Not every PDU goes through application.c.
OK tb@
-/* $OpenBSD: application.c,v 1.17 2022/12/20 20:04:55 martijn Exp $ */
+/* $OpenBSD: application.c,v 1.18 2023/10/24 13:28:11 martijn Exp $ */
/*
* Copyright (c) 2021 Martijn van Duren <martijn@openbsd.org>
}
}
-static struct appl_context *
+struct appl_context *
appl_context(const char *name, int create)
{
struct appl_context *ctx;
-/* $OpenBSD: application.h,v 1.5 2022/09/01 14:34:17 martijn Exp $ */
+/* $OpenBSD: application.h,v 1.6 2023/10/24 13:28:11 martijn Exp $ */
/*
* Copyright (c) 2021 Martijn van Duren <martijn@openbsd.org>
struct snmp_message;
enum snmp_version;
struct appl_backend;
+struct appl_context;
struct appl_backend_functions {
void (*ab_close)(struct appl_backend *, enum appl_close_reason);
void appl(void);
void appl_init(void);
void appl_shutdown(void);
+struct appl_context *appl_context(const char *, int);
enum appl_error appl_register(const char *, uint32_t, uint8_t, struct ber_oid *,
int, int, uint8_t, uint32_t, struct appl_backend *);
enum appl_error appl_unregister(const char *, uint8_t, struct ber_oid *,
-/* $OpenBSD: application_agentx.c,v 1.7 2023/10/24 12:57:40 martijn Exp $ */
+/* $OpenBSD: application_agentx.c,v 1.8 2023/10/24 13:28:11 martijn Exp $ */
/*
* Copyright (c) 2022 Martijn van Duren <martijn@openbsd.org>
*
error = APPL_ERROR_PARSEERROR;
goto fail;
}
+ if (appl_context(pdu->ap_context.aos_string, 0) == NULL) {
+ log_warnx("%s: %s: Unsupported context",
+ name, ax_pdutype2string(pdu->ap_header.aph_flags));
+ error = APPL_ERROR_UNSUPPORTEDCONTEXT;
+ goto fail;
+ }
}
switch (pdu->ap_header.aph_type) {
case AX_PDU_TYPE_OPEN: