1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-31 11:59:03 +00:00
Commit Graph

205 Commits

Author SHA1 Message Date
dmiller
ec9074f718 Correct "it's" to "its" where necessary
it's = it is
its = belonging to it
2014-06-19 04:58:46 +00:00
henri
ccf6e15b90 Nsock early error reporting.
Report finished (likely failed) events as early as possible. Because the
corresponding IODs can have no I/O activity, they wouldn't be flagged as active
by the I/O engines and the events could end up being delivered at shutdown only
(or never).

Reported by d33tah on http://seclists.org/nmap-dev/2014/q2/409
2014-06-11 20:14:16 +00:00
henri
d13dab54c3 Replaced internal opaque types by structs. 2014-05-21 19:59:42 +00:00
henri
687d153378 Divide code cleanly between ssl and non-ssl versions 2014-05-21 19:59:29 +00:00
dmiller
573f9c1a73 Fix a libpcap dependency flag in nsock test suite 2014-03-14 22:08:51 +00:00
dmiller
3f0d0c16f9 Spellcheck on Nmap, Nsock, Nbase source files 2014-02-20 18:44:12 +00:00
dmiller
c9714990c7 Remove trailing whitespace from C/C++ files
https://secwiki.org/w/Nmap/Code_Standards
2014-02-12 20:25:51 +00:00
henri
d5746993e2 Define nsi_delete() notify modes as enums.
These values aren't flags that can be ORed.
2014-02-03 20:53:09 +00:00
henri
64fb5b3482 Added safe fd_set operations.
Only FD_SET and FD_CLR were available. Added a FD_ISSET equivalent.
Implemented them as static inline instead of macros for consistency.

These functions abort() if the FD number is higher than FD_SETSIZE
(except on windows where no check is performed).
2014-01-30 19:02:57 +00:00
dmiller
83fd814a2c Really fix nsock's pcap configuration
This wasn't using Nmap's included libpcap if no options were specified,
instead compiling nsock without pcap support if no libpcap could be
found (which breaks Nmap)
2014-01-30 03:40:26 +00:00
dmiller
16505b5cc7 Nsock: let libpcap decisions set LDFLAGS, needed for make check 2014-01-26 16:38:24 +00:00
dmiller
2e047114f6 Improve support for non-included libpcap in nsock 2014-01-26 16:38:22 +00:00
dmiller
6251f85c9e Let nsock handle --with-libpcap in the same way as Nmap 2014-01-26 16:38:18 +00:00
henri
0ba3dc0be7 Include stddef only if required 2013-12-30 14:35:50 +00:00
d33tah
c7927c5449 Add missing stddef.h import. 2013-12-30 13:58:46 +00:00
dmiller
2506269bcc Let nsock's configure take the same --with-libpcap as Nmap does 2013-12-11 23:17:50 +00:00
dmiller
26b471c923 Also clean the tests dir when doing make clean (nsock) 2013-12-02 21:36:41 +00:00
dmiller
80510e96d6 Properly remove nsock_config.h on make distclean 2013-12-02 21:15:25 +00:00
dmiller
e4ce527a38 Avoid null pointer dereference to implement container_of
Using offsetof instead of actually dereferencing a 0 pointer is still
standards compliant (works under gcc -ansi, clang -ansi), and is more in
line with how Linux kernel defines this macro (kernel.h). Can't exactly
lift the kernel implementation because it uses gnu-extension typeof.

Not really a necessary change, but it was causing clang's address
sanitizer to complain.
2013-11-30 01:32:58 +00:00
dmiller
a5ce7f6083 Cast literal to appropriate type
On 64-bit, the literal 1 is a 32-bit integer, and can't be shifted
by the appropriate amount (61 bits).
2013-11-29 01:42:42 +00:00
henri
ba239a8610 Get rid of a level of indentation 2013-11-06 18:52:06 +00:00
henri
9c083de2cf Minor style fixes 2013-10-23 19:04:04 +00:00
david
d05d8acd93 Revert r32397, r32398, r32399 (tempnam to mkstemp).
I had intended the unlink to appy only to unix domain sockets, but it
was being called for every kind of local address.

http://seclists.org/nmap-dev/2013/q3/647
2013-09-27 15:30:18 +00:00
david
e18b25bccd Use tempfile in place of tempnam.
To avoid new GCC warnings about tempnam:
ncat_connect.c:789: warning: the use of `tempnam' is dangerous, better use `mkstemp'

Doing things this way has the same race condition as tempnam did,
because we are unlinking the file before binding it. (The race window is
smaller now.) The file must not exist before binding the Unix socket, or
else you get an "address already in use" error. Unlinking before binding
is the same thing that netcat-openbsd does. See this earlier thread:
http://seclists.org/nmap-dev/2012/q4/336.
2013-09-26 07:17:08 +00:00
henri
4fd3cc2f10 Allow NSE_TYPE_CONNECT_SSL to be canceled.
This fixes a really bad bug that seems to have been there for a while. Canceling
a nsock connect SSL operation fails with fatal(). I have never seen it in real
life though.

Added a corresponding unit test.
2013-09-15 10:52:07 +00:00
d33tah
4993befdb4 Fix a typo in nsock documentation. 2013-08-21 20:06:38 +00:00
henri
64c706c260 Proper code alignment. 2013-08-13 12:36:08 +00:00
d33tah
6805376faf Fix an nsock build error under MSVC. 2013-08-11 20:52:15 +00:00
henri
853aaff586 Manage expiration times via a heap queue.
This prevents nsock from iterating over the whole list of events at
each runloop, thus improving performance.

It made it necessary to have pointers from the msevents to the event
lists they belong to. The patch therefore also changes gh_list from
autonomous containers to embedded structures.

Added unit tests accordingly and cosmetic changes to make things look
more consistent.
2013-08-10 23:59:30 +00:00
henri
822d3e1da2 Fixed non-portable perror() statement.
Replaced perror() by printf + socket_strerror(socket_errno()).
Reported by Gisle Vanem.
2013-08-10 20:19:09 +00:00
henri
3a8607d65c Restore headers in nsock error.h
These includes seem useless and nsock and nmap happily compile w/o them but the
nsock test suite doesn't. Temporarily restore them to their pre-r36100 state
until I can clean and streamline the inclusion tree.
2013-08-06 19:39:39 +00:00
henri
3b6a09954b Build fix [brown-paper-bag bug]
Space inserted between the 'i' and the 'f' in a 'if'.
Reported and fixed by Robert Snyder.
2013-08-06 17:37:16 +00:00
david
61bbe88307 Include "nbase.h" for __attribute__ define on Windows.
I needed this on Visual C++ 2010 on Windows XP.
2013-08-06 01:35:33 +00:00
henri
ec55767734 Removed dead code 2013-07-31 19:11:21 +00:00
henri
694a8fe825 Nsock-pcap cleanup
Make the API follow the general nsock style. Report errors properly using the
nsock logging facilities.
2013-07-31 19:11:16 +00:00
henri
8352b28e55 Rewrapped and rephrased comments. 2013-07-31 19:11:09 +00:00
henri
23a58a1bc8 Minor style fixes. 2013-07-31 19:01:25 +00:00
henri
76a5565519 Spacing. 2013-07-31 19:01:21 +00:00
henri
105ea877b2 Update error message.
Report errors to dev@nmap.org.
2013-07-31 19:01:17 +00:00
henri
5d8fdc74a6 Cleanup conditionally compiled expressions. 2013-07-31 19:01:12 +00:00
henri
098c64a1de Removed occurences of `assert(0);'
Replaced them with `fatal()' so that nsock can compile w/ NDEBUG.
2013-07-31 18:46:57 +00:00
fyodor
83fb10ec56 Update the Nmap copyright/license files. This isn't the new Nmap Public Source License we've been discussing on the list, but rather just a 'quick patch' to hopefully prevent some of the abuse we've been seeing from companies lately. More details on the changes will be posted to the dev list. Also, the copyright year was updated to 2013 (which is the only change to Nsock license statements). 2013-07-28 22:05:05 +00:00
henri
c12b2e4370 Fixed indentation. 2013-06-17 19:23:41 +00:00
henri
a493296c54 Code cleanup.
Made get_peeraddr_string() return "peer unspecified" if peerlen <= 0.
This saves a handful duplicate lines that did the check externally.
2013-06-15 12:33:27 +00:00
henri
8b7f91cd0f Moved gh_lists tests from nsock/src/ to nsock/tests/ 2013-05-22 14:35:24 +00:00
henri
192cd3657d Don't set SO_BROADCAST on SOCK_STREAM sockets.
This doesn't make sense and raise verbose errors, at least on Windows.
See: http://seclists.org/nmap-dev/2013/q2/313
2013-05-18 13:24:03 +00:00
henri
3534dfa3b8 Display actual error codes in the nsock messages.
Refactored the code a bit too.
2013-05-18 13:23:55 +00:00
henri
8e38e32df1 Run nsock tests by typing make check from nmap/ or nsock/src/ 2013-05-18 13:06:10 +00:00
henri
8ab21a452d Properly declare the proxy spec structures as extern. 2013-05-13 08:05:31 +00:00
david
6b7b428cb9 Remove COMPAT_SRCS and COMPAT_OBJS.
These appear not to have any effect any more. They were initially used
to conditionally compile and link some files with replacements for
standard library functions, but seem not to have been used after r828
("Moved to nbase system for compatability funcs").
2013-05-13 04:21:11 +00:00