#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/ndr/libndr.h"
#include "dsdb/samdb/samdb.h"
+#include "../../../lib/ldb/include/ldb_handlers.h"
struct entryuuid_private {
struct ldb_context *ldb;
return out;
}
+/* Ensure we always convert sids into string, so the backend doesn't have to know about both forms */
+static struct ldb_val sid_always_string(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
+{
+ struct ldb_context *ldb = ldb_module_get_ctx(module);
+ struct ldb_val out = data_blob(NULL, 0);
+
+ if (ldif_comparision_objectSid_isString(val)) {
+ if (ldb_handler_copy(ldb, ctx, val, &out) != LDB_SUCCESS) {
+ return data_blob(NULL, 0);
+ }
+
+ } else {
+ if (ldif_write_objectSid(ldb, ctx, val, &out) != LDB_SUCCESS) {
+ return data_blob(NULL, 0);
+ }
+ }
+ return out;
+}
+
/* Ensure we always convert objectCategory into a DN */
static struct ldb_val objectCategory_always_dn(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
{
.type = LDB_MAP_CONVERT,
.u = {
.convert = {
- .remote_name = "objectSid",
- .convert_local = sid_always_binary,
- .convert_remote = val_copy,
+ .remote_name = "sambaSID",
+ .convert_local = sid_always_string,
+ .convert_remote = sid_always_binary,
}
}
},
}
}
},
- {
- .local_name = "unixHomeDirectory",
- .type = MAP_RENAME,
- .u = {
- .rename = {
- .remote_name = "homeDirectory"
- }
- }
- },
{
.local_name = "pwdLastSet",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaPwdLastSet"
},
{
.local_name = "lastLogon",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaLogonTime"
},
{
.local_name = "lastLogoff",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaLogoffTime"
},
{
.local_name = "badPwdCount",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaBadPasswordCount"
},
{
.local_name = "logonHours",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaLogonHours"
},
{
.local_name = "homeDrive",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaHomeDrive"
},
{
.local_name = "scriptPath",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaLogonScript"
},
{
.local_name = "profilePath",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaProfilePath"
},
{
.local_name = "userWorkstations",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaUserWorkstations"
},
{
.local_name = "homeDirectory",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaHomePath"
},
{
.local_name = "nextRid",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaNextRid"
},
{
.local_name = "privilegeDisplayName",
- .type = MAP_RENAME,
+ .type = LDB_MAP_RENAME,
.u = {
.rename = {
.remote_name = "sambaPrivName"
/* This objectClass conflicts with builtin classes on FDS */
const struct ldb_map_objectclass nsuniqueid_objectclasses[] =
{
- {
- .local_name = "domain",
- .remote_name = "samba4Domain"
- },
- {
- .local_name = "rFC822LocalPart",
- .remote_name = "samba4RFC822LocalPart"
- },
- {
- .local_name = "mailRecipient",
- .remote_name = "samba4MailRecipient"
- },
- {
- .local_name = "nisMap",
- .remote_name = "samba4NisMap"
- },
- {
- .local_name = "person",
- .remote_name = "samba4Person"
- },
- {
- .local_name = "organizationalPerson",
- .remote_name = "samba4OrganizationalPerson"
- },
- {
- .local_name = "residentialPerson",
- .remote_name = "samba4ResidentialPerson"
- },
- {
- .local_name = "inetOrgPerson",
- .remote_name = "samba4InetOrgPerson"
- },
{
.local_name = NULL
}