1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

netsamlogon_cache: Use "goto fail", save some lines

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2018-10-13 10:55:00 +02:00 committed by Jeremy Allison
parent 410ec70bb3
commit 9b6166f772

View File

@ -134,15 +134,13 @@ bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3)
int ret; int ret;
if (!info3) { if (!info3) {
TALLOC_FREE(tmp_ctx); goto fail;
return false;
} }
if (!netsamlogon_cache_init()) { if (!netsamlogon_cache_init()) {
DEBUG(0,("netsamlogon_cache_store: cannot open %s for write!\n", DEBUG(0,("netsamlogon_cache_store: cannot open %s for write!\n",
NETSAMLOGON_TDB)); NETSAMLOGON_TDB));
TALLOC_FREE(tmp_ctx); goto fail;
return false;
} }
/* /*
@ -158,8 +156,7 @@ bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3)
if ((ret == -1) && (tdb_error(netsamlogon_tdb) != TDB_ERR_EXISTS)) { if ((ret == -1) && (tdb_error(netsamlogon_tdb) != TDB_ERR_EXISTS)) {
DBG_WARNING("Could not store domain marker for %s: %s\n", DBG_WARNING("Could not store domain marker for %s: %s\n",
keystr, tdb_errorstr(netsamlogon_tdb)); keystr, tdb_errorstr(netsamlogon_tdb));
TALLOC_FREE(tmp_ctx); goto fail;
return false;
} }
sid_compose(&user_sid, info3->base.domain_sid, info3->base.rid); sid_compose(&user_sid, info3->base.domain_sid, info3->base.rid);
@ -207,8 +204,7 @@ bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3)
(ndr_push_flags_fn_t)ndr_push_netsamlogoncache_entry); (ndr_push_flags_fn_t)ndr_push_netsamlogoncache_entry);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
DEBUG(0,("netsamlogon_cache_store: failed to push entry to cache\n")); DEBUG(0,("netsamlogon_cache_store: failed to push entry to cache\n"));
TALLOC_FREE(tmp_ctx); goto fail;
return false;
} }
data.dsize = blob.length; data.dsize = blob.length;
@ -218,8 +214,8 @@ bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3)
result = true; result = true;
} }
fail:
TALLOC_FREE(tmp_ctx); TALLOC_FREE(tmp_ctx);
return result; return result;
} }