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_message_element *convert_sid_rid(TALLOC_CTX *ctx, const char *remote_attr, const struct ldb_message_element *el)
65 printf("Converting SID TO RID *\n");
67 return talloc_memdup(ctx, el, sizeof(*el));
70 static struct ldb_message_element *convert_rid_sid(TALLOC_CTX *ctx, const char *remote_attr, const struct ldb_message_element *el)
72 printf("Converting RID TO SID *\n");
74 return talloc_memdup(ctx, el, sizeof(*el));
77 static struct ldb_message_element *convert_unix_id2name(TALLOC_CTX *ctx, const char *remote_attr, const struct ldb_message_element *el)
79 printf("Converting UNIX ID to name\n");
81 return talloc_memdup(ctx, el, sizeof(*el));
84 static struct ldb_message_element *convert_unix_name2id(TALLOC_CTX *ctx, const char *remote_attr, const struct ldb_message_element *el)
86 printf("Converting UNIX name to ID\n");
88 return talloc_memdup(ctx, el, sizeof(*el));
91 const struct ldb_map_objectclass samba3_objectclasses[] = {
92 { "group", "sambaGroupMapping" },
93 { "user", "sambaSAMAccount" },
94 { "domain", "sambaDomain" },
97 const struct ldb_map_attribute samba3_attributes[] =
99 /* sambaNextRid -> nextRid */
101 .local_name = "nextRid",
103 .u.rename.remote_name = "sambaNextRid",
106 /* sambaBadPasswordTime -> badPasswordtime*/
108 .local_name = "badPasswordTime",
110 .u.rename.remote_name = "sambaBadPasswordTime",
113 /* sambaLMPassword -> lmPwdHash*/
115 .local_name = "lmPwdHash",
117 .u.rename.remote_name = "sambaLMPassword",
120 /* sambaGroupType -> groupType */
122 .local_name = "groupType",
124 .u.rename.remote_name = "sambaGroupType",
127 /* sambaNTPassword -> ntPwdHash*/
129 .local_name = "badPwdCount",
131 .u.rename.remote_name = "sambaNTPassword",
134 /* sambaPrimaryGroupSID -> primaryGroupID */
136 .local_name = "primaryGroupID",
138 .u.convert.remote_name = "sambaPrimaryGroupSID",
139 .u.convert.convert_local = convert_rid_sid,
140 .u.convert.convert_remote = convert_sid_rid,
143 /* sambaBadPasswordCount -> badPwdCount */
145 .local_name = "badPwdCount",
147 .u.rename.remote_name = "sambaBadPasswordCount",
150 /* sambaLogonTime -> lastLogon*/
152 .local_name = "lastLogon",
154 .u.rename.remote_name = "sambaLogonTime",
157 /* sambaLogoffTime -> lastLogoff*/
159 .local_name = "lastLogoff",
161 .u.rename.remote_name = "sambaLogoffTime",
164 /* gidNumber -> unixName */
166 .local_name = "unixName",
168 .u.convert.remote_name = "gidNumber",
169 .u.convert.convert_local = convert_unix_id2name,
170 .u.convert.convert_remote = convert_unix_name2id,
173 /* uid -> unixName */
175 .local_name = "unixName",
177 .u.convert.remote_name = "uid",
178 .u.convert.convert_local = convert_unix_id2name,
179 .u.convert.convert_remote = convert_unix_name2id,
182 /* displayName -> name */
184 .local_name = "name",
186 .u.rename.remote_name = "displayName",
197 .local_name = "description",
201 /* sambaSID -> objectSid*/
203 .local_name = "objectSid",
205 .u.rename.remote_name = "sambaSID",
208 /* sambaPwdLastSet -> pwdLastSet*/
210 .local_name = "pwdLastSet",
212 .u.rename.remote_name = "sambaPwdLastSet",
216 /* the init function */
217 #ifdef HAVE_DLOPEN_DISABLED
218 struct ldb_module *init_module(struct ldb_context *ldb, const char *options[])
220 struct ldb_module *ldb_samba3sam_module_init(struct ldb_context *ldb, const char *options[])
223 return ldb_map_init(ldb, samba3_attributes, samba3_objectclasses, options);