Fixes for FreeBSD password change

This commit is contained in:
Michiel Broek 2002-01-11 21:07:04 +00:00
parent 0611bb92b6
commit d43b8b4e47
4 changed files with 12 additions and 9 deletions

View File

@ -93,7 +93,6 @@ static int def_loaded = 0; /* are defs already loaded? */
/* local function prototypes */ /* local function prototypes */
static struct itemdef *def_find (const char *); 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 * Loads the user-configured options from the default configuration file
*/ */
static void def_load(void) void def_load(void)
{ {
int i; int i;
FILE *fp; FILE *fp;

View File

@ -8,6 +8,6 @@ int getdef_bool(const char *);
long getdef_long(const char *, long); long getdef_long(const char *, long);
int getdef_num(const char *, int); int getdef_num(const char *, int);
char *getdef_str(const char *); char *getdef_str(const char *);
void def_load (void);
#endif /* _GETDEF_H */ #endif /* _GETDEF_H */

View File

@ -62,6 +62,7 @@
#include "pwio.h" #include "pwio.h"
#include "shadowio.h" #include "shadowio.h"
#include "pw_util.h" #include "pw_util.h"
#include "getdef.h"
#include "mbpasswd.h" #include "mbpasswd.h"
@ -732,6 +733,10 @@ int main(int argc, char *argv[])
#endif #endif
char *cp; char *cp;
/*
* Init $MBSE_ROOT/etc/login.defs file before the *pw gets overwritten.
*/
def_load();
/* /*
* Get my username * Get my username
@ -763,10 +768,10 @@ int main(int argc, char *argv[])
// Dit programma is een groot security gat. // Dit programma is een groot security gat.
if (argc != 4) { if (argc != 4) {
printf("\nmbpasswd commandline:\n\n"); fprintf(stderr, "\nmbpasswd commandline:\n\n");
printf("mbpasswd [-opt] [username] [newpassword]\n"); fprintf(stderr, "mbpasswd [-opt] [username] [newpassword]\n");
printf("options are: -n normal password change\n"); fprintf(stderr, "options are: -n normal password change\n");
printf(" -f forced password change\n"); fprintf(stderr, " -f forced password change\n");
exit(E_FAILURE); exit(E_FAILURE);
} }
@ -832,7 +837,6 @@ int main(int argc, char *argv[])
#else #else
cp = pw->pw_passwd; cp = pw->pw_passwd;
#endif #endif
/* /*
* See if the user is permitted to change the password. * See if the user is permitted to change the password.
* Otherwise, go ahead and set a new password. * Otherwise, go ahead and set a new password.

View File

@ -193,7 +193,7 @@ int pw_mkdb(char *username)
syslog(LOG_WARNING, "rebuilding the database..."); syslog(LOG_WARNING, "rebuilding the database...");
execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname, NULL); execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname, NULL);
} else { } 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); execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-u", username, tempname, NULL);
} }
pw_error((char *)_PATH_PWD_MKDB, 1, 1); pw_error((char *)_PATH_PWD_MKDB, 1, 1);