summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-05-16 18:30:22 +0000
committerJeremy Allison <jra@samba.org>2003-05-16 18:30:22 +0000
commit3ebfe59d0fdeb6d58400b25f5b444fda42c6200a (patch)
treede01a2b7e68d34589a12995103d967dc17312784 /source3
parent90d24ee9a6c963710f05f31e942cf9c6e21424ec (diff)
downloadsamba-3ebfe59d0fdeb6d58400b25f5b444fda42c6200a.tar.gz
samba-3ebfe59d0fdeb6d58400b25f5b444fda42c6200a.tar.bz2
samba-3ebfe59d0fdeb6d58400b25f5b444fda42c6200a.zip
Patch from "Esh, Andrew" <Andrew_Esh@adaptec.com> to fix core dump bug
in add groupmem code. Jeremy. (This used to be commit f41eb9ce9af2075f62abaecd8792d30617d05818)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_samr_nt.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index fa7a10bb1a..ee496126ad 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -3505,6 +3505,7 @@ NTSTATUS _samr_add_groupmem(pipes_struct *p, SAMR_Q_ADD_GROUPMEM *q_u, SAMR_R_AD
DOM_SID group_sid;
DOM_SID user_sid;
fstring group_sid_str;
+ uid_t uid;
struct passwd *pwd;
struct group *grp;
fstring grp_name;
@@ -3546,7 +3547,19 @@ NTSTATUS _samr_add_groupmem(pipes_struct *p, SAMR_Q_ADD_GROUPMEM *q_u, SAMR_R_AD
pdb_free_sam(&sam_user);
return NT_STATUS_NO_SUCH_USER;
}
-
+
+ /* check a real user exist before we run the script to add a user to a group */
+ if (NT_STATUS_IS_ERR(sid_to_uid(pdb_get_user_sid(sam_user), &uid))) {
+ pdb_free_sam(&sam_user);
+ return NT_STATUS_NO_SUCH_USER;
+ }
+
+ pdb_free_sam(&sam_user);
+
+ if ((pwd=getpwuid_alloc(uid)) == NULL) {
+ return NT_STATUS_NO_SUCH_USER;
+ }
+
if ((grp=getgrgid(map.gid)) == NULL) {
passwd_free(&pwd);
return NT_STATUS_NO_SUCH_GROUP;