s3:idmap_ldap: use idmap_rw_new_mapping in idmap_ldap_new_mapping
authorMichael Adam <obnox@samba.org>
Wed, 23 Jun 2010 10:02:31 +0000 (12:02 +0200)
committerMichael Adam <obnox@samba.org>
Sat, 14 Aug 2010 00:10:57 +0000 (02:10 +0200)
source3/winbindd/idmap_ldap.c

index 3223e7d223667bd8e587be1ec731364efa51b1c2..51915002b52010f42b2223760dad5d0b6b6eba80 100644 (file)
@@ -770,43 +770,12 @@ done:
 static NTSTATUS idmap_ldap_new_mapping(struct idmap_domain *dom, struct id_map *map)
 {
        NTSTATUS ret;
 static NTSTATUS idmap_ldap_new_mapping(struct idmap_domain *dom, struct id_map *map)
 {
        NTSTATUS ret;
+       struct idmap_ldap_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_ldap_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_ldap_context);
 
 
-       /* store the mapping */
-       ret = idmap_ldap_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;
 }
 
        return ret;
 }