summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormartijn <martijn@openbsd.org>2019-09-18 09:59:05 +0000
committermartijn <martijn@openbsd.org>2019-09-18 09:59:05 +0000
commit8e8a231d271018550e2931b319b95b97d1b5eff3 (patch)
tree4a9935042e45a154f39a67afd1fb07fdb006c2e9
parentAdd support for SNMPv3/USM privacy. (diff)
downloadwireguard-openbsd-8e8a231d271018550e2931b319b95b97d1b5eff3.tar.xz
wireguard-openbsd-8e8a231d271018550e2931b319b95b97d1b5eff3.zip
Add support for some HP LaserJet systems. These systems don't return the
boots and time on probing, but only return those on a fully encrypted packet. Add a minor workaround for these systems. Feedback and OK jmatthew@
-rw-r--r--usr.bin/snmp/usm.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.bin/snmp/usm.c b/usr.bin/snmp/usm.c
index 7da977c9b25..357d1a127aa 100644
--- a/usr.bin/snmp/usm.c
+++ b/usr.bin/snmp/usm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usm.c,v 1.3 2019/09/18 09:54:36 martijn Exp $ */
+/* $OpenBSD: usm.c,v 1.4 2019/09/18 09:59:05 martijn Exp $ */
/*
* Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org>
@@ -142,6 +142,16 @@ usm_doinit(struct snmp_agent *agent)
agent->v3->level = level;
usm->userlen = userlen;
+ /*
+ * Ugly hack for HP Laserjet:
+ * This device returns the engineid on probing, but only returns boots
+ * and time after a packet has been sent with full auth/enc.
+ */
+ if (!usm->engineidset || !usm->bootsset || !usm->timeset) {
+ if ((ber = snmp_get(agent, NULL, 0)) == NULL)
+ return -1;
+ ber_free_element(ber);
+ }
return 0;
}
@@ -398,6 +408,14 @@ usm_parseparams(struct snmp_agent *agent, char *packet, size_t packetlen,
goto fail;
}
}
+ /*
+ * Don't assume these are set if both are zero.
+ * Ugly hack for HP Laserjet
+ */
+ if (usm->boots == 0 && usm->time == 0) {
+ usm->bootsset = 0;
+ usm->timeset = 0;
+ }
if (userlen != usm->userlen ||
memcmp(user, usm->user, userlen) != 0)