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

Volker Lendecke vlendec at samba.org
Sat May 10 22:27:59 GMT 2008


The branch, v3-3-test has been updated
       via  88423a17b966652eba4085e88f7ddb5c86b463dd (commit)
       via  0f19bc3f65bfc132aea1de1e76fcb4ee625a050f (commit)
       via  f23e970848b6e6655453fa65f6f160f624acfcff (commit)
       via  9891c7c30858a3bea9adbea1c5bfa5c6b1b85221 (commit)
       via  368454a27cb53a408ec416cbf37235b304592fb5 (commit)
       via  35438a940734340d5d6389ae0551fe3c25902f93 (commit)
       via  2834dacc8d49f77fe55fb5d7e3eb2dda431d1d3d (commit)
       via  a3738aef59e97d4533010b048534d937d36c0950 (commit)
       via  1a406def02bf171b223467d6b76317586d6205fc (commit)
       via  124a2c71852f39fcfe62ea19a5a8d25638d47400 (commit)
       via  c4bed3a48b86d44ad641250add2fc189af7e72f5 (commit)
       via  a34f73521712e3820d417f0d9ed811723b7681d6 (commit)
       via  6136a6d9d7301c65f37e2bf485681138cddd8bd2 (commit)
       via  93ce0705c14f222bda3e6204f4b54ba1893f33e1 (commit)
       via  6d9860d09b54c61625f011c2d56d710aa59d7686 (commit)
       via  7991e6764b4187ba86802569dfdc5816e6137f78 (commit)
       via  5aa3cdf355c179d89c2703f528919194ab084337 (commit)
       via  0f53f9e7db9f99f239c4d0950452d0e2cde2ae8b (commit)
       via  03944f8d8934cff74e19fc036f7611c1491e0d57 (commit)
       via  3ce395e61e931a77c5d2f52f39c7e3f71a9605a9 (commit)
       via  50bf075f7556fd09e0081175c31a5020a8eaf4d6 (commit)
       via  88e43097cafcd2849d9f1200a377357fde4cce99 (commit)
       via  e4a9492967f3d2b64f27943f99414608e0c03d21 (commit)
       via  a3651ced9e0859578df8cc44da64e7a8066bde76 (commit)
      from  6c9500c290fe0d6d71d4c33eb265906ce3a1d9f3 (commit)

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


- Log -----------------------------------------------------------------
commit 88423a17b966652eba4085e88f7ddb5c86b463dd
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 11 00:25:55 2008 +0200

    Make sure we have serversupplied_info->sanitized_username everywhere

commit 0f19bc3f65bfc132aea1de1e76fcb4ee625a050f
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 11 00:25:27 2008 +0200

    With force user, we have the same base token for all vuids

commit f23e970848b6e6655453fa65f6f160f624acfcff
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 11 00:23:01 2008 +0200

    Fix a memleak in new auth_serversupplied code

commit 9891c7c30858a3bea9adbea1c5bfa5c6b1b85221
Author: Volker Lendecke <vl at samba.org>
Date:   Sat May 10 23:27:21 2008 +0200

    Fix a memleak

commit 368454a27cb53a408ec416cbf37235b304592fb5
Author: Volker Lendecke <vl at samba.org>
Date:   Thu May 8 16:06:42 2008 +0200

    Remove "user" from connection_struct

commit 35438a940734340d5d6389ae0551fe3c25902f93
Author: Volker Lendecke <vl at samba.org>
Date:   Sat May 10 11:01:26 2008 +0200

    Add a comment explaining server_info in connection_struct

commit 2834dacc8d49f77fe55fb5d7e3eb2dda431d1d3d
Author: Volker Lendecke <vl at samba.org>
Date:   Thu May 8 15:53:55 2008 +0200

    Remove the unix token info from connection_struct

commit a3738aef59e97d4533010b048534d937d36c0950
Author: Volker Lendecke <vl at samba.org>
Date:   Thu May 8 15:09:02 2008 +0200

    Replace nt_user_token with server_info in connection_struct

commit 1a406def02bf171b223467d6b76317586d6205fc
Author: Volker Lendecke <vl at samba.org>
Date:   Thu May 8 12:14:43 2008 +0200

    Empty some nonempty blank lines

commit 124a2c71852f39fcfe62ea19a5a8d25638d47400
Author: Volker Lendecke <vl at samba.org>
Date:   Thu May 8 11:49:14 2008 +0200

    Use TALLOC_ZERO_P instead of separate ZERO_STRUCTP in dup_nt_token

commit c4bed3a48b86d44ad641250add2fc189af7e72f5
Author: Volker Lendecke <vl at samba.org>
Date:   Thu May 8 11:47:43 2008 +0200

    Make use of talloc_tos() in change_to_user()

commit a34f73521712e3820d417f0d9ed811723b7681d6
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 7 15:51:42 2008 +0200

    Next try at making the vuid cache circular
    
    Jeremy, please check!

commit 6136a6d9d7301c65f37e2bf485681138cddd8bd2
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 7 14:36:15 2008 +0200

    find_forced_group can directly change the token in server_info
    
    Now that we have a token that is correctly set up with gids already, this saves
    manual translation of the SIDs to GIDs.

commit 93ce0705c14f222bda3e6204f4b54ba1893f33e1
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 7 14:28:23 2008 +0200

    Add an error return in find_forced_group()

commit 6d9860d09b54c61625f011c2d56d710aa59d7686
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 7 14:25:47 2008 +0200

    Do not unnecessarily mess with the results in find_forced_group()

commit 7991e6764b4187ba86802569dfdc5816e6137f78
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 7 13:16:20 2008 +0200

    Replace find_forced_user by a direct call to make_serverinfo_from_username

commit 5aa3cdf355c179d89c2703f528919194ab084337
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 7 12:42:36 2008 +0200

    Simplify make_connection_snum: Copy connection_struct info from server_info

commit 0f53f9e7db9f99f239c4d0950452d0e2cde2ae8b
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 7 12:20:18 2008 +0200

    Add "server_info" to connection_struct
    
    This will replace all the user identity stuff in connection_struct, for now it
    is just a source where the other fields in connection_struct are filled from.

commit 03944f8d8934cff74e19fc036f7611c1491e0d57
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 6 22:12:04 2008 +0200

    Remove unused "force_group" from connection_struct

commit 3ce395e61e931a77c5d2f52f39c7e3f71a9605a9
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 6 21:50:08 2008 +0200

    "status" -> "pstatus" in make_connection_snum

commit 50bf075f7556fd09e0081175c31a5020a8eaf4d6
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 6 17:48:22 2008 +0200

    Add create_connection_server_info() -- not used yet

commit 88e43097cafcd2849d9f1200a377357fde4cce99
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 6 17:47:26 2008 +0200

    Add function make_serverinfo_from_username()
    
    This will be used for 'security=share' and 'force user'

commit e4a9492967f3d2b64f27943f99414608e0c03d21
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 6 17:26:49 2008 +0200

    Add a mem_ctx argument to make_server_info_guest()

commit a3651ced9e0859578df8cc44da64e7a8066bde76
Author: Volker Lendecke <vl at samba.org>
Date:   Tue May 6 16:10:23 2008 +0200

    Make copy_serverinfo non-static, add mem_ctx

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

Summary of changes:
 source/auth/auth_builtin.c        |    2 +-
 source/auth/auth_util.c           |   97 ++++++++-
 source/include/smb.h              |   20 +-
 source/lib/substitute.c           |    4 +-
 source/lib/util_nttoken.c         |    4 +-
 source/modules/vfs_expand_msdfs.c |    4 +-
 source/modules/vfs_full_audit.c   |    6 +-
 source/modules/vfs_recycle.c      |    5 +-
 source/smbd/close.c               |    2 +-
 source/smbd/conn.c                |   12 +-
 source/smbd/connection.c          |    4 +-
 source/smbd/fake_file.c           |    3 +-
 source/smbd/lanman.c              |   16 +-
 source/smbd/nttrans.c             |   10 +-
 source/smbd/open.c                |    5 +-
 source/smbd/service.c             |  430 +++++++++++++++----------------------
 source/smbd/sesssetup.c           |   14 +-
 source/smbd/trans2.c              |    9 +-
 source/smbd/uid.c                 |  132 ++++++------
 source/torture/vfstest.c          |    1 -
 20 files changed, 394 insertions(+), 386 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/auth/auth_builtin.c b/source/auth/auth_builtin.c
index ffc8b94..3741f29 100644
--- a/source/auth/auth_builtin.c
+++ b/source/auth/auth_builtin.c
@@ -42,7 +42,7 @@ static NTSTATUS check_guest_security(const struct auth_context *auth_context,
 
 	if (!(user_info->internal_username 
 	      && *user_info->internal_username)) {
-		nt_status = make_server_info_guest(server_info);
+		nt_status = make_server_info_guest(NULL, server_info);
 	}
 
 	return nt_status;
diff --git a/source/auth/auth_util.c b/source/auth/auth_util.c
index 5e9da4e..790b2f0 100644
--- a/source/auth/auth_util.c
+++ b/source/auth/auth_util.c
@@ -485,6 +485,14 @@ static auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx)
 	return result;
 }
 
+static char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username)
+{
+	fstring tmp;
+
+	alpha_strcpy(tmp, username, ". _-$", sizeof(tmp));
+	return talloc_strdup(mem_ctx, tmp);
+}
+
 /***************************************************************************
  Make (and fill) a user_info struct from a struct samu
 ***************************************************************************/
@@ -523,6 +531,13 @@ NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info,
 	
 	TALLOC_FREE(pwd);
 
+	result->sanitized_username = sanitize_username(result,
+						       result->unix_name);
+	if (result->sanitized_username == NULL) {
+		TALLOC_FREE(result);
+		return NT_STATUS_NO_MEMORY;
+	}
+
 	status = pdb_enum_group_memberships(result, sampass,
 					    &result->sids, &gids,
 					    &result->num_sids);
@@ -983,7 +998,6 @@ bool user_in_group(const char *username, const char *groupname)
 	return user_in_group_sid(username, &group_sid);
 }
 
-
 /***************************************************************************
  Make (and fill) a server_info struct from a 'struct passwd' by conversion
  to a struct samu
@@ -1018,7 +1032,17 @@ NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
 	}
 
 	result->sam_account = sampass;
+
 	result->unix_name = talloc_strdup(result, unix_username);
+	result->sanitized_username = sanitize_username(result, unix_username);
+
+	if ((result->unix_name == NULL)
+	    || (result->sanitized_username == NULL)) {
+		TALLOC_FREE(sampass);
+		TALLOC_FREE(result);
+		return NT_STATUS_NO_MEMORY;
+	}
+
 	result->uid = pwd->pw_uid;
 	result->gid = pwd->pw_gid;
 
@@ -1152,11 +1176,53 @@ static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_inf
 	return NT_STATUS_OK;
 }
 
-static auth_serversupplied_info *copy_serverinfo(auth_serversupplied_info *src)
+/****************************************************************************
+  Fake a auth_serversupplied_info just from a username
+****************************************************************************/
+
+NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
+				       const char *username,
+				       bool is_guest,
+				       struct auth_serversupplied_info **presult)
+{
+	struct auth_serversupplied_info *result;
+	struct passwd *pwd;
+	NTSTATUS status;
+
+	pwd = getpwnam_alloc(talloc_tos(), username);
+	if (pwd == NULL) {
+		return NT_STATUS_NO_SUCH_USER;
+	}
+
+	status = make_server_info_pw(&result, pwd->pw_name, pwd);
+
+	TALLOC_FREE(pwd);
+
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	result->nss_token = true;
+	result->guest = is_guest;
+
+	status = create_local_token(result);
+
+	if (!NT_STATUS_IS_OK(status)) {
+		TALLOC_FREE(result);
+		return status;
+	}
+
+	*presult = result;
+	return NT_STATUS_OK;
+}
+
+
+struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
+						 auth_serversupplied_info *src)
 {
 	auth_serversupplied_info *dst;
 
-	dst = make_server_info(NULL);
+	dst = make_server_info(mem_ctx);
 	if (dst == NULL) {
 		return NULL;
 	}
@@ -1223,9 +1289,10 @@ bool init_guest_info(void)
 	return NT_STATUS_IS_OK(make_new_server_info_guest(&guest_info));
 }
 
-NTSTATUS make_server_info_guest(auth_serversupplied_info **server_info)
+NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
+				auth_serversupplied_info **server_info)
 {
-	*server_info = copy_serverinfo(guest_info);
+	*server_info = copy_serverinfo(mem_ctx, guest_info);
 	return (*server_info != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
 }
 
@@ -1476,7 +1543,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
 	if (!NT_STATUS_IS_OK(nt_status)) {
 		TALLOC_FREE( sam_account );
 		if ( lp_map_to_guest() == MAP_TO_GUEST_ON_BAD_UID ) {
-		 	make_server_info_guest(server_info); 
+			make_server_info_guest(NULL, server_info);
 			return NT_STATUS_OK;
 		}
 		return nt_status;
@@ -1584,6 +1651,13 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
 	result->sam_account = sam_account;
 	result->unix_name = talloc_strdup(result, found_username);
 
+	result->sanitized_username = sanitize_username(result,
+						       result->unix_name);
+	if (result->sanitized_username == NULL) {
+		TALLOC_FREE(result);
+		return NT_STATUS_NO_MEMORY;
+	}
+
 	/* Fill in the unix info we found on the way */
 
 	result->uid = uid;
@@ -1728,7 +1802,7 @@ NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
 	if (!NT_STATUS_IS_OK(nt_status)) {
 		TALLOC_FREE( result );
 		if ( lp_map_to_guest() == MAP_TO_GUEST_ON_BAD_UID ) {
-			make_server_info_guest(server_info);
+			make_server_info_guest(NULL, server_info);
 			return NT_STATUS_OK;
 		}
 		return nt_status;
@@ -1819,8 +1893,17 @@ NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
 	result->sam_account = sam_account;
 	result->unix_name = talloc_strdup(result, found_username);
 
+	result->sanitized_username = sanitize_username(result,
+						       result->unix_name);
 	result->login_server = talloc_strdup(result, info->logon_server);
 
+	if ((result->unix_name == NULL)
+	    || (result->sanitized_username == NULL)
+	    || (result->login_server == NULL)) {
+		TALLOC_FREE(result);
+		return NT_STATUS_NO_MEMORY;
+	}
+
 	/* Fill in the unix info we found on the way */
 
 	result->uid = uid;
diff --git a/source/include/smb.h b/source/include/smb.h
index 10af3ff..1d6aba9 100644
--- a/source/include/smb.h
+++ b/source/include/smb.h
@@ -527,12 +527,13 @@ typedef struct files_struct {
 
 struct vuid_cache_entry {
 	uint16 vuid;
+	struct auth_serversupplied_info *server_info;
 	bool read_only;
 	bool admin_user;
 };
 
 struct vuid_cache {
-	unsigned int entries;
+	unsigned int next_entry;
 	struct vuid_cache_entry array[VUID_CACHE_SIZE];
 };
 
@@ -609,7 +610,6 @@ typedef struct connection_struct {
 	unsigned cnum; /* an index passed over the wire */
 	struct share_params *params;
 	bool force_user;
-	bool force_group;
 	struct vuid_cache vuid_cache;
 	struct dptr_struct *dirptr;
 	bool printer;
@@ -624,20 +624,16 @@ typedef struct connection_struct {
 	struct vfs_ops vfs_opaque;			/* OPAQUE Filesystem operations */
 	struct vfs_handle_struct *vfs_handles;		/* for the new plugins */
 
-	char *user; /* name of user who *opened* this connection */
-	uid_t uid; /* uid of user who *opened* this connection */
-	gid_t gid; /* gid of user who *opened* this connection */
+	/*
+	 * This represents the user information on this connection. Depending
+	 * on the vuid using this tid, this might change per SMB request.
+	 */
+	struct auth_serversupplied_info *server_info;
+
 	char client_address[INET6_ADDRSTRLEN]; /* String version of client IP address. */
 
 	uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
 
-	/* following groups stuff added by ih */
-
-	/* This groups info is valid for the user that *opened* the connection */
-	size_t ngroups;
-	gid_t *groups;
-	NT_USER_TOKEN *nt_user_token;
-	
 	time_t lastused;
 	time_t lastused_count;
 	bool used;
diff --git a/source/lib/substitute.c b/source/lib/substitute.c
index c8ad619..17bcbca 100644
--- a/source/lib/substitute.c
+++ b/source/lib/substitute.c
@@ -905,9 +905,9 @@ char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *st
 {
 	return talloc_sub_advanced(ctx,
 				lp_servicename(SNUM(conn)),
-				conn->user,
+				conn->server_info->unix_name,
 				conn->connectpath,
-				conn->gid,
+				conn->server_info->gid,
 				get_smb_user_name(),
 				"",
 				str);
diff --git a/source/lib/util_nttoken.c b/source/lib/util_nttoken.c
index f81191a..774ef49 100644
--- a/source/lib/util_nttoken.c
+++ b/source/lib/util_nttoken.c
@@ -38,14 +38,12 @@ NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken)
 	if (!ptoken)
 		return NULL;
 
-	token = TALLOC_P(mem_ctx, NT_USER_TOKEN);
+	token = TALLOC_ZERO_P(mem_ctx, NT_USER_TOKEN);
 	if (token == NULL) {
 		DEBUG(0, ("talloc failed\n"));
 		return NULL;
 	}
 
-	ZERO_STRUCTP(token);
-
 	if (ptoken->user_sids && ptoken->num_sids) {
 		token->user_sids = (DOM_SID *)talloc_memdup(
 			token, ptoken->user_sids, sizeof(DOM_SID) * ptoken->num_sids );
diff --git a/source/modules/vfs_expand_msdfs.c b/source/modules/vfs_expand_msdfs.c
index 9d4883c..133c5eb 100644
--- a/source/modules/vfs_expand_msdfs.c
+++ b/source/modules/vfs_expand_msdfs.c
@@ -145,9 +145,9 @@ static char *expand_msdfs_target(TALLOC_CTX *ctx,
 
 	targethost = talloc_sub_advanced(ctx,
 				lp_servicename(SNUM(conn)),
-				conn->user,
+				conn->server_info->unix_name,
 				conn->connectpath,
-				conn->gid,
+				conn->server_info->gid,
 				get_current_username(),
 				current_user_info.domain,
 				targethost);
diff --git a/source/modules/vfs_full_audit.c b/source/modules/vfs_full_audit.c
index 19a1d02..31069c1 100644
--- a/source/modules/vfs_full_audit.c
+++ b/source/modules/vfs_full_audit.c
@@ -693,8 +693,10 @@ static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
 		return NULL;
 	}
 	return talloc_sub_advanced(ctx,
-			lp_servicename(SNUM(conn)), conn->user,
-			conn->connectpath, conn->gid,
+			lp_servicename(SNUM(conn)),
+			conn->server_info->unix_name,
+			conn->connectpath,
+			conn->server_info->gid,
 			get_current_username(),
 			current_user_info.domain,
 			prefix);
diff --git a/source/modules/vfs_recycle.c b/source/modules/vfs_recycle.c
index da17167..abfae78 100644
--- a/source/modules/vfs_recycle.c
+++ b/source/modules/vfs_recycle.c
@@ -432,8 +432,9 @@ static int recycle_unlink(vfs_handle_struct *handle, const char *file_name)
 	int rc = -1;
 
 	repository = talloc_sub_advanced(NULL, lp_servicename(SNUM(conn)),
-					conn->user,
-					conn->connectpath, conn->gid,
+					conn->server_info->unix_name,
+					conn->connectpath,
+					conn->server_info->gid,
 					get_current_username(),
 					current_user_info.domain,
 					recycle_repository(handle));
diff --git a/source/smbd/close.c b/source/smbd/close.c
index e27d5c4..df188ba 100644
--- a/source/smbd/close.c
+++ b/source/smbd/close.c
@@ -581,7 +581,7 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_
 	}
 
 	DEBUG(2,("%s closed file %s (numopen=%d) %s\n",
-		conn->user,fsp->fsp_name,
+		conn->server_info->unix_name,fsp->fsp_name,
 		conn->num_files_open,
 		nt_errstr(status) ));
 
diff --git a/source/smbd/conn.c b/source/smbd/conn.c
index af18e90..e899af1 100644
--- a/source/smbd/conn.c
+++ b/source/smbd/conn.c
@@ -151,7 +151,6 @@ find_again:
 
 	num_open++;
 
-	string_set(&conn->user,"");
 	string_set(&conn->dirpath,"");
 	string_set(&conn->connectpath,"");
 	string_set(&conn->origpath,"");
@@ -237,10 +236,14 @@ void conn_clear_vuid_cache(uint16 vuid)
 			conn->vuid = UID_FIELD_INVALID;
 		}
 
-		for (i=0;i<conn->vuid_cache.entries && i< VUID_CACHE_SIZE;i++) {
-			if (conn->vuid_cache.array[i].vuid == vuid) {
-				struct vuid_cache_entry *ent = &conn->vuid_cache.array[i];
+		for (i=0; i<VUID_CACHE_SIZE; i++) {
+			struct vuid_cache_entry *ent;
+
+			ent = &conn->vuid_cache.array[i];
+
+			if (ent->vuid == vuid) {
 				ent->vuid = UID_FIELD_INVALID;
+				TALLOC_FREE(ent->server_info);
 				ent->read_only = False;
 				ent->admin_user = False;
 			}
@@ -279,7 +282,6 @@ void conn_free_internal(connection_struct *conn)
 	free_namearray(conn->veto_oplock_list);
 	free_namearray(conn->aio_write_behind_list);
 	
-	string_free(&conn->user);
 	string_free(&conn->dirpath);
 	string_free(&conn->connectpath);
 	string_free(&conn->origpath);
diff --git a/source/smbd/connection.c b/source/smbd/connection.c
index d7063c9..97f3697 100644
--- a/source/smbd/connection.c
+++ b/source/smbd/connection.c
@@ -152,8 +152,8 @@ bool claim_connection(connection_struct *conn, const char *name,
 	crec.pid = procid_self();
 	crec.cnum = conn?conn->cnum:-1;
 	if (conn) {
-		crec.uid = conn->uid;
-		crec.gid = conn->gid;
+		crec.uid = conn->server_info->uid;
+		crec.gid = conn->server_info->gid;
 		strlcpy(crec.servicename, lp_servicename(SNUM(conn)),
 			sizeof(crec.servicename));
 	}
diff --git a/source/smbd/fake_file.c b/source/smbd/fake_file.c
index 31fe030..0a54c85 100644
--- a/source/smbd/fake_file.c
+++ b/source/smbd/fake_file.c
@@ -113,7 +113,8 @@ NTSTATUS open_fake_file(connection_struct *conn,
 	if (current_user.ut.uid != 0) {
 		DEBUG(3, ("open_fake_file_shared: access_denied to "
 			  "service[%s] file[%s] user[%s]\n",
-			  lp_servicename(SNUM(conn)),fname,conn->user));
+			  lp_servicename(SNUM(conn)), fname,
+			  conn->server_info->unix_name));
 		return NT_STATUS_ACCESS_DENIED;
 
 	}
diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c
index a233893..413b916 100644
--- a/source/smbd/lanman.c
+++ b/source/smbd/lanman.c
@@ -101,9 +101,9 @@ static int CopyExpanded(connection_struct *conn,
 	}
 	buf = talloc_sub_advanced(ctx,
 				lp_servicename(SNUM(conn)),
-				conn->user,
+				conn->server_info->unix_name,
 				conn->connectpath,
-				conn->gid,
+				conn->server_info->gid,
 				get_current_username(),
 				current_user_info.domain,
 				buf);
@@ -152,9 +152,9 @@ static int StrlenExpanded(connection_struct *conn, int snum, char *s)
 	}
 	buf = talloc_sub_advanced(ctx,
 				lp_servicename(SNUM(conn)),
-				conn->user,
+				conn->server_info->unix_name,
 				conn->connectpath,
-				conn->gid,
+				conn->server_info->gid,
 				get_current_username(),
 				current_user_info.domain,
 				buf);
@@ -182,9 +182,9 @@ static char *Expand(connection_struct *conn, int snum, char *s)
 	}
 	return talloc_sub_advanced(ctx,
 				lp_servicename(SNUM(conn)),
-				conn->user,
+				conn->server_info->unix_name,
 				conn->connectpath,
-				conn->gid,
+				conn->server_info->gid,
 				get_current_username(),
 				current_user_info.domain,
 				buf);
@@ -3000,9 +3000,9 @@ static bool api_RNetServerGetInfo(connection_struct *conn,uint16 vuid,
 			SIVAL(p,6,PTR_DIFF(p2,*rdata));
 			comment = talloc_sub_advanced(ctx,
 						lp_servicename(SNUM(conn)),
-						conn->user,
+						conn->server_info->unix_name,
 						conn->connectpath,
-						conn->gid,
+						conn->server_info->gid,
 						get_current_username(),
 						current_user_info.domain,
 						comment);
diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c
index bd34b5a..b5546ea 100644
--- a/source/smbd/nttrans.c
+++ b/source/smbd/nttrans.c
@@ -2037,8 +2037,9 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
 
 	/* access check */
 	if (current_user.ut.uid != 0) {
-		DEBUG(1,("get_user_quota: access_denied service [%s] user [%s]\n",
-			lp_servicename(SNUM(conn)),conn->user));
+		DEBUG(1,("get_user_quota: access_denied service [%s] user "
+			 "[%s]\n", lp_servicename(SNUM(conn)),
+			 conn->server_info->unix_name));
 		reply_doserror(req, ERRDOS, ERRnoaccess);
 		return;
 	}
@@ -2303,8 +2304,9 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
 
 	/* access check */
 	if (current_user.ut.uid != 0) {
-		DEBUG(1,("set_user_quota: access_denied service [%s] user [%s]\n",
-			lp_servicename(SNUM(conn)),conn->user));
+		DEBUG(1,("set_user_quota: access_denied service [%s] user "
+			 "[%s]\n", lp_servicename(SNUM(conn)),
+			 conn->server_info->unix_name));
 		reply_doserror(req, ERRDOS, ERRnoaccess);
 		return;
 	}
diff --git a/source/smbd/open.c b/source/smbd/open.c
index 5c860f8..546128c 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -400,8 +400,9 @@ static NTSTATUS open_file(files_struct *fsp,
 	fsp->wcp = NULL; /* Write cache pointer. */
 
 	DEBUG(2,("%s opened file %s read=%s write=%s (numopen=%d)\n",
-		 *current_user_info.smb_name ?
-		 current_user_info.smb_name : conn->user,fsp->fsp_name,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list