[SCM] Samba Shared Repository - branch master updated

[email protected] (Garming Sam)
Newsgroups gmane.network.samba.cvs
Message-ID <[email protected]>
The branch, master has been updated
       via  77b51ba ldb_tdb: avoid erroneous error messages
       via  5337791 dsdb: Parse linked attributes using their DN+Binary or DN+String syntax, if needed
       via  a18e115 ldbdump: Parse the -i option
      from  f7d249d s3:libsmb: Always use GENSEC_OID_SPNEGO in cli_smb1_setup_encryption_send()

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


- Log -----------------------------------------------------------------
commit 77b51ba2f25e074bb57fb865d4fcf55243518568
Author: Garming Sam <[email protected]>
Date:   Thu Dec 22 15:10:24 2016 +1300

    ldb_tdb: avoid erroneous error messages
    
    Signed-off-by: Garming Sam <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    
    Autobuild-User(master): Garming Sam <[email protected]>
    Autobuild-Date(master): Fri Dec 23 02:28:54 CET 2016 on sn-devel-144

commit 53377917beeb18553904dc53b227ecf1745a5d1f
Author: Andrew Bartlett <[email protected]>
Date:   Wed May 20 11:06:22 2015 +0200

    dsdb: Parse linked attributes using their DN+Binary or DN+String syntax, if needed
    
    Signed-off-by: Andrew Bartlett <[email protected]>
    Reviewed-by: Garming Sam <[email protected]>

commit a18e115ffe7f30282636824f074b77dc746d7fa6
Author: Garming Sam <[email protected]>
Date:   Fri Dec 23 10:27:30 2016 +1300

    ldbdump: Parse the -i option
    
    Signed-off-by: Garming Sam <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>

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

Summary of changes:
 lib/ldb/ldb_tdb/ldb_tdb.c                          |  2 +-
 lib/ldb/tools/ldbdump.c                            |  2 +-
 source4/dsdb/samdb/ldb_modules/linked_attributes.c | 26 ++++++++++++++++------
 3 files changed, 21 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c
index 7cc0a2e..707d227 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -947,7 +947,7 @@ int ltdb_modify_internal(struct ldb_module *module,
 					if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE &&
 					    control_permissive) {
 						ret = LDB_SUCCESS;
-					} else {
+					} else if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE) {
 						ldb_asprintf_errstring(ldb,
 								       "attribute '%s': no matching attribute value while deleting attribute on '%s'",
 								       msg->elements[i].name, dn);
diff --git a/lib/ldb/tools/ldbdump.c b/lib/ldb/tools/ldbdump.c
index 33f853d..c399b59 100644
--- a/lib/ldb/tools/ldbdump.c
+++ b/lib/ldb/tools/ldbdump.c
@@ -200,7 +200,7 @@ static void usage( void)
 		exit(1);
 	}
 
-	while ((c = getopt( argc, argv, "hd:ec")) != -1) {
+	while ((c = getopt( argc, argv, "hd:eic")) != -1) {
 		switch (c) {
 		case 'h':
 			usage();
diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
index 8063162..2016524 100644
--- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c
+++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
@@ -172,28 +172,36 @@ static int la_guid_from_dn(struct ldb_module *module,
 /* Common routine to handle reading the attributes and creating a
  * series of modify requests */
 static int la_store_op(struct la_context *ac,
-		       enum la_op op, struct ldb_val *dn,
+		       enum la_op op, 
+		       const struct dsdb_attribute *schema_attr,
+		       struct ldb_val *dn,
 		       const char *name)
 {
 	struct ldb_context *ldb;
 	struct la_op_store *os;
 	struct ldb_dn *op_dn;
+	struct dsdb_dn *dsdb_dn;
 	int ret;
 
 	ldb = ldb_module_get_ctx(ac->module);
 
-	op_dn = ldb_dn_from_ldb_val(ac, ldb, dn);
-	if (!op_dn) {
-		ldb_asprintf_errstring(ldb,
-				       "could not parse attribute as a DN");
-		return LDB_ERR_INVALID_DN_SYNTAX;
-	}
 
 	os = talloc_zero(ac, struct la_op_store);
 	if (!os) {
 		return ldb_oom(ldb);
 	}
 
+	dsdb_dn = dsdb_dn_parse(os, ldb, dn, schema_attr->syntax->ldap_oid);
+
+	if (!dsdb_dn) {
+		ldb_asprintf_errstring(ldb,
+				       "could not parse attribute as a DN");
+		TALLOC_FREE(os);
+		return LDB_ERR_INVALID_DN_SYNTAX;
+	}
+
+	op_dn = dsdb_dn->dn;
+
 	os->op = op;
 
 	ret = la_guid_from_dn(ac->module, ac->req, op_dn, &os->guid);
@@ -319,6 +327,7 @@ static int linked_attributes_add(struct ldb_module *module, struct ldb_request *
 
 		for (j = 0; j < el->num_values; j++) {
 			ret = la_store_op(ac, LA_OP_ADD,
+					  schema_attr,
 					  &el->values[j],
 					  attr_name);
 			if (ret != LDB_SUCCESS) {
@@ -423,6 +432,7 @@ static int la_mod_search_callback(struct ldb_request *req, struct ldb_reply *are
 			/* Now we know what was there, we can remove it for the re-add */
 			for (j = 0; j < search_el->num_values; j++) {
 				ret = la_store_op(ac, LA_OP_DEL,
+						  schema_attr, 
 						  &search_el->values[j],
 						  attr_name);
 				if (ret != LDB_SUCCESS) {
@@ -570,6 +580,7 @@ static int linked_attributes_modify(struct ldb_module *module, struct ldb_reques
 			/* For each value being added, we need to setup the adds */
 			for (j = 0; j < el->num_values; j++) {
 				ret = la_store_op(ac, LA_OP_ADD,
+						  schema_attr,
 						  &el->values[j],
 						  attr_name);
 				if (ret != LDB_SUCCESS) {
@@ -584,6 +595,7 @@ static int linked_attributes_modify(struct ldb_module *module, struct ldb_reques
 				/* For each value being deleted, we need to setup the delete */
 				for (j = 0; j < el->num_values; j++) {
 					ret = la_store_op(ac, LA_OP_DEL,
+							  schema_attr,
 							  &el->values[j],
 							  attr_name);
 					if (ret != LDB_SUCCESS) {


-- 
Samba Shared Repository
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.