s3:idmap: remove the remove_mapping method from API and backends
authorMichael Adam <obnox@samba.org>
Thu, 22 Jan 2009 13:44:24 +0000 (14:44 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 31 May 2010 15:00:10 +0000 (17:00 +0200)
Michael

source3/include/idmap.h
source3/winbindd/idmap_adex/idmap_adex.c
source3/winbindd/idmap_tdb.c
source3/winbindd/idmap_tdb2.c

index 672e3731082ed11d45a84e6d5219dd5fe9df8a3c..6bf806c60fdb89bdd680ab1f51750ef83a522eb2 100644 (file)
@@ -51,7 +51,6 @@ struct idmap_methods {
        NTSTATUS (*sids_to_unixids)(struct idmap_domain *dom, struct id_map **ids);
 
        NTSTATUS (*set_mapping)(struct idmap_domain *dom, const struct id_map *map);
-       NTSTATUS (*remove_mapping)(struct idmap_domain *dom, const struct id_map *map);
 
        /* Called to dump backends data */
        /* NOTE: caller must use talloc_free to free maps when done */
index e2fcda83d329571a9708e2ca162a1bc2adf6d350..b6666bf6b0a5e8b9d38f139a312731b2591f26f0 100644 (file)
@@ -262,20 +262,6 @@ static NTSTATUS _idmap_adex_set_mapping(struct
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-/**********************************************************************
- *********************************************************************/
-
-static NTSTATUS _idmap_adex_remove_mapping(struct
-                                              idmap_domain
-                                              *dom, const
-                                              struct
-                                              id_map
-                                              *map)
-{
-       DEBUG(0, ("_idmap_adex_remove_mapping: not implemented\n"));
-       return NT_STATUS_NOT_IMPLEMENTED;
-}
-
 /**********************************************************************
  *********************************************************************/
 
@@ -416,7 +402,6 @@ static struct idmap_methods adex_idmap_methods = {
        .unixids_to_sids  = _idmap_adex_get_sid_from_id,
        .sids_to_unixids  = _idmap_adex_get_id_from_sid,
        .set_mapping      = _idmap_adex_set_mapping,
-       .remove_mapping   = _idmap_adex_remove_mapping,
        .dump_data        = _idmap_adex_dump,
        .close_fn         = _idmap_adex_close
 };
index 8ef57f48c1717fc62a893b3f875e9b08772185d1..b42d3872c43efb022a8d99bc4db6afaefaa7a898 100644 (file)
@@ -988,124 +988,6 @@ done:
        return ret;
 }
 
-/**********************************
- remove a mapping.
-**********************************/
-
-static NTSTATUS idmap_tdb_remove_mapping(struct idmap_domain *dom,
-                                        const struct id_map *map)
-{
-       struct idmap_tdb_context *ctx;
-       NTSTATUS ret;
-       TDB_DATA ksid, kid, data;
-       char *ksidstr, *kidstr;
-       fstring tmp;
-
-       if (!map || !map->sid) {
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       ksidstr = kidstr = NULL;
-       data.dptr = NULL;
-
-       /* TODO: should we filter a remove_mapping using low/high filters ? */
-
-       ctx = talloc_get_type(dom->private_data, struct idmap_tdb_context);
-
-       switch (map->xid.type) {
-
-       case ID_TYPE_UID:
-               kidstr = talloc_asprintf(ctx, "UID %lu",
-                                        (unsigned long)map->xid.id);
-               break;
-
-       case ID_TYPE_GID:
-               kidstr = talloc_asprintf(ctx, "GID %lu",
-                                        (unsigned long)map->xid.id);
-               break;
-
-       default:
-               DEBUG(2, ("INVALID unix ID type: 0x02%x\n", map->xid.type));
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       if (kidstr == NULL) {
-               DEBUG(0, ("ERROR: Out of memory!\n"));
-               ret = NT_STATUS_NO_MEMORY;
-               goto done;
-       }
-
-       if ((ksidstr = talloc_asprintf(
-                    ctx, "%s", sid_to_fstring(tmp, map->sid))) == NULL) {
-               DEBUG(0, ("Out of memory!\n"));
-               ret = NT_STATUS_NO_MEMORY;
-               goto done;
-       }
-
-       DEBUG(10, ("Checking %s <-> %s map\n", ksidstr, kidstr));
-       ksid = string_term_tdb_data(ksidstr);
-       kid = string_term_tdb_data(kidstr);
-
-       if (ctx->db->transaction_start(ctx->db) != 0) {
-               DEBUG(0, ("Failed to start transaction for %s\n",
-                         ksidstr));
-               return NT_STATUS_INTERNAL_DB_ERROR;
-       }
-
-       /* Check if sid is present in database */
-       data = dbwrap_fetch(ctx->db, NULL, ksid);
-       if (!data.dptr) {
-               ctx->db->transaction_cancel(ctx->db);
-               DEBUG(10,("Record %s not found\n", ksidstr));
-               ret = NT_STATUS_NONE_MAPPED;
-               goto done;
-       }
-
-       /* Check if sid is mapped to the specified ID */
-       if ((data.dsize != kid.dsize) ||
-           (memcmp(data.dptr, kid.dptr, data.dsize) != 0)) {
-               ctx->db->transaction_cancel(ctx->db);
-               DEBUG(10,("Specified SID does not map to specified ID\n"));
-               DEBUGADD(10,("Actual mapping is %s -> %s\n", ksidstr,
-                        (const char *)data.dptr));
-               ret = NT_STATUS_NONE_MAPPED;
-               goto done;
-       }
-
-       DEBUG(10, ("Removing %s <-> %s map\n", ksidstr, kidstr));
-
-       /* Delete previous mappings. */
-
-       DEBUG(10, ("Deleting existing mapping %s -> %s\n", ksidstr, kidstr ));
-       ret = dbwrap_delete(ctx->db, ksid);
-       if (!NT_STATUS_IS_OK(ret)) {
-               DEBUG(0,("Warning: Failed to delete %s: %s\n",
-                        ksidstr, nt_errstr(ret)));
-       }
-
-       DEBUG(10,("Deleting existing mapping %s -> %s\n", kidstr, ksidstr ));
-       ret = dbwrap_delete(ctx->db, kid);
-       if (!NT_STATUS_IS_OK(ret)) {
-               DEBUG(0,("Warning: Failed to delete %s: %s\n",
-                        kidstr, nt_errstr(ret)));
-       }
-
-       if (ctx->db->transaction_commit(ctx->db) != 0) {
-               DEBUG(0, ("Failed to commit transaction for (%s -> %s)\n",
-                         ksidstr, kidstr));
-               ret = NT_STATUS_INTERNAL_DB_ERROR;
-               goto done;
-       }
-
-       ret = NT_STATUS_OK;
-
-done:
-       talloc_free(ksidstr);
-       talloc_free(kidstr);
-       talloc_free(data.dptr);
-       return ret;
-}
-
 /**********************************
  Close the idmap tdb instance
 **********************************/
@@ -1221,7 +1103,6 @@ static struct idmap_methods db_methods = {
        .unixids_to_sids = idmap_tdb_unixids_to_sids,
        .sids_to_unixids = idmap_tdb_sids_to_unixids,
        .set_mapping = idmap_tdb_set_mapping,
-       .remove_mapping = idmap_tdb_remove_mapping,
        .dump_data = idmap_tdb_dump_data,
        .close_fn = idmap_tdb_close
 };
index f39969d1f84e295342b57be9e56ac4f83943ed25..3e27209295b781da152d624c8ae5ae91eee7d9f9 100644 (file)
@@ -925,17 +925,6 @@ done:
        return ret;
 }
 
-/*
-  remove a mapping. 
-*/
-static NTSTATUS idmap_tdb2_remove_mapping(struct idmap_domain *dom, const struct id_map *map)
-{
-       /* not supported as it would invalidate the cache tdb on other
-          nodes */
-       DEBUG(0,("idmap_tdb2_remove_mapping not supported\n"));
-       return NT_STATUS_NOT_SUPPORTED;
-}
-
 /*
   Close the idmap tdb instance
 */
@@ -960,7 +949,6 @@ static struct idmap_methods db_methods = {
        .unixids_to_sids = idmap_tdb2_unixids_to_sids,
        .sids_to_unixids = idmap_tdb2_sids_to_unixids,
        .set_mapping     = idmap_tdb2_set_mapping,
-       .remove_mapping  = idmap_tdb2_remove_mapping,
        .dump_data       = idmap_tdb2_dump_data,
        .close_fn        = idmap_tdb2_close
 };