version 1.48, 2016/08/15 04:28:31 |
version 1.49, 2016/08/31 10:06:41 |
|
|
#include <util.h> |
#include <util.h> |
#include <login_cap.h> |
#include <login_cap.h> |
|
|
#define UNCHANGED_MSG "Password unchanged.\n" |
#define UNCHANGED_MSG "Password unchanged." |
|
|
static uid_t uid; |
static uid_t uid; |
extern int pwd_check(login_cap_t *, char *); |
extern int pwd_check(login_cap_t *, char *); |
|
|
if (uid != 0 && pw->pw_passwd[0] != '\0') { |
if (uid != 0 && pw->pw_passwd[0] != '\0') { |
p = getpass("Old password:"); |
p = getpass("Old password:"); |
if (p == NULL || *p == '\0') { |
if (p == NULL || *p == '\0') { |
(void)printf(UNCHANGED_MSG); |
(void)printf("%s\n", UNCHANGED_MSG); |
pw_abort(); |
pw_abort(); |
exit(p == NULL ? 1 : 0); |
exit(p == NULL ? 1 : 0); |
} |
} |
|
|
for (buf[0] = '\0', tries = 0;;) { |
for (buf[0] = '\0', tries = 0;;) { |
p = getpass("New password:"); |
p = getpass("New password:"); |
if (p == NULL || *p == '\0') { |
if (p == NULL || *p == '\0') { |
(void)printf(UNCHANGED_MSG); |
(void)printf("%s\n", UNCHANGED_MSG); |
pw_abort(); |
pw_abort(); |
exit(p == NULL ? 1 : 0); |
exit(p == NULL ? 1 : 0); |
} |
} |
|
|
return hash; |
return hash; |
} |
} |
|
|
/* ARGSUSED */ |
|
void |
void |
kbintr(int signo) |
kbintr(int signo) |
{ |
{ |
write(STDOUT_FILENO, "\n", 1); |
dprintf(STDOUT_FILENO, "\n%s\n", UNCHANGED_MSG); |
write(STDOUT_FILENO, UNCHANGED_MSG, sizeof(UNCHANGED_MSG) - 1); |
|
_exit(0); |
_exit(0); |
} |
} |