2 ldb database library - Samba3 SAM compatibility backend
4 Copyright (C) Jelmer Vernooij 2005
6 ** NOTE! The following LGPL license applies to the ldb
7 ** library. This does NOT imply that all of Samba is released
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "ldb/ldb_map/ldb_map.h"
27 #include "ldb/include/ldb.h"
28 #include "ldb/include/ldb_private.h"
31 * sambaSID -> member (dn!)
32 * sambaSIDList -> member (dn!)
33 * sambaDomainName -> name
39 * sambaAcctFlags -> systemFlags ?
40 * sambaPasswordHistory -> ntPwdHistory*/
48 * sambaAlgorithmicRidBase
59 * sambaUserWorkstations
63 /* In Samba4 but not in Samba3:
66 static struct ldb_val convert_sid_rid(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
68 printf("Converting SID TO RID *\n");
70 return ldb_val_dup(ctx, val);
73 static struct ldb_val convert_rid_sid(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
75 printf("Converting RID TO SID *\n");
77 return ldb_val_dup(ctx, val);
80 static struct ldb_val convert_unix_id2name(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
82 printf("Converting UNIX ID to name\n");
84 return ldb_val_dup(ctx, val);
87 static struct ldb_val convert_unix_name2id(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
89 printf("Converting UNIX name to ID\n");
91 return ldb_val_dup(ctx, val);
94 const struct ldb_map_objectclass samba3_objectclasses[] = {
95 { "group", "sambaGroupMapping" },
96 { "user", "sambaSAMAccount" },
97 { "domain", "sambaDomain" },
101 const struct ldb_map_attribute samba3_attributes[] =
103 /* sambaNextRid -> nextRid */
105 .local_name = "nextRid",
107 .u.rename.remote_name = "sambaNextRid",
110 /* sambaBadPasswordTime -> badPasswordtime*/
112 .local_name = "badPasswordTime",
114 .u.rename.remote_name = "sambaBadPasswordTime",
117 /* sambaLMPassword -> lmPwdHash*/
119 .local_name = "lmPwdHash",
121 .u.rename.remote_name = "sambaLMPassword",
124 /* sambaGroupType -> groupType */
126 .local_name = "groupType",
128 .u.rename.remote_name = "sambaGroupType",
131 /* sambaNTPassword -> ntPwdHash*/
133 .local_name = "badPwdCount",
135 .u.rename.remote_name = "sambaNTPassword",
138 /* sambaPrimaryGroupSID -> primaryGroupID */
140 .local_name = "primaryGroupID",
142 .u.convert.remote_name = "sambaPrimaryGroupSID",
143 .u.convert.convert_local = convert_rid_sid,
144 .u.convert.convert_remote = convert_sid_rid,
147 /* sambaBadPasswordCount -> badPwdCount */
149 .local_name = "badPwdCount",
151 .u.rename.remote_name = "sambaBadPasswordCount",
154 /* sambaLogonTime -> lastLogon*/
156 .local_name = "lastLogon",
158 .u.rename.remote_name = "sambaLogonTime",
161 /* sambaLogoffTime -> lastLogoff*/
163 .local_name = "lastLogoff",
165 .u.rename.remote_name = "sambaLogoffTime",
168 /* gidNumber -> unixName */
170 .local_name = "unixName",
172 .u.convert.remote_name = "gidNumber",
173 .u.convert.convert_local = convert_unix_name2id,
174 .u.convert.convert_remote = convert_unix_id2name,
177 /* uid -> unixName */
179 .local_name = "unixName",
181 .u.convert.remote_name = "uid",
182 .u.convert.convert_local = convert_unix_name2id,
183 .u.convert.convert_remote = convert_unix_id2name,
186 /* displayName -> name */
188 .local_name = "name",
190 .u.rename.remote_name = "displayName",
199 /* sAMAccountName -> cn */
201 .local_name = "sAMAccountName",
203 .u.rename.remote_name = "cn",
208 .local_name = "objectCategory",
214 .local_name = "objectGUID",
220 .local_name = "objectVersion",
226 .local_name = "codePage",
232 .local_name = "dNSHostName",
239 .local_name = "dnsDomain",
245 .local_name = "dnsRoot",
251 .local_name = "countryCode",
257 .local_name = "nTMixedDomain",
261 /* operatingSystem */
263 .local_name = "operatingSystem",
267 /* operatingSystemVersion */
269 .local_name = "operatingSystemVersion",
274 /* servicePrincipalName */
276 .local_name = "servicePrincipalName",
280 /* msDS-Behavior-Version */
282 .local_name = "msDS-Behavior-Version",
286 /* msDS-KeyVersionNumber */
288 .local_name = "msDS-KeyVersionNumber",
292 /* msDs-masteredBy */
294 .local_name = "msDs-masteredBy",
312 .local_name = "description",
316 /* sambaSID -> objectSid*/
318 .local_name = "objectSid",
320 .u.rename.remote_name = "sambaSID",
323 /* sambaPwdLastSet -> pwdLastSet */
325 .local_name = "pwdLastSet",
327 .u.rename.remote_name = "sambaPwdLastSet",
332 .local_name = "accountExpires",
338 .local_name = "adminCount",
344 .local_name = "canonicalName",
348 /* createTimestamp */
350 .local_name = "createTimestamp",
356 .local_name = "creationTime",
362 .local_name = "dMDLocation",
368 .local_name = "fSMORoleOwner",
374 .local_name = "forceLogoff",
380 .local_name = "instanceType",
386 .local_name = "invocationId",
390 /* isCriticalSystemObject */
392 .local_name = "isCriticalSystemObject",
396 /* localPolicyFlags */
398 .local_name = "localPolicyFlags",
402 /* lockOutObservationWindow */
404 .local_name = "lockOutObservationWindow",
408 /* lockoutDuration */
410 .local_name = "lockoutDuration",
414 /* lockoutThreshold */
416 .local_name = "lockoutThreshold",
422 .local_name = "logonCount",
428 .local_name = "masteredBy",
434 .local_name = "maxPwdAge",
440 .local_name = "member",
446 .local_name = "memberOf",
452 .local_name = "minPwdAge",
458 .local_name = "minPwdLength",
464 .local_name = "modifiedCount",
468 /* modifiedCountAtLastProm */
470 .local_name = "modifiedCountAtLastProm",
474 /* modifyTimestamp */
476 .local_name = "modifyTimestamp",
482 .local_name = "nCName",
488 .local_name = "nETBIOSName",
494 .local_name = "oEMInformation",
500 .local_name = "privilege",
504 /* pwdHistoryLength */
506 .local_name = "pwdHistoryLength",
512 .local_name = "pwdProperties",
516 /* rIDAvailablePool */
518 .local_name = "rIDAvailablePool",
524 .local_name = "revision",
528 /* ridManagerReference */
530 .local_name = "ridManagerReference",
536 .local_name = "sAMAccountType",
542 .local_name = "sPNMappings",
546 /* serverReference */
548 .local_name = "serverReference",
554 .local_name = "serverState",
558 /* showInAdvancedViewOnly */
560 .local_name = "showInAdvancedViewOnly",
566 .local_name = "subRefs",
572 .local_name = "systemFlags",
578 .local_name = "uASCompat",
584 .local_name = "uSNChanged",
590 .local_name = "uSNCreated",
596 .local_name = "unicodePwd",
600 /* userAccountControl */
602 .local_name = "userAccountControl",
608 .local_name = "whenChanged",
614 .local_name = "whenCreated",
623 /* the init function */
624 #ifdef HAVE_DLOPEN_DISABLED
625 struct ldb_module *init_module(struct ldb_context *ldb, const char *options[])
627 struct ldb_module *ldb_samba3sam_module_init(struct ldb_context *ldb, const char *options[])
630 return ldb_map_init(ldb, samba3_attributes, samba3_objectclasses, options);