Hello, I?m sending doveadm ?kick? commands to doveadm-server via the doveadm protocol. When ?kick? sends back a NOTFOUND error, though, it?s sending back additional output. strace shows: write(3<UNIX:[3158354->3156665]>, "\t\tkick\tmyssltest\n", 17) = 17 ... read(3<UNIX:[3158354->3156665]>, "\n-NOTFOUND\n\n-\n", 8192) = 14 Going by the protocol documentation (https://wiki2.dovecot.org/Design/DoveadmProtocol), there appear to be 3 extra bytes at the end of the server?s response: "\n-\n". Is this a bug in doveadm-server? Or am I misreading the protocol documentation? Thank you! cheers, -Felipe Gasper
I did a bit more digging, and the issue appears to manifest only when doveadm sends back an error code. Here is a ?user? and a ?kick?, both of which fail with error codes:> echo -ne 'VERSION\tdoveadm-server\t1\t0\nD\tharry\tuser\nD\t\tkick\tharry\n' | nc -U /var/run/dovecot/doveadm-server | xxd0000000: 2b0a 0a2d 5553 4147 450a 0a2d 0a0a 2d4e +..-USAGE..-..-N 0000010: 4f54 464f 554e 440a 0a2d 0a OTFOUND..-. Here is an ?auth?/?lookup? and a ?kick?, both of which fail, but only the ?kick? gives back an error code:> echo -ne 'VERSION\tdoveadm-server\t1\t0\nD\tharry\tauth\tlookup\nD\t\tkick\tharry\n' | nc -U /var/run/dovecot/doveadm-server | xxd0000000: 2b0a 0a2d 0a0a 2d4e 4f54 464f 554e 440a +..-..-NOTFOUND. 0000010: 0a2d 0a .-. I?m seeing this with 2.3.9.3. I?m going to try to recompile with some debug statements and see what I can suss out. -FG> On May 26, 2020, at 7:07 PM, Felipe Gasper <felipe at felipegasper.com> wrote: > > Hello, > > I?m sending doveadm ?kick? commands to doveadm-server via the doveadm protocol. When ?kick? sends back a NOTFOUND error, though, it?s sending back additional output. strace shows: > > write(3<UNIX:[3158354->3156665]>, "\t\tkick\tmyssltest\n", 17) = 17 > ... > read(3<UNIX:[3158354->3156665]>, "\n-NOTFOUND\n\n-\n", 8192) = 14 > > Going by the protocol documentation (https://wiki2.dovecot.org/Design/DoveadmProtocol), there appear to be 3 extra bytes at the end of the server?s response: "\n-\n". > > Is this a bug in doveadm-server? Or am I misreading the protocol documentation? > > Thank you! > > cheers, > -Felipe Gasper
It looks like doveadm_cmd_server_post() prints its responses, then client_handle_command() has this logic: if (doveadm_cmd_handle(conn, cmd_name, argc-2, args+2, &cctx) < 0) o_stream_nsend(conn->output, "\n-\n", 3); ? which will print the extra output. It looks simple enough to fix, but would that break anything? -FG> On May 26, 2020, at 8:07 PM, Felipe Gasper <felipe at felipegasper.com> wrote: > > I did a bit more digging, and the issue appears to manifest only when doveadm sends back an error code. > > Here is a ?user? and a ?kick?, both of which fail with error codes: > >> echo -ne 'VERSION\tdoveadm-server\t1\t0\nD\tharry\tuser\nD\t\tkick\tharry\n' | nc -U /var/run/dovecot/doveadm-server | xxd > 0000000: 2b0a 0a2d 5553 4147 450a 0a2d 0a0a 2d4e +..-USAGE..-..-N > 0000010: 4f54 464f 554e 440a 0a2d 0a OTFOUND..-. > > Here is an ?auth?/?lookup? and a ?kick?, both of which fail, but only the ?kick? gives back an error code: > >> echo -ne 'VERSION\tdoveadm-server\t1\t0\nD\tharry\tauth\tlookup\nD\t\tkick\tharry\n' | nc -U /var/run/dovecot/doveadm-server | xxd > 0000000: 2b0a 0a2d 0a0a 2d4e 4f54 464f 554e 440a +..-..-NOTFOUND. > 0000010: 0a2d 0a .-. > > I?m seeing this with 2.3.9.3. I?m going to try to recompile with some debug statements and see what I can suss out. > > -FG > > >> On May 26, 2020, at 7:07 PM, Felipe Gasper <felipe at felipegasper.com> wrote: >> >> Hello, >> >> I?m sending doveadm ?kick? commands to doveadm-server via the doveadm protocol. When ?kick? sends back a NOTFOUND error, though, it?s sending back additional output. strace shows: >> >> write(3<UNIX:[3158354->3156665]>, "\t\tkick\tmyssltest\n", 17) = 17 >> ... >> read(3<UNIX:[3158354->3156665]>, "\n-NOTFOUND\n\n-\n", 8192) = 14 >> >> Going by the protocol documentation (https://wiki2.dovecot.org/Design/DoveadmProtocol), there appear to be 3 extra bytes at the end of the server?s response: "\n-\n". >> >> Is this a bug in doveadm-server? Or am I misreading the protocol documentation? >> >> Thank you! >> >> cheers, >> -Felipe Gasper >