[PATCH 7/9] SNMP-TARGET-MIB: Fix the debug code that shows tAddress

Bart Van Assche <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
Since tAddress contains binary data, show it in hex instead of as an
ASCII string.
---
 agent/mibgroup/target/snmpTargetAddrEntry_data.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/agent/mibgroup/target/snmpTargetAddrEntry_data.c b/agent/mibgroup/target/snmpTargetAddrEntry_data.c
index 326fb85400d9..5e38868c1cbe 100644
--- a/agent/mibgroup/target/snmpTargetAddrEntry_data.c
+++ b/agent/mibgroup/target/snmpTargetAddrEntry_data.c
@@ -643,9 +643,11 @@ snmpd_parse_config_targetAddr(const char *token, char *char_ptr)
         bptr += snprintf(bptr, buff + sizeof(buff) - bptr,
                          ".%d", (int) newEntry->tDomain[i]);
     }
+    for (i = 0; i < newEntry->tAddressLen; i++)
+        bptr += snprintf(bptr, buff + sizeof(buff) - bptr, " %02x",
+                         ((u_char *)newEntry->tAddress)[i]);
     bptr += snprintf(bptr, buff + sizeof(buff) - bptr,
-                     " %s %d %d %s %s %d %d\n",
-                     newEntry->tAddress, newEntry->timeout,
+                     " %d %d %s %s %d %d\n", newEntry->timeout,
                      newEntry->retryCount, newEntry->tagListData,
                      newEntry->paramsData, newEntry->storageType,
                      newEntry->rowStatus);
-- 
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.