1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-07 23:19:02 +00:00

Fix broken loading of SSH public keys from a file. Close #2919, see #2917

This commit is contained in:
nnposter
2024-09-07 16:40:14 +00:00
parent 5039f7efca
commit 36ba840489

View File

@@ -553,6 +553,11 @@ static int l_read_publickey (lua_State *L) {
const char* publickeyfile = luaL_checkstring(L, 1);
luaL_Buffer publickey_data;
lua_getglobal(L, "require");
lua_pushliteral(L, "base64");
lua_call(L, 1, 1);
lua_getfield(L, -1, "dec");
fd = fopen(publickeyfile, "r");
if (!fd)
return luaL_error(L, "Error reading file");
@@ -566,11 +571,6 @@ static int l_read_publickey (lua_State *L) {
}
fclose(fd);
lua_getglobal(L, "require");
lua_pushstring(L, "base64");
lua_call(L, 1, 1);
lua_getfield(L, -1, "dec");
luaL_pushresult(&publickey_data);
lua_call(L, 1, 1);