[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2293-ge7a4027

Volker Lendecke vlendec at samba.org
Mon May 5 16:29:27 GMT 2008


The branch, v3-3-test has been updated
       via  e7a4027acf38bf5800d9d8ba477afb5daaf517ce (commit)
       via  420de035237bb08bc470c9eb820f3da2edaa6805 (commit)
       via  964bd02220c04030d8cb0f97ca9b409400d1238c (commit)
       via  a33e8d2ffa4daea1deba13b3571cb0b36d521476 (commit)
       via  8047a1991a09191fec254815f3bfc85a2c36674a (commit)
       via  74c88a44422f88d6e2f2cdbfdfa0bafe0dbe06c4 (commit)
       via  570a6b80feb5b0dc23213ba936c721e766cd4818 (commit)
       via  aa2299d42adf4d27e707ac755e07be70d0af1bb4 (commit)
       via  51d5d512f28eadc74eced43e5e7f4e5bdff3ff69 (commit)
       via  b36fd84186a656f86e4cfb9166fc0ecbffb422cb (commit)
       via  36bfd32f1ff878e827db91e9bf233719ecca5b01 (commit)
       via  41f9afd62d8cc6067582d452f3d53a5c67253b69 (commit)
       via  32cd4bf34b614f7bb0b05a7ae5d7eb51d208a7c7 (commit)
       via  e7ce4bce5cd7eddb14982028538e965e12ccef84 (commit)
      from  d077ef64cd1d9bbaeb936566c2c70da508de829f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit e7a4027acf38bf5800d9d8ba477afb5daaf517ce
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 5 17:24:17 2008 +0200

    Fix a C++ warning

commit 420de035237bb08bc470c9eb820f3da2edaa6805
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Apr 30 17:42:39 2008 +0200

    Remove "userdom_struct user" from "struct user_struct"

commit 964bd02220c04030d8cb0f97ca9b409400d1238c
Author: Volker Lendecke <vl at samba.org>
Date:   Sat May 3 09:52:24 2008 +0200

    Fix a typo

commit a33e8d2ffa4daea1deba13b3571cb0b36d521476
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Apr 30 17:06:45 2008 +0200

    Remove unused set_current_user_guest()

commit 8047a1991a09191fec254815f3bfc85a2c36674a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Apr 30 12:58:40 2008 +0200

    Fix typo

commit 74c88a44422f88d6e2f2cdbfdfa0bafe0dbe06c4
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Apr 30 14:26:16 2008 +0200

    Remove "session_key" from "struct user_struct"
    
    This one took a bit -- I hope I covered all data paths

commit 570a6b80feb5b0dc23213ba936c721e766cd4818
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 29 13:45:58 2008 +0200

    Remove "guest" from "struct user_struct"

commit aa2299d42adf4d27e707ac755e07be70d0af1bb4
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 29 13:43:10 2008 +0200

    Remove the unix token info from "struct user_struct"

commit 51d5d512f28eadc74eced43e5e7f4e5bdff3ff69
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 29 13:35:00 2008 +0200

    Remove "nt_user_token" from "struct user_struct"

commit b36fd84186a656f86e4cfb9166fc0ecbffb422cb
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 29 13:28:40 2008 +0200

    Remove "logon_script" from "struct user_struct"

commit 36bfd32f1ff878e827db91e9bf233719ecca5b01
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 29 13:23:47 2008 +0200

    Remove unix_homedir from struct user_struct
    
    This makes pdb_get_unix_homedir unused. I wonder if that was ever really used...

commit 41f9afd62d8cc6067582d452f3d53a5c67253b69
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Apr 29 12:47:55 2008 +0200

    Remove "homedir" from "struct user_struct"

commit 32cd4bf34b614f7bb0b05a7ae5d7eb51d208a7c7
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Apr 28 19:42:11 2008 +0200

    pipes_struct->pipe_user_name is unused, remove it

commit e7ce4bce5cd7eddb14982028538e965e12ccef84
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Apr 28 13:35:44 2008 +0200

    Make the namelist arg to set_namearray const

-----------------------------------------------------------------------

Summary of changes:
 source/auth/auth_util.c          |   45 +++--------
 source/include/auth.h            |   10 ++-
 source/include/ntdomain.h        |    1 -
 source/include/passdb.h          |    1 -
 source/include/smb.h             |   18 ----
 source/lib/substitute.c          |   11 ++-
 source/lib/util.c                |    4 +-
 source/libsmb/clidgram.c         |    4 +-
 source/passdb/pdb_get_set.c      |    8 --
 source/printing/printing.c       |    9 ++-
 source/rpc_server/srv_lsa_hnd.c  |    2 +-
 source/rpc_server/srv_lsa_nt.c   |    6 +-
 source/rpc_server/srv_pipe_hnd.c |    6 +-
 source/smbd/lanman.c             |   38 ++++++---
 source/smbd/password.c           |  165 ++++++++++++++------------------------
 source/smbd/process.c            |    8 ++-
 source/smbd/service.c            |   25 +++---
 source/smbd/session.c            |    8 +-
 source/smbd/sesssetup.c          |   33 +++-----
 source/smbd/uid.c                |   29 ++++---
 20 files changed, 190 insertions(+), 241 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/auth/auth_util.c b/source/auth/auth_util.c
index 7013285..5116425 100644
--- a/source/auth/auth_util.c
+++ b/source/auth/auth_util.c
@@ -985,7 +985,7 @@ bool user_in_group(const char *username, const char *groupname)
 
 
 /***************************************************************************
- Make (and fill) a user_info struct from a 'struct passwd' by conversion 
+ Make (and fill) a server_info struct from a 'struct passwd' by conversion
  to a struct samu
 ***************************************************************************/
 
@@ -1107,6 +1107,7 @@ static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_inf
 	DOM_SID guest_sid;
 	bool ret;
 	char zeros[16];
+	fstring tmp;
 
 	if ( !(sampass = samu_new( NULL )) ) {
 		return NT_STATUS_NO_MEMORY;
@@ -1145,6 +1146,9 @@ static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_inf
 	(*server_info)->user_session_key = data_blob(zeros, sizeof(zeros));
 	(*server_info)->lm_session_key = data_blob(zeros, sizeof(zeros));
 
+	alpha_strcpy(tmp, pdb_get_username(sampass), ". _-$", sizeof(tmp));
+	(*server_info)->sanitized_username = talloc_strdup(*server_info, tmp);
+
 	return NT_STATUS_OK;
 }
 
@@ -1200,6 +1204,12 @@ static auth_serversupplied_info *copy_serverinfo(auth_serversupplied_info *src)
 		return NULL;
 	}
 
+	dst->sanitized_username = talloc_strdup(dst, src->sanitized_username);
+	if (!dst->sanitized_username) {
+		TALLOC_FREE(dst);
+		return NULL;
+	}
+
 	return dst;
 }
 
@@ -1246,39 +1256,6 @@ bool copy_current_user(struct current_user *dst, struct current_user *src)
 	return True;
 }
 
-bool set_current_user_guest(struct current_user *dst)
-{
-	gid_t *groups;
-	NT_USER_TOKEN *nt_token;
-
-	groups = (gid_t *)memdup(guest_info->groups,
-				 sizeof(gid_t) * guest_info->n_groups);
-	if (groups == NULL) {
-		return False;
-	}
-
-	nt_token = dup_nt_token(NULL, guest_info->ptok);
-	if (nt_token == NULL) {
-		SAFE_FREE(groups);
-		return False;
-	}
-
-	TALLOC_FREE(dst->nt_user_token);
-	SAFE_FREE(dst->ut.groups);
-
-	/* dst->conn is never really dereferenced, it's only tested for
-	 * equality in uid.c */
-	dst->conn = NULL;
-
-	dst->vuid = UID_FIELD_INVALID;
-	dst->ut.uid = guest_info->uid;
-	dst->ut.gid = guest_info->gid;
-	dst->ut.ngroups = guest_info->n_groups;
-	dst->ut.groups = groups;
-	dst->nt_user_token = nt_token;
-	return True;
-}
-
 /***************************************************************************
  Purely internal function for make_server_info_info3
  Fill the sam account from getpwnam
diff --git a/source/include/auth.h b/source/include/auth.h
index a7531b3..df2bed8 100644
--- a/source/include/auth.h
+++ b/source/include/auth.h
@@ -69,7 +69,15 @@ typedef struct auth_serversupplied_info {
 
 	bool was_mapped;	/* Did the username map match? */
 	char *unix_name;
-	
+
+	/*
+	 * For performance reasons we keep an alpha_strcpy-sanitized version
+	 * of the username around as long as the global variable current_user
+	 * still exists. If we did not do keep this, we'd have to call
+	 * alpha_strcpy whenever we do a become_user(), potentially on every
+	 * smb request. See set_current_user_info.
+	 */
+	char *sanitized_username;
 } auth_serversupplied_info;
 
 struct auth_context {
diff --git a/source/include/ntdomain.h b/source/include/ntdomain.h
index 7bd5afe..dc63706 100644
--- a/source/include/ntdomain.h
+++ b/source/include/ntdomain.h
@@ -236,7 +236,6 @@ typedef struct pipes_struct {
 	 * Unix user name and credentials used when a pipe is authenticated.
 	 */
 
-	fstring pipe_user_name;
 	struct current_user pipe_user;
 	DATA_BLOB session_key;
  
diff --git a/source/include/passdb.h b/source/include/passdb.h
index 8d5934d..360a0d0 100644
--- a/source/include/passdb.h
+++ b/source/include/passdb.h
@@ -59,7 +59,6 @@ enum pdb_elements {
 	PDB_GROUPSID,
 	PDB_ACCTCTRL,
 	PDB_PASSLASTSET,
-	PDB_UNIXHOMEDIR,
 	PDB_ACCTDESC,
 	PDB_WORKSTATIONS,
 	PDB_COMMENT,
diff --git a/source/include/smb.h b/source/include/smb.h
index f3295e1..47a11f5 100644
--- a/source/include/smb.h
+++ b/source/include/smb.h
@@ -1777,24 +1777,6 @@ struct pending_auth_data {
 typedef struct user_struct {
 	struct user_struct *next, *prev;
 	uint16 vuid; /* Tag for this entry. */
-	uid_t uid; /* uid of a validated user */
-	gid_t gid; /* gid of a validated user */
-
-	userdom_struct user;
-	const char *homedir;
-	const char *unix_homedir;
-	const char *logon_script;
-	
-	bool guest;
-
-	/* following groups stuff added by ih */
-	/* This groups info is needed for when we become_user() for this uid */
-	int n_groups;
-	gid_t *groups;
-
-	NT_USER_TOKEN *nt_user_token;
-
-	DATA_BLOB session_key;
 
 	char *session_keystr; /* used by utmp and pam session code.  
 				 TDB key string */
diff --git a/source/lib/substitute.c b/source/lib/substitute.c
index 62dfdb5..c8ad619 100644
--- a/source/lib/substitute.c
+++ b/source/lib/substitute.c
@@ -213,11 +213,18 @@ static const char *get_smb_user_name(void)
 /*******************************************************************
  Setup the strings used by substitutions. Called per packet. Ensure
  %U name is set correctly also.
+
+ smb_name must be sanitized by alpha_strcpy
 ********************************************************************/
 
-void set_current_user_info(const userdom_struct *pcui)
+void set_current_user_info(const char *smb_name, const char *unix_name,
+			   const char *full_name, const char *domain)
 {
-	current_user_info = *pcui;
+	fstrcpy(current_user_info.smb_name, smb_name);
+	fstrcpy(current_user_info.unix_name, unix_name);
+	fstrcpy(current_user_info.full_name, full_name);
+	fstrcpy(current_user_info.domain, domain);
+
 	/* The following is safe as current_user_info.smb_name
 	 * has already been sanitised in register_existing_vuid. */
 
diff --git a/source/lib/util.c b/source/lib/util.c
index 5f95bcc..a137d7c 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -1907,10 +1907,10 @@ bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensit
  if possible.
 ********************************************************************/
  
-void set_namearray(name_compare_entry **ppname_array, char *namelist)
+void set_namearray(name_compare_entry **ppname_array, const char *namelist)
 {
 	char *name_end;
-	char *nameptr = namelist;
+	const char *nameptr = namelist;
 	int num_entries = 0;
 	int i;
 
diff --git a/source/libsmb/clidgram.c b/source/libsmb/clidgram.c
index fba009d..1d3293c 100644
--- a/source/libsmb/clidgram.c
+++ b/source/libsmb/clidgram.c
@@ -301,8 +301,8 @@ bool receive_getdc_response(TALLOC_CTX *mem_ctx,
 	if (**dc_name == '\\')	*dc_name += 1;
 
 	if (reply) {
-		*reply = talloc_memdup(mem_ctx, &r,
-			sizeof(struct nbt_ntlogon_packet));
+		*reply = (struct nbt_ntlogon_packet *)talloc_memdup(
+			mem_ctx, &r, sizeof(struct nbt_ntlogon_packet));
 		if (!*reply) {
 			return false;
 		}
diff --git a/source/passdb/pdb_get_set.c b/source/passdb/pdb_get_set.c
index c427d41..7a8086c 100644
--- a/source/passdb/pdb_get_set.c
+++ b/source/passdb/pdb_get_set.c
@@ -301,14 +301,6 @@ const char *pdb_get_homedir(const struct samu *sampass)
 	return sampass->home_dir;
 }
 
-const char *pdb_get_unix_homedir(const struct samu *sampass)
-{
-	if (sampass->unix_pw ) {
-		return sampass->unix_pw->pw_dir;
-	}
-	return NULL;
-}
-
 const char *pdb_get_dir_drive(const struct samu *sampass)
 {
 	return sampass->dir_drive;
diff --git a/source/printing/printing.c b/source/printing/printing.c
index c5fe53f..aa67f08 100644
--- a/source/printing/printing.c
+++ b/source/printing/printing.c
@@ -1989,7 +1989,8 @@ static bool is_owner(struct current_user *user, const char *servicename,
 		return False;
 
 	if ((vuser = get_valid_user_struct(user->vuid)) != NULL) {
-		return strequal(pjob->user, vuser->user.smb_name);
+		return strequal(pjob->user,
+				vuser->server_info->sanitized_username);
 	} else {
 		return strequal(pjob->user, uidtoname(user->ut.uid));
 	}
@@ -2438,8 +2439,10 @@ uint32 print_job_start(struct current_user *user, int snum, char *jobname, NT_DE
 
 	if ((vuser = get_valid_user_struct(user->vuid)) != NULL) {
 		fstrcpy(pjob.user, lp_printjob_username(snum));
-		standard_sub_basic(vuser->user.smb_name, vuser->user.domain, 
-				   pjob.user, sizeof(pjob.user)-1);
+		standard_sub_basic(
+			vuser->server_info->sanitized_username,
+			pdb_get_domain(vuser->server_info->sam_account),
+			pjob.user, sizeof(pjob.user)-1);
 		/* ensure NULL termination */ 
 		pjob.user[sizeof(pjob.user)-1] = '\0'; 
 	} else {
diff --git a/source/rpc_server/srv_lsa_hnd.c b/source/rpc_server/srv_lsa_hnd.c
index a8341e6..78b891e 100644
--- a/source/rpc_server/srv_lsa_hnd.c
+++ b/source/rpc_server/srv_lsa_hnd.c
@@ -268,7 +268,7 @@ bool pipe_access_check(pipes_struct *p)
 			return False;
 		}
 
-		if (user->guest) {
+		if (user->server_info->guest) {
 			return False;
 		}
 	}
diff --git a/source/rpc_server/srv_lsa_nt.c b/source/rpc_server/srv_lsa_nt.c
index 20c910e..7c33bd0 100644
--- a/source/rpc_server/srv_lsa_nt.c
+++ b/source/rpc_server/srv_lsa_nt.c
@@ -1468,7 +1468,7 @@ NTSTATUS _lsa_GetUserName(pipes_struct *p,
 	if (vuser == NULL)
 		return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
 
-	if (vuser->guest) {
+	if (vuser->server_info->guest) {
 		/*
 		 * I'm 99% sure this is not the right place to do this,
 		 * global_sid_Anonymous should probably be put into the token
@@ -1479,8 +1479,8 @@ NTSTATUS _lsa_GetUserName(pipes_struct *p,
 			return NT_STATUS_NO_MEMORY;
 		}
 	} else {
-		username = vuser->user.smb_name;
-		domname = vuser->user.domain;
+		username = vuser->server_info->sanitized_username;
+		domname = pdb_get_domain(vuser->server_info->sam_account);
 	}
 
 	account_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
diff --git a/source/rpc_server/srv_pipe_hnd.c b/source/rpc_server/srv_pipe_hnd.c
index 45f649d..1d62199 100644
--- a/source/rpc_server/srv_pipe_hnd.c
+++ b/source/rpc_server/srv_pipe_hnd.c
@@ -340,9 +340,11 @@ static void *make_internal_rpc_pipe_p(const char *pipe_name,
 	
 	/* Store the session key and NT_TOKEN */
 	if (vuser) {
-		p->session_key = data_blob(vuser->session_key.data, vuser->session_key.length);
+		p->session_key = data_blob(
+			vuser->server_info->user_session_key.data,
+			vuser->server_info->user_session_key.length);
 		p->pipe_user.nt_user_token = dup_nt_token(
-			NULL, vuser->nt_user_token);
+			NULL, vuser->server_info->ptok);
 	}
 
 	/*
diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c
index 6fa4f96..a233893 100644
--- a/source/smbd/lanman.c
+++ b/source/smbd/lanman.c
@@ -3338,8 +3338,9 @@ static bool api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
 	   Don't depend on vuser being non-null !!. JRA */
 	user_struct *vuser = get_valid_user_struct(vuid);
 	if(vuser != NULL) {
-		DEBUG(3,("  Username of UID %d is %s\n", (int)vuser->uid,
-			vuser->user.unix_name));
+		DEBUG(3,("  Username of UID %d is %s\n",
+			 (int)vuser->server_info->uid,
+			 vuser->server_info->unix_name));
 	}
 
 	if (!str1 || !str2 || !UserName || !p) {
@@ -3412,7 +3413,9 @@ static bool api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
 
 		/* EEK! the cifsrap.txt doesn't have this in!!!! */
 		SIVAL(p,usri11_full_name,PTR_DIFF(p2,p)); /* full name */
-		strlcpy(p2,((vuser != NULL) ? vuser->user.full_name : UserName),PTR_DIFF(endp,p2));
+		strlcpy(p2,((vuser != NULL)
+			    ? pdb_get_fullname(vuser->server_info->sam_account)
+			    : UserName),PTR_DIFF(endp,p2));
 		p2 = skip_string(*rdata,*rdata_len,p2);
 		if (!p2) {
 			return False;
@@ -3420,12 +3423,17 @@ static bool api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
 	}
 
 	if (uLevel == 11) {
+		const char *homedir = "";
+		if (vuser != NULL) {
+			homedir = pdb_get_homedir(
+				vuser->server_info->sam_account);
+		}
 		/* modelled after NTAS 3.51 reply */
 		SSVAL(p,usri11_priv,conn->admin_user?USER_PRIV_ADMIN:USER_PRIV_USER); 
 		SIVAL(p,usri11_auth_flags,AF_OP_PRINT);		/* auth flags */
 		SIVALS(p,usri11_password_age,-1);		/* password age */
 		SIVAL(p,usri11_homedir,PTR_DIFF(p2,p)); /* home dir */
-		strlcpy(p2, vuser && vuser->homedir ? vuser->homedir : "",PTR_DIFF(endp,p2));
+		strlcpy(p2, homedir, PTR_DIFF(endp,p2));
 		p2 = skip_string(*rdata,*rdata_len,p2);
 		if (!p2) {
 			return False;
@@ -3476,7 +3484,9 @@ static bool api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
 		SSVAL(p,42,
 		conn->admin_user?USER_PRIV_ADMIN:USER_PRIV_USER);
 		SIVAL(p,44,PTR_DIFF(p2,*rdata)); /* home dir */
-		strlcpy(p2, vuser && vuser->homedir ? vuser->homedir : "",PTR_DIFF(endp,p2));
+		strlcpy(p2, vuser ? pdb_get_homedir(
+				vuser->server_info->sam_account) : "",
+			PTR_DIFF(endp,p2));
 		p2 = skip_string(*rdata,*rdata_len,p2);
 		if (!p2) {
 			return False;
@@ -3485,7 +3495,9 @@ static bool api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
 		*p2++ = 0;
 		SSVAL(p,52,0);		/* flags */
 		SIVAL(p,54,PTR_DIFF(p2,*rdata));		/* script_path */
-		strlcpy(p2,vuser && vuser->logon_script ? vuser->logon_script : "",PTR_DIFF(endp,p2));
+		strlcpy(p2, vuser ? pdb_get_logon_script(
+				vuser->server_info->sam_account) : "",
+			PTR_DIFF(endp,p2));
 		p2 = skip_string(*rdata,*rdata_len,p2);
 		if (!p2) {
 			return False;
@@ -3493,7 +3505,9 @@ static bool api_RNetUserGetInfo(connection_struct *conn, uint16 vuid,
 		if (uLevel == 2) {
 			SIVAL(p,60,0);		/* auth_flags */
 			SIVAL(p,64,PTR_DIFF(p2,*rdata)); /* full_name */
-   			strlcpy(p2,((vuser != NULL) ? vuser->user.full_name : UserName),PTR_DIFF(endp,p2));
+			strlcpy(p2,((vuser != NULL)
+				    ? pdb_get_fullname(vuser->server_info->sam_account)
+				    : UserName),PTR_DIFF(endp,p2));
 			p2 = skip_string(*rdata,*rdata_len,p2);
 			if (!p2) {
 				return False;
@@ -3580,8 +3594,9 @@ static bool api_WWkstaUserLogon(connection_struct *conn,uint16 vuid,
 	}
 
 	if(vuser != NULL) {
-		DEBUG(3,("  Username of UID %d is %s\n", (int)vuser->uid, 
-			vuser->user.unix_name));
+		DEBUG(3,("  Username of UID %d is %s\n",
+			 (int)vuser->server_info->uid,
+			 vuser->server_info->unix_name));
 	}
 
 	uLevel = get_safe_SVAL(param,tpscnt,p,0,-1);
@@ -3638,7 +3653,8 @@ static bool api_WWkstaUserLogon(connection_struct *conn,uint16 vuid,
 		}
 
 		PACKS(&desc,"z",lp_workgroup());/* domain */
-		PACKS(&desc,"z", vuser && vuser->logon_script ? vuser->logon_script :""); /* script path */
+		PACKS(&desc,"z", vuser ? pdb_get_logon_script(
+			      vuser->server_info->sam_account) : ""); /* script path */
 		PACKI(&desc,"D",0x00000000);		/* reserved */
 	}
 
@@ -4560,7 +4576,7 @@ void api_reply(connection_struct *conn, uint16 vuid,
 	if (api_commands[i].auth_user && lp_restrict_anonymous()) {
 		user_struct *user = get_valid_user_struct(vuid);
 
-		if (!user || user->guest) {
+		if (!user || user->server_info->guest) {
 			reply_nterror(req, NT_STATUS_ACCESS_DENIED);
 			return;
 		}
diff --git a/source/smbd/password.c b/source/smbd/password.c
index 80eba56..a872ea2 100644
--- a/source/smbd/password.c
+++ b/source/smbd/password.c
@@ -119,8 +119,6 @@ void invalidate_vuid(uint16 vuid)
 
 	session_yield(vuser);
 
-	data_blob_free(&vuser->session_key);
-
 	if (vuser->auth_ntlmssp_state) {
 		auth_ntlmssp_end(&vuser->auth_ntlmssp_state);
 	}
@@ -201,6 +199,37 @@ int register_initial_vuid(void)
 	return vuser->vuid;
 }
 
+static int register_homes_share(const char *username)
+{
+	int result;
+	struct passwd *pwd;
+
+	result = lp_servicenumber(username);
+	if (result != -1) {
+		DEBUG(3, ("Using static (or previously created) service for "
+			  "user '%s'; path = '%s'\n", username,
+			  lp_pathname(result)));
+		return result;
+	}
+
+	pwd = getpwnam_alloc(talloc_tos(), username);
+
+	if ((pwd == NULL) || (pwd->pw_dir[0] == '\0')) {
+		DEBUG(3, ("No home directory defined for user '%s'\n",
+			  username));
+		TALLOC_FREE(pwd);
+		return -1;
+	}
+
+	DEBUG(3, ("Adding homes service for user '%s' using home directory: "
+		  "'%s'\n", username, pwd->pw_dir));
+
+	result = add_home_service(username, username, pwd->pw_dir);
+
+	TALLOC_FREE(pwd);
+	return result;
+}
+
 /**
  *  register that a valid login has been performed, establish 'session'.
  *  @param server_info The token returned from the authentication process.
@@ -221,109 +250,47 @@ int register_initial_vuid(void)
 
 int register_existing_vuid(uint16 vuid,
 			auth_serversupplied_info *server_info,
-			DATA_BLOB session_key,
 			DATA_BLOB response_blob,
 			const char *smb_name)
 {
-	user_struct *vuser = get_partial_auth_user_struct(vuid);
+	fstring tmp;
+	user_struct *vuser;
+
+	vuser = get_partial_auth_user_struct(vuid);
 	if (!vuser) {
 		goto fail;
 	}
 
 	/* Use this to keep tabs on all our info from the authentication */
-	vuser->server_info = server_info;
-
-	/* Ensure that the server_info will disappear with
-	 * the vuser it is now attached to */
-


-- 
Samba Shared Repository


More information about the samba-cvs mailing list