summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-12-10 17:39:03 +0100
committerGünther Deschner <gd@samba.org>2012-12-12 09:42:32 +0100
commitf70c56b74769711e358860655bbb5c2329ad005b (patch)
tree1d2f7f7fc04d8825f60a027791e4a9a89797848d /source3/utils
parent785cc6f3f3b5fe0deae4352dbbb2cfe76257f47d (diff)
downloadsamba-f70c56b74769711e358860655bbb5c2329ad005b.tar.gz
samba-f70c56b74769711e358860655bbb5c2329ad005b.tar.bz2
samba-f70c56b74769711e358860655bbb5c2329ad005b.zip
s3-net: Check return value of string_to_sid().
Found by Coverity. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_rpc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 57d619e28b..2ccc92876b 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -4682,6 +4682,7 @@ static bool get_user_sids(const char *domain, const char *user, struct security_
for (i = 0; i < num_groups; i++) {
gid_t gid = groups[i];
struct dom_sid sid;
+ bool ok;
wbc_status = wbcGidToSid(gid, &wsid);
if (!WBC_ERROR_IS_OK(wbc_status)) {
@@ -4695,7 +4696,12 @@ static bool get_user_sids(const char *domain, const char *user, struct security_
DEBUG(3, (" %s\n", sid_str));
- string_to_sid(&sid, sid_str);
+ ok = string_to_sid(&sid, sid_str);
+ if (!ok) {
+ DEBUG(1, ("Failed to convert string to SID\n"));
+ wbcFreeMemory(groups);
+ return false;
+ }
add_sid_to_token(token, &sid);
}
wbcFreeMemory(groups);