summaryrefslogtreecommitdiff
path: root/source3/lib/idmap_cache.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-05-18 11:37:18 +0200
committerMichael Adam <obnox@samba.org>2012-05-18 16:34:27 +0200
commit7db637483b89817e14fc1fdb56ecc4ee07aaa33d (patch)
treebfbd6aad4d2a6622c6bbcb069825e369c72210ff /source3/lib/idmap_cache.c
parent0c3137c2e1d99ac1d61c4ca4dc55b35bad91f31b (diff)
downloadsamba-7db637483b89817e14fc1fdb56ecc4ee07aaa33d.tar.gz
samba-7db637483b89817e14fc1fdb56ecc4ee07aaa33d.tar.bz2
samba-7db637483b89817e14fc1fdb56ecc4ee07aaa33d.zip
s3:idmap_cache: improve checks for format of value string in idmap_cache_find_sid2unixid()
Autobuild-User: Michael Adam <obnox@samba.org> Autobuild-Date: Fri May 18 16:34:27 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3/lib/idmap_cache.c')
-rw-r--r--source3/lib/idmap_cache.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source3/lib/idmap_cache.c b/source3/lib/idmap_cache.c
index 0d792d456c..011a017c48 100644
--- a/source3/lib/idmap_cache.c
+++ b/source3/lib/idmap_cache.c
@@ -55,7 +55,22 @@ bool idmap_cache_find_sid2unixid(const struct dom_sid *sid, struct unixid *id,
DEBUG(10, ("Parsing value for key [%s]: value=[%s]\n", key, value));
+ if (value[0] == '\0') {
+ DEBUG(0, ("Failed to parse value for key [%s]: "
+ "value is empty\n", key));
+ ret = false;
+ goto done;
+ }
+
tmp_id.id = strtol(value, &endptr, 10);
+
+ if ((value == endptr) && (tmp_id.id == 0)) {
+ DEBUG(0, ("Failed to parse value for key [%s]: value[%s] does "
+ "not start with a number\n", key, value));
+ ret = false;
+ goto done;
+ }
+
DEBUG(10, ("Parsing value for key [%s]: id=[%llu], endptr=[%s]\n",
key, (unsigned long long)tmp_id.id, endptr));