Print

Print


Hi,

Brian told me that the printout of client's username has a limit of 8 characters
and as this is frequently too little for grid-username-slots I decided to have
to look into it.

So, I traced it down to usege of cuserid() in XrdClient/XrdClientSock.cc:487,
function:
    int XrdClientSock::Socks4Handshake(int sockid);
This function always returns at most L_cuserid - 1 characters, which is 8. So,
the username is truncated already in client, during handshake.

Here's what GNU manpage says about cuserid():

       Nobody knows precisely what cuserid() does; avoid it in  portable  pro-
       grams.   Or  avoid  it  altogether: use getpwuid(geteuid()) instead, if
       that is what you meant.  Do not use cuserid().

I played with this a bit on my machine, mini program attached. That's what I get
with a specially created username: :)

[root@greed tmp]# sudo -u alongusername666 ./xxx
getlogin='matevz'; _r='matevz', ret=0
cuserid='alonguse'
getpwuid='alongusername666' -- 0x7fff7513b2c0 vs 0x7fff7513b2c0

I can provide a patch using getpwuid(geteuid()) ... but can't really test it on
anything but GNU/Linux.

Cheers,
Matevz