Date: Wed, 29 Oct 2003 00:14:41 +0100 From: "Timur I. Bakeyev" <timur@com.bat.ru> To: Steve Lee <maillist@blitzen.net> Cc: freebsd-current@freebsd.org Subject: Re: OpenLDAP/nss_ldap/pam_ldap Message-ID: <20031028231441.GA30635@com.bat.ru> In-Reply-To: <Pine.LNX.4.44.0310281448140.2069-100000@neptune.blitzen.net> References: <Pine.LNX.4.44.0310281448140.2069-100000@neptune.blitzen.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, Steve! On Tue, Oct 28, 2003 at 02:52:51PM -0800, Steve Lee wrote: > Question ? > > I am using FreeBSD 5.1 > > I have gotten FreeBSD 5.1 to authenticate user remotely > ssh ing to the box. They can log in, but when they log > in, the system shows their userid instead of the username > when you do a ps. this tells me something might be > wrong with nss_ldap. but not sure what i am doing wrong. > > I can do "id <username>" which it returns the user information. > > does anyone have an idea what i didn't do during my setup of > OpenLDAP/nss_ldap/pam_ldap ? Thanks. I would like to confirm that such weirdness exists... I do use nss_ldap and also noticed, that some of the programs, like ls, show numeric id of the user, when other, like top, show normal username, retrieved from LDAP server. Short investigation brought me to the conclusion, that the behaviour differs depending if the program was linked against libc statically or dynamically... This short code exposes the problem: #include <stdio.h> #include <pwd.h> int main () { struct passwd *pw = getpwuid(1002); printf("%s\n", (pw) ? pw->pw_name : "none"); } Instead of 1002 put the uid of the user from LDAP. If you compile this program as: gcc test.c -o test Which normally implies dynamic linking, when you should get username in the output. If you compile it as: gcc -static test.c -o test When "none" will be printed instead... So, the problem lays somewhere in the libc, in the way, how getpwuid and friends work in the dynamic and static context with NSS... I don't know, is this a bug or a feature :) If first, then, probably, PR should be created. With regards, Timur.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031028231441.GA30635>