12 static struct passwd pw_passwd
; /* password structure */
13 static FILE *passwd_fp
;
15 static char logname
[8];
16 static char password
[1024];
17 static char gecos
[1024];
18 static char dir
[1024];
19 static char shell
[1024];
28 if ((fp
= fopen ("/etc/passwd", "r")) == NULL
)
33 while (fgets (buf
, sizeof (buf
), fp
))
35 sscanf (buf
, "%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%s\n",
36 logname
, password
, &pw_passwd
.pw_uid
,
37 &pw_passwd
.pw_gid
, gecos
,
39 pw_passwd
.pw_name
= logname
;
40 pw_passwd
.pw_passwd
= password
;
41 pw_passwd
.pw_comment
= "";
42 pw_passwd
.pw_gecos
= gecos
;
43 pw_passwd
.pw_dir
= dir
;
44 pw_passwd
.pw_shell
= shell
;
46 if (!strcmp (logname
, name
))
62 if ((fp
= fopen ("/etc/passwd", "r")) == NULL
)
67 while (fgets (buf
, sizeof (buf
), fp
))
69 sscanf (buf
, "%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%s\n",
70 logname
, password
, &pw_passwd
.pw_uid
,
71 &pw_passwd
.pw_gid
, gecos
,
73 pw_passwd
.pw_name
= logname
;
74 pw_passwd
.pw_passwd
= password
;
75 pw_passwd
.pw_comment
= "";
76 pw_passwd
.pw_gecos
= gecos
;
77 pw_passwd
.pw_dir
= dir
;
78 pw_passwd
.pw_shell
= shell
;
80 if (uid
== pw_passwd
.pw_uid
)
95 if (passwd_fp
== NULL
)
98 if (fgets (buf
, sizeof (buf
), passwd_fp
) == NULL
)
101 sscanf (buf
, "%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%s\n",
102 logname
, password
, &pw_passwd
.pw_uid
,
103 &pw_passwd
.pw_gid
, gecos
,
105 pw_passwd
.pw_name
= logname
;
106 pw_passwd
.pw_passwd
= password
;
107 pw_passwd
.pw_comment
= "";
108 pw_passwd
.pw_gecos
= gecos
;
109 pw_passwd
.pw_dir
= dir
;
110 pw_passwd
.pw_shell
= shell
;
118 if (passwd_fp
!= NULL
)
121 passwd_fp
= fopen ("/etc/passwd", "r");
127 if (passwd_fp
!= NULL
)
131 #endif /* !_NO_GETPWENT */