This diff adds support for the HP laserjet. The problem with this device
is that it only returns the engineid on probing, but only returns boots
and time after a packet has been send with full auth/enc.
It's not an intrusive diff and allows us to easily walk this device
without resorting to tcpdump for the information and setting it via -e
and -Z, so I think it's worth having it.
diff --git a/usm.c b/usm.c
index ba2020c..f34a6c9 100644
--- a/usm.c
+++ b/usm.c
@@ -142,6 +142,12 @@ usm_doinit(struct snmp_agent *agent)
agent->v3->level = level;
usm->userlen = userlen;
+ /* Ugly hack for HP Laserjet */
+ if (!usm->engineidset || !usm->bootsset || !usm->timeset) {
+ if ((ber = snmp_get(agent, NULL, 0)) == NULL)
+ return -1;
+ ber_free_element(ber);
+ }
return 0;
}
@@ -395,6 +401,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)