From 21a0428a6ebf6968b6f6a37d0fa16b442eed2de4 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 1 Feb 2020 18:40:01 +0100 Subject: [PATCH] snmp: additional fix around NetSNMP 5.8+ and function pointers --- src/daemon/agent_priv.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/daemon/agent_priv.c b/src/daemon/agent_priv.c index c317e6e6..59054ccc 100644 --- a/src/daemon/agent_priv.c +++ b/src/daemon/agent_priv.c @@ -34,16 +34,21 @@ #include #ifdef ASN_PRIV_STOP -#define CONST58 const +/* NetSNMP 5.8+ */ +#define F_SEND_SIGNATURE netsnmp_transport *t, const void *buf, int size, void **opaque, int *olength +#define F_FMTADDR_SIGNATURE netsnmp_transport *t, const void *data, int len +#define F_FROM_OSTRING_SIGNATURE const void* o, size_t o_len, int local #else -#define CONST58 +#define F_SEND_SIGNATURE netsnmp_transport *t, void *buf, int size, void **opaque, int *olength +#define F_FMTADDR_SIGNATURE netsnmp_transport *t, void *data, int len +#define F_FROM_OSTRING_SIGNATURE const u_char* o, size_t o_len, int local #endif static oid netsnmp_unix[] = { TRANSPORT_DOMAIN_LOCAL }; static netsnmp_tdomain unixDomain; static char * -agent_priv_unix_fmtaddr(netsnmp_transport *t, CONST58 void *data, int len) +agent_priv_unix_fmtaddr(F_FMTADDR_SIGNATURE) { /* We don't bother to implement the full function */ return strdup("Local Unix socket with privilege separation: unknown"); @@ -86,8 +91,7 @@ recv_error: #define AGENT_WRITE_TIMEOUT 2000 static int -agent_priv_unix_send(netsnmp_transport *t, CONST58 void *buf, int size, - void **opaque, int *olength) +agent_priv_unix_send(F_SEND_SIGNATURE) { int rc = -1; @@ -223,7 +227,7 @@ agent_priv_unix_create_tstring(const char *string, int local, const char *defaul } static netsnmp_transport * -agent_priv_unix_create_ostring(const void* o, size_t o_len, int local) +agent_priv_unix_create_ostring(F_FROM_OSTRING_SIGNATURE) { return agent_priv_unix_transport((char *)o, o_len, local); } -- 2.39.5