version 1.4, 1997/07/14 00:24:27 |
version 1.5, 2001/11/21 15:26:39 |
|
|
|
|
#ifndef lint |
#ifndef lint |
#if 0 |
#if 0 |
static char sccsid[] = "@(#)getname.c 8.1 (Berkeley) 6/6/93"; |
static const char sccsid[] = "@(#)getname.c 8.1 (Berkeley) 6/6/93"; |
#else |
#else |
static char rcsid[] = "$OpenBSD$"; |
static const char rcsid[] = "$OpenBSD$"; |
#endif |
#endif |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
|
|
* Search the passwd file for a uid. Return name on success, NULL on failure |
* Search the passwd file for a uid. Return name on success, NULL on failure |
*/ |
*/ |
char * |
char * |
getname(uid) |
getname(uid_t uid) |
int uid; |
|
{ |
{ |
struct passwd *pw; |
struct passwd *pw; |
|
|
|
|
* Convert the passed name to a user id and return it. Return -1 |
* Convert the passed name to a user id and return it. Return -1 |
* on error. |
* on error. |
*/ |
*/ |
int |
uid_t |
getuserid(name) |
getuserid(char *name) |
char name[]; |
|
{ |
{ |
struct passwd *pw; |
struct passwd *pw; |
|
|
if ((pw = getpwnam(name)) == NULL) |
if ((pw = getpwnam(name)) == NULL) |
return(-1); |
return(UID_MAX); |
return(pw->pw_uid); |
return(pw->pw_uid); |
} |
} |