diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-10-12 17:46:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-10-12 17:46:39 +0000 |
commit | e2a088c3e08c110efd0ecdff2bc504e090f60754 (patch) | |
tree | b6e7653174e87ee6de0f7923493f6972bc3614c8 /src/util | |
parent | ea5f62f5b0a2e70d5ae6d71245c21b773463ef4f (diff) | |
download | gnunet-e2a088c3e08c110efd0ecdff2bc504e090f60754.tar.gz gnunet-e2a088c3e08c110efd0ecdff2bc504e090f60754.zip |
minor indentation issues
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/socks.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/util/socks.c b/src/util/socks.c index 30a430fbe..fee79cc80 100644 --- a/src/util/socks.c +++ b/src/util/socks.c | |||
@@ -83,16 +83,20 @@ const char * SOCKS5_REP_names(int rep) | |||
83 | * @param s string to encode | 83 | * @param s string to encode |
84 | * @return pointer to the end of the encoded string in the buffer | 84 | * @return pointer to the end of the encoded string in the buffer |
85 | */ | 85 | */ |
86 | unsigned char * SOCK5_proto_string(unsigned char * b, const char * s) | 86 | unsigned char * |
87 | SOCK5_proto_string(unsigned char * b, | ||
88 | const char * s) | ||
87 | { | 89 | { |
88 | size_t l = strlen(s); | 90 | size_t l = strlen(s); |
89 | if (l>255) { | 91 | |
92 | if (l > 255) | ||
93 | { | ||
90 | LOG (GNUNET_ERROR_TYPE_WARNING, | 94 | LOG (GNUNET_ERROR_TYPE_WARNING, |
91 | "SOCKS5 cannot handle hostnames, usernames, or passwords over 255 bytes, truncating.\n"); | 95 | "SOCKS5 cannot handle hostnames, usernames, or passwords over 255 bytes, truncating.\n"); |
92 | l=255; | 96 | l=255; |
93 | } | 97 | } |
94 | *(b++) = (unsigned char)l; | 98 | *(b++) = (unsigned char) l; |
95 | strncpy((char *)b,s,l); | 99 | strncpy ((char *)b, s, l); |
96 | return b+l; | 100 | return b+l; |
97 | } | 101 | } |
98 | 102 | ||
@@ -575,13 +579,13 @@ GNUNET_SOCKS_do_connect (const char *service_name, | |||
575 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "SOCKSPORT", &port0)) | 579 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "SOCKSPORT", &port0)) |
576 | port0 = 9050; | 580 | port0 = 9050; |
577 | /* A typical Tor client should usually try port 9150 for the TBB too, but | 581 | /* A typical Tor client should usually try port 9150 for the TBB too, but |
578 | * GUNNet can probably assume a system Tor installation. */ | 582 | * GNUnet can probably assume a system Tor installation. */ |
579 | if (port0 > 65535 || port0 <= 0) | 583 | if (port0 > 65535 || port0 <= 0) |
580 | { | 584 | { |
581 | LOG (GNUNET_ERROR_TYPE_WARNING, | 585 | LOG (GNUNET_ERROR_TYPE_WARNING, |
582 | _ | 586 | _("Attempting to use invalid port %d as SOCKS proxy for service `%s'.\n"), |
583 | ("Attempting to use invalid port %d as SOCKS proxy for service `%s'.\n"), | 587 | port0, |
584 | port0,service_name); | 588 | service_name); |
585 | return NULL; | 589 | return NULL; |
586 | } | 590 | } |
587 | if ((GNUNET_OK != | 591 | if ((GNUNET_OK != |
@@ -596,17 +600,17 @@ GNUNET_SOCKS_do_connect (const char *service_name, | |||
596 | service_name,port1,host1); | 600 | service_name,port1,host1); |
597 | return NULL; | 601 | return NULL; |
598 | } | 602 | } |
599 | /* Appeared to still work after host0 corrupted, so either test case is broken, or | 603 | /* Appeared to still work after host0 corrupted, so either test case is broken, or |
600 | this whole routine is not being called. */ | 604 | this whole routine is not being called. */ |
601 | if (GNUNET_OK != | 605 | if (GNUNET_OK != |
602 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST", &host0)) | 606 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSHOST", &host0)) |
603 | host0 = NULL; | 607 | host0 = NULL; |
604 | socks5 = GNUNET_CONNECTION_create_from_connect (cfg, (host0 != NULL)? host0:"127.0.0.1", port0); | 608 | socks5 = GNUNET_CONNECTION_create_from_connect (cfg, (host0 != NULL)? host0:"127.0.0.1", port0); |
605 | GNUNET_free_non_null (host0); | 609 | GNUNET_free_non_null (host0); |
606 | 610 | ||
607 | /* Sets to NULL if they do not exist */ | 611 | /* Sets to NULL if they do not exist */ |
608 | (void)GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSUSER", &user); | 612 | (void) GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSUSER", &user); |
609 | (void)GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSPASS", &pass); | 613 | (void) GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "SOCKSPASS", &pass); |
610 | ih = GNUNET_SOCKS_init_handshake(user,pass); | 614 | ih = GNUNET_SOCKS_init_handshake(user,pass); |
611 | if (NULL != user) GNUNET_free (user); | 615 | if (NULL != user) GNUNET_free (user); |
612 | if (NULL != pass) GNUNET_free (pass); | 616 | if (NULL != pass) GNUNET_free (pass); |