1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-29 02:49:01 +00:00
Commit Graph

209 Commits

Author SHA1 Message Date
henri
3451220630 Refactored proxy code to use a "strategy" design pattern.
Proxy backends are selected at runtime. Each proxy exports a list of operations
to the rest of the library. This is similar to the way IO engines are
implemented within nsock.
2013-04-22 19:30:40 +00:00
henri
08c44fe775 Added nsock_proxy.h to the DEPS list. 2013-04-22 19:30:30 +00:00
henri
48354754a8 Renamed proxy actions into proxy op, which seems to be rather more meaningful. 2013-04-22 19:30:23 +00:00
henri
e1030f2fe7 Cosmetic fixes. 2013-04-22 19:30:14 +00:00
henri
f5e437cdbf Removed undesired debugging printf() call. 2013-04-22 19:30:07 +00:00
henri
2b3a3ca5df Fixed ProxyAction extern declaration. 2013-04-22 19:29:58 +00:00
henri
91af533ca2 Added missing initializer. 2013-04-22 19:29:43 +00:00
henri
641d63efb4 Reduced scope of the top level proxy event handler.
There is no need anymore for exporting this function to the rest of the library.
It's called by the proxy hooks when registering new events.
2013-04-22 19:29:35 +00:00
henri
9084805bbf Added destructor for proxy_chain_context. 2013-04-22 19:29:26 +00:00
henri
28604b63e3 Design improvements.
Externally:
  The calling application can build a proxychain object and assign it to one (or
  more) NSP. Once a NSP get assigned a proxychain it's not possible to remove
  it so that consistency is (should be...) ensured.

Internally:
  An IOD comes with a proxychain context structure storing the whole tunnel
  state. Also each proxy type now has a table of associated functions to use
  as hooks for TCP connects(), read() and write() requests. As a result, adding
  support of new proxy type should be easier. Code also gains readability in
  comparison to large switch/cases that redirect the execution flow according to
  the given proxy type.
2013-04-22 19:29:18 +00:00
henri
06219414a6 Initial version with a _very_ raw support for HTTP proxy chains (using the
CONNECT method). This is mostly intended to validate the concepts, data models
and programming approach.
2013-04-22 19:28:53 +00:00
henri
6d9a68ecb9 Code cleanup.
Removed unused nse.time_created field.
Use bitfields instead of integers for nse.eof and nse.event_done
Indentation fixes.
2013-04-19 23:21:40 +00:00
david
87bab78479 Move CHECKED_FD_SET and CHECKED_FD_CLR to Nbase. 2013-02-22 00:45:57 +00:00
david
6e674f5cf5 Use an fprintf and abort instead of Nsock's fatal.
In preparation for move to Nbase.
2013-02-22 00:45:56 +00:00
david
d50afbca7d Fix some format string mismatches (int versus long int). 2013-02-22 00:45:55 +00:00
david
129d804d15 Add some missing noreturn and format attributes. 2013-02-22 00:45:55 +00:00
david
658b8648c6 Remove declartion of nonexistent myerror. 2013-02-22 00:45:54 +00:00
david
ce51d8c4da Use the default value of MultiThreadedDLL where possible. 2013-02-09 20:30:01 +00:00
david
6b095f42d2 Use MultiThreadedDebugDLL (/MDd) in place of MultiThreadedDebug (/MTd).
This is to match r8507, which did the analogous thing for the Release
configuration.
http://seclists.org/nmap-dev/2013/q1/120
2013-02-09 20:29: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
a7f2788b26 Removed another forgotten vestige of nsock_trace. 2013-01-23 22:06:35 +00:00
henri
0e5e939c00 Added a special NSOCK_LOG_NONE value, to disable all messages. 2013-01-23 21:25:01 +00:00
david
eb98386809 Remove vestiges of nsp_settrace.
Now you call nsock_set_log_function then nsock_set_loglevel.
http://seclists.org/nmap-dev/2013/q1/72
2013-01-22 23:40:16 +00:00
henri
0d58167dcf fixed format string! 2013-01-10 19:19:15 +00:00
henri
d878062cc7 Added format attribute to __nsock_log_internal.
This allows log format strings to be checked at compile time.
2013-01-10 19:19:09 +00:00
henri
fb90c4ff33 Replaced the LOWER_MAX_FD macro by a static inline function. 2013-01-07 21:54:07 +00:00
henri
941b73ac8a Minor style fixes. 2012-12-29 15:59:59 +00:00
henri
b6765c03fa Fixed SUN_LEN definition in nsock.h.
Added missing parenthesis to nsock's SUN_LEN for platforms
where the macro isn't defined.

Report and patch by Conor McCarthy
2012-12-24 23:29:18 +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
f2757be055 Proper error reporting during socket creation and initialization. 2012-12-20 18:10:54 +00:00
henri
b0fe74e355 More log message cleanup. Use __func__ when referring to the current function's name. 2012-12-15 18:21:09 +00:00
henri
3206c48aab Normalized log messages. No idea why I initially put underscores instead of spaces there. 2012-12-15 18:16:59 +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
david
ab802a6f21 Update some more headers. 2012-12-06 02:25:46 +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
2bfeace798 Make it an error in nsock_make_socket if AF_UNIX can't bind.
http://seclists.org/nmap-dev/2012/q4/345
2012-11-29 03:31:50 +00:00
david
d52a6fd23c Straighten out port computation in nsock_connect_internal.
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.
2012-11-27 21:47:25 +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
0232192312 Move inclusion of <errno.h> to after HAVE_POLL.
Suggested by Henri.
http://seclists.org/nmap-dev/2012/q4/286
2012-11-20 19:43:55 +00:00
david
8f5ed637f9 Include <errno.h> in engine_poll.c for EINTR.
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
2012-11-20 18:59:41 +00:00
david
641dddafb5 Use socket_bindtodevice instead of bare setsockopt in Nsock. 2012-11-16 21:02:57 +00:00
david
8dd3a8a66e Fix SO_BINDTODEVICE Nsock error message. 2012-11-16 21:02:54 +00:00
fyodor
ea05ae2586 Latest auto-generated files in prep for upcoming 6.20BETA1 release 2012-11-16 00:54:16 +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
f5ac3e9f4e Put brackets on PEER_STR_LEN.
Maybe we'll decide to add these; anyway more space doesn't hurt.
2012-11-12 20:44:46 +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
99424a2b3e Only set HAVE_POLL on Vista and later.
Patch by Gisle Vanem
2012-11-02 10:53:24 +00:00
henri
cb3d88247b Fixed function name in error message. 2012-10-30 09:45:14 +00:00
henri
4b1e2a94bb A couple adjustemnt for windows.
- 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.
2012-10-22 17:57:58 +00:00
henri
ef9f4fcba5 Reverted r30104 and r30105. 2012-10-22 17:17:28 +00:00