blob: e2983765b66024574c440366955e14e49d96a250 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include <stddef.h>
#include <pwd.h>
#include <string.h>
extern int _getpw(int *, char **, char **);
static struct passwd holdpw;
static char dirbuf[40] = "/usr/";
static char *rc = "/bin/rc";
struct passwd *
getpwuid(uid_t uid)
{
int num;
char *nam, *mem;
num = uid;
nam = 0;
mem = 0;
if(_getpw(&num, &nam, &mem)){
holdpw.pw_name = nam;
holdpw.pw_uid = num;
holdpw.pw_gid = num;
strncpy(dirbuf+5, nam, sizeof(dirbuf)-6);
holdpw.pw_dir = dirbuf;
holdpw.pw_shell = rc;
return &holdpw;
}
return NULL;
}
|