[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Feb 20 03:13:01 MST 2011


The branch, master has been updated
       via  ac19b39 s3: Fix return code of pdb_ads_getsamupriv if the user does not exist
       via  5f953b1 s3: Add ACB_NORMAL to workstations, match RPC-SAMR
       via  351b672 s3: Make QueryDispInfo and QueryInfo match for guest
       via  3e4da94 s3: NO_SUCH_USER is a lot more likely than NO_MEMORY
       via  51b84a9 s3: Convert init_system_info to NTSTATUS
       via  88f5215 s3: Slightly simplify Get_Pwnam_alloc
       via  13bfae9 s3: Fix some nonempty blank lines
      from  8ad127e s3:tests: fix the smbclient_s3 test for multiple users running it.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ac19b3957774193b178f9cb61829384b70fc2126
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 19 18:25:25 2011 +0100

    s3: Fix return code of pdb_ads_getsamupriv if the user does not exist
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Sun Feb 20 11:12:01 CET 2011 on sn-devel-104

commit 5f953b1ef82ee280d58bc41a125d3e51cc26f38c
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 19 17:52:50 2011 +0100

    s3: Add ACB_NORMAL to workstations, match RPC-SAMR

commit 351b672426dfba61b7994e59350f4ee3c6d49bc0
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 19 17:44:48 2011 +0100

    s3: Make QueryDispInfo and QueryInfo match for guest

commit 3e4da946699f77abd40c9eb03c2cf67263149e16
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 19 23:20:34 2011 +0100

    s3: NO_SUCH_USER is a lot more likely than NO_MEMORY

commit 51b84a9ed7eaa7e38e2279a825290976bfa40177
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Feb 19 20:05:07 2011 +0100

    s3: Convert init_system_info to NTSTATUS

commit 88f52155607ccc653d4f4610557bfa10b83e4c73
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Feb 14 21:41:00 2011 +0100

    s3: Slightly simplify Get_Pwnam_alloc

commit 13bfae95e7eae9cdca0c20af7b6c95138504d76a
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Feb 14 21:39:10 2011 +0100

    s3: Fix some nonempty blank lines

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

Summary of changes:
 source3/auth/auth_util.c    |    9 ++++-----
 source3/include/proto.h     |    2 +-
 source3/lib/username.c      |    9 +++------
 source3/passdb/pdb_ads.c    |   37 +++++++++++++++++++++++++++++--------
 source3/smbd/sec_ctx.c      |   12 ++++++------
 source3/smbd/server.c       |    6 ++++--
 source3/winbindd/winbindd.c |    6 ++++--
 7 files changed, 51 insertions(+), 30 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 1c036ff..3143710 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -757,7 +757,7 @@ static NTSTATUS make_new_server_info_system(TALLOC_CTX *mem_ctx,
 
 	pwd = getpwuid_alloc(mem_ctx, sec_initial_uid());
 	if (pwd == NULL) {
-		return NT_STATUS_NO_MEMORY;
+		return NT_STATUS_NO_SUCH_USER;
 	}
 
 	status = make_serverinfo_from_username(mem_ctx,
@@ -918,13 +918,12 @@ NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
 
 static struct auth_serversupplied_info *system_info = NULL;
 
-bool init_system_info(void)
+NTSTATUS init_system_info(void)
 {
 	if (system_info != NULL)
-		return True;
+		return NT_STATUS_OK;
 
-	return NT_STATUS_IS_OK(make_new_server_info_system(NULL,
-							   &system_info));
+	return make_new_server_info_system(NULL, &system_info);
 }
 
 NTSTATUS make_server_info_system(TALLOC_CTX *mem_ctx,
diff --git a/source3/include/proto.h b/source3/include/proto.h
index a2cc222..f6c77b6 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -143,7 +143,7 @@ NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
 						 const struct auth_serversupplied_info *src);
 bool init_guest_info(void);
-bool init_system_info(void);
+NTSTATUS init_system_info(void);
 bool server_info_set_session_key(struct auth_serversupplied_info *info,
 				 DATA_BLOB session_key);
 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
diff --git a/source3/lib/username.c b/source3/lib/username.c
index afe83ac..7d3a541 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -9,12 +9,12 @@
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -193,7 +193,6 @@ done:
 struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user)
 {
 	fstring user2;
-	struct passwd *ret;
 
 	if ( *user == '\0' ) {
 		DEBUG(10,("Get_Pwnam: empty username!\n"));
@@ -204,9 +203,7 @@ struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user)
 
 	DEBUG(5,("Finding user %s\n", user));
 
-	ret = Get_Pwnam_internals(mem_ctx, user, user2);
-	
-	return ret;  
+	return Get_Pwnam_internals(mem_ctx, user, user2);
 }
 
 /* The functions below have been taken from password.c and slightly modified */
diff --git a/source3/passdb/pdb_ads.c b/source3/passdb/pdb_ads.c
index bcb803b..ad38256 100644
--- a/source3/passdb/pdb_ads.c
+++ b/source3/passdb/pdb_ads.c
@@ -492,7 +492,7 @@ static NTSTATUS pdb_ads_getsamupriv(struct pdb_ads_state *state,
 	if (count != 1) {
 		DEBUG(10, ("Expected 1 user, got %d\n", count));
 		TALLOC_FREE(result);
-		return NT_STATUS_INTERNAL_DB_CORRUPTION;
+		return NT_STATUS_NO_SUCH_USER;
 	}
 
 	result->ldapmsg = users[0];
@@ -1956,6 +1956,7 @@ static bool pdb_ads_search_filter(struct pdb_methods *m,
 	for (i=0; i<num_users; i++) {
 		struct samr_displayentry *e;
 		struct dom_sid sid;
+		uint32_t ctrl;
 
 		e = &sstate->entries[sstate->num_entries];
 
@@ -1965,19 +1966,39 @@ static bool pdb_ads_search_filter(struct pdb_methods *m,
 			continue;
 		}
 		sid_peek_rid(&sid, &e->rid);
-		e->acct_flags = ACB_NORMAL;
-		e->account_name = tldap_talloc_single_attribute(
-			users[i], "samAccountName", sstate->entries);
+
+		if (tldap_pull_uint32(users[i], "userAccountControl", &ctrl)) {
+			e->acct_flags = ds_uf2acb(ctrl);
+			if (e->acct_flags & (ACB_WSTRUST|ACB_SVRTRUST)) {
+				e->acct_flags |= ACB_NORMAL;
+			}
+		} else {
+			e->acct_flags = ACB_NORMAL;
+		}
+
+		if (e->rid == DOMAIN_RID_GUEST) {
+			/*
+			 * Guest is specially crafted in s3. Make
+			 * QueryDisplayInfo match QueryUserInfo
+			 */
+			e->account_name = lp_guestaccount();
+			e->fullname = lp_guestaccount();
+			e->description = "";
+			e->acct_flags = ACB_NORMAL;
+		} else {
+			e->account_name = tldap_talloc_single_attribute(
+				users[i], "samAccountName", sstate->entries);
+			e->fullname = tldap_talloc_single_attribute(
+				users[i], "displayName", sstate->entries);
+			e->description = tldap_talloc_single_attribute(
+				users[i], "description", sstate->entries);
+		}
 		if (e->account_name == NULL) {
 			return false;
 		}
-		e->fullname = tldap_talloc_single_attribute(
-                        users[i], "displayName", sstate->entries);
 		if (e->fullname == NULL) {
 			e->fullname = "";
 		}
-		e->description = tldap_talloc_single_attribute(
-                        users[i], "description", sstate->entries);
 		if (e->description == NULL) {
 			e->description = "";
 		}
diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c
index 2405eb5..54ee7ac 100644
--- a/source3/smbd/sec_ctx.c
+++ b/source3/smbd/sec_ctx.c
@@ -2,17 +2,17 @@
    Unix SMB/CIFS implementation.
    uid/user handling
    Copyright (C) Tim Potter 2000
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -81,7 +81,7 @@ static bool become_gid(gid_t gid)
 			become_gid_done = true;
 		}
 	}
-  
+
 	/* Set effective group id */
 
 	set_effective_gid(gid);
@@ -304,7 +304,7 @@ static void set_unix_security_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *grou
 void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, struct security_token *token)
 {
 	struct sec_ctx *ctx_p = &sec_ctx_stack[sec_ctx_stack_ndx];
-	
+
 	/* Set the security context */
 
 	DEBUG(3, ("setting sec ctx (%u, %u) - sec_ctx_stack_ndx = %d\n", 
@@ -324,7 +324,7 @@ void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, struct securi
 	}
 
 	TALLOC_FREE(ctx_p->token);
-	
+
 	if (ngroups) {
 		ctx_p->ut.groups = (gid_t *)memdup(groups,
 						   sizeof(gid_t) * ngroups);
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index f4436bf..abdd52a 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1179,8 +1179,10 @@ extern void build_options(bool screen);
 		exit(1);
 	}
 
-	if (!init_system_info()) {
-		DEBUG(0,("ERROR: failed to setup system user info.\n"));
+	status = init_system_info();
+	if (!NT_STATUS_IS_OK(status)) {
+		DEBUG(1, ("ERROR: failed to setup system user info: %s.\n",
+			  nt_errstr(status)));
 		return -1;
 	}
 
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 92ae12f..d9a302c 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1398,8 +1398,10 @@ int main(int argc, char **argv, char **envp)
 
 	winbindd_register_handlers();
 
-	if (!init_system_info()) {
-		DEBUG(0,("ERROR: failed to setup system user info.\n"));
+	status = init_system_info();
+	if (!NT_STATUS_IS_OK(status)) {
+		DEBUG(1, ("ERROR: failed to setup system user info: %s.\n",
+			  nt_errstr(status)));
 		exit(1);
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list