[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Mon Feb 14 00:46:03 MST 2011


The branch, master has been updated
       via  a6af1ef s4-dsdb: cope with broken exchange schema with single valued backlinks
       via  95e347a s4-ldb: fixed a uninitialised el->flags in ldb_tdb
       via  12a1e02 s4-dsdb: cleanups to the backupkey RPC server
       via  63d4a99 s4-dsdb: fixed problem with constrained modification of description attribute
       via  c2ccd24 s4-ldb: added LDB_FLAG_INTERNAL_FORCE_SINGLE_VALUE_CHECK
       via  a48328a s4-ldb: use a helper function for single valued checking
       via  a26f8b8 ldb-web: update mailing list info
       via  b3f3287 script: sign library releases with Samba Library Distribution Key
      from  b2e126c s4:selftest: add tests with seal and sign for backupkey

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


- Log -----------------------------------------------------------------
commit a6af1efb422e10bb66524fdceb2babaa8ca1bffe
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 14 13:22:27 2011 +1100

    s4-dsdb: cope with broken exchange schema with single valued backlinks
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Mon Feb 14 08:45:51 CET 2011 on sn-devel-104

commit 95e347a2d05d3b2c01655e02fd9eb0f5e4659ec1
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 14 13:08:44 2011 +1100

    s4-ldb: fixed a uninitialised el->flags in ldb_tdb
    
    this caused an intermittent failure in some tests
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 12a1e02002f7709c8d5a7fa9e5b6de829b9bee41
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 14 12:03:21 2011 +1100

    s4-dsdb: cleanups to the backupkey RPC server
    
    - fixed some warnings
    - change the debug levels to something more reasonable
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 63d4a99c1b7bb6937eca9f79dc77067468ae8333
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 14 10:14:15 2011 +1100

    s4-dsdb: fixed problem with constrained modification of description attribute
    
    This approach just asks the tdb backend to handle the single valued
    constraint for us
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit c2ccd24ebf91125394e4aa369945cc689152ff5f
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 14 10:08:24 2011 +1100

    s4-ldb: added LDB_FLAG_INTERNAL_FORCE_SINGLE_VALUE_CHECK
    
    this allows a ldb module to force an element as single valued

commit a48328a8282d116d17515cfe681c1b41f6541d39
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 14 10:07:21 2011 +1100

    s4-ldb: use a helper function for single valued checking
    
    this gives us a single piece of logic for single value checking in the
    tdb backend
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit a26f8b8ae6e147b59747cb140dbde2eddef8c970
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Feb 11 16:15:17 2011 +1100

    ldb-web: update mailing list info

commit b3f32871c1d329ccbd14f58d6069a22248e30dfe
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Feb 11 16:05:47 2011 +1100

    script: sign library releases with Samba Library Distribution Key

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

Summary of changes:
 script/librelease.sh                            |    4 +-
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c |    7 ++
 source4/dsdb/samdb/ldb_modules/samldb.c         |   57 ++++--------------
 source4/lib/ldb/include/ldb_module.h            |    3 +
 source4/lib/ldb/ldb_tdb/ldb_tdb.c               |   71 ++++++++++++++---------
 source4/lib/ldb/web/index.html                  |   10 ++--
 source4/rpc_server/backupkey/dcesrv_backupkey.c |   30 +++++-----
 7 files changed, 90 insertions(+), 92 deletions(-)


Changeset truncated at 500 lines:

diff --git a/script/librelease.sh b/script/librelease.sh
index 1c75bf1..b2bc9e7 100755
--- a/script/librelease.sh
+++ b/script/librelease.sh
@@ -1,6 +1,8 @@
 #!/bin/bash
 # make a release of a Samba library
 
+GPG_USER='Samba Library Distribution Key <samba-bugs at samba.org>'
+
 if [ ! -d ".git" ]; then
 	echo "Run this script from the top-level directory in the"
 	echo "repository"
@@ -41,7 +43,7 @@ release_lib() {
 
     echo "signing"
     rm -f "$tarname.asc"
-    gpg --detach-sign --armor $tarname || exit 1
+    gpg -u "$GPG_USER" --detach-sign --armor $tarname || exit 1
     [ -f "$tarname.asc" ] || {
 	echo "Failed to create signature $tarname.asc"
 	exit 1
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 87327e5..53d53d9 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -247,6 +247,13 @@ static int replmd_process_backlink(struct ldb_module *module, struct la_backlink
 	}
 	msg->elements[0].flags = bl->active?LDB_FLAG_MOD_ADD:LDB_FLAG_MOD_DELETE;
 
+	/* a backlink should never be single valued. Unfortunately the
+	   exchange schema has a attribute
+	   msExchBridgeheadedLocalConnectorsDNBL which is single
+	   valued and a backlink. We need to cope with that by
+	   ignoring the single value flag */
+	msg->elements[0].flags |= LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK;
+
 	ret = dsdb_module_modify(module, msg, DSDB_FLAG_NEXT_MODULE, parent);
 	if (ret != LDB_SUCCESS) {
 		ldb_asprintf_errstring(ldb, "Failed to %s backlink from %s to %s - %s",
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index ee0d66c..710ce8b 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -1572,35 +1572,26 @@ static int samldb_member_check(struct samldb_ctx *ac)
 
 /* SAM objects have special rules regarding the "description" attribute on
  * modify operations. */
-static int samldb_description_check(struct samldb_ctx *ac)
+static int samldb_description_check(struct samldb_ctx *ac, bool *modified)
 {
 	struct ldb_context *ldb = ldb_module_get_ctx(ac->module);
 	const char * const attrs[] = { "objectClass", "description", NULL };
-	struct ldb_message_element *el;
 	struct ldb_result *res;
 	unsigned int i;
 	int ret;
 
 	/* Fetch informations from the existing object */
-
 	ret = dsdb_module_search(ac->module, ac, &res, ac->msg->dn, LDB_SCOPE_BASE, attrs,
-				 DSDB_FLAG_NEXT_MODULE, ac->req, NULL);
+				 DSDB_FLAG_NEXT_MODULE | DSDB_SEARCH_SHOW_DELETED, ac->req,
+				 "(|(objectclass=user)(objectclass=group)(objectclass=samDomain)(objectclass=samServer))");
 	if (ret != LDB_SUCCESS) {
-		return ret;
-	}
-	if (res->count != 1) {
-		return ldb_operr(ldb);
+		/* don't treat it specially ... let normal error codes
+		   happen from other places */
+		ldb_reset_err_string(ldb);
+		return LDB_SUCCESS;
 	}
-
-	/* if it's not a SAM object then please skip the constraints */
-	if ((samdb_find_attribute(ldb, res->msgs[0], "objectClass",
-				  "group") == NULL) &&
-	    (samdb_find_attribute(ldb, res->msgs[0], "objectClass",
-				  "samDomain") == NULL) &&
-	    (samdb_find_attribute(ldb, res->msgs[0], "objectClass",
-				  "samServer") == NULL) &&
-	    (samdb_find_attribute(ldb, res->msgs[0], "objectClass",
-				  "user") == NULL)) {
+	if (res->count == 0) {
+		/* we didn't match the filter */
 		talloc_free(res);
 		return LDB_SUCCESS;
 	}
@@ -1608,31 +1599,9 @@ static int samldb_description_check(struct samldb_ctx *ac)
 	/* We've to walk over all modification entries and consider the
 	 * "description" ones. */
 	for (i = 0; i < ac->msg->num_elements; i++) {
-		if (ldb_attr_cmp(ac->msg->elements[i].name,
-				 "description") != 0) {
-			continue;
-		}
-
-		el = &ac->msg->elements[i];
-
-		/* Multi-valued add or replace operations are always denied */
-		if ((LDB_FLAG_MOD_TYPE(el->flags) != LDB_FLAG_MOD_DELETE) &&
-		    (el->num_values > 1)) {
-			ldb_asprintf_errstring(ldb,
-					       "samldb: Description on SAM entry '%s' is changed using a multi-valued add or replace operation!",
-					       ldb_dn_get_linearized(ac->msg->dn));
-			return LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS;
-		}
-
-		/* Add operations are only allowed if no value exists */
-		if (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_ADD) {
-			if (ldb_msg_find_element(res->msgs[0], "description")
-								!= NULL) {
-				ldb_asprintf_errstring(ldb,
-						       "samldb: Description on SAM entry '%s' is changed using an add operation while a value already exists!",
-						       ldb_dn_get_linearized(ac->msg->dn));
-				return LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS;
-			}
+		if (ldb_attr_cmp(ac->msg->elements[i].name, "description") == 0) {
+			ac->msg->elements[i].flags |= LDB_FLAG_INTERNAL_FORCE_SINGLE_VALUE_CHECK;
+			*modified = true;
 		}
 	}
 
@@ -2049,7 +2018,7 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req)
 
 	el = ldb_msg_find_element(ac->msg, "description");
 	if (el != NULL) {
-		ret = samldb_description_check(ac);
+		ret = samldb_description_check(ac, &modified);
 		if (ret != LDB_SUCCESS) {
 			return ret;
 		}
diff --git a/source4/lib/ldb/include/ldb_module.h b/source4/lib/ldb/include/ldb_module.h
index a793525..0f2a080 100644
--- a/source4/lib/ldb/include/ldb_module.h
+++ b/source4/lib/ldb/include/ldb_module.h
@@ -49,6 +49,9 @@ struct ldb_module;
 /* attribute has failed access check and must not be exposed */
 #define LDB_FLAG_INTERNAL_INACCESSIBLE_ATTRIBUTE 0x40
 
+/* force single value checking on this attribute */
+#define LDB_FLAG_INTERNAL_FORCE_SINGLE_VALUE_CHECK 0x80
+
 
 /*
    these function pointers define the operations that a ldb module can intercept
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index b0f9bf9..2f7f222 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -276,6 +276,34 @@ done:
 }
 
 
+/*
+  check if a attribute is a single valued, for a given element
+ */
+static bool ldb_tdb_single_valued(const struct ldb_schema_attribute *a,
+				  struct ldb_message_element *el)
+{
+	if (!a) return false;
+	if (el != NULL) {
+		if (el->flags & LDB_FLAG_INTERNAL_FORCE_SINGLE_VALUE_CHECK) {
+			/* override from a ldb module, for example
+			   used for the description field, which is
+			   marked multi-valued in the schema but which
+			   should not actually accept multiple
+			   values */
+			return true;
+		}
+		if (el->flags & LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK) {
+			/* override from a ldb module, for example used for
+			   deleted linked attribute entries */
+			return false;
+		}
+	}
+	if (a->flags & LDB_ATTR_FLAG_SINGLE_VALUE) {
+		return true;
+	}
+	return false;
+}
+
 static int ltdb_add_internal(struct ldb_module *module,
 			     const struct ldb_message *msg)
 {
@@ -292,13 +320,10 @@ static int ltdb_add_internal(struct ldb_module *module,
 					       el->name, ldb_dn_get_linearized(msg->dn));
 			return LDB_ERR_CONSTRAINT_VIOLATION;
 		}
-		if (a && (a->flags & LDB_ATTR_FLAG_SINGLE_VALUE) &&
-		    !(el->flags & LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK)) {
-			if (el->num_values > 1) {
-				ldb_asprintf_errstring(ldb, "SINGLE-VALUE attribute %s on %s specified more than once",
-						       el->name, ldb_dn_get_linearized(msg->dn));
-				return LDB_ERR_CONSTRAINT_VIOLATION;
-			}
+		if (el->num_values > 1 && ldb_tdb_single_valued(a, el)) {
+			ldb_asprintf_errstring(ldb, "SINGLE-VALUE attribute %s on %s specified more than once",
+					       el->name, ldb_dn_get_linearized(msg->dn));
+			return LDB_ERR_CONSTRAINT_VIOLATION;
 		}
 	}
 
@@ -680,8 +705,7 @@ int ltdb_modify_internal(struct ldb_module *module,
 					ret = LDB_ERR_OTHER;
 					goto done;
 				}
-				el->name = msg->elements[i].name;
-				el->num_values = msg->elements[i].num_values;
+				*el = msg->elements[i];
 				el->values = talloc_array(el, struct ldb_val, el->num_values);
 				if (el->values == NULL) {
 					ret = LDB_ERR_OTHER;
@@ -692,14 +716,11 @@ int ltdb_modify_internal(struct ldb_module *module,
 				}
 			}
 
-			if (a && (a->flags & LDB_ATTR_FLAG_SINGLE_VALUE) &&
-			    !(el->flags & LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK)) {
-				if (el->num_values > 1) {
-					ldb_asprintf_errstring(ldb, "SINGLE-VALUE attribute %s on %s specified more than once",
-						               el->name, ldb_dn_get_linearized(msg2->dn));
-					ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS;
-					goto done;
-				}
+			if (el->num_values > 1 && ldb_tdb_single_valued(a, el)) {
+				ldb_asprintf_errstring(ldb, "SINGLE-VALUE attribute %s on %s specified more than once",
+						       el->name, ldb_dn_get_linearized(msg2->dn));
+				ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS;
+				goto done;
 			}
 
 			/* Checks if element already exists */
@@ -720,8 +741,7 @@ int ltdb_modify_internal(struct ldb_module *module,
 
 				/* We cannot add another value on a existing one
 				   if the attribute is single-valued */
-				if (a && (a->flags & LDB_ATTR_FLAG_SINGLE_VALUE) &&
-				    !(el->flags & LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK)) {
+				if (ldb_tdb_single_valued(a, el)) {
 					ldb_asprintf_errstring(ldb, "SINGLE-VALUE attribute %s on %s specified more than once",
 						               el->name, ldb_dn_get_linearized(msg2->dn));
 					ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS;
@@ -787,14 +807,11 @@ int ltdb_modify_internal(struct ldb_module *module,
 
 		case LDB_FLAG_MOD_REPLACE:
 
-			if (a && (a->flags & LDB_ATTR_FLAG_SINGLE_VALUE) &&
-			    !(el->flags & LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK)) {
-				if (el->num_values > 1) {
-					ldb_asprintf_errstring(ldb, "SINGLE-VALUE attribute %s on %s specified more than once",
-						               el->name, ldb_dn_get_linearized(msg2->dn));
-					ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS;
-					goto done;
-				}
+			if (el->num_values > 1 && ldb_tdb_single_valued(a, el)) {
+				ldb_asprintf_errstring(ldb, "SINGLE-VALUE attribute %s on %s specified more than once",
+						       el->name, ldb_dn_get_linearized(msg2->dn));
+				ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS;
+				goto done;
 			}
 
 			/* TODO: This is O(n^2) - replace with more efficient check */
diff --git a/source4/lib/ldb/web/index.html b/source4/lib/ldb/web/index.html
index 3fa4cdc..7f50cdc 100644
--- a/source4/lib/ldb/web/index.html
+++ b/source4/lib/ldb/web/index.html
@@ -50,11 +50,11 @@ would be preferred.
 
 <h2>Discussion and bug reports</h2>
 
-ldb does not currently have its own mailing list or bug tracking
-system. For now, please use the <a
-href="https://lists.samba.org/mailman/listinfo/samba-technical">samba-technical</a>
-mailing list or the <a href="https://lists.samba.org/mailman/listinfo/ldb">ldb</a>
-mailing list, and the <a href="http://bugzilla.samba.org/">Samba bugzilla</a> bug tracking system.
+ldb does not have its own mailing list or bug tracking system. Please
+use
+the <a href="https://lists.samba.org/mailman/listinfo/samba-technical">samba-technical</a>
+mailing list, and the <a href="http://bugzilla.samba.org/">Samba
+bugzilla</a> bug tracking system.
 
 <h2>Download</h2>
 
diff --git a/source4/rpc_server/backupkey/dcesrv_backupkey.c b/source4/rpc_server/backupkey/dcesrv_backupkey.c
index e499128..1cd9a9f 100644
--- a/source4/rpc_server/backupkey/dcesrv_backupkey.c
+++ b/source4/rpc_server/backupkey/dcesrv_backupkey.c
@@ -98,7 +98,7 @@ static NTSTATUS set_lsa_secret(TALLOC_CTX *mem_ctx,
 			   ldb_binary_encode_string(mem_ctx, name2));
 
 	if (ret != LDB_SUCCESS ||  res->count != 0 ) {
-		DEBUG(0, ("Secret %s already exists !\n", name2));
+		DEBUG(2, ("Secret %s already exists !\n", name2));
 		talloc_free(msg);
 		return NT_STATUS_OBJECT_NAME_COLLISION;
 	}
@@ -153,7 +153,7 @@ static NTSTATUS set_lsa_secret(TALLOC_CTX *mem_ctx,
 	 */
 	ret = dsdb_add(ldb, msg, DSDB_MODIFY_RELAX);
 	if (ret != LDB_SUCCESS) {
-		DEBUG(0,("Failed to create secret record %s: %s\n",
+		DEBUG(2,("Failed to create secret record %s: %s\n",
 			ldb_dn_get_linearized(msg->dn),
 			ldb_errstring(ldb)));
 		talloc_free(msg);
@@ -217,7 +217,7 @@ static NTSTATUS get_lsa_secret(TALLOC_CTX *mem_ctx,
 	}
 
 	if (res->count > 1) {
-		DEBUG(0, ("Secret %s collision\n", name));
+		DEBUG(2, ("Secret %s collision\n", name));
 		talloc_free(tmp_mem);
 		return NT_STATUS_INTERNAL_DB_CORRUPTION;
 	}
@@ -301,7 +301,7 @@ static NTSTATUS get_pk_from_raw_keypair_params(TALLOC_CTX *ctx,
 	hx509_context_init(&hctx);
 	ops = hx509_find_private_alg(&_hx509_signature_rsa_with_var_num.algorithm);
 	if (ops == NULL) {
-		DEBUG(0, ("Not supported algorithm\n"));
+		DEBUG(2, ("Not supported algorithm\n"));
 		return NT_STATUS_INTERNAL_ERROR;
 	}
 
@@ -476,7 +476,7 @@ static WERROR get_and_verify_access_check(TALLOC_CTX *sub_ctx,
 		 */
 
 		if (memcmp(hash, uncrypted_accesscheckv2.hash, hash_size) != 0) {
-			DEBUG(0, ("Wrong hash value in the access check in backup key remote protocol\n"));
+			DEBUG(2, ("Wrong hash value in the access check in backup key remote protocol\n"));
 			return WERR_INVALID_DATA;
 		}
 		*access_sid = dom_sid_dup(sub_ctx, &(uncrypted_accesscheckv2.sid));
@@ -515,7 +515,7 @@ static WERROR get_and_verify_access_check(TALLOC_CTX *sub_ctx,
 		 */
 
 		if (memcmp(hash, uncrypted_accesscheckv3.hash, hash_size) != 0) {
-			DEBUG(0, ("Wrong hash value in the access check in backup key remote protocol\n"));
+			DEBUG(2, ("Wrong hash value in the access check in backup key remote protocol\n"));
 			return WERR_INVALID_DATA;
 		}
 		*access_sid = dom_sid_dup(sub_ctx, &(uncrypted_accesscheckv3.sid));
@@ -605,7 +605,7 @@ static WERROR bkrp_do_uncrypt_client_wrap_key(struct dcesrv_call_state *dce_call
 
 		ndr_err = ndr_pull_struct_blob(&secret, mem_ctx, &keypair, (ndr_pull_flags_fn_t)ndr_pull_bkrp_exported_RSA_key_pair);
 		if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-			DEBUG(1, ("Unable to parse the ndr encoded cert in key %s\n", cert_secret_name));
+			DEBUG(2, ("Unable to parse the ndr encoded cert in key %s\n", cert_secret_name));
 			return WERR_FILE_NOT_FOUND;
 		}
 
@@ -987,7 +987,7 @@ static WERROR generate_bkrp_cert(TALLOC_CTX *ctx, struct dcesrv_call_state *dce_
 	enum ndr_err_code ndr_err;
 	uint32_t nb_days_validity = 365;
 
-	DEBUG(0, ("Trying to generate a certificate\n"));
+	DEBUG(6, ("Trying to generate a certificate\n"));
 	hx509_context_init(&hctx);
 	w_err = create_req(ctx, &hctx, &req, &pk, &rsa, dn);
 	if (!W_ERROR_IS_OK(w_err)) {
@@ -1107,7 +1107,6 @@ static WERROR generate_bkrp_cert(TALLOC_CTX *ctx, struct dcesrv_call_state *dce_
 		return WERR_INVALID_DATA;
 	}
 	keypair.certificate_len = keypair.cert.length;
-	DEBUG(0, ("Len of priv key: %d pub_expo: %d\n", keypair.private_exponent.length, keypair.public_exponent.length));
 	ndr_err = ndr_push_struct_blob(&blobkeypair, ctx, &keypair, (ndr_push_flags_fn_t)ndr_push_bkrp_exported_RSA_key_pair);
 	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 		der_free_octet_string(&data);
@@ -1130,14 +1129,14 @@ static WERROR generate_bkrp_cert(TALLOC_CTX *ctx, struct dcesrv_call_state *dce_
 
 	status = set_lsa_secret(ctx, ldb_ctx, secret_name, &blobkeypair);
 	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(0, ("Failed to save the secret %s\n", secret_name));
+		DEBUG(2, ("Failed to save the secret %s\n", secret_name));
 	}
 	talloc_free(secret_name);
 
 	GUID_to_ndr_blob(&guid, ctx, &blob);
 	status = set_lsa_secret(ctx, ldb_ctx, "BCKUPKEY_PREFERRED", &blob);
 	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(0, ("Failed to save the secret BCKUPKEY_PREFERRED\n"));
+		DEBUG(2, ("Failed to save the secret BCKUPKEY_PREFERRED\n"));
 	}
 
 	der_free_octet_string(&data);
@@ -1186,7 +1185,7 @@ static WERROR bkrp_do_retreive_client_wrap_key(struct dcesrv_call_state *dce_cal
 
 			if (!NT_STATUS_IS_OK(status)) {
 				/* Ok we really don't manage to get this certs ...*/
-				DEBUG(0, ("Unable to locate BCKUPKEY_PREFERRED after cert generation\n"));
+				DEBUG(2, ("Unable to locate BCKUPKEY_PREFERRED after cert generation\n"));
 				return WERR_FILE_NOT_FOUND;
 			}
 		} else {
@@ -1247,16 +1246,17 @@ static WERROR bkrp_do_retreive_client_wrap_key(struct dcesrv_call_state *dce_cal
 	return WERR_NOT_SUPPORTED;
 }
 
-WERROR dcesrv_bkrp_BackupKey (struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct bkrp_BackupKey *r)
+static WERROR dcesrv_bkrp_BackupKey(struct dcesrv_call_state *dce_call,
+				    TALLOC_CTX *mem_ctx, struct bkrp_BackupKey *r)
 {
 	WERROR error = WERR_INVALID_PARAM;
 	struct ldb_context *ldb_ctx;
 	bool is_rodc;
 	const char *addr = "unknown";
 	/* At which level we start to add more debug of what is done in the protocol */
-	int debuglevel =4;
+	const int debuglevel = 4;
 
-	if (DEBUGLEVEL >= debuglevel) {
+	if (DEBUGLVL(debuglevel)) {
 		const struct tsocket_address *remote_address;
 		remote_address = dcesrv_connection_get_remote_address(dce_call->conn);
 		if (tsocket_address_is_inet(remote_address, "ip")) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list