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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
int
do_gpwent(which,gimme,arglast)
int which;
int gimme;
int *arglast;
{
#ifdef I_PWD
register ARRAY *ary = stack;
register int sp = arglast[0];
register STR *TARG;
struct passwd *getpwnam();
struct passwd *getpwuid();
struct passwd *getpwent();
struct passwd *pwent;
if (which == O_GPWNAM) {
char *name = str_get(ary->ary_array[sp+1]);
pwent = getpwnam(name);
}
else if (which == O_GPWUID) {
int uid = (int)str_gnum(ary->ary_array[sp+1]);
pwent = getpwuid(uid);
}
else
pwent = getpwent();
if (gimme != G_ARRAY) {
astore(ary, ++sp, TARG = str_mortal(&str_undef));
if (pwent) {
if (which == O_GPWNAM)
str_numset(TARG, (double)pwent->pw_uid);
else
str_set(TARG, pwent->pw_name);
}
return sp;
}
if (pwent) {
(void)astore(ary, ++sp, TARG = str_mortal(&str_no));
str_set(TARG, pwent->pw_name);
(void)astore(ary, ++sp, TARG = str_mortal(&str_no));
str_set(TARG, pwent->pw_passwd);
(void)astore(ary, ++sp, TARG = str_mortal(&str_no));
str_numset(TARG, (double)pwent->pw_uid);
(void)astore(ary, ++sp, TARG = str_mortal(&str_no));
str_numset(TARG, (double)pwent->pw_gid);
(void)astore(ary, ++sp, TARG = str_mortal(&str_no));
#ifdef PWCHANGE
str_numset(TARG, (double)pwent->pw_change);
#else
#ifdef PWQUOTA
str_numset(TARG, (double)pwent->pw_quota);
#else
#ifdef PWAGE
str_set(TARG, pwent->pw_age);
#endif
#endif
#endif
(void)astore(ary, ++sp, TARG = str_mortal(&str_no));
#ifdef PWCLASS
str_set(TARG,pwent->pw_class);
#else
#ifdef PWCOMMENT
str_set(TARG, pwent->pw_comment);
#endif
#endif
(void)astore(ary, ++sp, TARG = str_mortal(&str_no));
str_set(TARG, pwent->pw_gecos);
(void)astore(ary, ++sp, TARG = str_mortal(&str_no));
str_set(TARG, pwent->pw_dir);
(void)astore(ary, ++sp, TARG = str_mortal(&str_no));
str_set(TARG, pwent->pw_shell);
#ifdef PWEXPIRE
(void)astore(ary, ++sp, TARG = str_mortal(&str_no));
str_numset(TARG, (double)pwent->pw_expire);
#endif
}
return sp;
#else
fatal("password routines not implemented");
#endif
}
|