mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Change hostname parameter to const char *.
This commit is contained in:
@@ -742,13 +742,9 @@ static int l_resolve(lua_State *L)
|
|||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
struct addrinfo *addr, *addrs;
|
struct addrinfo *addr, *addrs;
|
||||||
int i;
|
int i;
|
||||||
char *host;
|
const char *host = luaL_checkstring(L, 1);
|
||||||
int af = fams[luaL_checkoption(L, 2, "unspec", fam_op)];
|
int af = fams[luaL_checkoption(L, 2, "unspec", fam_op)];
|
||||||
|
|
||||||
if (!lua_isstring(L, 1))
|
|
||||||
luaL_error(L, "Host to resolve must be a string");
|
|
||||||
host = (char *) lua_tostring(L, 1);
|
|
||||||
|
|
||||||
addrs = resolve_all(host, af);
|
addrs = resolve_all(host, af);
|
||||||
|
|
||||||
if (!addrs) {
|
if (!addrs) {
|
||||||
|
|||||||
2
tcpip.cc
2
tcpip.cc
@@ -437,7 +437,7 @@ const char *inet_socktop(struct sockaddr_storage *ss) {
|
|||||||
This function calls getaddrinfo and returns the same addrinfo linked list
|
This function calls getaddrinfo and returns the same addrinfo linked list
|
||||||
that getaddrinfo produces. Returns NULL for any error or failure to resolve.
|
that getaddrinfo produces. Returns NULL for any error or failure to resolve.
|
||||||
You need to call freeaddrinfo on the result if non-NULL. */
|
You need to call freeaddrinfo on the result if non-NULL. */
|
||||||
struct addrinfo *resolve_all(char *hostname, int pf)
|
struct addrinfo *resolve_all(const char *hostname, int pf)
|
||||||
{
|
{
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
struct addrinfo *result;
|
struct addrinfo *result;
|
||||||
|
|||||||
2
tcpip.h
2
tcpip.h
@@ -264,7 +264,7 @@ const char *inet_socktop(struct sockaddr_storage *ss);
|
|||||||
structure. This function calls getaddrinfo and returns the same
|
structure. This function calls getaddrinfo and returns the same
|
||||||
addrinfo linked list that getaddrinfo produces. Returns NULL for any
|
addrinfo linked list that getaddrinfo produces. Returns NULL for any
|
||||||
error or failure to resolve. */
|
error or failure to resolve. */
|
||||||
struct addrinfo *resolve_all(char *hostname, int pf);
|
struct addrinfo *resolve_all(const char *hostname, int pf);
|
||||||
|
|
||||||
/* Takes a destination address (dst) and tries to determine the
|
/* Takes a destination address (dst) and tries to determine the
|
||||||
source address and interface necessary to route to this address.
|
source address and interface necessary to route to this address.
|
||||||
|
|||||||
Reference in New Issue
Block a user