diff options
author | Pavel Machek <pavel@ucw.cz> | 1999-05-31 19:12:38 +0200 |
---|---|---|
committer | Pavel Machek <pavel@ucw.cz> | 1999-05-31 19:12:38 +0200 |
commit | 10915c9650d4b63b12140effc68718e2aecd01d3 (patch) | |
tree | 442137a8d3c0d9e2619d3c8dda3b5ae8b26544e5 /proto/rip/auth.c | |
parent | 900d5470ae2cada4d37ed62f8bf2ce64c84349cd (diff) | |
download | bird-10915c9650d4b63b12140effc68718e2aecd01d3.tar bird-10915c9650d4b63b12140effc68718e2aecd01d3.zip |
Modified rip to new password handling in nest. Now it at least compiles.
Diffstat (limited to 'proto/rip/auth.c')
-rw-r--r-- | proto/rip/auth.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/proto/rip/auth.c b/proto/rip/auth.c index bffade3..2477448 100644 --- a/proto/rip/auth.c +++ b/proto/rip/auth.c @@ -25,33 +25,54 @@ #define P ((struct rip_proto *) p) #define P_CF ((struct rip_proto_config *)p->cf) +/* 1 == failed, 0 == ok */ int -rip_incoming_authentication( struct proto *p, struct rip_block *block, struct rip_packet *packet, int num ) +rip_incoming_authentication( struct proto *p, struct rip_block_auth *block, struct rip_packet *packet, int num ) { DBG( "Incoming authentication: " ); - switch (block->tag) { /* Authentication type */ + switch (block->authtype) { /* Authentication type */ case AT_PLAINTEXT: DBG( "Plaintext passwd" ); - if (strncmp( (char *) (&block->network), P_CF->password, 16)) { + if (!P_CF->passwords) { + log( L_AUTH "no passwords set and password authentication came\n" ); + return 1; + } + if (strncmp( (char *) (&block->packetlen), P_CF->passwords->password, 16)) { log( L_AUTH, "Passwd authentication failed!\n" ); return 1; } return 0; + case AT_MD5: + DBG( "md5 password" ); + { + struct password_item *head; + head = P_CF->passwords; + while (head) { + if (head->id == block->keyid) + /* Perform md5 + compare */; + head = head->next; + } + return 1; + } } return 0; } void -rip_outgoing_authentication( struct proto *p, struct rip_block *block, struct rip_packet *packet, int num ) +rip_outgoing_authentication( struct proto *p, struct rip_block_auth *block, struct rip_packet *packet, int num ) { DBG( "Outgoing authentication: " ); - block->tag = P_CF->authtype; + block->authtype = P_CF->authtype; switch (P_CF->authtype) { case AT_PLAINTEXT: - strncpy( (char *) (&block->network), P_CF->password, 16); + if (!P_CF->passwords) { + log( L_ERR "no passwords set and password authentication requested\n" ); + return; + } + strncpy( (char *) (&block->packetlen), P_CF->passwords->password, 16); return; } } |