From 0368e31221f66d22f0612fca6754934ebcf3ee14 Mon Sep 17 00:00:00 2001 From: Niklas Hallqvist Date: Mon, 21 Dec 1998 01:02:36 +0000 Subject: Last months worth of work on isakmpd, lots done --- sbin/isakmpd/ui.c | 75 ++++++++----------------------------------------------- 1 file changed, 11 insertions(+), 64 deletions(-) (limited to 'sbin/isakmpd/ui.c') diff --git a/sbin/isakmpd/ui.c b/sbin/isakmpd/ui.c index 921e0d9477e..04f044125ea 100644 --- a/sbin/isakmpd/ui.c +++ b/sbin/isakmpd/ui.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ui.c,v 1.3 1998/11/17 11:10:21 niklas Exp $ */ -/* $EOM: ui.c,v 1.20 1998/11/12 13:01:19 niklas Exp $ */ +/* $OpenBSD: ui.c,v 1.4 1998/12/21 01:02:27 niklas Exp $ */ +/* $EOM: ui.c,v 1.26 1998/12/19 09:18:17 niklas Exp $ */ /* * Copyright (c) 1998 Niklas Hallqvist. All rights reserved. @@ -40,9 +40,7 @@ #include #include #include - -#define BUF_SZ 256 - +#include "conf.h" #include "doi.h" #include "exchange.h" #include "isakmp.h" @@ -52,6 +50,8 @@ #include "ui.h" #include "util.h" +#define BUF_SZ 256 + char *ui_fifo = FIFO; int ui_socket; @@ -76,71 +76,18 @@ ui_init () } } -/* Parse the connect command found in CMD. */ +/* New style connect. */ static void ui_connect (char *cmd) { - char trpt[11]; - char addr[81]; - struct transport *transport = 0; - int exchange, doi; - struct sa *isakmp_sa = 0; - u_int8_t cookies[ISAKMP_HDR_COOKIES_LEN]; + char name[81]; - if (sscanf (cmd, "c %10s %80s %d %d", trpt, addr, &exchange, &doi) != 4) + if (sscanf (cmd, "C %80s", name) != 1) { log_print ("ui_connect: command \"%s\" malformed", cmd); return; } - - if (strcasecmp (trpt, "isakmp") == 0) - { - if (hex2raw (addr, cookies, ISAKMP_HDR_COOKIES_LEN) == -1) - { - log_print ("ui_connect: cookiepair \"%s\" malformed", addr); - return; - } - isakmp_sa = sa_lookup (cookies, 0); - if (!isakmp_sa) - { - log_print ("ui_connect: transport \"%s %s\" could not be found", - trpt, addr); - return; - } - - /* XXX Fill in the args argument. */ - exchange_establish_p2 (isakmp_sa, exchange, 0); - } - else - { - transport = transport_create (trpt, addr); - if (!transport) - { - log_print ("ui_connect: transport \"%s %s\" could not be created", - trpt, addr); - return; - } - - /* XXX This validity check seems to be a bit dumb. */ -#if 0 - /* Only ISAKMP exchange types can be given. */ - if (exchange < ISAKMP_EXCH_BASE || exchange >= ISAKMP_EXCH_FUTURE_MIN) - { - log_print ("exchange %d is not valid", exchange); - return; - } -#endif - - /* Only valid DOIs can be given. XXX Uninteresting for phase 2. */ - if (!doi_lookup (doi)) - { - log_print ("DOI %d is not valid", doi); - return; - } - - /* XXX Fill in the args argument. */ - exchange_establish_p1 (transport, exchange, doi, 0); - } + exchange_establish (name, 0, 0); } static void @@ -185,7 +132,7 @@ ui_debug (char *cmd) { int cls, level; - if (sscanf (cmd, "d %d %d", &cls, &level) != 2) + if (sscanf (cmd, "D %d %d", &cls, &level) != 2) { log_print ("ui_debug: command \"%s\" malformed", cmd); return; @@ -194,7 +141,7 @@ ui_debug (char *cmd) } /* Report SAs and ongoing exchanges. */ -static void +void ui_report (char *cmd) { sa_report (); -- cgit v1.2.3