svn commit: samba r4941 - in branches/SAMBA_4_0/source: . ldap_server

metze at samba.org metze at samba.org
Sun Jan 23 11:12:43 GMT 2005


Author: metze
Date: 2005-01-23 11:12:42 +0000 (Sun, 23 Jan 2005)
New Revision: 4941

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

Log:
- all needed data is now in sam.ldb and hacked.ldb is not needed anymore by the hacked ldap backend
- readd the schema naming context container object as it's needed for a w2k3 dc join

metze

Modified:
   branches/SAMBA_4_0/source/ldap_server/ldap_hacked_ldb.c
   branches/SAMBA_4_0/source/provision.ldif


Changeset:
Modified: branches/SAMBA_4_0/source/ldap_server/ldap_hacked_ldb.c
===================================================================
--- branches/SAMBA_4_0/source/ldap_server/ldap_hacked_ldb.c	2005-01-23 11:03:20 UTC (rev 4940)
+++ branches/SAMBA_4_0/source/ldap_server/ldap_hacked_ldb.c	2005-01-23 11:12:42 UTC (rev 4941)
@@ -48,27 +48,11 @@
 	attr->values = blob;\
 } while(0)				 
 
-/*
-  connect to the HACKED database
-  return an opaque context pointer on success, or NULL on failure
- */
-struct ldb_wrap *hacked_db_connect(TALLOC_CTX *mem_ctx)
-{
-	char *db_path;
 
-	db_path = talloc_asprintf(mem_ctx, "tdb://%s/hacked.ldb", dyn_PRIVATE_DIR);
-	if (db_path == NULL) {
-		return NULL;
-	}
-	return ldb_wrap_connect(mem_ctx, db_path, 0, NULL);
-}
-
-
 static NTSTATUS convert_values(TALLOC_CTX *mem_ctx,
 			       struct ldb_message_element *elem,
 			       struct ldap_attribute *attrs,
 			       struct ldb_wrap *samdb,
-			       struct ldb_wrap *hackeddb,
 			       const char **dn,
 			       struct ldap_SearchRequest *r)
 {
@@ -145,7 +129,7 @@
 
 		
 		/* first the NC stuff */
-		count = ldb_search(hackeddb->ldb, "", LDB_SCOPE_BASE, nc_filter, s_attrs, &res);
+		count = ldb_search(samdb->ldb, "", LDB_SCOPE_BASE, nc_filter, s_attrs, &res);
 		if (count != 1) {
 			DEBUG(0, (__location__": convert_values(ncname): nc_count: %d \n", count));
 			return NT_STATUS_FOOBAR;
@@ -216,10 +200,7 @@
 	void *local_ctx;
 	struct ldap_SearchResEntry *ent;
 	struct ldap_Result *done;
-	int result = LDAP_SUCCESS;
 	struct ldapsrv_reply *ent_r, *done_r;
-	struct ldb_wrap *hackeddb;
-	const char *errstr = NULL;
 	int count;
 	const char *dn_prefix;
 	const char *wkdn;
@@ -285,24 +266,12 @@
 	done_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultDone);
 	NT_STATUS_HAVE_NO_MEMORY(done_r);
 
-	if (count > 0) {
-		DEBUG(10,("hacked_Search: results: [%d]\n",count));
-		result = LDAP_SUCCESS;
-		errstr = NULL;
-	} else if (count == 0) {
-		DEBUG(10,("hacked_Search: no results\n"));
-		result = LDAP_NO_SUCH_OBJECT;
-		errstr = ldb_errstring(hackeddb->ldb);	
-	} else if (count == -1) {
-		DEBUG(10,("hacked_Search: error\n"));
-		result = LDAP_OTHER;
-		errstr = ldb_errstring(hackeddb->ldb);
-	}
+	DEBUG(10,("hacked_Search: results: [%d]\n",count));
 
 	done = &done_r->msg.r.SearchResultDone;
 	done->dn = NULL;
-	done->resultcode = result;
-	done->errormessage = (errstr?talloc_strdup(done_r,errstr):NULL);;
+	done->resultcode = LDAP_SUCCESS;
+	done->errormessage = NULL;
 	done->referral = NULL;
 
 	talloc_free(local_ctx);
@@ -320,7 +289,6 @@
 	struct ldb_message **res = NULL;
 	int result = LDAP_SUCCESS;
 	struct ldapsrv_reply *ent_r, *done_r;
-	struct ldb_wrap *hackeddb;
 	const char *errstr = NULL;
 	int count, j, y, i;
 	const char **attrs = NULL;
@@ -331,9 +299,6 @@
 	local_ctx = talloc_named(call, 0, "hacked_Search local memory context");
 	NT_STATUS_HAVE_NO_MEMORY(local_ctx);
 
-	hackeddb = hacked_db_connect(local_ctx);
-	NT_STATUS_HAVE_NO_MEMORY(hackeddb);
-
 	basedn = ldap_parse_dn(local_ctx, r->basedn);
 	if (!basedn) {
 		basedn_str = r->basedn;
@@ -357,7 +322,7 @@
 	}
 
 	if (r->num_attributes >= 1) {
-		attrs = talloc_array_p(hackeddb, const char *, r->num_attributes+1);
+		attrs = talloc_array_p(samdb, const char *, r->num_attributes+1);
 		NT_STATUS_HAVE_NO_MEMORY(attrs);
 
 		for (j=0; j < r->num_attributes; j++) {
@@ -368,8 +333,8 @@
 	}
 DEBUG(0,("hacked basedn: %s\n", basedn_str));
 DEBUGADD(0,("hacked filter: %s\n", r->filter));
-	count = ldb_search(hackeddb->ldb, basedn_str, scope, r->filter, attrs, &res);
-	talloc_steal(hackeddb, res);
+	count = ldb_search(samdb->ldb, basedn_str, scope, r->filter, attrs, &res);
+	talloc_steal(samdb, res);
 
 	if (count < 1) {
 		DEBUG(0,("hacked not found\n"));
@@ -403,7 +368,7 @@
 				status = convert_values(ent_r,
 							&(res[0]->elements[j]),
 							&(ent->attributes[j]),
-							samdb, hackeddb, &ent->dn, r);
+							samdb, &ent->dn, r);
 				if (!NT_STATUS_IS_OK(status)) {
 					return status;
 				}
@@ -454,7 +419,7 @@
 					status = convert_values(ent_r,
 							&(res[0]->elements[j]),
 							&(ent->attributes[j]),
-							samdb, hackeddb, &ent->dn, r);
+							samdb, &ent->dn, r);
 					if (!NT_STATUS_IS_OK(status)) {
 						return status;
 					}
@@ -484,11 +449,11 @@
 	} else if (count == 0) {
 		DEBUG(10,("hacked_Search: no results\n"));
 		result = LDAP_NO_SUCH_OBJECT;
-		errstr = ldb_errstring(hackeddb->ldb);	
+		errstr = ldb_errstring(samdb->ldb);	
 	} else if (count == -1) {
 		DEBUG(10,("hacked_Search: error\n"));
 		result = LDAP_OTHER;
-		errstr = ldb_errstring(hackeddb->ldb);
+		errstr = ldb_errstring(samdb->ldb);
 	}
 
 	done = &done_r->msg.r.SearchResultDone;
@@ -507,24 +472,32 @@
 {
 	NTSTATUS status;
 	void *local_ctx;
+	struct ldb_wrap *samdb;
+#if 0
 	struct ldap_dn *basedn;
 	struct ldap_Result *done;
 	struct ldap_SearchResEntry *ent;
 	struct ldapsrv_reply *ent_r, *done_r;
 	int result = LDAP_SUCCESS;
-	struct ldb_wrap *samdb;
 	struct ldb_message **res = NULL;
 	int i, j, y, count = 0;
 	enum ldb_scope scope = LDB_SCOPE_DEFAULT;
 	const char **attrs = NULL;
 	const char *errstr = NULL;
-
+#endif
 	local_ctx = talloc_named(call, 0, "hldb_Search local memory context");
 	NT_STATUS_HAVE_NO_MEMORY(local_ctx);
 
 	samdb = samdb_connect(local_ctx);
 	NT_STATUS_HAVE_NO_MEMORY(samdb);
 
+	status = hacked_Search(partition, call, r, samdb);
+	talloc_free(local_ctx);
+	NT_STATUS_IS_OK_RETURN(status);
+	status = hacked_wellknown_Search(partition, call, r);
+	NT_STATUS_IS_OK_RETURN(status);
+	return status;
+#if 0
 	basedn = ldap_parse_dn(local_ctx, r->basedn);
 	VALID_DN_SYNTAX(basedn,0);
 
@@ -634,6 +607,7 @@
 	talloc_free(local_ctx);
 
 	return ldapsrv_queue_reply(call, done_r);
+#endif
 }
 
 static NTSTATUS hldb_Add(struct ldapsrv_partition *partition, struct ldapsrv_call *call,

Modified: branches/SAMBA_4_0/source/provision.ldif
===================================================================
--- branches/SAMBA_4_0/source/provision.ldif	2005-01-23 11:03:20 UTC (rev 4940)
+++ branches/SAMBA_4_0/source/provision.ldif	2005-01-23 11:12:42 UTC (rev 4941)
@@ -1222,3 +1222,23 @@
 invocationId: ${INVOCATIONID}
 msDS-Behavior-Version: 2
 
+###############################
+# Schema Naming Context
+###############################
+dn: CN=Schema,CN=Configuration,${BASEDN}
+objectClass: top
+objectClass: dMD
+cn: Schema
+instanceType: 13
+whenCreated: ${LDAPTIME}
+whenChanged: ${LDAPTIME}
+uSNCreated: ${USN}
+uSNChanged: ${USN}
+showInAdvancedViewOnly: TRUE
+name: Schema
+objectGUID: ${NEWGUID}
+objectCategory: CN=DMD,CN=Schema,CN=Configuration,${BASEDN}
+masteredBy: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,CN=Configuration,${BASEDN}
+msDs-masteredBy: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,CN=Configuration,${BASEDN}
+fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,CN=Configuration,${BASEDN}
+objectVersion: 30



More information about the samba-cvs mailing list