ldb-samba: Rename samdb_relative_path to ldb_relative_path, as it's not samdb-specific.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 10 Oct 2010 21:45:23 +0000 (23:45 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 10 Oct 2010 21:45:23 +0000 (23:45 +0200)
source4/dsdb/samdb/ldb_modules/partition_init.c
source4/dsdb/samdb/samdb.c
source4/lib/ldb-samba/ldb_wrap.c
source4/lib/ldb-samba/ldb_wrap.h
source4/param/secrets.c

index 0ab8bada13ed61fec959482f5abbf40274755fb5..775e566d517fe25168b612726af0d0cee93ba390 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "dsdb/samdb/ldb_modules/partition.h"
 #include "lib/util/tsort.h"
+#include "lib/ldb-samba/ldb_wrap.h"
 
 static int partition_sort_compare(const void *v1, const void *v2)
 {
@@ -218,7 +219,7 @@ static int new_partition_from_dn(struct ldb_context *ldb, struct partition_priva
                (*partition)->backend_url = data->ldapBackend;
        } else {
                /* the backend LDB is the DN (base64 encoded if not 'plain') followed by .ldb */
-               backend_url = samdb_relative_path(ldb, 
+               backend_url = ldb_relative_path(ldb, 
                                                  *partition, 
                                                  filename);
                if (!backend_url) {
index c2a1e9ec8010b60c81b88c2c20b928b90095da4b..57de27a22e099c55f3e01a140c2dcd118607bd9e 100644 (file)
 #include "param/secrets.h"
 #include "auth/auth.h"
 
-char *samdb_relative_path(struct ldb_context *ldb,
-                                TALLOC_CTX *mem_ctx, 
-                                const char *name) 
-{
-       const char *base_url = 
-               (const char *)ldb_get_opaque(ldb, "ldb_url");
-       char *path, *p, *full_name;
-       if (name == NULL) {
-               return NULL;
-       }
-       if (strncmp("tdb://", base_url, 6) == 0) {
-               base_url = base_url+6;
-       }
-       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;
-}
-
 /*
   make sure the static credentials are not freed
  */
index 7ac94dea2c0829477842a2680b58cdda260937a3..b09e68c0a15f6633b73fd4bed139e0b0cec296ac 100644 (file)
@@ -338,3 +338,29 @@ int samba_ldb_connect(struct ldb_context *ldb, struct loadparm_context *lp_ctx,
        }
 }
 
+ char *ldb_relative_path(struct ldb_context *ldb,
+                                TALLOC_CTX *mem_ctx, 
+                                const char *name) 
+{
+       const char *base_url = 
+               (const char *)ldb_get_opaque(ldb, "ldb_url");
+       char *path, *p, *full_name;
+       if (name == NULL) {
+               return NULL;
+       }
+       if (strncmp("tdb://", base_url, 6) == 0) {
+               base_url = base_url+6;
+       }
+       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;
+}
index a835f665fc012251cacb50eab975706f6f3d8bf5..531aa9ac700ff0c3f56f16d87e8e22f272df1c01 100644 (file)
@@ -60,5 +60,8 @@ bool ldb_wrap_add(const char *url, struct tevent_context *ev,
                                  struct cli_credentials *credentials,
                                  int flags,
                                  struct ldb_context *ldb);
+char *ldb_relative_path(struct ldb_context *ldb,
+                                TALLOC_CTX *mem_ctx,
+                                const char *name);
 
 #endif /* _LDB_WRAP_H_ */
index 5e9b0a977f7ae7f1c200221155007e841235e075..c894358e2dc1dd8100d79d463fb4867802869c47 100644 (file)
@@ -181,7 +181,7 @@ char *keytab_name_from_msg(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, struct
                        return NULL;
                }
 
-               relative_path = samdb_relative_path(ldb, mem_ctx, privateKeytab);
+               relative_path = ldb_relative_path(ldb, mem_ctx, privateKeytab);
                if (!relative_path) {
                        return NULL;
                }