r454: allow a non-URL form of a filename to be used in ldb_connect(). This
authorAndrew Tridgell <tridge@samba.org>
Mon, 3 May 2004 09:34:18 +0000 (09:34 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:51:43 +0000 (12:51 -0500)
makes it a little easier to work with the ldb tools
(This used to be commit 03df31cef025b2087531579437d6bae1ec36e82f)

source4/lib/ldb/common/ldb.c
source4/lib/ldb/ldb_tdb/ldb_tdb.c

index f61ddecdc7b9344e9d48b4246be6e7abc277f98b..ac77f306e9b0dd41dcd8f0a769f3861193cc3e42 100644 (file)
@@ -48,7 +48,8 @@ struct ldb_context *ldb_connect(const char *url, unsigned int flags,
                                const char *options[])
 {
 
-       if (strncmp(url, "tdb:", 4) == 0) {
+       if (strncmp(url, "tdb:", 4) == 0 ||
+           strchr(url, ':') == NULL) {
                return ltdb_connect(url, flags, options);
        }
 
index eb2decfe310a863e547548aed391c5e5e97f24cd..92b88e4fb59f0ddf12bba2fb1d5725993527f48d 100644 (file)
@@ -607,13 +607,16 @@ struct ldb_context *ltdb_connect(const char *url,
        struct ldb_context *ldb;
 
        /* parse the url */
-       if (strncmp(url, "tdb://", 6) != 0) {
-               errno = EINVAL;
-               return NULL;
+       if (strchr(url, ':')) {
+               if (strncmp(url, "tdb://", 6) != 0) {
+                       errno = EINVAL;
+                       return NULL;
+               }
+               path = url+6;
+       } else {
+               path = url;
        }
 
-       path = url+6;
-
        tdb_flags = TDB_DEFAULT;
 
        if (flags & LDB_FLG_RDONLY) {