diff -ruN pw.orig/Makefile pw.new/Makefile --- pw.orig/Makefile Mon Oct 2 14:12:37 2000 +++ pw.new/Makefile Mon Feb 5 15:23:02 2001 @@ -11,8 +12,16 @@ #RND= -DUSE_MD5RAND CFLAGS+= -W -Wall $(CDB) $(RND) -LDADD= -lcrypt -lutil -DPADD= ${LIBCRYPT} ${LIBUTIL} +LDADD= -lutil +DPADD= ${LIBUTIL} + +## FreeBSD +#CFLAGS+= -DHAVE_LOGIN_CAP -DHAVE_STRFTIME_EF +#LDADD+= -lcrypt +#DPADD+= ${LIBCRYPT} + +## OpenBSD + BINMODE=0555 diff -ruN pw.orig/pw_user.c pw.new/pw_user.c --- pw.orig/pw_user.c Mon Oct 2 14:12:37 2000 +++ pw.new/pw_user.c Mon Feb 5 15:18:13 2001 @@ -42,7 +42,9 @@ #include #include #include +#if defined(HAVE_LOGIN_CAP) #include +#endif #if defined(USE_MD5RAND) #include #endif @@ -545,6 +547,7 @@ } if ((arg = getarg(args, 'w')) != NULL && getarg(args, 'h') == NULL) { +#if defined(HAVE_LOGIN_CAP) login_cap_t *lc; lc = login_getpwclass(pwd); @@ -552,12 +555,15 @@ login_setcryptfmt(lc, "md5", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); +#endif pwd->pw_passwd = pw_password(cnf, args, pwd->pw_name); edited = 1; } } else { +#ifdef HAVE_LOGIN_CAP login_cap_t *lc; +#endif /* * Add code @@ -580,10 +586,12 @@ pwd->pw_expire = pw_exppolicy(cnf, args); pwd->pw_dir = pw_homepolicy(cnf, args, pwd->pw_name); pwd->pw_shell = pw_shellpolicy(cnf, args, NULL); +#ifdef HAVE_LOGIN_CAP lc = login_getpwclass(pwd); if (lc == NULL || login_setcryptfmt(lc, "md5", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); +#endif pwd->pw_passwd = pw_password(cnf, args, pwd->pw_name); edited = 1; @@ -613,7 +621,9 @@ int b; int istty = isatty(fd); struct termios t; +#ifdef HAVE_LOGIN_CAP login_cap_t *lc; +#endif if (istty) { if (tcgetattr(fd, &t) == -1) @@ -643,11 +653,13 @@ *p = '\0'; if (!*line) errx(EX_DATAERR, "empty password read on file descriptor %d", fd); +#ifdef HAVE_LOGIN_CAP lc = login_getpwclass(pwd); if (lc == NULL || login_setcryptfmt(lc, "md5", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); +#endif pwd->pw_passwd = pw_pwcrypt(line); edited = 1; } @@ -1172,9 +1184,17 @@ *p = (char) toupper((unsigned char)*p); } if (pwd->pw_expire > (time_t)0 && (tptr = localtime(&pwd->pw_expire)) != NULL) - strftime(acexpire, sizeof acexpire, "%a %Ef %Y %X", tptr); +#ifdef HAVE_STRFTIME_EF + strftime(acexpire, sizeof acexpire, "%a %Ef %Y %X", tptr); +#else + strftime(acexpire, sizeof acexpire, "%a %d %b %Y", tptr); +#endif if (pwd->pw_change > (time_t)0 && (tptr = localtime(&pwd->pw_change)) != NULL) - strftime(pwexpire, sizeof pwexpire, "%a %Ef %Y %X", tptr); +#ifdef HAVE_STRFTIME_EF + strftime(pwexpire, sizeof pwexpire, "%a %Ef %Y %X", tptr); +#else + strftime(pwexpire, sizeof pwexpire, "%a %d %b %Y", tptr); +#endif printf("Login Name: %-15s #%-12ld Group: %-15s #%ld\n" " Full Name: %s\n" " Home: %-26.26s Class: %s\n"