]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Remove duplicated code
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 11 Aug 2022 20:36:38 +0000 (21:36 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 11 Aug 2022 20:36:38 +0000 (21:36 +0100)
src/lua/lua_dns_resolver.c

index cbdb06641ddcae810e487287ec04c084bf935d02..9a9201f0ec6bc64b931874fcac8a31e3916e2859 100644 (file)
@@ -109,28 +109,7 @@ lua_dns_get_type (lua_State *L, int argno)
        }
        else {
                strtype = lua_tostring (L, argno);
-
-               if (g_ascii_strcasecmp (strtype, "a") == 0) {
-                       type = RDNS_REQUEST_A;
-               }
-               else if (g_ascii_strcasecmp (strtype, "aaaa") == 0) {
-                       type = RDNS_REQUEST_AAAA;
-               }
-               else if (g_ascii_strcasecmp (strtype, "mx") == 0) {
-                       type = RDNS_REQUEST_MX;
-               }
-               else if (g_ascii_strcasecmp (strtype, "txt") == 0) {
-                       type = RDNS_REQUEST_TXT;
-               }
-               else if (g_ascii_strcasecmp (strtype, "ptr") == 0) {
-                       type = RDNS_REQUEST_PTR;
-               }
-               else if (g_ascii_strcasecmp (strtype, "soa") == 0) {
-                       type = RDNS_REQUEST_SOA;
-               }
-               else {
-                       msg_err ("bad DNS type: %s", strtype);
-               }
+               type = rdns_type_fromstr (strtype);
        }
 
        return type;