summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/rpc_server/srv_pipe.c1
-rw-r--r--source3/smbd/password.c10
-rw-r--r--source3/smbd/service.c1
3 files changed, 12 insertions, 0 deletions
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index ded01e4e21..44bca13c1a 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -462,6 +462,7 @@ failed authentication on named pipe %s.\n", domain, pipe_user_name, wks, p->name
p->pipe_user.gid = pass->pw_gid;
/* Set up pipe user group membership. */
+ initialise_groups(pipe_user_name, p->pipe_user.uid, p->pipe_user.gid);
initialize_groups(pipe_user_name, p->pipe_user.uid, p->pipe_user.gid);
get_current_groups( &p->pipe_user.ngroups, &p->pipe_user.groups);
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 2b43f0baf4..3545f41dff 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -188,6 +188,7 @@ NT_USER_TOKEN *create_nt_token(uid_t uid, gid_t gid, int ngroups, gid_t *groups)
{
NT_USER_TOKEN *token;
DOM_SID *psids;
+ int i, psid_ndx = 0;
int i;
if ((token = (NT_USER_TOKEN *)malloc( sizeof(NT_USER_TOKEN) ) ) == NULL)
@@ -202,11 +203,19 @@ NT_USER_TOKEN *create_nt_token(uid_t uid, gid_t gid, int ngroups, gid_t *groups)
psids = token->user_sids;
+ token->num_sids = 2;
token->num_sids = ngroups + 2;
uid_to_sid( &psids[0], uid);
gid_to_sid( &psids[1], gid);
+ for (i = 0; i < ngroups; i++) {
+ if (groups[i] != gid) {
+ gid_to_sid( &psids[psid_ndx+2], groups[i]);
+ psid_ndx++;
+ token->num_sids++;
+ }
+ }
for (i = 0; i < ngroups; i++)
gid_to_sid( &psids[i+2], groups[i]);
@@ -254,6 +263,7 @@ uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name,
/* Find all the groups this uid is in and store them.
Used by become_user() */
+ initialise_groups(unix_name, uid, gid);
initialize_groups(unix_name, uid, gid);
get_current_groups( &vuser->n_groups, &vuser->groups);
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 8b63fe6662..500ba6e626 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -454,6 +454,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int
if (!IS_IPC(conn)) {
/* Find all the groups this uid is in and
store them. Used by become_user() */
+ initialise_groups(conn->user, conn->uid, conn->gid);
initialize_groups(conn->user, conn->uid, conn->gid);
get_current_groups(&conn->ngroups,&conn->groups);