Few FIXME's removed from auth, few FIXME's added to filter.
This commit is contained in:
parent
bce8a34b12
commit
2981814066
2 changed files with 15 additions and 4 deletions
|
@ -4,6 +4,9 @@
|
||||||
* Copyright 1998 Pavel Machek <pavel@ucw.cz>
|
* Copyright 1998 Pavel Machek <pavel@ucw.cz>
|
||||||
*
|
*
|
||||||
* Can be freely distributed and used under the terms of the GNU GPL.
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
||||||
|
*
|
||||||
|
* FIXME: local namespace for functions
|
||||||
|
* FIXME: switch (or how did we call it in final release?)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -148,6 +151,7 @@ interpret(struct f_inst *what)
|
||||||
case '<': COMPARE(i==-1);
|
case '<': COMPARE(i==-1);
|
||||||
case '<=': COMPARE(i!=1);
|
case '<=': COMPARE(i!=1);
|
||||||
|
|
||||||
|
/* FIXME: Should be able to work with prefixes of limited sizes */
|
||||||
case '~':
|
case '~':
|
||||||
TWOARGS;
|
TWOARGS;
|
||||||
res.type = T_BOOL;
|
res.type = T_BOOL;
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#define P ((struct rip_proto *) p)
|
#define P ((struct rip_proto *) p)
|
||||||
#define P_CF ((struct rip_proto_config *)p->cf)
|
#define P_CF ((struct rip_proto_config *)p->cf)
|
||||||
|
|
||||||
|
#define PACKETLEN(num) (num * sizeof(struct rip_block) + sizeof(struct rip_packet_heading))
|
||||||
|
|
||||||
/* 1 == failed, 0 == ok */
|
/* 1 == failed, 0 == ok */
|
||||||
int
|
int
|
||||||
rip_incoming_authentication( struct proto *p, struct rip_block_auth *block, struct rip_packet *packet, int num )
|
rip_incoming_authentication( struct proto *p, struct rip_block_auth *block, struct rip_packet *packet, int num )
|
||||||
|
@ -39,7 +41,7 @@ rip_incoming_authentication( struct proto *p, struct rip_block_auth *block, stru
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (strncmp( (char *) (&block->packetlen), P_CF->passwords->password, 16)) {
|
if (strncmp( (char *) (&block->packetlen), P_CF->passwords->password, 16)) {
|
||||||
log( L_AUTH, "Passwd authentication failed!\n" );
|
log( L_AUTH "Passwd authentication failed!\n" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -49,13 +51,18 @@ rip_incoming_authentication( struct proto *p, struct rip_block_auth *block, stru
|
||||||
struct password_item *head;
|
struct password_item *head;
|
||||||
struct rip_md5_tail *tail;
|
struct rip_md5_tail *tail;
|
||||||
|
|
||||||
/* FIXME: check that block->packetlen looks valid */
|
if (block->packetlen != PACKETLEN(num)) {
|
||||||
|
log( L_ERR "packetlen in md5 does not match computed value\n" );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
tail = (struct rip_md5_tail *) ((char *) packet + (block->packetlen - sizeof(struct rip_block_auth)));
|
tail = (struct rip_md5_tail *) ((char *) packet + (block->packetlen - sizeof(struct rip_block_auth)));
|
||||||
|
|
||||||
head = P_CF->passwords;
|
head = P_CF->passwords;
|
||||||
while (head) { /* FIXME: should not we check that password is not expired? */
|
while (head) {
|
||||||
/* FIXME: should check serial numbers, somehow */
|
/* FIXME: should check serial numbers, somehow */
|
||||||
|
if ((head->from > now) || (head->to < now))
|
||||||
|
continue;
|
||||||
if (head->id == block->keyid) {
|
if (head->id == block->keyid) {
|
||||||
struct MD5Context ctxt;
|
struct MD5Context ctxt;
|
||||||
char md5sum_packet[16];
|
char md5sum_packet[16];
|
||||||
|
@ -111,7 +118,7 @@ rip_outgoing_authentication( struct proto *p, struct rip_block_auth *block, stru
|
||||||
block->seq = sequence++;
|
block->seq = sequence++;
|
||||||
block->zero0 = 0;
|
block->zero0 = 0;
|
||||||
block->zero1 = 1;
|
block->zero1 = 1;
|
||||||
block->packetlen = 0 /* FIXME */;
|
block->packetlen = PACKETLEN(num);
|
||||||
|
|
||||||
tail = (struct rip_md5_tail *) ((char *) packet + (block->packetlen - sizeof(struct rip_block_auth)));
|
tail = (struct rip_md5_tail *) ((char *) packet + (block->packetlen - sizeof(struct rip_block_auth)));
|
||||||
tail->mustbeFFFF = 0xffff;
|
tail->mustbeFFFF = 0xffff;
|
||||||
|
|
Loading…
Reference in a new issue