From d43b8b4e47cace8877e473aa32b39ca88eb9a781 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Fri, 11 Jan 2002 21:07:04 +0000 Subject: [PATCH] Fixes for FreeBSD password change --- unix/getdef.c | 3 +-- unix/getdef.h | 2 +- unix/mbpasswd.c | 14 +++++++++----- unix/pw_util.c | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/unix/getdef.c b/unix/getdef.c index 3ef67a3d..1e49fb88 100644 --- a/unix/getdef.c +++ b/unix/getdef.c @@ -93,7 +93,6 @@ static int def_loaded = 0; /* are defs already loaded? */ /* local function prototypes */ static struct itemdef *def_find (const char *); -static void def_load (void); @@ -229,7 +228,7 @@ static struct itemdef *def_find(const char *name) * * Loads the user-configured options from the default configuration file */ -static void def_load(void) +void def_load(void) { int i; FILE *fp; diff --git a/unix/getdef.h b/unix/getdef.h index 641a4371..a96d987d 100644 --- a/unix/getdef.h +++ b/unix/getdef.h @@ -8,6 +8,6 @@ int getdef_bool(const char *); long getdef_long(const char *, long); int getdef_num(const char *, int); char *getdef_str(const char *); - +void def_load (void); #endif /* _GETDEF_H */ diff --git a/unix/mbpasswd.c b/unix/mbpasswd.c index 6d52f168..7a9e3c9a 100644 --- a/unix/mbpasswd.c +++ b/unix/mbpasswd.c @@ -62,6 +62,7 @@ #include "pwio.h" #include "shadowio.h" #include "pw_util.h" +#include "getdef.h" #include "mbpasswd.h" @@ -732,6 +733,10 @@ int main(int argc, char *argv[]) #endif char *cp; + /* + * Init $MBSE_ROOT/etc/login.defs file before the *pw gets overwritten. + */ + def_load(); /* * Get my username @@ -763,10 +768,10 @@ int main(int argc, char *argv[]) // Dit programma is een groot security gat. if (argc != 4) { - printf("\nmbpasswd commandline:\n\n"); - printf("mbpasswd [-opt] [username] [newpassword]\n"); - printf("options are: -n normal password change\n"); - printf(" -f forced password change\n"); + fprintf(stderr, "\nmbpasswd commandline:\n\n"); + fprintf(stderr, "mbpasswd [-opt] [username] [newpassword]\n"); + fprintf(stderr, "options are: -n normal password change\n"); + fprintf(stderr, " -f forced password change\n"); exit(E_FAILURE); } @@ -832,7 +837,6 @@ int main(int argc, char *argv[]) #else cp = pw->pw_passwd; #endif - /* * See if the user is permitted to change the password. * Otherwise, go ahead and set a new password. diff --git a/unix/pw_util.c b/unix/pw_util.c index 7a49deec..b0726794 100644 --- a/unix/pw_util.c +++ b/unix/pw_util.c @@ -193,7 +193,7 @@ int pw_mkdb(char *username) syslog(LOG_WARNING, "rebuilding the database..."); execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname, NULL); } else { - syslog(LOG_WARNING, "updating the database..."); + syslog(LOG_WARNING, "updating the database for %s...", username); execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-u", username, tempname, NULL); } pw_error((char *)_PATH_PWD_MKDB, 1, 1);