diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/idmap.h | 1 | ||||
-rw-r--r-- | source3/winbindd/idmap_adex/idmap_adex.c | 15 | ||||
-rw-r--r-- | source3/winbindd/idmap_tdb.c | 119 | ||||
-rw-r--r-- | source3/winbindd/idmap_tdb2.c | 12 |
4 files changed, 0 insertions, 147 deletions
diff --git a/source3/include/idmap.h b/source3/include/idmap.h index 672e373108..6bf806c60f 100644 --- a/source3/include/idmap.h +++ b/source3/include/idmap.h @@ -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 */ diff --git a/source3/winbindd/idmap_adex/idmap_adex.c b/source3/winbindd/idmap_adex/idmap_adex.c index ea6d688b72..d5c624e23f 100644 --- a/source3/winbindd/idmap_adex/idmap_adex.c +++ b/source3/winbindd/idmap_adex/idmap_adex.c @@ -268,20 +268,6 @@ static NTSTATUS _idmap_adex_set_mapping(struct /********************************************************************** *********************************************************************/ -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; -} - -/********************************************************************** - *********************************************************************/ - static NTSTATUS _idmap_adex_dump(struct idmap_domain *dom, struct id_map **maps, int *num_map) { @@ -420,7 +406,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 }; diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index 27d73d6ab5..df6bf51ac5 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -990,124 +990,6 @@ done: } /********************************** - 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 **********************************/ @@ -1222,7 +1104,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 }; diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index 409ac6debe..d6f7460ce2 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -926,17 +926,6 @@ done: } /* - 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 */ static NTSTATUS idmap_tdb2_close(struct idmap_domain *dom) @@ -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 }; |