Imported Upstream version 1.4.16_pre1
This commit is contained in:
		
							parent
							
								
									047baae1ca
								
							
						
					
					
						commit
						212b4b8677
					
				
					 69 changed files with 10803 additions and 2698 deletions
				
			
		| 
						 | 
				
			
			@ -101,7 +101,7 @@ check_tcp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
 | 
			
		|||
check_time_LDADD = $(NETLIBS)
 | 
			
		||||
check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS)
 | 
			
		||||
check_ups_LDADD = $(NETLIBS)
 | 
			
		||||
check_users_LDADD = $(BASEOBJS) popen.o
 | 
			
		||||
check_users_LDADD = $(BASEOBJS)
 | 
			
		||||
check_by_ssh_LDADD = $(NETLIBS)
 | 
			
		||||
check_ide_smart_LDADD = $(BASEOBJS)
 | 
			
		||||
negate_LDADD = $(BASEOBJS)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,8 @@
 | 
			
		|||
# Makefile.in generated by automake 1.10 from Makefile.am.
 | 
			
		||||
# Makefile.in generated by automake 1.10.1 from Makefile.am.
 | 
			
		||||
# @configure_input@
 | 
			
		||||
 | 
			
		||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
 | 
			
		||||
# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 | 
			
		||||
# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 | 
			
		||||
# This Makefile.in is free software; the Free Software Foundation
 | 
			
		||||
# gives unlimited permission to copy and/or distribute it,
 | 
			
		||||
# with or without modifications, as long as this notice is preserved.
 | 
			
		||||
| 
						 | 
				
			
			@ -239,7 +239,7 @@ negate_SOURCES = negate.c
 | 
			
		|||
negate_OBJECTS = negate.$(OBJEXT)
 | 
			
		||||
urlize_SOURCES = urlize.c
 | 
			
		||||
urlize_OBJECTS = urlize.$(OBJEXT)
 | 
			
		||||
DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
 | 
			
		||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 | 
			
		||||
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
 | 
			
		||||
am__depfiles_maybe = depfiles
 | 
			
		||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 | 
			
		||||
| 
						 | 
				
			
			@ -1159,7 +1159,7 @@ check_tcp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
 | 
			
		|||
check_time_LDADD = $(NETLIBS)
 | 
			
		||||
check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS)
 | 
			
		||||
check_ups_LDADD = $(NETLIBS)
 | 
			
		||||
check_users_LDADD = $(BASEOBJS) popen.o
 | 
			
		||||
check_users_LDADD = $(BASEOBJS)
 | 
			
		||||
check_by_ssh_LDADD = $(NETLIBS)
 | 
			
		||||
check_ide_smart_LDADD = $(BASEOBJS)
 | 
			
		||||
negate_LDADD = $(BASEOBJS)
 | 
			
		||||
| 
						 | 
				
			
			@ -1246,8 +1246,8 @@ install-libexecPROGRAMS: $(libexec_PROGRAMS)
 | 
			
		|||
	     || test -f $$p1 \
 | 
			
		||||
	  ; then \
 | 
			
		||||
	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
 | 
			
		||||
	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(libexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(libexecdir)/$$f'"; \
 | 
			
		||||
	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(libexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(libexecdir)/$$f" || exit 1; \
 | 
			
		||||
	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(libexecdir)/$$f'"; \
 | 
			
		||||
	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(libexecdir)/$$f" || exit 1; \
 | 
			
		||||
	  else :; fi; \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1493,8 +1493,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 | 
			
		|||
	unique=`for i in $$list; do \
 | 
			
		||||
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | 
			
		||||
	  done | \
 | 
			
		||||
	  $(AWK) '    { files[$$0] = 1; } \
 | 
			
		||||
	       END { for (i in files) print i; }'`; \
 | 
			
		||||
	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
 | 
			
		||||
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | 
			
		||||
	mkid -fID $$unique
 | 
			
		||||
tags: TAGS
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1506,8 +1506,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 | 
			
		|||
	unique=`for i in $$list; do \
 | 
			
		||||
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | 
			
		||||
	  done | \
 | 
			
		||||
	  $(AWK) '    { files[$$0] = 1; } \
 | 
			
		||||
	       END { for (i in files) print i; }'`; \
 | 
			
		||||
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | 
			
		||||
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | 
			
		||||
	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 | 
			
		||||
	  test -n "$$unique" || unique=$$empty_fix; \
 | 
			
		||||
	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
 | 
			
		||||
| 
						 | 
				
			
			@ -1517,13 +1517,12 @@ ctags: CTAGS
 | 
			
		|||
CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 | 
			
		||||
		$(TAGS_FILES) $(LISP)
 | 
			
		||||
	tags=; \
 | 
			
		||||
	here=`pwd`; \
 | 
			
		||||
	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 | 
			
		||||
	unique=`for i in $$list; do \
 | 
			
		||||
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 | 
			
		||||
	  done | \
 | 
			
		||||
	  $(AWK) '    { files[$$0] = 1; } \
 | 
			
		||||
	       END { for (i in files) print i; }'`; \
 | 
			
		||||
	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 | 
			
		||||
	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 | 
			
		||||
	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 | 
			
		||||
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 | 
			
		||||
	     $$tags $$unique
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -187,6 +187,7 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
		{"use-ipv6", no_argument, 0, '6'},
 | 
			
		||||
		{"ssh-option", required_argument, 0, 'o'},
 | 
			
		||||
		{"quiet", no_argument, 0, 'q'},
 | 
			
		||||
		{"configfile", optional_argument, 0, 'F'},
 | 
			
		||||
		{0, 0, 0, 0}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -198,7 +199,7 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
			strcpy (argv[c], "-t");
 | 
			
		||||
 | 
			
		||||
	while (1) {
 | 
			
		||||
		c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S::E::n:s:o:", longopts,
 | 
			
		||||
		c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S::E::n:s:o:F:", longopts,
 | 
			
		||||
		                 &option);
 | 
			
		||||
 | 
			
		||||
		if (c == -1 || c == EOF)
 | 
			
		||||
| 
						 | 
				
			
			@ -306,6 +307,10 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
		case 'q':									/* Tell the ssh command to be quiet */
 | 
			
		||||
			comm_append("-q");
 | 
			
		||||
			break;
 | 
			
		||||
		case 'F': 									/* ssh configfile */
 | 
			
		||||
			comm_append("-F");
 | 
			
		||||
			comm_append(optarg);
 | 
			
		||||
			break;
 | 
			
		||||
		default:									/* help */
 | 
			
		||||
			usage5();
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -418,6 +423,8 @@ print_help (void)
 | 
			
		|||
  printf ("    %s\n", _("short name of host in nagios configuration [optional]"));
 | 
			
		||||
  printf (" %s\n","-o, --ssh-option=OPTION");
 | 
			
		||||
  printf ("    %s\n", _("Call ssh with '-o OPTION' (may be used multiple times) [optional]"));
 | 
			
		||||
  printf (" %s\n","-F, --configfile");
 | 
			
		||||
  printf ("    %s\n", _("Tell ssh to use this configfile [optional]"));
 | 
			
		||||
  printf (" %s\n","-q, --quiet");
 | 
			
		||||
  printf ("    %s\n", _("Tell ssh to suppress warning and diagnostic messages [optional]"));
 | 
			
		||||
	printf (UT_WARN_CRIT);
 | 
			
		||||
| 
						 | 
				
			
			@ -454,6 +461,6 @@ print_usage (void)
 | 
			
		|||
	printf (" %s -H <host> -C <command> [-fqv] [-1|-2] [-4|-6]\n"
 | 
			
		||||
	        "       [-S [lines]] [-E [lines]] [-t timeout] [-i identity]\n"
 | 
			
		||||
	        "       [-l user] [-n name] [-s servicelist] [-O outputfile]\n"
 | 
			
		||||
	        "       [-p port] [-o ssh-option]\n",
 | 
			
		||||
	        "       [-p port] [-o ssh-option] [-F configfile]\n",
 | 
			
		||||
	        progname);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -122,6 +122,8 @@ void print_help (void);
 | 
			
		|||
void print_usage (void);
 | 
			
		||||
double calculate_percent(uintmax_t, uintmax_t);
 | 
			
		||||
void stat_path (struct parameter_list *p);
 | 
			
		||||
void get_stats (struct parameter_list *p, struct fs_usage *fsp);
 | 
			
		||||
void get_path_stats (struct parameter_list *p, struct fs_usage *fsp);
 | 
			
		||||
 | 
			
		||||
double w_dfp = -1.0;
 | 
			
		||||
double c_dfp = -1.0;
 | 
			
		||||
| 
						 | 
				
			
			@ -148,6 +150,7 @@ char *crit_freeinodes_percent = NULL;
 | 
			
		|||
int path_selected = FALSE;
 | 
			
		||||
char *group = NULL;
 | 
			
		||||
struct stat *stat_buf;
 | 
			
		||||
struct name_list *seen = NULL;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
| 
						 | 
				
			
			@ -160,10 +163,6 @@ main (int argc, char **argv)
 | 
			
		|||
  char *perf;
 | 
			
		||||
  char *preamble;
 | 
			
		||||
  double inode_space_pct;
 | 
			
		||||
  uintmax_t total, available, available_to_root, used;
 | 
			
		||||
  double dfree_pct = -1, dused_pct = -1;
 | 
			
		||||
  double dused_units, dfree_units, dtotal_units;
 | 
			
		||||
  double dused_inodes_percent, dfree_inodes_percent;
 | 
			
		||||
  double warning_high_tide;
 | 
			
		||||
  double critical_high_tide;
 | 
			
		||||
  int temp_result;
 | 
			
		||||
| 
						 | 
				
			
			@ -171,7 +170,6 @@ main (int argc, char **argv)
 | 
			
		|||
  struct mount_entry *me;
 | 
			
		||||
  struct fs_usage fsp, tmpfsp;
 | 
			
		||||
  struct parameter_list *temp_list, *path;
 | 
			
		||||
  struct name_list *seen = NULL;
 | 
			
		||||
 | 
			
		||||
  preamble = strdup (" - free space:");
 | 
			
		||||
  output = strdup ("");
 | 
			
		||||
| 
						 | 
				
			
			@ -237,45 +235,8 @@ main (int argc, char **argv)
 | 
			
		|||
    /* Remove filesystems already seen */
 | 
			
		||||
    if (np_seen_name(seen, me->me_mountdir)) {
 | 
			
		||||
      continue;
 | 
			
		||||
    } else {
 | 
			
		||||
      if (path->group != NULL) {
 | 
			
		||||
        /* find all group members */
 | 
			
		||||
        fsp.fsu_blocksize = 0;
 | 
			
		||||
        fsp.fsu_blocks    = 0;
 | 
			
		||||
        fsp.fsu_bfree     = 0;
 | 
			
		||||
        fsp.fsu_bavail    = 0;
 | 
			
		||||
        fsp.fsu_files     = 0;
 | 
			
		||||
        fsp.fsu_ffree     = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        for (temp_list = path_select_list; temp_list; temp_list=temp_list->name_next) {
 | 
			
		||||
          if (temp_list->group && ! (strcmp(temp_list->group, path->group))) {
 | 
			
		||||
 | 
			
		||||
            stat_path(path);
 | 
			
		||||
            get_fs_usage (temp_list->best_match->me_mountdir, temp_list->best_match->me_devname, &tmpfsp);
 | 
			
		||||
 | 
			
		||||
            /* possibly differing blocksizes if disks are grouped. Calculating average */
 | 
			
		||||
            fsp.fsu_blocksize = (fsp.fsu_blocksize * fsp.fsu_blocks + tmpfsp.fsu_blocksize * tmpfsp.fsu_blocks) / \
 | 
			
		||||
                                (fsp.fsu_blocks + tmpfsp.fsu_blocks);  /* Size of a block.  */
 | 
			
		||||
            fsp.fsu_blocks    += tmpfsp.fsu_blocks;     /* Total blocks. */
 | 
			
		||||
            fsp.fsu_bfree     += tmpfsp.fsu_bfree;      /* Free blocks available to superuser. */
 | 
			
		||||
            /* Gnulib workaround - see comment about it a few lines below */
 | 
			
		||||
            fsp.fsu_bavail    += (tmpfsp.fsu_bavail > tmpfsp.fsu_bfree ? 0 : tmpfsp.fsu_bavail); /* Free blocks available to non-superuser. */
 | 
			
		||||
            fsp.fsu_files     += tmpfsp.fsu_files;      /* Total file nodes. */
 | 
			
		||||
            fsp.fsu_ffree     += tmpfsp.fsu_ffree;      /* Free file nodes. */
 | 
			
		||||
 | 
			
		||||
            if (verbose >= 3)
 | 
			
		||||
              printf("Group %s: add %llu blocks (%s) \n", path->group, tmpfsp.fsu_bavail, temp_list->name);
 | 
			
		||||
             /* printf("Group %s: add %u blocks (%s)\n", temp_list->name); *//* path->group, tmpfsp.fsu_bavail, temp_list->name); */
 | 
			
		||||
 | 
			
		||||
            np_add_name(&seen, temp_list->best_match->me_mountdir);
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        /* modify devname and mountdir for output */
 | 
			
		||||
        me->me_mountdir = me->me_devname = path->group;
 | 
			
		||||
      } else
 | 
			
		||||
        np_add_name(&seen, me->me_mountdir);
 | 
			
		||||
    }
 | 
			
		||||
    } 
 | 
			
		||||
    np_add_name(&seen, me->me_mountdir);
 | 
			
		||||
 | 
			
		||||
    if (path->group == NULL) {
 | 
			
		||||
      /* Skip remote filesystems if we're not interested in them */
 | 
			
		||||
| 
						 | 
				
			
			@ -301,55 +262,36 @@ main (int argc, char **argv)
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
 | 
			
		||||
      total = fsp.fsu_blocks;
 | 
			
		||||
      /* 2007-12-08 - Workaround for Gnulib reporting insanely high available
 | 
			
		||||
       * space on BSD (the actual value should be negative but fsp.fsu_bavail
 | 
			
		||||
       * is unsigned) */
 | 
			
		||||
      available = fsp.fsu_bavail > fsp.fsu_bfree ? 0 : fsp.fsu_bavail;
 | 
			
		||||
      available_to_root = fsp.fsu_bfree;
 | 
			
		||||
      used = total - available_to_root;
 | 
			
		||||
 | 
			
		||||
      if (verbose >= 3)
 | 
			
		||||
        printf ("For %s, total=%llu, available=%llu, available_to_root=%llu, used=%llu, fsp.fsu_files=%llu, fsp.fsu_ffree=%llu\n",
 | 
			
		||||
        me->me_mountdir, total, available, available_to_root, used, fsp.fsu_files, fsp.fsu_ffree);
 | 
			
		||||
 | 
			
		||||
      dused_pct = calculate_percent( used, used + available );	/* used + available can never be > uintmax */
 | 
			
		||||
 | 
			
		||||
      dfree_pct = 100 - dused_pct;
 | 
			
		||||
      dused_units = used*fsp.fsu_blocksize/mult;
 | 
			
		||||
      dfree_units = available*fsp.fsu_blocksize/mult;
 | 
			
		||||
      dtotal_units = total*fsp.fsu_blocksize/mult;
 | 
			
		||||
      dused_inodes_percent = calculate_percent(fsp.fsu_files - fsp.fsu_ffree, fsp.fsu_files);
 | 
			
		||||
      dfree_inodes_percent = 100 - dused_inodes_percent;
 | 
			
		||||
      get_stats (path, &fsp);
 | 
			
		||||
 | 
			
		||||
      if (verbose >= 3) {
 | 
			
		||||
        printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%llu mult=%llu\n",
 | 
			
		||||
          me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dused_inodes_percent, dfree_inodes_percent, fsp.fsu_blocksize, mult);
 | 
			
		||||
          me->me_mountdir, path->dused_pct, path->dfree_pct, path->dused_units, path->dfree_units, path->dtotal_units, path->dused_inodes_percent, path->dfree_inodes_percent, fsp.fsu_blocksize, mult);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /* Threshold comparisons */
 | 
			
		||||
 | 
			
		||||
      temp_result = get_status(dfree_units, path->freespace_units);
 | 
			
		||||
      temp_result = get_status(path->dfree_units, path->freespace_units);
 | 
			
		||||
      if (verbose >=3) printf("Freespace_units result=%d\n", temp_result);
 | 
			
		||||
      disk_result = max_state( disk_result, temp_result );
 | 
			
		||||
 | 
			
		||||
      temp_result = get_status(dfree_pct, path->freespace_percent);
 | 
			
		||||
      temp_result = get_status(path->dfree_pct, path->freespace_percent);
 | 
			
		||||
      if (verbose >=3) printf("Freespace%% result=%d\n", temp_result);
 | 
			
		||||
      disk_result = max_state( disk_result, temp_result );
 | 
			
		||||
 | 
			
		||||
      temp_result = get_status(dused_units, path->usedspace_units);
 | 
			
		||||
      temp_result = get_status(path->dused_units, path->usedspace_units);
 | 
			
		||||
      if (verbose >=3) printf("Usedspace_units result=%d\n", temp_result);
 | 
			
		||||
      disk_result = max_state( disk_result, temp_result );
 | 
			
		||||
 | 
			
		||||
      temp_result = get_status(dused_pct, path->usedspace_percent);
 | 
			
		||||
      temp_result = get_status(path->dused_pct, path->usedspace_percent);
 | 
			
		||||
      if (verbose >=3) printf("Usedspace_percent result=%d\n", temp_result);
 | 
			
		||||
      disk_result = max_state( disk_result, temp_result );
 | 
			
		||||
 | 
			
		||||
      temp_result = get_status(dused_inodes_percent, path->usedinodes_percent);
 | 
			
		||||
      temp_result = get_status(path->dused_inodes_percent, path->usedinodes_percent);
 | 
			
		||||
      if (verbose >=3) printf("Usedinodes_percent result=%d\n", temp_result);
 | 
			
		||||
      disk_result = max_state( disk_result, temp_result );
 | 
			
		||||
 | 
			
		||||
      temp_result = get_status(dfree_inodes_percent, path->freeinodes_percent);
 | 
			
		||||
      temp_result = get_status(path->dfree_inodes_percent, path->freeinodes_percent);
 | 
			
		||||
      if (verbose >=3) printf("Freeinodes_percent result=%d\n", temp_result);
 | 
			
		||||
      disk_result = max_state( disk_result, temp_result );
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -365,26 +307,26 @@ main (int argc, char **argv)
 | 
			
		|||
      critical_high_tide = UINT_MAX;
 | 
			
		||||
 | 
			
		||||
      if (path->freespace_units->warning != NULL) {
 | 
			
		||||
        warning_high_tide = dtotal_units - path->freespace_units->warning->end;
 | 
			
		||||
        warning_high_tide = path->dtotal_units - path->freespace_units->warning->end;
 | 
			
		||||
      }
 | 
			
		||||
      if (path->freespace_percent->warning != NULL) {
 | 
			
		||||
        warning_high_tide = abs( min( (double) warning_high_tide, (double) (1.0 - path->freespace_percent->warning->end/100)*dtotal_units ));
 | 
			
		||||
        warning_high_tide = abs( min( (double) warning_high_tide, (double) (1.0 - path->freespace_percent->warning->end/100)*path->dtotal_units ));
 | 
			
		||||
      }
 | 
			
		||||
      if (path->freespace_units->critical != NULL) {
 | 
			
		||||
        critical_high_tide = dtotal_units - path->freespace_units->critical->end;
 | 
			
		||||
        critical_high_tide = path->dtotal_units - path->freespace_units->critical->end;
 | 
			
		||||
      }
 | 
			
		||||
      if (path->freespace_percent->critical != NULL) {
 | 
			
		||||
        critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*dtotal_units ));
 | 
			
		||||
        critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*path->dtotal_units ));
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /* Nb: *_high_tide are unset when == UINT_MAX */
 | 
			
		||||
      asprintf (&perf, "%s %s", perf,
 | 
			
		||||
                perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
 | 
			
		||||
                          dused_units, units,
 | 
			
		||||
                          path->dused_units, units,
 | 
			
		||||
                          (warning_high_tide != UINT_MAX ? TRUE : FALSE), warning_high_tide,
 | 
			
		||||
                          (critical_high_tide != UINT_MAX ? TRUE : FALSE), critical_high_tide,
 | 
			
		||||
                          TRUE, 0,
 | 
			
		||||
                          TRUE, dtotal_units));
 | 
			
		||||
                          TRUE, path->dtotal_units));
 | 
			
		||||
 | 
			
		||||
      if (disk_result==STATE_OK && erronly && !verbose)
 | 
			
		||||
        continue;
 | 
			
		||||
| 
						 | 
				
			
			@ -392,13 +334,13 @@ main (int argc, char **argv)
 | 
			
		|||
      asprintf (&output, "%s %s %.0f %s (%.0f%%",
 | 
			
		||||
                output,
 | 
			
		||||
                (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
 | 
			
		||||
                dfree_units,
 | 
			
		||||
                path->dfree_units,
 | 
			
		||||
                units,
 | 
			
		||||
                dfree_pct);
 | 
			
		||||
      if (dused_inodes_percent < 0) {
 | 
			
		||||
                path->dfree_pct);
 | 
			
		||||
      if (path->dused_inodes_percent < 0) {
 | 
			
		||||
        asprintf(&output, "%s inode=-);", output);
 | 
			
		||||
      } else {
 | 
			
		||||
        asprintf(&output, "%s inode=%.0f%%);", output, dfree_inodes_percent );
 | 
			
		||||
        asprintf(&output, "%s inode=%.0f%%);", output, path->dfree_inodes_percent );
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      /* TODO: Need to do a similar debug line
 | 
			
		||||
| 
						 | 
				
			
			@ -996,3 +938,74 @@ stat_path (struct parameter_list *p)
 | 
			
		|||
    die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
get_stats (struct parameter_list *p, struct fs_usage *fsp) {
 | 
			
		||||
  struct parameter_list *p_list;
 | 
			
		||||
  struct fs_usage tmpfsp;
 | 
			
		||||
  int first = 1;
 | 
			
		||||
 | 
			
		||||
  if (p->group == NULL) {
 | 
			
		||||
    get_path_stats(p,fsp);
 | 
			
		||||
  } else {
 | 
			
		||||
    /* find all group members */
 | 
			
		||||
    for (p_list = path_select_list; p_list; p_list=p_list->name_next) {
 | 
			
		||||
      if (p_list->group && ! (strcmp(p_list->group, p->group))) {
 | 
			
		||||
        stat_path(p_list);
 | 
			
		||||
        get_fs_usage (p_list->best_match->me_mountdir, p_list->best_match->me_devname, &tmpfsp);
 | 
			
		||||
        get_path_stats(p_list, &tmpfsp); 
 | 
			
		||||
        if (verbose >= 3)
 | 
			
		||||
          printf("Group %s: adding %llu blocks sized %llu, (%s) used_units=%g free_units=%g total_units=%g fsu_blocksize=%llu mult=%llu\n",
 | 
			
		||||
                 p_list->group, tmpfsp.fsu_bavail, tmpfsp.fsu_blocksize, p_list->best_match->me_mountdir, p_list->dused_units, p_list->dfree_units,
 | 
			
		||||
                 p_list->dtotal_units, mult);
 | 
			
		||||
 | 
			
		||||
        /* prevent counting the first FS of a group twice since its parameter_list entry 
 | 
			
		||||
         * is used to carry the information of all file systems of the entire group */
 | 
			
		||||
        if (! first) {
 | 
			
		||||
          p->total += p_list->total;
 | 
			
		||||
          p->available += p_list->available;
 | 
			
		||||
          p->available_to_root += p_list->available_to_root;
 | 
			
		||||
          p->used += p_list->used;
 | 
			
		||||
            
 | 
			
		||||
          p->dused_units += p_list->dused_units;
 | 
			
		||||
          p->dfree_units += p_list->dfree_units;
 | 
			
		||||
          p->dtotal_units += p_list->dtotal_units;
 | 
			
		||||
          p->inodes_total += p_list->inodes_total;
 | 
			
		||||
          p->inodes_free  += p_list->inodes_free;
 | 
			
		||||
        }
 | 
			
		||||
        first = 0;
 | 
			
		||||
      }
 | 
			
		||||
      if (verbose >= 3) 
 | 
			
		||||
        printf("Group %s now has: used_units=%g free_units=%g total_units=%g fsu_blocksize=%llu mult=%llu\n",
 | 
			
		||||
               p->group, tmpfsp.fsu_bavail, tmpfsp.fsu_blocksize, p->best_match->me_mountdir, p->dused_units,
 | 
			
		||||
               p->dfree_units, p->dtotal_units, mult);
 | 
			
		||||
    }
 | 
			
		||||
    /* modify devname and mountdir for output */
 | 
			
		||||
    p->best_match->me_mountdir = p->best_match->me_devname = p->group;
 | 
			
		||||
  }
 | 
			
		||||
  /* finally calculate percentages for either plain FS or summed up group */
 | 
			
		||||
  p->dused_pct = calculate_percent( p->used, p->used + p->available );	/* used + available can never be > uintmax */
 | 
			
		||||
  p->dfree_pct = 100 - p->dused_pct;
 | 
			
		||||
  p->dused_inodes_percent = calculate_percent(p->inodes_total - p->inodes_free, p->inodes_total);
 | 
			
		||||
  p->dfree_inodes_percent = 100 - p->dused_inodes_percent;
 | 
			
		||||
  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
get_path_stats (struct parameter_list *p, struct fs_usage *fsp) {
 | 
			
		||||
  p->total = fsp->fsu_blocks;
 | 
			
		||||
  /* 2007-12-08 - Workaround for Gnulib reporting insanely high available
 | 
			
		||||
  * space on BSD (the actual value should be negative but fsp->fsu_bavail
 | 
			
		||||
  * is unsigned) */
 | 
			
		||||
  p->available = fsp->fsu_bavail > fsp->fsu_bfree ? 0 : fsp->fsu_bavail;
 | 
			
		||||
  p->available_to_root = fsp->fsu_bfree;
 | 
			
		||||
  p->used = p->total - p->available_to_root;
 | 
			
		||||
  
 | 
			
		||||
  p->dused_units = p->used*fsp->fsu_blocksize/mult;
 | 
			
		||||
  p->dfree_units = p->available*fsp->fsu_blocksize/mult;
 | 
			
		||||
  p->dtotal_units = p->total*fsp->fsu_blocksize/mult;
 | 
			
		||||
  p->inodes_total = fsp->fsu_files;      /* Total file nodes. */
 | 
			
		||||
  p->inodes_free  = fsp->fsu_ffree;      /* Free file nodes. */
 | 
			
		||||
  np_add_name(&seen, p->best_match->me_mountdir);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@
 | 
			
		|||
/* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */
 | 
			
		||||
 | 
			
		||||
const char *progname = "check_http";
 | 
			
		||||
const char *copyright = "1999-2008";
 | 
			
		||||
const char *copyright = "1999-2011";
 | 
			
		||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
 | 
			
		||||
 | 
			
		||||
#include "common.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -59,6 +59,7 @@ enum {
 | 
			
		|||
#ifdef HAVE_SSL
 | 
			
		||||
int check_cert = FALSE;
 | 
			
		||||
int days_till_exp;
 | 
			
		||||
int ssl_version;
 | 
			
		||||
char *randbuff;
 | 
			
		||||
X509 *server_cert;
 | 
			
		||||
#  define my_recv(buf, len) ((use_ssl) ? np_net_ssl_read(buf, len) : read(sd, buf, len))
 | 
			
		||||
| 
						 | 
				
			
			@ -101,10 +102,9 @@ int server_expect_yn = 0;
 | 
			
		|||
char server_expect[MAX_INPUT_BUFFER] = HTTP_EXPECT;
 | 
			
		||||
char string_expect[MAX_INPUT_BUFFER] = "";
 | 
			
		||||
char output_string_search[30] = "";
 | 
			
		||||
double warning_time = 0;
 | 
			
		||||
int check_warning_time = FALSE;
 | 
			
		||||
double critical_time = 0;
 | 
			
		||||
int check_critical_time = FALSE;
 | 
			
		||||
char *warning_thresholds = NULL;
 | 
			
		||||
char *critical_thresholds = NULL;
 | 
			
		||||
thresholds *thlds;
 | 
			
		||||
char user_auth[MAX_INPUT_BUFFER] = "";
 | 
			
		||||
char proxy_auth[MAX_INPUT_BUFFER] = "";
 | 
			
		||||
int display_html = FALSE;
 | 
			
		||||
| 
						 | 
				
			
			@ -189,7 +189,7 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
    STD_LONG_OPTS,
 | 
			
		||||
    {"link", no_argument, 0, 'L'},
 | 
			
		||||
    {"nohtml", no_argument, 0, 'n'},
 | 
			
		||||
    {"ssl", no_argument, 0, 'S'},
 | 
			
		||||
    {"ssl", optional_argument, 0, 'S'},
 | 
			
		||||
    {"sni", no_argument, 0, SNI_OPTION},
 | 
			
		||||
    {"post", required_argument, 0, 'P'},
 | 
			
		||||
    {"method", required_argument, 0, 'j'},
 | 
			
		||||
| 
						 | 
				
			
			@ -235,7 +235,7 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  while (1) {
 | 
			
		||||
    c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option);
 | 
			
		||||
    c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLS::m:M:N", longopts, &option);
 | 
			
		||||
    if (c == -1 || c == EOF)
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -258,20 +258,10 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
        socket_timeout = atoi (optarg);
 | 
			
		||||
      break;
 | 
			
		||||
    case 'c': /* critical time threshold */
 | 
			
		||||
      if (!is_nonnegative (optarg))
 | 
			
		||||
        usage2 (_("Critical threshold must be integer"), optarg);
 | 
			
		||||
      else {
 | 
			
		||||
        critical_time = strtod (optarg, NULL);
 | 
			
		||||
        check_critical_time = TRUE;
 | 
			
		||||
      }
 | 
			
		||||
      critical_thresholds = optarg;
 | 
			
		||||
      break;
 | 
			
		||||
    case 'w': /* warning time threshold */
 | 
			
		||||
      if (!is_nonnegative (optarg))
 | 
			
		||||
        usage2 (_("Warning threshold must be integer"), optarg);
 | 
			
		||||
      else {
 | 
			
		||||
        warning_time = strtod (optarg, NULL);
 | 
			
		||||
        check_warning_time = TRUE;
 | 
			
		||||
      }
 | 
			
		||||
      warning_thresholds = optarg;
 | 
			
		||||
      break;
 | 
			
		||||
    case 'A': /* User Agent String */
 | 
			
		||||
      asprintf (&user_agent, "User-Agent: %s", optarg);
 | 
			
		||||
| 
						 | 
				
			
			@ -305,6 +295,13 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
      usage4 (_("Invalid option - SSL is not available"));
 | 
			
		||||
#endif
 | 
			
		||||
      use_ssl = TRUE;
 | 
			
		||||
      if (optarg == NULL || c != 'S')
 | 
			
		||||
        ssl_version = 0;
 | 
			
		||||
      else {
 | 
			
		||||
        ssl_version = atoi(optarg);
 | 
			
		||||
        if (ssl_version < 1 || ssl_version > 3)
 | 
			
		||||
            usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2) or 3 (SSLv3)"));
 | 
			
		||||
      }
 | 
			
		||||
      if (specify_port == FALSE)
 | 
			
		||||
        server_port = HTTPS_PORT;
 | 
			
		||||
      break;
 | 
			
		||||
| 
						 | 
				
			
			@ -478,8 +475,10 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
      server_address = strdup (host_name);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (check_critical_time && critical_time>(double)socket_timeout)
 | 
			
		||||
    socket_timeout = (int)critical_time + 1;
 | 
			
		||||
  set_thresholds(&thlds, warning_thresholds, critical_thresholds);
 | 
			
		||||
 | 
			
		||||
  if (critical_thresholds && thlds->critical->end>(double)socket_timeout)
 | 
			
		||||
    socket_timeout = (int)thlds->critical->end + 1;
 | 
			
		||||
 | 
			
		||||
  if (http_method == NULL)
 | 
			
		||||
    http_method = strdup ("GET");
 | 
			
		||||
| 
						 | 
				
			
			@ -807,7 +806,9 @@ check_http (void)
 | 
			
		|||
    die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n"));
 | 
			
		||||
#ifdef HAVE_SSL
 | 
			
		||||
  if (use_ssl == TRUE) {
 | 
			
		||||
    np_net_ssl_init_with_hostname(sd, (use_sni ? host_name : NULL));
 | 
			
		||||
    result = np_net_ssl_init_with_hostname_and_version(sd, (use_sni ? host_name : NULL), ssl_version);
 | 
			
		||||
    if (result != STATE_OK)
 | 
			
		||||
      return result;
 | 
			
		||||
    if (check_cert == TRUE) {
 | 
			
		||||
      result = np_net_ssl_check_cert(days_till_exp);
 | 
			
		||||
      np_net_ssl_cleanup();
 | 
			
		||||
| 
						 | 
				
			
			@ -1099,10 +1100,7 @@ check_http (void)
 | 
			
		|||
            (display_html ? "</A>" : ""),
 | 
			
		||||
            perfd_time (elapsed_time), perfd_size (page_len));
 | 
			
		||||
 | 
			
		||||
  if (check_critical_time == TRUE && elapsed_time > critical_time)
 | 
			
		||||
    result = STATE_CRITICAL;
 | 
			
		||||
  if (check_warning_time == TRUE && elapsed_time > warning_time)
 | 
			
		||||
    result =  max_state_alt(STATE_WARNING, result);
 | 
			
		||||
  result = max_state_alt(get_status(elapsed_time, thlds), result);
 | 
			
		||||
 | 
			
		||||
  die (result, "HTTP %s: %s\n", state_text(result), msg);
 | 
			
		||||
  /* die failed? */
 | 
			
		||||
| 
						 | 
				
			
			@ -1284,8 +1282,8 @@ server_port_check (int ssl_flag)
 | 
			
		|||
char *perfd_time (double elapsed_time)
 | 
			
		||||
{
 | 
			
		||||
  return fperfdata ("time", elapsed_time, "s",
 | 
			
		||||
            check_warning_time, warning_time,
 | 
			
		||||
            check_critical_time, critical_time,
 | 
			
		||||
            thlds->warning?TRUE:FALSE, thlds->warning?thlds->warning->end:0,
 | 
			
		||||
            thlds->critical?TRUE:FALSE, thlds->critical?thlds->critical->end:0,
 | 
			
		||||
                   TRUE, 0, FALSE, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1335,13 +1333,14 @@ print_help (void)
 | 
			
		|||
  printf (UT_IPv46);
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_SSL
 | 
			
		||||
  printf (" %s\n", "-S, --ssl");
 | 
			
		||||
  printf ("   %s\n", _("Connect via SSL. Port defaults to 443"));
 | 
			
		||||
  printf (" %s\n", "-S, --ssl=VERSION");
 | 
			
		||||
  printf ("    %s\n", _("Connect via SSL. Port defaults to 443. VERSION is optional, and prevents"));
 | 
			
		||||
  printf ("    %s\n", _("auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3)."));
 | 
			
		||||
  printf (" %s\n", "--sni");
 | 
			
		||||
  printf ("   %s\n", _("Enable SSL/TLS hostname extension support (SNI)"));
 | 
			
		||||
  printf ("    %s\n", _("Enable SSL/TLS hostname extension support (SNI)"));
 | 
			
		||||
  printf (" %s\n", "-C, --certificate=INTEGER");
 | 
			
		||||
  printf ("   %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443"));
 | 
			
		||||
  printf ("   %s\n", _("(when this option is used the URL is not checked.)\n"));
 | 
			
		||||
  printf ("    %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443"));
 | 
			
		||||
  printf ("    %s\n", _("(when this option is used the URL is not checked.)\n"));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  printf (" %s\n", "-e, --expect=STRING");
 | 
			
		||||
| 
						 | 
				
			
			@ -1378,16 +1377,16 @@ print_help (void)
 | 
			
		|||
  printf (" %s\n", "-a, --authorization=AUTH_PAIR");
 | 
			
		||||
  printf ("    %s\n", _("Username:password on sites with basic authentication"));
 | 
			
		||||
  printf (" %s\n", "-b, --proxy-authorization=AUTH_PAIR");
 | 
			
		||||
  printf (" 	%s\n", _("Username:password on proxy-servers with basic authentication"));
 | 
			
		||||
  printf ("    %s\n", _("Username:password on proxy-servers with basic authentication"));
 | 
			
		||||
  printf (" %s\n", "-A, --useragent=STRING");
 | 
			
		||||
  printf ("    %s\n", _("String to be sent in http header as \"User Agent\""));
 | 
			
		||||
  printf (" %s\n", "-k, --header=STRING");
 | 
			
		||||
  printf ("    %s\n", _(" Any other tags to be sent in http header. Use multiple times for additional headers"));
 | 
			
		||||
  printf ("    %s\n", _("Any other tags to be sent in http header. Use multiple times for additional headers"));
 | 
			
		||||
  printf (" %s\n", "-L, --link");
 | 
			
		||||
  printf ("    %s\n", _("Wrap output in HTML link (obsoleted by urlize)"));
 | 
			
		||||
  printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport>");
 | 
			
		||||
  printf ("    %s\n", _("How to handle redirected pages. sticky is like follow but stick to the"));
 | 
			
		||||
  printf ("    %s\n", _("specified IP address. stickyport also ensure post stays the same."));
 | 
			
		||||
  printf ("    %s\n", _("specified IP address. stickyport also ensures port stays the same."));
 | 
			
		||||
  printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>");
 | 
			
		||||
  printf ("    %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)"));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1412,6 +1411,10 @@ print_help (void)
 | 
			
		|||
  printf (" %s\n", _("serve content (optionally within a specified time) or whether the X509 "));
 | 
			
		||||
  printf (" %s\n", _("certificate is still valid for the specified number of days."));
 | 
			
		||||
  printf ("\n");
 | 
			
		||||
  printf (" %s\n", _("Please note that this plugin does not check if the presented server"));
 | 
			
		||||
  printf (" %s\n", _("certificate matches the hostname of the server, or if the certificate"));
 | 
			
		||||
  printf (" %s\n", _("has a valid chain of trust to one of the locally installed CAs."));
 | 
			
		||||
  printf ("\n");
 | 
			
		||||
  printf ("%s\n", _("Examples:"));
 | 
			
		||||
  printf (" %s\n\n", "CHECK CONTENT: check_http -w 5 -c 10 --ssl -H www.verisign.com");
 | 
			
		||||
  printf (" %s\n", _("When the 'www.verisign.com' server returns its content within 5 seconds,"));
 | 
			
		||||
| 
						 | 
				
			
			@ -1441,6 +1444,6 @@ print_usage (void)
 | 
			
		|||
  printf ("       [-b proxy_auth] [-f <ok|warning|critcal|follow|sticky|stickyport>]\n");
 | 
			
		||||
  printf ("       [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n");
 | 
			
		||||
  printf ("       [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n");
 | 
			
		||||
  printf ("       [-A string] [-k string] [-S] [--sni] [-C <age>] [-T <content-type>]\n");
 | 
			
		||||
  printf ("       [-A string] [-k string] [-S <version>] [--sni] [-C <age>] [-T <content-type>]\n");
 | 
			
		||||
  printf ("       [-j method]\n");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ char *ld_host = NULL;
 | 
			
		|||
char *ld_base = NULL;
 | 
			
		||||
char *ld_passwd = NULL;
 | 
			
		||||
char *ld_binddn = NULL;
 | 
			
		||||
int ld_port = DEFAULT_PORT;
 | 
			
		||||
int ld_port = -1;
 | 
			
		||||
#ifdef HAVE_LDAP_SET_OPTION
 | 
			
		||||
int ld_protocol = DEFAULT_PROTOCOL;
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -247,7 +247,7 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
		{"help", no_argument, 0, 'h'},
 | 
			
		||||
		{"version", no_argument, 0, 'V'},
 | 
			
		||||
		{"timeout", required_argument, 0, 't'},
 | 
			
		||||
		{"host", required_argument, 0, 'H'},
 | 
			
		||||
		{"hostname", required_argument, 0, 'H'},
 | 
			
		||||
		{"base", required_argument, 0, 'b'},
 | 
			
		||||
		{"attr", required_argument, 0, 'a'},
 | 
			
		||||
		{"bind", required_argument, 0, 'D'},
 | 
			
		||||
| 
						 | 
				
			
			@ -341,7 +341,8 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
		case 'S':
 | 
			
		||||
			if (! starttls) {
 | 
			
		||||
				ssl_on_connect = TRUE;
 | 
			
		||||
				ld_port = LDAPS_PORT;
 | 
			
		||||
				if (ld_port == -1)
 | 
			
		||||
					ld_port = LDAPS_PORT;
 | 
			
		||||
			} else
 | 
			
		||||
				usage_va(_("%s cannot be combined with %s"), "-S/--ssl", "-T/--starttls");
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -364,6 +365,9 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
	if (ld_base == NULL && argv[c])
 | 
			
		||||
		ld_base = strdup (argv[c++]);
 | 
			
		||||
 | 
			
		||||
	if (ld_port == -1)
 | 
			
		||||
		ld_port = DEFAULT_PORT;
 | 
			
		||||
 | 
			
		||||
	return validate_arguments ();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -203,7 +203,12 @@ int main(int argc, char **argv){
 | 
			
		|||
		uphours = (uptime % 86400) / 3600;
 | 
			
		||||
		upminutes = ((uptime % 86400) % 3600) / 60;
 | 
			
		||||
		asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
 | 
			
		||||
		return_code=STATE_OK;
 | 
			
		||||
		if (check_critical_value==TRUE && uptime <= critical_value)
 | 
			
		||||
			return_code=STATE_CRITICAL;
 | 
			
		||||
		else if (check_warning_value==TRUE && uptime <= warning_value)
 | 
			
		||||
			return_code=STATE_WARNING;
 | 
			
		||||
		else
 | 
			
		||||
			return_code=STATE_OK;
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case CHECK_USEDDISKSPACE:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -432,6 +432,7 @@ run_ping (const char *cmd, const char *addr)
 | 
			
		|||
{
 | 
			
		||||
	char buf[MAX_INPUT_BUFFER];
 | 
			
		||||
	int result = STATE_UNKNOWN;
 | 
			
		||||
	int match;
 | 
			
		||||
 | 
			
		||||
	if ((child_process = spopen (cmd)) == NULL)
 | 
			
		||||
		die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), cmd);
 | 
			
		||||
| 
						 | 
				
			
			@ -448,28 +449,29 @@ run_ping (const char *cmd, const char *addr)
 | 
			
		|||
		result = max_state (result, error_scan (buf, addr));
 | 
			
		||||
 | 
			
		||||
		/* get the percent loss statistics */
 | 
			
		||||
		if(sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss",&pl)==1 ||
 | 
			
		||||
			 sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d duplicates, %d%% packet loss", &pl) == 1 ||
 | 
			
		||||
			 sscanf(buf,"%*d packets transmitted, %*d received, +%*d duplicates, %d%% packet loss", &pl) == 1 ||
 | 
			
		||||
			 sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% packet loss",&pl)==1 ||
 | 
			
		||||
			 sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% loss, time",&pl)==1 ||
 | 
			
		||||
			 sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time", &pl)==1 ||
 | 
			
		||||
			 sscanf(buf,"%*d packets transmitted, %*d received, %d%% packet loss, time", &pl)==1 ||
 | 
			
		||||
			 sscanf(buf,"%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss", &pl) == 1 ||
 | 
			
		||||
			 sscanf(buf,"%*d packets transmitted %*d received, +%*d errors, %d%% packet loss", &pl) == 1
 | 
			
		||||
		match = 0;
 | 
			
		||||
		if((sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) ||
 | 
			
		||||
			 (sscanf(buf,"%*d packets transmitted, %*d packets received, +%*d duplicates, %d%% packet loss%n",&pl,&match) && match) ||
 | 
			
		||||
			 (sscanf(buf,"%*d packets transmitted, %*d received, +%*d duplicates, %d%% packet loss%n",&pl,&match) && match) ||
 | 
			
		||||
			 (sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% packet loss%n",&pl,&match) && match) ||
 | 
			
		||||
			 (sscanf(buf,"%*d packets transmitted, %*d packets received, %d%% loss, time%n",&pl,&match) && match) ||
 | 
			
		||||
			 (sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time%n",&pl,&match) && match) ||
 | 
			
		||||
			 (sscanf(buf,"%*d packets transmitted, %*d received, %d%% packet loss, time%n",&pl,&match) && match) ||
 | 
			
		||||
			 (sscanf(buf,"%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) ||
 | 
			
		||||
			 (sscanf(buf,"%*d packets transmitted %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match)
 | 
			
		||||
			 )
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		/* get the round trip average */
 | 
			
		||||
		else
 | 
			
		||||
			if(sscanf(buf,"round-trip min/avg/max = %*f/%f/%*f",&rta)==1 ||
 | 
			
		||||
				 sscanf(buf,"round-trip min/avg/max/mdev = %*f/%f/%*f/%*f",&rta)==1 ||
 | 
			
		||||
				 sscanf(buf,"round-trip min/avg/max/sdev = %*f/%f/%*f/%*f",&rta)==1 ||
 | 
			
		||||
				 sscanf(buf,"round-trip min/avg/max/stddev = %*f/%f/%*f/%*f",&rta)==1 ||
 | 
			
		||||
				 sscanf(buf,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f",&rta)==1 ||
 | 
			
		||||
				 sscanf(buf,"round-trip (ms) min/avg/max = %*f/%f/%*f",&rta)==1 ||
 | 
			
		||||
				 sscanf(buf,"round-trip (ms) min/avg/max/stddev = %*f/%f/%*f/%*f",&rta)==1 ||
 | 
			
		||||
				 sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms",&rta)==1)
 | 
			
		||||
			if((sscanf(buf,"round-trip min/avg/max = %*f/%f/%*f%n",&rta,&match) && match) ||
 | 
			
		||||
				 (sscanf(buf,"round-trip min/avg/max/mdev = %*f/%f/%*f/%*f%n",&rta,&match) && match) ||
 | 
			
		||||
				 (sscanf(buf,"round-trip min/avg/max/sdev = %*f/%f/%*f/%*f%n",&rta,&match) && match) ||
 | 
			
		||||
				 (sscanf(buf,"round-trip min/avg/max/stddev = %*f/%f/%*f/%*f%n",&rta,&match) && match) ||
 | 
			
		||||
				 (sscanf(buf,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f%n",&rta,&match) && match) ||
 | 
			
		||||
				 (sscanf(buf,"round-trip (ms) min/avg/max = %*f/%f/%*f%n",&rta,&match) && match) ||
 | 
			
		||||
				 (sscanf(buf,"round-trip (ms) min/avg/max/stddev = %*f/%f/%*f/%*f%n",&rta,&match) && match) ||
 | 
			
		||||
				 (sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms%n",&rta,&match) && match))
 | 
			
		||||
			continue;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -318,6 +318,8 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
	int err;
 | 
			
		||||
	int cflags = REG_NOSUB | REG_EXTENDED;
 | 
			
		||||
	char errbuf[MAX_INPUT_BUFFER];
 | 
			
		||||
	char *temp_string;
 | 
			
		||||
	int i=0;
 | 
			
		||||
	static struct option longopts[] = {
 | 
			
		||||
		{"warning", required_argument, 0, 'w'},
 | 
			
		||||
		{"critical", required_argument, 0, 'c'},
 | 
			
		||||
| 
						 | 
				
			
			@ -450,7 +452,14 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
				regerror (err, &re_args, errbuf, MAX_INPUT_BUFFER);
 | 
			
		||||
				die (STATE_UNKNOWN, "PROCS %s: %s - %s\n", _("UNKNOWN"), _("Could not compile regular expression"), errbuf);
 | 
			
		||||
			}
 | 
			
		||||
			asprintf (&fmt, "%s%sregex args '%s'", (fmt ? fmt : ""), (options ? ", " : ""), optarg);
 | 
			
		||||
			/* Strip off any | within the regex optarg */
 | 
			
		||||
			temp_string = strdup(optarg);
 | 
			
		||||
			while(temp_string[i]!='\0'){
 | 
			
		||||
				if(temp_string[i]=='|')
 | 
			
		||||
					temp_string[i]=',';
 | 
			
		||||
				i++;
 | 
			
		||||
			}
 | 
			
		||||
			asprintf (&fmt, "%s%sregex args '%s'", (fmt ? fmt : ""), (options ? ", " : ""), temp_string);
 | 
			
		||||
			options |= EREG_ARGS;
 | 
			
		||||
			break;
 | 
			
		||||
		case 'r': 					/* RSS */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -211,7 +211,7 @@ main (int argc, char **argv)
 | 
			
		|||
	if (result == OK_RC)
 | 
			
		||||
		die (STATE_OK, _("Auth OK"));
 | 
			
		||||
	(void)snprintf(msg, sizeof(msg), _("Unexpected result code %d"), result);
 | 
			
		||||
	die (STATE_UNKNOWN, msg);
 | 
			
		||||
	die (STATE_UNKNOWN, "%s", msg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -114,6 +114,7 @@ enum {
 | 
			
		|||
  TCP_PROTOCOL = 1,
 | 
			
		||||
  UDP_PROTOCOL = 2,
 | 
			
		||||
};
 | 
			
		||||
int ignore_send_quit_failure = FALSE;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
| 
						 | 
				
			
			@ -129,6 +130,9 @@ main (int argc, char **argv)
 | 
			
		|||
	char *error_msg = "";
 | 
			
		||||
	struct timeval tv;
 | 
			
		||||
 | 
			
		||||
	/* Catch pipe errors in read/write - sometimes occurs when writing QUIT */
 | 
			
		||||
	(void) signal (SIGPIPE, SIG_IGN);
 | 
			
		||||
 | 
			
		||||
	setlocale (LC_ALL, "");
 | 
			
		||||
	bindtextdomain (PACKAGE, LOCALEDIR);
 | 
			
		||||
	textdomain (PACKAGE);
 | 
			
		||||
| 
						 | 
				
			
			@ -183,7 +187,7 @@ main (int argc, char **argv)
 | 
			
		|||
		/* return a WARNING status if we couldn't read any data */
 | 
			
		||||
		if (recvlines(buffer, MAX_INPUT_BUFFER) <= 0) {
 | 
			
		||||
			printf (_("recv() failed\n"));
 | 
			
		||||
			result = STATE_WARNING;
 | 
			
		||||
			return STATE_WARNING;
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			if (verbose)
 | 
			
		||||
| 
						 | 
				
			
			@ -197,7 +201,7 @@ main (int argc, char **argv)
 | 
			
		|||
				else
 | 
			
		||||
					printf (_("Invalid SMTP response received from host on port %d: %s\n"),
 | 
			
		||||
									server_port, buffer);
 | 
			
		||||
				result = STATE_WARNING;
 | 
			
		||||
				return STATE_WARNING;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -272,9 +276,6 @@ main (int argc, char **argv)
 | 
			
		|||
#  ifdef USE_OPENSSL
 | 
			
		||||
		  if ( check_cert ) {
 | 
			
		||||
		    result = np_net_ssl_check_cert(days_till_exp);
 | 
			
		||||
		    if(result != STATE_OK){
 | 
			
		||||
		      printf ("%s\n", _("CRITICAL - Cannot retrieve server certificate."));
 | 
			
		||||
		    }
 | 
			
		||||
		    my_close();
 | 
			
		||||
		    return result;
 | 
			
		||||
		  }
 | 
			
		||||
| 
						 | 
				
			
			@ -476,6 +477,7 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
		{"help", no_argument, 0, 'h'},
 | 
			
		||||
		{"starttls",no_argument,0,'S'},
 | 
			
		||||
		{"certificate",required_argument,0,'D'},
 | 
			
		||||
		{"ignore-quit-failure",no_argument,0,'q'},
 | 
			
		||||
		{0, 0, 0, 0}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -492,7 +494,7 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	while (1) {
 | 
			
		||||
		c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:R:SD:F:A:U:P:",
 | 
			
		||||
		c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:R:SD:F:A:U:P:q",
 | 
			
		||||
		                 longopts, &option);
 | 
			
		||||
 | 
			
		||||
		if (c == -1 || c == EOF)
 | 
			
		||||
| 
						 | 
				
			
			@ -579,6 +581,9 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
		case 'v':									/* verbose */
 | 
			
		||||
			verbose++;
 | 
			
		||||
			break;
 | 
			
		||||
		case 'q':
 | 
			
		||||
			ignore_send_quit_failure++;             /* ignore problem sending QUIT */
 | 
			
		||||
			break;
 | 
			
		||||
		case 't':									/* timeout */
 | 
			
		||||
			if (is_intnonneg (optarg)) {
 | 
			
		||||
				socket_timeout = atoi (optarg);
 | 
			
		||||
| 
						 | 
				
			
			@ -662,8 +667,20 @@ void
 | 
			
		|||
smtp_quit(void)
 | 
			
		||||
{
 | 
			
		||||
	int bytes;
 | 
			
		||||
	int n;
 | 
			
		||||
 | 
			
		||||
	n = my_send(SMTP_QUIT, strlen(SMTP_QUIT));
 | 
			
		||||
	if(n < 0) {
 | 
			
		||||
		if(ignore_send_quit_failure) {
 | 
			
		||||
			if(verbose) {
 | 
			
		||||
				printf(_("Connection closed by server before sending QUIT command\n"));
 | 
			
		||||
			}
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		die (STATE_UNKNOWN,
 | 
			
		||||
			_("Connection closed by server before sending QUIT command\n"));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	my_send(SMTP_QUIT, strlen(SMTP_QUIT));
 | 
			
		||||
	if (verbose)
 | 
			
		||||
		printf(_("sent %s\n"), "QUIT");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -797,7 +814,9 @@ print_help (void)
 | 
			
		|||
  printf ("    %s\n", _("SMTP AUTH username"));
 | 
			
		||||
  printf (" %s\n", "-P, --authpass=STRING");
 | 
			
		||||
  printf ("    %s\n", _("SMTP AUTH password"));
 | 
			
		||||
 | 
			
		||||
  printf (" %s\n", "-q, --ignore-quit-failure");
 | 
			
		||||
  printf ("    %s\n", _("Ignore failure when sending QUIT command to server"));
 | 
			
		||||
   
 | 
			
		||||
	printf (UT_WARN_CRIT);
 | 
			
		||||
 | 
			
		||||
	printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
 | 
			
		||||
| 
						 | 
				
			
			@ -821,6 +840,6 @@ print_usage (void)
 | 
			
		|||
  printf ("%s\n", _("Usage:"));
 | 
			
		||||
  printf ("%s -H host [-p port] [-e expect] [-C command] [-f from addr]", progname);
 | 
			
		||||
  printf ("[-A authtype -U authuser -P authpass] [-w warn] [-c crit] [-t timeout]\n");
 | 
			
		||||
  printf ("[-F fqdn] [-S] [-D days] [-v] [-4|-6]\n");
 | 
			
		||||
  printf ("[-F fqdn] [-S] [-D days] [-v] [-4|-6] [-q]\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -169,7 +169,6 @@ main (int argc, char **argv)
 | 
			
		|||
	char *state_string=NULL;
 | 
			
		||||
	size_t response_length, current_length, string_length;
 | 
			
		||||
	char *temp_string=NULL;
 | 
			
		||||
	int is_numeric=0;
 | 
			
		||||
	time_t current_time;
 | 
			
		||||
	double temp_double;
 | 
			
		||||
	time_t duration;
 | 
			
		||||
| 
						 | 
				
			
			@ -335,29 +334,24 @@ main (int argc, char **argv)
 | 
			
		|||
		/* We strip out the datatype indicator for PHBs */
 | 
			
		||||
		if (strstr (response, "Gauge: ")) {
 | 
			
		||||
			show = strstr (response, "Gauge: ") + 7;
 | 
			
		||||
			is_numeric++;
 | 
			
		||||
		} 
 | 
			
		||||
		else if (strstr (response, "Gauge32: ")) {
 | 
			
		||||
			show = strstr (response, "Gauge32: ") + 9;
 | 
			
		||||
			is_numeric++;
 | 
			
		||||
		} 
 | 
			
		||||
		else if (strstr (response, "Counter32: ")) {
 | 
			
		||||
			show = strstr (response, "Counter32: ") + 11;
 | 
			
		||||
			is_numeric++;
 | 
			
		||||
			is_counter=1;
 | 
			
		||||
			if(!calculate_rate) 
 | 
			
		||||
				strcpy(type, "c");
 | 
			
		||||
		}
 | 
			
		||||
		else if (strstr (response, "Counter64: ")) {
 | 
			
		||||
			show = strstr (response, "Counter64: ") + 11;
 | 
			
		||||
			is_numeric++;
 | 
			
		||||
			is_counter=1;
 | 
			
		||||
			if(!calculate_rate)
 | 
			
		||||
				strcpy(type, "c");
 | 
			
		||||
		}
 | 
			
		||||
		else if (strstr (response, "INTEGER: ")) {
 | 
			
		||||
			show = strstr (response, "INTEGER: ") + 9;
 | 
			
		||||
			is_numeric++;
 | 
			
		||||
		}
 | 
			
		||||
		else if (strstr (response, "STRING: ")) {
 | 
			
		||||
			show = strstr (response, "STRING: ") + 8;
 | 
			
		||||
| 
						 | 
				
			
			@ -396,15 +390,17 @@ main (int argc, char **argv)
 | 
			
		|||
			}
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
		else if (strstr (response, "Timeticks: "))
 | 
			
		||||
		else if (strstr (response, "Timeticks: ")) {
 | 
			
		||||
			show = strstr (response, "Timeticks: ");
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
			show = response;
 | 
			
		||||
 | 
			
		||||
		iresult = STATE_DEPENDENT;
 | 
			
		||||
 | 
			
		||||
		/* Process this block for numeric comparisons */
 | 
			
		||||
		 if (is_numeric) {
 | 
			
		||||
		/* Make some special values,like Timeticks numeric only if a threshold is defined */
 | 
			
		||||
		if (thlds[i]->warning || thlds[i]->critical || calculate_rate) {
 | 
			
		||||
			ptr = strpbrk (show, "0123456789");
 | 
			
		||||
			if (ptr == NULL)
 | 
			
		||||
				die (STATE_UNKNOWN,_("No valid data returned"));
 | 
			
		||||
| 
						 | 
				
			
			@ -744,7 +740,7 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
			labels[nlabels - 1] = optarg;
 | 
			
		||||
			ptr = thisarg (optarg);
 | 
			
		||||
			labels[nlabels - 1] = ptr;
 | 
			
		||||
			if (strstr (ptr, "'") == ptr)
 | 
			
		||||
			if (ptr[0] == '\'')
 | 
			
		||||
				labels[nlabels - 1] = ptr + 1;
 | 
			
		||||
			while (ptr && (ptr = nextarg (ptr))) {
 | 
			
		||||
				if (nlabels >= labels_size) {
 | 
			
		||||
| 
						 | 
				
			
			@ -753,9 +749,9 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
					if (labels == NULL)
 | 
			
		||||
						die (STATE_UNKNOWN, _("Could not reallocate labels\n"));
 | 
			
		||||
				}
 | 
			
		||||
				labels++;
 | 
			
		||||
				nlabels++;
 | 
			
		||||
				ptr = thisarg (ptr);
 | 
			
		||||
				if (strstr (ptr, "'") == ptr)
 | 
			
		||||
				if (ptr[0] == '\'')
 | 
			
		||||
					labels[nlabels - 1] = ptr + 1;
 | 
			
		||||
				else
 | 
			
		||||
					labels[nlabels - 1] = ptr;
 | 
			
		||||
| 
						 | 
				
			
			@ -773,7 +769,7 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
			unitv[nunits - 1] = optarg;
 | 
			
		||||
			ptr = thisarg (optarg);
 | 
			
		||||
			unitv[nunits - 1] = ptr;
 | 
			
		||||
			if (strstr (ptr, "'") == ptr)
 | 
			
		||||
			if (ptr[0] == '\'')
 | 
			
		||||
				unitv[nunits - 1] = ptr + 1;
 | 
			
		||||
			while (ptr && (ptr = nextarg (ptr))) {
 | 
			
		||||
				if (nunits >= unitv_size) {
 | 
			
		||||
| 
						 | 
				
			
			@ -784,7 +780,7 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
				}
 | 
			
		||||
				nunits++;
 | 
			
		||||
				ptr = thisarg (ptr);
 | 
			
		||||
				if (strstr (ptr, "'") == ptr)
 | 
			
		||||
				if (ptr[0] == '\'')
 | 
			
		||||
					unitv[nunits - 1] = ptr + 1;
 | 
			
		||||
				else
 | 
			
		||||
					unitv[nunits - 1] = ptr;
 | 
			
		||||
| 
						 | 
				
			
			@ -939,7 +935,7 @@ char *
 | 
			
		|||
thisarg (char *str)
 | 
			
		||||
{
 | 
			
		||||
	str += strspn (str, " \t\r\n");	/* trim any leading whitespace */
 | 
			
		||||
	if (strstr (str, "'") == str) {	/* handle SIMPLE quoted strings */
 | 
			
		||||
	if (str[0] == '\'') {	/* handle SIMPLE quoted strings */
 | 
			
		||||
		if (strlen (str) == 1 || !strstr (str + 1, "'"))
 | 
			
		||||
			die (STATE_UNKNOWN, _("Unbalanced quotes\n"));
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -955,7 +951,7 @@ thisarg (char *str)
 | 
			
		|||
char *
 | 
			
		||||
nextarg (char *str)
 | 
			
		||||
{
 | 
			
		||||
	if (strstr (str, "'") == str) {
 | 
			
		||||
	if (str[0] == '\'') {
 | 
			
		||||
		str[0] = 0;
 | 
			
		||||
		if (strlen (str) > 1) {
 | 
			
		||||
			str = strstr (str + 1, "'");
 | 
			
		||||
| 
						 | 
				
			
			@ -965,7 +961,7 @@ nextarg (char *str)
 | 
			
		|||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (strstr (str, ",") == str) {
 | 
			
		||||
	if (str[0] == ',') {
 | 
			
		||||
		str[0] = 0;
 | 
			
		||||
		if (strlen (str) > 1) {
 | 
			
		||||
			return (++str);
 | 
			
		||||
| 
						 | 
				
			
			@ -1076,8 +1072,8 @@ print_help (void)
 | 
			
		|||
 | 
			
		||||
	printf ("\n");
 | 
			
		||||
	printf ("%s\n", _("Notes:"));
 | 
			
		||||
	printf (" %s\n", _("- Multiple OIDs may be indicated by a comma or space-delimited list (lists with"));
 | 
			
		||||
	printf ("   %s %i %s\n", _("internal spaces must be quoted). Maximum:"), MAX_OIDS, _("OIDs."));
 | 
			
		||||
	printf (" %s\n", _("- Multiple OIDs (and labels) may be indicated by a comma or space-delimited  "));
 | 
			
		||||
	printf ("   %s %i %s\n", _("list (lists with internal spaces must be quoted). Maximum:"), MAX_OIDS, _("OIDs."));
 | 
			
		||||
 | 
			
		||||
	printf(" -%s", UT_THRESHOLDS_NOTES);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -215,6 +215,10 @@ ssh_connect (char *haddr, int hport, char *remote_version)
 | 
			
		|||
	char *ssh_proto = NULL;
 | 
			
		||||
	char *ssh_server = NULL;
 | 
			
		||||
	static char *rev_no = VERSION;
 | 
			
		||||
	struct timeval tv;
 | 
			
		||||
	double elapsed_time;
 | 
			
		||||
 | 
			
		||||
	gettimeofday(&tv, NULL);
 | 
			
		||||
 | 
			
		||||
	result = my_tcp_connect (haddr, hport, &sd);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -250,9 +254,12 @@ ssh_connect (char *haddr, int hport, char *remote_version)
 | 
			
		|||
			exit (STATE_WARNING);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		elapsed_time = (double)deltime(tv) / 1.0e6;
 | 
			
		||||
 | 
			
		||||
		printf
 | 
			
		||||
			(_("SSH OK - %s (protocol %s)\n"),
 | 
			
		||||
			 ssh_server, ssh_proto);
 | 
			
		||||
			(_("SSH OK - %s (protocol %s) | %s\n"),
 | 
			
		||||
			 ssh_server, ssh_proto, fperfdata("time", elapsed_time, "s",
 | 
			
		||||
			 FALSE, 0, FALSE, 0, TRUE, 0, TRUE, (int)socket_timeout));
 | 
			
		||||
		close(sd);
 | 
			
		||||
		exit (STATE_OK);
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -236,12 +236,9 @@ main (int argc, char **argv)
 | 
			
		|||
		result = np_net_ssl_init(sd);
 | 
			
		||||
		if (result == STATE_OK && check_cert == TRUE) {
 | 
			
		||||
			result = np_net_ssl_check_cert(days_till_exp);
 | 
			
		||||
			if(result != STATE_OK) {
 | 
			
		||||
				printf(_("CRITICAL - Cannot retrieve server certificate.\n"));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if(result != STATE_OK){
 | 
			
		||||
	if(result != STATE_OK || check_cert == TRUE){
 | 
			
		||||
		np_net_ssl_cleanup();
 | 
			
		||||
		if(sd) close(sd);
 | 
			
		||||
		return result;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
* Nagios check_users plugin
 | 
			
		||||
* 
 | 
			
		||||
* License: GPL
 | 
			
		||||
* Copyright (c) 2000-2007 Nagios Plugins Development Team
 | 
			
		||||
* Copyright (c) 2000-2012 Nagios Plugins Development Team
 | 
			
		||||
* 
 | 
			
		||||
* Description:
 | 
			
		||||
* 
 | 
			
		||||
| 
						 | 
				
			
			@ -35,8 +35,8 @@ const char *copyright = "2000-2007";
 | 
			
		|||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
 | 
			
		||||
 | 
			
		||||
#include "common.h"
 | 
			
		||||
#include "popen.h"
 | 
			
		||||
#include "utils.h"
 | 
			
		||||
#include <utmpx.h>
 | 
			
		||||
 | 
			
		||||
#define possibly_set(a,b) ((a) == 0 ? (b) : 0)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -52,58 +52,33 @@ main (int argc, char **argv)
 | 
			
		|||
{
 | 
			
		||||
	int users = -1;
 | 
			
		||||
	int result = STATE_UNKNOWN;
 | 
			
		||||
	char input_buffer[MAX_INPUT_BUFFER];
 | 
			
		||||
	char *perf;
 | 
			
		||||
	struct utmpx *putmpx;
 | 
			
		||||
 | 
			
		||||
	setlocale (LC_ALL, "");
 | 
			
		||||
	bindtextdomain (PACKAGE, LOCALEDIR);
 | 
			
		||||
	textdomain (PACKAGE);
 | 
			
		||||
 | 
			
		||||
	perf = strdup("");
 | 
			
		||||
	perf = strdup ("");
 | 
			
		||||
 | 
			
		||||
	/* Parse extra opts if any */
 | 
			
		||||
	argv=np_extra_opts (&argc, argv, progname);
 | 
			
		||||
	argv = np_extra_opts (&argc, argv, progname);
 | 
			
		||||
 | 
			
		||||
	if (process_arguments (argc, argv) == ERROR)
 | 
			
		||||
		usage4 (_("Could not parse arguments"));
 | 
			
		||||
 | 
			
		||||
	/* run the command */
 | 
			
		||||
	child_process = spopen (WHO_COMMAND);
 | 
			
		||||
	if (child_process == NULL) {
 | 
			
		||||
		printf (_("Could not open pipe: %s\n"), WHO_COMMAND);
 | 
			
		||||
		return STATE_UNKNOWN;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
 | 
			
		||||
	if (child_stderr == NULL)
 | 
			
		||||
		printf (_("Could not open stderr for %s\n"), WHO_COMMAND);
 | 
			
		||||
 | 
			
		||||
	users = 0;
 | 
			
		||||
 | 
			
		||||
	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
 | 
			
		||||
	/* get currently logged users from utmpx */
 | 
			
		||||
	setutxent ();
 | 
			
		||||
 | 
			
		||||
		/* increment 'users' on all lines except total user count */
 | 
			
		||||
		if (input_buffer[0] != '#') {
 | 
			
		||||
	while ((putmpx = getutxent ()) != NULL)
 | 
			
		||||
		if (putmpx->ut_type == USER_PROCESS)
 | 
			
		||||
			users++;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* get total logged in users */
 | 
			
		||||
		if (sscanf (input_buffer, _("# users=%d"), &users) == 1)
 | 
			
		||||
			break;
 | 
			
		||||
	endutxent ();
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* check STDERR */
 | 
			
		||||
	if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
 | 
			
		||||
		result = possibly_set (result, STATE_UNKNOWN);
 | 
			
		||||
	(void) fclose (child_stderr);
 | 
			
		||||
 | 
			
		||||
	/* close the pipe */
 | 
			
		||||
	if (spclose (child_process))
 | 
			
		||||
		result = possibly_set (result, STATE_UNKNOWN);
 | 
			
		||||
 | 
			
		||||
	/* else check the user count against warning and critical thresholds */
 | 
			
		||||
	/* check the user count against warning and critical thresholds */
 | 
			
		||||
	if (users > cusers)
 | 
			
		||||
		result = STATE_CRITICAL;
 | 
			
		||||
	else if (users > wusers)
 | 
			
		||||
| 
						 | 
				
			
			@ -114,7 +89,7 @@ main (int argc, char **argv)
 | 
			
		|||
	if (result == STATE_UNKNOWN)
 | 
			
		||||
		printf ("%s\n", _("Unable to read output"));
 | 
			
		||||
	else {
 | 
			
		||||
		asprintf(&perf, "%s", perfdata ("users", users, "",
 | 
			
		||||
		asprintf (&perf, "%s", perfdata ("users", users, "",
 | 
			
		||||
		  TRUE, wusers,
 | 
			
		||||
		  TRUE, cusers,
 | 
			
		||||
		  TRUE, 0,
 | 
			
		||||
| 
						 | 
				
			
			@ -126,14 +101,11 @@ main (int argc, char **argv)
 | 
			
		|||
	return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* process command-line arguments */
 | 
			
		||||
int
 | 
			
		||||
process_arguments (int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	int c;
 | 
			
		||||
 | 
			
		||||
	int option = 0;
 | 
			
		||||
	static struct option longopts[] = {
 | 
			
		||||
		{"critical", required_argument, 0, 'c'},
 | 
			
		||||
| 
						 | 
				
			
			@ -183,7 +155,6 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
		else
 | 
			
		||||
			wusers = atoi (argv[c++]);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (cusers == -1 && argc > c) {
 | 
			
		||||
		if (is_intnonneg (argv[c]) == FALSE)
 | 
			
		||||
			usage4 (_("Warning threshold must be a positive integer"));
 | 
			
		||||
| 
						 | 
				
			
			@ -194,8 +165,6 @@ process_arguments (int argc, char **argv)
 | 
			
		|||
	return OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
print_help (void)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -205,9 +174,9 @@ print_help (void)
 | 
			
		|||
	printf (COPYRIGHT, copyright, email);
 | 
			
		||||
 | 
			
		||||
	printf ("%s\n", _("This plugin checks the number of users currently logged in on the local"));
 | 
			
		||||
  printf ("%s\n", _("system and generates an error if the number exceeds the thresholds specified."));
 | 
			
		||||
	printf ("%s\n", _("system and generates an error if the number exceeds the thresholds specified."));
 | 
			
		||||
 | 
			
		||||
  printf ("\n\n");
 | 
			
		||||
	printf ("\n\n");
 | 
			
		||||
 | 
			
		||||
	print_usage ();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -215,17 +184,16 @@ print_help (void)
 | 
			
		|||
	printf (UT_EXTRA_OPTS);
 | 
			
		||||
 | 
			
		||||
	printf (" %s\n", "-w, --warning=INTEGER");
 | 
			
		||||
  printf ("    %s\n", _("Set WARNING status if more than INTEGER users are logged in"));
 | 
			
		||||
  printf (" %s\n", "-c, --critical=INTEGER");
 | 
			
		||||
  printf ("    %s\n", _("Set CRITICAL status if more than INTEGER users are logged in"));
 | 
			
		||||
	printf ("    %s\n", _("Set WARNING status if more than INTEGER users are logged in"));
 | 
			
		||||
	printf (" %s\n", "-c, --critical=INTEGER");
 | 
			
		||||
	printf ("    %s\n", _("Set CRITICAL status if more than INTEGER users are logged in"));
 | 
			
		||||
 | 
			
		||||
	printf (UT_SUPPORT);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
print_usage (void)
 | 
			
		||||
{
 | 
			
		||||
  printf ("%s\n", _("Usage:"));
 | 
			
		||||
	printf ("%s\n", _("Usage:"));
 | 
			
		||||
	printf ("%s -w <users> -c <users>\n", progname);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,6 +59,12 @@
 | 
			
		|||
#include <math.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef _AIX
 | 
			
		||||
#ifdef HAVE_MP_H
 | 
			
		||||
#include <mp.h>
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_STRINGS_H
 | 
			
		||||
#include <strings.h>
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
* Nagios plugins SSL utilities
 | 
			
		||||
* 
 | 
			
		||||
* License: GPL
 | 
			
		||||
* Copyright (c) 2005-2007 Nagios Plugins Development Team
 | 
			
		||||
* Copyright (c) 2005-2010 Nagios Plugins Development Team
 | 
			
		||||
* 
 | 
			
		||||
* Description:
 | 
			
		||||
* 
 | 
			
		||||
| 
						 | 
				
			
			@ -26,6 +26,7 @@
 | 
			
		|||
* 
 | 
			
		||||
*****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#define MAX_CN_LENGTH 256
 | 
			
		||||
#define LOCAL_TIMEOUT_ALARM_HANDLER
 | 
			
		||||
#include "common.h"
 | 
			
		||||
#include "netutils.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -35,68 +36,104 @@ static SSL_CTX *c=NULL;
 | 
			
		|||
static SSL *s=NULL;
 | 
			
		||||
static int initialized=0;
 | 
			
		||||
 | 
			
		||||
int np_net_ssl_init (int sd) {
 | 
			
		||||
		return np_net_ssl_init_with_hostname(sd, NULL);
 | 
			
		||||
int np_net_ssl_init(int sd) {
 | 
			
		||||
	return np_net_ssl_init_with_hostname(sd, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int np_net_ssl_init_with_hostname (int sd, char *host_name) {
 | 
			
		||||
		if (!initialized) {
 | 
			
		||||
			/* Initialize SSL context */
 | 
			
		||||
			SSLeay_add_ssl_algorithms ();
 | 
			
		||||
			SSL_load_error_strings ();
 | 
			
		||||
			OpenSSL_add_all_algorithms ();
 | 
			
		||||
			initialized = 1;
 | 
			
		||||
		}
 | 
			
		||||
		if ((c = SSL_CTX_new (SSLv23_client_method ())) == NULL) {
 | 
			
		||||
				printf ("%s\n", _("CRITICAL - Cannot create SSL context."));
 | 
			
		||||
				return STATE_CRITICAL;
 | 
			
		||||
		}
 | 
			
		||||
		if ((s = SSL_new (c)) != NULL){
 | 
			
		||||
#ifdef SSL_set_tlsext_host_name
 | 
			
		||||
				if (host_name != NULL)
 | 
			
		||||
					SSL_set_tlsext_host_name(s, host_name);
 | 
			
		||||
#endif
 | 
			
		||||
				SSL_set_fd (s, sd);
 | 
			
		||||
				if (SSL_connect(s) == 1){
 | 
			
		||||
						return OK;
 | 
			
		||||
				} else {
 | 
			
		||||
						printf ("%s\n", _("CRITICAL - Cannot make SSL connection "));
 | 
			
		||||
#  ifdef USE_OPENSSL /* XXX look into ERR_error_string */
 | 
			
		||||
						ERR_print_errors_fp (stdout);
 | 
			
		||||
#  endif /* USE_OPENSSL */
 | 
			
		||||
				}
 | 
			
		||||
		} else {
 | 
			
		||||
				printf ("%s\n", _("CRITICAL - Cannot initiate SSL handshake."));
 | 
			
		||||
		}
 | 
			
		||||
int np_net_ssl_init_with_hostname(int sd, char *host_name) {
 | 
			
		||||
	return np_net_ssl_init_with_hostname_and_version(sd, host_name, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int np_net_ssl_init_with_hostname_and_version(int sd, char *host_name, int version) {
 | 
			
		||||
	const SSL_METHOD *method = NULL;
 | 
			
		||||
 | 
			
		||||
	switch (version) {
 | 
			
		||||
	case 0: /* Deafult to auto negotiation */
 | 
			
		||||
		method = SSLv23_client_method();
 | 
			
		||||
		break;
 | 
			
		||||
	case 1: /* TLSv1 protocol */
 | 
			
		||||
		method = TLSv1_client_method();
 | 
			
		||||
		break;
 | 
			
		||||
	case 2: /* SSLv2 protocol */
 | 
			
		||||
#if defined(USE_GNUTLS) || defined(OPENSSL_NO_SSL2)
 | 
			
		||||
		printf(("%s\n", _("CRITICAL - SSL protocol version 2 is not supported by your SSL library.")));
 | 
			
		||||
		return STATE_CRITICAL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void np_net_ssl_cleanup (){
 | 
			
		||||
		if(s){
 | 
			
		||||
#ifdef SSL_set_tlsext_host_name
 | 
			
		||||
				SSL_set_tlsext_host_name(s, NULL);
 | 
			
		||||
#else
 | 
			
		||||
		method = SSLv2_client_method();
 | 
			
		||||
#endif
 | 
			
		||||
				SSL_shutdown (s);
 | 
			
		||||
				SSL_free (s);
 | 
			
		||||
				if(c) {
 | 
			
		||||
					SSL_CTX_free (c);
 | 
			
		||||
					c=NULL;
 | 
			
		||||
				}
 | 
			
		||||
				s=NULL;
 | 
			
		||||
		break;
 | 
			
		||||
	case 3: /* SSLv3 protocol */
 | 
			
		||||
		method = SSLv3_client_method();
 | 
			
		||||
		break;
 | 
			
		||||
	default: /* Unsupported */
 | 
			
		||||
		printf("%s\n", _("CRITICAL - Unsupported SSL protocol version."));
 | 
			
		||||
		return STATE_CRITICAL;
 | 
			
		||||
	}
 | 
			
		||||
	if (!initialized) {
 | 
			
		||||
		/* Initialize SSL context */
 | 
			
		||||
		SSLeay_add_ssl_algorithms();
 | 
			
		||||
		SSL_load_error_strings();
 | 
			
		||||
		OpenSSL_add_all_algorithms();
 | 
			
		||||
		initialized = 1;
 | 
			
		||||
	}
 | 
			
		||||
	if ((c = SSL_CTX_new(method)) == NULL) {
 | 
			
		||||
		printf("%s\n", _("CRITICAL - Cannot create SSL context."));
 | 
			
		||||
		return STATE_CRITICAL;
 | 
			
		||||
	}
 | 
			
		||||
#ifdef SSL_OP_NO_TICKET
 | 
			
		||||
	SSL_CTX_set_options(c, SSL_OP_NO_TICKET);
 | 
			
		||||
#endif
 | 
			
		||||
	if ((s = SSL_new(c)) != NULL) {
 | 
			
		||||
#ifdef SSL_set_tlsext_host_name
 | 
			
		||||
		if (host_name != NULL)
 | 
			
		||||
			SSL_set_tlsext_host_name(s, host_name);
 | 
			
		||||
#endif
 | 
			
		||||
		SSL_set_fd(s, sd);
 | 
			
		||||
		if (SSL_connect(s) == 1) {
 | 
			
		||||
			return OK;
 | 
			
		||||
		} else {
 | 
			
		||||
			printf("%s\n", _("CRITICAL - Cannot make SSL connection."));
 | 
			
		||||
#  ifdef USE_OPENSSL /* XXX look into ERR_error_string */
 | 
			
		||||
			ERR_print_errors_fp(stdout);
 | 
			
		||||
#  endif /* USE_OPENSSL */
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
			printf("%s\n", _("CRITICAL - Cannot initiate SSL handshake."));
 | 
			
		||||
	}
 | 
			
		||||
	return STATE_CRITICAL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int np_net_ssl_write(const void *buf, int num){
 | 
			
		||||
void np_net_ssl_cleanup() {
 | 
			
		||||
	if (s) {
 | 
			
		||||
#ifdef SSL_set_tlsext_host_name
 | 
			
		||||
		SSL_set_tlsext_host_name(s, NULL);
 | 
			
		||||
#endif
 | 
			
		||||
		SSL_shutdown(s);
 | 
			
		||||
		SSL_free(s);
 | 
			
		||||
		if (c) {
 | 
			
		||||
			SSL_CTX_free(c);
 | 
			
		||||
			c=NULL;
 | 
			
		||||
		}
 | 
			
		||||
		s=NULL;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int np_net_ssl_write(const void *buf, int num) {
 | 
			
		||||
	return SSL_write(s, buf, num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int np_net_ssl_read(void *buf, int num){
 | 
			
		||||
int np_net_ssl_read(void *buf, int num) {
 | 
			
		||||
	return SSL_read(s, buf, num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int np_net_ssl_check_cert(int days_till_exp){
 | 
			
		||||
int np_net_ssl_check_cert(int days_till_exp) {
 | 
			
		||||
#  ifdef USE_OPENSSL
 | 
			
		||||
	X509 *certificate=NULL;
 | 
			
		||||
	X509_NAME *subj=NULL;
 | 
			
		||||
	char cn[MAX_CN_LENGTH]= "";
 | 
			
		||||
	int cnlen =-1;
 | 
			
		||||
	int status=STATE_UNKNOWN;
 | 
			
		||||
 | 
			
		||||
	ASN1_STRING *tm;
 | 
			
		||||
	int offset;
 | 
			
		||||
	struct tm stamp;
 | 
			
		||||
| 
						 | 
				
			
			@ -105,18 +142,29 @@ int np_net_ssl_check_cert(int days_till_exp){
 | 
			
		|||
	char timestamp[17] = "";
 | 
			
		||||
 | 
			
		||||
	certificate=SSL_get_peer_certificate(s);
 | 
			
		||||
	if(! certificate){
 | 
			
		||||
		printf ("%s\n",_("CRITICAL - Cannot retrieve server certificate."));
 | 
			
		||||
	if (!certificate) {
 | 
			
		||||
		printf("%s\n",_("CRITICAL - Cannot retrieve server certificate."));
 | 
			
		||||
		return STATE_CRITICAL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Extract CN from certificate subject */
 | 
			
		||||
	subj=X509_get_subject_name(certificate);
 | 
			
		||||
 | 
			
		||||
	if (!subj) {
 | 
			
		||||
		printf("%s\n",_("CRITICAL - Cannot retrieve certificate subject."));
 | 
			
		||||
		return STATE_CRITICAL;
 | 
			
		||||
	}
 | 
			
		||||
	cnlen = X509_NAME_get_text_by_NID(subj, NID_commonName, cn, sizeof(cn));
 | 
			
		||||
	if (cnlen == -1)
 | 
			
		||||
		strcpy(cn, _("Unknown CN"));
 | 
			
		||||
 | 
			
		||||
	/* Retrieve timestamp of certificate */
 | 
			
		||||
	tm = X509_get_notAfter (certificate);
 | 
			
		||||
	tm = X509_get_notAfter(certificate);
 | 
			
		||||
 | 
			
		||||
	/* Generate tm structure to process timestamp */
 | 
			
		||||
	if (tm->type == V_ASN1_UTCTIME) {
 | 
			
		||||
		if (tm->length < 10) {
 | 
			
		||||
			printf ("%s\n", _("CRITICAL - Wrong time format in certificate."));
 | 
			
		||||
			printf("%s\n", _("CRITICAL - Wrong time format in certificate."));
 | 
			
		||||
			return STATE_CRITICAL;
 | 
			
		||||
		} else {
 | 
			
		||||
			stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0');
 | 
			
		||||
| 
						 | 
				
			
			@ -126,7 +174,7 @@ int np_net_ssl_check_cert(int days_till_exp){
 | 
			
		|||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		if (tm->length < 12) {
 | 
			
		||||
			printf ("%s\n", _("CRITICAL - Wrong time format in certificate."));
 | 
			
		||||
			printf("%s\n", _("CRITICAL - Wrong time format in certificate."));
 | 
			
		||||
			return STATE_CRITICAL;
 | 
			
		||||
		} else {
 | 
			
		||||
			stamp.tm_year =
 | 
			
		||||
| 
						 | 
				
			
			@ -155,21 +203,22 @@ int np_net_ssl_check_cert(int days_till_exp){
 | 
			
		|||
		 stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min);
 | 
			
		||||
 | 
			
		||||
	if (days_left > 0 && days_left <= days_till_exp) {
 | 
			
		||||
		printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp);
 | 
			
		||||
		return STATE_WARNING;
 | 
			
		||||
		printf(_("WARNING - Certificate '%s' expires in %d day(s) (%s).\n"), cn, days_left, timestamp);
 | 
			
		||||
		status=STATE_WARNING;
 | 
			
		||||
	} else if (time_left < 0) {
 | 
			
		||||
		printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp);
 | 
			
		||||
		return STATE_CRITICAL;
 | 
			
		||||
		printf(_("CRITICAL - Certificate '%s' expired on %s.\n"), cn, timestamp);
 | 
			
		||||
		status=STATE_CRITICAL;
 | 
			
		||||
	} else if (days_left == 0) {
 | 
			
		||||
		printf (_("WARNING - Certificate expires today (%s).\n"), timestamp);
 | 
			
		||||
		return STATE_WARNING;
 | 
			
		||||
		printf(_("WARNING - Certificate '%s' expires today (%s).\n"), cn, timestamp);
 | 
			
		||||
		status=STATE_WARNING;
 | 
			
		||||
	} else {
 | 
			
		||||
		printf(_("OK - Certificate '%s' will expire on %s.\n"), cn, timestamp);
 | 
			
		||||
		status=STATE_OK;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	printf (_("OK - Certificate will expire on %s.\n"), timestamp);
 | 
			
		||||
	X509_free (certificate);
 | 
			
		||||
	return STATE_OK;
 | 
			
		||||
	X509_free(certificate);
 | 
			
		||||
	return status;
 | 
			
		||||
#  else /* ifndef USE_OPENSSL */
 | 
			
		||||
	printf ("%s\n", _("WARNING - Plugin does not support checking certificates."));
 | 
			
		||||
	printf("%s\n", _("WARNING - Plugin does not support checking certificates."));
 | 
			
		||||
	return STATE_WARNING;
 | 
			
		||||
#  endif /* USE_OPENSSL */
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,9 +17,14 @@ my $ssh_key = getTestParameter( "NP_SSH_IDENTITY",
 | 
			
		|||
    "A key allowing access to NP_SSH_HOST",
 | 
			
		||||
    "~/.ssh/id_dsa");
 | 
			
		||||
 | 
			
		||||
my $ssh_conf = getTestParameter( "NP_SSH_CONFIGFILE",
 | 
			
		||||
    "A config file with ssh settings",
 | 
			
		||||
    "~/.ssh/config");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
plan skip_all => "SSH_HOST and SSH_IDENTITY must be defined" unless ($ssh_service && $ssh_key);
 | 
			
		||||
 | 
			
		||||
plan tests => 40;
 | 
			
		||||
plan tests => 42;
 | 
			
		||||
 | 
			
		||||
# Some random check strings/response
 | 
			
		||||
my @responce = ('OK: Everything is fine!',
 | 
			
		||||
| 
						 | 
				
			
			@ -85,6 +90,12 @@ $result = NPTest->testCmd(
 | 
			
		|||
cmp_ok($result->return_code, '==', 8, "Exit with return code 8 (out of bounds)");
 | 
			
		||||
is($result->output, $responce[4], "Return proper status text even with unknown status codes");
 | 
			
		||||
 | 
			
		||||
$result = NPTest->testCmd(
 | 
			
		||||
	"./check_by_ssh -i $ssh_key -H $ssh_service -F $ssh_conf -C 'exit 0'"
 | 
			
		||||
	);
 | 
			
		||||
cmp_ok($result->return_code, '==', 0, "Exit with return code 0 (OK)");
 | 
			
		||||
is($result->output, 'OK - check_by_ssh: Remote command \'exit 0\' returned status 0', "Status text if command returned none (OK)");
 | 
			
		||||
 | 
			
		||||
# Multiple active checks
 | 
			
		||||
$result = NPTest->testCmd(
 | 
			
		||||
	"./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[1]; sh -c exit\\ 1'  -C '$check[0]; sh -c exit\\ 0' -C '$check[3]; sh -c exit\\ 3' -C '$check[2]; sh -c exit\\ 2'"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,7 +102,7 @@ SKIP: {
 | 
			
		|||
 | 
			
		||||
        $res = NPTest->testCmd( "./check_http -C 1 --ssl www.verisign.com" );
 | 
			
		||||
        cmp_ok( $res->return_code, '==', 0, "Checking certificate for www.verisign.com");
 | 
			
		||||
        like  ( $res->output, '/Certificate will expire on/', "Output OK" );
 | 
			
		||||
        like  ( $res->output, "/Certificate 'www.verisign.com' will expire on/", "Output OK" );
 | 
			
		||||
        my $saved_cert_output = $res->output;
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd( "./check_http www.verisign.com -C 1" );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ use strict;
 | 
			
		|||
use Test::More;
 | 
			
		||||
use NPTest;
 | 
			
		||||
 | 
			
		||||
my $tests = 8+38+2+2;
 | 
			
		||||
my $tests = 8+42+2+2;
 | 
			
		||||
plan tests => $tests;
 | 
			
		||||
my $res;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -124,6 +124,13 @@ SKIP: {
 | 
			
		|||
		cmp_ok( $res->return_code, '==', 0, "Skipping all thresholds");
 | 
			
		||||
		like($res->output, '/^SNMP OK - \d+ \w+ \d+\s.*$/', "Skipping all thresholds, result printed rather than parsed");
 | 
			
		||||
 | 
			
		||||
		$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -c 1000000000000: -u '1/100 sec'");
 | 
			
		||||
		cmp_ok( $res->return_code, '==', 2, "Timetick used as a threshold");
 | 
			
		||||
		like($res->output, '/^SNMP CRITICAL - \*\d+\* 1\/100 sec.*$/', "Timetick used as a threshold, parsed as numeric");
 | 
			
		||||
 | 
			
		||||
		$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0");
 | 
			
		||||
		cmp_ok( $res->return_code, '==', 0, "Timetick used as a string");
 | 
			
		||||
		like($res->output, '/^SNMP OK - Timeticks:\s\(\d+\)\s+(?:\d+ days?,\s+)?\d+:\d+:\d+\.\d+\s.*$/', "Timetick used as a string, result printed rather than parsed");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	# These checks need a complete command line. An invalid community is used so
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,9 +18,24 @@ use Test::More;
 | 
			
		|||
use NPTest;
 | 
			
		||||
use FindBin qw($Bin);
 | 
			
		||||
 | 
			
		||||
use HTTP::Daemon;
 | 
			
		||||
use HTTP::Status;
 | 
			
		||||
use HTTP::Response;
 | 
			
		||||
my $common_tests = 66;
 | 
			
		||||
my $ssl_only_tests = 6;
 | 
			
		||||
# Check that all dependent modules are available
 | 
			
		||||
eval {
 | 
			
		||||
	require HTTP::Daemon;
 | 
			
		||||
	require HTTP::Status;
 | 
			
		||||
	require HTTP::Response;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
if ($@) {
 | 
			
		||||
	plan skip_all => "Missing required module for test: $@";
 | 
			
		||||
} else {
 | 
			
		||||
	if (-x "./check_http") {
 | 
			
		||||
		plan tests => $common_tests * 2 + $ssl_only_tests;
 | 
			
		||||
	} else {
 | 
			
		||||
		plan skip_all => "No check_http compiled";
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my $servers = { http => 0 };	# HTTP::Daemon should always be available
 | 
			
		||||
eval { require HTTP::Daemon::SSL };
 | 
			
		||||
| 
						 | 
				
			
			@ -112,9 +127,9 @@ sub run_server {
 | 
			
		|||
				$c->send_response("slow");
 | 
			
		||||
			} elsif ($r->url->path eq "/method") {
 | 
			
		||||
				if ($r->method eq "DELETE") {
 | 
			
		||||
					$c->send_error(RC_METHOD_NOT_ALLOWED);
 | 
			
		||||
					$c->send_error(HTTP::Status->RC_METHOD_NOT_ALLOWED);
 | 
			
		||||
				} elsif ($r->method eq "foo") {
 | 
			
		||||
					$c->send_error(RC_NOT_IMPLEMENTED);
 | 
			
		||||
					$c->send_error(HTTP::Status->RC_NOT_IMPLEMENTED);
 | 
			
		||||
				} else {
 | 
			
		||||
					$c->send_status_line(200, $r->method);
 | 
			
		||||
				}
 | 
			
		||||
| 
						 | 
				
			
			@ -138,7 +153,7 @@ sub run_server {
 | 
			
		|||
				delete($persist[1000]);
 | 
			
		||||
				next MAINLOOP;
 | 
			
		||||
			} else {
 | 
			
		||||
				$c->send_error(RC_FORBIDDEN);
 | 
			
		||||
				$c->send_error(HTTP::Status->RC_FORBIDDEN);
 | 
			
		||||
			}
 | 
			
		||||
			$c->close;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -157,14 +172,6 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my $common_tests = 66;
 | 
			
		||||
my $ssl_only_tests = 6;
 | 
			
		||||
if (-x "./check_http") {
 | 
			
		||||
	plan tests => $common_tests * 2 + $ssl_only_tests;
 | 
			
		||||
} else {
 | 
			
		||||
	plan skip_all => "No check_http compiled";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my $result;
 | 
			
		||||
my $command = "./check_http -H 127.0.0.1";
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -175,17 +182,17 @@ SKIP: {
 | 
			
		|||
	
 | 
			
		||||
	$result = NPTest->testCmd( "$command -p $port_https -S -C 14" );
 | 
			
		||||
	is( $result->return_code, 0, "$command -p $port_https -S -C 14" );
 | 
			
		||||
	is( $result->output, 'OK - Certificate will expire on 03/03/2019 21:41.', "output ok" );
 | 
			
		||||
	is( $result->output, 'OK - Certificate \'Ton Voon\' will expire on 03/03/2019 21:41.', "output ok" );
 | 
			
		||||
 | 
			
		||||
	$result = NPTest->testCmd( "$command -p $port_https -S -C 14000" );
 | 
			
		||||
	is( $result->return_code, 1, "$command -p $port_https -S -C 14000" );
 | 
			
		||||
	like( $result->output, '/WARNING - Certificate expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" );
 | 
			
		||||
	like( $result->output, '/WARNING - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" );
 | 
			
		||||
 | 
			
		||||
	# Expired cert tests
 | 
			
		||||
	$result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" );
 | 
			
		||||
	is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" );
 | 
			
		||||
	is( $result->output, 
 | 
			
		||||
		'CRITICAL - Certificate expired on 03/05/2009 00:13.',
 | 
			
		||||
		'CRITICAL - Certificate \'Ton Voon\' expired on 03/05/2009 00:13.',
 | 
			
		||||
		"output ok" );
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ use Test::More;
 | 
			
		|||
use NPTest;
 | 
			
		||||
 | 
			
		||||
if (-x "./check_procs") {
 | 
			
		||||
	plan tests => 48;
 | 
			
		||||
	plan tests => 50;
 | 
			
		||||
} else {
 | 
			
		||||
	plan skip_all => "No check_procs compiled";
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -113,3 +113,7 @@ $result = NPTest->testCmd( "$command --metric=RSS -c 70000 -v" );
 | 
			
		|||
is( $result->return_code, 2, "Checking against RSS > 70MB" );
 | 
			
		||||
is( $result->output, 'RSS CRITICAL: 5 crit, 0 warn out of 95 processes [WindowServer, SystemUIServer, Safari, Mail, Safari]', "Output correct" );
 | 
			
		||||
 | 
			
		||||
$result = NPTest->testCmd( "$command --ereg-argument-array='(nosuchname|nosuch2name)'" );
 | 
			
		||||
is( $result->return_code, 0, "Checking no pipe symbol in output" );
 | 
			
		||||
is( $result->output, "PROCS OK: 0 processes with regex args '(nosuchname,nosuch2name)'", "Output correct" );
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,7 @@ use Test::More;
 | 
			
		|||
use NPTest;
 | 
			
		||||
use FindBin qw($Bin);
 | 
			
		||||
 | 
			
		||||
my $tests = 41;
 | 
			
		||||
# Check that all dependent modules are available
 | 
			
		||||
eval {
 | 
			
		||||
	require NetSNMP::OID;
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +18,12 @@ eval {
 | 
			
		|||
 | 
			
		||||
if ($@) {
 | 
			
		||||
	plan skip_all => "Missing required module for test: $@";
 | 
			
		||||
} else {
 | 
			
		||||
	if (-x "./check_snmp") {
 | 
			
		||||
		plan tests => $tests;
 | 
			
		||||
	} else {
 | 
			
		||||
		plan skip_all => "No check_snmp compiled";
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my $port_snmp = 16100 + int(rand(100));
 | 
			
		||||
| 
						 | 
				
			
			@ -51,12 +58,8 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my $tests = 33;
 | 
			
		||||
if (-x "./check_snmp") {
 | 
			
		||||
	plan tests => $tests;
 | 
			
		||||
} else {
 | 
			
		||||
	plan skip_all => "No check_snmp compiled";
 | 
			
		||||
}
 | 
			
		||||
# We should merge that with $ENV{'NPTEST_CACHE'}, use one dir for all test data
 | 
			
		||||
$ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'} ||= "/var/tmp";
 | 
			
		||||
 | 
			
		||||
my $res;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +109,7 @@ like($res->output, '/'.quotemeta('SNMP OK - And now have fun with with this: \"C
 | 
			
		|||
"And now have fun with with this: \"C:\\\\\"
 | 
			
		||||
because we\'re not done yet!"').'/m', "Attempt to confuse parser No.3");
 | 
			
		||||
 | 
			
		||||
system("rm /usr/local/nagios/var/check_snmp/*");
 | 
			
		||||
system("rm -f ".$ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'}."/check_snmp/*");
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" );
 | 
			
		||||
is($res->return_code, 0, "Returns OK");
 | 
			
		||||
is($res->output, "No previous data to calculate rate - assume okay");
 | 
			
		||||
| 
						 | 
				
			
			@ -170,5 +173,19 @@ $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1
 | 
			
		|||
is($res->return_code, 0, "OK as string doesn't match but inverted" );
 | 
			
		||||
is($res->output, 'SNMP OK - "stringtests" | ', "OK as inverted string no match" );
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.12 -w 4:5" );
 | 
			
		||||
is($res->return_code, 1, "Numeric in string test" );
 | 
			
		||||
is($res->output, 'SNMP WARNING - *3.5* | iso.3.6.1.4.1.8072.3.2.67.12=3.5 ', "WARNING threshold checks for string masquerading as number" );
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.13" );
 | 
			
		||||
is($res->return_code, 0, "Not really numeric test" );
 | 
			
		||||
is($res->output, 'SNMP OK - "87.4startswithnumberbutshouldbestring" | ', "Check string with numeric start is still string" );
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.14" );
 | 
			
		||||
is($res->return_code, 0, "Not really numeric test (trying best to fool it)" );
 | 
			
		||||
is($res->output, 'SNMP OK - "555\"I said\"" | ', "Check string with a double quote following is still a string (looks like the perl routine will always escape though)" );
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK OK'" );
 | 
			
		||||
is($res->return_code, 0, "String check should check whole string, not a parsed number" );
 | 
			
		||||
is($res->output, 'SNMP OK - "CUSTOM CHECK OK: foo is 12345" | ', "String check witn numbers returns whole string");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,9 +33,10 @@ ends with with this: C:\\';
 | 
			
		|||
my $multilin5 = 'And now have fun with with this: "C:\\"
 | 
			
		||||
because we\'re not done yet!';
 | 
			
		||||
 | 
			
		||||
my @fields = (ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_UNSIGNED, ASN_UNSIGNED, ASN_COUNTER, ASN_COUNTER64, ASN_UNSIGNED, ASN_COUNTER, ASN_OCTET_STR);
 | 
			
		||||
my @values = ($multiline, $multilin2, $multilin3, $multilin4, $multilin5, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32)), 64000, "stringtests");
 | 
			
		||||
my @incrts = (undef, undef, undef, undef, undef, 1000, -500, 1000, 100000, undef, 666, undef);
 | 
			
		||||
# 0..15 <---- please update comment when adding/removing fields
 | 
			
		||||
my @fields = (ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_UNSIGNED, ASN_UNSIGNED, ASN_COUNTER, ASN_COUNTER64, ASN_UNSIGNED, ASN_COUNTER, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR );
 | 
			
		||||
my @values = ($multiline, $multilin2, $multilin3, $multilin4, $multilin5, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32)), 64000, "stringtests", "3.5", "87.4startswithnumberbutshouldbestring", '555"I said"', 'CUSTOM CHECK OK: foo is 12345' );
 | 
			
		||||
my @incrts = (undef, undef, undef, undef, undef, 1000, -500, 1000, 100000, undef, 666, undef, undef, undef, undef, undef );
 | 
			
		||||
 | 
			
		||||
# Number of elements in our OID
 | 
			
		||||
my $oidelts;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue