summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/chgpasswd.c26
-rw-r--r--source3/smbd/dosmode.c4
-rw-r--r--source3/smbd/password.c6
3 files changed, 20 insertions, 16 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index b6aaf4765b..1f1ee96713 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -412,7 +412,8 @@ static BOOL chat_with_program(char *passwordprogram, char *name,
alarm(20);
if (as_root)
- become_root(False);
+ become_root();
+
DEBUG(3,
("Dochild for user %s (uid=%d,gid=%d)\n", name,
(int)getuid(), (int)getgid()));
@@ -420,6 +421,9 @@ static BOOL chat_with_program(char *passwordprogram, char *name,
dochild(master, slavedev, name, passwordprogram,
as_root);
+ if (as_root)
+ unbecome_root();
+
/*
* The child should never return from dochild() ....
*/
@@ -546,9 +550,9 @@ BOOL check_lanman_password(char *user, uchar * pass1,
*psmbpw = NULL;
- become_root(0);
+ become_root();
smbpw = getsmbpwnam(user);
- unbecome_root(0);
+ unbecome_root();
if (smbpw == NULL)
{
@@ -644,9 +648,9 @@ BOOL change_lanman_password(struct smb_passwd *smbpw, uchar * pass1,
smbpw->smb_nt_passwd = NULL; /* We lose the NT hash. Sorry. */
/* Now write it into the file. */
- become_root(0);
+ become_root();
ret = mod_smbpwd_entry(smbpw, False);
- unbecome_root(0);
+ unbecome_root();
return ret;
}
@@ -713,9 +717,9 @@ BOOL check_oem_password(char *user,
BOOL nt_pass_set = (ntdata != NULL && nthash != NULL);
- become_root(False);
+ become_root();
*psmbpw = smbpw = getsmbpwnam(user);
- unbecome_root(False);
+ unbecome_root();
if (smbpw == NULL)
{
@@ -878,9 +882,9 @@ BOOL change_oem_password(struct smb_passwd *smbpw, char *new_passwd,
smbpw->smb_nt_passwd = new_nt_p16;
/* Now write it into the file. */
- become_root(0);
+ become_root();
ret = mod_smbpwd_entry(smbpw, override);
- unbecome_root(0);
+ unbecome_root();
memset(new_passwd, '\0', strlen(new_passwd));
@@ -897,9 +901,9 @@ BOOL check_plaintext_password(char *user, char *old_passwd,
struct smb_passwd *smbpw = NULL;
uchar old_pw[16], old_ntpw[16];
- become_root(False);
+ become_root();
*psmbpw = smbpw = getsmbpwnam(user);
- unbecome_root(False);
+ unbecome_root();
if (smbpw == NULL)
{
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 5b077110bb..8e2382ee9f 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -270,9 +270,9 @@ int file_utime(connection_struct *conn, char *fname, struct utimbuf *times)
in_group(sb.st_gid,current_user.gid,
current_user.ngroups,current_user.groups)))) {
/* We are allowed to become root and change the filetime. */
- become_root(False);
+ become_root();
ret = conn->vfs_ops.utime(dos_to_unix(fname, False), times);
- unbecome_root(False);
+ unbecome_root();
}
}
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 06f4d72a40..209e4402df 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -329,10 +329,10 @@ static BOOL update_smbpassword_file(char *user, char *password)
struct smb_passwd *smbpw;
BOOL ret;
- become_root(0);
+ become_root();
smbpw = getsmbpwnam(user);
- unbecome_root(0);
-
+ unbecome_root();
+
if(smbpw == NULL) {
DEBUG(0,("getsmbpwnam returned NULL\n"));
return False;