]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Remove list_iterate usage auth.c
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 26 Mar 2010 18:18:19 +0000 (19:18 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 26 Mar 2010 18:18:19 +0000 (19:18 +0100)
normal/auth.c

index 156b84c3744313d70cc8cc68ef675ff9d3f35c3b..6d475cc0a16422983822f0e7602c40a3b672cf83 100644 (file)
@@ -133,25 +133,24 @@ static int
 is_authenticated (const char *userlist)
 {
   const char *superusers;
-
-  auto int hook (grub_list_t item);
-  int hook (grub_list_t item)
-  {
-    const char *name;
-    if (!((struct grub_auth_user *) item)->authenticated)
-      return 0;
-    name = ((struct grub_auth_user *) item)->name;
-
-    return (userlist && grub_strword (userlist, name))
-      || grub_strword (superusers, name);
-  }
+  struct grub_auth_user *user;
 
   superusers = grub_env_get ("superusers");
 
   if (!superusers)
     return 1;
 
-  return grub_list_iterate (GRUB_AS_LIST (users), hook);
+  for (user = users; user; user = user->next)
+    {
+      if (!(user->authenticated))
+       continue;
+
+      if ((userlist && grub_strword (userlist, user->name))
+         || grub_strword (superusers, user->name))
+       return 1;
+    }
+
+  return 0;
 }
 
 static int