- Removed dead code.
- Fixed style, improved consistency.
- Replaced FILESPACE_LENGTH and FILESPACE_STR macros by identical
static inline functions.
- Made fs_cat() a regular function. There's no actual benefit of
having it inlined.
Reworked the logging infrastructure to make it more flexible
and consistent.
Updated nmap, nping and ncat accordingly. Nsock log level can
now be adjusted at runtime by pressing d/D in nmap.
There was a bug here where AF_INET6 was used instead of AF_UNIX in the
HAVE_SYS_UN_H section. This masked another bug, which was that the
HAVE_SYS_UN_H section inadvertently extended into what was supposed to
be the HAVE_IPV6 section.
I'm not sure why I wasn't seeing this error before:
engine_poll.c: In function ‘poll_loop’:
engine_poll.c:352:46: error: ‘EINTR’ undeclared (first use in this function)
engine_poll.c:352:46: note: each undeclared identifier is reported only once for each function it appears in
All the information passed as arguments is present in an iod, and we
only call this with members of one iod. Change it to accept just an iod
as an argument.
Implementation of UNIX-domain sockets functionality
for Nsock. Also some minor necessary changes to
existing Nsock functions, to work properly with
UNIX-domain sockets.
- Do not set the X flags as events to be watched.
- Do not use POLLPRI as a R flag.
Not doing so causes WSAPoll() to fail with an "invalid argument" error.
This happens on Windows when two sockets bind to the same local port and
connect to the same remote port on a remote host. I tried this on Linux;
Linux prevents the second bind from succeeding.
http://seclists.org/nmap-dev/2012/q2/513
Otherwise WinSock error numbers are not understood; you get "Unknown
error" instead of "Only one usage of each socket address
(protocol/network address/port) is normally permitted." for example.
It's used two times, in two separate blocks of the function. Therefore it was
declared twice (once per block), then got moved toplevel but the second
declaration was forgotten somehow.
This doesn't actually change anything (identical objdump -d diff) but makes code
nicer.
http://seclists.org/nmap-dev/2012/q3/56. r29134 already addressed the issue but
was incomplete.
This replaces r29134 with an engine-agnostic approach, and additionally enforces
the reset of IOD flags before use or re-use.
that were internally closed and replaced by other ones. This happened during
reconnect attempts.
--
When reconnecting with SSL_OP_NO_SSLv2 (nsock_core.c:472), the libary closes the
fd of the current IOD, and replaces it by a new one.
The man page for epoll_ctl states that a close() on a fd makes it removed from
any epoll set it was in. Therefore, if epoll_ctl(EPOLL_CTL_MOD, ...) returns
ENOENT, we retry with EPOLL_CTL_ADD.
- Always format function name without parens at the beginning of a message.
- Added a nsi_new notification message.
- Only trace the first call to nsi_delete() of a given IOD (i.e. don't log the
calls issued from the resulting callbacks).