diff options
author | Sylvio Cesar Teixeira <sylvio@FreeBSD.org> | 2011-07-28 12:41:50 +0000 |
---|---|---|
committer | Sylvio Cesar Teixeira <sylvio@FreeBSD.org> | 2011-07-28 12:41:50 +0000 |
commit | a63158257c7d451ba40deeadea026a99862851d0 (patch) | |
tree | 8ee50fd0330fef71ebe2ec414e15bc9492ac61a4 /net-mgmt | |
parent | 89937b0618fda1cfb679bd53afd14a70bc8dfec3 (diff) | |
download | ports-a63158257c7d451ba40deeadea026a99862851d0.tar.gz ports-a63158257c7d451ba40deeadea026a99862851d0.zip |
Notes
Diffstat (limited to 'net-mgmt')
-rw-r--r-- | net-mgmt/net-snmp/Makefile | 1 | ||||
-rw-r--r-- | net-mgmt/net-snmp/files/patch-agent_read_config.c | 14 | ||||
-rw-r--r-- | net-mgmt/net-snmp/files/patch-auto_nlist.c | 32 | ||||
-rw-r--r-- | net-mgmt/net-snmp/files/patch-parse.c | 169 | ||||
-rw-r--r-- | net-mgmt/net-snmp/files/patch-snmp_vars.c | 12 |
5 files changed, 228 insertions, 0 deletions
diff --git a/net-mgmt/net-snmp/Makefile b/net-mgmt/net-snmp/Makefile index ccb51d961e14..8006433514da 100644 --- a/net-mgmt/net-snmp/Makefile +++ b/net-mgmt/net-snmp/Makefile @@ -7,6 +7,7 @@ PORTNAME= snmp PORTVERSION= 5.7 +PORTREVISION= 1 CATEGORIES= net-mgmt ipv6 MASTER_SITES= SF/net-${PORTNAME}/net-${PORTNAME}/${PORTVERSION} PKGNAMEPREFIX= net- diff --git a/net-mgmt/net-snmp/files/patch-agent_read_config.c b/net-mgmt/net-snmp/files/patch-agent_read_config.c new file mode 100644 index 000000000000..aec3ea4eaab5 --- /dev/null +++ b/net-mgmt/net-snmp/files/patch-agent_read_config.c @@ -0,0 +1,14 @@ +--- ./agent/agent_read_config.c.orig 2011-07-07 15:30:36.000000000 -0700 ++++ agent/agent_read_config.c 2011-07-07 15:35:57.000000000 -0700 +@@ -5,7 +5,11 @@ + #include <net-snmp/net-snmp-config.h> + #include <net-snmp/net-snmp-features.h> + ++#if HAVE_SYS_PARAM_H ++#include <sys/param.h> ++#else + #include <sys/types.h> ++#endif + #if HAVE_STDLIB_H + #include <stdlib.h> + #endif diff --git a/net-mgmt/net-snmp/files/patch-auto_nlist.c b/net-mgmt/net-snmp/files/patch-auto_nlist.c new file mode 100644 index 000000000000..d9795adff8b6 --- /dev/null +++ b/net-mgmt/net-snmp/files/patch-auto_nlist.c @@ -0,0 +1,32 @@ +--- ./agent/auto_nlist.c.orig 2011-07-07 15:38:44.000000000 -0700 ++++ agent/auto_nlist.c 2011-07-07 15:39:37.000000000 -0700 +@@ -66,15 +66,26 @@ + strcpy(it->nl[0].n_name, string); + it->nl[0].n_name[strlen(string)+1] = '\0'; + #else +- sprintf(it->nl[0].n_name, "_%s", string); ++ char *n_name; ++ ++ n_name = malloc(strlen(string) + 2); ++ if (n_name == NULL) { ++ snmp_log(LOG_ERR, "nlist err: failed to allocate memory"); ++ return (-1); ++ } ++ snprintf(n_name, strlen(string) + 2, "_%s", string); ++ it->nl[0].n_name = (const char*)n_name; + #endif + it->nl[1].n_name = 0; + init_nlist(it->nl); + #if !(defined(aix4) || defined(aix5) || defined(aix6) || defined(aix7) || \ + defined(netbsd1) || defined(dragonfly)) + if (it->nl[0].n_type == 0) { +- strcpy(it->nl[0].n_name, string); +- it->nl[0].n_name[strlen(string)+1] = '\0'; ++ it->nl[0].n_name = (const char*)strdup(string); ++ if (it->nl[0].n_name == (const char*)NULL) { ++ snmp_log(LOG_ERR, "nlist err: failed to allocate memory"); ++ return (-1); ++ } + init_nlist(it->nl); + } + #endif diff --git a/net-mgmt/net-snmp/files/patch-parse.c b/net-mgmt/net-snmp/files/patch-parse.c new file mode 100644 index 000000000000..77a39dca41fe --- /dev/null +++ b/net-mgmt/net-snmp/files/patch-parse.c @@ -0,0 +1,169 @@ +--- snmplib/parse.c ++++ snmplib/parse.c +@@ -3902,8 +3902,13 @@ read_module_internal(const char *name) + return MODULE_ALREADY_LOADED; + } + if ((fp = fopen(mp->file, "r")) == NULL) { ++ int rval; ++ if (errno == ENOTDIR || errno == ENOENT) ++ rval = MODULE_NOT_FOUND; ++ else ++ rval = MODULE_LOAD_FAILED; + snmp_log_perror(mp->file); +- return MODULE_LOAD_FAILED; ++ return rval; + } + mp->no_imports = 0; /* Note that we've read the file */ + File = mp->file; +@@ -3917,10 +3922,7 @@ read_module_internal(const char *name) + File = oldFile; + mibLine = oldLine; + current_module = oldModule; +- if (np != NULL) +- return MODULE_LOADED_OK; +- else if (gMibError == MODULE_SYNTAX_ERROR) +- return MODULE_SYNTAX_ERROR; ++ return gMibError ? gMibError : MODULE_LOADED_OK; + } + + return MODULE_NOT_FOUND; +@@ -4339,6 +4341,7 @@ parse(FILE * fp, struct node *root) + case END: + if (state != IN_MIB) { + print_error("Error, END before start of MIB", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } else { + struct module *mp; +@@ -4403,6 +4406,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_macro(fp, name); + if (nnp == NULL) { + print_error("Bad parse of MACRO", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + /* + * return NULL; + */ +@@ -4427,6 +4431,7 @@ parse(FILE * fp, struct node *root) + type = get_token(fp, token, MAXTOKEN); + if (type == ENDOFFILE) { + print_error("Expected \"}\"", token, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + type = get_token(fp, token, MAXTOKEN); +@@ -4436,6 +4441,7 @@ parse(FILE * fp, struct node *root) + case DEFINITIONS: + if (state != BETWEEN_MIBS) { + print_error("Error, nested MIBS", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + state = IN_MIB; +@@ -4460,6 +4466,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_objecttype(fp, name); + if (nnp == NULL) { + print_error("Bad parse of OBJECT-TYPE", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + break; +@@ -4467,6 +4474,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_objectgroup(fp, name, OBJECTS, &objects); + if (nnp == NULL) { + print_error("Bad parse of OBJECT-GROUP", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + break; +@@ -4474,6 +4482,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_objectgroup(fp, name, NOTIFICATIONS, ¬ifs); + if (nnp == NULL) { + print_error("Bad parse of NOTIFICATION-GROUP", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + break; +@@ -4481,6 +4490,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_trapDefinition(fp, name); + if (nnp == NULL) { + print_error("Bad parse of TRAP-TYPE", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + break; +@@ -4488,6 +4498,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_notificationDefinition(fp, name); + if (nnp == NULL) { + print_error("Bad parse of NOTIFICATION-TYPE", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + break; +@@ -4495,6 +4506,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_compliance(fp, name); + if (nnp == NULL) { + print_error("Bad parse of MODULE-COMPLIANCE", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + break; +@@ -4502,6 +4514,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_capabilities(fp, name); + if (nnp == NULL) { + print_error("Bad parse of AGENT-CAPABILITIES", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + break; +@@ -4509,6 +4522,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_macro(fp, name); + if (nnp == NULL) { + print_error("Bad parse of MACRO", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + /* + * return NULL; + */ +@@ -4520,6 +4534,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_moduleIdentity(fp, name); + if (nnp == NULL) { + print_error("Bad parse of MODULE-IDENTITY", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + break; +@@ -4527,6 +4542,7 @@ parse(FILE * fp, struct node *root) + nnp = parse_objectgroup(fp, name, OBJECTS, &objects); + if (nnp == NULL) { + print_error("Bad parse of OBJECT-IDENTITY", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + break; +@@ -4534,16 +4550,19 @@ parse(FILE * fp, struct node *root) + type = get_token(fp, token, MAXTOKEN); + if (type != IDENTIFIER) { + print_error("Expected IDENTIFIER", token, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + type = get_token(fp, token, MAXTOKEN); + if (type != EQUALS) { + print_error("Expected \"::=\"", token, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + nnp = parse_objectid(fp, name); + if (nnp == NULL) { + print_error("Bad parse of OBJECT IDENTIFIER", NULL, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + break; +@@ -4555,6 +4574,7 @@ parse(FILE * fp, struct node *root) + break; + default: + print_error("Bad operator", token, type); ++ gMibError = MODULE_SYNTAX_ERROR; + return NULL; + } + if (nnp) { diff --git a/net-mgmt/net-snmp/files/patch-snmp_vars.c b/net-mgmt/net-snmp/files/patch-snmp_vars.c new file mode 100644 index 000000000000..7942e52ed384 --- /dev/null +++ b/net-mgmt/net-snmp/files/patch-snmp_vars.c @@ -0,0 +1,12 @@ +--- ./agent/snmp_vars.c.orig 2011-07-07 15:37:08.000000000 -0700 ++++ agent/snmp_vars.c 2011-07-07 15:37:14.000000000 -0700 +@@ -62,6 +62,9 @@ + */ + + #include <net-snmp/net-snmp-config.h> ++#if HAVE_SYS_PARAM_H ++#include <sys/param.h> ++#endif + #if HAVE_STRING_H + #include <string.h> + #endif |