summaryrefslogtreecommitdiff
path: root/source3/winbindd/idmap_tdb2.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-06-23 12:02:31 +0200
committerMichael Adam <obnox@samba.org>2010-08-14 02:10:57 +0200
commit3f3cff9127b971c0de50975ed47cbb2d102a0e03 (patch)
treeb53f2a687bc44daab0267ec34544a05b90b0ddb0 /source3/winbindd/idmap_tdb2.c
parente82ef14008082ae34af5d1f0205aa2b5782fc567 (diff)
downloadsamba-3f3cff9127b971c0de50975ed47cbb2d102a0e03.tar.gz
samba-3f3cff9127b971c0de50975ed47cbb2d102a0e03.tar.bz2
samba-3f3cff9127b971c0de50975ed47cbb2d102a0e03.zip
s3:idmap_tdb2: use idmap_rw_new_mapping in idmap_tdb2_new_mapping
Diffstat (limited to 'source3/winbindd/idmap_tdb2.c')
-rw-r--r--source3/winbindd/idmap_tdb2.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index cb295ba003..d30b105ba0 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -263,6 +263,9 @@ static NTSTATUS idmap_tdb2_get_new_id(struct idmap_domain *dom,
IDMAP MAPPING TDB BACKEND
*/
+static NTSTATUS idmap_tdb2_set_mapping(struct idmap_domain *dom,
+ const struct id_map *map);
+
/*
Initialise idmap database.
*/
@@ -447,43 +450,12 @@ done:
static NTSTATUS idmap_tdb2_new_mapping(struct idmap_domain *dom, struct id_map *map)
{
NTSTATUS ret;
+ struct idmap_tdb2_context *ctx;
- if (map == NULL) {
- ret = NT_STATUS_INVALID_PARAMETER;
- goto done;
- }
-
- if ((map->xid.type != ID_TYPE_UID) && (map->xid.type != ID_TYPE_GID)) {
- ret = NT_STATUS_INVALID_PARAMETER;
- goto done;
- }
-
- if (map->sid == NULL) {
- ret = NT_STATUS_INVALID_PARAMETER;
- goto done;
- }
-
- ret = idmap_tdb2_get_new_id(dom, &map->xid);
- if (!NT_STATUS_IS_OK(ret)) {
- DEBUG(3, ("Could not allocate id: %s\n", nt_errstr(ret)));
- goto done;
- }
-
- DEBUG(10, ("Setting mapping: %s <-> %s %lu\n",
- sid_string_dbg(map->sid),
- (map->xid.type == ID_TYPE_UID) ? "UID" : "GID",
- (unsigned long)map->xid.id));
-
- map->status = ID_MAPPED;
+ ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context);
- /* store the mapping */
- ret = idmap_tdb2_set_mapping(dom, map);
- if (!NT_STATUS_IS_OK(ret)) {
- DEBUG(3, ("Could not store the new mapping: %s\n",
- nt_errstr(ret)));
- }
+ ret = idmap_rw_new_mapping(dom, ctx->rw_ops, map);
-done:
return ret;
}