diff --git a/Makefile.nmake b/Makefile.nmake index a0a11ebdb..32401b50b 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -1,6 +1,8 @@ all: cd src/common $(MAKE) /F Makefile.nmake + cd ../../src/ext + $(MAKE) /F Makefile.nmake cd ../../src/or $(MAKE) /F Makefile.nmake cd ../../src/test @@ -9,6 +11,8 @@ all: clean: cd src/common $(MAKE) /F Makefile.nmake clean + cd ../../src/ext + $(MAKE) /F Makefile.nmake clean cd ../../src/or $(MAKE) /F Makefile.nmake clean cd ../../src/test diff --git a/changes/bug12700 b/changes/bug12700 new file mode 100644 index 000000000..1d8caeb8b --- /dev/null +++ b/changes/bug12700 @@ -0,0 +1,10 @@ + o Minor bugfixes: + - When logging information about an EXTEND2 or EXTENDED2 cell, log + their names correctly. Fixes part of bug 12700; bugfix on + 0.2.4.8-alpha. + + o Minor bugfixes: + - When logging information about a relay cell whose command we + don't recognize, log its command as an integer. Fixes part of + bug 12700; bugfix on 0.2.1.10-alpha. + diff --git a/changes/bug13071 b/changes/bug13071 new file mode 100644 index 000000000..8212b6c04 --- /dev/null +++ b/changes/bug13071 @@ -0,0 +1,3 @@ + o Minor bugfixes (relay): + - Escape all strings from the directory connection before logging them. + Fixes bug 13071; bugfix on 0.1.1.15. Patch from "teor". diff --git a/changes/bug13081 b/changes/bug13081 new file mode 100644 index 000000000..154f73fb0 --- /dev/null +++ b/changes/bug13081 @@ -0,0 +1,3 @@ + o Compilation fixes: + - Make the nmake make files work again. Fixes bug 13081. Bugfix on 0.2.5.1-alpha. Patch + from "NewEraCracker". diff --git a/src/common/Makefile.nmake b/src/common/Makefile.nmake index 0ebeaaaf7..b8c5dd4fe 100644 --- a/src/common/Makefile.nmake +++ b/src/common/Makefile.nmake @@ -1,12 +1,13 @@ all: libor.lib libor-crypto.lib libor-event.lib -CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\ext +CFLAGS = /O2 /MT /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common \ + /I ..\ext -LIBOR_OBJECTS = address.obj compat.obj container.obj di_ops.obj \ - log.obj memarea.obj mempool.obj procmon.obj util.obj \ +LIBOR_OBJECTS = address.obj backtrace.obj compat.obj container.obj di_ops.obj \ + log.obj memarea.obj mempool.obj procmon.obj sandbox.obj util.obj \ util_codedigest.obj -LIBOR_CRYPTO_OBJECTS = aes.obj crypto.obj torgzip.obj tortls.obj \ +LIBOR_CRYPTO_OBJECTS = aes.obj crypto.obj crypto_format.obj torgzip.obj tortls.obj \ crypto_curve25519.obj curve25519-donna.obj LIBOR_EVENT_OBJECTS = compat_libevent.obj diff --git a/src/ext/Makefile.nmake b/src/ext/Makefile.nmake new file mode 100644 index 000000000..d02d03bf4 --- /dev/null +++ b/src/ext/Makefile.nmake @@ -0,0 +1,12 @@ +all: csiphash.lib + +CFLAGS = /O2 /MT /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common \ + /I ..\ext + +CSIPHASH_OBJECTS = csiphash.obj + +csiphash.lib: $(CSIPHASH_OBJECTS) + lib $(CSIPHASH_OBJECTS) $(CURVE25519_DONNA_OBJECTS) /out:csiphash.lib + +clean: + del *.obj *.lib diff --git a/src/or/Makefile.nmake b/src/or/Makefile.nmake index 3b627b1d0..523bf3306 100644 --- a/src/or/Makefile.nmake +++ b/src/or/Makefile.nmake @@ -1,6 +1,6 @@ all: tor.exe -CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common \ +CFLAGS = /O2 /MT /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common \ /I ..\ext LIBS = ..\..\..\build-alpha\lib\libevent.lib \ @@ -15,6 +15,7 @@ LIBTOR_OBJECTS = \ buffers.obj \ channel.obj \ channeltls.obj \ + circpathbias.obj \ circuitbuild.obj \ circuitlist.obj \ circuitmux.obj \ @@ -35,6 +36,7 @@ LIBTOR_OBJECTS = \ dirvote.obj \ dns.obj \ dnsserv.obj \ + ext_orport.obj \ fp_pair.obj \ entrynodes.obj \ geoip.obj \ @@ -69,7 +71,7 @@ libtor.lib: $(LIBTOR_OBJECTS) lib $(LIBTOR_OBJECTS) /out:$@ tor.exe: libtor.lib tor_main.obj - $(CC) $(CFLAGS) $(LIBS) libtor.lib ..\common\*.lib tor_main.obj /Fe$@ + $(CC) $(CFLAGS) $(LIBS) libtor.lib ..\common\*.lib ..\ext\*.lib tor_main.obj /Fe$@ clean: - del $(LIBTOR_OBJECTS) *.lib tor.exe + del $(LIBTOR_OBJECTS) tor_main.obj *.lib tor.exe diff --git a/src/or/directory.c b/src/or/directory.c index 51ea31268..298271f36 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2497,7 +2497,7 @@ client_likes_consensus(networkstatus_t *v, const char *want_url) if (base16_decode(want_digest, DIGEST_LEN, d, want_len*2) < 0) { log_fn(LOG_PROTOCOL_WARN, LD_DIR, - "Failed to decode requested authority digest %s.", d); + "Failed to decode requested authority digest %s.", escaped(d)); continue; }; @@ -2557,7 +2557,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, * act as if no If-Modified-Since header had been given. */ tor_free(header); } - log_debug(LD_DIRSERV,"rewritten url as '%s'.", url); + log_debug(LD_DIRSERV,"rewritten url as '%s'.", escaped(url)); url_mem = url; url_len = strlen(url); @@ -3006,7 +3006,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, const char *query = url + strlen("/tor/rendezvous2/"); if (strlen(query) == REND_DESC_ID_V2_LEN_BASE32) { log_info(LD_REND, "Got a v2 rendezvous descriptor request for ID '%s'", - safe_str(query)); + safe_str(escaped(query))); switch (rend_cache_lookup_v2_desc_as_dir(query, &descp)) { case 1: /* valid */ write_http_response_header(conn, strlen(descp), 0, 0); @@ -3140,7 +3140,7 @@ directory_handle_command_post(dir_connection_t *conn, const char *headers, write_http_status_line(conn, 400, "Bad request"); return 0; } - log_debug(LD_DIRSERV,"rewritten url as '%s'.", url); + log_debug(LD_DIRSERV,"rewritten url as '%s'.", escaped(url)); /* Handle v2 rendezvous service publish request. */ if (options->HidServDirectoryV2 && @@ -3273,7 +3273,9 @@ directory_handle_command(dir_connection_t *conn) } http_set_address_origin(headers, TO_CONN(conn)); - //log_debug(LD_DIRSERV,"headers %s, body %s.", headers, body); + // we should escape headers here as well, + // but we can't call escaped() twice, as it uses the same buffer + //log_debug(LD_DIRSERV,"headers %s, body %s.", headers, escaped(body)); if (!strncasecmp(headers,"GET",3)) r = directory_handle_command_get(conn, headers, body, body_len); diff --git a/src/or/relay.c b/src/or/relay.c index f42602d41..4d71157db 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -523,6 +523,7 @@ relay_header_unpack(relay_header_t *dest, const uint8_t *src) static const char * relay_command_to_string(uint8_t command) { + static char buf[64]; switch (command) { case RELAY_COMMAND_BEGIN: return "BEGIN"; case RELAY_COMMAND_DATA: return "DATA"; @@ -547,7 +548,12 @@ relay_command_to_string(uint8_t command) case RELAY_COMMAND_RENDEZVOUS_ESTABLISHED: return "RENDEZVOUS_ESTABLISHED"; case RELAY_COMMAND_INTRODUCE_ACK: return "INTRODUCE_ACK"; - default: return "(unrecognized)"; + case RELAY_COMMAND_EXTEND2: return "EXTEND2"; + case RELAY_COMMAND_EXTENDED2: return "EXTENDED2"; + default: + tor_snprintf(buf, sizeof(buf), "Unrecognized relay command %u", + (unsigned)command); + return buf; } } diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h index 8c2472c32..9873955a3 100644 --- a/src/win32/orconfig.h +++ b/src/win32/orconfig.h @@ -257,3 +257,11 @@ #define USE_CURVE25519_DONNA #define ENUM_VALS_ARE_SIGNED 1 + +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1 +#endif + +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif