libcli/security: fix sid_type_lookup().
authorGünther Deschner <gd@samba.org>
Mon, 10 Jan 2011 10:57:18 +0000 (11:57 +0100)
committerGünther Deschner <gd@samba.org>
Mon, 10 Jan 2011 11:47:00 +0000 (12:47 +0100)
It *always* returned "SID *TYPE* is INVALID".

Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Mon Jan 10 12:47:00 CET 2011 on sn-devel-104

libcli/security/util_sid.c

index 52d48ce431585a218a2ef146ccb354d867376db1..3d14536eae6cc2aa72454d6569862c8de43ad110 100644 (file)
@@ -126,20 +126,18 @@ static const struct {
        {SID_NAME_DELETED, "Deleted Account"},
        {SID_NAME_INVALID, "Invalid Account"},
        {SID_NAME_UNKNOWN, "UNKNOWN"},
        {SID_NAME_DELETED, "Deleted Account"},
        {SID_NAME_INVALID, "Invalid Account"},
        {SID_NAME_UNKNOWN, "UNKNOWN"},
-       {SID_NAME_COMPUTER, "Computer"},
-
-       {(enum lsa_SidType)0, NULL}
+       {SID_NAME_COMPUTER, "Computer"}
 };
 
 const char *sid_type_lookup(uint32_t sid_type)
 {
 };
 
 const char *sid_type_lookup(uint32_t sid_type)
 {
-       int i = 0;
+       int i;
 
        /* Look through list */
 
        /* Look through list */
-       while(sid_name_type[i].sid_type != 0) {
-               if (sid_name_type[i].sid_type == sid_type)
+       for (i=0; i < ARRAY_SIZE(sid_name_type); i++) {
+               if (sid_name_type[i].sid_type == sid_type) {
                        return sid_name_type[i].string;
                        return sid_name_type[i].string;
-               i++;
+               }
        }
 
        /* Default return */
        }
 
        /* Default return */