Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 307346 Details for
Bug 447839
snmptrapd command line does not accept hostname in transport-address
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
fix
net-snmp-5.1.2-port.patch (text/plain), 3.44 KB, created by
Jan Safranek
on 2008-06-02 11:05:44 UTC
(
hide
)
Description:
fix
Filename:
MIME Type:
Creator:
Jan Safranek
Created:
2008-06-02 11:05:44 UTC
Size:
3.44 KB
patch
obsolete
>447839: snmptrapd command line does not accept hostname in transport-address >205154: 205154: When an invalid port number that exceeds 0x10000(65536) is specified by the snmpd and snmptrapd command, an improper port number is generated. > >Check port specifiers. Inspired by upstream version of snmpUDPDomain.c (but rewritten to >fit to old version of net-snmp). > >diff -up net-snmp-5.1.2/snmplib/snmpUDPDomain.c.port net-snmp-5.1.2/snmplib/snmpUDPDomain.c >--- net-snmp-5.1.2/snmplib/snmpUDPDomain.c.port 2008-06-02 10:36:19.000000000 +0200 >+++ net-snmp-5.1.2/snmplib/snmpUDPDomain.c 2008-06-02 12:00:58.000000000 +0200 >@@ -358,7 +358,9 @@ netsnmp_sockaddr_in(struct sockaddr_in * > const char *inpeername, int remote_port) > { > char *cp = NULL, *peername = NULL; >- >+ char *port = NULL, *host = NULL, *end; >+ long portnr; >+ > if (addr == NULL) { > return 0; > } >@@ -395,35 +397,49 @@ netsnmp_sockaddr_in(struct sockaddr_in * > */ > cp = strchr(peername, ':'); > if (cp != NULL) { >+ /* peername contains hostname and port */ > *cp = '\0'; >- cp++; >- if (atoi(cp) != 0) { >+ port = cp+1; >+ host = peername; >+ } >+ portnr = strtol(peername, &end, 10); >+ if (portnr > 0 && *end == '\0') { >+ /* whole peername is a number, it must be port */ >+ port = peername; >+ host = NULL; >+ } else { >+ /* peername is host only */ >+ host = peername; >+ } >+ >+ if (port) { >+ portnr = strtol(port, &end, 10); >+ if (portnr > 0 && portnr < 0xffff) { >+ DEBUGMSGTL(("netsnmp_sockaddr_in", >+ "port number suffix: %d\n", portnr)); >+ addr->sin_port = htons(portnr); >+ } else { > DEBUGMSGTL(("netsnmp_sockaddr_in", >- "port number suffix :%d\n", atoi(cp))); >- addr->sin_port = htons((u_short)atoi(cp)); >+ "invalid port specifier: %s\n", port)); >+ free(peername); >+ return 0; > } > } >- >- for (cp = peername; *cp && isdigit((int) *cp); cp++); >- if (!*cp && atoi(peername) != 0) { >- /* >- * Okay, it looks like just a port number. >- */ >- DEBUGMSGTL(("netsnmp_sockaddr_in", "totally numeric: %d\n", >- atoi(peername))); >- addr->sin_port = htons((u_short)atoi(peername)); >- } else if (inet_addr(peername) != INADDR_NONE) { >+ if (!host) { >+ DEBUGMSGTL(("netsnmp_sockaddr_in", >+ "no hostname specified, listening on all interfaces\n")); >+ } else if (inet_addr(host) != INADDR_NONE) { > /* > * It looks like an IP address. > */ > DEBUGMSGTL(("netsnmp_sockaddr_in", "IP address\n")); >- addr->sin_addr.s_addr = inet_addr(peername); >+ addr->sin_addr.s_addr = inet_addr(host); > } else { > /* > * Well, it must be a hostname then. > */ > #ifdef HAVE_GETHOSTBYNAME >- struct hostent *hp = gethostbyname(peername); >+ struct hostent *hp = gethostbyname(host); > if (hp == NULL) { > DEBUGMSGTL(("netsnmp_sockaddr_in", > "hostname (couldn't resolve)\n"));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 447839
: 307346