]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fixed infinite recursion in password_same.
authorMartin Mares <mj@ucw.cz>
Mon, 8 Jan 2001 11:13:01 +0000 (11:13 +0000)
committerMartin Mares <mj@ucw.cz>
Mon, 8 Jan 2001 11:13:01 +0000 (11:13 +0000)
Pavel, please check.

nest/password.c

index c27062708c1a268e938f7ba2d5443f88b93f8be0..ba5d0e61166ca514599f73dfcd3155727f36d3d3 100644 (file)
@@ -54,12 +54,19 @@ password_strncpy(char *to, char *from, int len)
 int
 password_same(struct password_item *old, struct password_item *new)
 {
-  if (old == new)
-    return 1;
-  if ((!old) || (!new))
-    return 0;
-  return ((old->from == new->from) &&
-         (old->to == new->to) &&
-         (old->passive == new->passive) &&
-         password_same(old, new));
+  for(;;)
+    {
+      if (old == new)
+       return 1;
+      if (!old || !new)
+       return 0;
+      if (old->from    != new->from    ||
+         old->to      != new->to      ||
+         old->passive != new->passive ||
+         old->id      != new->id      ||
+         strcmp(old->password, new->password))
+       return 0;
+      old = old->next;
+      new = new->next;
+    }
 }