TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: Carl Kreider, 71076,76 (X)
from: Mark Griffith 76070,41
date: 1990-08-09 06:19:51
subject: #Password functions

#: 5948 S3/Languages
    09-Aug-90  06:19:51
Sb: #Password functions
Fm: Mark Griffith 76070,41
To: Carl Kreider, 71076,76 (X)

Carl,

There seems to be a problem with the password functions.  In the example below,
the second call to get the name returns NULL in all cases.  If you swap the
functions, then same thing happens, i.e., the second call always returns a NULL
even if the name or uid exists.  Apparently something is not getting reset in
endpwent() ???  Any ideas?

    if (getpwuid(atoi(pw[ID]))) {
        fprintf (stderr, "\nUID %s is already used\n", pw[ID]);
        endpwent();
        exit(0);
    }

    endpwent();                 /* close password in case getpwuid fails */

    if (getpwnam(pw[NAME])) {
        fprintf (stderr, "\nUser %s already exists\n", pw[NAME]);
        endpwent();
        exit(0);
    }

    endpwent();                 /* close password in case getpwnam fails */

Mark



There is 1 Reply.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.