diff options
author | Stefan Metzmacher <metze@samba.org> | 2004-10-09 21:53:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:41 -0500 |
commit | 4c2bbb1edbee60556a3e0d1d428236400ae514ff (patch) | |
tree | 37662a3c2104e947423367c9ae32cae04fc3cbde /source4/ldap_server | |
parent | d669d6a8920fe4725adbecf86d184b97d8433988 (diff) | |
download | samba-4c2bbb1edbee60556a3e0d1d428236400ae514ff.tar.gz samba-4c2bbb1edbee60556a3e0d1d428236400ae514ff.tar.bz2 samba-4c2bbb1edbee60556a3e0d1d428236400ae514ff.zip |
r2876: - more than one rootDSE entry in the database is an error!
- don't say that we provide the same functionality as w2k3
- netbiosname is always upper case hostname
- minor fixes rootdse.pl
metze
(This used to be commit 0b30ec593fc6a8f0c0a5b2219ca1250fdd87c1f3)
Diffstat (limited to 'source4/ldap_server')
-rw-r--r-- | source4/ldap_server/ldap_rootdse.c | 42 | ||||
-rw-r--r-- | source4/ldap_server/rootdse.ldif | 51 |
2 files changed, 36 insertions, 57 deletions
diff --git a/source4/ldap_server/ldap_rootdse.c b/source4/ldap_server/ldap_rootdse.c index b936c92da3..631b38d383 100644 --- a/source4/ldap_server/ldap_rootdse.c +++ b/source4/ldap_server/ldap_rootdse.c @@ -100,7 +100,7 @@ void *rootdse_db_connect(TALLOC_CTX *mem_ctx) return NULL; } - DEBUG(10, ("opening %s", db_path)); + DEBUG(10, ("opening %s\n", db_path)); ctx->ldb = ldb_connect(db_path, 0, NULL); if (ctx->ldb == NULL) { talloc_free(ctx); @@ -291,7 +291,6 @@ static NTSTATUS fill_dynamic_values(void *mem_ctx, struct ldap_attribute *attrs) * 2 */ -def: { DATA_BLOB *x = talloc_array_p(mem_ctx, DATA_BLOB, 1); x[0] = ATTR_BLOB_CONST("0"); @@ -312,7 +311,8 @@ static NTSTATUS rootdse_Search(struct ldapsrv_partition *partition, struct ldaps struct ldapsrv_reply *ent_r, *done_r; struct rootdse_db_context *rootdsedb; const char *errstr = NULL; - int count, i, j, y; + int count, j, y; + const char **attrs = NULL; if (r->scope != LDAP_SEARCH_SCOPE_BASE) { count = -1; @@ -325,10 +325,21 @@ static NTSTATUS rootdse_Search(struct ldapsrv_partition *partition, struct ldaps rootdsedb = rootdse_db_connect(local_ctx); ALLOC_CHECK(rootdsedb); + if (r->num_attributes >= 1) { + attrs = talloc_array_p(rootdsedb, const char *, r->num_attributes+1); + ALLOC_CHECK(attrs); + + for (j=0; j < r->num_attributes; j++) { + DEBUG(10,("rootDSE_Search: attrs: [%s]\n",r->attributes[j])); + attrs[j] = r->attributes[j]; + } + attrs[j] = NULL; + } + ldb_set_alloc(rootdsedb->ldb, talloc_realloc_fn, rootdsedb); - count = ldb_search(rootdsedb->ldb, "", 0, "dn=rootDSE", NULL, &res); + count = ldb_search(rootdsedb->ldb, "", 0, "dn=cn=rootDSE", attrs, &res); - for (i = 0; i < count; i++) { + if (count == 1) { ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultEntry); if (!ent_r) { return NT_STATUS_NO_MEMORY; @@ -338,19 +349,19 @@ static NTSTATUS rootdse_Search(struct ldapsrv_partition *partition, struct ldaps ent->dn = ""; ent->num_attributes = 0; ent->attributes = NULL; - if (res[i]->num_elements == 0) { + if (res[0]->num_elements == 0) { goto queue_reply; } - ent->num_attributes = res[i]->num_elements; + ent->num_attributes = res[0]->num_elements; ent->attributes = talloc_array_p(ent_r, struct ldap_attribute, ent->num_attributes); ALLOC_CHECK(ent->attributes); for (j=0; j < ent->num_attributes; j++) { - ent->attributes[j].name = talloc_steal(ent->attributes, res[i]->elements[j].name); + ent->attributes[j].name = talloc_steal(ent->attributes, res[0]->elements[j].name); ent->attributes[j].num_values = 0; ent->attributes[j].values = NULL; - ent->attributes[j].num_values = res[i]->elements[j].num_values; + ent->attributes[j].num_values = res[0]->elements[j].num_values; if (ent->attributes[j].num_values == 1 && - strncmp(res[i]->elements[j].values[0].data, "_DYNAMIC_", 9) == 0) { + strncmp(res[0]->elements[j].values[0].data, "_DYNAMIC_", 9) == 0) { fill_dynamic_values(ent->attributes, &(ent->attributes[j])); if (ent->attributes[j].values[0].data == NULL) { DEBUG (10, ("ARRGHH!\n")); @@ -360,9 +371,9 @@ static NTSTATUS rootdse_Search(struct ldapsrv_partition *partition, struct ldaps DATA_BLOB, ent->attributes[j].num_values); ALLOC_CHECK(ent->attributes[j].values); for (y=0; y < ent->attributes[j].num_values; y++) { - ent->attributes[j].values[y].length = res[i]->elements[j].values[y].length; + ent->attributes[j].values[y].length = res[0]->elements[j].values[y].length; ent->attributes[j].values[y].data = talloc_steal(ent->attributes[j].values, - res[i]->elements[j].values[y].data); + res[0]->elements[j].values[y].data); } } } @@ -382,10 +393,14 @@ no_base_scope: return NT_STATUS_NO_MEMORY; } - if (count > 0) { + if (count == 1) { DEBUG(10,("rootdse_Search: results: [%d]\n",count)); result = 0; errstr = NULL; + } else if (count > 1) { + DEBUG(10,("rootdse_Search: to many results[%d]\n", count)); + result = 80; /* nosuchobject */ + errstr = talloc_strdup(done_r, "internal error"); } else if (count == 0) { DEBUG(10,("rootdse_Search: no results\n")); result = 32; /* nosuchobject */ @@ -396,7 +411,6 @@ no_base_scope: errstr = talloc_strdup(done_r, ldb_errstring(rootdsedb->ldb)); } - done = &done_r->msg.r.SearchResultDone; done->resultcode = result; done->dn = NULL; diff --git a/source4/ldap_server/rootdse.ldif b/source4/ldap_server/rootdse.ldif index f129492732..86ba2fd676 100644 --- a/source4/ldap_server/rootdse.ldif +++ b/source4/ldap_server/rootdse.ldif @@ -1,61 +1,26 @@ -dn: rootDSE +dn: @INDEXLIST + +dn: @ATTRIBUTES + +dn: @SUBCLASSES + +dn: cn=rootDSE currentTime: _DYNAMIC_ subschemaSubentry: CN=Aggregate,CN=Schema,CN=Configuration,${BASEDN} dsServiceName: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,${BASEDN} namingContexts: ${BASEDN} namingContexts: CN=Configuration,${BASEDN} namingContexts: CN=Schema,CN=Configuration,${BASEDN} -namingContexts: DC=DomainDnsZones,${BASEDN} -namingContexts: DC=ForestDnsZones,${BASEDN} defaultNamingContext: ${BASEDN} rootDomainNamingContext: ${BASEDN} configurationNamingContext: CN=Configuration,${BASEDN} schemaNamingContext: CN=Schema,CN=Configuration,${BASEDN} -supportedControl: 1.2.840.113556.1.4.319 -supportedControl: 1.2.840.113556.1.4.801 -supportedControl: 1.2.840.113556.1.4.473 -supportedControl: 1.2.840.113556.1.4.528 -supportedControl: 1.2.840.113556.1.4.417 -supportedControl: 1.2.840.113556.1.4.619 -supportedControl: 1.2.840.113556.1.4.841 -supportedControl: 1.2.840.113556.1.4.529 -supportedControl: 1.2.840.113556.1.4.805 -supportedControl: 1.2.840.113556.1.4.521 -supportedControl: 1.2.840.113556.1.4.970 -supportedControl: 1.2.840.113556.1.4.1338 -supportedControl: 1.2.840.113556.1.4.474 -supportedControl: 1.2.840.113556.1.4.1339 -supportedControl: 1.2.840.113556.1.4.1340 -supportedControl: 1.2.840.113556.1.4.1413 -supportedControl: 2.16.840.1.113730.3.4.9 -supportedControl: 2.16.840.1.113730.3.4.10 -supportedControl: 1.2.840.113556.1.4.1504 -supportedControl: 1.2.840.113556.1.4.1852 -supportedControl: 1.2.840.113556.1.4.802 supportedLDAPVersion: 3 -supportedLDAPPolicies: MaxPoolThreads -supportedLDAPPolicies: MaxDatagramRecv -supportedLDAPPolicies: MaxReceiveBuffer -supportedLDAPPolicies: InitRecvTimeout -supportedLDAPPolicies: MaxConnections -supportedLDAPPolicies: MaxConnIdleTime -supportedLDAPPolicies: MaxPageSize -supportedLDAPPolicies: MaxQueryDuration -supportedLDAPPolicies: MaxTempTableSize -supportedLDAPPolicies: MaxResultSetSize -supportedLDAPPolicies: MaxNotificationPerConn -supportedLDAPPolicies: MaxValRange highestCommittedUSN: _DYNAMIC_ -supportedSASLMechanisms: GSSAPI supportedSASLMechanisms: GSS-SPNEGO -supportedSASLMechanisms: EXTERNAL -supportedSASLMechanisms: DIGEST-MD5 -dnsHostName: ${NETBIOSNAME}.${DNSDOMAIN} +dnsHostName: ${DNSNAME} ldapServiceName: ${DNSDOMAIN}:${NETBIOSNAME}$@${DNSDOMAIN} serverName: CN=${NETBIOSNAME},CN=Servers,CN=Default-First-Site,CN=Sites,CN=Configuration,${BASEDN} -supportedCapabilities: 1.2.840.113556.1.4.800 -supportedCapabilities: 1.2.840.113556.1.4.1670 -supportedCapabilities: 1.2.840.113556.1.4.1791 isSynchronized: _DYNAMIC_ domainFunctionality: 0 forestFunctionality: 0 |