summaryrefslogtreecommitdiffstats
path: root/source4/lib/ldb/samba/samba3sam.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-27 15:13:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:41 -0500
commit7e3838dd2d8647e9c621a08c61a2a22ef1d94bb2 (patch)
tree221d336d855546df8be8ececffb2e4aea013131c /source4/lib/ldb/samba/samba3sam.c
parente3dcc92deef81972a6f38bdbab75256d3d038357 (diff)
downloadsamba-7e3838dd2d8647e9c621a08c61a2a22ef1d94bb2.tar.gz
samba-7e3838dd2d8647e9c621a08c61a2a22ef1d94bb2.tar.xz
samba-7e3838dd2d8647e9c621a08c61a2a22ef1d94bb2.zip
r9685: Add tests for samba3sam mapping module
Fix a couple of bugs Move samba3sam backend to lib/ldb/ Remove some more unused parameters (This used to be commit 7f864d446d6af7cfd9fb8dbc496a29b36ec57ce9)
Diffstat (limited to 'source4/lib/ldb/samba/samba3sam.c')
-rw-r--r--source4/lib/ldb/samba/samba3sam.c198
1 files changed, 198 insertions, 0 deletions
diff --git a/source4/lib/ldb/samba/samba3sam.c b/source4/lib/ldb/samba/samba3sam.c
new file mode 100644
index 0000000000..6c98ffc5c1
--- /dev/null
+++ b/source4/lib/ldb/samba/samba3sam.c
@@ -0,0 +1,198 @@
+/*
+ ldb database library - Samba3 SAM compatibility backend
+
+ Copyright (C) Jelmer Vernooij 2005
+
+ ** NOTE! The following LGPL license applies to the ldb
+ ** library. This does NOT imply that all of Samba is released
+ ** under the LGPL
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "includes.h"
+#include "ldb/ldb_map/ldb_map.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
+
+/* FIXME:
+ * sambaSID -> member
+ * sambaSIDList -> member (special!)
+ * sambaDomainName -> name
+ * sambaTrustPassword
+ * sambaUnixIdPool
+ * sambaIdmapEntry
+ * sambaAccountPolicy
+ * sambaSidEntry
+ * sambaAcctFlags -> systemFlags ?
+ * sambaPasswordHistory -> ntPwdHistory*/
+
+/* Not necessary:
+ * sambaConfig
+ * sambaShare
+ * sambaConfigOption
+ * sambaNextGroupRid
+ * sambaNextUserRid
+ * sambaAlgorithmicRidBase
+ */
+
+/* Not in Samba4:
+ * sambaKickoffTime
+ * sambaPwdCanChange
+ * sambaPwdMustChange
+ * sambaHomePath
+ * sambaHomeDrive
+ * sambaLogonScript
+ * sambaProfilePath
+ * sambaUserWorkstations
+ * sambaMungedDial
+ * sambaLogonHours */
+
+
+
+const struct ldb_map_objectclass samba3_objectclasses[] = {
+ { "group", "sambaGroupMapping" },
+ { "user", "sambaSAMAccount" },
+ { "domain", "sambaDomain" },
+};
+
+const struct ldb_map_attribute samba3_attributes[] =
+{
+ /* sambaNextRid -> nextRid */
+ {
+ .local_name = "nextRid",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "sambaNextRid",
+ },
+
+ /* sambaBadPasswordTime -> badPasswordtime*/
+ {
+ .local_name = "badPasswordTime",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "sambaBadPasswordTime",
+ },
+
+ /* sambaLMPassword -> lmPwdHash*/
+ {
+ .local_name = "lmPwdHash",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "sambaLMPassword",
+ },
+
+ /* sambaGroupType -> groupType */
+ {
+ .local_name = "groupType",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "sambaGroupType",
+ },
+
+ /* sambaNTPassword -> ntPwdHash*/
+ {
+ .local_name = "badPwdCount",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "sambaNTPassword",
+ },
+
+ /* sambaPrimaryGroupSID -> primaryGroupID */
+ {
+ .local_name = "primaryGroupID",
+ .type = MAP_CONVERT,
+ .u.convert.remote_name = "sambaPrimaryGroupSID",
+ .u.convert.convert_local = NULL, /* FIXME: Add domain SID */
+ .u.convert.convert_remote = NULL, /* FIXME: Extract RID */
+ },
+
+ /* sambaBadPasswordCount -> badPwdCount */
+ {
+ .local_name = "badPwdCount",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "sambaBadPasswordCount",
+ },
+
+ /* sambaLogonTime -> lastLogon*/
+ {
+ .local_name = "lastLogon",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "sambaLogonTime",
+ },
+
+ /* sambaLogoffTime -> lastLogoff*/
+ {
+ .local_name = "lastLogoff",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "sambaLogoffTime",
+ },
+
+ /* gidNumber -> unixName */
+ {
+ .local_name = "unixName",
+ .type = MAP_CONVERT,
+ .u.convert.remote_name = "gidNumber",
+ .u.convert.convert_local = NULL, /* FIXME: Lookup gid */
+ .u.convert.convert_remote = NULL, /* FIXME: Lookup groupname */
+ },
+
+ /* uid -> unixName */
+ {
+ .local_name = "unixName",
+ .type = MAP_CONVERT,
+ .u.convert.remote_name = "uid",
+ .u.convert.convert_local = NULL, /* FIXME: Lookup uid */
+ .u.convert.convert_remote = NULL, /* FIXME: Lookup username */
+ },
+
+ /* displayName -> name */
+ {
+ .local_name = "name",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "displayName",
+ },
+
+ /* cn */
+ {
+ .local_name = "cn",
+ .type = MAP_KEEP,
+ },
+
+ /* description */
+ {
+ .local_name = "description",
+ .type = MAP_KEEP,
+ },
+
+ /* sambaSID -> objectSid*/
+ {
+ .local_name = "objectSid",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "sambaSID",
+ },
+
+ /* sambaPwdLastSet -> pwdLastSet*/
+ {
+ .local_name = "pwdLastSet",
+ .type = MAP_RENAME,
+ .u.rename.remote_name = "sambaPwdLastSet",
+ },
+};
+
+ /* the init function */
+#ifdef HAVE_DLOPEN_DISABLED
+struct ldb_module *init_module(struct ldb_context *ldb, const char *options[])
+#else
+struct ldb_module *ldb_samba3sam_module_init(struct ldb_context *ldb, const char *options[])
+#endif
+{
+ return ldb_map_init(ldb, &samba3_attributes, &samba3_objectclasses, options);
+}