diff options
author | Michael Adam <obnox@samba.org> | 2014-04-11 18:20:01 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-04-25 15:35:09 +0200 |
commit | 79a245808cc61ad3396e246680d9d3ce9d230096 (patch) | |
tree | 69cfa781f9f06c92a1018b765e4553b033319c10 /source3/winbindd/idmap_autorid.c | |
parent | e32f6a278dccb14991ba8103876d9a98a585150d (diff) | |
download | samba-79a245808cc61ad3396e246680d9d3ce9d230096.tar.gz samba-79a245808cc61ad3396e246680d9d3ce9d230096.tar.xz samba-79a245808cc61ad3396e246680d9d3ce9d230096.zip |
autorid: more explicitly and reasonably set map->state in idmap_autorid_sid_to_id_alloc
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/winbindd/idmap_autorid.c')
-rw-r--r-- | source3/winbindd/idmap_autorid.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 0e7d6d676e..8cdc37e20f 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -348,6 +348,8 @@ static NTSTATUS idmap_autorid_sid_to_id_alloc(struct idmap_domain *dom, NTSTATUS ret; int res; + map->status = ID_UNKNOWN; + /* see if we already have a mapping */ ret = idmap_tdb_common_sid_to_unixid(dom, map); @@ -366,6 +368,7 @@ static NTSTATUS idmap_autorid_sid_to_id_alloc(struct idmap_domain *dom, if (dom->read_only) { DEBUG(3, ("Not allocating new mapping for %s, because backend " "is read-only\n", sid_string_dbg(map->sid))); + map->status = ID_UNMAPPED; return NT_STATUS_NONE_MAPPED; } @@ -380,18 +383,17 @@ static NTSTATUS idmap_autorid_sid_to_id_alloc(struct idmap_domain *dom, } ret = idmap_tdb_common_new_mapping(dom, map); - - map->status = (NT_STATUS_IS_OK(ret))?ID_MAPPED:ID_UNMAPPED; - if (!NT_STATUS_IS_OK(ret)) { if (dbwrap_transaction_cancel(ctx->db) != 0) { smb_panic("Cancelling transaction failed"); } + map->status = ID_UNMAPPED; return ret; } res = dbwrap_transaction_commit(ctx->db); if (res == 0) { + map->status = ID_MAPPED; return ret; } |