diff options
author | Volker Lendecke <vlendec@samba.org> | 2002-10-21 20:33:00 +0000 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2002-10-21 20:33:00 +0000 |
commit | c7731c988ed289952310f4bec19f6afdb6c1d1fc (patch) | |
tree | 516ae0ccc362ab103af5d0ec97308a14db381aa9 /source3/rpc_server/srv_samr_nt.c | |
parent | 2d19a6550bd1dc41fcd9f198fcee18a2e56b6e56 (diff) | |
download | samba-c7731c988ed289952310f4bec19f6afdb6c1d1fc.tar.gz samba-c7731c988ed289952310f4bec19f6afdb6c1d1fc.tar.bz2 samba-c7731c988ed289952310f4bec19f6afdb6c1d1fc.zip |
Same segfault as in add_groupmem.
Volker
(This used to be commit 1f702dcd2ced6f64a619e3ddbb570f41f7f0986b)
Diffstat (limited to 'source3/rpc_server/srv_samr_nt.c')
-rw-r--r-- | source3/rpc_server/srv_samr_nt.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 1db3f60c87..1bdfefff65 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -3414,19 +3414,21 @@ NTSTATUS _samr_add_aliasmem(pipes_struct *p, SAMR_Q_ADD_ALIASMEM *q_u, SAMR_R_AD if ((pwd=getpwuid_alloc(uid)) == NULL) { return NT_STATUS_NO_SUCH_USER; - } else { - passwd_free(&pwd); } - if ((grp=getgrgid(map.gid)) == NULL) + if ((grp=getgrgid(map.gid)) == NULL) { + passwd_free(&pwd); return NT_STATUS_NO_SUCH_ALIAS; + } /* we need to copy the name otherwise it's overloaded in user_in_group_list */ fstrcpy(grp_name, grp->gr_name); /* if the user is already in the group */ - if(user_in_group_list(pwd->pw_name, grp_name)) + if(user_in_group_list(pwd->pw_name, grp_name)) { + passwd_free(&pwd); return NT_STATUS_MEMBER_IN_ALIAS; + } /* * ok, the group exist, the user exist, the user is not in the group, @@ -3435,9 +3437,12 @@ NTSTATUS _samr_add_aliasmem(pipes_struct *p, SAMR_Q_ADD_ALIASMEM *q_u, SAMR_R_AD smb_add_user_group(grp_name, pwd->pw_name); /* check if the user has been added then ... */ - if(!user_in_group_list(pwd->pw_name, grp_name)) + if(!user_in_group_list(pwd->pw_name, grp_name)) { + passwd_free(&pwd); return NT_STATUS_MEMBER_NOT_IN_ALIAS; /* don't know what to reply else */ + } + passwd_free(&pwd); return NT_STATUS_OK; } |