[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: patch: router.exit -> localhost.router.exit



Probably, MAX_SOCKS_ADDR_LEN could be replaced with 10.

Geoff

On Mon, May 09, 2005 at 02:56:12AM -0400, Geoffrey Goodell wrote:
> Please consider this patch, which provides the following functionality:
> 
> If a user specifies router.exit, then rather than rejecting the
> connection, try to connect to 127.0.0.1 on the specified exit node.
> 
> Geoff

> Only in or: .or.h.swp
> Only in or: CVS
> diff -u or/connection_edge.c or.patch/connection_edge.c
> --- or/connection_edge.c	2005-05-07 01:55:06.000000000 -0400
> +++ or.patch/connection_edge.c	2005-05-09 02:46:58.000000000 -0400
> @@ -914,14 +914,18 @@
>    if (addresstype == EXIT_HOSTNAME) {
>      /* .exit -- modify conn to specify the exit node. */
>      char *s = strrchr(socks->address,'.');
> -    if (!s || s[1] == '\0') {
> -      log_fn(LOG_WARN,"Malformed exit address '%s'. Refusing.",
> -             safe_str(socks->address));
> -      connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
> -      return -1;
> +    if (s) {
> +      if (s[1] == '\0') {
> +        log_fn(LOG_WARN,"Malformed exit address '%s'. Refusing.",
> +               safe_str(socks->address));
> +        connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
> +        return -1;
> +      }
> +      conn->chosen_exit_name = tor_strdup(s+1);
> +      *s = 0;
> +    } else {
> +      strncpy(socks->address, "127.0.0.1", MAX_SOCKS_ADDR_LEN);
>      }
> -    conn->chosen_exit_name = tor_strdup(s+1);
> -    *s = 0;
>    }
>  
>    if (addresstype != ONION_HOSTNAME) {



Attachment: signature.asc
Description: Digital signature