aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/chpass
diff options
context:
space:
mode:
authorDavid Nugent <davidn@FreeBSD.org>2000-06-28 00:24:45 +0000
committerDavid Nugent <davidn@FreeBSD.org>2000-06-28 00:24:45 +0000
commitd5c4e10f4bd26e96b45902671f1793ae38061b2e (patch)
tree84b163573c720832141bd64b27db683bfd469901 /usr.bin/chpass
parent2e334a213f50e540b328fa4f44f3a8fbd92b276f (diff)
Notes
Diffstat (limited to 'usr.bin/chpass')
-rw-r--r--usr.bin/chpass/Makefile4
-rw-r--r--usr.bin/chpass/edit.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/usr.bin/chpass/Makefile b/usr.bin/chpass/Makefile
index 6e26143ad06a..7966608938ce 100644
--- a/usr.bin/chpass/Makefile
+++ b/usr.bin/chpass/Makefile
@@ -27,8 +27,8 @@ COPTS+= -DYP -I. -I${.CURDIR}/../../libexec/ypxfr \
#Some people need this, uncomment to activate
#COPTS+= -DRESTRICT_FULLNAME_CHANGE
-DPADD= ${LIBRPCSVC} ${LIBCRYPT}
-LDADD+= -lrpcsvc -lcrypt
+DPADD= ${LIBRPCSVC} ${LIBCRYPT} ${LIBMD}
+LDADD+= -lrpcsvc -lcrypt -lmd
CLEANFILES= ${GENSRCS}
diff --git a/usr.bin/chpass/edit.c b/usr.bin/chpass/edit.c
index a8c5cc2c76c4..6311d5751508 100644
--- a/usr.bin/chpass/edit.c
+++ b/usr.bin/chpass/edit.c
@@ -43,6 +43,7 @@ static const char sccsid[] = "@(#)edit.c 8.3 (Berkeley) 4/2/94";
#include <ctype.h>
#include <err.h>
#include <errno.h>
+#include <md5.h>
#include <paths.h>
#include <pwd.h>
#include <stdio.h>
@@ -65,17 +66,23 @@ edit(pw)
struct passwd *pw;
{
struct stat begin, end;
+ char *begin_sum, *end_sum;
for (;;) {
if (stat(tempname, &begin))
pw_error(tempname, 1, 1);
+ begin_sum = MD5File(tempname, (char *)NULL);
pw_edit(1);
if (stat(tempname, &end))
pw_error(tempname, 1, 1);
- if (begin.st_mtime == end.st_mtime) {
+ end_sum = MD5File(tempname, (char *)NULL);
+ if ((begin.st_mtime == end.st_mtime) &&
+ (strcmp(begin_sum, end_sum) == 0)) {
warnx("no changes made");
pw_error(NULL, 0, 0);
}
+ free(begin_sum);
+ free(end_sum);
if (verify(pw))
break;
pw_prompt();