diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-12-07 09:50:52 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-12-07 09:50:52 +0000 |
commit | 31554520542dd5f92ce73cde2156304054423b5b (patch) | |
tree | dd1509803e5d3d2421be54c4f1225495648ddcd2 /usr.sbin/snmpd/snmpe.c | |
parent | f88bca2dd82801eebb72c91e1370c419b83d5b4f (diff) |
add a new 'd' format to ber_printf_elements to pass ints instead of
long longs; you have to pass the right type with vargs. this finally
fixes the previous problem on i386.
discussed with claudio
Diffstat (limited to 'usr.sbin/snmpd/snmpe.c')
-rw-r--r-- | usr.sbin/snmpd/snmpe.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c index 0b5d7aabba9..c11fb327a41 100644 --- a/usr.sbin/snmpd/snmpe.c +++ b/usr.sbin/snmpd/snmpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpe.c,v 1.2 2007/12/07 09:18:00 reyk Exp $ */ +/* $OpenBSD: snmpe.c,v 1.3 2007/12/07 09:50:51 reyk Exp $ */ /* * Copyright (c) 2007 Reyk Floeter <reyk@vantronix.net> @@ -607,7 +607,7 @@ snmpe_parse(struct sockaddr_storage *ss, msg->sm_error = errval; msg->sm_errorindex = erridx; - log_debug("snmpe_parse: %s: SNMPv%d '%s' context %d request %d", + log_debug("snmpe_parse: %s: SNMPv%d '%s' context %d request %lld", log_host(ss, host, sizeof(host)), msg->sm_version + 1, msg->sm_community, msg->sm_context, msg->sm_request); @@ -725,7 +725,7 @@ snmpe_recvmsg(int fd, short sig, void *arg) socklen_t slen; ssize_t len; struct ber ber; - struct ber_element *req = NULL, *resp = NULL, *b, *c; + struct ber_element *req = NULL, *resp = NULL; struct snmp_message msg; slen = sizeof(ss); @@ -777,23 +777,11 @@ snmpe_recvmsg(int fd, short sig, void *arg) /* Create new SNMP packet */ resp = ber_add_sequence(NULL); -#ifdef notyet - ber_printf_elements(resp, "is{tiii{e}}.", + ber_printf_elements(resp, "ds{tiii{e}}.", msg.sm_version, msg.sm_community, BER_CLASS_CONTEXT, SNMP_T_GETRESP, msg.sm_request, msg.sm_error, msg.sm_errorindex, msg.sm_varbindresp); -#else - b = ber_add_integer(resp, msg.sm_version); - b = ber_add_string(b, msg.sm_community); - c = b = ber_add_sequence(b); - ber_set_header(b, BER_CLASS_CONTEXT, SNMP_T_GETRESP); - c = ber_add_integer(c, msg.sm_request); - c = ber_add_integer(c, msg.sm_error); - c = ber_add_integer(c, msg.sm_errorindex); - c = ber_add_sequence(c); - ber_link_elements(c, msg.sm_varbindresp); -#endif #ifdef DEBUG snmpe_debug_elements(resp); |