Collect auth requirements for bidirectional source peers and fix follow-up review findings

This commit is contained in:
Viktor Liu
2026-08-29 09:57:07 +02:00
parent 1c10c19d45
commit ec320278e3
5 changed files with 60 additions and 29 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ var (
func init() {
vncAgentCmd.Flags().StringVar(&vncAgentSocket, "socket", "", "Unix-domain socket path the agent listens on (required)")
vncAgentCmd.Flags().Uint32Var(&vncAgentTargetUID, "target-uid", 0, "uid the agent should drop privileges to before listening (darwin only; 0 = stay as current uid)")
vncAgentCmd.Flags().Uint32Var(&vncAgentTargetUID, "target-uid", 0, "uid the agent drops privileges to before listening (darwin only; required there, and must not be 0)")
rootCmd.AddCommand(vncAgentCmd)
}
+6 -3
View File
@@ -69,13 +69,16 @@ func (c *xfixesCursor) Cursor() (*image.RGBA, int, int, uint64, error) {
return nil, 0, 0, 0, fmt.Errorf("cursor has zero extent")
}
// Anything past maxCursorDim is discarded by the encoder, so decoding it
// would allocate and convert a sprite that can only be thrown away. Keep
// showing the last good cursor instead.
// would allocate and convert a sprite that can only be thrown away. Report
// it as "nothing new" rather than an error: the caller latches a cursor
// error for the rest of the session, and an oversized sprite is a property
// of the current cursor, not of the source. The next ordinary cursor is
// still delivered.
if w > maxCursorDim || h > maxCursorDim {
if c.lastImg != nil {
return c.lastImg, c.lastHotX, c.lastHotY, c.lastSerial, nil
}
return nil, 0, 0, 0, fmt.Errorf("cursor %dx%d exceeds %d", w, h, maxCursorDim)
return nil, 0, 0, 0, nil
}
if len(reply.CursorImage) < w*h {
if c.lastImg != nil {
+6 -6
View File
@@ -273,15 +273,15 @@ func (x *X11InputInjector) TypeText(text string) {
if !ok {
continue
}
x.typeRuneLocked(keysym, shift)
x.typeRune(keysym, shift)
}
}
// typeRuneLocked emits one rune, framed by Shift-down/up when the keysym needs
// it. Locked per rune rather than for the whole string: the framing has to be
// atomic, but a long paste must not hold another session's pointer off for the
// length of it.
func (x *X11InputInjector) typeRuneLocked(keysym uint32, shift bool) {
// typeRune emits one rune, framed by Shift-down/up when the keysym needs it. It
// takes inputMu itself, per rune rather than for the whole string: the framing
// has to be atomic, but a long paste must not hold another session's pointer
// off for the length of it.
func (x *X11InputInjector) typeRune(keysym uint32, shift bool) {
x.inputMu.Lock()
defer x.inputMu.Unlock()