r9672: Fix build for compilers that don't like undefined-length arrays at the end...
[sfrench/samba-autobuild/.git] / source / lib / samba3 / ldb_samba3.c
index fa13daa611678e71c90a722482bbb6e360f22880..68f5412c90c9d409d207a18b47653da8e0314f70 100644 (file)
 #include "ldb/include/ldb.h"
 #include "ldb/include/ldb_private.h"
 
-/* 
- * sambaGroupMapping -> group
- *     gidNumber -> ???
- *     sambaSID -> member
- *     sambaGroupType -> groupType
- *     displayName -> name
- *     description -> description
- *     sambaSIDList -> member 
+/* 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
  */
 
-struct ldb_map_mappings samba3_mappings;
+/* 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 */
+       /* the init function */
 #ifdef HAVE_DLOPEN_DISABLED
- struct ldb_module *init_module(struct ldb_context *ldb, const char *options[])
      struct ldb_module *init_module(struct ldb_context *ldb, const char *options[])
 #else
-struct ldb_module *ldb_samba3_module_init(struct ldb_context *ldb, const char *options[])
+       struct ldb_module *ldb_samba3_module_init(struct ldb_context *ldb, const char *options[])
 #endif
 {
-       return ldb_map_init(ldb, &samba3_mappings, options);
+       return ldb_map_init(ldb, &samba3_attributes, &samba3_objectclasses, options);
 }