From 529de9b9f063291b0848c2c41560d5886425aa1f8e9662aab7b595252973f450 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Thu, 19 Oct 2023 08:41:14 +0000 Subject: [PATCH] Accepting request 1118370 from home:abergmann:net-snmp-5.9.4:net-snmp-network-utilities - Update to net-snmp-5.9.4 (bsc#1214364). - Removing legacy MIBs used by Velocity Software (jira#PED-6416). - Re-add support for hostname netgroups that was removed accidentally and previously added with FATE#316305 (bsc#1207697). '@hostgroup' can be specified for multiple hosts - Hardening systemd services setting "ProtectHome=true" caused home directory size and allocation to be listed incorrectly (bsc#1206044). OBS-URL: https://build.opensuse.org/request/show/1118370 OBS-URL: https://build.opensuse.org/package/show/network:utilities/net-snmp?expand=0&rev=59 --- net-snmp-5.9.1-velocity-mib.patch | 3373 ----------------- ...allow_SET_requests_with_NULL_varbind.patch | 94 - net-snmp-5.9.3-grep.patch | 333 -- net-snmp-5.9.3.tar.gz | 3 - net-snmp-5.9.3.tar.gz.asc | 16 - ...net-snmp-5.9.4-add-lustre-fs-support.patch | 0 ...mp-5.9.4-add-netgroups-functionality.patch | 402 ++ ...ch => net-snmp-5.9.4-fix-Makefile.PL.patch | 0 ...nmp-5.9.4-fix-create-v3-user-outfile.patch | 0 ...et-snmp-5.9.4-fixed-python2-bindings.patch | 0 ... net-snmp-5.9.4-harden_snmpd.service.patch | 10 +- ...-snmp-5.9.4-harden_snmptrapd.service.patch | 10 +- ...tch => net-snmp-5.9.4-modern-rpm-api.patch | 0 ...mp-5.9.4-net-snmp-config-headercheck.patch | 0 ...ch => net-snmp-5.9.4-perl-tk-warning.patch | 0 ....9.2-pie.patch => net-snmp-5.9.4-pie.patch | 0 ...nmp-5.9.4-snmpstatus-suppress-output.patch | 0 ....patch => net-snmp-5.9.4-socket-path.patch | 0 ...net-snmp-5.9.4-subagent-set-response.patch | 0 ...nmp-5.9.4-suse-systemd-service-files.patch | 0 ...et-snmp-5.9.4-testing-empty-arptable.patch | 0 net-snmp-5.9.4.tar.gz | 3 + net-snmp-5.9.4.tar.gz.asc | 7 + net-snmp.changes | 47 + net-snmp.keyring | 59 +- net-snmp.spec | 39 +- 26 files changed, 496 insertions(+), 3900 deletions(-) delete mode 100644 net-snmp-5.9.1-velocity-mib.patch delete mode 100644 net-snmp-5.9.3-disallow_SET_requests_with_NULL_varbind.patch delete mode 100644 net-snmp-5.9.3-grep.patch delete mode 100644 net-snmp-5.9.3.tar.gz delete mode 100644 net-snmp-5.9.3.tar.gz.asc rename net-snmp-5.9.1-add-lustre-fs-support.patch => net-snmp-5.9.4-add-lustre-fs-support.patch (100%) create mode 100644 net-snmp-5.9.4-add-netgroups-functionality.patch rename net-snmp-5.9.1-fix-Makefile.PL.patch => net-snmp-5.9.4-fix-Makefile.PL.patch (100%) rename net-snmp-5.9.2-fix-create-v3-user-outfile.patch => net-snmp-5.9.4-fix-create-v3-user-outfile.patch (100%) rename net-snmp-5.9.3-fixed-python2-bindings.patch => net-snmp-5.9.4-fixed-python2-bindings.patch (100%) rename net-snmp-5.9.1-harden_snmpd.service.patch => net-snmp-5.9.4-harden_snmpd.service.patch (61%) rename net-snmp-5.9.1-harden_snmptrapd.service.patch => net-snmp-5.9.4-harden_snmptrapd.service.patch (59%) rename net-snmp-5.9.1-modern-rpm-api.patch => net-snmp-5.9.4-modern-rpm-api.patch (100%) rename net-snmp-5.9.1-net-snmp-config-headercheck.patch => net-snmp-5.9.4-net-snmp-config-headercheck.patch (100%) rename net-snmp-5.9.1-perl-tk-warning.patch => net-snmp-5.9.4-perl-tk-warning.patch (100%) rename net-snmp-5.9.2-pie.patch => net-snmp-5.9.4-pie.patch (100%) rename net-snmp-5.9.1-snmpstatus-suppress-output.patch => net-snmp-5.9.4-snmpstatus-suppress-output.patch (100%) rename net-snmp-5.9.1-socket-path.patch => net-snmp-5.9.4-socket-path.patch (100%) rename net-snmp-5.9.1-subagent-set-response.patch => net-snmp-5.9.4-subagent-set-response.patch (100%) rename net-snmp-5.9.1-suse-systemd-service-files.patch => net-snmp-5.9.4-suse-systemd-service-files.patch (100%) rename net-snmp-5.9.1-testing-empty-arptable.patch => net-snmp-5.9.4-testing-empty-arptable.patch (100%) create mode 100644 net-snmp-5.9.4.tar.gz create mode 100644 net-snmp-5.9.4.tar.gz.asc diff --git a/net-snmp-5.9.1-velocity-mib.patch b/net-snmp-5.9.1-velocity-mib.patch deleted file mode 100644 index 1c7dac6..0000000 --- a/net-snmp-5.9.1-velocity-mib.patch +++ /dev/null @@ -1,3373 +0,0 @@ -Index: net-snmp-5.7.2/LICENSE.VELOCITY -=================================================================== ---- /dev/null -+++ net-snmp-5.7.2/LICENSE.VELOCITY -@@ -0,0 +1,41 @@ -+/* Portions of these files are subject to the following copyright(s). See -+ * the Net-SNMP's COPYING file for more details and other copyrights -+ * that may apply: -+ */ -+/* -+ * Portions of these files are copyrighted by: -+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved. -+ * Use is subject to license terms specified in the COPYING file -+ * distributed with the Net-SNMP package. -+ */ -+/* -+ * Copyright © 2002-2008, Velocity Software, Inc. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are met: -+ * -+ ** Redistributions of source code must retain the above copyright notice, -+ * this list of conditions and the following disclaimer. -+ * -+ ** Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ ** Neither the name of the Velocity Software, Inc. nor the -+ * names of its contributors may be used to endorse or promote -+ * products derived from this software without specific prior written -+ * permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS -+ * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -+ */ -Index: net-snmp-5.7.2/agent/mibgroup/velocity.h -=================================================================== ---- /dev/null -+++ net-snmp-5.7.2/agent/mibgroup/velocity.h -@@ -0,0 +1,28 @@ -+/* -+ * Velocity 'wrapper' interface which is an extension of the host resources -+ * calls the per-group interfaces from 'hr_*.h' and 'velocity_*.h' -+ */ -+ -+ config_require(host/hr_system) -+ config_require(velocity/velocity_system) -+ config_require(host/hrh_storage) -+ config_require(host/hr_device) -+ config_require(host/hr_other) -+ config_require(host/hr_proc) -+ config_require(host/hr_network) -+ config_require(host/hr_print) -+ config_require(host/hr_disk) -+ config_require(host/hr_partition) -+ config_require(host/hrh_filesys) -+ config_require(velocity/velocity_swrun) -+ config_require(host/hr_swrun) -+ config_require(host/hr_swinst) -+ config_require(velocity/velocity_app) -+/* config_require(ucd-snmp/proc) */ -+ -+/* add the host resources mib to the default mibs to load */ -+config_add_mib(HOST-RESOURCES-MIB) -+config_add_mib(HOST-RESOURCES-TYPES) -+config_add_mib(UCD-SNMP-MIB) -+config_add_mib(VELOCITY-MIB) -+config_add_mib(VELOCITY-TYPES) -Index: net-snmp-5.7.2/agent/mibgroup/velocity/velocity_app.c -=================================================================== ---- /dev/null -+++ net-snmp-5.7.2/agent/mibgroup/velocity/velocity_app.c -@@ -0,0 +1,499 @@ -+#include -+ -+#ifdef solaris2 -+#define _KMEMUSER /* Needed by */ -+#include /* helps define struct rlimit */ -+#endif -+ -+#if HAVE_IO_H /* win32 */ -+#include -+#endif -+#if HAVE_STDLIB_H -+#include -+#endif -+#if HAVE_UNISTD_H -+#include -+#endif -+#if HAVE_STRING_H -+#include -+#else -+#include -+#endif -+#if HAVE_MALLOC_H -+#include -+#endif -+#include -+#include -+#include -+#if HAVE_NETINET_IN_H -+#include -+#endif -+#if TIME_WITH_SYS_TIME -+# ifdef WIN32 -+# include -+# else -+# include -+# endif -+# include -+#else -+# if HAVE_SYS_TIME_H -+# include -+# else -+# include -+# endif -+#endif -+#if HAVE_KVM_H -+#include -+#endif -+#if HAVE_WINSOCK_H -+#include -+#endif -+ -+#if HAVE_DMALLOC_H -+#include -+#endif -+ -+#include -+#include -+ -+#include "struct.h" -+#include "velocity_app.h" -+#ifdef USING_UCD_SNMP_ERRORMIB_MODULE -+#include "../ucd-snmp/errormib.h" -+#else -+#define setPerrorstatus(x) snmp_log_perror(x) -+#endif -+#include "util_funcs.h" -+#include "kernel.h" -+#include "errno.h" -+ -+static struct myvelocityApp *get_velocityApp_instance(struct myvelocityApp *, oid); -+struct myvelocityApp *velocityAppwatch = NULL; -+int numvelocityApps = 0; -+#define ID_SIZE 300 -+ -+void -+init_velocity_app(void) -+{ -+ -+ /* -+ * define the structure we're going to ask the agent to register our -+ * information at -+ */ -+ struct variable2 extensible_velocityApp_variables[] = { -+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_velocityApp, 1, {MIBINDEX}}, -+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_velocityApp, 1, -+ {ERRORNAME}}, -+ {APPPID, ASN_OCTET_STR, RONLY, var_extensible_velocityApp, 1, {APPPID}}, -+ {APPMIN, ASN_INTEGER, RONLY, var_extensible_velocityApp, 1, {APPMIN}}, -+ {APPMAX, ASN_INTEGER, RONLY, var_extensible_velocityApp, 1, {APPMAX}}, -+ {APPCOUNT, ASN_INTEGER, RONLY, var_extensible_velocityApp, 1, -+ {APPCOUNT}}, -+ {APPIDS, ASN_OCTET_STR, RONLY, var_extensible_velocityApp, 1, -+ {APPIDS}}, -+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_velocityApp, 1, -+ {ERRORFLAG}}, -+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_velocityApp, 1, -+ {ERRORMSG}}, -+ }; -+ -+ /* -+ * Define the OID pointer to the top of the mib tree that we're -+ * registering underneath -+ */ -+ oid velocityApp_variables_oid[] = { 1, 3, 6, 1, 4, 1, 15601, 6, 1 }; -+ -+ /* -+ * register ourselves with the agent to handle our mib tree -+ */ -+ REGISTER_MIB("velocity/velocity_app", extensible_velocityApp_variables, variable2, -+ velocityApp_variables_oid); -+ -+ snmpd_register_config_handler("app", velocityApp_parse_config, -+ velocityApp_free_config, -+ "application-name [max-num] [min-num]"); -+} -+ -+ -+ -+/* -+ * Define snmpd.conf reading routines first. They get called -+ * automatically by the invocation of a macro in the proc.h file. -+ */ -+ -+void -+velocityApp_free_config(void) -+{ -+ struct myvelocityApp *ptmp, *ptmp2; -+ -+ for (ptmp = velocityAppwatch; ptmp != NULL;) { -+ ptmp2 = ptmp; -+ ptmp = ptmp->next; -+ free(ptmp2); -+ } -+ velocityAppwatch = NULL; -+ numvelocityApps = 0; -+} -+ -+/* -+ * find a give entry in the linked list associated with a proc name -+ */ -+static struct myvelocityApp * -+get_velocityApp_by_name(char *name) -+{ -+ struct myvelocityApp *ptmp; -+ -+ if (name == NULL) -+ return NULL; -+ -+ for (ptmp = velocityAppwatch; ptmp != NULL && strcmp(ptmp->name, name) != 0; -+ ptmp = ptmp->next); -+ return ptmp; -+} -+ -+#include -+#include -+#include -+ -+void -+velocityApp_parse_config(const char *token, char *cptr) -+{ -+ char tmpname[STRMAX]; -+ char tmppid[STRMAX]; -+ struct myvelocityApp **procp = &velocityAppwatch; -+ struct stat stat_buf; -+ const char none[] = "NONE"; -+ int statrc, retc; -+ char *tmpstr; -+ -+ /* -+ * don't allow two entries with the same name -+ */ -+ /* retc = strcpy(tmpstr,cptr); */ -+ tmpstr = cptr; -+ copy_nword(tmpstr, tmpname, sizeof(tmpname)); -+ if (get_velocityApp_by_name(tmpname) != NULL) { -+ config_perror("Already have an entry for this process."); -+ return; -+ } -+ DEBUGMSGTL(("velocity/velocity_app", "tmpname = %s \n", tmpname)); -+ tmpstr = skip_not_white(tmpstr); -+ tmpstr = skip_white(tmpstr); -+ copy_nword(tmpstr, tmppid, sizeof(tmppid)); -+ retc = strcmp(tmppid, none); -+ DEBUGMSGTL(("velocity/velocity_app", "tmppid = %s retc = %d\n", tmppid, retc)); -+ statrc = stat(tmppid, &stat_buf); -+ DEBUGMSGTL(("velocity/velocity_app", "tmppid = %s statrc = %d st_mode = %d\n", tmppid, statrc, S_ISREG(stat_buf.st_mode))); -+ if (retc == 0 || S_ISREG(stat_buf.st_mode)) { -+ DEBUGMSGTL(("velocity/velocity_app", "Valid app string %s %s\n", tmpname, tmppid)); -+ } -+ else { -+ config_perror("Incorrect syntax for app statement. Must give either keyword NONE or absolute file."); -+ return; -+ } -+ -+ /* -+ * skip past used ones -+ */ -+ while (*procp != NULL) -+ procp = &((*procp)->next); -+ -+ (*procp) = (struct myvelocityApp *) calloc(1, sizeof(struct myvelocityApp)); -+ if (*procp == NULL) -+ return; /* memory alloc error */ -+ numvelocityApps++; -+ /* -+ * not blank and not a comment -+ */ -+ copy_nword(cptr, (*procp)->name, sizeof((*procp)->name)); -+ cptr = skip_not_white(cptr); -+ cptr = skip_white(cptr); -+ copy_nword(cptr, (*procp)->pidfile, sizeof((*procp)->pidfile)); -+ DEBUGMSGTL(("velocity/velocity_app", "Read: %s %s\n", -+ (*procp)->name, (*procp)->pidfile)); -+ cptr = skip_not_white(cptr); -+ if ((cptr = skip_white(cptr))) { -+ (*procp)->max = atoi(cptr); -+ cptr = skip_not_white(cptr); -+ if ((cptr = skip_white(cptr))) -+ (*procp)->min = atoi(cptr); -+ else -+ (*procp)->min = 0; -+ } else { -+ (*procp)->max = 0; -+ (*procp)->min = 0; -+ } -+ DEBUGMSGTL(("velocity/velocity_app", "Read: %s (%d) (%d)\n", -+ (*procp)->name, (*procp)->max, (*procp)->min)); -+} -+ -+ -+static struct myvelocityApp * -+get_velocityApp_instance(struct myvelocityApp *proc, oid inst) -+{ -+ int i; -+ -+ if (proc == NULL) -+ return (NULL); -+ for (i = 1; (i != (int) inst) && (proc != NULL); i++) -+ proc = proc->next; -+ return (proc); -+} -+#include -+#include -+ -+/* -+ * The routine that handles everything -+ */ -+ -+u_char * -+var_extensible_velocityApp(struct variable *vp, -+ oid * name, -+ size_t * length, -+ int exact, -+ size_t * var_len, WriteMethod ** write_method) -+{ -+ -+ DIR *dir; -+ struct myvelocityApp *proc; -+ static long long_ret; -+ static char errmsg[ID_SIZE]; -+ -+ char * cmdline = NULL; -+ struct dirent *ent; -+ static char fn[19]; -+ FILE * fd; -+ char temp[ID_SIZE]; -+ size_t len = 0; -+ ssize_t read; -+ int statrc, retc; -+ struct stat stat_buff; -+ const char none[] = "NONE"; -+ char * temp2; -+ -+ if (header_simple_table -+ (vp, name, length, exact, var_len, write_method, numvelocityApps)) -+ return (NULL); -+ if ((proc = get_velocityApp_instance(velocityAppwatch, name[*length - 1]))) { -+ switch (vp->magic) { -+ case MIBINDEX: -+ long_ret = name[*length - 1]; -+ return ((u_char *) (&long_ret)); -+ case ERRORNAME: /* process name to check for */ -+ *var_len = strlen(proc->name); -+ return ((u_char *) (proc->name)); -+ case APPPID: -+ *var_len = strlen(proc->pidfile); -+ DEBUGMSGTL(("velocity/velocity_app", "pid file is %s\n", proc->name )); -+ return ((u_char *) (proc->pidfile)); -+ case APPMIN: -+ long_ret = proc->min; -+ return ((u_char *) (&long_ret)); -+ case APPMAX: -+ long_ret = proc->max; -+ return ((u_char *) (&long_ret)); -+ case APPCOUNT: -+ DEBUGMSGTL(("velocity/velocity_app", "pid file is %s\n", proc->pidfile )); -+ retc = strcmp(proc->pidfile, none); -+ DEBUGMSGTL(("velocity/velocity_app", "retc is %d, pid is %s, none is %s.\n", retc, proc->pidfile, none)); -+ DEBUGMSGTL(("velocity/velocity_app", "pid length is %d, none length is %d\n",strlen(proc->pidfile), strlen(none))); -+ if ( retc == 0 || strlen(proc->pidfile) == 0 ) { -+ DEBUGMSGTL(("velocity/velocity_app", "Calling count")); -+ long_ret = sh_count_velocityApps(proc->name); -+ } -+ else { -+ if (proc->pidfile != NULL) { -+ if ((fd = fopen(proc->pidfile, "r")) == NULL) break; -+ read = getline(&cmdline, &len, fd); -+ fclose(fd); -+ if (len == -1 ) break; -+ DEBUGMSGTL(("velocity/velocity_app", "Length returned is %d\n",len)); -+ DEBUGMSGTL(("velocity/velocity_app", "cmdline is %s\n",cmdline)); -+ cmdline = skip_white(cmdline); -+ copy_nword(cmdline, errmsg, sizeof(errmsg)); -+ sprintf(fn,"/proc/%s",errmsg); -+ DEBUGMSGTL(("velocity/velocity_app", "Filename is %s\n",fn)); -+ statrc = stat(fn, &stat_buff); -+ DEBUGMSGTL(("velocity/velocity_app", "statrc = %d\n",statrc)); -+ if (cmdline) -+ free(cmdline); -+ if (statrc == 0 ) { -+ DEBUGMSGTL(("velocity/velocity_app", "process found - %s\n", fn)); -+ long_ret = 1; -+ } -+ else { -+ DEBUGMSGTL(("velocity/velocity_app", "process not found - %s\n",fn)); -+ long_ret = 0; -+ } -+ } -+ } -+ DEBUGMSGTL(("velocity/velocity_app", "Return %d\n", long_ret)); -+ return ((u_char *) (&long_ret)); -+ case APPIDS: -+ if (strcmp(proc->pidfile, none) == 0 || strlen(proc->pidfile) == 0) { -+ if ((dir = opendir("/proc")) == NULL) { -+ sprintf(fn,"-1"); -+ return ((u_char *) fn); -+ } -+ errmsg[0] = 0; -+ while (NULL != (ent = readdir(dir))) { -+ if(!(ent->d_name[0] >= '0' && ent->d_name[0] <= '9')) continue; -+ /* read /proc/XX/cmdline */ -+ sprintf(fn,"/proc/%s/cmdline",ent->d_name); -+ if((fd = fopen(fn, "r")) == NULL) break; -+ read = getline(&cmdline,&len, fd); -+ fclose(fd); -+ if(read == -1) continue; -+ while(--read && !cmdline[read]); -+ while(--read) if(!cmdline[read]) cmdline[read] = ' '; -+ if(strstr(cmdline,proc->name) != NULL ) { -+ snprintf(temp,sizeof(errmsg),"%s %s", errmsg, ent->d_name); -+ -+ strcpy(errmsg,temp); -+ } -+ } -+ closedir(dir); -+ } -+ else { -+ DEBUGMSGTL(("velocity/velocity_app", "Appid\n")); -+ if ((fd = fopen(proc->pidfile, "r")) == NULL) break; -+ read = getline(&cmdline, &len, fd); -+ fclose(fd); -+ if (len == -1 ) break; -+ cmdline = skip_white(cmdline); -+ copy_nword(cmdline, errmsg, sizeof(errmsg)); -+ sprintf(fn,"/proc/%s",errmsg); -+ DEBUGMSGTL(("velocity/velocity_app", "Filename is %s\n",fn)); -+ statrc = stat(fn, &stat_buff); -+ DEBUGMSGTL(("velocity/velocity_app", "statrc = %d\n",statrc)); -+ if (statrc == 0 ) { -+ DEBUGMSGTL(("velocity/velocity_app", "process id is - %s \n", errmsg)); -+ } -+ else { -+ DEBUGMSGTL(("velocity/velocity_app", "process id should be - %s\n", errmsg)); -+ errmsg[0] = 0; -+ } -+ } -+ DEBUGMSGTL(("velocity/velocity_app", "errmsg string is %s\n", errmsg)); -+ if (cmdline) -+ free(cmdline); -+ *var_len = strlen(errmsg); -+ return ((u_char *) errmsg); -+ case ERRORFLAG: -+ if (strcmp(proc->pidfile, none) == 0 || strlen(proc->pidfile) == 0) { -+ long_ret = sh_count_velocityApps(proc->name); -+ } -+ else { -+ if ((fd = fopen(proc->pidfile, "r")) == NULL) break; -+ read = getline(&cmdline, &len, fd); -+ fclose(fd); -+ if (len == -1 ) break; -+ cmdline = skip_white(cmdline); -+ copy_nword(cmdline, errmsg, sizeof(errmsg)); -+ sprintf(fn,"/proc/%s",errmsg); -+ DEBUGMSGTL(("velocity/velocity_app", "Filename is %s\n",fn)); -+ statrc = stat(fn, &stat_buff); -+ DEBUGMSGTL(("velocity/velocity_app", "statrc = %d\n",statrc)); -+ if (cmdline) -+ free(cmdline); -+ if (statrc == 0 ) { -+ DEBUGMSGTL(("velocity/velocity_app", "process found - %s ", fn)); -+ long_ret = 1; -+ } -+ else { -+ DEBUGMSGTL(("velocity/velocity_app", "process not found - %s",fn)); -+ long_ret = 0; -+ } -+ } -+ if (long_ret >= 0 && -+ ((proc->min && long_ret < proc->min) || -+ (proc->max && long_ret > proc->max) || -+ (proc->min == 0 && proc->max == 0 && long_ret < 1))) { -+ long_ret = 1; -+ } else { -+ long_ret = 0; -+ } -+ return ((u_char *) (&long_ret)); -+ case ERRORMSG: -+ if (strcmp(proc->pidfile, none) == 0 || strlen(proc->pidfile) == 0) { -+ long_ret = sh_count_velocityApps(proc->name); -+ } -+ else { -+ if ((fd = fopen(proc->pidfile, "r")) == NULL) break; -+ read = getline(&cmdline, &len, fd); -+ fclose(fd); -+ if (len == -1 ) break; -+ cmdline = skip_white(cmdline); -+ copy_nword(cmdline, errmsg, sizeof(errmsg)); -+ sprintf(fn,"/proc/%s",errmsg); -+ DEBUGMSGTL(("velocity/velocity_app", "Filename is %s\n",fn)); -+ statrc = stat(fn, &stat_buff); -+ DEBUGMSGTL(("velocity/velocity_app", "statrc = %d\n",statrc)); -+ if (cmdline) -+ free(cmdline); -+ if (statrc == 0 ) { -+ DEBUGMSGTL(("velocity/velocity_app", "process found - %s\n ", fn)); -+ long_ret = 1; -+ } -+ else { -+ DEBUGMSGTL(("velocity/velocity_app", "process not found - %s\n",fn)); -+ long_ret = 0; -+ } -+ } -+ if (long_ret < 0) { -+ errmsg[0] = 0; /* catch out of mem errors return 0 count */ -+ } else if (proc->min && long_ret < proc->min) { -+ snprintf(errmsg, sizeof(errmsg), -+ "Too few %s running (# = %d)", -+ proc->name, (int) long_ret); -+ } else if (proc->max && long_ret > proc->max) { -+ snprintf(errmsg, sizeof(errmsg), -+ "Too many %s running (# = %d)", -+ proc->name, (int) long_ret); -+ } else if (proc->min == 0 && proc->max == 0 && long_ret < 1) { -+ snprintf(errmsg, sizeof(errmsg), -+ "No %s process running.", proc->name); -+ } else { -+ errmsg[0] = 0; -+ } -+ errmsg[ sizeof(errmsg)-1 ] = 0; -+ *var_len = strlen(errmsg); -+ return ((u_char *) errmsg); -+ } -+ return NULL; -+ } -+ return NULL; -+} -+ -+ -+int -+sh_count_velocityApps(char *velocityAppname) -+{ -+ DIR *dir; -+ char *cmdline = NULL; -+ struct dirent *ent; -+ FILE *fd; -+ size_t len; -+ char fn[18]; -+ int total = 0; -+ -+ if ((dir = opendir("/proc")) == NULL) return -1; -+ while (NULL != (ent = readdir(dir))) { -+ if(!(ent->d_name[0] >= '0' && ent->d_name[0] <= '9')) continue; -+ /* read /proc/XX/cmdline */ -+ sprintf(fn,"/proc/%s/cmdline",ent->d_name); -+ if((fd = fopen(fn, "r")) == NULL) break; -+ len = getline(&cmdline,&len,fd); -+ fclose(fd); -+ if(len == -1) continue; -+ cmdline[len] = 0; -+ while(--len && !cmdline[len]); -+ while(--len) if(!cmdline[len]) cmdline[len] = ' '; -+ if(strstr(cmdline,velocityAppname) != NULL ) total++; -+ if (cmdline) -+ free(cmdline); -+ } -+ closedir(dir); -+ return total; -+} -+ -Index: net-snmp-5.7.2/agent/mibgroup/velocity/velocity_app.h -=================================================================== ---- /dev/null -+++ net-snmp-5.7.2/agent/mibgroup/velocity/velocity_app.h -@@ -0,0 +1,38 @@ -+/* -+ * Application watching mib group -+ */ -+#ifndef _MIBGROUP_APP_H -+#define _MIBGROUP_APP_H -+ -+config_require(util_funcs) -+ -+ void init_velocity_app(void); -+ -+ extern FindVarMethod var_extensible_velocityApp; -+ int sh_count_velocityApps(char *); -+ int sh_list_velocityApps(char *, char *); -+ -+/* -+ * config file parsing routines -+ */ -+ void velocityApp_free_config(void); -+ void velocityApp_parse_config(const char *, char *); -+ -+struct myvelocityApp { -+ char name[STRMAX]; -+ char pidfile[STRMAX]; -+ int min; -+ int max; -+ struct myvelocityApp *next; -+}; -+ -+ -+#include "mibdefs.h" -+ -+#define APPPID 3 -+#define APPMIN 4 -+#define APPMAX 5 -+#define APPCOUNT 6 -+#define APPIDS 7 -+ -+#endif /* _MIBGROUP_APP_H */ -Index: net-snmp-5.7.2/agent/mibgroup/velocity/velocity_swrun.c -=================================================================== ---- /dev/null -+++ net-snmp-5.7.2/agent/mibgroup/velocity/velocity_swrun.c -@@ -0,0 +1,1595 @@ -+/* -+ * Velocity MIB - Running Software group implementation - velocity_swrun.c -+ * (also includes Running Software Performance group extensions to the -+ * standard host resources MIB) -+ */ -+ -+#include -+#if HAVE_STDLIB_H -+#include -+#endif -+#include -+#if HAVE_UNISTD_H -+#include -+#endif -+ -+#include -+#include -+#if HAVE_SYS_PSTAT_H -+#include -+#endif -+#if HAVE_SYS_USER_H -+#ifdef solaris2 -+#define _KMEMUSER -+#endif -+#include -+#endif -+#if HAVE_SYS_PROC_H -+#include -+#endif -+#if HAVE_KVM_H -+#include -+#endif -+#if HAVE_SYS_SYSCTL_H -+#include -+#endif -+#if HAVE_DIRENT_H && !defined(cygwin) -+#include -+#else -+# define dirent direct -+# if HAVE_SYS_NDIR_H -+# include -+# endif -+# if HAVE_SYS_DIR_H -+# include -+# endif -+# if HAVE_NDIR_H -+# include -+# endif -+#endif -+#ifdef cygwin -+#include -+#include -+#include -+#include -+#endif -+ -+#if _SLASH_PROC_METHOD_ -+#include -+#endif -+ -+#if HAVE_STRING_H -+#include -+#else -+#include -+#endif -+ -+#include -+ -+#include -+#include -+#include -+#include "host_res.h" -+#include "velocity_swrun.h" -+#include -+#include "kernel.h" -+#if solaris2 -+#include "kernel_sunos5.h" -+#endif -+ -+ /********************* -+ * -+ * Initialisation & common implementation functions -+ * -+ *********************/ -+void Init_VELOCITY_SWRun(void); -+int Get_Next_VELOCITY_SWRun(void); -+void End_VELOCITY_SWRun(void); -+int header_velocityswrun(struct variable *, oid *, size_t *, int, -+ size_t *, WriteMethod **); -+int header_velocityswrunEntry(struct variable *, oid *, size_t *, -+ int, size_t *, WriteMethod **); -+ -+#ifdef dynix -+pid_t nextproc; -+static prpsinfo_t lowpsinfo, mypsinfo; -+#endif -+#ifdef cygwin -+static struct external_pinfo *curproc; -+static struct external_pinfo lowproc; -+#elif !defined(linux) -+static int LowProcIndex; -+#endif -+#if defined(hpux10) || defined(hpux11) -+struct pst_status *proc_table; -+struct pst_dynamic pst_dyn; -+#elif HAVE_KVM_GETPROCS -+struct kinfo_proc *proc_table; -+#elif defined(solaris2) -+int *proc_table; -+#else -+struct proc *proc_table; -+#endif -+#ifndef dynix -+int current_proc_entry; -+#endif -+ -+ -+#define VELOCITYSWRUN_OSINDEX 1 -+ -+#define VELOCITYSWRUN_INDEX 2 -+#define VELOCITYSWRUN_NAME 3 -+#define VELOCITYSWRUN_ID 4 -+#define VELOCITYSWRUN_PATH 5 -+#define VELOCITYSWRUN_PARAMS 6 -+#define VELOCITYSWRUN_TYPE 7 -+#define VELOCITYSWRUN_STATUS 8 -+#define VELOCITYSWRUN_PPID 9 -+#define VELOCITYSWRUN_PGRP 10 -+ -+#define VELOCITYSWRUNPERF_CPU_USER 11 -+#define VELOCITYSWRUNPERF_CPU_SYS 12 -+#define VELOCITYSWRUNPERF_MEM 13 -+#define VELOCITYSWRUNPERF_CPU_CUMM_USER 14 -+#define VELOCITYSWRUNPERF_CPU_CUMM_SYS 15 -+#define VELOCITYSWRUNPERF_MIN_FAULT 16 -+#define VELOCITYSWRUNPERF_MAJ_FAULT 17 -+#define VELOCITYSWRUNPERF_MIN_FAULT_CUMM 18 -+#define VELOCITYSWRUNPERF_MAJ_FAULT_CUMM 19 -+#define VELOCITYSWRUNPERF_RSS 20 -+#define VELOCITYSWRUNPERF_PRIO 21 -+#define VELOCITYSWRUNPERF_ALL 22 -+#define VELOCITYSWRUNPERF_UID 23 -+#define VELOCITYSWRUNPERF_UNAME 24 -+ -+struct variable4 velocityswrun_variables[] = { -+ {VELOCITYSWRUN_OSINDEX, ASN_INTEGER, RONLY, var_velocityswrun, 1, {1}}, -+ {VELOCITYSWRUN_INDEX, ASN_INTEGER, RONLY, var_velocityswrun, 3, {2, 1, 1}}, -+ {VELOCITYSWRUN_NAME, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {2, 1, 2}}, -+ {VELOCITYSWRUN_ID, ASN_OBJECT_ID, RONLY, var_velocityswrun, 3, {2, 1, 3}}, -+ {VELOCITYSWRUN_PATH, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {2, 1, 4}}, -+ {VELOCITYSWRUN_PARAMS, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {2, 1, 5}}, -+ {VELOCITYSWRUN_TYPE, ASN_INTEGER, RONLY, var_velocityswrun, 3, {2, 1, 6}}, -+ {VELOCITYSWRUN_STATUS, ASN_INTEGER, RONLY, var_velocityswrun, 3, {2, 1, 7}}, -+ {VELOCITYSWRUN_PPID, ASN_INTEGER, RONLY, var_velocityswrun, 3, {2, 1, 8}}, -+ {VELOCITYSWRUN_PGRP, ASN_INTEGER, RONLY, var_velocityswrun, 3, {2, 1, 9}} -+}; -+ -+struct variable4 velocityswrunperf_variables[] = { -+ {VELOCITYSWRUNPERF_CPU_USER, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 1}}, -+ {VELOCITYSWRUNPERF_CPU_SYS, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 2}}, -+ {VELOCITYSWRUNPERF_MEM, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 3}}, -+ {VELOCITYSWRUNPERF_CPU_CUMM_USER, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 4}}, -+ {VELOCITYSWRUNPERF_CPU_CUMM_SYS, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 5}}, -+ {VELOCITYSWRUNPERF_MIN_FAULT, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 6}}, -+ {VELOCITYSWRUNPERF_MAJ_FAULT, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 7}}, -+ {VELOCITYSWRUNPERF_MIN_FAULT_CUMM, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 8}}, -+ {VELOCITYSWRUNPERF_MAJ_FAULT_CUMM, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 9}}, -+ {VELOCITYSWRUNPERF_RSS, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 10}}, -+ {VELOCITYSWRUNPERF_PRIO, ASN_INTEGER, RONLY, var_velocityswrun, 3, {1, 1, 11}}, -+ {VELOCITYSWRUNPERF_ALL, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {1, 1, 12}}, -+ {VELOCITYSWRUNPERF_UID, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {1, 1, 13}}, -+ {VELOCITYSWRUNPERF_UNAME, ASN_OCTET_STR, RONLY, var_velocityswrun, 3, {1, 1, 14}} -+}; -+ -+oid velocityswrun_variables_oid[] = { 1, 3, 6, 1, 4, 1, 15601, 4 }; -+oid velocityswrunperf_variables_oid[] = { 1, 3, 6, 1, 4, 1, 15601, 5 }; -+ -+#ifdef cygwin -+ -+/* -+ * a lot of this is "stolen" from cygwin ps.cc -+ */ -+ -+typedef BOOL(WINAPI * ENUMPROCESSMODULES) (HANDLE hProcess, -+ HMODULE * lphModule, -+ DWORD cb, -+ LPDWORD lpcbNeeded); -+ -+typedef DWORD(WINAPI * GETMODULEFILENAME) (HANDLE hProcess, -+ HMODULE hModule, -+ LPTSTR lpstrFIleName, -+ DWORD nSize); -+ -+typedef DWORD(WINAPI * GETPROCESSMEMORYINFO) (HANDLE hProcess, -+ PPROCESS_MEMORY_COUNTERS -+ pmc, DWORD nSize); -+ -+typedef HANDLE(WINAPI * CREATESNAPSHOT) (DWORD dwFlags, -+ DWORD th32ProcessID); -+ -+typedef BOOL(WINAPI * PROCESSWALK) (HANDLE hSnapshot, -+ LPPROCESSENTRY32 lppe); -+ -+ENUMPROCESSMODULES myEnumProcessModules; -+GETMODULEFILENAME myGetModuleFileNameEx; -+CREATESNAPSHOT myCreateToolhelp32Snapshot; -+PROCESSWALK myProcess32First; -+PROCESSWALK myProcess32Next; -+GETPROCESSMEMORYINFO myGetProcessMemoryInfo = NULL; -+cygwin_getinfo_types query = CW_GETPINFO; -+ -+static BOOL WINAPI -+dummyprocessmodules(HANDLE hProcess, -+ HMODULE * lphModule, DWORD cb, LPDWORD lpcbNeeded) -+{ -+ lphModule[0] = (HMODULE) * lpcbNeeded; -+ *lpcbNeeded = 1; -+ return 1; -+} -+ -+static DWORD WINAPI -+GetModuleFileNameEx95(HANDLE hProcess, -+ HMODULE hModule, LPTSTR lpstrFileName, DWORD n) -+{ -+ HANDLE h; -+ DWORD pid = (DWORD) hModule; -+ PROCESSENTRY32 proc; -+ -+ h = myCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); -+ if (!h) -+ return 0; -+ proc.dwSize = sizeof(proc); -+ if (myProcess32First(h, &proc)) -+ do -+ if (proc.th32ProcessID == pid) { -+ CloseHandle(h); -+ strcpy(lpstrFileName, proc.szExeFile); -+ return 1; -+ } -+ while (myProcess32Next(h, &proc)); -+ CloseHandle(h); -+ return 0; -+} -+ -+#define FACTOR (0x19db1ded53ea710LL) -+#define NSPERSEC 10000000LL -+#define NSPERMSEC 10000LL -+ -+static time_t __stdcall -+to_time_t(PFILETIME ptr) -+{ -+ long rem; -+ long long x = -+ ((long long) ptr->dwHighDateTime << 32) + -+ ((unsigned) ptr->dwLowDateTime); -+ x -= FACTOR; -+ rem = x % NSPERSEC; -+ rem += NSPERSEC / 2; -+ x /= NSPERSEC; -+ x += rem / NSPERSEC; -+ return x; -+} -+ -+static long -+to_msec(PFILETIME ptr) -+{ -+ long long x = -+ ((long long) ptr->dwHighDateTime << 32) + -+ (unsigned) ptr->dwLowDateTime; -+ x /= NSPERMSEC; -+ return x; -+} -+ -+#endif /* cygwin */ -+ -+ -+void -+init_velocity_swrun(void) -+{ -+#ifdef cygwin -+ OSVERSIONINFO ver; -+ HMODULE h; -+ -+ memset(&ver, 0, sizeof ver); -+ ver.dwOSVersionInfoSize = sizeof ver; -+ GetVersionEx(&ver); -+ -+ if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { -+ h = LoadLibrary("psapi.dll"); -+ if (h) { -+ myEnumProcessModules = -+ (ENUMPROCESSMODULES) GetProcAddress(h, -+ "EnumProcessModules"); -+ myGetModuleFileNameEx = -+ (GETMODULEFILENAME) GetProcAddress(h, -+ "GetModuleFileNameExA"); -+ myGetProcessMemoryInfo = -+ (GETPROCESSMEMORYINFO) GetProcAddress(h, -+ "GetProcessMemoryInfo"); -+ if (myEnumProcessModules && myGetModuleFileNameEx) -+ query = CW_GETPINFO_FULL; -+ else -+ snmp_log(LOG_ERR, "velocity_swrun failed NT init\n"); -+ } else -+ snmp_log(LOG_ERR, "velocity_swrun failed to load psapi.dll\n"); -+ } else { -+ h = GetModuleHandle("KERNEL32.DLL"); -+ myCreateToolhelp32Snapshot = -+ (CREATESNAPSHOT) GetProcAddress(h, "CreateToolhelp32Snapshot"); -+ myProcess32First = -+ (PROCESSWALK) GetProcAddress(h, "Process32First"); -+ myProcess32Next = (PROCESSWALK) GetProcAddress(h, "Process32Next"); -+ myEnumProcessModules = dummyprocessmodules; -+ myGetModuleFileNameEx = GetModuleFileNameEx95; -+ if (myCreateToolhelp32Snapshot && myProcess32First -+ && myProcess32Next) -+#if 0 -+ /* -+ * This doesn't work after all on Win98 SE -+ */ -+ query = CW_GETPINFO_FULL; -+#else -+ query = CW_GETPINFO; -+#endif -+ else -+ snmp_log(LOG_ERR, "velocity_swrun failed non-NT init\n"); -+ } -+#endif /* cygwin */ -+#ifdef PROC_SYMBOL -+ auto_nlist(PROC_SYMBOL, 0, 0); -+#endif -+#ifdef NPROC_SYMBOL -+ auto_nlist(NPROC_SYMBOL, 0, 0); -+#endif -+ -+ proc_table = 0; -+ -+ REGISTER_MIB("velocity/velocity_swrun", velocityswrun_variables, variable4, -+ velocityswrun_variables_oid); -+ REGISTER_MIB("velocity/velocity_swrun", velocityswrunperf_variables, variable4, -+ velocityswrunperf_variables_oid); -+} -+ -+/* -+ * header_velocityswrun(... -+ * Arguments: -+ * vp IN - pointer to variable entry that points here -+ * name IN/OUT - IN/name requested, OUT/name found -+ * length IN/OUT - length of IN/OUT oid's -+ * exact IN - TRUE if an exact match was requested -+ * var_len OUT - length of variable or 0 if function returned -+ * write_method -+ * -+ */ -+ -+int -+header_velocityswrun(struct variable *vp, -+ oid * name, -+ size_t * length, -+ int exact, size_t * var_len, WriteMethod ** write_method) -+{ -+#define VELOCITYSWRUN_NAME_LENGTH 9 -+ oid newname[MAX_OID_LEN]; -+ int result; -+ -+ DEBUGMSGTL(("velocity/velocity_swrun", "var_velocityswrun: \n")); -+ DEBUGMSGOID(("velocity/velocity_swrun", name, *length)); -+ DEBUGMSG(("velocity/velocity_swrun", " %d\n", exact)); -+ -+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid)); -+ newname[VELOCITYSWRUN_NAME_LENGTH] = 0; -+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1); -+ if ((exact && (result != 0)) || (!exact && (result >= 0))) -+ return (MATCH_FAILED); -+ memcpy((char *) name, (char *) newname, -+ (vp->namelen + 1) * sizeof(oid)); -+ *length = vp->namelen + 1; -+ -+ *write_method = 0; -+ *var_len = sizeof(long); /* default to 'long' results */ -+ return (MATCH_SUCCEEDED); -+} -+ -+int -+header_velocityswrunEntry(struct variable *vp, -+ oid * name, -+ size_t * length, -+ int exact, -+ size_t * var_len, WriteMethod ** write_method) -+{ -+#define VELOCITYSWRUN_ENTRY_NAME_LENGTH 11 -+ oid newname[MAX_OID_LEN]; -+ int pid, LowPid = -1; -+ int result; -+ -+ DEBUGMSGTL(("velocity/velocity_swrun", "var_velocityswrunEntry: \n")); -+ DEBUGMSGOID(("velocity/velocity_swrun", name, *length)); -+ DEBUGMSG(("velocity/velocity_swrun", " %d\n", exact)); -+ -+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid)); -+ -+ /* -+ * Find the "next" running process -+ */ -+ Init_VELOCITY_SWRun(); -+ for (;;) { -+ pid = Get_Next_VELOCITY_SWRun(); -+#ifndef linux -+#ifndef dynix -+ DEBUGMSG(("velocity/velocity_swrun", -+ "(index %d (entry #%d) ....", pid, current_proc_entry)); -+#else -+ DEBUGMSG(("velocity/velocity_swrun", "pid %d; nextproc %d ....\n", pid, -+ nextproc)); -+#endif -+#endif -+ if (pid == -1) -+ break; -+ newname[VELOCITYSWRUN_ENTRY_NAME_LENGTH] = pid; -+ DEBUGMSGOID(("velocity/velocity_swrun", newname, *length)); -+ DEBUGMSG(("velocity/velocity_swrun", "newname\n")); -+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1); -+ if (exact && (result == 0)) { -+ LowPid = pid; -+#ifdef cygwin -+ lowproc = *curproc; -+#elif dynix -+ memcpy(&lowpsinfo, &mypsinfo, sizeof(prpsinfo_t)); -+#elif !defined(linux) -+ LowProcIndex = current_proc_entry - 1; -+#endif -+ DEBUGMSGTL(("velocity/velocity_swrun", " saved\n")); -+ /* -+ * Save process status information -+ */ -+ break; -+ } -+ if ((!exact && (result < 0)) && (LowPid == -1 || pid < LowPid)) { -+ LowPid = pid; -+#ifdef cygwin -+ lowproc = *curproc; -+#elif !defined(linux) -+ LowProcIndex = current_proc_entry - 1; -+#endif -+ /* -+ * Save process status information -+ */ -+ DEBUGMSG(("velocity/velocity_swrun", " saved")); -+ } -+ DEBUGMSG(("velocity/velocity_swrun", "\n")); -+ } -+ End_VELOCITY_SWRun(); -+ -+ if (LowPid == -1) { -+ DEBUGMSGTL(("velocity/velocity_swrun", "... index out of range\n")); -+ return (MATCH_FAILED); -+ } -+ -+ newname[VELOCITYSWRUN_ENTRY_NAME_LENGTH] = LowPid; -+ memcpy((char *) name, (char *) newname, -+ (vp->namelen + 1) * sizeof(oid)); -+ *length = vp->namelen + 1; -+ *write_method = 0; -+ *var_len = sizeof(long); /* default to 'long' results */ -+ -+ DEBUGMSGTL(("velocity/velocity_swrun", "... get process stats\n")); -+ DEBUGMSGOID(("velocity/velocity_swrun", name, *length)); -+ DEBUGMSG(("velocity/velocity_swrun", "\n")); -+ return LowPid; -+} -+ -+ /********************* -+ * -+ * System specific implementation functions -+ * -+ *********************/ -+ -+ -+u_char * -+var_velocityswrun(struct variable * vp, -+ oid * name, -+ size_t * length, -+ int exact, size_t * var_len, WriteMethod ** write_method) -+{ -+ int pid = 0; -+ static char string[256]; -+#ifdef HAVE_SYS_PSTAT_H -+ struct pst_status proc_buf; -+#elif defined(solaris2) -+#if _SLASH_PROC_METHOD_ -+ static psinfo_t psinfo; -+ static psinfo_t *proc_buf; -+ int procfd; -+ char procfn[sizeof "/proc/00000/psinfo"]; -+#else -+ static struct proc *proc_buf; -+ char *cp1; -+#endif /* _SLASH_PROC_METHOD_ */ -+ static time_t when = 0; -+ time_t now; -+ static int oldpid = -1; -+#endif -+#if HAVE_KVM_GETPROCS -+ char **argv; -+#endif -+#ifdef linux -+ FILE *fp; -+ int fd; -+ char buf[256]; -+ char buff[1024]; -+ char uid[33]; -+ char gid[33]; -+ char unknown[] = "unknown"; -+ int bsize; -+ int i; -+ int uid1, uid2, uid3, uid4; -+ int gid1, gid2, gid3, gid4; -+ struct passwd* pwd; -+ struct group* grp; -+ char *username = NULL; -+ char *groupname = NULL; -+#endif -+ char *cp; -+ -+ if (vp->magic == VELOCITYSWRUN_OSINDEX) { -+ if (header_velocityswrun(vp, name, length, exact, var_len, write_method) -+ == MATCH_FAILED) -+ return NULL; -+ } else { -+ -+ pid = -+ header_velocityswrunEntry(vp, name, length, exact, var_len, -+ write_method); -+ if (pid == MATCH_FAILED) -+ return NULL; -+ } -+ -+#ifdef HAVE_SYS_PSTAT_H -+ if (pstat_getproc(&proc_buf, sizeof(struct pst_status), 0, pid) == -1) -+ return NULL; -+#elif defined(solaris2) -+ time(&now); -+ if (pid == oldpid) { -+ if (now != when) -+ oldpid = -1; -+ } -+ if (oldpid != pid || proc_buf == NULL) { -+#if _SLASH_PROC_METHOD_ -+ proc_buf = &psinfo; -+ sprintf(procfn, "/proc/%.5d/psinfo", pid); -+ if ((procfd = open(procfn, O_RDONLY)) != -1) { -+ if (read(procfd, proc_buf, sizeof(*proc_buf)) != -+ sizeof(*proc_buf)) -+ abort(); -+ close(procfd); -+ } else -+ proc_buf = NULL; -+#else -+ if (kd == NULL) -+ return NULL; -+ if ((proc_buf = kvm_getproc(kd, pid)) == NULL) -+ return NULL; -+#endif -+ oldpid = pid; -+ when = now; -+ } -+#endif -+ -+ switch (vp->magic) { -+ case VELOCITYSWRUN_OSINDEX: -+#if NO_DUMMY_VALUES -+ return NULL; -+#else -+ long_return = 1; /* Probably! */ -+ return (u_char *) & long_return; -+#endif -+ -+ case VELOCITYSWRUN_INDEX: -+ long_return = pid; -+ return (u_char *) & long_return; -+ case VELOCITYSWRUN_NAME: -+#ifdef HAVE_SYS_PSTAT_H -+ sprintf(string, "%s", proc_buf.pst_cmd); -+ cp = strchr(string, ' '); -+ if (cp != NULL) -+ *cp = '\0'; -+#elif defined(dynix) -+ sprintf(string, "%s", lowpsinfo.pr_fname); -+ cp = strchr(string, ' '); -+ if (cp != NULL) -+ *cp = '\0'; -+#elif defined(solaris2) -+#if _SLASH_PROC_METHOD_ -+ if (proc_buf) -+ strcpy(string, proc_buf->pr_fname); -+ else -+ strcpy(string, ""); -+#else -+ strcpy(string, proc_buf->p_user.u_comm); -+#endif -+#elif HAVE_KVM_GETPROCS -+ strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm); -+#elif defined(linux) -+ sprintf(string, "/proc/%d/status", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); /* Name: process name */ -+ cp = buf; -+ while (*cp != ':') -+ ++cp; -+ ++cp; -+ while (isspace(*cp)) -+ ++cp; -+ strcpy(string, cp); -+ fclose(fp); -+#elif defined(cygwin) -+ if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED)) -+ strcpy(string, ""); -+ else if (lowproc.ppid) { -+ cygwin_conv_to_posix_path(lowproc.progname, string); -+ cp = strrcvelocity(string, '/'); -+ if (cp) -+ strcpy(string, cp + 1); -+ } else if (query == CW_GETPINFO_FULL) { -+ DWORD n = lowproc.dwProcessId & 0xffff; -+ HANDLE h = -+ OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, -+ FALSE, n); -+ -+ if (h) { -+ HMODULE hm[1000]; -+ if (!myEnumProcessModules(h, hm, sizeof hm, &n)) { -+ snmp_log(LOG_DEBUG, "no module handle for %lu\n", n); -+ n = 0; -+ } -+ if (n -+ && myGetModuleFileNameEx(h, hm[0], string, -+ sizeof string)) { -+ cp = strrcvelocity(string, '\\'); -+ if (cp) -+ strcpy(string, cp + 1); -+ } else -+ strcpy(string, "*** unknown"); -+ CloseHandle(h); -+ } else { -+ snmp_log(LOG_INFO, "no process handle for %lu\n", n); -+ strcpy(string, "** unknown"); -+ } -+ } else -+ strcpy(string, "* unknown"); -+ cp = strchr(string, '\0') - 4; -+ if (cp > string && strcasecmp(cp, ".exe") == 0) -+ *cp = '\0'; -+#else -+#if NO_DUMMY_VALUES -+ return NULL; -+#endif -+ sprintf(string, "process name"); -+#endif -+ *var_len = strlen(string); -+ /* -+ * remove trailing newline -+ */ -+ if (*var_len) { -+ cp = string + *var_len - 1; -+ if (*cp == '\n') -+ --(*var_len); -+ } -+ return (u_char *) string; -+ case VELOCITYSWRUN_ID: -+ *var_len = nullOidLen; -+ return (u_char *) nullOid; -+ case VELOCITYSWRUN_PATH: -+#ifdef HAVE_SYS_PSTAT_H -+ /* -+ * Path not available - use argv[0] -+ */ -+ sprintf(string, "%s", proc_buf.pst_cmd); -+ cp = strchr(string, ' '); -+ if (cp != NULL) -+ *cp = '\0'; -+#elif defined(dynix) -+ /* -+ * Path not available - use argv[0] -+ */ -+ sprintf(string, "%s", lowpsinfo.pr_psargs); -+ cp = strchr(string, ' '); -+ if (cp != NULL) -+ *cp = '\0'; -+#elif defined(solaris2) -+#ifdef _SLASH_PROC_METHOD_ -+ if (proc_buf) -+ strcpy(string, proc_buf->pr_psargs); -+ else -+ sprintf(string, ""); -+ cp = strchr(string, ' '); -+ if (cp) -+ *cp = 0; -+#else -+ cp = proc_buf->p_user.u_psargs; -+ cp1 = string; -+ while (*cp && *cp != ' ') -+ *cp1++ = *cp++; -+ *cp1 = 0; -+#endif -+#elif HAVE_KVM_GETPROCS -+ strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm); -+#elif defined(linux) -+ sprintf(string, "/proc/%d/cmdline", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ if (fgets(buf, sizeof(buf) - 1, fp)) /* argv[0] '\0' argv[1] '\0' .... */ -+ strcpy(string, buf); -+ else { -+ /* -+ * swapped out - no cmdline -+ */ -+ fclose(fp); -+ sprintf(string, "/proc/%d/status", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); /* Name: process name */ -+ cp = strchr(buf, ':'); -+ ++cp; -+ while (isspace(*cp)) -+ ++cp; -+ strcpy(string, cp); -+ cp = strchr(string, '\n'); -+ if (cp) -+ *cp = 0; -+ } -+ fclose(fp); -+#elif defined(cygwin) -+ if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED)) -+ strcpy(string, ""); -+ else if (lowproc.ppid) -+ cygwin_conv_to_posix_path(lowproc.progname, string); -+ else if (query == CW_GETPINFO_FULL) { -+ DWORD n = lowproc.dwProcessId & 0xFFFF; -+ HANDLE h = -+ OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, -+ FALSE, n); -+ if (h) { -+ HMODULE hm[1000]; -+ if (!myEnumProcessModules(h, hm, sizeof hm, &n)) -+ n = 0; -+ if (!n -+ || !myGetModuleFileNameEx(h, hm[0], string, -+ sizeof string)) -+ strcpy(string, "*** unknown"); -+ CloseHandle(h); -+ } else -+ strcpy(string, "** unknown"); -+ } else -+ strcpy(string, "* unknown"); -+#else -+#if NO_DUMMY_VALUES -+ return NULL; -+#endif -+ sprintf(string, "/bin/wombat"); -+#endif -+ *var_len = strlen(string); -+ return (u_char *) string; -+ case VELOCITYSWRUN_PARAMS: -+#ifdef HAVE_SYS_PSTAT_H -+ cp = strchr(proc_buf.pst_cmd, ' '); -+ if (cp != NULL) { -+ cp++; -+ sprintf(string, "%s", cp); -+ } else -+ string[0] = '\0'; -+#elif defined(dynix) -+ cp = strchr(lowpsinfo.pr_psargs, ' '); -+ if (cp != NULL) { -+ cp++; -+ sprintf(string, "%s", cp); -+ } else -+ string[0] = '\0'; -+#elif defined(solaris2) -+#ifdef _SLASH_PROC_METHOD_ -+ if (proc_buf) { -+ cp = strchr(proc_buf->pr_psargs, ' '); -+ if (cp) -+ strcpy(string, cp + 1); -+ else -+ string[0] = 0; -+ } else -+ string[0] = 0; -+#else -+ cp = proc_buf->p_user.u_psargs; -+ while (*cp && *cp != ' ') -+ cp++; -+ if (*cp == ' ') -+ cp++; -+ strcpy(string, cp); -+#endif -+#elif HAVE_KVM_GETPROCS -+ string[0] = 0; -+ argv = kvm_getargv(kd, proc_table + LowProcIndex, sizeof(string)); -+ if (argv) -+ argv++; -+ while (argv && *argv) { -+ if (string[0] != 0) -+ strcat(string, " "); -+ strcat(string, *argv); -+ argv++; -+ } -+#elif defined(linux) -+ sprintf(string, "/proc/%d/cmdline", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ memset(buf, 0, sizeof(buf)); -+ -+ /* -+ * argv[0] '\0' argv[1] '\0' .... -+ */ -+ if (!fgets(buf, sizeof(buf) - 2, fp)) { -+ /* -+ * maybe be empty (even argv[0] is missing) -+ */ -+ string[0] = '\0'; -+ *var_len = 0; -+ fclose(fp); -+ return string; -+ } -+ -+ /* -+ * Skip over argv[0] -+ */ -+ cp = buf; -+ while (*cp) -+ ++cp; -+ ++cp; -+ /* -+ * Now join together separate arguments. -+ */ -+ while (1) { -+ while (*cp) -+ ++cp; -+ if (*(cp + 1) == '\0') -+ break; /* '\0''\0' => End of command line */ -+ *cp = ' '; -+ } -+ -+ cp = buf; -+ while (*cp) -+ ++cp; -+ ++cp; -+ strcpy(string, cp); -+ fclose(fp); -+#elif defined(cygwin) -+ string[0] = 0; -+#else -+#if NO_DUMMY_VALUES -+ return NULL; -+#endif -+ sprintf(string, "-h -q -v"); -+#endif -+ *var_len = strlen(string); -+ return (u_char *) string; -+ case VELOCITYSWRUNPERF_ALL: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ strcpy(string,buf); -+ -+ fclose(fp); -+#endif -+ *var_len = strlen(string); -+ return (u_char *) string; -+ case VELOCITYSWRUNPERF_UID: -+#if defined(linux) -+ sprintf(string, "/proc/%d/status", pid); -+ DEBUGMSG(("velocity/velocity_swrun", "In UID string=%s\n",string)); -+ if ((fd = open(string, O_RDONLY, 0)) == -1) -+ return NULL; -+ bsize = read(fd, buff, sizeof(buff)); -+ buff[bsize-1] = 0; -+ DEBUGMSG(("velocity/velocity_swrun", "In UID buff=%s\n",buff)); -+ cp = strstr(buff, "Uid:"); -+ DEBUGMSG(("velocity/velocity_swrun", "In UID cp=%s\n",cp)); -+ if (cp) -+ sscanf(cp, "%*s %s %*s %*s %*s %*s %s", uid, gid); -+ else { -+ return NULL; -+ } -+ strcpy(string,uid); -+ strcat(string," "); -+ strcat(string,gid); -+ DEBUGMSG(("velocity/velocity_swrun", "In UID end string=%s\n",string)); -+ close(fd); -+#endif -+ *var_len = strlen(string); -+ return (u_char *) string; -+ case VELOCITYSWRUNPERF_UNAME: -+#if defined(linux) -+ sprintf(string, "/proc/%d/status", pid); -+ DEBUGMSG(("velocity/velocity_swrun", "UName string=%s\n",string)); -+ if ((fd = open(string, O_RDONLY, 0)) == -1) -+ return NULL; -+ bsize = read(fd, buff, sizeof(buff)); -+ buff[bsize-1] = 0; -+ DEBUGMSG(("velocity/velocity_swrun", "UName buff=%s\n",buff)); -+ cp = strstr(buff, "Uid:"); -+ DEBUGMSG(("velocity/velocity_swrun", "UName cp=%s\n",cp)); -+ if (cp) -+ sscanf(cp, "%*s %d %*s %*s %*s %*s %d", &uid1, &gid1); -+ else { -+ return NULL; -+ } -+ DEBUGMSG(("velocity/velocity_swrun", "UName uid1=%d gid1=%d\n", uid1, gid1)); -+ pwd = getpwuid(uid1); -+ if ( pwd == NULL ) -+ username = unknown; -+ else username = pwd->pw_name; -+ grp = getgrgid(gid1); -+ if ( grp == NULL ) -+ groupname = unknown; -+ else groupname = grp->gr_name; -+/* strcpy(string,username); -+ strcat(string," "); -+ strcat(string,groupname); */ -+ sprintf(string,"%s %s %d %d", username, groupname, uid1, gid1); -+ DEBUGMSG(("velocity/velocity_swrun", "UName end string=%s\n",string)); -+ close(fd); -+#endif -+ *var_len = strlen(string); -+ return (u_char *) string; -+ case VELOCITYSWRUN_TYPE: -+#ifdef PID_MAXSYS -+ if (pid < PID_MAXSYS) -+ long_return = 2; /* operatingSystem */ -+ else -+#endif -+ long_return = 4; /* application */ -+ return (u_char *) & long_return; -+ case VELOCITYSWRUN_STATUS: -+#if defined(cygwin) -+ if (lowproc.process_state & PID_STOPPED) -+ long_return = 3; /* notRunnable */ -+ else if (lowproc.process_state & PID_ZOMBIE) -+ long_return = 4; /* invalid */ -+ else -+ long_return = 1; /* running */ -+#elif !defined(linux) -+#if defined(hpux10) || defined(hpux11) -+ switch (proc_table[LowProcIndex].pst_stat) { -+ case PS_STOP: -+ long_return = 3; /* notRunnable */ -+ break; -+ case PS_SLEEP: -+ long_return = 2; /* runnable */ -+ break; -+ case PS_RUN: -+ long_return = 1; /* running */ -+ break; -+ case PS_ZOMBIE: -+ case PS_IDLE: -+ case PS_OTHER: -+ default: -+ long_return = 4; /* invalid */ -+ break; -+ } -+#else -+#if HAVE_KVM_GETPROCS -+ switch (proc_table[LowProcIndex].kp_proc.p_stat) { -+#elif defined(dynix) -+ switch (lowpsinfo.pr_state) { -+#elif defined(solaris2) -+#if _SLASH_PROC_METHOD_ -+ switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) { -+#else -+ switch (proc_buf->p_stat) { -+#endif -+#else -+ switch (proc_table[LowProcIndex].p_stat) { -+#endif -+ case SSTOP: -+ long_return = 3; /* notRunnable */ -+ break; -+ case 0: -+#ifdef SSWAP -+ case SSWAP: -+#endif -+#ifdef SSLEEP -+ case SSLEEP: -+#endif -+#ifdef SWAIT -+ case SWAIT: -+#endif -+ long_return = 2; /* runnable */ -+ break; -+#ifdef SACTIVE -+ case SACTIVE: -+#endif -+#ifdef SRUN -+ case SRUN: -+#endif -+#ifdef SONPROC -+ case SONPROC: -+#endif -+ long_return = 1; /* running */ -+ break; -+ case SIDL: -+ case SZOMB: -+ default: -+ long_return = 4; /* invalid */ -+ break; -+ } -+#endif -+#else -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) != NULL) { -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 2; ++i) { /* skip two fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ switch (*cp) { -+ case 'R': -+ long_return = 1; /* running */ -+ break; -+ case 'S': -+ long_return = 2; /* runnable */ -+ break; -+ case 'D': -+ case 'T': -+ long_return = 3; /* notRunnable */ -+ break; -+ case 'Z': -+ default: -+ long_return = 4; /* invalid */ -+ break; -+ } -+ fclose(fp); -+ } else -+ long_return = 4; /* invalid */ -+#endif -+ return (u_char *) & long_return; -+ -+ case VELOCITYSWRUN_PPID: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 3; ++i) { /* skip 3 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* Parent Process ID */ -+ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUN_PGRP: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 4; ++i) { /* skip 4 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* Process group ID */ -+ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_CPU_USER: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 13; ++i) { /* skip 13 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* utime */ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_CPU_SYS: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 14; ++i) { /* skip 14 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* stime */ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_CPU_CUMM_USER: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 15; ++i) { /* skip 15 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* cutime */ -+ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_CPU_CUMM_SYS: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 16; ++i) { /* skip 16 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* cstime */ -+ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_MIN_FAULT: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 9; ++i) { /* skip 9 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* minflt */ -+ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_MAJ_FAULT: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 11; ++i) { /* skip 11 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* majflt */ -+ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_MIN_FAULT_CUMM: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 10; ++i) { /* skip 10 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* cminflt */ -+ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_MAJ_FAULT_CUMM: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 12; ++i) { /* skip 12 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* cmajflt */ -+ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_RSS: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 23; ++i) { /* skip 23 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* rss */ -+ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_PRIO: -+#if defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 18; ++i) { /* skip 18 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ -+ long_return = atoi(cp); /* priority */ -+ -+ fclose(fp); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSWRUNPERF_MEM: -+#ifdef HAVE_SYS_PSTAT_H -+ long_return = (proc_buf.pst_rssize << PGSHIFT) / 1024; -+#elif defined(dynix) -+ long_return = (lowpsinfo.pr_rssize * MMU_PAGESIZE) / 1024; -+#elif defined(solaris2) -+#if _SLASH_PROC_METHOD_ -+ long_return = proc_buf ? proc_buf->pr_rssize : 0; -+#else -+ long_return = proc_buf->p_swrss; -+#endif -+#elif HAVE_KVM_GETPROCS -+#if defined(freebsd3) && !defined(darwin) -+ long_return = -+ proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024; -+#else -+ long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize + -+ proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize + -+ proc_table[LowProcIndex].kp_eproc.e_vm.vm_dsize; -+ long_return = long_return * (getpagesize() / 1024); -+#endif -+#elif defined(linux) -+ sprintf(string, "/proc/%d/stat", pid); -+ if ((fp = fopen(string, "r")) == NULL) -+ return NULL; -+ fgets(buf, sizeof(buf), fp); -+ cp = buf; -+ for (i = 0; i < 22; ++i) { /* skip 22 fields */ -+ while (*cp != ' ') -+ ++cp; -+ ++cp; -+ } -+ long_return = atoi(cp) / 1024; /* perfmem in K */ -+ fclose(fp); -+#elif defined(cygwin) -+ { -+ DWORD n = lowproc.dwProcessId; -+ HANDLE h = -+ OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, -+ FALSE, n); -+ PROCESS_MEMORY_COUNTERS pmc; -+ -+ if (h) { -+ if (myGetProcessMemoryInfo -+ && myGetProcessMemoryInfo(h, &pmc, sizeof pmc)) -+ long_return = pmc.WorkingSetSize / 1024; -+ else { -+ snmp_log(LOG_INFO, "no process times for %lu (%lu)\n", -+ lowproc.pid, n); -+ long_return = 0; -+ } -+ CloseHandle(h); -+ } else { -+ snmp_log(LOG_INFO, "no process handle for %lu (%lu)\n", -+ lowproc.pid, n); -+ long_return = 0; -+ } -+ } -+#else -+#if NO_DUMMY_VALUES -+ return NULL; -+#endif -+ long_return = 16 * 1024; /* XXX - 16M! */ -+#endif -+ return (u_char *) & long_return; -+ default: -+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_velocityswrun\n", -+ vp->magic)); -+ } -+ return NULL; -+} -+ -+ -+ /********************* -+ * -+ * Internal implementation functions -+ * -+ *********************/ -+ -+#if defined(linux) -+ -+DIR *vsprocdir = NULL; -+struct dirent *procentry_p; -+ -+void -+Init_VELOCITY_SWRun(void) -+{ -+ if (vsprocdir != NULL) -+ closedir(vsprocdir); -+ vsprocdir = opendir("/proc"); -+} -+ -+int -+Get_Next_VELOCITY_SWRun(void) -+{ -+ int pid; -+ procentry_p = readdir(vsprocdir); -+ -+ if (procentry_p == NULL) -+ return -1; -+ -+ pid = atoi(procentry_p->d_name); -+ if (pid == 0) -+ return (Get_Next_VELOCITY_SWRun()); -+ return pid; -+} -+ -+void -+End_VELOCITY_SWRun(void) -+{ -+ if (vsprocdir) -+ closedir(vsprocdir); -+ vsprocdir = NULL; -+} -+ -+#elif defined(cygwin) -+ -+static pid_t curpid; -+ -+void -+Init_VELOCITY_SWRun(void) -+{ -+ cygwin_internal(CW_LOCK_PINFO, 1000); -+ curpid = 0; -+} -+ -+int -+Get_Next_VELOCITY_SWRun(void) -+{ -+ curproc = -+ (struct external_pinfo *) cygwin_internal(query, -+ curpid | CW_NEXTPID); -+ if (curproc) -+ curpid = curproc->pid; -+ else { -+ curpid = -1; -+ } -+ return curpid; -+} -+ -+void -+End_VELOCITY_SWRun(void) -+{ -+ cygwin_internal(CW_UNLOCK_PINFO); -+} -+ -+#elif defined(dynix) -+ -+void -+Init_VELOCITY_SWRun(void) -+{ -+ nextproc = 0; -+} -+ -+int -+Get_Next_VELOCITY_SWRun(void) -+{ -+ getprpsinfo_t *select = 0; -+ -+ DEBUGMSGTL(("velocity/velocity_swrun::GetNextVELOCITY_SWRun", -+ "nextproc == %d... &nextproc = %u\n", nextproc, -+ &nextproc)); -+ if ((nextproc = getprpsinfo(nextproc, select, &mypsinfo)) < 0) { -+ return -1; -+ } else { -+ DEBUGMSGTL(("velocity/velocity_swrun::GetNextVELOCITY_SWRun", -+ "getprpsinfo returned %d\n", nextproc)); -+ return mypsinfo.pr_pid; -+ } -+ -+} -+ -+void -+End_VELOCITY_SWRun(void) -+{ -+ /* -+ * just a stub... because it's declared -+ */ -+} -+ -+#else /* linux */ -+ -+static int nproc; -+ -+void -+Init_VELOCITY_SWRun(void) -+{ -+ size_t bytes; -+ static time_t iwhen = 0; -+ time_t now; -+ -+ time(&now); -+ if (now == iwhen) { -+ current_proc_entry = 0; -+ return; -+ } -+ iwhen = now; -+ -+#if defined(hpux10) || defined(hpux11) -+ pstat_getdynamic(&pst_dyn, sizeof(struct pst_dynamic), 1, 0); -+ nproc = pst_dyn.psd_activeprocs; -+ bytes = nproc * sizeof(struct pst_status); -+ if ((proc_table = -+ (struct pst_status *) realloc(proc_table, bytes)) == NULL) { -+ current_proc_entry = nproc + 1; -+ return; -+ } -+ pstat_getproc(proc_table, sizeof(struct pst_status), nproc, 0); -+ -+#elif defined(solaris2) -+ if (!getKstatInt("unix", "system_misc", "nproc", &nproc)) { -+ current_proc_entry = nproc + 1; -+ return; -+ } -+ bytes = nproc * sizeof(int); -+ if ((proc_table = (int *) realloc(proc_table, bytes)) == NULL) { -+ current_proc_entry = nproc + 1; -+ return; -+ } -+ { -+ DIR *f; -+ struct dirent *dp; -+#if _SLASH_PROC_METHOD_ == 0 -+ if (kd == NULL) { -+ current_proc_entry = nproc + 1; -+ return; -+ } -+#endif -+ f = opendir("/proc"); -+ current_proc_entry = 0; -+ while ((dp = readdir(f)) != NULL && current_proc_entry < nproc) -+ if (dp->d_name[0] != '.') -+ proc_table[current_proc_entry++] = atoi(dp->d_name); -+ closedir(f); -+ } -+#elif HAVE_KVM_GETPROCS -+ { -+ if (kd == NULL) { -+ nproc = 0; -+ return; -+ } -+ proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc); -+ } -+#else -+ -+ current_proc_entry = 1; -+#ifndef bsdi2 -+ nproc = 0; -+ -+ if (auto_nlist(NPROC_SYMBOL, (char *) &nproc, sizeof(int)) == 0) { -+ snmp_log_perror("Init_VELOCITY_SWRun-auto_nlist NPROC"); -+ return; -+ } -+#endif -+ bytes = nproc * sizeof(struct proc); -+ -+ if (proc_table) -+ free((char *) proc_table); -+ if ((proc_table = (struct proc *) malloc(bytes)) == NULL) { -+ nproc = 0; -+ snmp_log_perror("Init_VELOCITY_SWRun-malloc"); -+ return; -+ } -+ -+ { -+ int proc_table_base; -+ if (auto_nlist -+ (PROC_SYMBOL, (char *) &proc_table_base, -+ sizeof(proc_table_base)) == 0) { -+ nproc = 0; -+ snmp_log_perror("Init_VELOCITY_SWRun-auto_nlist PROC"); -+ return; -+ } -+ if (klookup(proc_table_base, (char *) proc_table, bytes) == 0) { -+ nproc = 0; -+ snmp_log_perror("Init_VELOCITY_SWRun-klookup"); -+ return; -+ } -+ } -+#endif -+ current_proc_entry = 0; -+} -+ -+int -+Get_Next_VELOCITY_SWRun(void) -+{ -+ while (current_proc_entry < nproc) { -+#if defined(hpux10) || defined(hpux11) -+ return proc_table[current_proc_entry++].pst_pid; -+#elif defined(solaris2) -+ return proc_table[current_proc_entry++]; -+#elif HAVE_KVM_GETPROCS -+ if (proc_table[current_proc_entry].kp_proc.p_stat != 0) -+ return proc_table[current_proc_entry++].kp_proc.p_pid; -+#else -+ if (proc_table[current_proc_entry].p_stat != 0) -+ return proc_table[current_proc_entry++].p_pid; -+ else -+ ++current_proc_entry; -+#endif -+ -+ } -+ return -1; -+} -+ -+void -+End_VELOCITY_SWRun(void) -+{ -+ current_proc_entry = nproc + 1; -+} -+#endif -+ -+int -+vscount_processes(void) -+{ -+#if !(defined(linux) || defined(cygwin)) || defined(hpux10) || defined(hpux11) || defined(solaris2) || HAVE_KVM_GETPROCS -+ int i; -+#endif -+ int total = 0; -+ -+ Init_VELOCITY_SWRun(); -+#if defined(hpux10) || defined(hpux11) || HAVE_KVM_GETPROCS || defined(solaris2) -+ total = nproc; -+#else -+#if !defined(linux) && !defined(cygwin) && !defined(dynix) -+ for (i = 0; i < nproc; ++i) { -+ if (proc_table[i].p_stat != 0) -+#else -+ while (Get_Next_VELOCITY_SWRun() != -1) { -+#endif -+ ++total; -+ } -+#endif /* !hpux10 && !hpux11 && !HAVE_KVM_GETPROCS && !solaris2 */ -+ End_VELOCITY_SWRun(); -+ return total; -+} -Index: net-snmp-5.7.2/agent/mibgroup/velocity/velocity_swrun.h -=================================================================== ---- /dev/null -+++ net-snmp-5.7.2/agent/mibgroup/velocity/velocity_swrun.h -@@ -0,0 +1,13 @@ -+/* -+ * Velocity MIB - Running Software group interface - velocity_swrun.h -+ * (also includes Running Software Performance group extenstions to the -+ * standard host resources MIB) -+ */ -+#ifndef _MIBGROUP_VELOCITYSWRUN_H -+#define _MIBGROUP_VELOCITYSWRUN_H -+ -+extern void init_velocity_swrun(void); -+extern FindVarMethod var_velocityswrun; -+ -+ -+#endif /* _MIBGROUP_VELOCITYSWRUN_H */ -Index: net-snmp-5.7.2/agent/mibgroup/velocity/velocity_system.c -=================================================================== ---- /dev/null -+++ net-snmp-5.7.2/agent/mibgroup/velocity/velocity_system.c -@@ -0,0 +1,403 @@ -+/* -+ * Velocity MIB - system group implementation - velocity_system.c -+ * -+ */ -+ -+#include -+#if HAVE_STRING_H -+#include -+#else -+#include -+#endif -+ -+#include -+#include -+ -+#include "host.h" -+#include "host_res.h" -+#include "velocity_system.h" -+#include -+ -+#ifdef HAVE_SYS_PROC_H -+#include -+#include "sys/proc.h" -+#endif -+#if HAVE_UTMPX_H -+#include -+#else -+#include -+#endif -+ -+#ifdef linux -+#ifdef HAVE_LINUX_TASKS_H -+#include -+#else -+/* -+ * If this file doesn't exist, then there is no hard limit on the number -+ * of processes, so return 0 for velocitySystemMaxProcesses. -+ */ -+#define NR_TASKS 0 -+#endif -+#endif -+ -+#if defined(hpux10) || defined(hpux11) -+#include -+#endif -+ -+#ifdef HAVE_SYS_SYSCTL_H -+#include -+#endif -+ -+#if !defined(UTMP_FILE) && defined(_PATH_UTMP) -+#define UTMP_FILE _PATH_UTMP -+#endif -+ -+#if defined(UTMP_FILE) && !HAVE_UTMPX_H -+void setutent(void); -+void endutent(void); -+struct utmp *getutent(void); -+#endif /* UTMP_FILE */ -+ -+ -+ /********************* -+ * -+ * Kernel & interface information, -+ * and internal forward declarations -+ * -+ *********************/ -+ -+static int get_load_dev(void); -+static int count_users(void); -+extern int count_processes(void); -+ -+ -+ /********************* -+ * -+ * Initialisation & common implementation functions -+ * -+ *********************/ -+ -+#define VELOCITYSYS_UPTIME 1 -+#define VELOCITYSYS_DATE 2 -+#define VELOCITYSYS_LOAD_DEV 3 -+#define VELOCITYSYS_LOAD_PARAM 4 -+#define VELOCITYSYS_USERS 5 -+#define VELOCITYSYS_PROCS 6 -+#define VELOCITYSYS_MAXPROCS 7 -+#define VELOCITYSYS_PAGEIN 8 -+#define VELOCITYSYS_PAGEOUT 9 -+#define VELOCITYSYS_SWAPIN 10 -+#define VELOCITYSYS_SWAPOUT 11 -+#define VELOCITYSYS_INTR 12 -+#define VELOCITYSYS_CTXT 13 -+#define VELOCITYSYS_PROCTOTAL 14 -+ -+#define VELOCITY_TYPE_PAGE 101 -+#define VELOCITY_TYPE_INTR 102 -+#define VELOCITY_TYPE_CTXT 103 -+#define VELOCITY_TYPE_SWAP 104 -+#define VELOCITY_TYPE_PROCTOTAL 105 -+ -+#define VELOCITY_IN 200 -+#define VELOCITY_OUT 201 -+ -+struct variable2 velocitysystem_variables[] = { -+ {VELOCITYSYS_UPTIME, ASN_TIMETICKS, RONLY, var_velocitysys, 1, {1}}, -+ {VELOCITYSYS_DATE, ASN_OCTET_STR, RONLY, var_velocitysys, 1, {2}}, -+ {VELOCITYSYS_LOAD_DEV, ASN_INTEGER, RONLY, var_velocitysys, 1, {3}}, -+ {VELOCITYSYS_LOAD_PARAM, ASN_OCTET_STR, RONLY, var_velocitysys, 1, {4}}, -+ {VELOCITYSYS_USERS, ASN_GAUGE, RONLY, var_velocitysys, 1, {5}}, -+ {VELOCITYSYS_PROCS, ASN_GAUGE, RONLY, var_velocitysys, 1, {6}}, -+ {VELOCITYSYS_MAXPROCS, ASN_INTEGER, RONLY, var_velocitysys, 1, {7}}, -+ {VELOCITYSYS_PAGEIN, ASN_INTEGER, RONLY, var_velocitysys, 1, {8}}, -+ {VELOCITYSYS_PAGEOUT, ASN_INTEGER, RONLY, var_velocitysys, 1, {9}}, -+ {VELOCITYSYS_SWAPIN, ASN_INTEGER, RONLY, var_velocitysys, 1, {10}}, -+ {VELOCITYSYS_SWAPOUT, ASN_INTEGER, RONLY, var_velocitysys, 1, {11}}, -+ {VELOCITYSYS_INTR, ASN_INTEGER, RONLY, var_velocitysys, 1, {12}}, -+ {VELOCITYSYS_CTXT, ASN_INTEGER, RONLY, var_velocitysys, 1, {13}}, -+ {VELOCITYSYS_PROCTOTAL, ASN_INTEGER, RONLY, var_velocitysys, 1, {14}} -+}; -+oid velocitysystem_variables_oid[] = { 1, 3, 6, 1, 4, 1, 15601, 1 }; -+ -+#ifdef linux -+int linux_stat(int, int); -+#endif -+ -+ -+ -+void -+init_velocity_system(void) -+{ -+#ifdef NPROC_SYMBOL -+ auto_nlist(NPROC_SYMBOL, 0, 0); -+#endif -+ -+ REGISTER_MIB("velocity/velocity_system", velocitysystem_variables, variable2, -+ velocitysystem_variables_oid); -+} -+ -+/* -+ * header_velocitysys(... -+ * Arguments: -+ * vp IN - pointer to variable entry that points here -+ * name IN/OUT - IN/name requested, OUT/name found -+ * length IN/OUT - length of IN/OUT oid's -+ * exact IN - TRUE if an exact match was requested -+ * var_len OUT - length of variable or 0 if function returned -+ * write_method -+ */ -+ -+int -+header_velocitysys(struct variable *vp, -+ oid * name, -+ size_t * length, -+ int exact, size_t * var_len, WriteMethod ** write_method) -+{ -+#define VELOCITYSYS_NAME_LENGTH 9 -+ oid newname[MAX_OID_LEN]; -+ int result; -+ -+ DEBUGMSGTL(("velocity/velocity_system", "var_velocitysys: ")); -+ DEBUGMSGOID(("velocity/velocity_system", name, *length)); -+ DEBUGMSG(("velocity/velocity_system", " %d\n", exact)); -+ -+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid)); -+ newname[VELOCITYSYS_NAME_LENGTH] = 0; -+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1); -+ if ((exact && (result != 0)) || (!exact && (result >= 0))) -+ return (MATCH_FAILED); -+ memcpy((char *) name, (char *) newname, -+ (vp->namelen + 1) * sizeof(oid)); -+ *length = vp->namelen + 1; -+ -+ *write_method = 0; -+ *var_len = sizeof(long); /* default to 'long' results */ -+ return (MATCH_SUCCEEDED); -+} -+ -+int -+linux_stat(int stat_type, int in_or_out) -+{ -+ FILE *fp; -+ char buf[100]; -+ int in = -1, out = -1; -+ -+ if ((fp = fopen("/proc/stat", "r")) == NULL) -+ return -1; -+ -+ while (fgets(buf, sizeof(buf), fp) != NULL) { -+ if ((!strncmp(buf, "page", 4) && stat_type == VELOCITY_TYPE_PAGE) || -+ (!strncmp(buf, "intr", 4) && stat_type == VELOCITY_TYPE_INTR) || -+ (!strncmp(buf, "ctxt", 4) && stat_type == VELOCITY_TYPE_CTXT) || -+ (!strncmp(buf, "processes", 9) && stat_type == VELOCITY_TYPE_PROCTOTAL) || -+ (!strncmp(buf, "swap", 4) && stat_type == VELOCITY_TYPE_SWAP)) { -+ sscanf(buf, "%*s %d %d", &in, &out); -+ DEBUGMSGTL(("string found", " %s type - %d\n", buf, stat_type)); -+ break; -+ } -+ else { -+ DEBUGMSGTL(("string not found", " %s type - %d\n", buf, stat_type )); -+ } -+ } -+ -+ fclose(fp); -+ return (in_or_out == VELOCITY_IN ? in : out); -+ -+} -+ -+ -+ -+ /********************* -+ * -+ * System specific implementation functions -+ * -+ *********************/ -+ -+u_char * -+var_velocitysys(struct variable * vp, -+ oid * name, -+ size_t * length, -+ int exact, size_t * var_len, WriteMethod ** write_method) -+{ -+ static char string[100]; -+ time_t now; -+#ifndef NR_TASKS -+ int nproc = 0; -+#endif -+#ifdef linux -+ FILE *fp; -+#endif -+#if CAN_USE_SYSCTL && defined(CTL_KERN) && defined(KERN_MAXPROC) -+ static int maxproc_mib[] = { CTL_KERN, KERN_MAXPROC }; -+ int buf_size; -+#endif -+#if defined(hpux10) || defined(hpux11) -+ struct pst_static pst_buf; -+#endif -+ -+ if (header_velocitysys(vp, name, length, exact, var_len, write_method) == -+ MATCH_FAILED) -+ return NULL; -+ -+ switch (vp->magic) { -+ case VELOCITYSYS_UPTIME: -+ long_return = get_uptime(); -+ return (u_char *) & long_return; -+ case VELOCITYSYS_DATE: -+ (void *) time(&now); -+ return (u_char *) date_n_time(&now, var_len); -+ case VELOCITYSYS_LOAD_DEV: -+ long_return = get_load_dev(); -+ return (u_char *) & long_return; -+ case VELOCITYSYS_LOAD_PARAM: -+#ifdef linux -+ fp = fopen("/proc/cmdline", "r"); -+ fgets(string, sizeof(string), fp); -+ fclose(fp); -+#else -+#if NO_DUMMY_VALUES -+ return NULL; -+#endif -+ sprintf(string, "ask Dave"); /* XXX */ -+#endif -+ *var_len = strlen(string); -+ return (u_char *) string; -+ case VELOCITYSYS_PAGEIN: -+ long_return = linux_stat(VELOCITY_TYPE_PAGE,VELOCITY_IN); -+ return (u_char *) & long_return; -+ case VELOCITYSYS_PAGEOUT: -+ long_return = linux_stat(VELOCITY_TYPE_PAGE,VELOCITY_OUT); -+ return (u_char *) & long_return; -+ case VELOCITYSYS_SWAPIN: -+ long_return = linux_stat(VELOCITY_TYPE_SWAP,VELOCITY_IN); -+ return (u_char *) & long_return; -+ case VELOCITYSYS_SWAPOUT: -+ long_return = linux_stat(VELOCITY_TYPE_SWAP,VELOCITY_OUT); -+ return (u_char *) & long_return; -+ case VELOCITYSYS_CTXT: -+ long_return = linux_stat(VELOCITY_TYPE_CTXT,VELOCITY_IN); -+ return (u_char *) & long_return; -+ case VELOCITYSYS_PROCTOTAL: -+ long_return = linux_stat(VELOCITY_TYPE_PROCTOTAL,VELOCITY_IN); -+ return (u_char *) & long_return; -+ case VELOCITYSYS_INTR: -+#ifdef linux -+ long_return = linux_stat(VELOCITY_TYPE_INTR,VELOCITY_IN); -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSYS_USERS: -+ long_return = count_users(); -+ return (u_char *) & long_return; -+ case VELOCITYSYS_PROCS: -+#if USING_VELOCITY_VELOCITY_SWRUN_MODULE -+ long_return = count_processes(); -+#else -+#if NO_DUMMY_VALUES -+ return NULL; -+#endif -+ long_return = 0; -+#endif -+ return (u_char *) & long_return; -+ case VELOCITYSYS_MAXPROCS: -+#if defined(NR_TASKS) -+ long_return = NR_TASKS; /* */ -+#elif CAN_USE_SYSCTL && defined(CTL_KERN) && defined(KERN_MAXPROC) -+ buf_size = sizeof(nproc); -+ if (sysctl(maxproc_mib, 2, &nproc, &buf_size, NULL, 0) < 0) -+ return NULL; -+ long_return = nproc; -+#elif defined(hpux10) || defined(hpux11) -+ pstat_getstatic(&pst_buf, sizeof(struct pst_static), 1, 0); -+ long_return = pst_buf.max_proc; -+#elif defined(NPROC_SYMBOL) -+ auto_nlist(NPROC_SYMBOL, (char *) &nproc, sizeof(int)); -+ long_return = nproc; -+#else -+#if NO_DUMMY_VALUES -+ return NULL; -+#endif -+ long_return = 0; -+#endif -+ return (u_char *) & long_return; -+ default: -+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_velocitysys\n", -+ vp->magic)); -+ } -+ return NULL; -+} -+ -+ -+ /********************* -+ * -+ * Internal implementation functions -+ * -+ *********************/ -+ -+ /* -+ * Return the DeviceIndex corresponding -+ * to the boot device -+ */ -+static int -+get_load_dev(void) -+{ -+ return (HRDEV_DISK << HRDEV_TYPE_SHIFT); /* XXX */ -+} -+ -+static int -+count_users(void) -+{ -+ int total = 0; -+#if HAVE_UTMPX_H -+#define setutent setutxent -+#define getutent getutxent -+#define endutent endutxent -+ struct utmpx *utmp_p; -+#else -+ struct utmp *utmp_p; -+#endif -+ -+ setutent(); -+ while ((utmp_p = getutent()) != NULL) { -+#ifndef UTMP_HAS_NO_TYPE -+ if (utmp_p->ut_type == USER_PROCESS) -+#endif -+ ++total; -+ } -+ endutent(); -+ return total; -+} -+ -+#if defined(UTMP_FILE) && !HAVE_UTMPX_H -+ -+static FILE *utmp_file; -+static struct utmp utmp_rec; -+ -+void -+setutent(void) -+{ -+ if (utmp_file) -+ fclose(utmp_file); -+ utmp_file = fopen(UTMP_FILE, "r"); -+} -+ -+void -+endutent(void) -+{ -+ if (utmp_file) { -+ fclose(utmp_file); -+ utmp_file = NULL; -+ } -+} -+ -+struct utmp * -+getutent(void) -+{ -+ if (!utmp_file) -+ return NULL; -+ while (fread(&utmp_rec, sizeof(utmp_rec), 1, utmp_file) == 1) -+ if (*utmp_rec.ut_name && *utmp_rec.ut_line) -+ return &utmp_rec; -+ return NULL; -+} -+ -+#endif /* UTMP_FILE */ -Index: net-snmp-5.7.2/agent/mibgroup/velocity/velocity_system.h -=================================================================== ---- /dev/null -+++ net-snmp-5.7.2/agent/mibgroup/velocity/velocity_system.h -@@ -0,0 +1,12 @@ -+/* -+ * Velocity MIB - system group interface - velocity_system.h -+ * -+ */ -+#ifndef _MIBGROUP_VELOCITYSYSTEM_H -+#define _MIBGROUP_VELOCITYSYSTEM_H -+ -+extern void init_velocity_system(void); -+extern FindVarMethod var_velocitysys; -+ -+ -+#endif /* _MIBGROUP_VELOCITYSYSTEM_H */ -Index: net-snmp-5.7.2/mibs/VELOCITY-MIB.txt -=================================================================== ---- /dev/null -+++ net-snmp-5.7.2/mibs/VELOCITY-MIB.txt -@@ -0,0 +1,671 @@ -+VELOCITY-MIB DEFINITIONS ::= BEGIN -+ -+IMPORTS -+MODULE-IDENTITY, OBJECT-TYPE, mib-2, -+Integer32, Counter32, Gauge32, TimeTicks, enterprises FROM SNMPv2-SMI -+ -+TEXTUAL-CONVENTION, DisplayString, -+TruthValue, DateAndTime, AutonomousType FROM SNMPv2-TC -+ -+MODULE-COMPLIANCE, OBJECT-GROUP FROM SNMPv2-CONF -+ -+InterfaceIndexOrZero FROM IF-MIB; -+ -+velocityMibModule MODULE-IDENTITY -+ LAST-UPDATED "200607310000Z" -- 31 July 2006 -+ ORGANIZATION "Velocity Software Inc." -+ CONTACT-INFO -+ "Dennis Andrews -+ Postal: Velocity Software, Inc. -+ 106-D Castro St. -+ Mountain View, CA 94041 -+ USA -+ Phone: 650-964-8867 -+ Fax: 650-964-9012 -+ Email: dennis@velocitysoftware.com" -+ DESCRIPTION -+ "This MIB is an extension of the host MIB. This MIB currently -+ only runs on linux. This is the original version." -+ ::= { velocityMIBAdminInfo 1 } -+ -+velocity OBJECT IDENTIFIER ::= { enterprises 15601 } -+ -+velocitySystem OBJECT IDENTIFIER ::= { velocity 1 } -+velocitySWRun OBJECT IDENTIFIER ::= { velocity 4 } -+velocitySWRunPerf OBJECT IDENTIFIER ::= { velocity 5 } -+velocityAppTable OBJECT IDENTIFIER ::= { velocity 6 } -+velocityMIBAdminInfo OBJECT IDENTIFIER ::= { velocity 7 } -+ -+-- The Host Resources System Group -+ -+velocitySystemUptime OBJECT-TYPE -+ SYNTAX TimeTicks -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The amount of time since this host was last -+ initialized. Note that this is different from -+ sysUpTime in the SNMPv2-MIB [RFC1907] because -+ sysUpTime is the uptime of the network management -+ portion of the system." -+ ::= { velocitySystem 1 } -+ -+velocitySystemDate OBJECT-TYPE -+ SYNTAX DateAndTime -+ MAX-ACCESS read-write -+ STATUS current -+ DESCRIPTION -+ "The host's notion of the local date and time of day." -+ ::= { velocitySystem 2 } -+ -+velocitySystemInitialLoadDevice OBJECT-TYPE -+ SYNTAX Integer32 (1..2147483647) -+ MAX-ACCESS read-write -+ STATUS current -+ DESCRIPTION -+ "The index of the velocityDeviceEntry for the device from -+ which this host is configured to load its initial -+ operating system configuration (i.e., which operating -+ system code and/or boot parameters). -+ -+ Note that writing to this object just changes the -+ configuration that will be used the next time the -+ operating system is loaded and does not actually cause -+ the reload to occur." -+ ::= { velocitySystem 3 } -+ -+velocitySystemInitialLoadParameters OBJECT-TYPE -+ SYNTAX InternationalDisplayString (SIZE (0..128)) -+ MAX-ACCESS read-write -+ STATUS current -+ DESCRIPTION -+ "This object contains the parameters (e.g. a pathname -+ and parameter) supplied to the load device when -+ requesting the initial operating system configuration -+ from that device. -+ -+ Note that writing to this object just changes the -+ configuration that will be used the next time the -+ operating system is loaded and does not actually cause -+ the reload to occur." -+ ::= { velocitySystem 4 } -+ -+velocitySystemNumUsers OBJECT-TYPE -+ SYNTAX Gauge32 -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of user sessions for which this host is -+ storing state information. A session is a collection -+ of processes requiring a single act of user -+ authentication and possibly subject to collective job -+ control." -+ ::= { velocitySystem 5 } -+ -+velocitySystemProcesses OBJECT-TYPE -+ SYNTAX Gauge32 -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of process contexts currently loaded or -+ running on this system." -+ ::= { velocitySystem 6 } -+ -+velocitySystemMaxProcesses OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The maximum number of process contexts this system -+ can support. If there is no fixed maximum, the value -+ should be zero. On systems that have a fixed maximum, -+ this object can help diagnose failures that occur when -+ this maximum is reached." -+ ::= { velocitySystem 7 } -+ -+velocitySystemPageIn OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "Total number of pages that the system paged in" -+ ::= { velocitySystem 8 } -+ -+velocitySystemPageOut OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "Total number of pages that the system paged out" -+ ::= { velocitySystem 9 } -+ -+velocitySystemSwapIn OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "Total number of swap pages that have been brought in" -+ ::= { velocitySystem 10 } -+ -+velocitySystemSwapOut OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "Total number of swap pages that have been swapped out" -+ ::= { velocitySystem 11 } -+ -+velocitySystemInterupts OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "Total number of interupts since system boot" -+ ::= { velocitySystem 12 } -+ -+velocitySystemContext OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "Total number of context switches the system had done." -+ ::= { velocitySystem 13 } -+ -+velocitySystemProcessTotal OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "Total number of processes the system has started since boot." -+ ::= { velocitySystem 14 } -+ -+ -+ -+ -+-- The Velocity Running Software Group -+-- -+-- The velocitySWRunTable contains an entry for each distinct piece of -+-- software that is running or loaded into physical or virtual -+-- memory in preparation for running. This includes the velocity's -+-- operating system, device drivers, and applications. -+ -+velocitySWOSIndex OBJECT-TYPE -+ SYNTAX Integer32 (1..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The value of the velocitySWRunIndex for the velocitySWRunEntry -+ that represents the primary operating system running -+ on this velocity. This object is useful for quickly and -+ uniquely identifying that primary operating system." -+ ::= { velocitySWRun 1 } -+ -+velocitySWRunTable OBJECT-TYPE -+ SYNTAX SEQUENCE OF VelocitySWRunEntry -+ MAX-ACCESS not-accessible -+ STATUS current -+ DESCRIPTION -+ "The (conceptual) table of software running on the -+ velocity." -+ ::= { velocitySWRun 2 } -+ -+velocitySWRunEntry OBJECT-TYPE -+ SYNTAX VelocitySWRunEntry -+ MAX-ACCESS not-accessible -+ STATUS current -+ DESCRIPTION -+ "A (conceptual) entry for one piece of software -+ running on the velocity Note that because the installed -+ software table only contains information for software -+ stored locally on this velocity, not every piece of -+ running software will be found in the installed -+ software table. This is true of software that was -+ loaded and run from a non-local source, such as a -+ network-mounted file system. -+ -+ As an example of how objects in this table are named, -+ an instance of the velocitySWRunName object might be named -+ velocitySWRunName.1287" -+ INDEX { velocitySWRunIndex } -+ ::= { velocitySWRunTable 1 } -+ -+VelocitySWRunEntry ::= SEQUENCE { -+ velocitySWRunIndex Integer32, -+ velocitySWRunName InternationalDisplayString, -+ velocitySWRunID ProductID, -+ velocitySWRunPath InternationalDisplayString, -+ velocitySWRunParameters InternationalDisplayString, -+ velocitySWRunType INTEGER, -+ velocitySWRunStatus INTEGER, -+ velocitySWRunPPID Integer32, -+ velocitySWRunPGRP Integer32 -+ } -+ -+velocitySWRunIndex OBJECT-TYPE -+ SYNTAX Integer32 (1..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "A unique value for each piece of software running on -+ the velocity. Wherever possible, this should be the -+ system's native, unique identification number." -+ ::= { velocitySWRunEntry 1 } -+ -+velocitySWRunName OBJECT-TYPE -+ SYNTAX InternationalDisplayString (SIZE (0..64)) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "A textual description of this running piece of -+ software, including the manufacturer, revision, and -+ the name by which it is commonly known. If this -+ software was installed locally, this should be the -+ same string as used in the corresponding -+ velocitySWInstalledName." -+ ::= { velocitySWRunEntry 2 } -+ -+velocitySWRunID OBJECT-TYPE -+ SYNTAX ProductID -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The product ID of this running piece of software." -+ ::= { velocitySWRunEntry 3 } -+ -+velocitySWRunPath OBJECT-TYPE -+ SYNTAX InternationalDisplayString (SIZE(0..128)) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "A description of the location on long-term storage -+ (e.g. a disk drive) from which this software was -+ loaded." -+ ::= { velocitySWRunEntry 4 } -+ -+velocitySWRunParameters OBJECT-TYPE -+ SYNTAX InternationalDisplayString (SIZE(0..128)) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "A description of the parameters supplied to this -+ software when it was initially loaded." -+ ::= { velocitySWRunEntry 5 } -+ -+velocitySWRunType OBJECT-TYPE -+ SYNTAX INTEGER { -+ unknown(1), -+ operatingSystem(2), -+ deviceDriver(3), -+ application(4) -+ } -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The type of this software." -+ ::= { velocitySWRunEntry 6 } -+ -+velocitySWRunStatus OBJECT-TYPE -+ SYNTAX INTEGER { -+ running(1), -+ runnable(2), -- waiting for resource -+ -- (i.e., CPU, memory, IO) -+ notRunnable(3), -- loaded but waiting for event -+ invalid(4) -- not loaded -+ } -+ MAX-ACCESS read-write -+ STATUS current -+ DESCRIPTION -+ "The status of this running piece of software. -+ Setting this value to invalid(4) shall cause this -+ software to stop running and to be unloaded. Sets to -+ other values are not valid." -+ ::= { velocitySWRunEntry 7 } -+ -+velocitySWRunPPID OBJECT-TYPE -+ SYNTAX Integer32 (1..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The ID of the parent process." -+ ::= { velocitySWRunEntry 8 } -+ -+velocitySWRunPGRP OBJECT-TYPE -+ SYNTAX Integer32 (1..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The ID of the process group that the process belongs to." -+ ::= { velocitySWRunEntry 9 } -+ -+ -+-- The Velocity Resources Running Software Performance Group -+-- -+-- The velocitySWRunPerfTable contains an entry corresponding to -+-- each entry in the velocitySWRunTable. -+ -+velocitySWRunPerfTable OBJECT-TYPE -+ SYNTAX SEQUENCE OF VelocitySWRunPerfEntry -+ MAX-ACCESS not-accessible -+ STATUS current -+ DESCRIPTION -+ "The (conceptual) table of running software -+ performance metrics." -+ ::= { velocitySWRunPerf 1 } -+ -+velocitySWRunPerfEntry OBJECT-TYPE -+ SYNTAX VelocitySWRunPerfEntry -+ MAX-ACCESS not-accessible -+ STATUS current -+ DESCRIPTION -+ "A (conceptual) entry containing software performance -+ metrics. As an example, an instance of the -+ velocitySWRunPerfCPU object might be named -+ velocitySWRunPerfCPU.1287" -+ AUGMENTS { velocitySWRunEntry } -- This table augments information in -+ -- the velocitySWRunTable. -+ ::= { velocitySWRunPerfTable 1 } -+ -+VelocitySWRunPerfEntry ::= SEQUENCE { -+ velocitySWRunPerfCPUUser Integer32, -+ velocitySWRunPerfCPUSys Integer32, -+ velocitySWRunPerfMem KBytes, -+ velocitySWRunPerfCPUCummUser Integer32, -+ velocitySWRunPerfCPUCummSys Integer32, -+ velocitySWRunPerfMinFault Integer32, -+ velocitySWRunPerfMajFault Integer32, -+ velocitySWRunPerfMinFaultCumm Integer32, -+ velocitySWRunPerfMajFaultCumm Integer32, -+ velocitySWRunPerfRss Integer32, -+ velocitySWRunPerfPrio Integer32, -+ velocitySWRunPerfAll InternationalDisplayString, -+ velocitySWRunPerfUID InternationalDisplayString, -+ velocitySWRunPerfUName InternationalDisplayString -+} -+ -+velocitySWRunPerfCPUUser OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of centi-seconds of the User's CPU -+ resources consumed by this process. Note that on a -+ multi-processor system, this value may increment by -+ more than one centi-second in one centi-second of real -+ (wall clock) time." -+ ::= { velocitySWRunPerfEntry 1 } -+ -+velocitySWRunPerfCPUSys OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of centi-seconds of the system's CPU -+ resources consumed by this process. Note that on a -+ multi-processor system, this value may increment by -+ more than one centi-second in one centi-second of real -+ (wall clock) time." -+ ::= { velocitySWRunPerfEntry 2 } -+ -+velocitySWRunPerfMem OBJECT-TYPE -+ SYNTAX KBytes -+ UNITS "KBytes" -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The total amount of real system memory allocated to -+ this process." -+ ::= { velocitySWRunPerfEntry 3 } -+ -+velocitySWRunPerfCPUCummUser OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of cummulative centi-seconds of the total user's CPU -+ resources consumed by this process. Note that on a -+ multi-processor system, this value may increment by -+ more than one centi-second in one centi-second of real -+ (wall clock) time." -+ ::= { velocitySWRunPerfEntry 4 } -+ -+velocitySWRunPerfCPUCummSys OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of cummulative centi-seconds of the total system's CPU -+ resources consumed by this process. Note that on a -+ multi-processor system, this value may increment by -+ more than one centi-second in one centi-second of real -+ (wall clock) time." -+ ::= { velocitySWRunPerfEntry 5 } -+ -+velocitySWRunPerfMinFault OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of minor page faults. (Those that have not -+ required loading a page from disk.)" -+ ::= { velocitySWRunPerfEntry 6 } -+ -+velocitySWRunPerfMajFault OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of major page faults. (Those that have -+ required loading a page from disk.)" -+ ::= { velocitySWRunPerfEntry 7 } -+ -+velocitySWRunPerfMinFaultCumm OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of minor page faults for this process and its -+ children. (Those that have not required loading a page -+ from disk.)" -+ ::= { velocitySWRunPerfEntry 8 } -+ -+velocitySWRunPerfMajFaultCumm OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of major page faults. for this process and its -+ children. (Those that have required loading a page from disk.)" -+ ::= { velocitySWRunPerfEntry 9 } -+ -+velocitySWRunPerfRss OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of pages in real memory minus 3 for administrative -+ purposes. This is just the pages which count towards text, -+ data, or stack space. This does not include pages which -+ have not been demand-loaded in, or which are swapped out." -+ ::= { velocitySWRunPerfEntry 10 } -+ -+velocitySWRunPerfPrio OBJECT-TYPE -+ SYNTAX Integer32 (0..2147483647) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The standard nice value, plus fifteen. The value is never -+ negative in the kernel." -+ ::= { velocitySWRunPerfEntry 11 } -+ -+velocitySWRunPerfAll OBJECT-TYPE -+ SYNTAX InternationalDisplayString (SIZE (0..256)) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The complete information from the stat file for the given process" -+ ::= { velocitySWRunPerfEntry 12 } -+ -+velocitySWRunPerfUID OBJECT-TYPE -+ SYNTAX InternationalDisplayString (SIZE(0..128)) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The owning user ID and group ID of this process." -+ ::= { velocitySWRunPerfEntry 13 } -+ -+velocitySWRunPerfUName OBJECT-TYPE -+ SYNTAX InternationalDisplayString (SIZE(0..128)) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The name of the owning user ID and group of this process." -+ ::= { velocitySWRunPerfEntry 14 } -+ -+velocityAppTable OBJECT-TYPE -+ SYNTAX SEQUENCE OF AppEntry -+ MAX-ACCESS not-accessible -+ STATUS current -+ DESCRIPTION -+ "A table containing a list of applications that are of special -+ interest. The process table is searched for the given string -+ that identifies the given process(s). Other than being able to -+ return the process ids of interest this is the same MIB is the -+ UCD-snmp proc MIB. " -+ ::= { velocity 6 } -+ -+velocityAppEntry OBJECT-TYPE -+ SYNTAX velocityAppEntry -+ MAX-ACCESS not-accessible -+ STATUS current -+ DESCRIPTION -+ "An entry containing an application and its statistics." -+ INDEX { appIndex } -+ ::= { velocityAppTable 1 } -+ -+velocityAppEntry ::= SEQUENCE { -+ velocityAppIndex Integer32, -+ velocityAppNames DisplayString, -+ velocityAppPid DisplayString, -+ velocityAppMin Integer32, -+ velocityAppMax Integer32, -+ velocityAppCount Integer32, -+ velocityAppIds DisplayString, -+ velocityAppErrorFlag Integer32, -+ velocityAppErrMessage DisplayString -+} -+ -+velocityAppIndex OBJECT-TYPE -+ SYNTAX Integer32 (0..65535) -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "Reference Index for each observed application." -+ ::= { velocityAppEntry 1 } -+ -+velocityAppNames OBJECT-TYPE -+ SYNTAX DisplayString -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The application name we're counting/checking on." -+ ::= { velocityAppEntry 2 } -+ -+velocityAppPid OBJECT-TYPE -+ SYNTAX DisplayString -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The absolute location of the PID file for the application." -+ ::= { velocityAppEntry 3 } -+ -+velocityAppMin OBJECT-TYPE -+ SYNTAX Integer32 -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The minimum number of processes for that applicationes that should be -+ running. An error flag is generated if the number of -+ running processes is < the minimum." -+ ::= { velocityAppEntry 4 } -+ -+velocityAppMax OBJECT-TYPE -+ SYNTAX Integer32 -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The maximum number of processes for that application that should be -+ running. An error flag is generated if the number of -+ running processes is > the maximum." -+ ::= { velocityAppEntry 5 } -+ -+velocityAppCount OBJECT-TYPE -+ SYNTAX Integer32 -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The number of current applications running with the name -+ in question." -+ ::= { velocityAppEntry 6 } -+ -+velocityAppIds OBJECT-TYPE -+ SYNTAX DisplayString -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "The list of process Ids that match the Application name." -+ ::= { velocityAppEntry 7 } -+ -+velocityAppErrorFlag OBJECT-TYPE -+ SYNTAX Integer32 -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "A Error flag to indicate trouble with a application. It -+ goes to 1 if there is an error, 0 if no error." -+ ::= { velocityAppEntry 100 } -+ -+velocityAppErrMessage OBJECT-TYPE -+ SYNTAX DisplayString -+ MAX-ACCESS read-only -+ STATUS current -+ DESCRIPTION -+ "An error message describing the problem (if one exists)." -+ ::= { velocityAppEntry 101 } -+ -+velocityMIBCompliances OBJECT IDENTIFIER ::= { velocityMIBAdminInfo 2 } -+velocityMIBGroups OBJECT IDENTIFIER ::= { velocityMIBAdminInfo 3 } -+ -+ velocitySystemGroup OBJECT-GROUP -+ OBJECTS { -+ velocitySystemUptime, velocitySystemDate, -+ velocitySystemInitialLoadDevice, -+ velocitySystemInitialLoadParameters, -+ velocitySystemNumUsers, velocitySystemProcesses, -+ velocitySystemMaxProcesses -+ } -+ STATUS current -+ DESCRIPTION -+ "The Velocity System Group." -+ ::= { velocityMIBGroups 1 } -+ -+ velocitySWRunGroup OBJECT-GROUP -+ OBJECTS { -+ velocitySWOSIndex, velocitySWRunIndex, velocitySWRunName, -+ velocitySWRunID, velocitySWRunPath, velocitySWRunParameters, -+ velocitySWRunType, velocitySWRunStatus, velocitySWRunPPID, -+ velocitySWRunPGRP -+ } -+ STATUS current -+ DESCRIPTION -+ "The Velocity Resources Running Software Group." -+ ::= { velocityMIBGroups 4 } -+ -+ velocitySWRunPerfGroup OBJECT-GROUP -+ OBJECTS { velocitySWRunPerfCPUUser, velocitySWRunPerfCPUSys, velocitySWRunPerfMem, velocitySWRunPerfCPUCummUser, velocitySWRunPerfCPUCummSys } -+ STATUS current -+ DESCRIPTION -+ "The Velocity Resources Running Software -+ Performance Group." -+ ::= { velocityMIBGroups 5 } -+ -+END -Index: net-snmp-5.7.2/mibs/VELOCITY-TYPES.txt -=================================================================== ---- /dev/null -+++ net-snmp-5.7.2/mibs/VELOCITY-TYPES.txt -@@ -0,0 +1,23 @@ -+VELOCITY-TYPES DEFINITIONS ::= BEGIN -+ -+IMPORTS -+ MODULE-IDENTITY, OBJECT-IDENTITY FROM SNMPv2-SMI -+ -+velocityMibModule MODULE-IDENTITY -+ LAST-UPDATED "200607310000Z" -- 31 July 2006 -+ ORGANIZATION "Velocity Software Inc." -+ CONTACT-INFO -+ "Dennis Andrews -+ Postal: Velocity Software, Inc. -+ 106-D Castro St. -+ Mountain View, CA 94041 -+ USA -+ Phone: 650-964-8867 -+ Fax: 650-964-9012 -+ Email: dennis@velocitysoftware.com" -+ DESCRIPTION -+ "This MIB is an extension of the host MIB. This MIB currently -+ only runs on linux. This is the original version." -+ ::= { velocityMIBAdminInfo 4 } -+ -+END diff --git a/net-snmp-5.9.3-disallow_SET_requests_with_NULL_varbind.patch b/net-snmp-5.9.3-disallow_SET_requests_with_NULL_varbind.patch deleted file mode 100644 index 8dec992..0000000 --- a/net-snmp-5.9.3-disallow_SET_requests_with_NULL_varbind.patch +++ /dev/null @@ -1,94 +0,0 @@ -diff -Nurp net-snmp-5.9.3-orig/agent/snmp_agent.c net-snmp-5.9.3/agent/snmp_agent.c ---- net-snmp-5.9.3-orig/agent/snmp_agent.c 2022-07-13 23:14:14.000000000 +0200 -+++ net-snmp-5.9.3/agent/snmp_agent.c 2023-01-05 12:44:03.533604744 +0100 -@@ -3719,12 +3719,44 @@ netsnmp_handle_request(netsnmp_agent_ses - return 1; - } - -+static int -+check_set_pdu_for_null_varbind(netsnmp_agent_session *asp) -+{ -+ int i; -+ netsnmp_variable_list *v = NULL; -+ -+ for (i = 1, v = asp->pdu->variables; v != NULL; i++, v = v->next_variable) { -+ if (v->type == ASN_NULL) { -+ /* -+ * Protect SET implementations that do not protect themselves -+ * against wrong type. -+ */ -+ DEBUGMSGTL(("snmp_agent", "disallowing SET with NULL var for varbind %d\n", i)); -+ asp->index = i; -+ return SNMP_ERR_WRONGTYPE; -+ } -+ } -+ return SNMP_ERR_NOERROR; -+} -+ - int - handle_pdu(netsnmp_agent_session *asp) - { - int status, inclusives = 0; - netsnmp_variable_list *v = NULL; - -+#ifndef NETSNMP_NO_WRITE_SUPPORT -+ /* -+ * Check for ASN_NULL in SET request -+ */ -+ if (asp->pdu->command == SNMP_MSG_SET) { -+ status = check_set_pdu_for_null_varbind(asp); -+ if (status != SNMP_ERR_NOERROR) { -+ return status; -+ } -+ } -+#endif /* NETSNMP_NO_WRITE_SUPPORT */ -+ - /* - * for illegal requests, mark all nodes as ASN_NULL - */ -diff -Nurp net-snmp-5.9.3-orig/apps/snmpset.c net-snmp-5.9.3/apps/snmpset.c ---- net-snmp-5.9.3-orig/apps/snmpset.c 2022-07-13 23:14:14.000000000 +0200 -+++ net-snmp-5.9.3/apps/snmpset.c 2023-01-05 12:44:06.377533268 +0100 -@@ -182,6 +182,7 @@ main(int argc, char *argv[]) - case 'x': - case 'd': - case 'b': -+ case 'n': /* undocumented */ - #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES - case 'I': - case 'U': -diff -Nurp net-snmp-5.9.3-orig/testing/fulltests/default/T0142snmpv2csetnull_simple net-snmp-5.9.3/testing/fulltests/default/T0142snmpv2csetnull_simple ---- net-snmp-5.9.3-orig/testing/fulltests/default/T0142snmpv2csetnull_simple 1970-01-01 01:00:00.000000000 +0100 -+++ net-snmp-5.9.3/testing/fulltests/default/T0142snmpv2csetnull_simple 2023-01-05 12:44:08.701474860 +0100 -@@ -0,0 +1,31 @@ -+#!/bin/sh -+ -+. ../support/simple_eval_tools.sh -+ -+HEADER SNMPv2c set of system.sysContact.0 with NULL varbind -+ -+SKIPIF NETSNMP_DISABLE_SET_SUPPORT -+SKIPIF NETSNMP_NO_WRITE_SUPPORT -+SKIPIF NETSNMP_DISABLE_SNMPV2C -+SKIPIFNOT USING_MIBII_SYSTEM_MIB_MODULE -+ -+# -+# Begin test -+# -+ -+# standard V2C configuration: testcomunnity -+snmp_write_access='all' -+. ./Sv2cconfig -+STARTAGENT -+ -+CAPTURE "snmpget -On $SNMP_FLAGS -c testcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0" -+ -+CHECK ".1.3.6.1.2.1.1.4.0 = STRING:" -+ -+CAPTURE "snmpset -On $SNMP_FLAGS -c testcommunity -v 2c $SNMP_TRANSPORT_SPEC:$SNMP_TEST_DEST$SNMP_SNMPD_PORT .1.3.6.1.2.1.1.4.0 n x" -+ -+CHECK "Reason: wrongType" -+ -+STOPAGENT -+ -+FINISHED diff --git a/net-snmp-5.9.3-grep.patch b/net-snmp-5.9.3-grep.patch deleted file mode 100644 index f9d8979..0000000 --- a/net-snmp-5.9.3-grep.patch +++ /dev/null @@ -1,333 +0,0 @@ -From 011de0e8fce88702619ba78cc80c900991a8e036 Mon Sep 17 00:00:00 2001 -From: Andreas Stieger -Date: Sun, 2 Oct 2022 16:10:38 +0200 -Subject: [PATCH 02/10] configure: change use of fgrep to AC detected tool - -GNU grep 3.8 started throwing warnings for direct usage, -deprecating it in favour of grep -F - -[ bvanassche: regenerated configure script ] ---- - configure | 4 ++-- - configure.d/config_modules_agent | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/configure b/configure -index 727164eb7..65b99c020 100755 ---- a/configure -+++ b/configure -@@ -22257,8 +22257,8 @@ $as_echo "$NETSNMP_DEFAULT_MIBS" >&6; } - # - - if echo " $agent_module_list " | \ -- fgrep ' agentx/agentx_config ' | \ -- fgrep ' agentx/protocol ' > /dev/null ; then -+ $FGREP ' agentx/agentx_config ' | \ -+ $FGREP ' agentx/protocol ' > /dev/null ; then - NETSNMP_HAVE_AGENTX_LIBS_TRUE='' - NETSNMP_HAVE_AGENTX_LIBS_FALSE='#' - else -diff --git a/configure.d/config_modules_agent b/configure.d/config_modules_agent -index 1132da8d9..0169749d9 100644 ---- a/configure.d/config_modules_agent -+++ b/configure.d/config_modules_agent -@@ -814,8 +814,8 @@ AC_MSG_RESULT($NETSNMP_DEFAULT_MIBS) - # - - if echo " $agent_module_list " | \ -- fgrep ' agentx/agentx_config ' | \ -- fgrep ' agentx/protocol ' > /dev/null ; then -+ $FGREP ' agentx/agentx_config ' | \ -+ $FGREP ' agentx/protocol ' > /dev/null ; then - NETSNMP_HAVE_AGENTX_LIBS_TRUE='' - NETSNMP_HAVE_AGENTX_LIBS_FALSE='#' - else --- -2.37.3 - -From 5ae5ad5234a8e0ef3661fe3ec3c77ae57b156bf5 Mon Sep 17 00:00:00 2001 -From: Andreas Stieger -Date: Sun, 2 Oct 2022 16:34:17 +0200 -Subject: [PATCH 03/10] Makefile.in: change use of egrep to AC detected tool - -GNU grep 3.8 started throwing warnings for direct usage, -deprecating it in favour of grep -E ---- - Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.in b/Makefile.in -index 9b0f0dbac..9fe3781e5 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -119,7 +119,7 @@ agentxtrap snmptrapd: @FEATURETARGS@ - # local build rules - # - sedscript: sedscript.in include/net-snmp/net-snmp-config.h $(srcdir)/agent/mibgroup/mibdefs.h -- $(CPP) $(srcdir)/sedscript.in | egrep '^s[/#]' | sed 's/REMOVEME//g;s# */#/#g;s/ *#/#/g;s#/ *#/#g;s/# g/#g/;' > sedscript -+ $(CPP) $(srcdir)/sedscript.in | ${EGREP} '^s[/#]' | sed 's/REMOVEME//g;s# */#/#g;s/ *#/#/g;s#/ *#/#g;s/# g/#g/;' > sedscript - echo 's/VERSIONINFO/$(VERSION)/g' >> sedscript - echo 's#DATADIR#$(datadir)#g' >> sedscript - echo 's#LIBDIR#$(libdir)#g' >> sedscript --- -2.37.3 - -From 9a577171ce728b97aeb42c455f5d09a2c3e2b51f Mon Sep 17 00:00:00 2001 -From: Andreas Stieger -Date: Sun, 2 Oct 2022 16:35:22 +0200 -Subject: [PATCH 04/10] dist: update instructions and scripts to use grep -E - -GNU grep 3.8 started throwing warnings for direct usage of egrep, -deprecating it in favour of grep -E ---- - dist/RELEASE-INSTRUCTIONS | 2 +- - dist/makerelease.xml | 4 ++-- - dist/net-snmp-solaris-build/buildpackage-solaris | 2 +- - dist/nsb-functions | 4 ++-- - dist/patme | 2 +- - 5 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/dist/RELEASE-INSTRUCTIONS b/dist/RELEASE-INSTRUCTIONS -index 032a0c92e..a38e46a6d 100644 ---- a/dist/RELEASE-INSTRUCTIONS -+++ b/dist/RELEASE-INSTRUCTIONS -@@ -87,7 +87,7 @@ STEP: 1.6: Check for changes - - Commands to execute: - -- svn -u status | egrep '^[^\?]' -+ svn -u status | grep -E '^[^\?]' - - (Leaving Step: 1) - -diff --git a/dist/makerelease.xml b/dist/makerelease.xml -index 0494fd098..f3c8bfa0e 100644 ---- a/dist/makerelease.xml -+++ b/dist/makerelease.xml -@@ -21,7 +21,7 @@ - them before continuing! - - -- find . -name 'net-snmp-5*' | egrep '^[^\?]' -+ find . -name 'net-snmp-5*' | grep -E '^[^\?]' - - - -@@ -130,7 +130,7 @@ - this step finds outstanding modified files you need to check - them in or revert them before continuing! - -- git status --porcelain | egrep '^[^\?]' -+ git status --porcelain | grep -E '^[^\?]' - - - -diff --git a/dist/net-snmp-solaris-build/buildpackage-solaris b/dist/net-snmp-solaris-build/buildpackage-solaris -index 31f4f0c0e..72971111a 100644 ---- a/dist/net-snmp-solaris-build/buildpackage-solaris -+++ b/dist/net-snmp-solaris-build/buildpackage-solaris -@@ -94,7 +94,7 @@ f snmp /etc/init.d/snmpd=./snmpd-init.d 0755 root sys - == - - pkgproto -c snmp $TMP=/ |\ --egrep -v '^d .* / |^d .* /var |^d .* /opt |^ .*perllocal.pod=' |\ -+grep -E -v '^d .* / |^d .* /var |^d .* /opt |^ .*perllocal.pod=' |\ - sed -e "s/ $owner $group\$//" >> prototype || exit $? - # and ignore top level directories (must pre-exist) - -diff --git a/dist/nsb-functions b/dist/nsb-functions -index 4865cc28a..f42a527a8 100644 ---- a/dist/nsb-functions -+++ b/dist/nsb-functions -@@ -364,10 +364,10 @@ nsb_make() - # checking $? would only get us the rc from tee, which is useless - - nsb_info "Checking for errors..." -- egrep -i "error|fail|warn|no such|exists|t find |ermission denied" $nsb_make_OUTPUT \ -+ grep -E -i "error|fail|warn|no such|exists|t find |ermission denied" $nsb_make_OUTPUT \ - > nsb_make-$target-allerrs.$NSB_DATE - # allow for a few exceptions -- egrep -v -i "^ok|testing .*failure|[a-z&_](fail|error)|warn|error(mib|\.3)|(LOG|SNMP)_ERR|In function|= FAILURE|DEBUGMSG|/\*|static library .* is not portable" nsb_make-$target-allerrs.$NSB_DATE \ -+ grep -E -v -i "^ok|testing .*failure|[a-z&_](fail|error)|warn|error(mib|\.3)|(LOG|SNMP)_ERR|In function|= FAILURE|DEBUGMSG|/\*|static library .* is not portable" nsb_make-$target-allerrs.$NSB_DATE \ - > nsb_make-$target-errs.$NSB_DATE - if [ -s nsb_make-$target-errs.$NSB_DATE ]; then - nsb_prompt "press enter to view errors" -diff --git a/dist/patme b/dist/patme -index 0fd50ee4a..6e62c80f9 100755 ---- a/dist/patme -+++ b/dist/patme -@@ -101,7 +101,7 @@ sub load_primaries { - patch_info => - qw_primary('check','Checking code directory status:', '', - [qw_paragraph('patch pieces:', -- sub { capture("egrep '^(---|\\+\\+\\+)' " . -+ sub { capture("grep -E '^(---|\\+\\+\\+)' " . - qwparam('patchfile'))}, - width => 80, - height => 30), --- -2.37.3 - -From 1023b76d53a279d44fa0629c1fd3a3b82d39eb42 Mon Sep 17 00:00:00 2001 -From: Andreas Stieger -Date: Sun, 2 Oct 2022 16:36:57 +0200 -Subject: [PATCH 05/10] local: convert direct usage of egrep to grep -E - -GNU grep 3.8 started throwing warnings for direct usage, -deprecating it in favour of grep -E - -[ bvanassche: changed one occurrence of egrep into grep -F instead of grep ] ---- - local/gittools/shell-functions | 6 +++--- - local/mib2c-update | 4 ++-- - local/minimalist/feature-remove | 6 +++--- - local/snmp-ucd.sh | 2 +- - 4 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/local/gittools/shell-functions b/local/gittools/shell-functions -index eafcbfdb4..0b09df323 100644 ---- a/local/gittools/shell-functions -+++ b/local/gittools/shell-functions -@@ -26,7 +26,7 @@ _ns_switchtobuilddir () { - - _ns_getbuilddir() { - nssuffix=${1:-$nssuffix} -- nsbranch=`git branch | egrep '^\*' | sed 's/^..//'` -+ nsbranch=`git branch | grep -E '^\*' | sed 's/^..//'` - NSBUILDDIR="$nsbuildroot/$nsbranch" - NSSRCDIR="$PWD" - -@@ -334,7 +334,7 @@ nsrollup() { - fi - - if [ -f dist/release ] ; then -- if [ "`egrep ^$branch dist/release`" = "$branch rc" ] ; then -+ if [ "`grep -E ^$branch dist/release`" = "$branch rc" ] ; then - $nsverbose Skipping: branch is in rc phase of release - nsbranchesnotdone="$nsbranchesnotdone $branch" - -@@ -411,7 +411,7 @@ nsrollup() { - } - - nspull() { -- nscurrentbranch=`git branch | egrep '^\*' | sed 's/^..//'` -+ nscurrentbranch=`git branch | grep -E '^\*' | sed 's/^..//'` - _ns_checkclean - if [ $NSCLEAN != 1 ]; then - return -diff --git a/local/mib2c-update b/local/mib2c-update -index 4282f3332..5fe5fd33d 100755 ---- a/local/mib2c-update -+++ b/local/mib2c-update -@@ -157,7 +157,7 @@ do_cp() - die "src $src is not a directory" - fi - safecd "$src" -- files=`ls ./*"$UPDATE_OID"* 2>/dev/null| egrep "(file|onf|m2d|txt|\.c|\.h)$"` -+ files=`ls ./*"$UPDATE_OID"* 2>/dev/null| grep -E "(file|onf|m2d|txt|\.c|\.h)$"` - if [ -z "$files" ]; then - echo " no files to copy from $src" - else -@@ -174,7 +174,7 @@ do_cp() - save_diff() - { - echo "Creating patch for your custom code" -- cnt=`ls ./"$UPDATE_CURR/"*"$UPDATE_OID"* 2>/dev/null | egrep "(file|onf|m2d|txt|\.c|\.h)$" | wc -l` -+ cnt=`ls ./"$UPDATE_CURR/"*"$UPDATE_OID"* 2>/dev/null | grep -E "(file|onf|m2d|txt|\.c|\.h)$" | wc -l` - if [ "$cnt" -eq 0 ]; then - echo " no custom code!" - FIRST_RUN=1 -diff --git a/local/minimalist/feature-remove b/local/minimalist/feature-remove -index aae340d93..504f26e0b 100755 ---- a/local/minimalist/feature-remove -+++ b/local/minimalist/feature-remove -@@ -99,15 +99,15 @@ for i in `grep NETSNMP_FEATURE_PROVIDE_ $featureheaderin | sed 's/.*FEATURE_PROV - # - # check to see if something required a parent - # -- elif egrep NETSNMP_FEATURE_${i}_CHILD_OF $featureheaderglobal > /dev/null ; then -- parentnames=`egrep NETSNMP_FEATURE_${i}_CHILD_OF $featureheaderglobal | sed 's/.*CHILD_OF_//;s/ .*//;'` -+ elif grep -E NETSNMP_FEATURE_${i}_CHILD_OF $featureheaderglobal > /dev/null ; then -+ parentnames=`grep -E NETSNMP_FEATURE_${i}_CHILD_OF $featureheaderglobal | sed 's/.*CHILD_OF_//;s/ .*//;'` - - foundone=0 - for parentname in $parentnames ; do - # if the parent was desired, then we are too: - - if test $foundone = 0 ; then -- if egrep "NETSNMP_FEATURE_HAS_${parentname} " $featureheader > /dev/null ; then -+ if grep -E "NETSNMP_FEATURE_HAS_${parentname} " $featureheader > /dev/null ; then - echo "#define NETSNMP_FEATURE_HAS_$i 1" >> $featureheader - haslist="${haslist}${i} " - foundone=1 -diff --git a/local/snmp-ucd.sh b/local/snmp-ucd.sh -index 7d16b746a..98d4094d0 100755 ---- a/local/snmp-ucd.sh -+++ b/local/snmp-ucd.sh -@@ -60,7 +60,7 @@ killproc() { # [signal] - # - pid=`pidofproc $base 2>/dev/null` - [ -z "$pid" ] && { -- pid=`ps $PSARGS | egrep $base | egrep -v egrep | egrep -v $0 | awk '{ print $2 }'`; -+ pid=`ps $PSARGS | grep -F "$base" | grep -v grep | grep -v $0 | awk '{ print $2 }'`; - } - [ -z "$pid" ] && { - echo "`basename $0`: killproc: Could not find process ID." --- -2.37.3 - -From 2b048bbe20d0e17ed6091c7ee75abc78e27423b5 Mon Sep 17 00:00:00 2001 -From: Andreas Stieger -Date: Sun, 2 Oct 2022 16:38:37 +0200 -Subject: [PATCH 06/10] net-snmp-create-v3-user: convert egrep to grep -E - -GNU grep 3.8 started throwing warnings for direct usage, -deprecating it in favour of grep -E ---- - net-snmp-create-v3-user.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in -index 19895a178..87121b9a1 100644 ---- a/net-snmp-create-v3-user.in -+++ b/net-snmp-create-v3-user.in -@@ -3,7 +3,7 @@ - # this shell script is designed to add new SNMPv3 users - # to Net-SNMP config file. - --if @PSCMD@ | egrep ' snmpd *$' > /dev/null 2>&1 ; then -+if @PSCMD@ | @EGREP@ ' snmpd *$' > /dev/null 2>&1 ; then - echo "Apparently at least one snmpd demon is already running." - echo "You must stop them in order to use this command." - exit 1 --- -2.37.3 - -From bc314524507e39cc283904e69d2a670e1ee7a6be Mon Sep 17 00:00:00 2001 -From: Andreas Stieger -Date: Sun, 2 Oct 2022 16:39:57 +0200 -Subject: [PATCH 07/10] testing/fulltests/support/simple_eval_tools.sh: egrep - to grep -E - -GNU grep 3.8 started throwing warnings for direct usage, -deprecating it in favour of grep -E ---- - testing/fulltests/support/simple_eval_tools.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/testing/fulltests/support/simple_eval_tools.sh b/testing/fulltests/support/simple_eval_tools.sh -index 4b2178618..858c20f75 100644 ---- a/testing/fulltests/support/simple_eval_tools.sh -+++ b/testing/fulltests/support/simple_eval_tools.sh -@@ -474,7 +474,7 @@ CHECKANDDIE() { - # Returns: Count of matched lines. - # - CHECKEXACT() { # -- rval=`egrep -c "^$*\$|^$*[^a-zA-Z0-9_]|[^a-zA-Z0-9_]$*\$|[^a-zA-Z0-9_]$*[^a-zA-Z0-9_]" "$junkoutputfile" 2>/dev/null` -+ rval=`grep -E -c "^$*\$|^$*[^a-zA-Z0-9_]|[^a-zA-Z0-9_]$*\$|[^a-zA-Z0-9_]$*[^a-zA-Z0-9_]" "$junkoutputfile" 2>/dev/null` - snmp_last_test_result=$rval - EXPECTRESULT 1 # default - return $rval --- -2.37.3 - diff --git a/net-snmp-5.9.3.tar.gz b/net-snmp-5.9.3.tar.gz deleted file mode 100644 index d57a2dd..0000000 --- a/net-snmp-5.9.3.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2097f29b7e1bf3f1300b4bae52fa2308d0bb8d5d3998dbe02f9462a413a2ef0a -size 6646950 diff --git a/net-snmp-5.9.3.tar.gz.asc b/net-snmp-5.9.3.tar.gz.asc deleted file mode 100644 index 0c42d9e..0000000 --- a/net-snmp-5.9.3.tar.gz.asc +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQIzBAABCAAdFiEE0Pj0ldphYMRO/78Q8HudLayxn9YFAmLPNbAACgkQ8HudLayx -n9ZoYRAAutAiZ4PzrWLkK2OUssCCbacKd+mswSuPsDOGe9OiJLedXGvI2+0iApba -avm3QZUDVID4LbHlNNHZxUWjQbCfl994pu5N0RHbJUZL9lLunkUDKZHv7AY/UCc4 -cb35s0n8OTPpud7q3z+T1cmFV4C/mXaji2f/CAHu4biWqT1SUE3eMADgT/9hxJES -0wEk1vVus0Y7qj6J2WQ5TepmuTwMB22ynWs1ffIxSrGtMm7YRigblCeNwCwXEeMY -vdwoxeTNAloJB6xzcjJ9sHYU6fHdlghNg1fwJZ/F6zAiVeRSij/jvNNWYVMYnsuC -Nwqa2RnhQv/OzIqyjo5rn/h7X0WI5XXT4x1XQQzOCKr4nb2tPYl+Me3sT/56nMRU -nUJK8Mak+0ygt0FUeRv5UUsWryXZyoDNxbF+fBxR2/S9RWGaSliIddld9KSImAYW -Y6EO71tqYX137jJ0/KcXF7BOVZ8EvEkVcaphz236vYJoa15XgDm1MEg92Dv2QFtU -CevMidbtMew0+9LxI3ZpAasGlbzC1t7WO/iKgHtGku67Ke+n+eB95ZYnTkCPLEtd -185Ln5ZylhvHpMvYrxDhIEiKvDyTO/lefN/ovLwhQNNmDtUntiKvQh5jdiFwos4/ -RxhzVnVdGGKSfLXwfZakU4QACfL/5YxxPtm/6h05dy/TIflZWAA= -=nlF8 ------END PGP SIGNATURE----- diff --git a/net-snmp-5.9.1-add-lustre-fs-support.patch b/net-snmp-5.9.4-add-lustre-fs-support.patch similarity index 100% rename from net-snmp-5.9.1-add-lustre-fs-support.patch rename to net-snmp-5.9.4-add-lustre-fs-support.patch diff --git a/net-snmp-5.9.4-add-netgroups-functionality.patch b/net-snmp-5.9.4-add-netgroups-functionality.patch new file mode 100644 index 0000000..53edd8c --- /dev/null +++ b/net-snmp-5.9.4-add-netgroups-functionality.patch @@ -0,0 +1,402 @@ +commit d047b54f874f392f97ffce8d51f49729e1c78225 +Author: Alexander Bergmann +Date: Fri Mar 10 15:23:35 2023 +0100 + + Create sub-function to parse source address and network mask + + Function netsnmp_udp_resolve_source was introduced to handle the source + address and network mask parsing into in_addr structures. + +diff --git a/snmplib/transports/snmpUDPDomain.c b/snmplib/transports/snmpUDPDomain.c +index 2724cf2191..3ad33d4bc5 100644 +--- a/snmplib/transports/snmpUDPDomain.c ++++ b/snmplib/transports/snmpUDPDomain.c +@@ -98,6 +98,58 @@ netsnmp_udp_fmtaddr(netsnmp_transport *t, const void *data, int len) + return netsnmp_ipv4_fmtaddr("UDP", t, data, len); + } + ++static int ++netsnmp_udp_resolve_source(char *source, struct in_addr *network, ++ struct in_addr *mask) ++{ ++ /* Split the source/netmask parts */ ++ char *strmask = strchr(source, '/'); ++ if (strmask != NULL) ++ /* Mask given. */ ++ *strmask++ = '\0'; ++ ++ /* Try interpreting as a dotted quad. */ ++ if (inet_pton(AF_INET, source, network) == 0) { ++ /* Nope, wasn't a dotted quad. Must be a hostname. */ ++ int ret = netsnmp_gethostbyname_v4(source, &(network->s_addr)); ++ if (ret < 0) { ++ config_perror("cannot resolve source hostname"); ++ return ret; ++ } ++ } ++ ++ /* Now work out the mask. */ ++ if (strmask == NULL || *strmask == '\0') { ++ /* No mask was given. Assume /32 */ ++ mask->s_addr = (in_addr_t)(~0UL); ++ } else { ++ /* Try to interpret mask as a "number of 1 bits". */ ++ char* cp; ++ long maskLen = strtol(strmask, &cp, 10); ++ if (*cp == '\0') { ++ if (0 < maskLen && maskLen <= 32) ++ mask->s_addr = htonl((in_addr_t)(~0UL << (32 - maskLen))); ++ else if (maskLen == 0) ++ mask->s_addr = 0; ++ else { ++ config_perror("bad mask length"); ++ return -1; ++ } ++ } ++ /* Try to interpret mask as a dotted quad. */ ++ else if (inet_pton(AF_INET, strmask, mask) == 0) { ++ config_perror("bad mask"); ++ return -1; ++ } ++ ++ /* Check that the network and mask are consistent. */ ++ if (network->s_addr & ~mask->s_addr) { ++ config_perror("source/mask mismatch"); ++ return -1; ++ } ++ } ++ return 0; ++} + + #if defined(HAVE_IP_PKTINFO) || (defined(HAVE_IP_RECVDSTADDR) && defined(HAVE_IP_SENDSRCADDR)) + +@@ -375,52 +427,10 @@ netsnmp_udp_parse_security(const char *token, char *param) + negate = 0; + sourcep = source; + } +- +- /* Split the source/netmask parts */ +- strmask = strchr(sourcep, '/'); +- if (strmask != NULL) +- /* Mask given. */ +- *strmask++ = '\0'; +- +- /* Try interpreting as a dotted quad. */ +- if (inet_pton(AF_INET, sourcep, &network) == 0) { +- /* Nope, wasn't a dotted quad. Must be a hostname. */ +- int ret = netsnmp_gethostbyname_v4(sourcep, &network.s_addr); +- if (ret < 0) { +- config_perror("cannot resolve IPv4 source hostname"); +- return; +- } +- } +- +- /* Now work out the mask. */ +- if (strmask == NULL || *strmask == '\0') { +- /* No mask was given. Assume /32 */ +- mask.s_addr = (in_addr_t)(~0UL); +- } else { +- /* Try to interpret mask as a "number of 1 bits". */ +- char* cp; +- long maskLen = strtol(strmask, &cp, 10); +- if (*cp == '\0') { +- if (0 < maskLen && maskLen <= 32) +- mask.s_addr = htonl((in_addr_t)(~0UL << (32 - maskLen))); +- else if (0 == maskLen) +- mask.s_addr = 0; +- else { +- config_perror("bad mask length"); +- return; +- } +- } +- /* Try to interpret mask as a dotted quad. */ +- else if (inet_pton(AF_INET, strmask, &mask) == 0) { +- config_perror("bad mask"); +- return; +- } +- +- /* Check that the network and mask are consistent. */ +- if (network.s_addr & ~mask.s_addr) { +- config_perror("source/mask mismatch"); +- return; +- } ++ /* Parse source address and network mask. */ ++ if(netsnmp_udp_resolve_source(sourcep, &network, &mask)) { ++ config_perror("source address/network mask parsing issue"); ++ return; + } + } + +commit a2559914d8d8132f155a81c0852cbbd2090d2d40 +Author: Alexander Bergmann +Date: Fri Mar 10 15:25:10 2023 +0100 + + Create sub-function to check the com2SecEntry_create return code + + The return code interpretation of the netsnmp_udp_com2SecEntry_create + function is now done inside a new sub-function. + +diff --git a/snmplib/transports/snmpUDPDomain.c b/snmplib/transports/snmpUDPDomain.c +index 3ad33d4bc5..5904a1b423 100644 +--- a/snmplib/transports/snmpUDPDomain.c ++++ b/snmplib/transports/snmpUDPDomain.c +@@ -346,6 +346,33 @@ netsnmp_udp_com2SecEntry_create(com2SecEntry **entryp, const char *community, + return C2SE_ERR_SUCCESS; + } + ++void ++netsnmp_udp_com2SecEntry_check_return_code(int rc) ++{ ++ /* ++ * Check return code of the newly created com2Sec entry. ++ */ ++ switch(rc) { ++ case C2SE_ERR_SUCCESS: ++ break; ++ case C2SE_ERR_CONTEXT_TOO_LONG: ++ config_perror("context name too long"); ++ break; ++ case C2SE_ERR_COMMUNITY_TOO_LONG: ++ config_perror("community name too long"); ++ break; ++ case C2SE_ERR_SECNAME_TOO_LONG: ++ config_perror("security name too long"); ++ break; ++ case C2SE_ERR_MASK_MISMATCH: ++ config_perror("source/mask mismatch"); ++ break; ++ case C2SE_ERR_MISSING_ARG: ++ default: ++ config_perror("unexpected error; could not create com2SecEntry"); ++ } ++} ++ + void + netsnmp_udp_parse_security(const char *token, char *param) + { +@@ -440,25 +467,7 @@ netsnmp_udp_parse_security(const char *token, char *param) + */ + rc = netsnmp_udp_com2SecEntry_create(NULL, community, secName, contextName, + &network, &mask, negate); +- switch(rc) { +- case C2SE_ERR_SUCCESS: +- break; +- case C2SE_ERR_CONTEXT_TOO_LONG: +- config_perror("context name too long"); +- break; +- case C2SE_ERR_COMMUNITY_TOO_LONG: +- config_perror("community name too long"); +- break; +- case C2SE_ERR_SECNAME_TOO_LONG: +- config_perror("security name too long"); +- break; +- case C2SE_ERR_MASK_MISMATCH: +- config_perror("source/mask mismatch"); +- break; +- case C2SE_ERR_MISSING_ARG: +- default: +- config_perror("unexpected error; could not create com2SecEntry"); +- } ++ netsnmp_udp_com2SecEntry_check_return_code(rc); + } + + void +commit 20e2bb7d75c391f5cfde1eb8b8676aff68f3a5f5 +Author: Alexander Bergmann +Date: Fri Mar 10 15:31:41 2023 +0100 + + Add '@' netgroup functionality + + Allow access control via netgroups defined in /etc/netgroup or NIS/LDAP + via the '@' sign inside the configuration file. Same as IP addresses and + host names. + +diff --git a/configure b/configure +index 575b60c4d2..82414664cf 100755 +--- a/configure ++++ b/configure +@@ -31221,6 +31221,12 @@ if test "x$ac_cv_func_closedir" = xyes + then : + printf "%s\n" "#define HAVE_CLOSEDIR 1" >>confdefs.h + ++fi ++ac_fn_c_check_func "$LINENO" "endnetgrent" "ac_cv_func_endnetgrent" ++if test "x$ac_cv_func_endnetgrent" = xyes ++then : ++ printf "%s\n" "#define HAVE_ENDNETGRENT 1" >>confdefs.h ++ + fi + ac_fn_c_check_func "$LINENO" "fgetc_unlocked" "ac_cv_func_fgetc_unlocked" + if test "x$ac_cv_func_fgetc_unlocked" = xyes +@@ -31257,6 +31263,12 @@ if test "x$ac_cv_func_getlogin" = xyes + then : + printf "%s\n" "#define HAVE_GETLOGIN 1" >>confdefs.h + ++fi ++ac_fn_c_check_func "$LINENO" "getnetgrent" "ac_cv_func_getnetgrent" ++if test "x$ac_cv_func_getnetgrent" = xyes ++then : ++ printf "%s\n" "#define HAVE_GETNETGRENT 1" >>confdefs.h ++ + fi + ac_fn_c_check_func "$LINENO" "if_nametoindex" "ac_cv_func_if_nametoindex" + if test "x$ac_cv_func_if_nametoindex" = xyes +@@ -31305,6 +31317,12 @@ if test "x$ac_cv_func_setlocale" = xyes + then : + printf "%s\n" "#define HAVE_SETLOCALE 1" >>confdefs.h + ++fi ++ac_fn_c_check_func "$LINENO" "setnetgrent" "ac_cv_func_setnetgrent" ++if test "x$ac_cv_func_setnetgrent" = xyes ++then : ++ printf "%s\n" "#define HAVE_SETNETGRENT 1" >>confdefs.h ++ + fi + ac_fn_c_check_func "$LINENO" "setsid" "ac_cv_func_setsid" + if test "x$ac_cv_func_setsid" = xyes +diff --git a/configure.d/config_os_functions b/configure.d/config_os_functions +index b921f8cd7b..0915928e21 100644 +--- a/configure.d/config_os_functions ++++ b/configure.d/config_os_functions +@@ -25,12 +25,14 @@ AC_TYPE_SIGNAL + AC_CHECK_FUNCS([rand random srand srandom lrand48 srand48]) + + # Library: +-AC_CHECK_FUNCS([asprintf closedir fgetc_unlocked ] dnl ++AC_CHECK_FUNCS([asprintf closedir endnetgrent ] dnl ++ [fgetc_unlocked ] dnl + [flockfile funlockfile getipnodebyname ] dnl +- [gettimeofday getlogin ] dnl ++ [gettimeofday getlogin getnetgrent ] dnl + [if_nametoindex mkstemp ] dnl + [opendir readdir regcomp ] dnl + [setenv setitimer setlocale ] dnl ++ [setnetgrent ] dnl + [setsid snprintf strcasestr ] dnl + [strdup strerror strncasecmp ] dnl + [sysconf times vsnprintf ] ) +diff --git a/include/net-snmp/net-snmp-config.h.in b/include/net-snmp/net-snmp-config.h.in +index 89b2ca116d..5efbf12400 100644 +--- a/include/net-snmp/net-snmp-config.h.in ++++ b/include/net-snmp/net-snmp-config.h.in +@@ -183,6 +183,9 @@ + /* Define to 1 if you have the `endfsent' function. */ + #undef HAVE_ENDFSENT + ++/* Define to 1 if you have the `endnetgrent' function. */ ++#undef HAVE_ENDNETGRENT ++ + /* Define to 1 if you have the `ERR_get_error_all' function. */ + #undef HAVE_ERR_GET_ERROR_ALL + +@@ -294,6 +297,9 @@ + /* Define to 1 if you have the `getmntinfo' function. */ + #undef HAVE_GETMNTINFO + ++/* Define to 1 if you have the `getnetgrent' function. */ ++#undef HAVE_GETNETGRENT ++ + /* Define to 1 if you have the `getopt' function. */ + #undef HAVE_GETOPT + +@@ -883,6 +889,9 @@ + /* Define to 1 if you have the `setmntent' function. */ + #undef HAVE_SETMNTENT + ++/* Define to 1 if you have the `setnetgrent' function. */ ++#undef HAVE_SETNETGRENT ++ + /* Define to 1 if you have the `setsid' function. */ + #undef HAVE_SETSID + +diff --git a/man/snmpd.conf.5.def b/man/snmpd.conf.5.def +index 2a9abd5b51..6060ed51d1 100644 +--- a/man/snmpd.conf.5.def ++++ b/man/snmpd.conf.5.def +@@ -434,6 +434,14 @@ com2sec sec1 10.0.0.0/8 public + .IP + Access from outside of 10.0.0.0/8 would still be denied. + .IP ++It is also possible to reference a specific \fInetgroup\fR starting with an ++'@' character (e.g. @adminhosts). The \fInetgroup\fR lookup is running ++through the NSS (Name Services Switch) making it possible to define the ++group locally or via NIS/LDAP. ++.IP ++Note: The hostname DNS lookup and \fInetgroup\fR resolution is done only ++during snmpd start or reload. ++.IP + The same community string can be specified in several separate directives + (presumably with different source tokens), and the first source/community + combination that matches the incoming request will be selected. +diff --git a/snmplib/transports/snmpUDPDomain.c b/snmplib/transports/snmpUDPDomain.c +index 5904a1b423..8f98398704 100644 +--- a/snmplib/transports/snmpUDPDomain.c ++++ b/snmplib/transports/snmpUDPDomain.c +@@ -445,6 +445,10 @@ netsnmp_udp_parse_security(const char *token, char *param) + network.s_addr = 0; + mask.s_addr = 0; + negate = 0; ++ /* Create a new com2Sec entry. */ ++ rc = netsnmp_udp_com2SecEntry_create(NULL, community, secName, contextName, ++ &network, &mask, negate); ++ netsnmp_udp_com2SecEntry_check_return_code(rc); + } else { + char *strmask; + if (*source == '!') { +@@ -454,20 +458,44 @@ netsnmp_udp_parse_security(const char *token, char *param) + negate = 0; + sourcep = source; + } +- /* Parse source address and network mask. */ +- if(netsnmp_udp_resolve_source(sourcep, &network, &mask)) { +- config_perror("source address/network mask parsing issue"); +- return; ++#if HAVE_ENDNETGRENT && HAVE_GETNETGRENT && HAVE_SETNETGRENT ++ /* Interpret as netgroup */ ++ if (*sourcep == '@') { ++ char *netgroup = sourcep+1; ++ char *host, *user, *domain; ++ if(setnetgrent(netgroup)) { ++ while (getnetgrent(&host, &user, &domain)) { ++ /* Parse source address and network mask for each netgroup host. */ ++ if (netsnmp_udp_resolve_source(host, &network, &mask) == 0) { ++ /* Create a new com2Sec entry. */ ++ rc = netsnmp_udp_com2SecEntry_create(NULL, community, secName, contextName, ++ &network, &mask, negate); ++ netsnmp_udp_com2SecEntry_check_return_code(rc); ++ } else { ++ config_perror("netgroup host address parsing issue"); ++ break; ++ } ++ } ++ endnetgrent(); ++ } else { ++ config_perror("netgroup could not be found"); ++ } ++ } ++ /* Without '@' it has to be an address or hostname */ ++ else ++#endif ++ { ++ /* Parse source address and network mask. */ ++ if(netsnmp_udp_resolve_source(sourcep, &network, &mask) == 0) { ++ /* Create a new com2Sec entry. */ ++ rc = netsnmp_udp_com2SecEntry_create(NULL, community, secName, contextName, ++ &network, &mask, negate); ++ netsnmp_udp_com2SecEntry_check_return_code(rc); ++ } else { ++ config_perror("source address/network mask parsing issue"); ++ } + } + } +- +- /* +- * Everything is okay. Copy the parameters to the structure allocated +- * above and add it to END of the list. +- */ +- rc = netsnmp_udp_com2SecEntry_create(NULL, community, secName, contextName, +- &network, &mask, negate); +- netsnmp_udp_com2SecEntry_check_return_code(rc); + } + + void diff --git a/net-snmp-5.9.1-fix-Makefile.PL.patch b/net-snmp-5.9.4-fix-Makefile.PL.patch similarity index 100% rename from net-snmp-5.9.1-fix-Makefile.PL.patch rename to net-snmp-5.9.4-fix-Makefile.PL.patch diff --git a/net-snmp-5.9.2-fix-create-v3-user-outfile.patch b/net-snmp-5.9.4-fix-create-v3-user-outfile.patch similarity index 100% rename from net-snmp-5.9.2-fix-create-v3-user-outfile.patch rename to net-snmp-5.9.4-fix-create-v3-user-outfile.patch diff --git a/net-snmp-5.9.3-fixed-python2-bindings.patch b/net-snmp-5.9.4-fixed-python2-bindings.patch similarity index 100% rename from net-snmp-5.9.3-fixed-python2-bindings.patch rename to net-snmp-5.9.4-fixed-python2-bindings.patch diff --git a/net-snmp-5.9.1-harden_snmpd.service.patch b/net-snmp-5.9.4-harden_snmpd.service.patch similarity index 61% rename from net-snmp-5.9.1-harden_snmpd.service.patch rename to net-snmp-5.9.4-harden_snmpd.service.patch index 9d6b8d9..cff3914 100644 --- a/net-snmp-5.9.1-harden_snmpd.service.patch +++ b/net-snmp-5.9.4-harden_snmpd.service.patch @@ -1,15 +1,13 @@ -Index: net-snmp-5.9/dist/snmpd.service -=================================================================== ---- net-snmp-5.9.orig/dist/snmpd.service -+++ net-snmp-5.9/dist/snmpd.service -@@ -10,6 +10,16 @@ Description=Simple Network Management Pr +diff -Nurp net-snmp-5.9.3-orig/dist/snmpd.service net-snmp-5.9.3/dist/snmpd.service +--- net-snmp-5.9.3-orig/dist/snmpd.service 2022-07-13 23:14:14.000000000 +0200 ++++ net-snmp-5.9.3/dist/snmpd.service 2023-01-09 12:11:47.508668095 +0100 +@@ -10,6 +10,15 @@ Description=Simple Network Management Pr After=syslog.target network.target [Service] +# added automatically, for details please see +# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort +ProtectSystem=full -+ProtectHome=true +ProtectHostname=true +ProtectKernelTunables=true +ProtectKernelModules=true diff --git a/net-snmp-5.9.1-harden_snmptrapd.service.patch b/net-snmp-5.9.4-harden_snmptrapd.service.patch similarity index 59% rename from net-snmp-5.9.1-harden_snmptrapd.service.patch rename to net-snmp-5.9.4-harden_snmptrapd.service.patch index d1b66a0..7634fe6 100644 --- a/net-snmp-5.9.1-harden_snmptrapd.service.patch +++ b/net-snmp-5.9.4-harden_snmptrapd.service.patch @@ -1,15 +1,13 @@ -Index: net-snmp-5.9/dist/snmptrapd.service -=================================================================== ---- net-snmp-5.9.orig/dist/snmptrapd.service -+++ net-snmp-5.9/dist/snmptrapd.service -@@ -7,6 +7,16 @@ Description=Simple Network Management Pr +diff -Nurp net-snmp-5.9.3-orig/dist/snmptrapd.service net-snmp-5.9.3/dist/snmptrapd.service +--- net-snmp-5.9.3-orig/dist/snmptrapd.service 2022-07-13 23:14:14.000000000 +0200 ++++ net-snmp-5.9.3/dist/snmptrapd.service 2023-01-09 12:13:40.120216602 +0100 +@@ -7,6 +7,15 @@ Description=Simple Network Management Pr After=syslog.target network.target [Service] +# added automatically, for details please see +# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort +ProtectSystem=full -+ProtectHome=true +ProtectHostname=true +ProtectKernelTunables=true +ProtectKernelModules=true diff --git a/net-snmp-5.9.1-modern-rpm-api.patch b/net-snmp-5.9.4-modern-rpm-api.patch similarity index 100% rename from net-snmp-5.9.1-modern-rpm-api.patch rename to net-snmp-5.9.4-modern-rpm-api.patch diff --git a/net-snmp-5.9.1-net-snmp-config-headercheck.patch b/net-snmp-5.9.4-net-snmp-config-headercheck.patch similarity index 100% rename from net-snmp-5.9.1-net-snmp-config-headercheck.patch rename to net-snmp-5.9.4-net-snmp-config-headercheck.patch diff --git a/net-snmp-5.9.1-perl-tk-warning.patch b/net-snmp-5.9.4-perl-tk-warning.patch similarity index 100% rename from net-snmp-5.9.1-perl-tk-warning.patch rename to net-snmp-5.9.4-perl-tk-warning.patch diff --git a/net-snmp-5.9.2-pie.patch b/net-snmp-5.9.4-pie.patch similarity index 100% rename from net-snmp-5.9.2-pie.patch rename to net-snmp-5.9.4-pie.patch diff --git a/net-snmp-5.9.1-snmpstatus-suppress-output.patch b/net-snmp-5.9.4-snmpstatus-suppress-output.patch similarity index 100% rename from net-snmp-5.9.1-snmpstatus-suppress-output.patch rename to net-snmp-5.9.4-snmpstatus-suppress-output.patch diff --git a/net-snmp-5.9.1-socket-path.patch b/net-snmp-5.9.4-socket-path.patch similarity index 100% rename from net-snmp-5.9.1-socket-path.patch rename to net-snmp-5.9.4-socket-path.patch diff --git a/net-snmp-5.9.1-subagent-set-response.patch b/net-snmp-5.9.4-subagent-set-response.patch similarity index 100% rename from net-snmp-5.9.1-subagent-set-response.patch rename to net-snmp-5.9.4-subagent-set-response.patch diff --git a/net-snmp-5.9.1-suse-systemd-service-files.patch b/net-snmp-5.9.4-suse-systemd-service-files.patch similarity index 100% rename from net-snmp-5.9.1-suse-systemd-service-files.patch rename to net-snmp-5.9.4-suse-systemd-service-files.patch diff --git a/net-snmp-5.9.1-testing-empty-arptable.patch b/net-snmp-5.9.4-testing-empty-arptable.patch similarity index 100% rename from net-snmp-5.9.1-testing-empty-arptable.patch rename to net-snmp-5.9.4-testing-empty-arptable.patch diff --git a/net-snmp-5.9.4.tar.gz b/net-snmp-5.9.4.tar.gz new file mode 100644 index 0000000..b20f631 --- /dev/null +++ b/net-snmp-5.9.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b4de01391e74e3c7014beb43961a2d6d6fa03acc34280b9585f4930745b0544 +size 6681606 diff --git a/net-snmp-5.9.4.tar.gz.asc b/net-snmp-5.9.4.tar.gz.asc new file mode 100644 index 0000000..4cf933e --- /dev/null +++ b/net-snmp-5.9.4.tar.gz.asc @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- + +iHUEABYKAB0WIQRuZxiu8etcZcMtGyo1a8C1UtU8qwUCZNvg2QAKCRA1a8C1UtU8 +qw8qAQDETiafcfGE3SBySaKHBbF29I0JoCgyQkMZcohhulta0gEA3VXykAg9M0S9 +q/bjRz8lPTdz9tpYmiza9eXcYmQZcAA= +=PJkj +-----END PGP SIGNATURE----- diff --git a/net-snmp.changes b/net-snmp.changes index 4820342..2924d8a 100644 --- a/net-snmp.changes +++ b/net-snmp.changes @@ -1,3 +1,50 @@ +------------------------------------------------------------------- +Tue Oct 17 13:56:01 UTC 2023 - Alexander Bergmann + +- Update to net-snmp-5.9.4 (bsc#1214364). +- Removing legacy MIBs used by Velocity Software (jira#PED-6416). +- Re-add support for hostname netgroups that was removed accidentally and + previously added with FATE#316305 (bsc#1207697). + '@hostgroup' can be specified for multiple hosts +- Hardening systemd services setting "ProtectHome=true" caused home directory + size and allocation to be listed incorrectly (bsc#1206044). + add: + * net-snmp-5.9.4-add-lustre-fs-support.patch + * net-snmp-5.9.4-add-netgroups-functionality.patch + * net-snmp-5.9.4-fix-create-v3-user-outfile.patch + * net-snmp-5.9.4-fixed-python2-bindings.patch + * net-snmp-5.9.4-fix-Makefile.PL.patch + * net-snmp-5.9.4-harden_snmpd.service.patch + * net-snmp-5.9.4-harden_snmptrapd.service.patch + * net-snmp-5.9.4-modern-rpm-api.patch + * net-snmp-5.9.4-net-snmp-config-headercheck.patch + * net-snmp-5.9.4-perl-tk-warning.patch + * net-snmp-5.9.4-pie.patch + * net-snmp-5.9.4-snmpstatus-suppress-output.patch + * net-snmp-5.9.4-socket-path.patch + * net-snmp-5.9.4-subagent-set-response.patch + * net-snmp-5.9.4-suse-systemd-service-files.patch + * net-snmp-5.9.4-testing-empty-arptable.patch + delete: + * net-snmp-5.9.1-add-lustre-fs-support.patch + * net-snmp-5.9.1-fix-Makefile.PL.patch + * net-snmp-5.9.1-harden_snmpd.service.patch + * net-snmp-5.9.1-harden_snmptrapd.service.patch + * net-snmp-5.9.1-modern-rpm-api.patch + * net-snmp-5.9.1-net-snmp-config-headercheck.patch + * net-snmp-5.9.1-perl-tk-warning.patch + * net-snmp-5.9.1-snmpstatus-suppress-output.patch + * net-snmp-5.9.1-socket-path.patch + * net-snmp-5.9.1-subagent-set-response.patch + * net-snmp-5.9.1-suse-systemd-service-files.patch + * net-snmp-5.9.1-testing-empty-arptable.patch + * net-snmp-5.9.1-velocity-mib.patch + * net-snmp-5.9.2-fix-create-v3-user-outfile.patch + * net-snmp-5.9.2-pie.patch + * net-snmp-5.9.3-disallow_SET_requests_with_NULL_varbind.patch + * net-snmp-5.9.3-fixed-python2-bindings.patch + * net-snmp-5.9.3-grep.patch + ------------------------------------------------------------------- Thu Jan 5 11:49:22 UTC 2023 - Alexander Bergmann diff --git a/net-snmp.keyring b/net-snmp.keyring index 71e5daa..d8fcf80 100644 --- a/net-snmp.keyring +++ b/net-snmp.keyring @@ -1,51 +1,14 @@ -----BEGIN PGP PUBLIC KEY BLOCK----- -mQINBFn1UdoBEADUagdPrU/tmcctszdv2JsrPotrNyD6mn3sXU3pJ2GdL83rMmRX -2vcNsJsyyJwPFnrBVTDPYfoCsD671ccW6JVC9QfPwpNQAJRuJCwZ50bpk3P/0DX2 -0YjED6chUF+OnnsnA1CK8eDDJ58QlmDCCd/wiG20UcipwTnUd7w8MBCJ/Y8ly54w -M9DxYP2YuPKd3AGasINwPGOdhOIjb9xpmL4Wxgc5rYFCxugYfxFEKnvOmZ34EUiQ -zj15LWpLSH1ZcP2CgbyrttODeftDbG/my4SMqCjINDcS1xI03h2UGsTOcR6816XU -tXTk/MLk8QKbX9CV2E80GSuPgolgH16tldGafwJ4rzasoorChefVovUsGoDf4nH+ -2WwUB/ZR2hmOa2MLKqNeJQSJH06o7dMsanYrSA8TKeLL6Xv2Gr9372JoVGazVrLi -DnylUcn35/gsM6oQk4DtrPwiV71f3eJkQk8mC8xS43bdn9DzbVbxYlSIw9X8nMLj -klHqnSm9+kIASud3YlV/tizR67Ph+Yh5nyxxZDZWLf9LUNgMdqc58LgmrXnrt9hk -AEVW4/MV3H/DTedLZA8aH/SWiyM3Z8+N5cUV82vBy4rGnkvMADWdrOnteizgnRLg -zgMGIvFH/UfzqhSJNFe/nk3ee4K9q5ZuWo5xwxwjvyIofPRAZ9wsYTGxZQARAQAB -tD9OZXQtU05NUCBBZG1pbmlzdHJhdG9ycyA8bmV0LXNubXAtYWRtaW5zQGxpc3Rz -LnNvdXJjZWZvcmdlLm5ldD6JAj4EEwECACgFAln1UdoCGwMFCQlmAYAGCwkIBwMC -BhUIAgkKCwQWAgMBAh4BAheAAAoJEPB7nS2ssZ/WxqoP/3Ay9ECsxnHjYWN/tGo/ -1cfnJLhCq3+eBmJL6nJDXFR/AiK0XmYZkoiOpWV9MU0lc40u+gkcOf44TL4q/q9v -P2PvH5wDZIXy9Kt3pKcFw6eUFQcwmta5ZZbGtbraCmsp2rZnU7RABnWkjVYoISZi -Y11G90mn1uOcGTtXLLb+hrWxaVeJZ5RZGFWmO9nbEr2+L1sX72e2U01c6SMOqQle -jUbz5vt6hq3hW+32oXpffaZ06M6QX4Vq5H66m5W3cZLZrbSCKDzmsXdvMJ5a8JG9 -DQZ3SXbNLscQXDAHt8UKoc7GC6xd293j5RsiL+UMp08AAvn07rAIH+JLTtqJjt7J -b40K8RoHN5bQvXbmow3wXoyJCF4se+IgJEjnjhDZahwJvA4wZGVkzYQz70+dG79V -AdoDpkQJvk2Fp8FgknDqvnbPCZZmaI0k4RfULLZgbVBN24tf8utxK4hB7KUgAcO7 -J31iP+hY6Xu1PQHp1AXEbxOJoj2OQ0RBPNnvF6xEr0/Qt3xdJgNN7RaDewttXcOe -klU9jl7NpFxEVjsZv8/yjp9oSOFnxLG8UPs+wAl+GLqzvkl0ArZu9xRfT82NfCMz -LoQpbu6QjRvDumiQfTropgJj+ekhfnn79W8ttPMpPJwhKSM5o9mHGDWXlHd6DaOt -jAXGa0MN8hVVmLKRpQp1fT3kuQINBFn1UdoBEADDmqitK1hnrTC94icxDwSdYuyR -D1Cq9wZSm40/Qpbr49/tAu2qWYadFaVzG+t3u6ELoYJkb31jEeBWmGZUGxWLxttP -Hja8cj2JSdI/qaQ0OeemxP4CHZucnxiEJ/g49dNbAxgoinq/wJewbU1GBHl0fInp -drZRAJdKB4/1bA1ILRWar29kQTMBsRX8OCBux+vYW1duDkvDD19I0FCH89dxAwsE -89KdMRc7nrrNRKNr9hG84V/GWvBib36amOHwPQlQVkYvVQ2J6GEa/juhpuKsWX2B -dxcYfGJQamXO7naaJySPGBzzGXkRmdrn7mOclqq4jwjNfWt9Tb3k3jfBW8sfUfKh -bXkvnLWr6l/ic1PkkxjPFuGJdfCYLPfXtNEgjn2Eg+EZ+t/H4T3w5CR9A/Kz91hv -pdGN4Np7gUMBftr+ZvRHGQn72KmMK+QqZuhu4NDfhIB7JtU8mR4LjEFHZL9rARs2 -QrV6Xg+jcgzRtJu6YGieZTVkiYiMv/ujrCehMoX/h64xWKBodbaBu+XrXdYT79nB -B1BhtLcApq08Wj46KX49KwEmoWBPqJj3BjFC4UrcnjCvk1R8ZkBA/Jy4Yma0hSoL -wMjlotBIWbHSaE8XA+ASwq3CBn+6BDF/u6SoUYG2yvV0yvEMWQOfKsDXWD8P5yyK -PbG+Nl2MIylg2q2TNwARAQABiQIlBBgBAgAPBQJZ9VHaAhsMBQkJZgGAAAoJEPB7 -nS2ssZ/WWPkQAJ7xUSSvNgUj441kKqrIgDMS0ZrVuwsuD8q95Y8juOR35QR1di0F -lPOhr6wSNIxAaJrUtmKsHWdAUwRGe+xQ0ab/sGht1U7loWUKwcunjNh16VE6m2cg -qEWg/InsPko8gBzBBiyRrY13lNWXoCPx3WX0ueNsFzlTOddIzOqClFEg8e5fhNHx -WAzwBrJOxtmmnhF17FKaZcHYScUNLE/okhsz4AZUUhj6PbSHfh4aLHLhh8//oArn -jQCQdIJngx8BqYOp8SNjyp6i6GNKnGP80J+sVRHtEAvcwiBDoJD7E1L47zBXkecY -8EfWHCopGue2kqMEUdtANKLHJS9b9EBRZwne4uXuq87/qTKzHQJlAs1xqpLPX5tr -0UzFNMxUnO5BD1XVEomuZBlloltRZ6DTbfTtog4wniDZLFWpfJZUu9vPJyvSj0Zc -7B3WAzj3IsSTy8KT8PKn7o0oZnLpQ2NQGKhhmp4ggrHuStf/t734SLiHgF17P5hK -LokQzwdMyyUhvdj3rVbEKItOKV8z/2j5qb+Og5W5YxcQGa4XaZykhr7C/jjwBAkR -2sZKQaHydhqZKqQ1cUCzzat69KtFwqhHPVxazEMrUqZdibW1jij8G8uGY6TAVi1b -iWL4rwllv1xTXnIA6LGu+gPHkk32ClNfgQyl2B5pulfGP0fvXBEmCKKH -=fpTJ +mDMEZCtJmhYJKwYBBAHaRw8BAQdADrR3+vAhB8AXYe9RztKtuRKMRN1Dp/mQLqey +Tg6X/Iq0P05ldC1TTk1QIEFkbWluaXN0cmF0b3JzIDxuZXQtc25tcC1hZG1pbnNA +bGlzdHMuc291cmNlZm9yZ2UubmV0PoiZBBMWCgBBFiEEbmcYrvHrXGXDLRsqNWvA +tVLVPKsFAmQrSZoCGwMFCRLMAwAFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AA +CgkQNWvAtVLVPKtF1wEAk1Cs77LtOWb34kjLiVfZU4/RtbjpzhJAbjczgQAzRLwB +AJSr6kJ2UgVgTar5Rtuyd9jFKiopH56h46IFG79XkvQIuDgEZCtJmhIKKwYBBAGX +VQEFAQEHQBOKL1xzf/uUQOqpRWR6CbbIpSc/aFDRxiF/o85gN78aAwEIB4h+BBgW +CgAmFiEEbmcYrvHrXGXDLRsqNWvAtVLVPKsFAmQrSZoCGwwFCRLMAwAACgkQNWvA +tVLVPKuwlwEAxpTW8jjFkZXqo7MKxbdI5tGUfvhOAbcBDZpzqpOyCGkBAOMY/Am/ +oAfYd5+tds3nCWhlvYGX/NuIvplVZSzNhsEA +=lV4S -----END PGP PUBLIC KEY BLOCK----- diff --git a/net-snmp.spec b/net-snmp.spec index 4697dd0..c5b0093 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -30,7 +30,7 @@ %define libname libsnmp40 %bcond_without python2 Name: net-snmp -Version: 5.9.3 +Version: 5.9.4 Release: 0 Summary: SNMP Daemon License: BSD-3-Clause AND MIT @@ -48,24 +48,22 @@ Source11: snmptrapd.sysconfig Source20: net-snmp-tmpfs.conf Source98: net-snmp-rpmlintrc Source99: baselibs.conf -Patch1: net-snmp-5.9.1-socket-path.patch -Patch2: net-snmp-5.9.1-testing-empty-arptable.patch -Patch3: net-snmp-5.9.2-pie.patch -Patch4: net-snmp-5.9.1-net-snmp-config-headercheck.patch -Patch5: net-snmp-5.9.1-perl-tk-warning.patch -Patch6: net-snmp-5.9.1-velocity-mib.patch -Patch7: net-snmp-5.9.1-snmpstatus-suppress-output.patch -Patch8: net-snmp-5.9.1-fix-Makefile.PL.patch -Patch9: net-snmp-5.9.1-modern-rpm-api.patch -Patch10: net-snmp-5.9.1-add-lustre-fs-support.patch -Patch11: net-snmp-5.9.1-harden_snmpd.service.patch -Patch12: net-snmp-5.9.1-harden_snmptrapd.service.patch -Patch13: net-snmp-5.9.1-suse-systemd-service-files.patch -Patch14: net-snmp-5.9.2-fix-create-v3-user-outfile.patch -Patch15: net-snmp-5.9.1-subagent-set-response.patch -Patch16: net-snmp-5.9.3-fixed-python2-bindings.patch -Patch17: net-snmp-5.9.3-grep.patch -Patch18: net-snmp-5.9.3-disallow_SET_requests_with_NULL_varbind.patch +Patch1: net-snmp-5.9.4-socket-path.patch +Patch2: net-snmp-5.9.4-testing-empty-arptable.patch +Patch3: net-snmp-5.9.4-pie.patch +Patch4: net-snmp-5.9.4-net-snmp-config-headercheck.patch +Patch5: net-snmp-5.9.4-perl-tk-warning.patch +Patch6: net-snmp-5.9.4-snmpstatus-suppress-output.patch +Patch7: net-snmp-5.9.4-fix-Makefile.PL.patch +Patch8: net-snmp-5.9.4-modern-rpm-api.patch +Patch9: net-snmp-5.9.4-add-lustre-fs-support.patch +Patch10: net-snmp-5.9.4-harden_snmpd.service.patch +Patch11: net-snmp-5.9.4-harden_snmptrapd.service.patch +Patch12: net-snmp-5.9.4-suse-systemd-service-files.patch +Patch13: net-snmp-5.9.4-fix-create-v3-user-outfile.patch +Patch14: net-snmp-5.9.4-subagent-set-response.patch +Patch15: net-snmp-5.9.4-fixed-python2-bindings.patch +Patch16: net-snmp-5.9.4-add-netgroups-functionality.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: autoconf @@ -241,7 +239,7 @@ Net-SNMP toolkit library. %autopatch -p1 %build -MIBS="misc/ipfwacc ucd-snmp/diskio etherlike-mib rmon-mib velocity smux \ +MIBS="misc/ipfwacc ucd-snmp/diskio etherlike-mib rmon-mib smux \ ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \ ip-mib/ipDefaultRouterTable ip-mib/ipAddressPrefixTable \ ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \ @@ -251,7 +249,6 @@ MIBS="misc/ipfwacc ucd-snmp/diskio etherlike-mib rmon-mib velocity smux \ MIBS="$MIBS ucd-snmp/lmsensorsMib" %endif -autoreconf -fvi %configure \ --with-sys-contact="root@localhost" \ --with-sys-location="unknown" \