[Nagiosplug-checkins] CVS: nagiosplug/plugins check_snmp.c,1.15,1.16

Subhendu Ghosh sghosh at users.sourceforge.net
Mon Nov 11 12:48:39 CET 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory usw-pr-cvs1:/tmp/cvs-serv4131

Modified Files:
	check_snmp.c 
Log Message:
more snmpv3 patches

Index: check_snmp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_snmp.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** check_snmp.c	11 Nov 2002 19:29:19 -0000	1.15
--- check_snmp.c	11 Nov 2002 20:19:01 -0000	1.16
***************
*** 35,39 ****
            [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\
            [-l label] [-u units] [-p port-number] [-d delimiter]\n\
!           [-D output-delimiter] [-m miblist]"
  
  #define LONGOPTIONS "\
--- 35,41 ----
            [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\
            [-l label] [-u units] [-p port-number] [-d delimiter]\n\
!           [-D output-delimiter] [-m miblist] [-P snmp version]\n\
! 					[-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\
! 					[-X privpasswd]\n"
  
  #define LONGOPTIONS "\
***************
*** 646,650 ****
  			break;
  		case 'a':     /* auth protocol */
! 			authproto = strscpy(authproto, optarg);
  			break;
  		case 'A':     /* auth passwd */
--- 648,652 ----
  			break;
  		case 'a':     /* auth protocol */
! 			asprintf (&authproto, optarg);
  			break;
  		case 'A':     /* auth passwd */
***************
*** 706,733 ****
  		asprintf (&units, "");
  
! 	if ( strcmp(seclevel, "noAuthNoPriv") && strcmp(seclevel, "authNoPriv") && strcmp(seclevel, "authPriv") ) {
! 		if (seclevel == NULL) 
! 			asprintf (&seclevel, "noAuthNoPriv");
! 		else {
! 			printf ("Invalid seclevel: %s! \n", seclevel);
! 			print_usage ();
! 			exit (STATE_UNKNOWN);	
! 		}
! 	}
  
  
! 	if ( strcmp (authproto, "SHA") && strcmp(authproto, "MD5") ) {
! 		if (authproto == NULL ) 
! 			asprintf(&authproto, DEFAULT_AUTH_PROTOCOL);
! 		else{
! 			printf ("Invalid authproto: %s! \n", authproto);
! 			print_usage ();
! 			exit (STATE_UNKNOWN);
! 		}
! 	}
! 
  	 
  	
! 	if (proto == NULL || !strcmp(proto,DEFAULT_PROTOCOL) ) {        /* default protocol version */
  		asprintf(&proto, DEFAULT_PROTOCOL);
  		asprintf(&authpriv, "%s%s", "-c ", community);
--- 708,723 ----
  		asprintf (&units, "");
  
! 	/* Need better checks to verify seclevel and authproto choices */
! 	
! 	if (seclevel == NULL) 
! 		asprintf (&seclevel, "noAuthNoPriv");
  
  
! 	if (authproto == NULL ) 
! 		asprintf(&authproto, DEFAULT_AUTH_PROTOCOL);
! 	
  	 
  	
! 	if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) {        /* default protocol version */
  		asprintf(&proto, DEFAULT_PROTOCOL);
  		asprintf(&authpriv, "%s%s", "-c ", community);
***************
*** 753,757 ****
  				exit (STATE_UNKNOWN);
  			}
! 			authpriv = ssprintf(authpriv, "-l authPriv -a %s -u %s -A %s -X %s ", authproto, secname, authpasswd, privpasswd);
  		}
  		
--- 743,747 ----
  				exit (STATE_UNKNOWN);
  			}
! 			authpriv = ssprintf(authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd);
  		}
  		





More information about the Commits mailing list