summaryrefslogtreecommitdiffstats
path: root/source4/lib/ldb/samba/samba3sam.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-27 23:47:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:42 -0500
commit95ed275dbbff7c1e3a58a3d0c5408087ef9a0432 (patch)
tree45f65adabb61b97edbe40236d46b7cbd114ac6b6 /source4/lib/ldb/samba/samba3sam.c
parent3c265c79867e55a8118c2fa3c545a451e2b5e7e9 (diff)
downloadsamba-95ed275dbbff7c1e3a58a3d0c5408087ef9a0432.tar.gz
samba-95ed275dbbff7c1e3a58a3d0c5408087ef9a0432.tar.xz
samba-95ed275dbbff7c1e3a58a3d0c5408087ef9a0432.zip
r9698: Fix a bit of memory management
More minor bugfixes Support mapping objectclasses and do mapping on 'dn' field as well (not just msg->dn) (This used to be commit b7b079167d5c6616f7c5c4afb7dd80c15707cfd9)
Diffstat (limited to 'source4/lib/ldb/samba/samba3sam.c')
-rw-r--r--source4/lib/ldb/samba/samba3sam.c76
1 files changed, 19 insertions, 57 deletions
diff --git a/source4/lib/ldb/samba/samba3sam.c b/source4/lib/ldb/samba/samba3sam.c
index c1ac691e92..ceb52b8a16 100644
--- a/source4/lib/ldb/samba/samba3sam.c
+++ b/source4/lib/ldb/samba/samba3sam.c
@@ -60,86 +60,39 @@
* sambaMungedDial
* sambaLogonHours */
-static struct ldb_message_element *convert_sid_rid(TALLOC_CTX *ctx, const char *remote_attr, const struct ldb_message_element *el)
+static struct ldb_val convert_sid_rid(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
{
- struct ldb_message_element *ret = talloc(ctx, struct ldb_message_element);
- int i;
-
printf("Converting SID TO RID *\n");
- ret->flags = el->flags;
- ret->name = talloc_strdup(ret, remote_attr);
- ret->num_values = el->num_values;
- ret->values = talloc_array(ret, struct ldb_val, ret->num_values);
-
- for (i = 0; i < ret->num_values; i++) {
- ret->values[i] = ldb_val_dup(ret->values, &el->values[i]);
- }
-
- return ret;
+ return ldb_val_dup(ctx, val);
}
-static struct ldb_message_element *convert_rid_sid(TALLOC_CTX *ctx, const char *remote_attr, const struct ldb_message_element *el)
+static struct ldb_val convert_rid_sid(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
{
- struct ldb_message_element *ret = talloc(ctx, struct ldb_message_element);
- int i;
-
printf("Converting RID TO SID *\n");
- ret->flags = el->flags;
- ret->name = talloc_strdup(ret, remote_attr);
- ret->num_values = el->num_values;
- ret->values = talloc_array(ret, struct ldb_val, ret->num_values);
-
- for (i = 0; i < ret->num_values; i++) {
- ret->values[i] = ldb_val_dup(ret->values, &el->values[i]);
- }
-
- return ret;
+ return ldb_val_dup(ctx, val);
}
-static struct ldb_message_element *convert_unix_id2name(TALLOC_CTX *ctx, const char *remote_attr, const struct ldb_message_element *el)
+static struct ldb_val convert_unix_id2name(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
{
- int i;
- struct ldb_message_element *ret = talloc(ctx, struct ldb_message_element);
-
printf("Converting UNIX ID to name\n");
- ret->flags = el->flags;
- ret->name = talloc_strdup(ret, remote_attr);
- ret->num_values = el->num_values;
- ret->values = talloc_array(ret, struct ldb_val, ret->num_values);
-
- for (i = 0; i < ret->num_values; i++) {
- ret->values[i] = ldb_val_dup(ret->values, &el->values[i]);
- }
-
- return ret;
+ return ldb_val_dup(ctx, val);
}
-static struct ldb_message_element *convert_unix_name2id(TALLOC_CTX *ctx, const char *remote_attr, const struct ldb_message_element *el)
+static struct ldb_val convert_unix_name2id(struct ldb_map_context *map, TALLOC_CTX *ctx, const struct ldb_val *val)
{
- struct ldb_message_element *ret = talloc(ctx, struct ldb_message_element);
- int i;
-
printf("Converting UNIX name to ID\n");
- ret->flags = el->flags;
- ret->name = talloc_strdup(ret, remote_attr);
- ret->num_values = el->num_values;
- ret->values = talloc_array(ret, struct ldb_val, ret->num_values);
-
- for (i = 0; i < ret->num_values; i++) {
- ret->values[i] = ldb_val_dup(ret->values, &el->values[i]);
- }
-
- return ret;
+ return ldb_val_dup(ctx, val);
}
const struct ldb_map_objectclass samba3_objectclasses[] = {
{ "group", "sambaGroupMapping" },
{ "user", "sambaSAMAccount" },
{ "domain", "sambaDomain" },
+ { NULL, NULL }
};
const struct ldb_map_attribute samba3_attributes[] =
@@ -253,12 +206,21 @@ const struct ldb_map_attribute samba3_attributes[] =
.u.rename.remote_name = "sambaSID",
},
- /* sambaPwdLastSet -> pwdLastSet*/
+ /* sambaPwdLastSet -> pwdLastSet */
{
.local_name = "pwdLastSet",
.type = MAP_RENAME,
.u.rename.remote_name = "sambaPwdLastSet",
},
+
+ /* cn -> cn */
+ {
+ .local_name = "cn",
+ .type = MAP_KEEP,
+ },
+ {
+ .local_name = NULL,
+ }
};
/* the init function */