s3-idmap: Check return value of string_to_sid().
authorAndreas Schneider <asn@samba.org>
Fri, 14 Dec 2012 15:54:55 +0000 (16:54 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 2 Jan 2013 11:35:36 +0000 (12:35 +0100)
Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
source3/winbindd/idmap_autorid.c

index 621cae9..b7b1689 100644 (file)
@@ -248,6 +248,7 @@ static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg,
        char *keystr;
        struct dom_sid sid;
        NTSTATUS status;
+       bool ok;
 
        /* can this be one of our ids? */
        if (map->xid.id < cfg->minvalue) {
@@ -297,8 +298,12 @@ static NTSTATUS idmap_autorid_id_to_sid(struct autorid_global_config *cfg,
                return idmap_autorid_map_id_to_sid(dom, map);
        }
 
-       string_to_sid(&sid, (const char *)data.dptr);
+       ok = string_to_sid(&sid, (const char *)data.dptr);
        TALLOC_FREE(data.dptr);
+       if (!ok) {
+               map->status = ID_UNKNOWN;
+               return NT_STATUS_OK;
+       }
 
        sid_compose(map->sid, &sid,
                    (map->xid.id - cfg->minvalue -