glibc 2.3.6 and setlogin

Andrew Benton b3nt at ukonline.co.uk
Fri Nov 25 04:00:06 PST 2005


Dan Osterrath wrote:
> Hi,
> 
> I've tried to compile the current rc1 for kde 3.5.0. Everything build
> fine and even seems tu run fine except for kdm. Everytime I try to login
> it fails with the error message "setlogin for <username> failed:
> Function not implemented".
> 
> I investigated a little bit and found out that setlogin from glibc
> always fails. So I wrote a little test program:
> ---------------------------------------
> #include <stdio.h>
> 
> int main(int argc, char **argv) {
>         if (argc < 2) {
>                 printf("no login given: %s <loginname>\n", argv[0]);
>                 exit(2);
>         }
>         if (setlogin(argv[1]) < 0) {
>                 printf("could not setlogin to %s\n", argv[1]);
>                 exit(1);
>         } else {
>                 printf("setlogin successful\n");
>                 exit(0);
>         }
> }
> ---------------------------------------
> 
> When compiling the gcc already shows the problem:
> 
> -bash-3.00# gcc setlogintest.c -o setlogintest
> /tmp/cc2G2SBZ.o(.text+0x4f): In function `main':
> : warning: warning: setlogin is not implemented and will always fail
> 
That's just a warning. Your program still compiles

> And indeed in the glibc 2.3.6 source there were only two implementations
> for setlogin. One for hurd and one for generic, which always returns
> "not implemented".
> 
> So what's wrong here? Is my glibc faulty? Is there anything missing? Or
> is kdm (whose source code is derived from xdm) buggy and uses a not yet
> implemented function?
> 
> Could anyone test the upper test program?
> 
I compiled it

andy:~$ gcc setlogintest.c -o setlogintest
setlogintest.c: In function ‘main’:
setlogintest.c:6: warning: incompatible implicit declaration of built-in function ‘exit’
setlogintest.c:10: warning: incompatible implicit declaration of built-in function ‘exit’
setlogintest.c:13: warning: incompatible implicit declaration of built-in function ‘exit’
/tmp/ccAfTStR.o: In function `main':
setlogintest.c:(.text+0x4f): warning: warning: setlogin is not implemented and will always fail 

And despite the warnings it compiled and does run but it doesn't work

andy:~$ /home/andy/setlogintest eddie
could not setlogin to eddie

However, Gnome's gdm works fine so maybe it's not important? FWIW I'm using glibc-cvs from the 6th of nov



More information about the lfs-support mailing list