diff options
author | Martijn van Duren <martijn@cvs.openbsd.org> | 2019-09-18 09:59:06 +0000 |
---|---|---|
committer | Martijn van Duren <martijn@cvs.openbsd.org> | 2019-09-18 09:59:06 +0000 |
commit | 9aeb90f251e932069bc1f6ab9c8a1ee925069639 (patch) | |
tree | 37b0808cbdeb78351d19d6a8dc643686425ecd1a | |
parent | 6124587d3ce2e2fe998f4c7c05ad3b1bd0d89474 (diff) |
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.c | 20 |
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) |