svn commit: samba r25941 - in branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules: .

abartlet at samba.org abartlet at samba.org
Tue Nov 13 22:40:44 GMT 2007


Author: abartlet
Date: 2007-11-13 22:40:42 +0000 (Tue, 13 Nov 2007)
New Revision: 25941

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25941

Log:
Use samdb_relative_path() (new function in samdb.c) in the partitions
module.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c	2007-11-13 22:38:55 UTC (rev 25940)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c	2007-11-13 22:40:42 UTC (rev 25941)
@@ -707,33 +707,6 @@
 	return ldb_dn_compare(partition1->dn, partition2->dn);
 }
 
-static const char *relative_path(struct ldb_module *module, 
-				 TALLOC_CTX *mem_ctx, 
-				 const char *name) 
-{
-	const char *base_url = 
-		(const char *)ldb_get_opaque(module->ldb, "ldb_url");
-	char *path, *p, *full_name;
-	if (name == NULL) {
-		return NULL;
-	}
-	if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) {
-		return talloc_strdup(mem_ctx, name);
-	}
-	path = talloc_strdup(mem_ctx, base_url);
-	if (path == NULL) {
-		return NULL;
-	}
-	if ( (p = strrchr(path, '/')) != NULL) {
-		p[0] = '\0';
-		full_name = talloc_asprintf(mem_ctx, "%s/%s", path, name);
-	} else {
-		full_name = talloc_asprintf(mem_ctx, "./%s", name);
-	}
-	talloc_free(path);
-	return full_name;
-}
-
 static int partition_init(struct ldb_module *module)
 {
 	int ret, i;
@@ -822,9 +795,9 @@
 			return LDB_ERR_CONSTRAINT_VIOLATION;
 		}
 
-		data->partitions[i]->backend = relative_path(module, 
-							     data->partitions[i], 
-							     p);
+		data->partitions[i]->backend = samdb_relative_path(module->ldb, 
+								   data->partitions[i], 
+								   p);
 		if (!data->partitions[i]->backend) {
 			ldb_asprintf_errstring(module->ldb, 
 						"partition_init: unable to determine an relative path for partition: %s", base);



More information about the samba-cvs mailing list