[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Tue Mar 29 00:25:01 MDT 2011


The branch, master has been updated
       via  bd9b272 ldb: detect eof on ldif files
       via  daeb6a0 s4-dsdb: allow modification of linked attribute targets with relax
      from  af31bf6 debug: ignore debug_set_logfile() with a blank string

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


- Log -----------------------------------------------------------------
commit bd9b2727ef1cb63630c58afe1bba2f4f93246180
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 29 16:31:17 2011 +1100

    ldb: detect eof on ldif files
    
    use feof() to detect parsing errors in ldif files
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Tue Mar 29 08:24:04 CEST 2011 on sn-devel-104

commit daeb6a02eab5822c557ab167fbc171aebe2ddf05
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 29 16:14:18 2011 +1100

    s4-dsdb: allow modification of linked attribute targets with relax
    
    this is used to help recover a corrupt database.
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 source4/dsdb/samdb/ldb_modules/objectclass_attrs.c |    3 ++-
 source4/lib/ldb/tools/ldbedit.c                    |   15 +++++++++++++++
 source4/lib/ldb/tools/ldbmodify.c                  |    5 +++++
 3 files changed, 22 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
index 8f6cc66..9df1210 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
@@ -127,7 +127,8 @@ static int attr_handler(struct oc_context *ac)
 			return LDB_ERR_NO_SUCH_ATTRIBUTE;
 		}
 
-		if ((attr->linkID & 1) == 1) {
+		if ((attr->linkID & 1) == 1 &&
+		    !ldb_request_get_control(ac->req, LDB_CONTROL_RELAX_OID)) {
 			/* Odd is for the target.  Illegal to modify */
 			ldb_asprintf_errstring(ldb, 
 					       "objectclass_attrs: attribute '%s' on entry '%s' must not be modified directly, it is a linked attribute", 
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index 36d054e..aaf6d80 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -281,6 +281,21 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1,
 		msgs2[count2++] = ldif->msg;
 	}
 
+	/* the feof() test works here, even for the last line of the
+	 * file, as we parse ldif files character by character, and
+	 * feof() is only true if we have failed to read a character
+	 * from the file. So if the last line is bad, we don't get
+	 * feof() set, so we know the record was bad. Only if we
+	 * attempt to go to the next record will we get feof() and
+	 * thus consider that the ldif has ended without errors
+	 */
+	if (!feof(f)) {
+		fprintf(stderr, "Error parsing ldif - aborting\n");
+		fclose(f);
+		unlink(file_template);
+		return -1;
+	}
+
 	fclose(f);
 	unlink(file_template);
 
diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c
index 1484bbf..1374765 100644
--- a/source4/lib/ldb/tools/ldbmodify.c
+++ b/source4/lib/ldb/tools/ldbmodify.c
@@ -87,6 +87,11 @@ static int process_file(struct ldb_context *ldb, FILE *f, unsigned int *count)
 		ldb_ldif_read_free(ldb, ldif);
 	}
 
+	if (!feof(f)) {
+		fprintf(stderr, "Failed to parse ldif\n");
+		return -1;
+	}
+
 	return ret;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list