md5 authentication seems to work.
This commit is contained in:
parent
d3702d57fd
commit
1a509a6310
4 changed files with 5 additions and 5 deletions
|
@ -33,7 +33,7 @@ protocol rip MyRIP_test {
|
||||||
passwords { password "ahoj" from 0 to 10;
|
passwords { password "ahoj" from 0 to 10;
|
||||||
password "nazdar" from 10;
|
password "nazdar" from 10;
|
||||||
}
|
}
|
||||||
authentication plaintext;
|
authentication md5;
|
||||||
}
|
}
|
||||||
|
|
||||||
protocol device {
|
protocol device {
|
||||||
|
|
|
@ -56,7 +56,7 @@ 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;
|
||||||
|
|
||||||
if (block->packetlen != PACKETLEN(num) + 20) {
|
if (block->packetlen != PACKETLEN(num)) {
|
||||||
log( L_ERR "packetlen in md5 does not match computed value\n" );
|
log( L_ERR "packetlen in md5 does not match computed value\n" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ rip_outgoing_authentication( struct proto *p, struct rip_block_auth *block, stru
|
||||||
MD5Init(&ctxt);
|
MD5Init(&ctxt);
|
||||||
MD5Update(&ctxt, (char *) packet, block->packetlen );
|
MD5Update(&ctxt, (char *) packet, block->packetlen );
|
||||||
MD5Final((char *) (&tail->md5), &ctxt);
|
MD5Final((char *) (&tail->md5), &ctxt);
|
||||||
return block->packetlen;
|
return PACKETLEN(num) + block->authlen;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
bug( "Uknown authtype in outgoing authentication?\n" );
|
bug( "Uknown authtype in outgoing authentication?\n" );
|
||||||
|
|
|
@ -352,7 +352,7 @@ rip_process_packet( struct proto *p, struct rip_packet *packet, int num, ip_addr
|
||||||
struct rip_block *block = &packet->block[i];
|
struct rip_block *block = &packet->block[i];
|
||||||
if (block->family == 0xffff) {
|
if (block->family == 0xffff) {
|
||||||
if (i)
|
if (i)
|
||||||
BAD( "Authentication header is not the first" );
|
continue; /* md5 tail has this family */
|
||||||
if (rip_incoming_authentication(p, (void *) block, packet, num))
|
if (rip_incoming_authentication(p, (void *) block, packet, num))
|
||||||
BAD( "Authentication failed" );
|
BAD( "Authentication failed" );
|
||||||
authenticated = 1;
|
authenticated = 1;
|
||||||
|
|
|
@ -28,7 +28,7 @@ struct rip_connection {
|
||||||
int done;
|
int done;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rip_packet_heading {
|
struct rip_packet_heading { /* 4 bytes */
|
||||||
u8 command;
|
u8 command;
|
||||||
#define RIPCMD_REQUEST 1 /* want info */
|
#define RIPCMD_REQUEST 1 /* want info */
|
||||||
#define RIPCMD_RESPONSE 2 /* responding to request */
|
#define RIPCMD_RESPONSE 2 /* responding to request */
|
||||||
|
|
Loading…
Reference in a new issue