Add quarantined Xorg destination-key ownership and cleanup
This commit is contained in:
1 parent
792cac5d0b
commit
cd9ae05bbe
10 files changed
+988
-29
No files matched your search
@@ -6,7 +6,8 @@ package tentaclewire
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
|
||||
"git.stormux.org/storm/cthulhu/internal/input"
|
||||
)
|
||||
|
||||
const RemoteKeyQueueSize = 256
|
||||
@@ -25,32 +26,7 @@ type RemoteKeyRequest struct {
|
||||
Key RemoteKey `json:"key"`
|
||||
}
|
||||
|
||||
func ValidRemoteKey(key RemoteKey) bool {
|
||||
name := key.Name
|
||||
if len(name) == 1 && (name[0] >= 'a' && name[0] <= 'z' || name[0] >= '0' && name[0] <= '9') {
|
||||
return true
|
||||
}
|
||||
if len(name) >= 2 && len(name) <= 3 && name[0] == 'F' {
|
||||
number, err := strconv.Atoi(name[1:])
|
||||
return err == nil && number >= 1 && number <= 24 && strconv.Itoa(number) == name[1:]
|
||||
}
|
||||
if len(name) == 4 && name[:3] == "KP_" && name[3] >= '0' && name[3] <= '9' {
|
||||
return true
|
||||
}
|
||||
switch name {
|
||||
case "BackSpace", "Tab", "Return", "Escape", "space", "Pause", "Print", "Menu",
|
||||
"Caps_Lock", "Num_Lock", "Scroll_Lock", "Shift_L", "Shift_R", "Control_L", "Control_R",
|
||||
"Alt_L", "Alt_R", "Super_L", "Super_R", "Page_Up", "Page_Down", "End", "Home",
|
||||
"Left", "Up", "Right", "Down", "Insert", "Delete",
|
||||
"KP_Begin", "KP_Enter", "KP_Page_Up", "KP_Page_Down", "KP_End", "KP_Home",
|
||||
"KP_Left", "KP_Up", "KP_Right", "KP_Down", "KP_Insert", "KP_Delete",
|
||||
"KP_Multiply", "KP_Add", "KP_Separator", "KP_Subtract", "KP_Decimal", "KP_Divide",
|
||||
"semicolon", "equal", "comma", "minus", "period", "slash", "grave", "bracketleft",
|
||||
"backslash", "bracketright", "apostrophe":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
func ValidRemoteKey(key RemoteKey) bool { return input.ValidRemoteKeyName(key.Name) }
|
||||
|
||||
func ValidRemoteKeyRequest(request RemoteKeyRequest) bool {
|
||||
return len(request.Lease) == 32 && request.Epoch != 0 && request.Sequence != 0 && ValidRemoteKey(request.Key)
|
||||
|
||||
Reference in new issue
Block a user