]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
policy TLS_FORWARD: fix error reporting from net.tls_client()
authorPetr Špaček <petr.spacek@nic.cz>
Wed, 17 Jan 2018 13:37:16 +0000 (14:37 +0100)
committerPetr Špaček <petr.spacek@nic.cz>
Thu, 18 Jan 2018 12:20:10 +0000 (13:20 +0100)
daemon/bindings.c
daemon/tls.c

index 46aaa8c504a71c566c6d2095aaf027ef522596f2..74e9c865fbb04bf5cf79b6dc1abfa8cf3885e276 100644 (file)
@@ -391,7 +391,7 @@ static int net_tls(lua_State *L)
 
        int r = tls_certificate_set(net, lua_tostring(L, 1), lua_tostring(L, 2));
        if (r != 0) {
-               lua_pushstring(L, strerror(ENOMEM));
+               lua_pushstring(L, kr_strerror(r));
                lua_error(L);
        }
 
@@ -511,7 +511,7 @@ static int net_tls_client(lua_State *L)
                int r = tls_client_params_set(&net->tls_client_params,
                                              addr, port, NULL, NULL, NULL);
                if (r != 0) {
-                       lua_pushstring(L, strerror(ENOMEM));
+                       lua_pushstring(L, kr_strerror(r));
                        lua_error(L);
                }
 
@@ -529,7 +529,7 @@ static int net_tls_client(lua_State *L)
                        int r = tls_client_params_set(&net->tls_client_params,
                                                      addr, port, NULL, NULL, pin);
                        if (r != 0) {
-                               lua_pushstring(L, strerror(ENOMEM));
+                               lua_pushstring(L, kr_strerror(r));
                                lua_error(L);
                        }
                        lua_pop(L, 1);
@@ -555,7 +555,7 @@ static int net_tls_client(lua_State *L)
                int r = tls_client_params_set(&net->tls_client_params,
                                              addr, port, ca_file, NULL, NULL);
                if (r != 0) {
-                       lua_pushstring(L, strerror(ENOMEM));
+                       lua_pushstring(L, kr_strerror(r));
                        lua_error(L);
                }
                /* removes 'value'; keeps 'key' for next iteration */
@@ -569,7 +569,7 @@ static int net_tls_client(lua_State *L)
                int r = tls_client_params_set(&net->tls_client_params,
                                              addr, port, NULL, hostname, NULL);
                if (r != 0) {
-                       lua_pushstring(L, strerror(ENOMEM));
+                       lua_pushstring(L, kr_strerror(r));
                        lua_error(L);
                }
                /* removes 'value'; keeps 'key' for next iteration */
@@ -1393,7 +1393,7 @@ static int wrk_resolve(lua_State *L)
        /* Create query packet */
        knot_pkt_t *pkt = knot_pkt_new(NULL, KNOT_EDNS_MAX_UDP_PAYLOAD, NULL);
        if (!pkt) {
-               lua_pushstring(L, strerror(ENOMEM));
+               lua_pushstring(L, kr_strerror(ENOMEM));
                lua_error(L);
        }
        uint8_t dname[KNOT_DNAME_MAXLEN];
index 17e0bf5bbdc0ee729ce069f0d36fcde44c70559c..fc846d3cb4c4bc19827128a642a19fd9fe453b33 100644 (file)
@@ -621,7 +621,7 @@ int tls_client_params_set(map_t *tls_client_paramlist,
                                int res = gnutls_certificate_set_x509_trust_file(entry->credentials, value,
                                                                                 GNUTLS_X509_FMT_PEM);
                                if (res < 0) {
-                                       kr_log_error("[tls client], failed to import certificate file '%s' (%s)\n",
+                                       kr_log_error("[tls client] failed to import certificate file '%s' (%s)\n",
                                                     value, gnutls_strerror_name(res));
                                        /* value will be freed at cleanup */
                                        ret = kr_error(EINVAL);