From 3ea8a4d220067e27ab3b988f35b3ac7b9c27efd4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 23 Sep 2006 19:07:20 +0000 Subject: Dmitriy Sergeyev provided a patch that made the SOCKS[45] code work better as it now will read the full data sent from servers. The SOCKS-related code was also moved to the new lib/socks.c source file. --- lib/socks.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/socks.h (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h new file mode 100644 index 000000000..b0a40a69d --- /dev/null +++ b/lib/socks.h @@ -0,0 +1,19 @@ +#ifndef __SOCKS_H +#define __SOCKS_H + +/* + * This function logs in to a SOCKS4 proxy and sends the specifics to the + * final destination server. + */ +CURLcode Curl_SOCKS4(const char *proxy_name, + struct connectdata *conn); + +/* + * This function logs in to a SOCKS5 proxy and sends the specifics to the + * final destination server. + */ +CURLcode Curl_SOCKS5(const char *proxy_name, + const char *proxy_password, + struct connectdata *conn); + +#endif -- cgit v1.2.1 From 9cd928674f6a66b98a6d1581fa0aed5cf69c870b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 23 Sep 2006 19:09:39 +0000 Subject: standard curl source code headers --- lib/socks.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h index b0a40a69d..0da987998 100644 --- a/lib/socks.h +++ b/lib/socks.h @@ -1,5 +1,27 @@ #ifndef __SOCKS_H #define __SOCKS_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ /* * This function logs in to a SOCKS4 proxy and sends the specifics to the -- cgit v1.2.1 From 17e8d60c01f8f020e3738db855584f23fb892a04 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 19 Feb 2007 11:53:54 +0000 Subject: - Robson Braga Araujo made passive FTP transfers work with SOCKS (both 4 and 5). --- lib/socks.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h index 0da987998..471b26224 100644 --- a/lib/socks.h +++ b/lib/socks.h @@ -28,6 +28,9 @@ * final destination server. */ CURLcode Curl_SOCKS4(const char *proxy_name, + char *hostname, + int remote_port, + int sockindex, struct connectdata *conn); /* @@ -36,6 +39,9 @@ CURLcode Curl_SOCKS4(const char *proxy_name, */ CURLcode Curl_SOCKS5(const char *proxy_name, const char *proxy_password, + char *hostname, + int remote_port, + int sockindex, struct connectdata *conn); #endif -- cgit v1.2.1 From 584f3639e36f991c0962b9b88165decdc1c8d2c9 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 3 Apr 2007 18:25:18 +0000 Subject: update copyright year --- lib/socks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h index 471b26224..dfe5cb4f1 100644 --- a/lib/socks.h +++ b/lib/socks.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms -- cgit v1.2.1 From 8cf0814a143d99de813fbd1653b785252b4c58a6 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Mon, 27 Aug 2007 06:31:28 +0000 Subject: Fixed some minor type mismatches and missing consts mainly found by splint. --- lib/socks.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h index dfe5cb4f1..8da142fbd 100644 --- a/lib/socks.h +++ b/lib/socks.h @@ -28,7 +28,7 @@ * final destination server. */ CURLcode Curl_SOCKS4(const char *proxy_name, - char *hostname, + const char *hostname, int remote_port, int sockindex, struct connectdata *conn); @@ -39,7 +39,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name, */ CURLcode Curl_SOCKS5(const char *proxy_name, const char *proxy_password, - char *hostname, + const char *hostname, int remote_port, int sockindex, struct connectdata *conn); -- cgit v1.2.1 From a46b40b7fdf567250451b984b977f5e03c716d5e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 2 Jan 2008 21:40:11 +0000 Subject: Richard Atterer brought a patch that added support for SOCKS4a proxies, which is an inofficial PROXY4 variant that sends the hostname to the proxy instead of the resolved address (which is already supported by SOCKS5). --socks4a is the curl command line option for it and CURLOPT_PROXYTYPE can now be set to CURLPROXY_SOCKS4A as well. --- lib/socks.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h index 8da142fbd..756ecc3db 100644 --- a/lib/socks.h +++ b/lib/socks.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2007, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -24,14 +24,15 @@ ***************************************************************************/ /* - * This function logs in to a SOCKS4 proxy and sends the specifics to the + * This function logs in to a SOCKS4(a) proxy and sends the specifics to the * final destination server. */ CURLcode Curl_SOCKS4(const char *proxy_name, const char *hostname, int remote_port, int sockindex, - struct connectdata *conn); + struct connectdata *conn, + bool protocol4a); /* * This function logs in to a SOCKS5 proxy and sends the specifics to the -- cgit v1.2.1 From de4610a55f9e99bebaf448ca33e2e43baf977c74 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 28 Jan 2009 21:33:58 +0000 Subject: - Markus Moeller introduced two new options to libcurl: CURLOPT_SOCKS5_GSSAPI_SERVICE and CURLOPT_SOCKS5_GSSAPI_NEC to allow libcurl to do GSS-style authentication with SOCKS5 proxies. The curl tool got the options called --socks5-gssapi-service and --socks5-gssapi-nec to enable these. --- lib/socks.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h index 756ecc3db..9f4c6f09a 100644 --- a/lib/socks.h +++ b/lib/socks.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -23,6 +23,20 @@ * $Id$ ***************************************************************************/ +/* + * Helper read-from-socket functions. Does the same as Curl_read() but it + * blocks until all bytes amount of buffersize will be read. No more, no less. + * + * This is STUPID BLOCKING behaviour which we frown upon, but right now this + * is what we have... + */ +int Curl_blockread_all(struct connectdata *conn, + curl_socket_t sockfd, + char *buf, + ssize_t buffersize, + ssize_t *n, + long conn_timeout); + /* * This function logs in to a SOCKS4(a) proxy and sends the specifics to the * final destination server. @@ -45,4 +59,12 @@ CURLcode Curl_SOCKS5(const char *proxy_name, int sockindex, struct connectdata *conn); +#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) +/* + * This function handles the sockss5 gssapie negotiation and initialisation + */ +CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, + struct connectdata *conn); #endif + +#endif /* __SOCKS_H */ -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/socks.h | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h index 9f4c6f09a..2bea66bf6 100644 --- a/lib/socks.h +++ b/lib/socks.h @@ -20,7 +20,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ /* -- cgit v1.2.1 From 8321a367ee1da094147384a6619334221f5d014c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 5 Apr 2011 13:55:11 +0200 Subject: FTP+proxy: macrofied functions when proxy disabled In my attempts to reduce #ifdefs in code, the SOCKS functions are now macros when libcurl is built without proxy support and therefore the FTP code could avoid some #ifs. --- lib/socks.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h index 2bea66bf6..1c686d181 100644 --- a/lib/socks.h +++ b/lib/socks.h @@ -1,5 +1,5 @@ -#ifndef __SOCKS_H -#define __SOCKS_H +#ifndef __CURL_SOCKS_H +#define __CURL_SOCKS_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -22,6 +22,12 @@ * ***************************************************************************/ +#include "setup.h" + +#ifdef CURL_DISABLE_PROXY +#define Curl_SOCKS4(a,b,c,d,e,f) CURLE_FAILED_INIT +#define Curl_SOCKS5(a,b,c,d,e,f) CURLE_FAILED_INIT +#else /* * Helper read-from-socket functions. Does the same as Curl_read() but it * blocks until all bytes amount of buffersize will be read. No more, no less. @@ -66,4 +72,6 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, struct connectdata *conn); #endif -#endif /* __SOCKS_H */ +#endif /* CURL_DISABLE_PROXY */ + +#endif /* __CURL_SOCKS_H */ -- cgit v1.2.1 From 01f05d0c758795e5bb02c6245fc73b8458eb397a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 5 Apr 2011 15:14:02 +0200 Subject: return code cleanup: build, init and run-time errors Stop the abuse of CURLE_FAILED_INIT as return code for things not being init related by introducing two new return codes: CURLE_NOT_BUILT_IN and CURLE_UNKNOWN_OPTION CURLE_NOT_BUILT_IN replaces return code 4 that has been obsoleted for several years. It is used for returning error when something is attempted to be used but the feature/option was not enabled or explictitly disabled at build-time. Getting this error mostly means that libcurl needs to be rebuilt. CURLE_FAILED_INIT is now saved and used strictly for init failures. Getting this problem means something went seriously wrong, like a resource shortage or similar. CURLE_UNKNOWN_OPTION is the option formerly known as CURLE_UNKNOWN_TELNET_OPTION (and the old name is still present, separately defined to be removed in a very distant future). This error code is meant to be used to return when an option is given to libcurl that isn't known. This problem would mostly indicate a problem in the program that uses libcurl. --- lib/socks.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h index 1c686d181..42b8080b0 100644 --- a/lib/socks.h +++ b/lib/socks.h @@ -25,8 +25,8 @@ #include "setup.h" #ifdef CURL_DISABLE_PROXY -#define Curl_SOCKS4(a,b,c,d,e,f) CURLE_FAILED_INIT -#define Curl_SOCKS5(a,b,c,d,e,f) CURLE_FAILED_INIT +#define Curl_SOCKS4(a,b,c,d,e,f) CURLE_NOT_BUILT_IN +#define Curl_SOCKS5(a,b,c,d,e,f) CURLE_NOT_BUILT_IN #else /* * Helper read-from-socket functions. Does the same as Curl_read() but it -- cgit v1.2.1 From 3dcc0df5ccac15275f612f5c275ea320f5f41cd4 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 8 Aug 2011 11:10:17 +0200 Subject: SOCKS: fix the connect timeout The connect timeout logic when using SOCKS was done wrong Bug: http://curl.haxx.se/mail/lib-2011-07/0177.html Reported by: "Spoon Man" --- lib/socks.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/socks.h') diff --git a/lib/socks.h b/lib/socks.h index 42b8080b0..fc4cc7f02 100644 --- a/lib/socks.h +++ b/lib/socks.h @@ -39,8 +39,7 @@ int Curl_blockread_all(struct connectdata *conn, curl_socket_t sockfd, char *buf, ssize_t buffersize, - ssize_t *n, - long conn_timeout); + ssize_t *n); /* * This function logs in to a SOCKS4(a) proxy and sends the specifics to the -- cgit v1.2.1