[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Sat May 21 11:20:02 MDT 2011


The branch, master has been updated
       via  1b5c2d8 s4:sam.py - add tests to check that setting "userAccountValue" on usersdon't impact the "primaryGroupID" attribute
       via  e3aa200 s4:samldb LDB module - don't change the "primaryGroupId" on LDB modifications unless we are a computer/dc/rodc
       via  67bf5cf s4:lsa RPC server - handle LDB flags as "unsigned"
       via  d34205a s4:ldb-samba/ldb_wrap.*-dsdb/samdb/samdb.c - handle LDB connection flags as unsigned
       via  4618a7f ldb:pyldb.c - all flags should be unsigned
       via  74b50b4 ldb:ldb_sqlite3.c - all LDB flags should be handled as "unsigned"
       via  3956e68 ldb:tools/cmdline.c + tools/ldbtest.c - the connection flags are typed as "unsigned"
       via  e6c5e11 ldb:ldbtest.c - make more use of LDB constants
       via  5c4fabb s4:torture - always cast correctly when using the "%x" format string argument
       via  f44808f s4:auth/ntlmssp/ntlmssp_server.c - add "const" in front of "dnsdomain"
      from  850cca3 add a demo script for dirsync

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


- Log -----------------------------------------------------------------
commit 1b5c2d8e924e32b1a4eae36c7b353de8a126a422
Author: Matthieu Patou <mat at matws.net>
Date:   Sat May 21 14:35:58 2011 +0400

    s4:sam.py - add tests to check that setting "userAccountValue" on usersdon't impact the "primaryGroupID" attribute
    
    Notice: The domain administrators groups isn't referenced as "Domain Admins"
    since this name could differ.
    
    Signed-off-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    
    Autobuild-User: Matthias Dieter Wallnöfer <mdw at samba.org>
    Autobuild-Date: Sat May 21 19:19:57 CEST 2011 on sn-devel-104

commit e3aa200a14e92f82c8233cad1b8062ffcc5a9a7e
Author: Matthieu Patou <mat at matws.net>
Date:   Sat May 21 11:56:45 2011 +0400

    s4:samldb LDB module - don't change the "primaryGroupId" on LDB modifications unless we are a computer/dc/rodc
    
    Signed-off-by: Matthias Dieter Wallnöfer <mdw at samba.org>

commit 67bf5cfc0853078e4e817dbc1a9f9de78ed2610d
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Wed Apr 13 09:01:42 2011 +0200

    s4:lsa RPC server - handle LDB flags as "unsigned"
    
    Signed-off-by: Metze

commit d34205add33c028dfd8ca1f8c364013b71f5b3a1
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sun Apr 10 19:54:31 2011 +0200

    s4:ldb-samba/ldb_wrap.*-dsdb/samdb/samdb.c - handle LDB connection flags as unsigned
    
    The LDB API ("ldb_connect") prescribes that they should be "unsigned".
    
    Signed-off-by: Metze

commit 4618a7f3a188e938070e1aa70a9209cdc8045f81
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sun Apr 10 19:48:07 2011 +0200

    ldb:pyldb.c - all flags should be unsigned
    
    Adapt it to the previous commits
    
    Reviewed-by: Jelmer + Metze

commit 74b50b47e962ae7a7e90b054f4bab7527397b7de
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Wed Apr 13 09:05:34 2011 +0200

    ldb:ldb_sqlite3.c - all LDB flags should be handled as "unsigned"
    
    Signed-off-by: Metze

commit 3956e6840d1619519bf9848574baf60efa926b42
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sun Apr 10 19:44:53 2011 +0200

    ldb:tools/cmdline.c + tools/ldbtest.c - the connection flags are typed as "unsigned"
    
    Signed-off-by: Metze

commit e6c5e11116afb8e6f5c16267c62e90084ac7d4da
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Wed May 11 14:25:11 2011 +0200

    ldb:ldbtest.c - make more use of LDB constants
    
    Signed-off-by: Metze

commit 5c4fabb08edfdc8e4da431927c5337e96988beef
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sat May 7 11:06:38 2011 +0200

    s4:torture - always cast correctly when using the "%x" format string argument
    
    Signed-off-by: Metze

commit f44808fa1197c28137808f7e8560bbe3ed439cff
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sat May 7 10:37:24 2011 +0200

    s4:auth/ntlmssp/ntlmssp_server.c - add "const" in front of "dnsdomain"
    
    Signed-off-by: Metze

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

Summary of changes:
 source4/auth/ntlmssp/ntlmssp_server.c     |    2 +-
 source4/dsdb/samdb/ldb_modules/samldb.c   |   17 +++++++++++-
 source4/dsdb/samdb/samdb.c                |    2 +-
 source4/dsdb/tests/python/sam.py          |   42 +++++++++++++++++++++++++++-
 source4/lib/ldb-samba/ldb_wrap.c          |    6 ++--
 source4/lib/ldb-samba/ldb_wrap.h          |    6 ++--
 source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c |    5 ++-
 source4/lib/ldb/pyldb.c                   |   20 +++++++-------
 source4/lib/ldb/tools/cmdline.c           |    2 +-
 source4/lib/ldb/tools/ldbtest.c           |   10 +++---
 source4/rpc_server/lsa/dcesrv_lsa.c       |    2 +-
 source4/torture/basic/attr.c              |    2 +-
 source4/torture/raw/open.c                |   10 +++---
 13 files changed, 90 insertions(+), 36 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/auth/ntlmssp/ntlmssp_server.c b/source4/auth/ntlmssp/ntlmssp_server.c
index 56315c5..240edbe 100644
--- a/source4/auth/ntlmssp/ntlmssp_server.c
+++ b/source4/auth/ntlmssp/ntlmssp_server.c
@@ -308,7 +308,7 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security)
 	ntlmssp_state->server.netbios_domain = lpcfg_workgroup(gensec_security->settings->lp_ctx);
 
 	{
-		char *dnsdomain = lpcfg_dnsdomain(gensec_security->settings->lp_ctx);
+		const char *dnsdomain = lpcfg_dnsdomain(gensec_security->settings->lp_ctx);
 		char *dnsname, *lower_netbiosname;
 		lower_netbiosname = strlower_talloc(ntlmssp_state, ntlmssp_state->server.netbios_name);
 
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 2134185..216e14d 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -1219,6 +1219,12 @@ static int samldb_prim_group_trigger(struct samldb_ctx *ac)
 	return ret;
 }
 
+
+/**
+ * This function is called on a LDB modify. It performs some additions/changes
+ * on the current LDB message. Changes depend on the value of
+ * userAccountControl.
+ */
 static int samldb_user_account_control_change(struct samldb_ctx *ac)
 {
 	struct ldb_context *ldb = ldb_module_get_ctx(ac->module);
@@ -1278,7 +1284,16 @@ static int samldb_user_account_control_change(struct samldb_ctx *ac)
 		el->flags = LDB_FLAG_MOD_REPLACE;
 	}
 
-	if (!ldb_msg_find_element(ac->msg, "primaryGroupID")) {
+	/*
+	 * If the account has UF_SERVER_TRUST_ACCOUNT or
+	 * UF_WORKSTATION_TRUST_ACCOUNT then change the group
+	 * as it's either a workstation, a RODC, or a DC.
+	 *
+	 * If not it might be just a user that we are enabling
+	 * and in this case we don't want to change its default group.
+	 */
+	if (user_account_control & (UF_SERVER_TRUST_ACCOUNT| UF_WORKSTATION_TRUST_ACCOUNT) &&
+			!ldb_msg_find_element(ac->msg, "primaryGroupID")) {
 		uint32_t rid = ds_uf2prim_group_rid(user_account_control);
 		ret = samdb_msg_add_uint(ldb, ac->msg, ac->msg,
 					 "primaryGroupID", rid);
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 29b4544..cef0d1e 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -96,7 +96,7 @@ struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx,
 				  struct tevent_context *ev_ctx,
 				  struct loadparm_context *lp_ctx,
 				  struct auth_session_info *session_info,
-				  int flags)
+				  unsigned int flags)
 {
 	struct ldb_context *ldb;
 	struct dsdb_schema *schema;
diff --git a/source4/dsdb/tests/python/sam.py b/source4/dsdb/tests/python/sam.py
index 5f7c90d..ee6f122 100755
--- a/source4/dsdb/tests/python/sam.py
+++ b/source4/dsdb/tests/python/sam.py
@@ -36,8 +36,8 @@ from samba.dsdb import (UF_NORMAL_ACCOUNT, UF_ACCOUNTDISABLE,
     ATYPE_SECURITY_LOCAL_GROUP, ATYPE_DISTRIBUTION_GLOBAL_GROUP,
     ATYPE_DISTRIBUTION_UNIVERSAL_GROUP, ATYPE_DISTRIBUTION_LOCAL_GROUP,
     ATYPE_WORKSTATION_TRUST)
-from samba.dcerpc.security import (DOMAIN_RID_USERS, DOMAIN_RID_DOMAIN_MEMBERS,
-    DOMAIN_RID_DCS, DOMAIN_RID_READONLY_DCS)
+from samba.dcerpc.security import (DOMAIN_RID_USERS, DOMAIN_RID_ADMINS,
+    DOMAIN_RID_DOMAIN_MEMBERS, DOMAIN_RID_DCS, DOMAIN_RID_READONLY_DCS)
 
 from subunit.run import SubunitTestRunner
 import unittest
@@ -1866,7 +1866,45 @@ class SamTests(unittest.TestCase):
 #        except LdbError, (num, _):
 #            self.assertEquals(num, ERR_INSUFFICIENT_ACCESS_RIGHTS)
 
+        ldb.add({
+            "dn": "cn=ldaptestuser2,cn=users," + self.base_dn,
+            "objectclass": "user",
+            "userAccountControl": str(UF_NORMAL_ACCOUNT | UF_PASSWD_NOTREQD | UF_ACCOUNTDISABLE)})
+
+        res1 = ldb.search("cn=ldaptestuser2,cn=users," + self.base_dn,
+                          scope=SCOPE_BASE,
+                          attrs=["userAccountControl"])
+        self.assertTrue(len(res1) == 1)
+        self.assertEquals(int(res1[0]["userAccountControl"][0]),
+           UF_NORMAL_ACCOUNT | UF_PASSWD_NOTREQD | UF_ACCOUNTDISABLE)
+
+        m = Message()
+        m.dn = Dn(ldb, "<SID=" + ldb.get_domain_sid() + "-" + str(DOMAIN_RID_ADMINS) + ">")
+        m["member"] = MessageElement(
+          "cn=ldaptestuser2,cn=users," + self.base_dn, FLAG_MOD_ADD, "member")
+        ldb.modify(m)
+
+        m = Message()
+        m.dn = Dn(ldb, "cn=ldaptestuser2,cn=users," + self.base_dn)
+        m["primaryGroupID"] = MessageElement(str(DOMAIN_RID_ADMINS),
+          FLAG_MOD_REPLACE, "primaryGroupID")
+        ldb.modify(m)
+
+        m = Message()
+        m.dn = Dn(ldb, "cn=ldaptestuser2,cn=users," + self.base_dn)
+        m["userAccountControl"] = MessageElement(
+          str(UF_NORMAL_ACCOUNT | UF_PASSWD_NOTREQD),
+          FLAG_MOD_REPLACE, "userAccountControl")
+        ldb.modify(m)
+
+        res1 = ldb.search("cn=ldaptestuser2,cn=users," + self.base_dn,
+                          scope=SCOPE_BASE,
+                          attrs=["userAccountControl", "primaryGroupID"])
+        self.assertTrue(int(res1[0]["userAccountControl"][0]) & UF_ACCOUNTDISABLE == 0)
+        self.assertEquals(int(res1[0]["primaryGroupID"][0]), DOMAIN_RID_ADMINS)
+
         delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
+        delete_force(self.ldb, "cn=ldaptestuser2,cn=users," + self.base_dn)
         delete_force(self.ldb, "cn=ldaptestcomputer,cn=computers," + self.base_dn)
 
     def test_service_principal_name_updates(self):
diff --git a/source4/lib/ldb-samba/ldb_wrap.c b/source4/lib/ldb-samba/ldb_wrap.c
index 6d92f60..f7d5623 100644
--- a/source4/lib/ldb-samba/ldb_wrap.c
+++ b/source4/lib/ldb-samba/ldb_wrap.c
@@ -177,7 +177,7 @@ char *wrap_casefold(void *context, void *mem_ctx, const char *s, size_t n)
 				   struct loadparm_context *lp_ctx,
 				   struct auth_session_info *session_info,
 				   struct cli_credentials *credentials,
-				   int flags)
+				   unsigned int flags)
 {
 	struct ldb_wrap *w;
 	/* see if we can re-use an existing ldb */
@@ -195,7 +195,7 @@ char *wrap_casefold(void *context, void *mem_ctx, const char *s, size_t n)
 }
 
 int samba_ldb_connect(struct ldb_context *ldb, struct loadparm_context *lp_ctx,
-		      const char *url, int flags)
+		      const char *url, unsigned int flags)
 {
 	int ret;
 	char *real_url = NULL;
@@ -230,7 +230,7 @@ int samba_ldb_connect(struct ldb_context *ldb, struct loadparm_context *lp_ctx,
 		   struct loadparm_context *lp_ctx,
 		   struct auth_session_info *session_info,
 		   struct cli_credentials *credentials,
-		   int flags,
+		   unsigned int flags,
 		   struct ldb_context *ldb)
 {
 	struct ldb_wrap *w;
diff --git a/source4/lib/ldb-samba/ldb_wrap.h b/source4/lib/ldb-samba/ldb_wrap.h
index 4d2539f..aa7ccb3 100644
--- a/source4/lib/ldb-samba/ldb_wrap.h
+++ b/source4/lib/ldb-samba/ldb_wrap.h
@@ -53,18 +53,18 @@ struct ldb_context *ldb_wrap_find(const char *url,
 								  struct loadparm_context *lp_ctx,
 								  struct auth_session_info *session_info,
 								  struct cli_credentials *credentials,
-								  int flags);
+								  unsigned int flags);
 bool ldb_wrap_add(const char *url, struct tevent_context *ev,
 				  struct loadparm_context *lp_ctx,
 				  struct auth_session_info *session_info,
 				  struct cli_credentials *credentials,
-				  int flags,
+				  unsigned int flags,
 				  struct ldb_context *ldb);
 char *ldb_relative_path(struct ldb_context *ldb,
 				 TALLOC_CTX *mem_ctx,
 				 const char *name);
 
 int samba_ldb_connect(struct ldb_context *ldb, struct loadparm_context *lp_ctx,
-		      const char *url, int flags);
+		      const char *url, unsigned int flags);
 
 #endif /* _LDB_WRAP_H_ */
diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
index e5b43fd..223868a 100644
--- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
+++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
@@ -1136,7 +1136,7 @@ static int lsql_modify(struct lsql_context *ctx)
 	for (i = 0; i < msg->num_elements; i++) {
 		const struct ldb_message_element *el = &msg->elements[i];
 		const struct ldb_schema_attribute *a;
-		int flags = el->flags & LDB_FLAG_MOD_MASK;
+		unsigned int flags = el->flags & LDB_FLAG_MOD_MASK;
 		char *attr;
 		char *mod;
 		unsigned int j;
@@ -1596,7 +1596,8 @@ static const struct ldb_module_ops lsqlite3_ops = {
  */
 
 static int initialize(struct lsqlite3_private *lsqlite3,
-		      struct ldb_context *ldb, const char *url, int flags)
+		      struct ldb_context *ldb, const char *url,
+		      unsigned int flags)
 {
 	TALLOC_CTX *local_ctx;
         long long queryInt;
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index 5fcc5a6..68f9098 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -48,7 +48,7 @@ static PyObject *PyLdbModule_FromModule(struct ldb_module *mod);
 static struct ldb_message_element *PyObject_AsMessageElement(
 						      TALLOC_CTX *mem_ctx,
 						      PyObject *set_obj,
-						      int flags,
+						      unsigned int flags,
 						      const char *attr_name);
 
 /* There's no Py_ssize_t in 2.4, apparently */
@@ -737,11 +737,11 @@ static int py_ldb_init(PyLdbObject *self, PyObject *args, PyObject *kwargs)
 	char *url = NULL;
 	PyObject *py_options = Py_None;
 	const char **options;
-	int flags = 0;
+	unsigned int flags = 0;
 	int ret;
 	struct ldb_context *ldb;
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ziO:Ldb.__init__",
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zIO:Ldb.__init__",
 					 discard_const_p(char *, kwnames),
 					 &url, &flags, &py_options))
 		return -1;
@@ -792,13 +792,13 @@ static PyObject *py_ldb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs
 static PyObject *py_ldb_connect(PyLdbObject *self, PyObject *args, PyObject *kwargs)
 {
 	char *url;
-	int flags = 0;
+	unsigned int flags = 0;
 	PyObject *py_options = Py_None;
 	int ret;
 	const char **options;
 	const char * const kwnames[] = { "url", "flags", "options", NULL };
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ziO",
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zIO",
 					 discard_const_p(char *, kwnames),
 					 &url, &flags, &py_options))
 		return NULL;
@@ -2031,7 +2031,7 @@ static PyTypeObject PyLdbModule = {
 static struct ldb_message_element *PyObject_AsMessageElement(
 						      TALLOC_CTX *mem_ctx,
 						      PyObject *set_obj,
-						      int flags,
+						      unsigned int flags,
 						      const char *attr_name)
 {
 	struct ldb_message_element *me;
@@ -2122,9 +2122,9 @@ static PyObject *py_ldb_msg_element_flags(PyLdbMessageElementObject *self, PyObj
 
 static PyObject *py_ldb_msg_element_set_flags(PyLdbMessageElementObject *self, PyObject *args)
 {
-	int flags;
+	unsigned int flags;
 	struct ldb_message_element *el;
-	if (!PyArg_ParseTuple(args, "i", &flags))
+	if (!PyArg_ParseTuple(args, "I", &flags))
 		return NULL;
 
 	el = PyLdbMessageElement_AsMessageElement(self);
@@ -2192,13 +2192,13 @@ static PyObject *py_ldb_msg_element_new(PyTypeObject *type, PyObject *args, PyOb
 {
 	PyObject *py_elements = NULL;
 	struct ldb_message_element *el;
-	int flags = 0;
+	unsigned int flags = 0;
 	char *name = NULL;
 	const char * const kwnames[] = { "elements", "flags", "name", NULL };
 	PyLdbMessageElementObject *ret;
 	TALLOC_CTX *mem_ctx;
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Ois",
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OIs",
 					 discard_const_p(char *, kwnames),
 					 &py_elements, &flags, &name))
 		return NULL;
diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c
index c259941..a06445f 100644
--- a/source4/lib/ldb/tools/cmdline.c
+++ b/source4/lib/ldb/tools/cmdline.c
@@ -101,7 +101,7 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb,
 	poptContext pc;
 	int num_options = 0;
 	int opt;
-	int flags = 0;
+	unsigned int flags = 0;
 	int rc;
 	struct poptOption **popt_options;
 
diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c
index 5270357..4e181af 100644
--- a/source4/lib/ldb/tools/ldbtest.c
+++ b/source4/lib/ldb/tools/ldbtest.c
@@ -126,7 +126,7 @@ static void add_records(struct ldb_context *ldb,
 
 		ldb_delete(ldb, msg.dn);
 
-		if (ldb_add(ldb, &msg) != 0) {
+		if (ldb_add(ldb, &msg) != LDB_SUCCESS) {
 			printf("Add of %s failed - %s\n", name, ldb_errstring(ldb));
 			exit(LDB_ERR_OPERATIONS_ERROR);
 		}
@@ -183,7 +183,7 @@ static void modify_records(struct ldb_context *ldb,
 		vals[2].data = (uint8_t *)talloc_asprintf(tmp_ctx, "%s at other2.example.com", name);
 		vals[2].length = strlen((char *)vals[2].data);
 
-		if (ldb_modify(ldb, &msg) != 0) {
+		if (ldb_modify(ldb, &msg) != LDB_SUCCESS) {
 			printf("Modify of %s failed - %s\n", name, ldb_errstring(ldb));
 			exit(LDB_ERR_OPERATIONS_ERROR);
 		}
@@ -213,7 +213,7 @@ static void delete_records(struct ldb_context *ldb,
 		printf("Deleting uid Test%d\r", i);
 		fflush(stdout);
 
-		if (ldb_delete(ldb, dn) != 0) {
+		if (ldb_delete(ldb, dn) != LDB_SUCCESS) {
 			printf("Delete of %s failed - %s\n", ldb_dn_get_linearized(dn), ldb_errstring(ldb));
 			exit(LDB_ERR_OPERATIONS_ERROR);
 		}
@@ -304,7 +304,7 @@ static void start_test_index(struct ldb_context **ldb)
 	struct ldb_dn *indexlist;
 	struct ldb_dn *basedn;
 	int ret;
-	int flags = 0;
+	unsigned int flags = 0;
 	const char *specials;
 
 	specials = getenv("LDB_SPECIALS");
@@ -343,7 +343,7 @@ static void start_test_index(struct ldb_context **ldb)
 	ldb_msg_add_string(msg, "uid", strdup("test"));
 	ldb_msg_add_string(msg, "objectClass", strdup("OpenLDAPperson"));
 
-	if (ldb_add(*ldb, msg) != 0) {
+	if (ldb_add(*ldb, msg) != LDB_SUCCESS) {
 		printf("Add of %s failed - %s\n", ldb_dn_get_linearized(msg->dn), ldb_errstring(*ldb));
 		exit(LDB_ERR_OPERATIONS_ERROR);
 	}
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index b9fe5a3..50ce234 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -1429,7 +1429,7 @@ static NTSTATUS update_uint32_t_value(TALLOC_CTX *mem_ctx,
 {
 	const struct ldb_val *orig_val;
 	uint32_t orig_uint = 0;
-	int flags = 0;
+	unsigned int flags = 0;
 	int ret;
 
 	orig_val = ldb_msg_find_ldb_val(orig, attribute);
diff --git a/source4/torture/basic/attr.c b/source4/torture/basic/attr.c
index 9655f7a..2f0248e 100644
--- a/source4/torture/basic/attr.c
+++ b/source4/torture/basic/attr.c
@@ -374,7 +374,7 @@ error_exit_file:
 				[0x%x], got attr 0x%x, should be 0x%x\n",
 			        open_attrs_table[j],
 			        (uint16_t)attr,
-			        (int)open_attrs_table[j]|FILE_ATTRIBUTE_DIRECTORY);
+			        (unsigned int)(open_attrs_table[j]|FILE_ATTRIBUTE_DIRECTORY));
 			CHECK_MAX_FAILURES(error_exit_dir);
 		}
 
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index beb6290..8a66a12 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -130,7 +130,7 @@ static const char *rdwr_string(enum rdwr_mode m)
 	if ((v) != (finfo.all_info.out.field)) { \
 		torture_result(tctx, TORTURE_FAIL, \
 		       "(%s) wrong value for field %s  0x%x - 0x%x\n", \
-		       __location__, #field, (int)v, (int)(finfo.all_info.out.field)); \
+		       __location__, #field, (unsigned int)(v), (unsigned int)(finfo.all_info.out.field)); \
 		dump_all_info(tctx, &finfo); \
 		ret = false; \
 	}} while (0)
@@ -139,7 +139,7 @@ static const char *rdwr_string(enum rdwr_mode m)
 	if ((v) != (correct)) { \
 		torture_result(tctx, TORTURE_FAIL, \
 		       "(%s) wrong value for %s  0x%x - should be 0x%x\n", \
-		       __location__, #v, (int)(v), (int)correct); \
+		       __location__, #v, (unsigned int)(v), (unsigned int)(correct)); \
 		ret = false; \
 	}} while (0)
 
@@ -152,7 +152,7 @@ static const char *rdwr_string(enum rdwr_mode m)
 	status = smb_raw_setpathinfo(cli->tree, &sfinfo); \
 	if (!NT_STATUS_IS_OK(status)) { \
 		torture_warning(tctx, "(%s) Failed to set attrib 0x%x on %s\n", \
-		       __location__, (int)sattrib, fname); \
+		       __location__, (unsigned int)(sattrib), fname); \
 	}} while (0)
 
 /*
@@ -337,7 +337,7 @@ static bool test_openx(struct torture_context *tctx, struct smbcli_state *cli)
 				__location__, nt_errstr(status),
 				nt_errstr(open_funcs[i].correct_status),
 				i, (int)open_funcs[i].with_file,
-				(int)open_funcs[i].open_func);
+				open_funcs[i].open_func);
 			ret = false;
 		}
 		if (NT_STATUS_IS_OK(status)) {
@@ -602,7 +602,7 @@ static bool test_t2open(struct torture_context *tctx, struct smbcli_state *cli)
 				 __location__, nt_errstr(status),
 				nt_errstr(open_funcs[i].correct_status),
 				i, (int)open_funcs[i].with_file,
-				(int)open_funcs[i].open_func);
+				open_funcs[i].open_func);
 			ret = false;
 		}
 		if (NT_STATUS_IS_OK(status)) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list