svn commit: samba r17820 - in branches/SAMBA_4_0/source/lib/ldb/tools: .

tridge at samba.org tridge at samba.org
Fri Aug 25 06:38:30 GMT 2006


Author: tridge
Date: 2006-08-25 06:38:29 +0000 (Fri, 25 Aug 2006)
New Revision: 17820

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

Log:

simplify the code flow a little

Modified:
   branches/SAMBA_4_0/source/lib/ldb/tools/cmdline.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/tools/cmdline.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/tools/cmdline.c	2006-08-25 03:17:47 UTC (rev 17819)
+++ branches/SAMBA_4_0/source/lib/ldb/tools/cmdline.c	2006-08-25 06:38:29 UTC (rev 17820)
@@ -33,6 +33,8 @@
 #include "db_wrap.h"
 #endif
 
+
+
 /*
   process command line options
 */
@@ -47,6 +49,8 @@
 #endif
 	int num_options = 0;
 	int opt;
+	int flags = 0;
+
 	struct poptOption popt_options[] = {
 		POPT_AUTOHELP
 		{ "url",       'H', POPT_ARG_STRING, &options.url, 0, "database URL", "URL" },
@@ -194,29 +198,32 @@
 		goto failed;
 	}
 
-	if (strcmp(ret->url, "NONE") != 0) {
-		int flags = 0;
-		if (options.nosync) {
-			flags |= LDB_FLG_NOSYNC;
-		}
+	if (strcmp(ret->url, "NONE") == 0) {
+		return ret;
+	}
 
+	if (options.nosync) {
+		flags |= LDB_FLG_NOSYNC;
+	}
+
 #ifdef _SAMBA_BUILD_
-		/* Must be after we have processed command line options */
-		gensec_init(); 
+	/* Must be after we have processed command line options */
+	gensec_init(); 
+	
+	if (ldb_set_opaque(ldb, "sessionInfo", system_session(ldb))) {
+		goto failed;
+	}
+	if (ldb_set_opaque(ldb, "credentials", cmdline_credentials)) {
+		goto failed;
+	}
+	ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
+#endif
 
-		if (ldb_set_opaque(ldb, "sessionInfo", system_session(ldb))) {
-			goto failed;
-		}
-		if (ldb_set_opaque(ldb, "credentials", cmdline_credentials)) {
-			goto failed;
-		}
-		ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
-#endif
-		if (ldb_connect(ldb, ret->url, flags, ret->options) != 0) {
-			fprintf(stderr, "Failed to connect to %s - %s\n", 
-				ret->url, ldb_errstring(ldb));
-			goto failed;
-		}
+	/* now connect to the ldb */
+	if (ldb_connect(ldb, ret->url, flags, ret->options) != 0) {
+		fprintf(stderr, "Failed to connect to %s - %s\n", 
+			ret->url, ldb_errstring(ldb));
+		goto failed;
 	}
 
 	return ret;



More information about the samba-cvs mailing list