do endpwent(3).
This commit is contained in:
parent
5191d27807
commit
c6e4953622
1 changed files with 9 additions and 8 deletions
|
|
@ -46,8 +46,8 @@ exec_auth()
|
||||||
pid_t child_pid = -1;
|
pid_t child_pid = -1;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
if (socketpair(AF_LOCAL, SOCK_STREAM, PF_UNSPEC, socks) == -1) {
|
if (socketpair(AF_LOCAL, SOCK_STREAM, PF_UNSPEC, socks) == -1) {
|
||||||
fprintf(stderr, "socketpair() failed");
|
fprintf(stderr, "socketpair() failed");
|
||||||
exit(255);
|
exit(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,11 +63,11 @@ exec_auth()
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = SA_RESTART;
|
sa.sa_flags = SA_RESTART;
|
||||||
sa.sa_handler = SIG_DFL;
|
sa.sa_handler = SIG_DFL;
|
||||||
for (i = 1; i < NSIG; i++)
|
for (i = 1; i < NSIG; i++)
|
||||||
sigaction(i, &sa, NULL);
|
sigaction(i, &sa, NULL);
|
||||||
|
|
||||||
strlcpy(chroot_dir, "/", sizeof(chroot_dir));
|
strlcpy(chroot_dir, "/", sizeof(chroot_dir));
|
||||||
set_priv("[auth]");
|
set_priv("[auth]");
|
||||||
|
|
@ -82,7 +82,7 @@ exec_auth()
|
||||||
if (may_read(socks[0], &cmd, sizeof(int)))
|
if (may_read(socks[0], &cmd, sizeof(int)))
|
||||||
break;
|
break;
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case AUTH_GETUGID:
|
case AUTH_GETUGID:
|
||||||
/* length, user name */
|
/* length, user name */
|
||||||
must_read(socks[0], &username_len, sizeof(size_t));
|
must_read(socks[0], &username_len, sizeof(size_t));
|
||||||
if (username_len == 0 || username_len > sizeof(username))
|
if (username_len == 0 || username_len > sizeof(username))
|
||||||
|
|
@ -99,6 +99,7 @@ exec_auth()
|
||||||
ret = 0;
|
ret = 0;
|
||||||
must_write(socks[0], &ret, sizeof(int));
|
must_write(socks[0], &ret, sizeof(int));
|
||||||
}
|
}
|
||||||
|
endpwent();
|
||||||
break;
|
break;
|
||||||
case AUTH_EXIT:
|
case AUTH_EXIT:
|
||||||
close(socks[0]);
|
close(socks[0]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue