2 Unix SMB/CIFS implementation.
4 Copyright (C) Stefan Metzmacher 2004
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #define ATTR_BLOB_CONST(val) data_blob_talloc(attrs, val, sizeof(val)-1)
24 #define ATTR_SINGLE_NOVAL(attr, blob, num, nam) do { \
25 attr.name = talloc_strdup(attrs, nam);\
26 attr.num_values = num; \
30 void ldapsrv_RootDSE_Search(struct ldapsrv_call *call,
31 struct ldap_SearchRequest *r)
33 struct ldap_SearchResEntry *ent;
34 struct ldap_Result *done;
36 struct ldapsrv_reply *ent_r, *done_r;
38 struct ldap_attribute *attrs;
40 DEBUG(10, ("Root DSE: %s\n", r->filter));
42 if (r->scope != LDAP_SEARCH_SCOPE_BASE) {
43 code = 32; /* nosuchobject */
47 attrs = talloc_array_p(call, struct ldap_attribute, num_attrs);
49 ldapsrv_terminate_connection(call->conn, "no memory");
58 int num_currentTime = 1;
59 DATA_BLOB *currentTime = talloc_array_p(attrs, DATA_BLOB, num_currentTime);
60 char *str = ldap_timestring(call, time(NULL));
62 ldapsrv_terminate_connection(call->conn, "no memory");
65 currentTime[0].data = str;
66 currentTime[0].length = strlen(str);
67 ATTR_SINGLE_NOVAL(attrs[0], currentTime, num_currentTime, "currentTime");
72 * CN=Aggregate,CN=Schema,CN=Configuration,DC=DOM,DC=TLD
77 * CN=NTDS Settings,CN=NETBIOSNAME,CN=Servers,CN=Default-First-Site,CN=Sites,CN=Configuration,DC=DOM,DC=TLD
83 * CN=Configuration,DC=DOM,DC=TLD
84 * CN=Schema,CN=Configuration,DC=DOM,DC=TLD
85 * DC=DomainDnsZones,DC=DOM,DC=TLD
86 * DC=ForestDnsZones,DC=DOM,DC=TLD
90 * defaultNamingContext
96 * CN=Schema,CN=Configuration,DC=DOM,DC=TLD
100 * configurationNamingContext
101 * CN=Configuration,DC=DOM,DC=TLD
105 * rootDomainNamingContext
111 * 1.2.840.113556.1.4.319
112 * 1.2.840.113556.1.4.801
113 * 1.2.840.113556.1.4.473
114 * 1.2.840.113556.1.4.528
115 * 1.2.840.113556.1.4.417
116 * 1.2.840.113556.1.4.619
117 * 1.2.840.113556.1.4.841
118 * 1.2.840.113556.1.4.529
119 * 1.2.840.113556.1.4.805
120 * 1.2.840.113556.1.4.521
121 * 1.2.840.113556.1.4.970
122 * 1.2.840.113556.1.4.1338
123 * 1.2.840.113556.1.4.474
124 * 1.2.840.113556.1.4.1339
125 * 1.2.840.113556.1.4.1340
126 * 1.2.840.113556.1.4.1413
127 * 2.16.840.1.113730.3.4.9
128 * 2.16.840.1.113730.3.4.10
129 * 1.2.840.113556.1.4.1504
130 * 1.2.840.113556.1.4.1852
131 * 1.2.840.113556.1.4.802
135 * supportedLDAPVersion
140 int num_supportedLDAPVersion = 1;
141 DATA_BLOB *supportedLDAPVersion = talloc_array_p(attrs, DATA_BLOB, num_supportedLDAPVersion);
142 supportedLDAPVersion[0] = ATTR_BLOB_CONST("3");
143 ATTR_SINGLE_NOVAL(attrs[1], supportedLDAPVersion, num_supportedLDAPVersion, "supportedLDAPVersion");
147 * supportedLDAPPolicies
158 * MaxNotificationPerConn
163 * highestCommittedUSN
168 * supportedSASLMechanisms
177 * netbiosname.dom.tld
180 int num_dnsHostName = 1;
181 DATA_BLOB *dnsHostName = talloc_array_p(attrs, DATA_BLOB, num_dnsHostName);
182 dnsHostName[0] = data_blob_talloc(attrs, lp_netbios_name(),strlen(lp_netbios_name()));
183 ATTR_SINGLE_NOVAL(attrs[2], dnsHostName, num_dnsHostName, "dnsHostName");
188 * dom.tld:netbiosname$@DOM.TLD
193 * CN=NETBIOSNAME,CN=Servers,CN=Default-First-Site,CN=Sites,CN=Configuration,DC=DOM,DC=TLD
197 * supportedCapabilities
198 * 1.2.840.113556.1.4.800
199 * 1.2.840.113556.1.4.1670
200 * 1.2.840.113556.1.4.1791
209 * isGlobalCatalogReady
214 * domainFunctionality
219 * forestFunctionality
224 * domainControllerFunctionality
229 ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultEntry);
231 ldapsrv_terminate_connection(call->conn, "ldapsrv_init_reply() failed");
235 ent = &ent_r->msg.r.SearchResultEntry;
237 ent->num_attributes = num_attrs;
238 ent->attributes = attrs;
240 ldapsrv_queue_reply(call, ent_r);
244 done_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultDone);
246 ldapsrv_terminate_connection(call->conn, "ldapsrv_init_reply() failed");
250 done = &done_r->msg.r.SearchResultDone;
251 done->resultcode = code;
253 done->errormessage = NULL;
254 done->referral = NULL;
256 ldapsrv_queue_reply(call, done_r);