From 672ab10ee784fcfc3270df3e7665f74ff08f7d40 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 22 Jan 2009 15:52:34 +0100 Subject: [PATCH] s3:idmap: remove unused method dump_data() from the idmap API Michael --- source3/include/idmap.h | 4 - source3/winbindd/idmap_adex/idmap_adex.c | 10 --- source3/winbindd/idmap_ldap.c | 1 - source3/winbindd/idmap_tdb.c | 94 ------------------------ source3/winbindd/idmap_tdb2.c | 11 --- 5 files changed, 120 deletions(-) diff --git a/source3/include/idmap.h b/source3/include/idmap.h index 6bf806c60fd..e32ade709f0 100644 --- a/source3/include/idmap.h +++ b/source3/include/idmap.h @@ -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); }; diff --git a/source3/winbindd/idmap_adex/idmap_adex.c b/source3/winbindd/idmap_adex/idmap_adex.c index d5c624e23f6..05b51707182 100644 --- a/source3/winbindd/idmap_adex/idmap_adex.c +++ b/source3/winbindd/idmap_adex/idmap_adex.c @@ -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 = { diff --git a/source3/winbindd/idmap_ldap.c b/source3/winbindd/idmap_ldap.c index 71a7d0e3a2b..994a6bc0772 100644 --- a/source3/winbindd/idmap_ldap.c +++ b/source3/winbindd/idmap_ldap.c @@ -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) diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index df6bf51ac5b..6acf1e45733 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -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 }; diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index d6f7460ce2e..bd30a253938 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -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 }; -- 2.34.1