summaryrefslogtreecommitdiffstats
path: root/nest/password.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2008-11-08 17:24:23 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2008-11-08 17:24:23 +0100
commitb21f68b4cd4794c84e5f0eb2c34204c87ccf0e9a (patch)
tree2bbf675877333084f912c5b18eae34eb247851b3 /nest/password.c
parent08cca48a149bd6d5210659daf220b6dae87a43b3 (diff)
downloadbird-b21f68b4cd4794c84e5f0eb2c34204c87ccf0e9a.tar
bird-b21f68b4cd4794c84e5f0eb2c34204c87ccf0e9a.zip
Fix bugs in OSPF MD5 authentication. First bug is that default
values for MD5 password ID changed during reconfigure, Second bug is that BIRD chooses password in first-fit manner, but RFC says that it should use the one with the latest generate-from. It also modifies the syntax for multiple passwords. Now it is possible to just add more 'password' statements to the interface section and it is not needed to use 'passwords' section. Old syntax can be used too.
Diffstat (limited to 'nest/password.c')
-rw-r--r--nest/password.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/nest/password.c b/nest/password.c
index 80c4c7b..179939e 100644
--- a/nest/password.c
+++ b/nest/password.c
@@ -14,19 +14,26 @@
struct password_item *last_password_item = NULL;
struct password_item *
-password_find(list *l)
+password_find(list *l, int first_fit)
{
struct password_item *pi;
+ struct password_item *pf = NULL;
if (l)
{
WALK_LIST(pi, *l)
{
if ((pi->genfrom < now_real) && (pi->gento > now_real))
- return pi;
+ {
+ if (first_fit)
+ return pi;
+
+ if (!pf || pf->genfrom < pi->genfrom)
+ pf = pi;
+ }
}
}
- return NULL;
+ return pf;
}
void password_cpy(char *dst, char *src, int size)