svn commit: samba r17350 - in branches/SAMBA_4_0/source/lib/ldb: include ldb_tdb

idra at samba.org idra at samba.org
Tue Aug 1 03:22:03 GMT 2006


Author: idra
Date: 2006-08-01 03:22:02 +0000 (Tue, 01 Aug 2006)
New Revision: 17350

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

Log:

Avoid a couple of memleaks, unnecessary code and use a more linear style



Modified:
   branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h	2006-08-01 02:25:05 UTC (rev 17349)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h	2006-08-01 03:22:02 UTC (rev 17350)
@@ -502,6 +502,22 @@
 */
 #define LDB_EXTENDED_START_TLS_OID	"1.3.6.1.4.1.1466.20037"
 
+/**
+   OID for LDAP Extended Operation START_TLS.
+
+   This Extended operation is used to start a new TLS
+   channel on top of a clear text channel.
+*/
+#define LDB_EXTENDED_DYNAMIC_OID	"1.3.6.1.4.1.1466.101.119.1"
+
+/**
+   OID for LDAP Extended Operation START_TLS.
+
+   This Extended operation is used to start a new TLS
+   channel on top of a clear text channel.
+*/
+#define LDB_EXTENDED_FAST_BIND_OID	"1.2.840.113556.1.4.1781"
+
 struct ldb_paged_control {
 	int size;
 	int cookie_len;

Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c	2006-08-01 02:25:05 UTC (rev 17349)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c	2006-08-01 03:22:02 UTC (rev 17350)
@@ -270,41 +270,26 @@
 	}
 
 	ret = ltdb_store(module, msg, TDB_INSERT);
-	switch (ret) {
-	case LDB_SUCCESS:
-	{
-		TALLOC_CTX *mem_ctx = talloc_new(module);
+
+	if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) {
 		char *dn;
-		dn = ldb_dn_linearize(mem_ctx, msg->dn);
+
+		dn = ldb_dn_linearize(module, msg->dn);
 		if (!dn) {
-			break;
+			return ret;
 		}
+		ldb_set_errstring(module->ldb, talloc_asprintf(module, "Entry %s already exists", dn));
+		talloc_free(dn);
+		return ret;
+	}
+	
+	if (ret == LDB_SUCCESS) {
 		ret = ltdb_modified(module, msg->dn);
 		if (ret != LDB_SUCCESS) {
 			return LDB_ERR_OPERATIONS_ERROR;
 		}
-		break;
 	}
-	case LDB_ERR_ENTRY_ALREADY_EXISTS:
-	{
-		TALLOC_CTX *mem_ctx = talloc_new(module);
-		char *errstring, *dn;
-		if (!mem_ctx) {
-			break;
-		}
-		dn = ldb_dn_linearize(mem_ctx, msg->dn);
-		if (!dn) {
-			break;
-		}
-		errstring = talloc_asprintf(mem_ctx, "Entry %s already exists",
-					    dn);
-		ldb_set_errstring(module->ldb, errstring);
-		talloc_free(mem_ctx);
-		break;
-	}
-	default:
-		break;
-	}
+
 	return ret;
 }
 



More information about the samba-cvs mailing list