From 85dde8c7cb56614ec32f58af50ddf73460b6c0ba Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 12 Nov 1998 01:22:07 +0000 Subject: Added enable user button. Fixed bug where log was always printed. Jeremy. (This used to be commit 43ddc857793ffe507017fc989d60403e33e2ada3) --- source3/web/swat.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'source3') diff --git a/source3/web/swat.c b/source3/web/swat.c index 038829337d..1030689f18 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -40,6 +40,7 @@ char new2_pswd[] = "new2_passwd"; char chg_passwd_flag[] = "chg_passwd_flag"; char add_user_flag[] = "add_user_flag"; char disable_user_flag[] = "disable_user_flag"; +char enable_user_flag[] = "enable_user_flag"; /* we need these because we link to locking*.o */ void become_root(BOOL save_dir) {} @@ -626,9 +627,9 @@ static BOOL talk_to_smbpasswd(char *old, char *new) close(fd2[1]); /* parent doesn't need output side of pipe fd2 */ /* - * smbpasswd doesn't require any input to disable a user + * smbpasswd doesn't require any input to disable or enable a user */ - if (cgi_variable(disable_user_flag)) { + if (!cgi_variable(disable_user_flag) && !cgi_variable(enable_user_flag)) { /* * smbpasswd requires a regular old user to send their old password */ @@ -742,6 +743,13 @@ static BOOL talk_to_smbpasswd(char *old, char *new) if (execl(SMB_PASSWD_PROGRAM, "smbpasswd", "-s", "-d", cgi_variable(user), (char *) 0) < 0) { printf("

execl error of smbpasswd"); } + } else if (cgi_variable(enable_user_flag)) { + /* + * Enable a user + */ + if (execl(SMB_PASSWD_PROGRAM, "smbpasswd", "-s", "-e", cgi_variable(user), (char *) 0) < 0) { + printf("

execl error of smbpasswd"); + } } else { /* * Change a users password @@ -848,10 +856,10 @@ static void chg_passwd(void) } /* - * smbpasswd doesn't require anything but the users name to disable the user, + * smbpasswd doesn't require anything but the users name to disable or enable the user, * so if that's what we're doing, skip the rest of the checks */ - if (!cgi_variable(disable_user_flag)) { + if (!cgi_variable(disable_user_flag) && !cgi_variable(enable_user_flag)) { /* If current user is not root, make sure old password has been specified */ if ((am_root() == False) && (strlen( cgi_variable(old_pswd)) <= 0)) { @@ -886,7 +894,7 @@ static void chg_passwd(void) } } -#ifndef SWAT_DEBUG +#ifdef SWAT_DEBUG if (pass) printf("

User uid %d gid %d \n", pass->pw_uid, pass->pw_gid); printf("

Processes uid %d, euid %d, gid %d, egid %d \n",getuid(),geteuid(),getgid(),getegid()); printf("

User Name %s \n", cgi_variable(user)); @@ -897,6 +905,7 @@ static void chg_passwd(void) (cgi_variable( chg_passwd_flag) ? cgi_variable( chg_passwd_flag) : ""), (cgi_variable( add_user_flag) ? cgi_variable( add_user_flag) : ""), (cgi_variable( disable_user_flag) ? cgi_variable( disable_user_flag) : "")); + (cgi_variable( enable_user_flag) ? cgi_variable( enable_user_flag) : "")); #endif /* SWAT_DEBUG */ @@ -951,6 +960,7 @@ static void passwd_page(void) if (am_root() == True) { printf("", add_user_flag); printf("", disable_user_flag); + printf("", enable_user_flag); } printf("\n"); -- cgit