1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-15 09:56:33 +00:00
Commit Graph

59 Commits

Author SHA1 Message Date
tudor
1e1f744186 Added IOCP integration for Nsock, engine IOCP is the default engine on Windows 2016-08-22 19:15:13 +00:00
tudor
63b31682f4 Reverted the IOCP integration 2016-08-11 18:58:03 +00:00
tudor
1aa7958e23 Added IOCP integration for Nsock 2016-08-09 12:44:55 +00:00
dmiller
74cade6f39 Avoid some theoretical null pointer derefs 2016-07-30 03:54:00 +00:00
dmiller
a752c2265a Adjust indents to avoid confusion. Fixes #396. whitespace only. 2016-06-01 16:51:50 +00:00
dmiller
f38b959593 Avoid clobbering nsiod.peer with junk data if recvfrom doesn't set src_addr 2016-05-13 02:13:25 +00:00
dmiller
6e33d6ac3c Bump date in copyright headers 2016-04-04 15:38:44 +00:00
dmiller
616cf9730e clear session data before attempting a reconnect without SSLv2-compatibility. Fixes #318. Fixes #308 2016-03-12 23:26:26 +00:00
dmiller
ee048d5349 Avoid printf on NULL pointer if no string is registered for the error code. 2016-01-04 16:48:09 +00:00
henri
b55ff2d68f Don't associate nsock logging info to a nspool.
Make current loglevel and current log callback global
to the library. Attaching them to the nsock pool doesn't
bring any benefit and prevents from logging activity in
code sections that don't have access to a pool (such as
proxy chain specification parsing).

Updated external calls and nsock tests accordingly.
2015-06-27 08:21:53 +00:00
henri
b75233ce98 Consistently renamed nsi_XXX calls into nsock_iod_XXX
This is part of the effort to make nsock expose only
nsock_ prefixed symbols and simplify the API.
2015-06-27 08:21:33 +00:00
henri
0348359f60 Enforce nsock naming scheme.
convert nsp_* calls into nsock_pool_*. Separate words with underscores
where appropriate.
2015-06-27 08:21:16 +00:00
dmiller
68409b2226 Update copyright date to 2015 2015-06-03 13:01:29 +00:00
fyodor
f6f59a7cd7 Auto regeneration with latest template files, etc. 2014-08-13 22:57:43 +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
dmiller
3f0d0c16f9 Spellcheck on Nmap, Nsock, Nbase source files 2014-02-20 18:44:12 +00:00
henri
ba239a8610 Get rid of a level of indentation 2013-11-06 18:52:06 +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
23a58a1bc8 Minor style fixes. 2013-07-31 19:01:25 +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
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
28af8f519f Consistent spacing for switch (<condition>). 2013-05-12 13:40:01 +00:00
henri
ce01e2040a Refactored code.
A switch/case reads easier than a if/else if/else block
to handle multiple cases.
2013-05-12 13:39:53 +00:00
henri
81fda37f89 New function msevent_timedout(). 2013-05-12 13:39:45 +00:00
henri
d383df2847 More style fixes. 2013-05-03 21:25:53 +00:00
henri
23dcad8ea4 Removed redundant code. Style fixes. 2013-05-03 20:41:56 +00:00
david
d50afbca7d Fix some format string mismatches (int versus long int). 2013-02-22 00:45:55 +00:00
henri
b4400d0a44 Added static inline wrappers to simplify calls to I/O engine functions. 2013-01-23 22:06:40 +00:00
henri
2774c8cce6 Filespace code cleanup.
- 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.
2012-12-22 21:59:38 +00:00
henri
809f1eda68 Merged nsock-logging from nmap-exp/henri/nsock-logging/
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.
2012-12-15 10:59:30 +00:00
fyodor
6a42ef47c0 Update the Nmap and Nsock source code headers to note new Nmap dev mailing list email address and a better URL for Nmap license. 2012-12-06 01:21:42 +00:00
david
d81b4112a0 Don't add rc to write_count when rc is negative.
Noticed by Tomas Hozza.
2012-11-26 22:13:30 +00:00
david
7b371609a3 Refactor get_hostaddr_string to get_peeraddr_string.
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.
2012-11-12 20:44:49 +00:00
david
f01e3800fb Implementation of UNIX-domain sockets for Nsock.
Implementation of UNIX-domain sockets functionality
for Nsock. Also some minor necessary changes to
existing Nsock functions, to work properly with
UNIX-domain sockets.
2012-11-12 20:44:37 +00:00
henri
e2fb7301de Avoid sending error message to stdout 2012-10-10 18:59:13 +00:00
david
5ab8e37be6 Recognize WSAEADDRINUSE in handle_connect_result.
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
2012-09-06 20:11:08 +00:00
david
66c296e27f Use socket_strerror in Nsock callback traces.
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.
2012-09-06 20:11:04 +00:00
henri
87fcddad2b Fixed a couple nsock problems described in
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.
2012-07-09 16:45:49 +00:00
david
05c713d22a Don't try to do FD_ISSET on a nonselectable pcap descriptor.
The Nsock select engine stores readiness information in a mask instead
of doing an FD_ISSET against the descriptor every time. This is a good
idea, but it removed a special case in the pre-engines code: in case
PCAP_CAN_DO_SELECT is not defined, we can't do FD_ISSET on the
descriptor because it is -1. Here we check for that occurrence and set
EV_READ in the mask so that a non-blocking pcap read can happen every
iteration.
2012-04-05 03:30:09 +00:00
fyodor
e96a7b7b24 Update the headers for each code file. This updates code copyright dates to 2012, notes the awesome NSE in the list of technology, and slightly rewords the derivative works clarification 2012-03-01 06:32:23 +00:00
henri
889a4711ba Changed variable name from camel case to all lowercase for consistency with the naming convention. 2012-02-19 15:29:23 +00:00
henri
2ff581affa Fixed event set masking, only ev_inc was modified. Error introduced in r27949.
This was noticed and fixed by Brian Gottreu.
2012-01-30 21:53:34 +00:00
henri
e1c71046fe Changed update_events() to make it directly filter out events that belong to
both event sets (events to add and events to remove).

This removes the need callers had to do that filtering, it is safer and makes code
easier to read and maintain.

This section of code is described in a nmap-dev thread, that led to the
development of this patch: http://seclists.org/nmap-dev/2012/q1/243
2012-01-29 15:30:59 +00:00
henri
9cf2fa8854 Apply the correct event type against evclr in X_EV. 2012-01-27 20:44:28 +00:00
henri
255c2a0a9b Fixed an assertion failure which could occur when connecting to an SSL server:
nsock_core.c:186: update_events: Assertion `(ev_inc & ev_dec) == 0' failed.

Thanks to Ron for reporting the bug and testing.
See: http://seclists.org/nmap-dev/2012/q1/235
2012-01-27 15:46:32 +00:00
henri
9c7f72108b More code cleaning: whitespace and indentation fixes. 2012-01-20 08:26:14 +00:00