Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
labs
BIRD Internet Routing Daemon
Commits
10915c96
Commit
10915c96
authored
May 31, 1999
by
Pavel Machek
Browse files
Modified rip to new password handling in nest. Now it at least compiles.
parent
900d5470
Changes
2
Hide whitespace changes
Inline
Side-by-side
proto/rip/auth.c
View file @
10915c96
...
...
@@ -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
;
}
}
proto/rip/rip.h
View file @
10915c96
...
...
@@ -42,6 +42,17 @@ struct rip_block {
u32
metric
;
};
struct
rip_block_auth
{
u16
mustbeFFFF
;
u16
authtype
;
u16
packetlen
;
u8
keyid
;
u8
authlen
;
u32
seq
;
u32
zero0
;
u32
zero1
;
};
struct
rip_entry
{
struct
fib_node
n
;
...
...
@@ -97,7 +108,7 @@ struct rip_proto_config {
int
authtype
;
#define AT_NONE 0
#define AT_PLAINTEXT 2
#define AT_MD5
1234
/* FIXME: get a real number for this one */
#define AT_MD5
3
};
struct
rip_proto
{
...
...
@@ -120,5 +131,5 @@ struct rip_interface *new_iface(struct proto *p, struct iface *new, unsigned lon
/* Authentication functions */
int
rip_incoming_authentication
(
struct
proto
*
p
,
struct
rip_block
*
block
,
struct
rip_packet
*
packet
,
int
num
);
void
rip_outgoing_authentication
(
struct
proto
*
p
,
struct
rip_block
*
block
,
struct
rip_packet
*
packet
,
int
num
);
int
rip_incoming_authentication
(
struct
proto
*
p
,
struct
rip_block
_auth
*
block
,
struct
rip_packet
*
packet
,
int
num
);
void
rip_outgoing_authentication
(
struct
proto
*
p
,
struct
rip_block
_auth
*
block
,
struct
rip_packet
*
packet
,
int
num
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment