]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Fixed crash for some lookups that didn't specify service name.
authorTimo Sirainen <tss@iki.fi>
Wed, 10 Jul 2013 06:43:19 +0000 (09:43 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 10 Jul 2013 06:43:19 +0000 (09:43 +0300)
src/auth/auth.c

index 292cdbd2cf03f05f74a295c94926cdf93de570be..2c7dca4d1a1dab48c46dee8859e17f9c65bd540e 100644 (file)
@@ -268,15 +268,17 @@ struct auth *auth_find_service(const char *name)
        unsigned int i, count;
 
        a = array_get(&auths, &count);
-       for (i = 1; i < count; i++) {
-               if (strcmp(a[i]->service, name) == 0)
-                       return a[i];
-       }
-       /* not found. maybe we can instead find a !service */
-       for (i = 1; i < count; i++) {
-               if (a[i]->service[0] == '!' &&
-                   strcmp(a[i]->service + 1, name) != 0)
-                       return a[i];
+       if (name != NULL) {
+               for (i = 1; i < count; i++) {
+                       if (strcmp(a[i]->service, name) == 0)
+                               return a[i];
+               }
+               /* not found. maybe we can instead find a !service */
+               for (i = 1; i < count; i++) {
+                       if (a[i]->service[0] == '!' &&
+                           strcmp(a[i]->service + 1, name) != 0)
+                               return a[i];
+               }
        }
        return a[0];
 }