From ee1ba3209993b72e90f5fe30a16ad951f1e2402d Mon Sep 17 00:00:00 2001 From: Lorenz Kästle Date: Thu, 17 Oct 2024 17:57:50 +0200 Subject: lib: clang-format --- lib/utils_base.c | 444 +++++++++++++++++++++++++++---------------------------- 1 file changed, 215 insertions(+), 229 deletions(-) (limited to 'lib/utils_base.c') diff --git a/lib/utils_base.c b/lib/utils_base.c index f8592f41..cd135836 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c @@ -1,28 +1,28 @@ /***************************************************************************** -* -* utils_base.c -* -* License: GPL -* Copyright (c) 2006 Monitoring Plugins Development Team -* -* Library of useful functions for plugins -* -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* -*****************************************************************************/ + * + * utils_base.c + * + * License: GPL + * Copyright (c) 2006 Monitoring Plugins Development Team + * + * Library of useful functions for plugins + * + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + *****************************************************************************/ #include "../plugins/common.h" #include @@ -33,43 +33,47 @@ #include #include -#define np_free(ptr) { if(ptr) { free(ptr); ptr = NULL; } } +#define np_free(ptr) \ + { \ + if (ptr) { \ + free(ptr); \ + ptr = NULL; \ + } \ + } -monitoring_plugin *this_monitoring_plugin=NULL; +monitoring_plugin *this_monitoring_plugin = NULL; int timeout_state = STATE_CRITICAL; unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT; bool _np_state_read_file(FILE *); -void np_init( char *plugin_name, int argc, char **argv ) { - if (this_monitoring_plugin==NULL) { +void np_init(char *plugin_name, int argc, char **argv) { + if (this_monitoring_plugin == NULL) { this_monitoring_plugin = calloc(1, sizeof(monitoring_plugin)); - if (this_monitoring_plugin==NULL) { - die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), - strerror(errno)); + if (this_monitoring_plugin == NULL) { + die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); } this_monitoring_plugin->plugin_name = strdup(plugin_name); - if (this_monitoring_plugin->plugin_name==NULL) + if (this_monitoring_plugin->plugin_name == NULL) die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno)); this_monitoring_plugin->argc = argc; this_monitoring_plugin->argv = argv; } } -void np_set_args( int argc, char **argv ) { - if (this_monitoring_plugin==NULL) +void np_set_args(int argc, char **argv) { + if (this_monitoring_plugin == NULL) die(STATE_UNKNOWN, _("This requires np_init to be called")); this_monitoring_plugin->argc = argc; this_monitoring_plugin->argv = argv; } - void np_cleanup() { - if (this_monitoring_plugin!=NULL) { - if(this_monitoring_plugin->state!=NULL) { - if(this_monitoring_plugin->state->state_data) { + if (this_monitoring_plugin != NULL) { + if (this_monitoring_plugin->state != NULL) { + if (this_monitoring_plugin->state->state_data) { np_free(this_monitoring_plugin->state->state_data->data); np_free(this_monitoring_plugin->state->state_data); } @@ -79,48 +83,43 @@ void np_cleanup() { np_free(this_monitoring_plugin->plugin_name); np_free(this_monitoring_plugin); } - this_monitoring_plugin=NULL; + this_monitoring_plugin = NULL; } /* Hidden function to get a pointer to this_monitoring_plugin for testing */ -void _get_monitoring_plugin( monitoring_plugin **pointer ){ - *pointer = this_monitoring_plugin; -} +void _get_monitoring_plugin(monitoring_plugin **pointer) { *pointer = this_monitoring_plugin; } -void -die (int result, const char *fmt, ...) -{ - if(fmt!=NULL) { +void die(int result, const char *fmt, ...) { + if (fmt != NULL) { va_list ap; - va_start (ap, fmt); - vprintf (fmt, ap); - va_end (ap); + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); } - if(this_monitoring_plugin!=NULL) { + if (this_monitoring_plugin != NULL) { np_cleanup(); } - exit (result); + exit(result); } -void set_range_start (range *this, double value) { +void set_range_start(range *this, double value) { this->start = value; this->start_infinity = false; } -void set_range_end (range *this, double value) { +void set_range_end(range *this, double value) { this->end = value; this->end_infinity = false; } -range -*parse_range_string (char *str) { +range *parse_range_string(char *str) { range *temp_range; double start; double end; char *end_str; - temp_range = (range *) calloc(1, sizeof(range)); + temp_range = (range *)calloc(1, sizeof(range)); /* Set defaults */ temp_range->start = 0; @@ -140,10 +139,10 @@ range if (str[0] == '~') { temp_range->start_infinity = true; } else { - start = strtod(str, NULL); /* Will stop at the ':' */ + start = strtod(str, NULL); /* Will stop at the ':' */ set_range_start(temp_range, start); } - end_str++; /* Move past the ':' */ + end_str++; /* Move past the ':' */ } else { end_str = str; } @@ -152,9 +151,7 @@ range set_range_end(temp_range, end); } - if (temp_range->start_infinity == true || - temp_range->end_infinity == true || - temp_range->start <= temp_range->end) { + if (temp_range->start_infinity == true || temp_range->end_infinity == true || temp_range->start <= temp_range->end) { return temp_range; } free(temp_range); @@ -162,14 +159,11 @@ range } /* returns 0 if okay, otherwise 1 */ -int -_set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_string) -{ +int _set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_string) { thresholds *temp_thresholds = NULL; if ((temp_thresholds = calloc(1, sizeof(thresholds))) == NULL) - die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), - strerror(errno)); + die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); temp_thresholds->warning = NULL; temp_thresholds->critical = NULL; @@ -190,9 +184,7 @@ _set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_st return 0; } -void -set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_string) -{ +void set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_string) { switch (_set_thresholds(my_thresholds, warn_string, critical_string)) { case 0: return; @@ -206,7 +198,7 @@ set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_str void print_thresholds(const char *threshold_name, thresholds *my_threshold) { printf("%s - ", threshold_name); - if (! my_threshold) { + if (!my_threshold) { printf("Threshold not set"); } else { if (my_threshold->warning) { @@ -224,8 +216,7 @@ void print_thresholds(const char *threshold_name, thresholds *my_threshold) { } /* Returns true if alert should be raised based on the range */ -bool check_range(double value, range *my_range) -{ +bool check_range(double value, range *my_range) { bool no = false; bool yes = true; @@ -258,9 +249,7 @@ bool check_range(double value, range *my_range) } /* Returns status */ -int -get_status(double value, thresholds *my_thresholds) -{ +int get_status(double value, thresholds *my_thresholds) { if (my_thresholds->critical != NULL) { if (check_range(value, my_thresholds->critical) == true) { return STATE_CRITICAL; @@ -274,27 +263,27 @@ get_status(double value, thresholds *my_thresholds) return STATE_OK; } -char *np_escaped_string (const char *string) { +char *np_escaped_string(const char *string) { char *data; - int i, j=0; + int i, j = 0; data = strdup(string); - for (i=0; data[i]; i++) { + for (i = 0; data[i]; i++) { if (data[i] == '\\') { - switch(data[++i]) { - case 'n': - data[j++] = '\n'; - break; - case 'r': - data[j++] = '\r'; - break; - case 't': - data[j++] = '\t'; - break; - case '\\': - data[j++] = '\\'; - break; - default: - data[j++] = data[i]; + switch (data[++i]) { + case 'n': + data[j++] = '\n'; + break; + case 'r': + data[j++] = '\r'; + break; + case 't': + data[j++] = '\t'; + break; + case '\\': + data[j++] = '\\'; + break; + default: + data[j++] = data[i]; } } else { data[j++] = data[i]; @@ -313,33 +302,38 @@ int np_check_if_root(void) { return (geteuid() == 0); } * data strings. */ char *np_extract_value(const char *varlist, const char *name, char sep) { - char *tmp=NULL, *value=NULL; + char *tmp = NULL, *value = NULL; int i; while (1) { /* Strip any leading space */ - for (; isspace(varlist[0]); varlist++); + for (; isspace(varlist[0]); varlist++) + ; if (strncmp(name, varlist, strlen(name)) == 0) { varlist += strlen(name); /* strip trailing spaces */ - for (; isspace(varlist[0]); varlist++); + for (; isspace(varlist[0]); varlist++) + ; if (varlist[0] == '=') { /* We matched the key, go past the = sign */ varlist++; /* strip leading spaces */ - for (; isspace(varlist[0]); varlist++); + for (; isspace(varlist[0]); varlist++) + ; if ((tmp = index(varlist, sep))) { /* Value is delimited by a comma */ - if (tmp-varlist == 0) continue; - value = (char *)calloc(1, tmp-varlist+1); - strncpy(value, varlist, tmp-varlist); - value[tmp-varlist] = '\0'; + if (tmp - varlist == 0) + continue; + value = (char *)calloc(1, tmp - varlist + 1); + strncpy(value, varlist, tmp - varlist); + value[tmp - varlist] = '\0'; } else { /* Value is delimited by a \0 */ - if (strlen(varlist) == 0) continue; + if (strlen(varlist) == 0) + continue; value = (char *)calloc(1, strlen(varlist) + 1); strncpy(value, varlist, strlen(varlist)); value[strlen(varlist)] = '\0'; @@ -357,14 +351,14 @@ char *np_extract_value(const char *varlist, const char *name, char sep) { } /* Clean-up trailing spaces/newlines */ - if (value) for (i=strlen(value)-1; isspace(value[i]); i--) value[i] = '\0'; + if (value) + for (i = strlen(value) - 1; isspace(value[i]); i--) + value[i] = '\0'; return value; } -const char * -state_text (int result) -{ +const char *state_text(int result) { switch (result) { case STATE_OK: return "OK"; @@ -383,14 +377,14 @@ state_text (int result) * Read a string representing a state (ok, warning... or numeric: 0, 1) and * return the corresponding STATE_ value or ERROR) */ -int mp_translate_state (char *state_text) { - if (!strcasecmp(state_text,"OK") || !strcmp(state_text,"0")) +int mp_translate_state(char *state_text) { + if (!strcasecmp(state_text, "OK") || !strcmp(state_text, "0")) return STATE_OK; - if (!strcasecmp(state_text,"WARNING") || !strcmp(state_text,"1")) + if (!strcasecmp(state_text, "WARNING") || !strcmp(state_text, "1")) return STATE_WARNING; - if (!strcasecmp(state_text,"CRITICAL") || !strcmp(state_text,"2")) + if (!strcasecmp(state_text, "CRITICAL") || !strcmp(state_text, "2")) return STATE_CRITICAL; - if (!strcasecmp(state_text,"UNKNOWN") || !strcmp(state_text,"3")) + if (!strcasecmp(state_text, "UNKNOWN") || !strcmp(state_text, "3")) return STATE_UNKNOWN; return ERROR; } @@ -404,7 +398,7 @@ char *_np_state_generate_key() { int i; char **argv = this_monitoring_plugin->argv; char keyname[41]; - char *p=NULL; + char *p = NULL; unsigned char result[256]; @@ -418,7 +412,7 @@ char *_np_state_generate_key() { EVP_DigestInit(ctx, EVP_sha256()); - for(i=0; iargc; i++) { + for (i = 0; i < this_monitoring_plugin->argc; i++) { EVP_DigestUpdate(ctx, argv[i], strlen(argv[i])); } @@ -427,28 +421,28 @@ char *_np_state_generate_key() { struct sha256_ctx ctx; - for(i=0; iargc; i++) { + for (i = 0; i < this_monitoring_plugin->argc; i++) { sha256_process_bytes(argv[i], strlen(argv[i]), &ctx); } sha256_finish_ctx(&ctx, result); #endif // FOUNDOPENSSL - for (i=0; i<20; ++i) { - sprintf(&keyname[2*i], "%02x", result[i]); + for (i = 0; i < 20; ++i) { + sprintf(&keyname[2 * i], "%02x", result[i]); } - keyname[40]='\0'; + keyname[40] = '\0'; p = strdup(keyname); - if(p==NULL) { + if (p == NULL) { die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno)); } return p; } void _cleanup_state_data() { - if (this_monitoring_plugin->state->state_data!=NULL) { + if (this_monitoring_plugin->state->state_data != NULL) { np_free(this_monitoring_plugin->state->state_data->data); np_free(this_monitoring_plugin->state->state_data); } @@ -459,18 +453,18 @@ void _cleanup_state_data() { * envvar NAGIOS_PLUGIN_STATE_DIRECTORY * statically compiled shared state directory */ -char* _np_state_calculate_location_prefix(){ +char *_np_state_calculate_location_prefix() { char *env_dir; /* Do not allow passing MP_STATE_PATH in setuid plugins * for security reasons */ if (!mp_suid()) { env_dir = getenv("MP_STATE_PATH"); - if(env_dir && env_dir[0] != '\0') + if (env_dir && env_dir[0] != '\0') return env_dir; /* This is the former ENV, for backward-compatibility */ env_dir = getenv("NAGIOS_PLUGIN_STATE_DIRECTORY"); - if(env_dir && env_dir[0] != '\0') + if (env_dir && env_dir[0] != '\0') return env_dir; } @@ -486,46 +480,42 @@ void np_enable_state(char *keyname, int expected_data_version) { state_key *this_state = NULL; char *temp_filename = NULL; char *temp_keyname = NULL; - char *p=NULL; + char *p = NULL; int ret; - if(this_monitoring_plugin==NULL) + if (this_monitoring_plugin == NULL) die(STATE_UNKNOWN, _("This requires np_init to be called")); - this_state = (state_key *) calloc(1, sizeof(state_key)); - if(this_state==NULL) - die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), - strerror(errno)); + this_state = (state_key *)calloc(1, sizeof(state_key)); + if (this_state == NULL) + die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); - if(keyname==NULL) { + if (keyname == NULL) { temp_keyname = _np_state_generate_key(); } else { temp_keyname = strdup(keyname); - if(temp_keyname==NULL) + if (temp_keyname == NULL) die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno)); } /* Die if invalid characters used for keyname */ p = temp_keyname; - while(*p!='\0') { - if(! (isalnum(*p) || *p == '_')) { + while (*p != '\0') { + if (!(isalnum(*p) || *p == '_')) { die(STATE_UNKNOWN, _("Invalid character for keyname - only alphanumerics or '_'")); } p++; } - this_state->name=temp_keyname; - this_state->plugin_name=this_monitoring_plugin->plugin_name; - this_state->data_version=expected_data_version; - this_state->state_data=NULL; + this_state->name = temp_keyname; + this_state->plugin_name = this_monitoring_plugin->plugin_name; + this_state->data_version = expected_data_version; + this_state->state_data = NULL; /* Calculate filename */ - ret = asprintf(&temp_filename, "%s/%lu/%s/%s", - _np_state_calculate_location_prefix(), (unsigned long)geteuid(), - this_monitoring_plugin->plugin_name, this_state->name); + ret = asprintf(&temp_filename, "%s/%lu/%s/%s", _np_state_calculate_location_prefix(), (unsigned long)geteuid(), this_monitoring_plugin->plugin_name, this_state->name); if (ret < 0) - die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), - strerror(errno)); + die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); - this_state->_filename=temp_filename; + this_state->_filename = temp_filename; this_monitoring_plugin->state = this_state; } @@ -538,23 +528,22 @@ void np_enable_state(char *keyname, int expected_data_version) { * if exceptional error. */ state_data *np_state_read() { - state_data *this_state_data=NULL; + state_data *this_state_data = NULL; FILE *statefile; bool rc = false; - if(this_monitoring_plugin==NULL) + if (this_monitoring_plugin == NULL) die(STATE_UNKNOWN, _("This requires np_init to be called")); /* Open file. If this fails, no previous state found */ - statefile = fopen( this_monitoring_plugin->state->_filename, "r" ); - if(statefile!=NULL) { + statefile = fopen(this_monitoring_plugin->state->_filename, "r"); + if (statefile != NULL) { - this_state_data = (state_data *) calloc(1, sizeof(state_data)); - if(this_state_data==NULL) - die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), - strerror(errno)); + this_state_data = (state_data *)calloc(1, sizeof(state_data)); + if (this_state_data == NULL) + die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); - this_state_data->data=NULL; + this_state_data->data = NULL; this_monitoring_plugin->state->state_data = this_state_data; rc = _np_state_read_file(statefile); @@ -562,7 +551,7 @@ state_data *np_state_read() { fclose(statefile); } - if(!rc) { + if (!rc) { _cleanup_state_data(); } @@ -577,60 +566,59 @@ bool _np_state_read_file(FILE *f) { size_t pos; char *line; int i; - int failure=0; + int failure = 0; time_t current_time, data_time; - enum { STATE_FILE_VERSION, STATE_DATA_VERSION, STATE_DATA_TIME, STATE_DATA_TEXT, STATE_DATA_END } expected=STATE_FILE_VERSION; + enum { STATE_FILE_VERSION, STATE_DATA_VERSION, STATE_DATA_TIME, STATE_DATA_TEXT, STATE_DATA_END } expected = STATE_FILE_VERSION; time(¤t_time); /* Note: This introduces a limit of 1024 bytes in the string data */ - line = (char *) calloc(1, 1024); - if(line==NULL) - die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), - strerror(errno)); - - while(!failure && (fgets(line,1024,f))!=NULL){ - pos=strlen(line); - if(line[pos-1]=='\n') { - line[pos-1]='\0'; + line = (char *)calloc(1, 1024); + if (line == NULL) + die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); + + while (!failure && (fgets(line, 1024, f)) != NULL) { + pos = strlen(line); + if (line[pos - 1] == '\n') { + line[pos - 1] = '\0'; } - if(line[0] == '#') continue; + if (line[0] == '#') + continue; - switch(expected) { - case STATE_FILE_VERSION: - i=atoi(line); - if(i!=NP_STATE_FORMAT_VERSION) - failure++; - else - expected=STATE_DATA_VERSION; - break; - case STATE_DATA_VERSION: - i=atoi(line); - if(i != this_monitoring_plugin->state->data_version) - failure++; - else - expected=STATE_DATA_TIME; - break; - case STATE_DATA_TIME: - /* If time > now, error */ - data_time=strtoul(line,NULL,10); - if(data_time > current_time) - failure++; - else { - this_monitoring_plugin->state->state_data->time = data_time; - expected=STATE_DATA_TEXT; - } - break; - case STATE_DATA_TEXT: - this_monitoring_plugin->state->state_data->data = strdup(line); - if(this_monitoring_plugin->state->state_data->data==NULL) - die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno)); - expected=STATE_DATA_END; - status=true; - break; - case STATE_DATA_END: - ; + switch (expected) { + case STATE_FILE_VERSION: + i = atoi(line); + if (i != NP_STATE_FORMAT_VERSION) + failure++; + else + expected = STATE_DATA_VERSION; + break; + case STATE_DATA_VERSION: + i = atoi(line); + if (i != this_monitoring_plugin->state->data_version) + failure++; + else + expected = STATE_DATA_TIME; + break; + case STATE_DATA_TIME: + /* If time > now, error */ + data_time = strtoul(line, NULL, 10); + if (data_time > current_time) + failure++; + else { + this_monitoring_plugin->state->state_data->time = data_time; + expected = STATE_DATA_TEXT; + } + break; + case STATE_DATA_TEXT: + this_monitoring_plugin->state->state_data->data = strdup(line); + if (this_monitoring_plugin->state->state_data->data == NULL) + die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno)); + expected = STATE_DATA_END; + status = true; + break; + case STATE_DATA_END:; } } @@ -647,77 +635,75 @@ bool _np_state_read_file(FILE *f) { */ void np_state_write_string(time_t data_time, char *data_string) { FILE *fp; - char *temp_file=NULL; - int fd=0, result=0; + char *temp_file = NULL; + int fd = 0, result = 0; time_t current_time; - char *directories=NULL; - char *p=NULL; + char *directories = NULL; + char *p = NULL; - if(data_time==0) + if (data_time == 0) time(¤t_time); else - current_time=data_time; + current_time = data_time; /* If file doesn't currently exist, create directories */ - if(access(this_monitoring_plugin->state->_filename,F_OK)!=0) { + if (access(this_monitoring_plugin->state->_filename, F_OK) != 0) { result = asprintf(&directories, "%s", this_monitoring_plugin->state->_filename); - if(result < 0) - die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), - strerror(errno)); - - for(p=directories+1; *p; p++) { - if(*p=='/') { - *p='\0'; - if((access(directories,F_OK)!=0) && (mkdir(directories, S_IRWXU)!=0)) { + if (result < 0) + die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); + + for (p = directories + 1; *p; p++) { + if (*p == '/') { + *p = '\0'; + if ((access(directories, F_OK) != 0) && (mkdir(directories, S_IRWXU) != 0)) { /* Can't free this! Otherwise error message is wrong! */ /* np_free(directories); */ die(STATE_UNKNOWN, _("Cannot create directory: %s"), directories); } - *p='/'; + *p = '/'; } } np_free(directories); } - result = asprintf(&temp_file,"%s.XXXXXX",this_monitoring_plugin->state->_filename); - if(result < 0) - die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), - strerror(errno)); + result = asprintf(&temp_file, "%s.XXXXXX", this_monitoring_plugin->state->_filename); + if (result < 0) + die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); - if((fd=mkstemp(temp_file))==-1) { + if ((fd = mkstemp(temp_file)) == -1) { np_free(temp_file); die(STATE_UNKNOWN, _("Cannot create temporary filename")); } - fp=(FILE *)fdopen(fd,"w"); - if(fp==NULL) { + fp = (FILE *)fdopen(fd, "w"); + if (fp == NULL) { close(fd); unlink(temp_file); np_free(temp_file); die(STATE_UNKNOWN, _("Unable to open temporary state file")); } - fprintf(fp,"# NP State file\n"); - fprintf(fp,"%d\n",NP_STATE_FORMAT_VERSION); - fprintf(fp,"%d\n",this_monitoring_plugin->state->data_version); - fprintf(fp,"%lu\n",current_time); - fprintf(fp,"%s\n",data_string); + fprintf(fp, "# NP State file\n"); + fprintf(fp, "%d\n", NP_STATE_FORMAT_VERSION); + fprintf(fp, "%d\n", this_monitoring_plugin->state->data_version); + fprintf(fp, "%lu\n", current_time); + fprintf(fp, "%s\n", data_string); fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP); fflush(fp); - result=fclose(fp); + result = fclose(fp); fsync(fd); - if(result!=0) { + if (result != 0) { unlink(temp_file); np_free(temp_file); die(STATE_UNKNOWN, _("Error writing temp file")); } - if(rename(temp_file, this_monitoring_plugin->state->_filename)!=0) { + if (rename(temp_file, this_monitoring_plugin->state->_filename) != 0) { unlink(temp_file); np_free(temp_file); die(STATE_UNKNOWN, _("Cannot rename state temp file")); -- cgit v1.2.3-74-g34f1 From 9462819774ed2e3f51c75fffda59724428205c0e Mon Sep 17 00:00:00 2001 From: Lorenz Kästle Date: Thu, 17 Oct 2024 18:01:49 +0200 Subject: lib: Update copyright --- lib/extra_opts.c | 2 +- lib/maxfd.c | 20 ++++++++++++++++++++ lib/parse_ini.c | 2 +- lib/utils_base.c | 2 +- lib/utils_cmd.c | 2 +- lib/utils_cmd.h | 1 - lib/utils_disk.c | 2 +- lib/utils_tcp.c | 2 +- 8 files changed, 26 insertions(+), 7 deletions(-) (limited to 'lib/utils_base.c') diff --git a/lib/extra_opts.c b/lib/extra_opts.c index 82460e92..88787336 100644 --- a/lib/extra_opts.c +++ b/lib/extra_opts.c @@ -3,7 +3,7 @@ * Monitoring Plugins extra_opts library * * License: GPL - * Copyright (c) 2007 Monitoring Plugins Development Team + * Copyright (c) 2007 - 2024 Monitoring Plugins Development Team * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/lib/maxfd.c b/lib/maxfd.c index c39d427c..ca5b6e54 100644 --- a/lib/maxfd.c +++ b/lib/maxfd.c @@ -1,3 +1,23 @@ +/***************************************************************************** + * + * License: GPL + * Copyright (c) 2024 Monitoring Plugins Development Team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + *****************************************************************************/ + #include "./maxfd.h" #include diff --git a/lib/parse_ini.c b/lib/parse_ini.c index 150df7b2..873ee8ce 100644 --- a/lib/parse_ini.c +++ b/lib/parse_ini.c @@ -3,7 +3,7 @@ * Monitoring Plugins parse_ini library * * License: GPL - * Copyright (c) 2007 Monitoring Plugins Development Team + * Copyright (c) 2007 - 2024 Monitoring Plugins Development Team * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/lib/utils_base.c b/lib/utils_base.c index cd135836..6d6954ef 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c @@ -3,7 +3,7 @@ * utils_base.c * * License: GPL - * Copyright (c) 2006 Monitoring Plugins Development Team + * Copyright (c) 2006 - 2024 Monitoring Plugins Development Team * * Library of useful functions for plugins * diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c index 25d56785..416cf824 100644 --- a/lib/utils_cmd.c +++ b/lib/utils_cmd.c @@ -3,7 +3,7 @@ * Monitoring run command utilities * * License: GPL - * Copyright (c) 2005-2006 Monitoring Plugins Development Team + * Copyright (c) 2005-2024 Monitoring Plugins Development Team * * Description : * diff --git a/lib/utils_cmd.h b/lib/utils_cmd.h index 0fc09173..d00069c9 100644 --- a/lib/utils_cmd.h +++ b/lib/utils_cmd.h @@ -4,7 +4,6 @@ /* * Header file for Monitoring Plugins utils_cmd.c * - * */ /** types **/ diff --git a/lib/utils_disk.c b/lib/utils_disk.c index a317f7da..c87090e8 100644 --- a/lib/utils_disk.c +++ b/lib/utils_disk.c @@ -3,7 +3,7 @@ * Library for check_disk * * License: GPL - * Copyright (c) 1999-2007 Monitoring Plugins Development Team + * Copyright (c) 1999-2024 Monitoring Plugins Development Team * * Description: * diff --git a/lib/utils_tcp.c b/lib/utils_tcp.c index ffb351e6..440eb9b4 100644 --- a/lib/utils_tcp.c +++ b/lib/utils_tcp.c @@ -3,7 +3,7 @@ * Library for check_tcp * * License: GPL - * Copyright (c) 1999-2013 Monitoring Plugins Development Team + * Copyright (c) 1999-2024 Monitoring Plugins Development Team * * Description: * -- cgit v1.2.3-74-g34f1 From 880e57271d66b34240b58bdbeaf9d53a08958eb2 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 31 Oct 2024 01:30:50 +0100 Subject: lib: clang-format --- lib/parse_ini.c | 23 +++-- lib/tests/test_base64.c | 196 ++++++++++++++++++++++++------------------ lib/tests/test_cmd.c | 3 +- lib/tests/test_generic_output | Bin 0 -> 143808 bytes lib/tests/test_ini1.c | 25 ++++-- lib/tests/test_opts1.c | 6 +- lib/tests/test_opts2.c | 36 +++++--- lib/tests/test_tcp.c | 18 ++-- lib/tests/test_utils.c | 3 +- lib/utils_base.c | 23 +++-- lib/utils_disk.c | 3 +- lib/utils_tcp.c | 8 +- 12 files changed, 203 insertions(+), 141 deletions(-) create mode 100755 lib/tests/test_generic_output (limited to 'lib/utils_base.c') diff --git a/lib/parse_ini.c b/lib/parse_ini.c index 873ee8ce..1289aae2 100644 --- a/lib/parse_ini.c +++ b/lib/parse_ini.c @@ -42,16 +42,17 @@ typedef struct { static char *default_ini_file_names[] = {"monitoring-plugins.ini", "plugins.ini", "nagios-plugins.ini", NULL}; -static char *default_ini_path_names[] = {"/usr/local/etc/monitoring-plugins/monitoring-plugins.ini", "/usr/local/etc/monitoring-plugins.ini", - "/etc/monitoring-plugins/monitoring-plugins.ini", "/etc/monitoring-plugins.ini", - /* deprecated path names (for backward compatibility): */ - "/etc/nagios/plugins.ini", "/usr/local/nagios/etc/plugins.ini", "/usr/local/etc/nagios/plugins.ini", "/etc/opt/nagios/plugins.ini", - "/etc/nagios-plugins.ini", "/usr/local/etc/nagios-plugins.ini", "/etc/opt/nagios-plugins.ini", NULL}; +static char *default_ini_path_names[] = { + "/usr/local/etc/monitoring-plugins/monitoring-plugins.ini", "/usr/local/etc/monitoring-plugins.ini", + "/etc/monitoring-plugins/monitoring-plugins.ini", "/etc/monitoring-plugins.ini", + /* deprecated path names (for backward compatibility): */ + "/etc/nagios/plugins.ini", "/usr/local/nagios/etc/plugins.ini", "/usr/local/etc/nagios/plugins.ini", "/etc/opt/nagios/plugins.ini", + "/etc/nagios-plugins.ini", "/usr/local/etc/nagios-plugins.ini", "/etc/opt/nagios-plugins.ini", NULL}; /* eat all characters from a FILE pointer until n is encountered */ -#define GOBBLE_TO(f, c, n) \ - do { \ - (c) = fgetc((f)); \ +#define GOBBLE_TO(f, c, n) \ + do { \ + (c) = fgetc((f)); \ } while ((c) != EOF && (c) != (n)) /* internal function that returns the constructed defaults options */ @@ -146,7 +147,11 @@ static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts) { int c = 0; bool status = false; size_t i, stanza_len; - enum { NOSTANZA, WRONGSTANZA, RIGHTSTANZA } stanzastate = NOSTANZA; + enum { + NOSTANZA, + WRONGSTANZA, + RIGHTSTANZA + } stanzastate = NOSTANZA; stanza_len = strlen(stanza); diff --git a/lib/tests/test_base64.c b/lib/tests/test_base64.c index 48e5ed62..94cb5aa9 100644 --- a/lib/tests/test_base64.c +++ b/lib/tests/test_base64.c @@ -180,93 +180,117 @@ int main(int argc, char **argv) { #endif char random[1024] = { - 0x0b, 0x30, 0x44, 0x62, 0x7c, 0x22, 0x1f, 0x0d, 0x05, 0x67, 0x2c, 0x2a, 0x39, 0x21, 0x46, 0x08, 0x50, 0x66, 0x34, 0x37, 0x0b, 0x45, 0x4b, 0x38, 0x32, 0x06, 0x7a, 0x3e, - 0x7f, 0x0c, 0x40, 0x18, 0x6b, 0x2d, 0x60, 0x4c, 0x60, 0x0c, 0x23, 0x43, 0x3b, 0x3e, 0x1b, 0x16, 0x04, 0x46, 0x58, 0x3f, 0x40, 0x6a, 0x11, 0x05, 0x63, 0x71, 0x14, 0x35, - 0x47, 0x79, 0x13, 0x6f, 0x6b, 0x27, 0x18, 0x5b, 0x48, 0x27, 0x3e, 0x6f, 0x15, 0x33, 0x4f, 0x3e, 0x5e, 0x51, 0x73, 0x68, 0x25, 0x0f, 0x06, 0x5b, 0x7c, 0x72, 0x75, 0x3e, - 0x3f, 0x1b, 0x5c, 0x6d, 0x6a, 0x39, 0x7c, 0x63, 0x63, 0x60, 0x6c, 0x7a, 0x33, 0x76, 0x52, 0x13, 0x25, 0x33, 0x7d, 0x65, 0x23, 0x27, 0x11, 0x06, 0x06, 0x47, 0x71, 0x1e, - 0x14, 0x74, 0x63, 0x70, 0x2d, 0x15, 0x27, 0x18, 0x51, 0x06, 0x05, 0x33, 0x11, 0x2c, 0x6b, 0x00, 0x2d, 0x77, 0x20, 0x48, 0x0d, 0x73, 0x51, 0x45, 0x25, 0x7f, 0x7f, 0x35, - 0x26, 0x2e, 0x26, 0x53, 0x24, 0x68, 0x1e, 0x0e, 0x58, 0x3a, 0x59, 0x50, 0x56, 0x37, 0x5f, 0x66, 0x01, 0x4c, 0x5a, 0x64, 0x32, 0x50, 0x7b, 0x6a, 0x20, 0x72, 0x2b, 0x1d, - 0x7e, 0x43, 0x7b, 0x61, 0x42, 0x0b, 0x61, 0x73, 0x24, 0x79, 0x3a, 0x6b, 0x4a, 0x79, 0x6e, 0x09, 0x0f, 0x27, 0x2d, 0x0c, 0x5e, 0x32, 0x4b, 0x0d, 0x79, 0x46, 0x39, 0x21, - 0x0a, 0x26, 0x5f, 0x3a, 0x00, 0x26, 0x3f, 0x13, 0x2e, 0x7e, 0x50, 0x2b, 0x67, 0x46, 0x72, 0x3f, 0x3b, 0x01, 0x46, 0x1b, 0x0b, 0x35, 0x49, 0x39, 0x19, 0x70, 0x3d, 0x02, - 0x41, 0x0e, 0x38, 0x05, 0x76, 0x65, 0x4f, 0x31, 0x6c, 0x5e, 0x17, 0x04, 0x15, 0x36, 0x26, 0x64, 0x34, 0x14, 0x17, 0x7c, 0x0e, 0x0b, 0x5b, 0x55, 0x53, 0x6b, 0x00, 0x42, - 0x41, 0x4f, 0x02, 0x5c, 0x13, 0x0a, 0x2c, 0x2c, 0x3e, 0x10, 0x14, 0x33, 0x45, 0x7c, 0x7a, 0x5a, 0x31, 0x61, 0x39, 0x08, 0x22, 0x6a, 0x1e, 0x0f, 0x6f, 0x1b, 0x6c, 0x13, - 0x5e, 0x79, 0x20, 0x79, 0x50, 0x62, 0x06, 0x2c, 0x76, 0x17, 0x04, 0x2b, 0x2a, 0x75, 0x1f, 0x0c, 0x37, 0x4e, 0x0f, 0x7b, 0x2d, 0x34, 0x75, 0x60, 0x31, 0x74, 0x2e, 0x0a, - 0x4a, 0x11, 0x6c, 0x49, 0x25, 0x01, 0x3a, 0x3d, 0x22, 0x1e, 0x6d, 0x18, 0x51, 0x78, 0x2d, 0x62, 0x31, 0x4c, 0x50, 0x40, 0x17, 0x4b, 0x6f, 0x22, 0x00, 0x7f, 0x61, 0x2a, - 0x34, 0x3e, 0x00, 0x5f, 0x2f, 0x5f, 0x2f, 0x14, 0x2a, 0x55, 0x27, 0x1f, 0x46, 0x1f, 0x12, 0x46, 0x5e, 0x1e, 0x0c, 0x7c, 0x38, 0x01, 0x61, 0x64, 0x76, 0x22, 0x6e, 0x08, - 0x20, 0x38, 0x4f, 0x73, 0x72, 0x55, 0x12, 0x42, 0x19, 0x50, 0x61, 0x43, 0x77, 0x7d, 0x41, 0x2e, 0x35, 0x4f, 0x3d, 0x31, 0x28, 0x58, 0x67, 0x1b, 0x03, 0x51, 0x20, 0x32, - 0x1c, 0x08, 0x6e, 0x37, 0x75, 0x37, 0x44, 0x4f, 0x68, 0x19, 0x07, 0x64, 0x14, 0x28, 0x25, 0x2b, 0x69, 0x35, 0x18, 0x27, 0x26, 0x14, 0x13, 0x70, 0x42, 0x19, 0x12, 0x75, - 0x3e, 0x02, 0x5d, 0x7c, 0x13, 0x1f, 0x16, 0x53, 0x3b, 0x74, 0x48, 0x3c, 0x5e, 0x39, 0x6c, 0x1c, 0x1c, 0x74, 0x39, 0x1f, 0x00, 0x1b, 0x06, 0x0a, 0x68, 0x3b, 0x52, 0x4f, - 0x1e, 0x6e, 0x3c, 0x35, 0x0c, 0x38, 0x0e, 0x0b, 0x3b, 0x1a, 0x76, 0x23, 0x29, 0x53, 0x1e, 0x5f, 0x41, 0x0c, 0x4b, 0x0a, 0x65, 0x28, 0x78, 0x67, 0x48, 0x59, 0x26, 0x6d, - 0x31, 0x76, 0x23, 0x70, 0x61, 0x64, 0x3b, 0x38, 0x79, 0x66, 0x74, 0x53, 0x2c, 0x64, 0x64, 0x54, 0x03, 0x54, 0x65, 0x44, 0x4c, 0x18, 0x4f, 0x48, 0x20, 0x4f, 0x72, 0x10, - 0x3f, 0x0c, 0x52, 0x2d, 0x03, 0x14, 0x03, 0x51, 0x42, 0x10, 0x77, 0x6a, 0x34, 0x06, 0x32, 0x03, 0x72, 0x14, 0x7c, 0x08, 0x5d, 0x52, 0x1a, 0x62, 0x7c, 0x3e, 0x30, 0x7e, - 0x5f, 0x7f, 0x54, 0x0f, 0x44, 0x49, 0x5d, 0x5e, 0x10, 0x6a, 0x06, 0x2b, 0x06, 0x53, 0x10, 0x39, 0x37, 0x32, 0x4a, 0x4e, 0x3d, 0x2b, 0x65, 0x38, 0x39, 0x07, 0x72, 0x54, - 0x64, 0x4d, 0x56, 0x6a, 0x03, 0x22, 0x70, 0x7b, 0x5f, 0x60, 0x0b, 0x2a, 0x0b, 0x6b, 0x10, 0x64, 0x14, 0x05, 0x22, 0x00, 0x73, 0x40, 0x23, 0x5b, 0x51, 0x1f, 0x2b, 0x1a, - 0x5d, 0x69, 0x7a, 0x46, 0x0c, 0x5f, 0x32, 0x4b, 0x4a, 0x28, 0x52, 0x79, 0x5b, 0x12, 0x42, 0x18, 0x00, 0x5d, 0x27, 0x31, 0x53, 0x3c, 0x4c, 0x36, 0x4e, 0x38, 0x3f, 0x72, - 0x03, 0x71, 0x02, 0x5b, 0x36, 0x59, 0x7f, 0x75, 0x6e, 0x08, 0x54, 0x0d, 0x34, 0x1c, 0x34, 0x57, 0x5d, 0x69, 0x48, 0x00, 0x3b, 0x05, 0x07, 0x6e, 0x27, 0x65, 0x6e, 0x40, - 0x3d, 0x3a, 0x4f, 0x72, 0x5d, 0x39, 0x16, 0x0f, 0x63, 0x12, 0x12, 0x15, 0x3a, 0x70, 0x0d, 0x57, 0x18, 0x0d, 0x5e, 0x3d, 0x22, 0x68, 0x68, 0x7c, 0x6d, 0x4f, 0x0c, 0x7b, - 0x09, 0x2d, 0x4a, 0x73, 0x20, 0x47, 0x07, 0x57, 0x75, 0x5d, 0x53, 0x70, 0x34, 0x21, 0x40, 0x57, 0x51, 0x5e, 0x49, 0x44, 0x00, 0x54, 0x27, 0x04, 0x68, 0x7e, 0x59, 0x56, - 0x58, 0x74, 0x14, 0x3c, 0x16, 0x33, 0x41, 0x16, 0x4b, 0x2f, 0x49, 0x37, 0x0a, 0x54, 0x08, 0x08, 0x1f, 0x39, 0x67, 0x76, 0x28, 0x28, 0x07, 0x1d, 0x61, 0x47, 0x51, 0x4d, - 0x75, 0x26, 0x52, 0x47, 0x47, 0x0c, 0x57, 0x58, 0x74, 0x3e, 0x62, 0x6c, 0x58, 0x3a, 0x44, 0x1e, 0x16, 0x2e, 0x21, 0x1c, 0x73, 0x45, 0x67, 0x74, 0x4f, 0x33, 0x66, 0x0e, - 0x74, 0x66, 0x26, 0x1f, 0x2e, 0x38, 0x44, 0x40, 0x7e, 0x2a, 0x50, 0x52, 0x5e, 0x43, 0x01, 0x7a, 0x38, 0x49, 0x3c, 0x55, 0x4d, 0x5a, 0x44, 0x08, 0x26, 0x59, 0x4d, 0x45, - 0x0b, 0x48, 0x0a, 0x33, 0x5e, 0x4a, 0x4d, 0x75, 0x16, 0x17, 0x63, 0x46, 0x01, 0x2a, 0x55, 0x7b, 0x0f, 0x02, 0x73, 0x6a, 0x4b, 0x7f, 0x75, 0x65, 0x3c, 0x4c, 0x33, 0x39, - 0x6c, 0x74, 0x05, 0x60, 0x0f, 0x7f, 0x2d, 0x41, 0x4d, 0x4d, 0x46, 0x71, 0x09, 0x6f, 0x4f, 0x60, 0x15, 0x0f, 0x46, 0x73, 0x63, 0x4c, 0x5e, 0x74, 0x30, 0x0d, 0x28, 0x43, - 0x08, 0x72, 0x32, 0x04, 0x2e, 0x31, 0x29, 0x27, 0x44, 0x6d, 0x13, 0x17, 0x48, 0x0f, 0x49, 0x52, 0x10, 0x13, 0x7f, 0x17, 0x16, 0x62, 0x79, 0x35, 0x78, 0x3e, 0x01, 0x7c, - 0x2e, 0x0f, 0x76, 0x3e, 0x5e, 0x53, 0x6c, 0x5b, 0x5f, 0x7c, 0x19, 0x41, 0x02, 0x2f, 0x17, 0x64, 0x41, 0x75, 0x10, 0x04, 0x47, 0x7c, 0x3d, 0x4b, 0x52, 0x00, 0x10, 0x5d, - 0x51, 0x4e, 0x7a, 0x27, 0x25, 0x55, 0x40, 0x12, 0x35, 0x60, 0x05, 0x1b, 0x34, 0x2d, 0x04, 0x7a, 0x6a, 0x69, 0x02, 0x79, 0x03, 0x3a, 0x2f, 0x06, 0x0a, 0x79, 0x7b, 0x12, - 0x5d, 0x7c, 0x52, 0x29, 0x47, 0x58, 0x12, 0x73, 0x3f, 0x27, 0x56, 0x05, 0x0c, 0x48, 0x32, 0x58, 0x6b, 0x57, 0x5c, 0x03, 0x64, 0x56, 0x11, 0x52, 0x7a, 0x30, 0x36, 0x29, - 0x17, 0x3b, 0x68, 0x7a, 0x7c, 0x05, 0x6b, 0x6b, 0x13, 0x6a, 0x24, 0x5c, 0x68, 0x42, 0x18, 0x32, 0x03, 0x73, 0x6e, 0x04, 0x21, 0x2e, 0x01, 0x04, 0x63, 0x7d, 0x44, 0x41, - 0x12, 0x31, 0x0b, 0x15, 0x1f, 0x70, 0x00, 0x2e, 0x66, 0x14, 0x3c, 0x7f, 0x2b, 0x00, 0x1f, 0x0c, 0x28, 0x59, 0x0a, 0x16, 0x49, 0x5a, 0x5c, 0x64, 0x65, 0x4b, 0x11, 0x29, - 0x15, 0x36, 0x5a, 0x65, 0x19, 0x4f, 0x60, 0x23, 0x3a, 0x3a, 0x13, 0x25, 0x02, 0x78, 0x4c, 0x54}; + 0x0b, 0x30, 0x44, 0x62, 0x7c, 0x22, 0x1f, 0x0d, 0x05, 0x67, 0x2c, 0x2a, 0x39, 0x21, 0x46, 0x08, 0x50, 0x66, 0x34, 0x37, 0x0b, 0x45, + 0x4b, 0x38, 0x32, 0x06, 0x7a, 0x3e, 0x7f, 0x0c, 0x40, 0x18, 0x6b, 0x2d, 0x60, 0x4c, 0x60, 0x0c, 0x23, 0x43, 0x3b, 0x3e, 0x1b, 0x16, + 0x04, 0x46, 0x58, 0x3f, 0x40, 0x6a, 0x11, 0x05, 0x63, 0x71, 0x14, 0x35, 0x47, 0x79, 0x13, 0x6f, 0x6b, 0x27, 0x18, 0x5b, 0x48, 0x27, + 0x3e, 0x6f, 0x15, 0x33, 0x4f, 0x3e, 0x5e, 0x51, 0x73, 0x68, 0x25, 0x0f, 0x06, 0x5b, 0x7c, 0x72, 0x75, 0x3e, 0x3f, 0x1b, 0x5c, 0x6d, + 0x6a, 0x39, 0x7c, 0x63, 0x63, 0x60, 0x6c, 0x7a, 0x33, 0x76, 0x52, 0x13, 0x25, 0x33, 0x7d, 0x65, 0x23, 0x27, 0x11, 0x06, 0x06, 0x47, + 0x71, 0x1e, 0x14, 0x74, 0x63, 0x70, 0x2d, 0x15, 0x27, 0x18, 0x51, 0x06, 0x05, 0x33, 0x11, 0x2c, 0x6b, 0x00, 0x2d, 0x77, 0x20, 0x48, + 0x0d, 0x73, 0x51, 0x45, 0x25, 0x7f, 0x7f, 0x35, 0x26, 0x2e, 0x26, 0x53, 0x24, 0x68, 0x1e, 0x0e, 0x58, 0x3a, 0x59, 0x50, 0x56, 0x37, + 0x5f, 0x66, 0x01, 0x4c, 0x5a, 0x64, 0x32, 0x50, 0x7b, 0x6a, 0x20, 0x72, 0x2b, 0x1d, 0x7e, 0x43, 0x7b, 0x61, 0x42, 0x0b, 0x61, 0x73, + 0x24, 0x79, 0x3a, 0x6b, 0x4a, 0x79, 0x6e, 0x09, 0x0f, 0x27, 0x2d, 0x0c, 0x5e, 0x32, 0x4b, 0x0d, 0x79, 0x46, 0x39, 0x21, 0x0a, 0x26, + 0x5f, 0x3a, 0x00, 0x26, 0x3f, 0x13, 0x2e, 0x7e, 0x50, 0x2b, 0x67, 0x46, 0x72, 0x3f, 0x3b, 0x01, 0x46, 0x1b, 0x0b, 0x35, 0x49, 0x39, + 0x19, 0x70, 0x3d, 0x02, 0x41, 0x0e, 0x38, 0x05, 0x76, 0x65, 0x4f, 0x31, 0x6c, 0x5e, 0x17, 0x04, 0x15, 0x36, 0x26, 0x64, 0x34, 0x14, + 0x17, 0x7c, 0x0e, 0x0b, 0x5b, 0x55, 0x53, 0x6b, 0x00, 0x42, 0x41, 0x4f, 0x02, 0x5c, 0x13, 0x0a, 0x2c, 0x2c, 0x3e, 0x10, 0x14, 0x33, + 0x45, 0x7c, 0x7a, 0x5a, 0x31, 0x61, 0x39, 0x08, 0x22, 0x6a, 0x1e, 0x0f, 0x6f, 0x1b, 0x6c, 0x13, 0x5e, 0x79, 0x20, 0x79, 0x50, 0x62, + 0x06, 0x2c, 0x76, 0x17, 0x04, 0x2b, 0x2a, 0x75, 0x1f, 0x0c, 0x37, 0x4e, 0x0f, 0x7b, 0x2d, 0x34, 0x75, 0x60, 0x31, 0x74, 0x2e, 0x0a, + 0x4a, 0x11, 0x6c, 0x49, 0x25, 0x01, 0x3a, 0x3d, 0x22, 0x1e, 0x6d, 0x18, 0x51, 0x78, 0x2d, 0x62, 0x31, 0x4c, 0x50, 0x40, 0x17, 0x4b, + 0x6f, 0x22, 0x00, 0x7f, 0x61, 0x2a, 0x34, 0x3e, 0x00, 0x5f, 0x2f, 0x5f, 0x2f, 0x14, 0x2a, 0x55, 0x27, 0x1f, 0x46, 0x1f, 0x12, 0x46, + 0x5e, 0x1e, 0x0c, 0x7c, 0x38, 0x01, 0x61, 0x64, 0x76, 0x22, 0x6e, 0x08, 0x20, 0x38, 0x4f, 0x73, 0x72, 0x55, 0x12, 0x42, 0x19, 0x50, + 0x61, 0x43, 0x77, 0x7d, 0x41, 0x2e, 0x35, 0x4f, 0x3d, 0x31, 0x28, 0x58, 0x67, 0x1b, 0x03, 0x51, 0x20, 0x32, 0x1c, 0x08, 0x6e, 0x37, + 0x75, 0x37, 0x44, 0x4f, 0x68, 0x19, 0x07, 0x64, 0x14, 0x28, 0x25, 0x2b, 0x69, 0x35, 0x18, 0x27, 0x26, 0x14, 0x13, 0x70, 0x42, 0x19, + 0x12, 0x75, 0x3e, 0x02, 0x5d, 0x7c, 0x13, 0x1f, 0x16, 0x53, 0x3b, 0x74, 0x48, 0x3c, 0x5e, 0x39, 0x6c, 0x1c, 0x1c, 0x74, 0x39, 0x1f, + 0x00, 0x1b, 0x06, 0x0a, 0x68, 0x3b, 0x52, 0x4f, 0x1e, 0x6e, 0x3c, 0x35, 0x0c, 0x38, 0x0e, 0x0b, 0x3b, 0x1a, 0x76, 0x23, 0x29, 0x53, + 0x1e, 0x5f, 0x41, 0x0c, 0x4b, 0x0a, 0x65, 0x28, 0x78, 0x67, 0x48, 0x59, 0x26, 0x6d, 0x31, 0x76, 0x23, 0x70, 0x61, 0x64, 0x3b, 0x38, + 0x79, 0x66, 0x74, 0x53, 0x2c, 0x64, 0x64, 0x54, 0x03, 0x54, 0x65, 0x44, 0x4c, 0x18, 0x4f, 0x48, 0x20, 0x4f, 0x72, 0x10, 0x3f, 0x0c, + 0x52, 0x2d, 0x03, 0x14, 0x03, 0x51, 0x42, 0x10, 0x77, 0x6a, 0x34, 0x06, 0x32, 0x03, 0x72, 0x14, 0x7c, 0x08, 0x5d, 0x52, 0x1a, 0x62, + 0x7c, 0x3e, 0x30, 0x7e, 0x5f, 0x7f, 0x54, 0x0f, 0x44, 0x49, 0x5d, 0x5e, 0x10, 0x6a, 0x06, 0x2b, 0x06, 0x53, 0x10, 0x39, 0x37, 0x32, + 0x4a, 0x4e, 0x3d, 0x2b, 0x65, 0x38, 0x39, 0x07, 0x72, 0x54, 0x64, 0x4d, 0x56, 0x6a, 0x03, 0x22, 0x70, 0x7b, 0x5f, 0x60, 0x0b, 0x2a, + 0x0b, 0x6b, 0x10, 0x64, 0x14, 0x05, 0x22, 0x00, 0x73, 0x40, 0x23, 0x5b, 0x51, 0x1f, 0x2b, 0x1a, 0x5d, 0x69, 0x7a, 0x46, 0x0c, 0x5f, + 0x32, 0x4b, 0x4a, 0x28, 0x52, 0x79, 0x5b, 0x12, 0x42, 0x18, 0x00, 0x5d, 0x27, 0x31, 0x53, 0x3c, 0x4c, 0x36, 0x4e, 0x38, 0x3f, 0x72, + 0x03, 0x71, 0x02, 0x5b, 0x36, 0x59, 0x7f, 0x75, 0x6e, 0x08, 0x54, 0x0d, 0x34, 0x1c, 0x34, 0x57, 0x5d, 0x69, 0x48, 0x00, 0x3b, 0x05, + 0x07, 0x6e, 0x27, 0x65, 0x6e, 0x40, 0x3d, 0x3a, 0x4f, 0x72, 0x5d, 0x39, 0x16, 0x0f, 0x63, 0x12, 0x12, 0x15, 0x3a, 0x70, 0x0d, 0x57, + 0x18, 0x0d, 0x5e, 0x3d, 0x22, 0x68, 0x68, 0x7c, 0x6d, 0x4f, 0x0c, 0x7b, 0x09, 0x2d, 0x4a, 0x73, 0x20, 0x47, 0x07, 0x57, 0x75, 0x5d, + 0x53, 0x70, 0x34, 0x21, 0x40, 0x57, 0x51, 0x5e, 0x49, 0x44, 0x00, 0x54, 0x27, 0x04, 0x68, 0x7e, 0x59, 0x56, 0x58, 0x74, 0x14, 0x3c, + 0x16, 0x33, 0x41, 0x16, 0x4b, 0x2f, 0x49, 0x37, 0x0a, 0x54, 0x08, 0x08, 0x1f, 0x39, 0x67, 0x76, 0x28, 0x28, 0x07, 0x1d, 0x61, 0x47, + 0x51, 0x4d, 0x75, 0x26, 0x52, 0x47, 0x47, 0x0c, 0x57, 0x58, 0x74, 0x3e, 0x62, 0x6c, 0x58, 0x3a, 0x44, 0x1e, 0x16, 0x2e, 0x21, 0x1c, + 0x73, 0x45, 0x67, 0x74, 0x4f, 0x33, 0x66, 0x0e, 0x74, 0x66, 0x26, 0x1f, 0x2e, 0x38, 0x44, 0x40, 0x7e, 0x2a, 0x50, 0x52, 0x5e, 0x43, + 0x01, 0x7a, 0x38, 0x49, 0x3c, 0x55, 0x4d, 0x5a, 0x44, 0x08, 0x26, 0x59, 0x4d, 0x45, 0x0b, 0x48, 0x0a, 0x33, 0x5e, 0x4a, 0x4d, 0x75, + 0x16, 0x17, 0x63, 0x46, 0x01, 0x2a, 0x55, 0x7b, 0x0f, 0x02, 0x73, 0x6a, 0x4b, 0x7f, 0x75, 0x65, 0x3c, 0x4c, 0x33, 0x39, 0x6c, 0x74, + 0x05, 0x60, 0x0f, 0x7f, 0x2d, 0x41, 0x4d, 0x4d, 0x46, 0x71, 0x09, 0x6f, 0x4f, 0x60, 0x15, 0x0f, 0x46, 0x73, 0x63, 0x4c, 0x5e, 0x74, + 0x30, 0x0d, 0x28, 0x43, 0x08, 0x72, 0x32, 0x04, 0x2e, 0x31, 0x29, 0x27, 0x44, 0x6d, 0x13, 0x17, 0x48, 0x0f, 0x49, 0x52, 0x10, 0x13, + 0x7f, 0x17, 0x16, 0x62, 0x79, 0x35, 0x78, 0x3e, 0x01, 0x7c, 0x2e, 0x0f, 0x76, 0x3e, 0x5e, 0x53, 0x6c, 0x5b, 0x5f, 0x7c, 0x19, 0x41, + 0x02, 0x2f, 0x17, 0x64, 0x41, 0x75, 0x10, 0x04, 0x47, 0x7c, 0x3d, 0x4b, 0x52, 0x00, 0x10, 0x5d, 0x51, 0x4e, 0x7a, 0x27, 0x25, 0x55, + 0x40, 0x12, 0x35, 0x60, 0x05, 0x1b, 0x34, 0x2d, 0x04, 0x7a, 0x6a, 0x69, 0x02, 0x79, 0x03, 0x3a, 0x2f, 0x06, 0x0a, 0x79, 0x7b, 0x12, + 0x5d, 0x7c, 0x52, 0x29, 0x47, 0x58, 0x12, 0x73, 0x3f, 0x27, 0x56, 0x05, 0x0c, 0x48, 0x32, 0x58, 0x6b, 0x57, 0x5c, 0x03, 0x64, 0x56, + 0x11, 0x52, 0x7a, 0x30, 0x36, 0x29, 0x17, 0x3b, 0x68, 0x7a, 0x7c, 0x05, 0x6b, 0x6b, 0x13, 0x6a, 0x24, 0x5c, 0x68, 0x42, 0x18, 0x32, + 0x03, 0x73, 0x6e, 0x04, 0x21, 0x2e, 0x01, 0x04, 0x63, 0x7d, 0x44, 0x41, 0x12, 0x31, 0x0b, 0x15, 0x1f, 0x70, 0x00, 0x2e, 0x66, 0x14, + 0x3c, 0x7f, 0x2b, 0x00, 0x1f, 0x0c, 0x28, 0x59, 0x0a, 0x16, 0x49, 0x5a, 0x5c, 0x64, 0x65, 0x4b, 0x11, 0x29, 0x15, 0x36, 0x5a, 0x65, + 0x19, 0x4f, 0x60, 0x23, 0x3a, 0x3a, 0x13, 0x25, 0x02, 0x78, 0x4c, 0x54}; char b64_known[1369] = { - 0x43, 0x7a, 0x42, 0x45, 0x59, 0x6e, 0x77, 0x69, 0x48, 0x77, 0x30, 0x46, 0x5a, 0x79, 0x77, 0x71, 0x4f, 0x53, 0x46, 0x47, 0x43, 0x46, 0x42, 0x6d, 0x4e, 0x44, 0x63, 0x4c, - 0x52, 0x55, 0x73, 0x34, 0x4d, 0x67, 0x5a, 0x36, 0x50, 0x6e, 0x38, 0x4d, 0x51, 0x42, 0x68, 0x72, 0x4c, 0x57, 0x42, 0x4d, 0x59, 0x41, 0x77, 0x6a, 0x51, 0x7a, 0x73, 0x2b, - 0x47, 0x78, 0x59, 0x45, 0x52, 0x6c, 0x67, 0x2f, 0x51, 0x47, 0x6f, 0x52, 0x42, 0x57, 0x4e, 0x78, 0x46, 0x44, 0x56, 0x48, 0x65, 0x52, 0x4e, 0x76, 0x61, 0x79, 0x63, 0x59, - 0x57, 0x30, 0x67, 0x6e, 0x50, 0x6d, 0x38, 0x56, 0x4d, 0x30, 0x38, 0x2b, 0x58, 0x6c, 0x46, 0x7a, 0x61, 0x43, 0x55, 0x50, 0x42, 0x6c, 0x74, 0x38, 0x63, 0x6e, 0x55, 0x2b, - 0x50, 0x78, 0x74, 0x63, 0x62, 0x57, 0x6f, 0x35, 0x66, 0x47, 0x4e, 0x6a, 0x59, 0x47, 0x78, 0x36, 0x4d, 0x33, 0x5a, 0x53, 0x45, 0x79, 0x55, 0x7a, 0x66, 0x57, 0x55, 0x6a, - 0x4a, 0x78, 0x45, 0x47, 0x42, 0x6b, 0x64, 0x78, 0x48, 0x68, 0x52, 0x30, 0x59, 0x33, 0x41, 0x74, 0x46, 0x53, 0x63, 0x59, 0x55, 0x51, 0x59, 0x46, 0x4d, 0x78, 0x45, 0x73, - 0x61, 0x77, 0x41, 0x74, 0x64, 0x79, 0x42, 0x49, 0x44, 0x58, 0x4e, 0x52, 0x52, 0x53, 0x56, 0x2f, 0x66, 0x7a, 0x55, 0x6d, 0x4c, 0x69, 0x5a, 0x54, 0x4a, 0x47, 0x67, 0x65, - 0x44, 0x6c, 0x67, 0x36, 0x57, 0x56, 0x42, 0x57, 0x4e, 0x31, 0x39, 0x6d, 0x41, 0x55, 0x78, 0x61, 0x5a, 0x44, 0x4a, 0x51, 0x65, 0x32, 0x6f, 0x67, 0x63, 0x69, 0x73, 0x64, - 0x66, 0x6b, 0x4e, 0x37, 0x59, 0x55, 0x49, 0x4c, 0x59, 0x58, 0x4d, 0x6b, 0x65, 0x54, 0x70, 0x72, 0x53, 0x6e, 0x6c, 0x75, 0x43, 0x51, 0x38, 0x6e, 0x4c, 0x51, 0x78, 0x65, - 0x4d, 0x6b, 0x73, 0x4e, 0x65, 0x55, 0x59, 0x35, 0x49, 0x51, 0x6f, 0x6d, 0x58, 0x7a, 0x6f, 0x41, 0x4a, 0x6a, 0x38, 0x54, 0x4c, 0x6e, 0x35, 0x51, 0x4b, 0x32, 0x64, 0x47, - 0x63, 0x6a, 0x38, 0x37, 0x41, 0x55, 0x59, 0x62, 0x43, 0x7a, 0x56, 0x4a, 0x4f, 0x52, 0x6c, 0x77, 0x50, 0x51, 0x4a, 0x42, 0x44, 0x6a, 0x67, 0x46, 0x64, 0x6d, 0x56, 0x50, - 0x4d, 0x57, 0x78, 0x65, 0x46, 0x77, 0x51, 0x56, 0x4e, 0x69, 0x5a, 0x6b, 0x4e, 0x42, 0x51, 0x58, 0x66, 0x41, 0x34, 0x4c, 0x57, 0x31, 0x56, 0x54, 0x61, 0x77, 0x42, 0x43, - 0x51, 0x55, 0x38, 0x43, 0x58, 0x42, 0x4d, 0x4b, 0x4c, 0x43, 0x77, 0x2b, 0x45, 0x42, 0x51, 0x7a, 0x52, 0x58, 0x78, 0x36, 0x57, 0x6a, 0x46, 0x68, 0x4f, 0x51, 0x67, 0x69, - 0x61, 0x68, 0x34, 0x50, 0x62, 0x78, 0x74, 0x73, 0x45, 0x31, 0x35, 0x35, 0x49, 0x48, 0x6c, 0x51, 0x59, 0x67, 0x59, 0x73, 0x64, 0x68, 0x63, 0x45, 0x4b, 0x79, 0x70, 0x31, - 0x48, 0x77, 0x77, 0x33, 0x54, 0x67, 0x39, 0x37, 0x4c, 0x54, 0x52, 0x31, 0x59, 0x44, 0x46, 0x30, 0x4c, 0x67, 0x70, 0x4b, 0x45, 0x57, 0x78, 0x4a, 0x4a, 0x51, 0x45, 0x36, - 0x50, 0x53, 0x49, 0x65, 0x62, 0x52, 0x68, 0x52, 0x65, 0x43, 0x31, 0x69, 0x4d, 0x55, 0x78, 0x51, 0x51, 0x42, 0x64, 0x4c, 0x62, 0x79, 0x49, 0x41, 0x66, 0x32, 0x45, 0x71, - 0x4e, 0x44, 0x34, 0x41, 0x58, 0x79, 0x39, 0x66, 0x4c, 0x78, 0x51, 0x71, 0x56, 0x53, 0x63, 0x66, 0x52, 0x68, 0x38, 0x53, 0x52, 0x6c, 0x34, 0x65, 0x44, 0x48, 0x77, 0x34, - 0x41, 0x57, 0x46, 0x6b, 0x64, 0x69, 0x4a, 0x75, 0x43, 0x43, 0x41, 0x34, 0x54, 0x33, 0x4e, 0x79, 0x56, 0x52, 0x4a, 0x43, 0x47, 0x56, 0x42, 0x68, 0x51, 0x33, 0x64, 0x39, - 0x51, 0x53, 0x34, 0x31, 0x54, 0x7a, 0x30, 0x78, 0x4b, 0x46, 0x68, 0x6e, 0x47, 0x77, 0x4e, 0x52, 0x49, 0x44, 0x49, 0x63, 0x43, 0x47, 0x34, 0x33, 0x64, 0x54, 0x64, 0x45, - 0x54, 0x32, 0x67, 0x5a, 0x42, 0x32, 0x51, 0x55, 0x4b, 0x43, 0x55, 0x72, 0x61, 0x54, 0x55, 0x59, 0x4a, 0x79, 0x59, 0x55, 0x45, 0x33, 0x42, 0x43, 0x47, 0x52, 0x4a, 0x31, - 0x50, 0x67, 0x4a, 0x64, 0x66, 0x42, 0x4d, 0x66, 0x46, 0x6c, 0x4d, 0x37, 0x64, 0x45, 0x67, 0x38, 0x58, 0x6a, 0x6c, 0x73, 0x48, 0x42, 0x78, 0x30, 0x4f, 0x52, 0x38, 0x41, - 0x47, 0x77, 0x59, 0x4b, 0x61, 0x44, 0x74, 0x53, 0x54, 0x78, 0x35, 0x75, 0x50, 0x44, 0x55, 0x4d, 0x4f, 0x41, 0x34, 0x4c, 0x4f, 0x78, 0x70, 0x32, 0x49, 0x79, 0x6c, 0x54, - 0x48, 0x6c, 0x39, 0x42, 0x44, 0x45, 0x73, 0x4b, 0x5a, 0x53, 0x68, 0x34, 0x5a, 0x30, 0x68, 0x5a, 0x4a, 0x6d, 0x30, 0x78, 0x64, 0x69, 0x4e, 0x77, 0x59, 0x57, 0x51, 0x37, - 0x4f, 0x48, 0x6c, 0x6d, 0x64, 0x46, 0x4d, 0x73, 0x5a, 0x47, 0x52, 0x55, 0x41, 0x31, 0x52, 0x6c, 0x52, 0x45, 0x77, 0x59, 0x54, 0x30, 0x67, 0x67, 0x54, 0x33, 0x49, 0x51, - 0x50, 0x77, 0x78, 0x53, 0x4c, 0x51, 0x4d, 0x55, 0x41, 0x31, 0x46, 0x43, 0x45, 0x48, 0x64, 0x71, 0x4e, 0x41, 0x59, 0x79, 0x41, 0x33, 0x49, 0x55, 0x66, 0x41, 0x68, 0x64, - 0x55, 0x68, 0x70, 0x69, 0x66, 0x44, 0x34, 0x77, 0x66, 0x6c, 0x39, 0x2f, 0x56, 0x41, 0x39, 0x45, 0x53, 0x56, 0x31, 0x65, 0x45, 0x47, 0x6f, 0x47, 0x4b, 0x77, 0x5a, 0x54, - 0x45, 0x44, 0x6b, 0x33, 0x4d, 0x6b, 0x70, 0x4f, 0x50, 0x53, 0x74, 0x6c, 0x4f, 0x44, 0x6b, 0x48, 0x63, 0x6c, 0x52, 0x6b, 0x54, 0x56, 0x5a, 0x71, 0x41, 0x79, 0x4a, 0x77, - 0x65, 0x31, 0x39, 0x67, 0x43, 0x79, 0x6f, 0x4c, 0x61, 0x78, 0x42, 0x6b, 0x46, 0x41, 0x55, 0x69, 0x41, 0x48, 0x4e, 0x41, 0x49, 0x31, 0x74, 0x52, 0x48, 0x79, 0x73, 0x61, - 0x58, 0x57, 0x6c, 0x36, 0x52, 0x67, 0x78, 0x66, 0x4d, 0x6b, 0x74, 0x4b, 0x4b, 0x46, 0x4a, 0x35, 0x57, 0x78, 0x4a, 0x43, 0x47, 0x41, 0x42, 0x64, 0x4a, 0x7a, 0x46, 0x54, - 0x50, 0x45, 0x77, 0x32, 0x54, 0x6a, 0x67, 0x2f, 0x63, 0x67, 0x4e, 0x78, 0x41, 0x6c, 0x73, 0x32, 0x57, 0x58, 0x39, 0x31, 0x62, 0x67, 0x68, 0x55, 0x44, 0x54, 0x51, 0x63, - 0x4e, 0x46, 0x64, 0x64, 0x61, 0x55, 0x67, 0x41, 0x4f, 0x77, 0x55, 0x48, 0x62, 0x69, 0x64, 0x6c, 0x62, 0x6b, 0x41, 0x39, 0x4f, 0x6b, 0x39, 0x79, 0x58, 0x54, 0x6b, 0x57, - 0x44, 0x32, 0x4d, 0x53, 0x45, 0x68, 0x55, 0x36, 0x63, 0x41, 0x31, 0x58, 0x47, 0x41, 0x31, 0x65, 0x50, 0x53, 0x4a, 0x6f, 0x61, 0x48, 0x78, 0x74, 0x54, 0x77, 0x78, 0x37, - 0x43, 0x53, 0x31, 0x4b, 0x63, 0x79, 0x42, 0x48, 0x42, 0x31, 0x64, 0x31, 0x58, 0x56, 0x4e, 0x77, 0x4e, 0x43, 0x46, 0x41, 0x56, 0x31, 0x46, 0x65, 0x53, 0x55, 0x51, 0x41, - 0x56, 0x43, 0x63, 0x45, 0x61, 0x48, 0x35, 0x5a, 0x56, 0x6c, 0x68, 0x30, 0x46, 0x44, 0x77, 0x57, 0x4d, 0x30, 0x45, 0x57, 0x53, 0x79, 0x39, 0x4a, 0x4e, 0x77, 0x70, 0x55, - 0x43, 0x41, 0x67, 0x66, 0x4f, 0x57, 0x64, 0x32, 0x4b, 0x43, 0x67, 0x48, 0x48, 0x57, 0x46, 0x48, 0x55, 0x55, 0x31, 0x31, 0x4a, 0x6c, 0x4a, 0x48, 0x52, 0x77, 0x78, 0x58, - 0x57, 0x48, 0x51, 0x2b, 0x59, 0x6d, 0x78, 0x59, 0x4f, 0x6b, 0x51, 0x65, 0x46, 0x69, 0x34, 0x68, 0x48, 0x48, 0x4e, 0x46, 0x5a, 0x33, 0x52, 0x50, 0x4d, 0x32, 0x59, 0x4f, - 0x64, 0x47, 0x59, 0x6d, 0x48, 0x79, 0x34, 0x34, 0x52, 0x45, 0x42, 0x2b, 0x4b, 0x6c, 0x42, 0x53, 0x58, 0x6b, 0x4d, 0x42, 0x65, 0x6a, 0x68, 0x4a, 0x50, 0x46, 0x56, 0x4e, - 0x57, 0x6b, 0x51, 0x49, 0x4a, 0x6c, 0x6c, 0x4e, 0x52, 0x51, 0x74, 0x49, 0x43, 0x6a, 0x4e, 0x65, 0x53, 0x6b, 0x31, 0x31, 0x46, 0x68, 0x64, 0x6a, 0x52, 0x67, 0x45, 0x71, - 0x56, 0x58, 0x73, 0x50, 0x41, 0x6e, 0x4e, 0x71, 0x53, 0x33, 0x39, 0x31, 0x5a, 0x54, 0x78, 0x4d, 0x4d, 0x7a, 0x6c, 0x73, 0x64, 0x41, 0x56, 0x67, 0x44, 0x33, 0x38, 0x74, - 0x51, 0x55, 0x31, 0x4e, 0x52, 0x6e, 0x45, 0x4a, 0x62, 0x30, 0x39, 0x67, 0x46, 0x51, 0x39, 0x47, 0x63, 0x32, 0x4e, 0x4d, 0x58, 0x6e, 0x51, 0x77, 0x44, 0x53, 0x68, 0x44, - 0x43, 0x48, 0x49, 0x79, 0x42, 0x43, 0x34, 0x78, 0x4b, 0x53, 0x64, 0x45, 0x62, 0x52, 0x4d, 0x58, 0x53, 0x41, 0x39, 0x4a, 0x55, 0x68, 0x41, 0x54, 0x66, 0x78, 0x63, 0x57, - 0x59, 0x6e, 0x6b, 0x31, 0x65, 0x44, 0x34, 0x42, 0x66, 0x43, 0x34, 0x50, 0x64, 0x6a, 0x35, 0x65, 0x55, 0x32, 0x78, 0x62, 0x58, 0x33, 0x77, 0x5a, 0x51, 0x51, 0x49, 0x76, - 0x46, 0x32, 0x52, 0x42, 0x64, 0x52, 0x41, 0x45, 0x52, 0x33, 0x77, 0x39, 0x53, 0x31, 0x49, 0x41, 0x45, 0x46, 0x31, 0x52, 0x54, 0x6e, 0x6f, 0x6e, 0x4a, 0x56, 0x56, 0x41, - 0x45, 0x6a, 0x56, 0x67, 0x42, 0x52, 0x73, 0x30, 0x4c, 0x51, 0x52, 0x36, 0x61, 0x6d, 0x6b, 0x43, 0x65, 0x51, 0x4d, 0x36, 0x4c, 0x77, 0x59, 0x4b, 0x65, 0x58, 0x73, 0x53, - 0x58, 0x58, 0x78, 0x53, 0x4b, 0x55, 0x64, 0x59, 0x45, 0x6e, 0x4d, 0x2f, 0x4a, 0x31, 0x59, 0x46, 0x44, 0x45, 0x67, 0x79, 0x57, 0x47, 0x74, 0x58, 0x58, 0x41, 0x4e, 0x6b, - 0x56, 0x68, 0x46, 0x53, 0x65, 0x6a, 0x41, 0x32, 0x4b, 0x52, 0x63, 0x37, 0x61, 0x48, 0x70, 0x38, 0x42, 0x57, 0x74, 0x72, 0x45, 0x32, 0x6f, 0x6b, 0x58, 0x47, 0x68, 0x43, - 0x47, 0x44, 0x49, 0x44, 0x63, 0x32, 0x34, 0x45, 0x49, 0x53, 0x34, 0x42, 0x42, 0x47, 0x4e, 0x39, 0x52, 0x45, 0x45, 0x53, 0x4d, 0x51, 0x73, 0x56, 0x48, 0x33, 0x41, 0x41, - 0x4c, 0x6d, 0x59, 0x55, 0x50, 0x48, 0x38, 0x72, 0x41, 0x42, 0x38, 0x4d, 0x4b, 0x46, 0x6b, 0x4b, 0x46, 0x6b, 0x6c, 0x61, 0x58, 0x47, 0x52, 0x6c, 0x53, 0x78, 0x45, 0x70, - 0x46, 0x54, 0x5a, 0x61, 0x5a, 0x52, 0x6c, 0x50, 0x59, 0x43, 0x4d, 0x36, 0x4f, 0x68, 0x4d, 0x6c, 0x41, 0x6e, 0x68, 0x4d, 0x56, 0x41, 0x3d, 0x3d, 0x00}; + 0x43, 0x7a, 0x42, 0x45, 0x59, 0x6e, 0x77, 0x69, 0x48, 0x77, 0x30, 0x46, 0x5a, 0x79, 0x77, 0x71, 0x4f, 0x53, 0x46, 0x47, 0x43, 0x46, + 0x42, 0x6d, 0x4e, 0x44, 0x63, 0x4c, 0x52, 0x55, 0x73, 0x34, 0x4d, 0x67, 0x5a, 0x36, 0x50, 0x6e, 0x38, 0x4d, 0x51, 0x42, 0x68, 0x72, + 0x4c, 0x57, 0x42, 0x4d, 0x59, 0x41, 0x77, 0x6a, 0x51, 0x7a, 0x73, 0x2b, 0x47, 0x78, 0x59, 0x45, 0x52, 0x6c, 0x67, 0x2f, 0x51, 0x47, + 0x6f, 0x52, 0x42, 0x57, 0x4e, 0x78, 0x46, 0x44, 0x56, 0x48, 0x65, 0x52, 0x4e, 0x76, 0x61, 0x79, 0x63, 0x59, 0x57, 0x30, 0x67, 0x6e, + 0x50, 0x6d, 0x38, 0x56, 0x4d, 0x30, 0x38, 0x2b, 0x58, 0x6c, 0x46, 0x7a, 0x61, 0x43, 0x55, 0x50, 0x42, 0x6c, 0x74, 0x38, 0x63, 0x6e, + 0x55, 0x2b, 0x50, 0x78, 0x74, 0x63, 0x62, 0x57, 0x6f, 0x35, 0x66, 0x47, 0x4e, 0x6a, 0x59, 0x47, 0x78, 0x36, 0x4d, 0x33, 0x5a, 0x53, + 0x45, 0x79, 0x55, 0x7a, 0x66, 0x57, 0x55, 0x6a, 0x4a, 0x78, 0x45, 0x47, 0x42, 0x6b, 0x64, 0x78, 0x48, 0x68, 0x52, 0x30, 0x59, 0x33, + 0x41, 0x74, 0x46, 0x53, 0x63, 0x59, 0x55, 0x51, 0x59, 0x46, 0x4d, 0x78, 0x45, 0x73, 0x61, 0x77, 0x41, 0x74, 0x64, 0x79, 0x42, 0x49, + 0x44, 0x58, 0x4e, 0x52, 0x52, 0x53, 0x56, 0x2f, 0x66, 0x7a, 0x55, 0x6d, 0x4c, 0x69, 0x5a, 0x54, 0x4a, 0x47, 0x67, 0x65, 0x44, 0x6c, + 0x67, 0x36, 0x57, 0x56, 0x42, 0x57, 0x4e, 0x31, 0x39, 0x6d, 0x41, 0x55, 0x78, 0x61, 0x5a, 0x44, 0x4a, 0x51, 0x65, 0x32, 0x6f, 0x67, + 0x63, 0x69, 0x73, 0x64, 0x66, 0x6b, 0x4e, 0x37, 0x59, 0x55, 0x49, 0x4c, 0x59, 0x58, 0x4d, 0x6b, 0x65, 0x54, 0x70, 0x72, 0x53, 0x6e, + 0x6c, 0x75, 0x43, 0x51, 0x38, 0x6e, 0x4c, 0x51, 0x78, 0x65, 0x4d, 0x6b, 0x73, 0x4e, 0x65, 0x55, 0x59, 0x35, 0x49, 0x51, 0x6f, 0x6d, + 0x58, 0x7a, 0x6f, 0x41, 0x4a, 0x6a, 0x38, 0x54, 0x4c, 0x6e, 0x35, 0x51, 0x4b, 0x32, 0x64, 0x47, 0x63, 0x6a, 0x38, 0x37, 0x41, 0x55, + 0x59, 0x62, 0x43, 0x7a, 0x56, 0x4a, 0x4f, 0x52, 0x6c, 0x77, 0x50, 0x51, 0x4a, 0x42, 0x44, 0x6a, 0x67, 0x46, 0x64, 0x6d, 0x56, 0x50, + 0x4d, 0x57, 0x78, 0x65, 0x46, 0x77, 0x51, 0x56, 0x4e, 0x69, 0x5a, 0x6b, 0x4e, 0x42, 0x51, 0x58, 0x66, 0x41, 0x34, 0x4c, 0x57, 0x31, + 0x56, 0x54, 0x61, 0x77, 0x42, 0x43, 0x51, 0x55, 0x38, 0x43, 0x58, 0x42, 0x4d, 0x4b, 0x4c, 0x43, 0x77, 0x2b, 0x45, 0x42, 0x51, 0x7a, + 0x52, 0x58, 0x78, 0x36, 0x57, 0x6a, 0x46, 0x68, 0x4f, 0x51, 0x67, 0x69, 0x61, 0x68, 0x34, 0x50, 0x62, 0x78, 0x74, 0x73, 0x45, 0x31, + 0x35, 0x35, 0x49, 0x48, 0x6c, 0x51, 0x59, 0x67, 0x59, 0x73, 0x64, 0x68, 0x63, 0x45, 0x4b, 0x79, 0x70, 0x31, 0x48, 0x77, 0x77, 0x33, + 0x54, 0x67, 0x39, 0x37, 0x4c, 0x54, 0x52, 0x31, 0x59, 0x44, 0x46, 0x30, 0x4c, 0x67, 0x70, 0x4b, 0x45, 0x57, 0x78, 0x4a, 0x4a, 0x51, + 0x45, 0x36, 0x50, 0x53, 0x49, 0x65, 0x62, 0x52, 0x68, 0x52, 0x65, 0x43, 0x31, 0x69, 0x4d, 0x55, 0x78, 0x51, 0x51, 0x42, 0x64, 0x4c, + 0x62, 0x79, 0x49, 0x41, 0x66, 0x32, 0x45, 0x71, 0x4e, 0x44, 0x34, 0x41, 0x58, 0x79, 0x39, 0x66, 0x4c, 0x78, 0x51, 0x71, 0x56, 0x53, + 0x63, 0x66, 0x52, 0x68, 0x38, 0x53, 0x52, 0x6c, 0x34, 0x65, 0x44, 0x48, 0x77, 0x34, 0x41, 0x57, 0x46, 0x6b, 0x64, 0x69, 0x4a, 0x75, + 0x43, 0x43, 0x41, 0x34, 0x54, 0x33, 0x4e, 0x79, 0x56, 0x52, 0x4a, 0x43, 0x47, 0x56, 0x42, 0x68, 0x51, 0x33, 0x64, 0x39, 0x51, 0x53, + 0x34, 0x31, 0x54, 0x7a, 0x30, 0x78, 0x4b, 0x46, 0x68, 0x6e, 0x47, 0x77, 0x4e, 0x52, 0x49, 0x44, 0x49, 0x63, 0x43, 0x47, 0x34, 0x33, + 0x64, 0x54, 0x64, 0x45, 0x54, 0x32, 0x67, 0x5a, 0x42, 0x32, 0x51, 0x55, 0x4b, 0x43, 0x55, 0x72, 0x61, 0x54, 0x55, 0x59, 0x4a, 0x79, + 0x59, 0x55, 0x45, 0x33, 0x42, 0x43, 0x47, 0x52, 0x4a, 0x31, 0x50, 0x67, 0x4a, 0x64, 0x66, 0x42, 0x4d, 0x66, 0x46, 0x6c, 0x4d, 0x37, + 0x64, 0x45, 0x67, 0x38, 0x58, 0x6a, 0x6c, 0x73, 0x48, 0x42, 0x78, 0x30, 0x4f, 0x52, 0x38, 0x41, 0x47, 0x77, 0x59, 0x4b, 0x61, 0x44, + 0x74, 0x53, 0x54, 0x78, 0x35, 0x75, 0x50, 0x44, 0x55, 0x4d, 0x4f, 0x41, 0x34, 0x4c, 0x4f, 0x78, 0x70, 0x32, 0x49, 0x79, 0x6c, 0x54, + 0x48, 0x6c, 0x39, 0x42, 0x44, 0x45, 0x73, 0x4b, 0x5a, 0x53, 0x68, 0x34, 0x5a, 0x30, 0x68, 0x5a, 0x4a, 0x6d, 0x30, 0x78, 0x64, 0x69, + 0x4e, 0x77, 0x59, 0x57, 0x51, 0x37, 0x4f, 0x48, 0x6c, 0x6d, 0x64, 0x46, 0x4d, 0x73, 0x5a, 0x47, 0x52, 0x55, 0x41, 0x31, 0x52, 0x6c, + 0x52, 0x45, 0x77, 0x59, 0x54, 0x30, 0x67, 0x67, 0x54, 0x33, 0x49, 0x51, 0x50, 0x77, 0x78, 0x53, 0x4c, 0x51, 0x4d, 0x55, 0x41, 0x31, + 0x46, 0x43, 0x45, 0x48, 0x64, 0x71, 0x4e, 0x41, 0x59, 0x79, 0x41, 0x33, 0x49, 0x55, 0x66, 0x41, 0x68, 0x64, 0x55, 0x68, 0x70, 0x69, + 0x66, 0x44, 0x34, 0x77, 0x66, 0x6c, 0x39, 0x2f, 0x56, 0x41, 0x39, 0x45, 0x53, 0x56, 0x31, 0x65, 0x45, 0x47, 0x6f, 0x47, 0x4b, 0x77, + 0x5a, 0x54, 0x45, 0x44, 0x6b, 0x33, 0x4d, 0x6b, 0x70, 0x4f, 0x50, 0x53, 0x74, 0x6c, 0x4f, 0x44, 0x6b, 0x48, 0x63, 0x6c, 0x52, 0x6b, + 0x54, 0x56, 0x5a, 0x71, 0x41, 0x79, 0x4a, 0x77, 0x65, 0x31, 0x39, 0x67, 0x43, 0x79, 0x6f, 0x4c, 0x61, 0x78, 0x42, 0x6b, 0x46, 0x41, + 0x55, 0x69, 0x41, 0x48, 0x4e, 0x41, 0x49, 0x31, 0x74, 0x52, 0x48, 0x79, 0x73, 0x61, 0x58, 0x57, 0x6c, 0x36, 0x52, 0x67, 0x78, 0x66, + 0x4d, 0x6b, 0x74, 0x4b, 0x4b, 0x46, 0x4a, 0x35, 0x57, 0x78, 0x4a, 0x43, 0x47, 0x41, 0x42, 0x64, 0x4a, 0x7a, 0x46, 0x54, 0x50, 0x45, + 0x77, 0x32, 0x54, 0x6a, 0x67, 0x2f, 0x63, 0x67, 0x4e, 0x78, 0x41, 0x6c, 0x73, 0x32, 0x57, 0x58, 0x39, 0x31, 0x62, 0x67, 0x68, 0x55, + 0x44, 0x54, 0x51, 0x63, 0x4e, 0x46, 0x64, 0x64, 0x61, 0x55, 0x67, 0x41, 0x4f, 0x77, 0x55, 0x48, 0x62, 0x69, 0x64, 0x6c, 0x62, 0x6b, + 0x41, 0x39, 0x4f, 0x6b, 0x39, 0x79, 0x58, 0x54, 0x6b, 0x57, 0x44, 0x32, 0x4d, 0x53, 0x45, 0x68, 0x55, 0x36, 0x63, 0x41, 0x31, 0x58, + 0x47, 0x41, 0x31, 0x65, 0x50, 0x53, 0x4a, 0x6f, 0x61, 0x48, 0x78, 0x74, 0x54, 0x77, 0x78, 0x37, 0x43, 0x53, 0x31, 0x4b, 0x63, 0x79, + 0x42, 0x48, 0x42, 0x31, 0x64, 0x31, 0x58, 0x56, 0x4e, 0x77, 0x4e, 0x43, 0x46, 0x41, 0x56, 0x31, 0x46, 0x65, 0x53, 0x55, 0x51, 0x41, + 0x56, 0x43, 0x63, 0x45, 0x61, 0x48, 0x35, 0x5a, 0x56, 0x6c, 0x68, 0x30, 0x46, 0x44, 0x77, 0x57, 0x4d, 0x30, 0x45, 0x57, 0x53, 0x79, + 0x39, 0x4a, 0x4e, 0x77, 0x70, 0x55, 0x43, 0x41, 0x67, 0x66, 0x4f, 0x57, 0x64, 0x32, 0x4b, 0x43, 0x67, 0x48, 0x48, 0x57, 0x46, 0x48, + 0x55, 0x55, 0x31, 0x31, 0x4a, 0x6c, 0x4a, 0x48, 0x52, 0x77, 0x78, 0x58, 0x57, 0x48, 0x51, 0x2b, 0x59, 0x6d, 0x78, 0x59, 0x4f, 0x6b, + 0x51, 0x65, 0x46, 0x69, 0x34, 0x68, 0x48, 0x48, 0x4e, 0x46, 0x5a, 0x33, 0x52, 0x50, 0x4d, 0x32, 0x59, 0x4f, 0x64, 0x47, 0x59, 0x6d, + 0x48, 0x79, 0x34, 0x34, 0x52, 0x45, 0x42, 0x2b, 0x4b, 0x6c, 0x42, 0x53, 0x58, 0x6b, 0x4d, 0x42, 0x65, 0x6a, 0x68, 0x4a, 0x50, 0x46, + 0x56, 0x4e, 0x57, 0x6b, 0x51, 0x49, 0x4a, 0x6c, 0x6c, 0x4e, 0x52, 0x51, 0x74, 0x49, 0x43, 0x6a, 0x4e, 0x65, 0x53, 0x6b, 0x31, 0x31, + 0x46, 0x68, 0x64, 0x6a, 0x52, 0x67, 0x45, 0x71, 0x56, 0x58, 0x73, 0x50, 0x41, 0x6e, 0x4e, 0x71, 0x53, 0x33, 0x39, 0x31, 0x5a, 0x54, + 0x78, 0x4d, 0x4d, 0x7a, 0x6c, 0x73, 0x64, 0x41, 0x56, 0x67, 0x44, 0x33, 0x38, 0x74, 0x51, 0x55, 0x31, 0x4e, 0x52, 0x6e, 0x45, 0x4a, + 0x62, 0x30, 0x39, 0x67, 0x46, 0x51, 0x39, 0x47, 0x63, 0x32, 0x4e, 0x4d, 0x58, 0x6e, 0x51, 0x77, 0x44, 0x53, 0x68, 0x44, 0x43, 0x48, + 0x49, 0x79, 0x42, 0x43, 0x34, 0x78, 0x4b, 0x53, 0x64, 0x45, 0x62, 0x52, 0x4d, 0x58, 0x53, 0x41, 0x39, 0x4a, 0x55, 0x68, 0x41, 0x54, + 0x66, 0x78, 0x63, 0x57, 0x59, 0x6e, 0x6b, 0x31, 0x65, 0x44, 0x34, 0x42, 0x66, 0x43, 0x34, 0x50, 0x64, 0x6a, 0x35, 0x65, 0x55, 0x32, + 0x78, 0x62, 0x58, 0x33, 0x77, 0x5a, 0x51, 0x51, 0x49, 0x76, 0x46, 0x32, 0x52, 0x42, 0x64, 0x52, 0x41, 0x45, 0x52, 0x33, 0x77, 0x39, + 0x53, 0x31, 0x49, 0x41, 0x45, 0x46, 0x31, 0x52, 0x54, 0x6e, 0x6f, 0x6e, 0x4a, 0x56, 0x56, 0x41, 0x45, 0x6a, 0x56, 0x67, 0x42, 0x52, + 0x73, 0x30, 0x4c, 0x51, 0x52, 0x36, 0x61, 0x6d, 0x6b, 0x43, 0x65, 0x51, 0x4d, 0x36, 0x4c, 0x77, 0x59, 0x4b, 0x65, 0x58, 0x73, 0x53, + 0x58, 0x58, 0x78, 0x53, 0x4b, 0x55, 0x64, 0x59, 0x45, 0x6e, 0x4d, 0x2f, 0x4a, 0x31, 0x59, 0x46, 0x44, 0x45, 0x67, 0x79, 0x57, 0x47, + 0x74, 0x58, 0x58, 0x41, 0x4e, 0x6b, 0x56, 0x68, 0x46, 0x53, 0x65, 0x6a, 0x41, 0x32, 0x4b, 0x52, 0x63, 0x37, 0x61, 0x48, 0x70, 0x38, + 0x42, 0x57, 0x74, 0x72, 0x45, 0x32, 0x6f, 0x6b, 0x58, 0x47, 0x68, 0x43, 0x47, 0x44, 0x49, 0x44, 0x63, 0x32, 0x34, 0x45, 0x49, 0x53, + 0x34, 0x42, 0x42, 0x47, 0x4e, 0x39, 0x52, 0x45, 0x45, 0x53, 0x4d, 0x51, 0x73, 0x56, 0x48, 0x33, 0x41, 0x41, 0x4c, 0x6d, 0x59, 0x55, + 0x50, 0x48, 0x38, 0x72, 0x41, 0x42, 0x38, 0x4d, 0x4b, 0x46, 0x6b, 0x4b, 0x46, 0x6b, 0x6c, 0x61, 0x58, 0x47, 0x52, 0x6c, 0x53, 0x78, + 0x45, 0x70, 0x46, 0x54, 0x5a, 0x61, 0x5a, 0x52, 0x6c, 0x50, 0x59, 0x43, 0x4d, 0x36, 0x4f, 0x68, 0x4d, 0x6c, 0x41, 0x6e, 0x68, 0x4d, + 0x56, 0x41, 0x3d, 0x3d, 0x00}; char *b64_test; plan_tests(1); diff --git a/lib/tests/test_cmd.c b/lib/tests/test_cmd.c index a60b64e1..c8867dfb 100644 --- a/lib/tests/test_cmd.c +++ b/lib/tests/test_cmd.c @@ -140,7 +140,8 @@ int main(int argc, char **argv) { ok(chld_err.lines == 0, "(array) Check for expected number of stderr lines"); ok(strcmp(chld_out.line[0], "this is a test via echo") == 0, "(array) Check line 1 for expected stdout output"); ok(strcmp(chld_out.line[1], "line two") == 0, "(array) Check line 2 for expected stdout output"); - ok(strcmp(chld_out.line[2], "it's line 3 and (note space between '3' and 'and') $$ will not get evaluated") == 0, "(array) Check line 3 for expected stdout output"); + ok(strcmp(chld_out.line[2], "it's line 3 and (note space between '3' and 'and') $$ will not get evaluated") == 0, + "(array) Check line 3 for expected stdout output"); ok(result == 0, "(array) Checking exit code"); /* ensure everything is empty again */ diff --git a/lib/tests/test_generic_output b/lib/tests/test_generic_output new file mode 100755 index 00000000..51e299a0 Binary files /dev/null and b/lib/tests/test_generic_output differ diff --git a/lib/tests/test_ini1.c b/lib/tests/test_ini1.c index 711fef98..246c1250 100644 --- a/lib/tests/test_ini1.c +++ b/lib/tests/test_ini1.c @@ -98,15 +98,22 @@ int main(int argc, char **argv) { my_free(optstr); optstr = list2str(np_get_defaults("tcp_long_lines@plugins.ini", "check_tcp")); - ok(!strcmp(optstr, - "--escape --send=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " - "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo " - "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " - "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda --expect=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " - "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " - "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo " - "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " - "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda --jail"), + ok(!strcmp(optstr, "--escape --send=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar " + "BAZ yadda yadda yadda Foo bar BAZ yadda yadda " + "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " + "yadda yadda Foo bar BAZ yadda yadda yadda Foo " + "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " + "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " + "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda --expect=Foo bar BAZ yadda yadda " + "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " + "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo " + "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " + "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " + "yadda yadda Foo bar BAZ yadda yadda yadda Foo " + "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " + "yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " + "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo " + "bar BAZ yadda yadda yadda --jail"), "Long options"); my_free(optstr); diff --git a/lib/tests/test_opts1.c b/lib/tests/test_opts1.c index e32115c5..984183d3 100644 --- a/lib/tests/test_opts1.c +++ b/lib/tests/test_opts1.c @@ -126,9 +126,11 @@ int main(int argc, char **argv) { } { - char *argv_test[] = {"prog_name", "--arg1=val1", "--extra-opts=@./config-opts.ini", "--extra-opts", "sect1@./config-opts.ini", "--arg2", (char *)NULL}; + char *argv_test[] = {"prog_name", "--arg1=val1", "--extra-opts=@./config-opts.ini", "--extra-opts", "sect1@./config-opts.ini", + "--arg2", (char *)NULL}; argc_test = 6; - char *argv_known[] = {"prog_name", "--foo=Bar", "--this=Your Mother!", "--blank", "--one=two", "--arg1=val1", "--arg2", (char *)NULL}; + char *argv_known[] = {"prog_name", "--foo=Bar", "--this=Your Mother!", "--blank", "--one=two", + "--arg1=val1", "--arg2", (char *)NULL}; argv_new = np_extra_opts(&argc_test, argv_test, "check_disk"); ok(array_diff(argc_test, argv_new, 7, argv_known), "twice extra opts using two sections"); my_free(&argc_test, argv_new, argv_test); diff --git a/lib/tests/test_opts2.c b/lib/tests/test_opts2.c index 95c65052..23496617 100644 --- a/lib/tests/test_opts2.c +++ b/lib/tests/test_opts2.c @@ -110,20 +110,28 @@ int main(int argc, char **argv) { { char *argv_test[] = {"check_tcp", "--extra-opts", "--extra-opts=tcp_long_lines", (char *)NULL}; argc_test = 3; - char *argv_known[] = {"check_tcp", - "--timeout=10", - "--escape", - "--send=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " - "yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " - "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar " - "BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda", - "--expect=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " - "yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " - "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar " - "BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo " - "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda", - "--jail", - (char *)NULL}; + char *argv_known[] = { + "check_tcp", + "--timeout=10", + "--escape", + "--send=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " + "yadda Foo bar BAZ yadda " + "yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " + "yadda Foo bar BAZ " + "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " + "yadda yadda Foo bar " + "BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda", + "--expect=Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " + "yadda Foo bar BAZ yadda " + "yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda " + "yadda Foo bar BAZ " + "yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda " + "yadda yadda Foo bar " + "BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ " + "yadda yadda yadda Foo " + "bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda Foo bar BAZ yadda yadda yadda", + "--jail", + (char *)NULL}; argv_new = np_extra_opts(&argc_test, argv_test, "check_tcp"); ok(array_diff(argc_test, argv_new, 6, argv_known), "Long lines test"); my_free(&argc_test, argv_new, argv_test); diff --git a/lib/tests/test_tcp.c b/lib/tests/test_tcp.c index b09c005b..1b3003e9 100644 --- a/lib/tests/test_tcp.c +++ b/lib/tests/test_tcp.c @@ -32,15 +32,21 @@ int main(void) { server_expect[1] = strdup("bb"); server_expect[2] = strdup("CC"); - ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS, "Test matching any string at the beginning (first expect string)"); - ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS, "Test matching any string at the beginning (second expect string)"); - ok(np_expect_match("b", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_RETRY, "Test matching any string at the beginning (substring match)"); - ok(np_expect_match("XX bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_FAILURE, "Test with strings not matching at the beginning"); + ok(np_expect_match("AA bb CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS, + "Test matching any string at the beginning (first expect string)"); + ok(np_expect_match("bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_SUCCESS, + "Test matching any string at the beginning (second expect string)"); + ok(np_expect_match("b", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_RETRY, + "Test matching any string at the beginning (substring match)"); + ok(np_expect_match("XX bb AA CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_FAILURE, + "Test with strings not matching at the beginning"); ok(np_expect_match("XX CC XX", server_expect, server_expect_count, NP_MATCH_EXACT) == NP_MATCH_FAILURE, "Test matching any string"); ok(np_expect_match("XX", server_expect, server_expect_count, 0) == NP_MATCH_RETRY, "Test not matching any string"); - ok(np_expect_match("XX AA bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_SUCCESS, "Test matching all strings"); + ok(np_expect_match("XX AA bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_SUCCESS, + "Test matching all strings"); ok(np_expect_match("XX bb CC XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY, "Test not matching all strings"); - ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY, "Test not matching any string (testing all)"); + ok(np_expect_match("XX XX", server_expect, server_expect_count, NP_MATCH_ALL) == NP_MATCH_RETRY, + "Test not matching any string (testing all)"); return exit_status(); } diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c index 901e0cc3..c3150f00 100644 --- a/lib/tests/test_utils.c +++ b/lib/tests/test_utils.c @@ -375,7 +375,8 @@ int main(int argc, char **argv) { temp_state_key->_filename = "var/statefile"; temp_state_data = np_state_read(); - ok(this_monitoring_plugin->state->state_data != NULL, "Got state data now") || diag("Are you running in right directory? Will get coredump next if not"); + ok(this_monitoring_plugin->state->state_data != NULL, "Got state data now") || + diag("Are you running in right directory? Will get coredump next if not"); ok(this_monitoring_plugin->state->state_data->time == 1234567890, "Got time"); ok(!strcmp((char *)this_monitoring_plugin->state->state_data->data, "String to read"), "Data as expected"); diff --git a/lib/utils_base.c b/lib/utils_base.c index 6d6954ef..90a4aaa5 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c @@ -33,12 +33,12 @@ #include #include -#define np_free(ptr) \ - { \ - if (ptr) { \ - free(ptr); \ - ptr = NULL; \ - } \ +#define np_free(ptr) \ + { \ + if (ptr) { \ + free(ptr); \ + ptr = NULL; \ + } \ } monitoring_plugin *this_monitoring_plugin = NULL; @@ -511,7 +511,8 @@ void np_enable_state(char *keyname, int expected_data_version) { this_state->state_data = NULL; /* Calculate filename */ - ret = asprintf(&temp_filename, "%s/%lu/%s/%s", _np_state_calculate_location_prefix(), (unsigned long)geteuid(), this_monitoring_plugin->plugin_name, this_state->name); + ret = asprintf(&temp_filename, "%s/%lu/%s/%s", _np_state_calculate_location_prefix(), (unsigned long)geteuid(), + this_monitoring_plugin->plugin_name, this_state->name); if (ret < 0) die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); @@ -568,7 +569,13 @@ bool _np_state_read_file(FILE *f) { int i; int failure = 0; time_t current_time, data_time; - enum { STATE_FILE_VERSION, STATE_DATA_VERSION, STATE_DATA_TIME, STATE_DATA_TEXT, STATE_DATA_END } expected = STATE_FILE_VERSION; + enum { + STATE_FILE_VERSION, + STATE_DATA_VERSION, + STATE_DATA_TIME, + STATE_DATA_TEXT, + STATE_DATA_END + } expected = STATE_FILE_VERSION; time(¤t_time); diff --git a/lib/utils_disk.c b/lib/utils_disk.c index c87090e8..2b761f5e 100644 --- a/lib/utils_disk.c +++ b/lib/utils_disk.c @@ -180,7 +180,8 @@ void np_set_best_match(struct parameter_list *desired, struct mount_entry *mount if (!best_match) { for (me = mount_list; me; me = me->me_next) { size_t len = strlen(me->me_mountdir); - if ((!exact && (best_match_len <= len && len <= name_len && (len == 1 || strncmp(me->me_mountdir, d->name, len) == 0))) || + if ((!exact && + (best_match_len <= len && len <= name_len && (len == 1 || strncmp(me->me_mountdir, d->name, len) == 0))) || (exact && strcmp(me->me_mountdir, d->name) == 0)) { if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) >= 0) { best_match = me; diff --git a/lib/utils_tcp.c b/lib/utils_tcp.c index 440eb9b4..daae1d54 100644 --- a/lib/utils_tcp.c +++ b/lib/utils_tcp.c @@ -29,10 +29,10 @@ #include "common.h" #include "utils_tcp.h" -#define VERBOSE(message) \ - do { \ - if (flags & NP_MATCH_VERBOSE) \ - puts(message); \ +#define VERBOSE(message) \ + do { \ + if (flags & NP_MATCH_VERBOSE) \ + puts(message); \ } while (0) enum np_match_result np_expect_match(char *status, char **server_expect, int expect_count, int flags) { -- cgit v1.2.3-74-g34f1