-# $OpenBSD: Makefile,v 1.17 2020/06/30 17:11:49 martijn Exp $
+# $OpenBSD: Makefile,v 1.18 2022/01/19 11:00:56 martijn Exp $
PROG= snmpd
MAN= snmpd.8 snmpd.conf.5
-SRCS= parse.y log.c snmpe.c \
+SRCS= parse.y log.c snmpe.c application.c application_legacy.c \
mps.c trap.c mib.c smi.c kroute.c snmpd.c timer.c \
pf.c proc.c usm.c traphandler.c util.c
-/* $OpenBSD: snmpe.c,v 1.81 2022/01/19 10:36:35 martijn Exp $ */
+/* $OpenBSD: snmpe.c,v 1.82 2022/01/19 11:00:56 martijn Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
#include <unistd.h>
#include <pwd.h>
+#include "application.h"
#include "snmpd.h"
#include "snmpe.h"
#include "mib.h"
kr_init();
timer_init();
usm_generate_keys();
+ appl_init();
/* listen for incoming SNMP UDP/TCP messages */
TAILQ_FOREACH(h, &env->sc_addresses, entry) {
close(h->fd);
}
kr_shutdown();
+ appl_shutdown();
}
int
for (a = msg->sm_varbind; a != NULL; a = a->be_next) {
if (ober_scanf_elements(a, "{oS$}", NULL) == -1)
goto parsefail;
- }
+ }
msg->sm_request = req;
msg->sm_error = errval;
struct ber_oid o;
int i;
+ appl_processpdu(msg, msg->sm_ctxname, msg->sm_version, msg->sm_pdu);
+ return 0;
+ /*
+ * Leave code here for now so it's easier to switch back in case of
+ * issues.
+ */
+
msg->sm_errstr = "invalid varbind element";
varbind = msg->sm_varbind;
/* XXX Do proper error handling */
(void) snmpe_parsevarbinds(msg);
+ return;
+ /*
+ * Leave code here for now so it's easier to switch back in case of
+ * issues.
+ */
/* respond directly */
msg->sm_pdutype = SNMP_C_RESPONSE;
snmpe_response(msg);