Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

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