summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-05-16 23:10:04 +0200
committerMichael Adam <obnox@samba.org>2012-05-18 14:44:15 +0200
commit0c3137c2e1d99ac1d61c4ca4dc55b35bad91f31b (patch)
tree72b2c4d4d8bd5a6e5abc202e2f24c9fd168843fd /source3
parentecb24fd459ca6d1c25cc23ffb1e7694bcc280fef (diff)
downloadsamba-0c3137c2e1d99ac1d61c4ca4dc55b35bad91f31b.tar.gz
samba-0c3137c2e1d99ac1d61c4ca4dc55b35bad91f31b.tar.xz
samba-0c3137c2e1d99ac1d61c4ca4dc55b35bad91f31b.zip
s3:idmap_cache: add common exit point to idmap_cache_find_sid2unixid()
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/idmap_cache.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/source3/lib/idmap_cache.c b/source3/lib/idmap_cache.c
index 8bad6e4eab6..0d792d456ca 100644
--- a/source3/lib/idmap_cache.c
+++ b/source3/lib/idmap_cache.c
@@ -37,7 +37,7 @@ bool idmap_cache_find_sid2unixid(const struct dom_sid *sid, struct unixid *id,
{
fstring sidstr;
char *key;
- char *value;
+ char *value = NULL;
char *endptr;
time_t timeout;
bool ret;
@@ -50,8 +50,7 @@ bool idmap_cache_find_sid2unixid(const struct dom_sid *sid, struct unixid *id,
}
ret = gencache_get(key, &value, &timeout);
if (!ret) {
- TALLOC_FREE(key);
- return false;
+ goto done;
}
DEBUG(10, ("Parsing value for key [%s]: value=[%s]\n", key, value));
@@ -76,31 +75,28 @@ bool idmap_cache_find_sid2unixid(const struct dom_sid *sid, struct unixid *id,
break;
case '\0':
- TALLOC_FREE(key);
- SAFE_FREE(value);
DEBUG(0, ("FAILED to parse value for key [%s] "
"(id=[%llu], endptr=[%s]): "
"no type character after colon\n",
key, (unsigned long long)tmp_id.id, endptr));
- return false;
+ ret = false;
+ goto done;
default:
- TALLOC_FREE(key);
- SAFE_FREE(value);
DEBUG(0, ("FAILED to parse value for key [%s] "
"(id=[%llu], endptr=[%s]): "
"illegal type character '%c'\n",
key, (unsigned long long)tmp_id.id, endptr,
endptr[1]));
- return false;
+ ret = false;
+ goto done;
}
if (endptr[2] != '\0') {
- TALLOC_FREE(key);
- SAFE_FREE(value);
DEBUG(0, ("FAILED to parse value for key [%s] "
"(id=[%llu], endptr=[%s]): "
"more than 1 type character after colon\n",
key, (unsigned long long)tmp_id.id, endptr));
- return false;
+ ret = false;
+ goto done;
}
*id = tmp_id;
@@ -110,6 +106,8 @@ bool idmap_cache_find_sid2unixid(const struct dom_sid *sid, struct unixid *id,
"colon missing after id=[%llu]\n",
key, value, (unsigned long long)tmp_id.id));
}
+
+done:
TALLOC_FREE(key);
SAFE_FREE(value);
return ret;