diff options
author | Pavel Machek <pavel@ucw.cz> | 1999-05-11 11:53:45 +0200 |
---|---|---|
committer | Pavel Machek <pavel@ucw.cz> | 1999-05-11 11:53:45 +0200 |
commit | 1b16029c12a501752388523ebfe2981e7d7d7ed3 (patch) | |
tree | 7f35d3184049073ac0f6961ab8483defa76cba26 /proto/rip/auth.c | |
parent | f7103dfcfe174d39c8aa10eb100550e3ec213981 (diff) | |
download | bird-1b16029c12a501752388523ebfe2981e7d7d7ed3.tar bird-1b16029c12a501752388523ebfe2981e7d7d7ed3.zip |
Mensi updaty do ripu. Pridana passwd autentikace (netestovano).
Diffstat (limited to 'proto/rip/auth.c')
-rw-r--r-- | proto/rip/auth.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/proto/rip/auth.c b/proto/rip/auth.c new file mode 100644 index 0000000..bffade3 --- /dev/null +++ b/proto/rip/auth.c @@ -0,0 +1,57 @@ +/* + * Rest in pieces - RIP protocol + * + * Copyright (c) 1999 Pavel Machek <pavel@ucw.cz> + * + * Can be freely distributed and used under the terms of the GNU GPL. + */ + +#define LOCAL_DEBUG + +#include <string.h> +#include <stdlib.h> + +#include "nest/bird.h" +#include "nest/iface.h" +#include "nest/protocol.h" +#include "nest/route.h" +#include "lib/socket.h" +#include "lib/resource.h" +#include "lib/lists.h" +#include "lib/timer.h" + +#include "rip.h" + +#define P ((struct rip_proto *) p) +#define P_CF ((struct rip_proto_config *)p->cf) + +int +rip_incoming_authentication( struct proto *p, struct rip_block *block, struct rip_packet *packet, int num ) +{ + DBG( "Incoming authentication: " ); + + switch (block->tag) { /* Authentication type */ + case AT_PLAINTEXT: + DBG( "Plaintext passwd" ); + if (strncmp( (char *) (&block->network), P_CF->password, 16)) { + log( L_AUTH, "Passwd authentication failed!\n" ); + return 1; + } + return 0; + } + + return 0; +} + +void +rip_outgoing_authentication( struct proto *p, struct rip_block *block, struct rip_packet *packet, int num ) +{ + DBG( "Outgoing authentication: " ); + + block->tag = P_CF->authtype; + switch (P_CF->authtype) { + case AT_PLAINTEXT: + strncpy( (char *) (&block->network), P_CF->password, 16); + return; + } +} |