diff options
author | Michael Adam <obnox@samba.org> | 2010-06-23 11:30:56 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2010-08-14 02:10:46 +0200 |
commit | dac9f73ccd7041334308367a2f712df87173bb76 (patch) | |
tree | a3c4b6376d462a6d57d4f3c011ea787a9c321cb4 | |
parent | 627b9aa4b7ccc87938c864a9be19e23b404d3fa1 (diff) | |
download | samba-dac9f73ccd7041334308367a2f712df87173bb76.tar.gz samba-dac9f73ccd7041334308367a2f712df87173bb76.tar.bz2 samba-dac9f73ccd7041334308367a2f712df87173bb76.zip |
s3:idmap_tdb2: move idmap_tdb2_new_mapping() up. spare a prototype.
-rw-r--r-- | source3/winbindd/idmap_tdb2.c | 106 |
1 files changed, 51 insertions, 55 deletions
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index e80d21c9b8..520e1ebe1c 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -46,10 +46,6 @@ struct idmap_tdb2_context { #define HWM_USER "USER HWM" -static NTSTATUS idmap_tdb2_new_mapping(struct idmap_domain *dom, - struct id_map *map); - - /* * check and initialize high/low water marks in the db */ @@ -427,6 +423,57 @@ done: return ret; } +/** + * Create a new mapping for an unmapped SID, also allocating a new ID. + * This should be run inside a transaction. + * + * TODO: +* Properly integrate this with multi domain idmap config: + * Currently, the allocator is default-config only. + */ +static NTSTATUS idmap_tdb2_new_mapping(struct idmap_domain *dom, struct id_map *map) +{ + NTSTATUS ret; + + 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_tdb2_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; + + /* store the mapping */ + ret = idmap_tdb2_set_mapping(dom, map); + if (!NT_STATUS_IS_OK(ret)) { + DEBUG(3, ("Could not store the new mapping: %s\n", + nt_errstr(ret))); + } + +done: + return ret; +} + /* run a script to perform a mapping @@ -837,57 +884,6 @@ static NTSTATUS idmap_tdb2_sids_to_unixids(struct idmap_domain *dom, struct id_m } -/** - * Create a new mapping for an unmapped SID, also allocating a new ID. - * This should be run inside a transaction. - * - * TODO: -* Properly integrate this with multi domain idmap config: - * Currently, the allocator is default-config only. - */ -static NTSTATUS idmap_tdb2_new_mapping(struct idmap_domain *dom, struct id_map *map) -{ - NTSTATUS ret; - - 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_tdb2_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; - - /* store the mapping */ - ret = idmap_tdb2_set_mapping(dom, map); - if (!NT_STATUS_IS_OK(ret)) { - DEBUG(3, ("Could not store the new mapping: %s\n", - nt_errstr(ret))); - } - -done: - return ret; -} - /* Close the idmap tdb instance */ |