if (forkret == 0) {
/* child process */
+ uid_t uid;
+
close(child_out[0]);
close(child_in[1]);
/* run winbind as the user that invoked pppd */
setgid(getgid());
- setuid(getuid());
+ uid = getuid();
+ if (setuid(uid) == -1 || getuid() != uid)
+ fatal("pppd/winbind: could not setuid to %d: %m", uid);
execl("/bin/sh", "sh", "-c", ntlm_auth, NULL);
- perror("pppd/winbind: could not exec /bin/sh");
- exit(1);
+ fatal("pppd/winbind: could not exec /bin/sh: %m");
}
/* parent */
/* parent */
if (close(child_out[0]) == -1) {
+ close(child_in[1]);
notice("error closing pipe?!? for child OUT[0]");
return NOT_AUTHENTICATED;
}
return NOT_AUTHENTICATED;
}
- while ((wait(&status) == -1) && errno == EINTR)
+ while ((wait(&status) == -1) && errno == EINTR && !got_sigterm)
;
if ((authenticated == AUTHENTICATED) && nt_key && !got_user_session_key) {