diff options
Diffstat (limited to 'plugins/check_cluster.c')
-rw-r--r-- | plugins/check_cluster.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/check_cluster.c b/plugins/check_cluster.c index cf699e1f..e1ede9f7 100644 --- a/plugins/check_cluster.c +++ b/plugins/check_cluster.c | |||
@@ -143,6 +143,7 @@ int main(int argc, char **argv){ | |||
143 | 143 | ||
144 | int process_arguments(int argc, char **argv){ | 144 | int process_arguments(int argc, char **argv){ |
145 | int c; | 145 | int c; |
146 | char *ptr; | ||
146 | int option=0; | 147 | int option=0; |
147 | static struct option longopts[]={ | 148 | static struct option longopts[]={ |
148 | {"data", required_argument,0,'d'}, | 149 | {"data", required_argument,0,'d'}, |
@@ -188,6 +189,15 @@ int process_arguments(int argc, char **argv){ | |||
188 | 189 | ||
189 | case 'd': /* data values */ | 190 | case 'd': /* data values */ |
190 | data_vals=(char *)strdup(optarg); | 191 | data_vals=(char *)strdup(optarg); |
192 | /* validate data */ | ||
193 | for (ptr=data_vals;ptr!=NULL;ptr+=2){ | ||
194 | if (ptr[0]<'0' || ptr[0]>'3') | ||
195 | return ERROR; | ||
196 | if (ptr[1]=='\0') | ||
197 | break; | ||
198 | if (ptr[1]!=',') | ||
199 | return ERROR; | ||
200 | } | ||
191 | break; | 201 | break; |
192 | 202 | ||
193 | case 'l': /* text label */ | 203 | case 'l': /* text label */ |
@@ -200,7 +210,7 @@ int process_arguments(int argc, char **argv){ | |||
200 | 210 | ||
201 | case 'V': /* version */ | 211 | case 'V': /* version */ |
202 | print_revision (progname, NP_VERSION); | 212 | print_revision (progname, NP_VERSION); |
203 | exit (STATE_OK); | 213 | exit (STATE_UNKNOWN); |
204 | break; | 214 | break; |
205 | 215 | ||
206 | case 'H': /* help */ | 216 | case 'H': /* help */ |