diff --git a/src/client.c b/src/client.c index 66c3ef2..f33a8e9 100644 --- a/src/client.c +++ b/src/client.c @@ -167,7 +167,7 @@ client_set_password(const char *cp) password = cp; } -void +int client_set_qtype(char *qtype) { if (!strcasecmp(qtype, "NULL")) @@ -182,6 +182,7 @@ client_set_qtype(char *qtype) do_qtype = T_SRV; else if (!strcasecmp(qtype, "TXT")) do_qtype = T_TXT; + return (do_qtype == T_UNSET); } char * diff --git a/src/client.h b/src/client.h index 69687d1..983b830 100644 --- a/src/client.h +++ b/src/client.h @@ -27,7 +27,7 @@ const char *client_get_raw_addr(); void client_set_nameserver(struct sockaddr_storage *, int); void client_set_topdomain(const char *cp); void client_set_password(const char *cp); -void client_set_qtype(char *qtype); +int client_set_qtype(char *qtype); char *client_get_qtype(); void client_set_downenc(char *encoding); void client_set_selecttimeout(int select_timeout); diff --git a/src/iodine.c b/src/iodine.c index 2f24889..6cf7cc3 100644 --- a/src/iodine.c +++ b/src/iodine.c @@ -249,7 +249,8 @@ main(int argc, char **argv) pidfile = optarg; break; case 'T': - client_set_qtype(optarg); + if (client_set_qtype(optarg)) + errx(5, "Invalid query type '%s'", optarg); break; case 'O': /* not -D, is Debug in server */ client_set_downenc(optarg);