diff --git a/SRC/plugins/dns/dns.c b/SRC/plugins/dns/dns.c index 5889327..ceab36b 100644 --- a/SRC/plugins/dns/dns.c +++ b/SRC/plugins/dns/dns.c @@ -69,7 +69,6 @@ char * init (const int argc, const char **argv) { int value; - int c; char *hostname; char *msg = malloc (256); char *type_name, *upper_type_name = NULL; @@ -102,15 +101,12 @@ init (const int argc, const char **argv) request = (char *) poptGetArg (dns_poptcon); if (request == NULL) dns_usage ("Mandatory request missing"); - if ((type_name == NULL) || !strcmp(type_name, "")) + if ((type_name == NULL) || !strcmp (type_name, "")) type = T_A; else - { + { + upper_type_name = to_upper (type_name); /* TODO: a better algorithm. Use dns_rdatatype_fromtext in BIND ? */ - upper_type_name = (char *) malloc(strlen(type_name)); - for (c=0; c +#include char * random_string (unsigned length) @@ -36,6 +37,18 @@ random_string (unsigned length) } +char * +to_upper (char *input) +{ + int c; + char *result; + result = (char *) malloc (strlen (input)); + for (c = 0; c < strlen (input); c++) + result[c] = toupper (input[c]); + result[strlen (input)] = '\0'; + return result; +} + /* * tvsub -- Subtract 2 timeval structs: out = out - in. Out is assumed to be * >= in. Comes from the bing program.