identd(8) response to first request has garbage appended

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

identd(8) response to first request has garbage appended

Simon Kuhnle-2
>Synopsis: identd appends garbage bytes at the end of the username on the first response
>Category: user
>Environment:
        System      : OpenBSD 5.4
        Details     : OpenBSD 5.4-current (GENERIC.MP) #119: Tue Dec 31 16:48:37 MST 2013
                         [hidden email]:/usr/src/sys/arch/sparc64/compile/GENERIC.MP

        Architecture: OpenBSD.sparc64
        Machine     : sparc64
>Description:
On this sparc64 -current system, the first request sent to the identd generates
a reply with the correct username, but with 2 bytes of garbage appended at the
end, triggering an error message from the IRC daemon I am trying to connect to:

  ERROR Closing Link: foobar[simon`�@example.com] (Invalid username)

All requests after that are correct and do not contain garbage bytes.
It seems like something is not correctly zeroed on startup?

>How-To-Repeat:
Connect to a random IRC daemon requesting your ident.
I can reproduce the behaviour everytime by restarting the identd via rc.d

>Fix:
None.


dmesg:
OpenBSD 5.4-current (GENERIC.MP) #119: Tue Dec 31 16:48:37 MST 2013
    [hidden email]:/usr/src/sys/arch/sparc64/compile/GENERIC.MP
real mem = 1073741824 (1024MB)
avail mem = 1042767872 (994MB)
mainbus0 at root: Sun Ultra 60 UPA/PCI (2 X UltraSPARC-II 360MHz)
cpu0 at mainbus0: SUNW,UltraSPARC-II (rev 10.0) @ 360.006 MHz
cpu0: physical 16K instruction (32 b/l), 16K data (32 b/l), 4096K external (64 b/l)
cpu1 at mainbus0: SUNW,UltraSPARC-II (rev 10.0) @ 360.006 MHz
cpu1: physical 16K instruction (32 b/l), 16K data (32 b/l), 4096K external (64 b/l)
psycho0 at mainbus0 addr 0xfffb4000: SUNW,psycho, impl 0, version 4, ign 7c0
psycho0: bus range 0-0, PCI bus 0
psycho0: dvma map fe000000-ffffffff, STC0 enabled
pci0 at psycho0
ebus0 at pci0 dev 1 function 0 "Sun PCIO EBus2" rev 0x01
auxio0 at ebus0 addr 726000-726003, 728000-728003, 72a000-72a003, 72c000-72c003, 72f000-72f003
power0 at ebus0 addr 724000-724003
"SUNW,pll" at ebus0 addr 504000-504002 not configured
uperf0 at ebus0 addr 500000-500007: model SUNW,sc-qp (0/1) ports 9
sab0 at ebus0 addr 400000-40007f ivec 0x2b: rev 3.2
sabtty0 at sab0 port 0: console
sabtty1 at sab0 port 1
comkbd0 at ebus0 addr 3083f8-3083ff ivec 0x29: no keyboard
comms0 at ebus0 addr 3062f8-3062ff ivec 0x2a
wsmouse0 at comms0 mux 0
lpt0 at ebus0 addr 3043bc-3043cb, 300398-300399, 700000-70000f ivec 0x22: polled
"fdthree" at ebus0 addr 3023f0-3023f7, 706000-70600f, 720000-720003 ivec 0x27 not configured
clock1 at ebus0 addr 0-1fff: mk48t59
"flashprom" at ebus0 addr 0-fffff not configured
audioce0 at ebus0 addr 200000-2000ff, 702000-70200f, 704000-70400f, 722000-722003 ivec 0x23 ivec 0x24: nvaddrs 0
audio0 at audioce0
hme0 at pci0 dev 1 function 1 "Sun HME" rev 0x01: ivec 0x7e1, address 08:00:20:b8:e0:11
qsphy0 at hme0 phy 1: QS6612 10/100 PHY, rev. 1
siop0 at pci0 dev 3 function 0 "Symbios Logic 53c875" rev 0x14: ivec 0x7e0, using 4K of on-board RAM
scsibus0 at siop0: 16 targets, initiator 7
sd0 at scsibus0 targ 0 lun 0: <SEAGATE, SX173404LC, BD13> SCSI3 0/direct fixed serial.SEAGATE_SX173404LC_3CE06PDG_7109X3UP
sd0: 70007MB, 512 bytes/sector, 143374738 sectors
sd1 at scsibus0 targ 1 lun 0: <SEAGATE, SX173404LC, BD13> SCSI3 0/direct fixed serial.SEAGATE_SX173404LC_3CE0BHT9_71503GBY
sd1: 70007MB, 512 bytes/sector, 143374738 sectors
cd0 at scsibus0 targ 6 lun 0: <TOSHIBA, XM6201TASUN32XCD, 1103> SCSI2 5/cdrom removable
siop1 at pci0 dev 3 function 1 "Symbios Logic 53c875" rev 0x14: ivec 0x7e6, using 4K of on-board RAM
scsibus1 at siop1: 16 targets, initiator 7
psycho1 at mainbus0 addr 0xfffc6000: SUNW,psycho, impl 0, version 4, ign 7c0
psycho1: bus range 128-128, PCI bus 128
psycho1: dvma map fe000000-ffffffff, STC0 enabled, STC1 enabled
pci1 at psycho1
"counter-timer" at mainbus0 addr 0xfff9fc00 not configured
creator0 at mainbus0: Creator3D, model SUNW,501-4788, dac 10
wsdisplay0 at creator0 mux 1
wsdisplay0: screen 0 added (std, sun emulation)
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
siop0: target 0 now using tagged 16 bit 20.0 MHz 16 REQ/ACK offset xfers
siop0: target 1 now using tagged 16 bit 20.0 MHz 16 REQ/ACK offset xfers
bootpath: /pci@1f,4000/scsi@3,0/disk@0,0
root on sd0a (9d94abe270711abd.a) swap on sd0b dump on sd0b

usbdevs:
usbdevs: no USB controllers found

Reply | Threaded
Open this post in threaded view
|

Re: identd(8) response to first request has garbage appended

David Gwynne-5
On Mon, Jan 06, 2014 at 01:57:28PM +0100, Simon Kuhnle wrote:
> >Synopsis: identd appends garbage bytes at the end of the username on the first response

hey simon,

i was able to reproduce this and came up with the following fix.
ill commit it now, so you should be able to just cvs up to get it.

thanks for the report :)

cheers,
dlg

Index: identd.c
===================================================================
RCS file: /cvs/src/usr.sbin/identd/identd.c,v
retrieving revision 1.23
diff -u -p -r1.23 identd.c
--- identd.c 21 Nov 2013 03:09:07 -0000 1.23
+++ identd.c 7 Jan 2014 00:05:18 -0000
@@ -395,7 +395,7 @@ parent_rd(int fd, short events, void *ar
  goto done;
  }
 
- r->buflen = n;
+ r->buflen = n + 1;
 
 done:
  SIMPLEQ_INSERT_TAIL(&sc.parent.replies, r, entry);