Forráskód Böngészése

r7304@Kushana: nickm | 2006-08-10 01:58:05 -0700
Fix verbose compilation errors; make sure transparent proxy fails when no method is configured.


svn:r7012

Nick Mathewson 19 éve
szülő
commit
7ddd9e8cd9
3 módosított fájl, 13 hozzáadás és 7 törlés
  1. 1 1
      src/or/config.c
  2. 9 3
      src/or/connection_edge.c
  3. 3 3
      src/or/dns.c

+ 1 - 1
src/or/config.c

@@ -2072,6 +2072,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
   for (i = 0; i < 2; ++i) {
     int is_socks = i==0;
     config_line_t *line, *opt, *old;
+    const char *tp = is_socks ? "SOCKS proxy" : "transparent proxy";
     if (is_socks) {
       opt = options->SocksListenAddress;
       old = old_options->SocksListenAddress;
@@ -2079,7 +2080,6 @@ options_validate(or_options_t *old_options, or_options_t *options,
       opt = options->TransListenAddress;
       old = old_options->TransListenAddress;
     }
-    const char *tp = is_socks ? "SOCKS proxy" : "transparent proxy";
 
     for (line = opt; line; line = line->next) {
       char *address = NULL;

+ 9 - 3
src/or/connection_edge.c

@@ -1290,9 +1290,9 @@ connection_ap_get_original_destination(edge_connection_t *conn,
   tor_inet_ntoa(&orig_dst.sin_addr, tmpbuf, sizeof(tmpbuf));
   strlcpy(req->address, tmpbuf, sizeof(req->address));
   req->port = ntohs(orig_dst.sin_port);
-#endif
 
-#ifdef TRANS_PF
+  return 0;
+#elif defined(TRANS_PF)
   struct sockaddr_in proxy_addr;
   socklen_t proxy_addr_len = sizeof(proxy_addr);
   char tmpbuf[INET_NTOA_BUF_LEN];
@@ -1327,9 +1327,15 @@ connection_ap_get_original_destination(edge_connection_t *conn,
   tor_inet_ntoa(&pnl.rdaddr.v4, tmpbuf, sizeof(tmpbuf));
   strlcpy(req->address, tmpbuf, sizeof(req->address));
   req->port = ntohs(pnl.rdport);
-#endif
 
   return 0;
+#else
+  (void)conn;
+  (void)req;
+  log_warn(LD_BUG, "Called connection_ap_get_original_destination, but no "
+           "transparent proxy method was configured.");
+  return -1;
+#endif
 }
 
 /** connection_edge_process_inbuf() found a conn in state

+ 3 - 3
src/or/dns.c

@@ -95,7 +95,7 @@ typedef struct cached_resolve_t {
   pending_connection_t *pending_connections;
 } cached_resolve_t;
 
-static void purge_expired_resolves(uint32_t now);
+static void purge_expired_resolves(time_t now);
 static void dns_found_answer(const char *address, uint32_t addr, char outcome,
                              uint32_t ttl);
 static void send_resolved_cell(edge_connection_t *conn, uint8_t answer_type);
@@ -253,7 +253,7 @@ dns_free_all(void)
 /** Remove every cached_resolve whose <b>expire</b> time is before <b>now</b>
  * from the cache. */
 static void
-purge_expired_resolves(uint32_t now)
+purge_expired_resolves(time_t now)
 {
   cached_resolve_t *resolve, *removed;
   pending_connection_t *pend;
@@ -386,7 +386,7 @@ dns_resolve(edge_connection_t *exitconn)
   pending_connection_t *pending_connection;
   struct in_addr in;
   circuit_t *circ;
-  uint32_t now = time(NULL);
+  time_t now = time(NULL);
   assert_connection_ok(TO_CONN(exitconn), 0);
   tor_assert(exitconn->_base.s == -1);