Shutdown: use PATH_DEFAULT as suggested by Paul Arthur in local bug #36101
Killall5/pidof: handle strange names of executables (local bug #36252) Sulogin: be aware the crypt(3) may fail (local bug #36313)
This commit is contained in:
parent
ec06765756
commit
1017641f3e
@ -39,6 +39,9 @@ sysvinit (2.89dsf) UNRELEASED; urgency=low
|
|||||||
was specified.
|
was specified.
|
||||||
* Sulogin: if zero is read at reading the passwd guess it's done.
|
* Sulogin: if zero is read at reading the passwd guess it's done.
|
||||||
* Sulogin: respect byte order that is do not mix chars and ints
|
* Sulogin: respect byte order that is do not mix chars and ints
|
||||||
|
* Shutdown: use PATH_DEFAULT as suggested by Paul Arthur in local bug #36101
|
||||||
|
* Killall5/pidof: handle strange names of executables (local bug #36252)
|
||||||
|
* Sulogin: be aware the crypt(3) may fail (local bug #36313)
|
||||||
|
|
||||||
[ Petter Reinholdtsen ]
|
[ Petter Reinholdtsen ]
|
||||||
* Next release will be 2.89dsf.
|
* Next release will be 2.89dsf.
|
||||||
|
@ -508,8 +508,10 @@ int readproc(int do_stat)
|
|||||||
|
|
||||||
/* Read SID & statname from it. */
|
/* Read SID & statname from it. */
|
||||||
if ((fp = fopen(path, "r")) != NULL) {
|
if ((fp = fopen(path, "r")) != NULL) {
|
||||||
if (!fgets(buf, sizeof(buf), fp))
|
size_t len;
|
||||||
buf[0] = '\0';
|
|
||||||
|
len = fread(buf, sizeof(char), sizeof(buf)-1, fp);
|
||||||
|
buf[len] = '\0';
|
||||||
|
|
||||||
if (buf[0] == '\0') {
|
if (buf[0] == '\0') {
|
||||||
nsyslog(LOG_ERR,
|
nsyslog(LOG_ERR,
|
||||||
|
@ -76,7 +76,7 @@ int got_alrm = 0;
|
|||||||
|
|
||||||
char *clean_env[] = {
|
char *clean_env[] = {
|
||||||
"HOME=/",
|
"HOME=/",
|
||||||
"PATH=/bin:/usr/bin:/sbin:/usr/sbin",
|
"PATH=" PATH_DEFAULT,
|
||||||
"TERM=dumb",
|
"TERM=dumb",
|
||||||
"SHELL=/bin/sh",
|
"SHELL=/bin/sh",
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -961,19 +961,30 @@ int main(int argc, char **argv)
|
|||||||
while (1) {
|
while (1) {
|
||||||
char *passwd = pwd->pw_passwd;
|
char *passwd = pwd->pw_passwd;
|
||||||
char *answer;
|
char *answer;
|
||||||
int failed = 0;
|
int failed = 0, doshell = 0;
|
||||||
|
|
||||||
doprompt(passwd, con);
|
doprompt(passwd, con);
|
||||||
if ((answer = getpasswd(con)) == NULL)
|
if ((answer = getpasswd(con)) == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (passwd[0] == '\0' ||
|
if (passwd[0] == '\0')
|
||||||
strcmp(crypt(answer, passwd), passwd) == 0) {
|
doshell++;
|
||||||
|
else {
|
||||||
|
char *cryptbuf;
|
||||||
|
cryptbuf = crypt(answer, passwd);
|
||||||
|
if (cryptbuf == NULL)
|
||||||
|
fprintf(stderr, "sulogin: crypt failed: %m\n\r");
|
||||||
|
else if (strcmp(cryptbuf, pwd->pw_passwd) == 0)
|
||||||
|
doshell++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doshell) {
|
||||||
*usemask |= (1<<con->id);
|
*usemask |= (1<<con->id);
|
||||||
sushell(pwd);
|
sushell(pwd);
|
||||||
*usemask &= ~(1<<con->id);
|
*usemask &= ~(1<<con->id);
|
||||||
failed++;
|
failed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
signal(SIGQUIT, SIG_IGN);
|
signal(SIGQUIT, SIG_IGN);
|
||||||
signal(SIGTSTP, SIG_IGN);
|
signal(SIGTSTP, SIG_IGN);
|
||||||
signal(SIGINT, SIG_IGN);
|
signal(SIGINT, SIG_IGN);
|
||||||
@ -987,7 +998,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (alarm_rised) {
|
if (alarm_rised) {
|
||||||
tcfinal(con);
|
tcfinal(con);
|
||||||
printf("Timed out.\n\r");
|
fprintf(stderr, "Timed out.\n\r");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* User may pressed Control-D.
|
* User may pressed Control-D.
|
||||||
|
Loading…
Reference in New Issue
Block a user