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"
32 * sambaSIDList -> member (special!)
33 * sambaDomainName -> name
39 * sambaAcctFlags -> systemFlags ?
40 * sambaPasswordHistory -> ntPwdHistory*/
48 * sambaAlgorithmicRidBase
59 * sambaUserWorkstations
63 static struct ldb_val convert_sid_rid(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
65 printf("Converting SID TO RID *\n");
67 return ldb_val_dup(ctx, val);
70 static struct ldb_val convert_rid_sid(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
72 printf("Converting RID TO SID *\n");
74 return ldb_val_dup(ctx, val);
77 static struct ldb_val convert_unix_id2name(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
79 printf("Converting UNIX ID to name\n");
81 return ldb_val_dup(ctx, val);
84 static struct ldb_val convert_unix_name2id(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
86 printf("Converting UNIX name to ID\n");
88 return ldb_val_dup(ctx, val);
91 const struct ldb_map_objectclass samba3_objectclasses[] = {
92 { "group", "sambaGroupMapping" },
93 { "user", "sambaSAMAccount" },
94 { "domain", "sambaDomain" },
98 const struct ldb_map_attribute samba3_attributes[] =
100 /* sambaNextRid -> nextRid */
102 .local_name = "nextRid",
104 .u.rename.remote_name = "sambaNextRid",
107 /* sambaBadPasswordTime -> badPasswordtime*/
109 .local_name = "badPasswordTime",
111 .u.rename.remote_name = "sambaBadPasswordTime",
114 /* sambaLMPassword -> lmPwdHash*/
116 .local_name = "lmPwdHash",
118 .u.rename.remote_name = "sambaLMPassword",
121 /* sambaGroupType -> groupType */
123 .local_name = "groupType",
125 .u.rename.remote_name = "sambaGroupType",
128 /* sambaNTPassword -> ntPwdHash*/
130 .local_name = "badPwdCount",
132 .u.rename.remote_name = "sambaNTPassword",
135 /* sambaPrimaryGroupSID -> primaryGroupID */
137 .local_name = "primaryGroupID",
139 .u.convert.remote_name = "sambaPrimaryGroupSID",
140 .u.convert.convert_local = convert_rid_sid,
141 .u.convert.convert_remote = convert_sid_rid,
144 /* sambaBadPasswordCount -> badPwdCount */
146 .local_name = "badPwdCount",
148 .u.rename.remote_name = "sambaBadPasswordCount",
151 /* sambaLogonTime -> lastLogon*/
153 .local_name = "lastLogon",
155 .u.rename.remote_name = "sambaLogonTime",
158 /* sambaLogoffTime -> lastLogoff*/
160 .local_name = "lastLogoff",
162 .u.rename.remote_name = "sambaLogoffTime",
165 /* gidNumber -> unixName */
167 .local_name = "unixName",
169 .u.convert.remote_name = "gidNumber",
170 .u.convert.convert_local = convert_unix_name2id,
171 .u.convert.convert_remote = convert_unix_id2name,
174 /* uid -> unixName */
176 .local_name = "unixName",
178 .u.convert.remote_name = "uid",
179 .u.convert.convert_local = convert_unix_name2id,
180 .u.convert.convert_remote = convert_unix_id2name,
183 /* displayName -> name */
185 .local_name = "name",
187 .u.rename.remote_name = "displayName",
198 .local_name = "description",
202 /* sambaSID -> objectSid*/
204 .local_name = "objectSid",
206 .u.rename.remote_name = "sambaSID",
209 /* sambaPwdLastSet -> pwdLastSet */
211 .local_name = "pwdLastSet",
213 .u.rename.remote_name = "sambaPwdLastSet",
226 /* the init function */
227 #ifdef HAVE_DLOPEN_DISABLED
228 struct ldb_module *init_module(struct ldb_context *ldb, const char *options[])
230 struct ldb_module *ldb_samba3sam_module_init(struct ldb_context *ldb, const char *options[])
233 return ldb_map_init(ldb, samba3_attributes, samba3_objectclasses, options);