s3:idmap: remove unused method dump_data() from the idmap API
authorMichael Adam <obnox@samba.org>
Thu, 22 Jan 2009 14:52:34 +0000 (15:52 +0100)
committerMichael Adam <obnox@samba.org>
Sat, 14 Aug 2010 00:10:35 +0000 (02:10 +0200)
Michael

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

index 6bf806c60fdb89bdd680ab1f51750ef83a522eb2..e32ade709f015d996bfcb08625a21dc15344f46c 100644 (file)
@@ -52,10 +52,6 @@ struct idmap_methods {
 
        NTSTATUS (*set_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 */
-       NTSTATUS (*dump_data)(struct idmap_domain *dom, struct id_map **maps, int *num_maps);
-
        /* Called when backend is unloaded */
        NTSTATUS (*close_fn)(struct idmap_domain *dom);
 };
index d5c624e23f66a9868a62cf672e47e945ca453ba3..05b517071824f49d5a8a1145ab36fb372512e0d7 100644 (file)
@@ -265,15 +265,6 @@ static NTSTATUS _idmap_adex_set_mapping(struct
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-/**********************************************************************
- *********************************************************************/
-
-static NTSTATUS _idmap_adex_dump(struct idmap_domain
-                                    *dom, struct id_map **maps, int *num_map)
-{
-       return NT_STATUS_NOT_IMPLEMENTED;
-}
-
 /**********************************************************************
  *********************************************************************/
 
@@ -406,7 +397,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,
-       .dump_data        = _idmap_adex_dump,
        .close_fn         = _idmap_adex_close
 };
 static struct nss_info_methods adex_nss_methods = {
index 71a7d0e3a2b1cf0a36c650bc120dde3886ff9e73..994a6bc0772249fa3db9283c42cb2429544b9a16 100644 (file)
@@ -1520,7 +1520,6 @@ static struct idmap_alloc_methods idmap_ldap_alloc_methods = {
        .get_id_hwm = idmap_ldap_get_hwm,
        .set_id_hwm = idmap_ldap_set_hwm,
        .close_fn = idmap_ldap_alloc_close,
-       /* .dump_data = TODO */
 };
 
 static NTSTATUS idmap_alloc_ldap_init(void)
index df6bf51ac5b06c324d8b37326fa2cfa363f32536..6acf1e4573348cea0135dd48484d3a534a37a829 100644 (file)
@@ -1005,106 +1005,12 @@ static NTSTATUS idmap_tdb_close(struct idmap_domain *dom)
        return NT_STATUS_OK;
 }
 
-struct dump_data {
-       TALLOC_CTX *memctx;
-       struct id_map **maps;
-       int *num_maps;
-       NTSTATUS ret;
-};
-
-static int idmap_tdb_dump_one_entry(struct db_record *rec, void *pdata)
-{
-       struct dump_data *data = talloc_get_type(pdata, struct dump_data);
-       struct id_map *maps;
-       int num_maps = *data->num_maps;
-
-       /* ignore any record but the ones with a SID as key */
-       if (strncmp((const char *)rec->key.dptr, "S-", 2) == 0) {
-
-               maps = talloc_realloc(NULL, *data->maps, struct id_map, num_maps+1);
-               if ( ! maps) {
-                       DEBUG(0, ("Out of memory!\n"));
-                       data->ret = NT_STATUS_NO_MEMORY;
-                       return -1;
-               }
-                       *data->maps = maps;
-               maps[num_maps].sid = talloc(maps, struct dom_sid);
-               if ( ! maps[num_maps].sid) {
-                       DEBUG(0, ("Out of memory!\n"));
-                       data->ret = NT_STATUS_NO_MEMORY;
-                       return -1;
-               }
-
-               if (!string_to_sid(maps[num_maps].sid, (const char *)rec->key.dptr)) {
-                       DEBUG(10,("INVALID record %s\n", (const char *)rec->key.dptr));
-                       /* continue even with errors */
-                       return 0;
-               }
-
-               /* Try a UID record. */
-               if (sscanf((const char *)rec->value.dptr, "UID %u", &(maps[num_maps].xid.id)) == 1) {
-                       maps[num_maps].xid.type = ID_TYPE_UID;
-                       maps[num_maps].status = ID_MAPPED;
-                       *data->num_maps = num_maps + 1;
-
-               /* Try a GID record. */
-               } else
-               if (sscanf((const char *)rec->value.dptr, "GID %u", &(maps[num_maps].xid.id)) == 1) {
-                       maps[num_maps].xid.type = ID_TYPE_GID;
-                       maps[num_maps].status = ID_MAPPED;
-                       *data->num_maps = num_maps + 1;
-
-               /* Unknown record type ! */
-               } else {
-                       maps[num_maps].status = ID_UNKNOWN;
-                       DEBUG(2, ("Found INVALID record %s -> %s\n",
-                               (const char *)rec->key.dptr,
-                               (const char *)rec->value.dptr));
-                       /* do not increment num_maps */
-               }
-       }
-
-       return 0;
-}
-
-/**********************************
- Dump all mappings out
-**********************************/
-
-static NTSTATUS idmap_tdb_dump_data(struct idmap_domain *dom, struct id_map **maps, int *num_maps)
-{
-       struct idmap_tdb_context *ctx;
-       struct dump_data *data;
-       NTSTATUS ret = NT_STATUS_OK;
-
-       ctx = talloc_get_type(dom->private_data, struct idmap_tdb_context);
-
-       data = TALLOC_ZERO_P(ctx, struct dump_data);
-       if ( ! data) {
-               DEBUG(0, ("Out of memory!\n"));
-               return NT_STATUS_NO_MEMORY;
-       }
-       data->maps = maps;
-       data->num_maps = num_maps;
-       data->ret = NT_STATUS_OK;
-
-       ctx->db->traverse_read(ctx->db, idmap_tdb_dump_one_entry, data);
-
-       if ( ! NT_STATUS_IS_OK(data->ret)) {
-               ret = data->ret;
-       }
-
-       talloc_free(data);
-       return ret;
-}
-
 static struct idmap_methods db_methods = {
 
        .init = idmap_tdb_db_init,
        .unixids_to_sids = idmap_tdb_unixids_to_sids,
        .sids_to_unixids = idmap_tdb_sids_to_unixids,
        .set_mapping = idmap_tdb_set_mapping,
-       .dump_data = idmap_tdb_dump_data,
        .close_fn = idmap_tdb_close
 };
 
index d6f7460ce2ec7fbed8cc5afc18e6293bd2fed3f9..bd30a253938ac8a1840ea1ae6e5d512f7dee54f5 100644 (file)
@@ -934,22 +934,11 @@ static NTSTATUS idmap_tdb2_close(struct idmap_domain *dom)
        return NT_STATUS_OK;
 }
 
-
-/*
-  Dump all mappings out
-*/
-static NTSTATUS idmap_tdb2_dump_data(struct idmap_domain *dom, struct id_map **maps, int *num_maps)
-{
-       DEBUG(0,("idmap_tdb2_dump_data not supported\n"));
-       return NT_STATUS_NOT_SUPPORTED;
-}
-
 static struct idmap_methods db_methods = {
        .init            = idmap_tdb2_db_init,
        .unixids_to_sids = idmap_tdb2_unixids_to_sids,
        .sids_to_unixids = idmap_tdb2_sids_to_unixids,
        .set_mapping     = idmap_tdb2_set_mapping,
-       .dump_data       = idmap_tdb2_dump_data,
        .close_fn        = idmap_tdb2_close
 };