summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-03-16 16:44:54 +0000
committerGerald Carter <jerry@samba.org>2004-03-16 16:44:54 +0000
commit1df61db0720b0d5372ffb43cf2fd60d72e438728 (patch)
tree10caaaceb0a5c79e7e2d2f464af9c1413bc28726 /source3/smbd
parent76e86e88c3d578ad47d4bc9ef7e8e6c035715dea (diff)
downloadsamba-1df61db0720b0d5372ffb43cf2fd60d72e438728.tar.gz
samba-1df61db0720b0d5372ffb43cf2fd60d72e438728.tar.bz2
samba-1df61db0720b0d5372ffb43cf2fd60d72e438728.zip
BUG 1165, 1126: Fix bug with secondary groups (security = ads) and winbind use default domain = yes
(This used to be commit ca971cf76e5fbb33d51b1fdfa92e4d13b2e150b6)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/sesssetup.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index c66ccfd8eb..864d69653c 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -143,7 +143,7 @@ static int reply_spnego_kerberos(connection_struct *conn,
DATA_BLOB ticket;
char *client, *p, *domain;
fstring netbios_domain_name;
- const struct passwd *pw;
+ struct passwd *pw;
char *user;
int sess_vuid;
NTSTATUS ret;
@@ -154,6 +154,7 @@ static int reply_spnego_kerberos(connection_struct *conn,
uint8 tok_id[2];
BOOL foreign = False;
DATA_BLOB nullblob = data_blob(NULL, 0);
+ fstring real_username;
ZERO_STRUCT(ticket);
ZERO_STRUCT(auth_data);
@@ -239,7 +240,9 @@ static int reply_spnego_kerberos(connection_struct *conn,
asprintf(&user, "%s%c%s", domain, *lp_winbind_separator(), client);
- pw = smb_getpwnam( user );
+ /* lookup the passwd struct, create a new user if necessary */
+
+ pw = smb_getpwnam( user, real_username, True );
if (!pw) {
DEBUG(1,("Username %s is invalid on this system\n",user));
@@ -251,10 +254,11 @@ static int reply_spnego_kerberos(connection_struct *conn,
/* setup the string used by %U */
- sub_set_smb_name(pw->pw_name);
+ sub_set_smb_name( real_username );
reload_services(True);
- if (!NT_STATUS_IS_OK(ret = make_server_info_pw(&server_info,pw))) {
+ if (!NT_STATUS_IS_OK(ret = make_server_info_pw(&server_info, real_username, pw)))
+ {
DEBUG(1,("make_server_info_from_pw failed!\n"));
SAFE_FREE(user);
SAFE_FREE(client);