summaryrefslogtreecommitdiff
path: root/sbin/routed/output.c
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-01-05 05:23:47 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-01-05 05:23:47 +0000
commitbfd1c6f53c2ea423d1b3f84ff173ad077cf0b25b (patch)
treea9c55a16984ec6f34d690a44e0d408fdad7211f0 /sbin/routed/output.c
parent29983c42f2f1c3b88530ec2d2114271c1cc3388d (diff)
Fix sending/receiving passwords (james@oaktree.co.uk)
Diffstat (limited to 'sbin/routed/output.c')
-rw-r--r--sbin/routed/output.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/sbin/routed/output.c b/sbin/routed/output.c
index 7c079a66f94..a19872cb17c 100644
--- a/sbin/routed/output.c
+++ b/sbin/routed/output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: output.c,v 1.5 1997/07/30 23:28:43 deraadt Exp $ */
+/* $OpenBSD: output.c,v 1.6 2001/01/05 05:23:46 angelos Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@@ -36,7 +36,7 @@
#if !defined(lint)
static char sccsid[] = "@(#)output.c 8.1 (Berkeley) 6/5/93";
#else
-static char rcsid[] = "$OpenBSD: output.c,v 1.5 1997/07/30 23:28:43 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: output.c,v 1.6 2001/01/05 05:23:46 angelos Exp $";
#endif
#include "defs.h"
@@ -204,13 +204,16 @@ output(enum output_type type,
static void
set_auth(struct ws_buf *w)
{
+ struct netauth *nap;
+
if (ws.ifp != 0
&& ws.ifp->int_passwd[0] != '\0'
&& (ws.state & WS_ST_RIP2_SAFE)) {
+ nap = (struct netauth *)(&w->n->n_tag);
w->n->n_family = RIP_AF_AUTH;
- ((struct netauth*)w->n)->a_type = RIP_AUTH_PW;
- bcopy(ws.ifp->int_passwd, ((struct netauth*)w->n)->au.au_pw,
- sizeof(((struct netauth*)w->n)->au.au_pw));
+ nap->a_type = RIP_AUTH_PW;
+ bcopy(ws.ifp->int_passwd, nap->au.au_pw,
+ sizeof(nap->au.au_pw));
w->n++;
}
}
@@ -617,11 +620,6 @@ supply(struct sockaddr_in *dst,
}
ripv12_buf.rip.rip_vers = vers;
- ws.v12.n = ws.v12.base;
- set_auth(&ws.v12);
- ws.v2.n = ws.v2.base;
- set_auth(&ws.v2);
-
switch (type) {
case OUT_BROADCAST:
ws.v2.type = ((ws.ifp != 0
@@ -671,6 +669,11 @@ supply(struct sockaddr_in *dst,
ws.state |= WS_ST_SUB_AG;
}
+ ws.v12.n = ws.v12.base;
+ set_auth(&ws.v12);
+ ws.v2.n = ws.v2.base;
+ set_auth(&ws.v2);
+
if (supplier) {
/* Fake a default route if asked, and if there is not
* a better, real default route.