NTLM/SSL fixes by Taco IJsselmuiden <taco@varda.nl>

git-svn-id: https://proxytunnel.svn.sourceforge.net/svnroot/proxytunnel/trunk/proxytunnel@155 bc163920-b10d-0410-b2c5-a5491ca2ceef
This commit is contained in:
Mark Janssen 2007-04-12 11:31:17 +00:00
parent a194b6a06c
commit 9fd5bfe8d5
4 changed files with 14 additions and 3 deletions

10
http.c
View file

@ -116,7 +116,7 @@ void proxy_protocol(PTSTREAM *pts)
/*
* Create the proxy CONNECT command into buf
*/
if (args_info.remproxy_given )
if (args_info.remproxy_given && !connected_with_remote_proxy)
{
if( args_info.verbose_flag )
message( "Tunneling to %s (remote proxy)\n", args_info.remproxy_arg );
@ -183,13 +183,19 @@ void proxy_protocol(PTSTREAM *pts)
analyze_HTTP(pts);
if (args_info.remproxy_given )
if (args_info.remproxy_given && !connected_with_remote_proxy)
{
connected_with_remote_proxy = 1;
/*
* Clean buffer for next analysis
*/
while ( strcmp( buf, "\r\n" ) != 0 ) readline(pts);
#ifdef USE_SSL
if (args_info.encrypt_flag )
stream_enable_ssl(pts);
#endif
if( args_info.verbose_flag )
message( "Tunneling to %s (destination)\n", args_info.dest_arg );
sprintf( buf, "CONNECT %s HTTP/1.0\r\n", args_info.dest_arg );

View file

@ -289,6 +289,7 @@ void do_daemon()
#endif
/* Open the tunnel */
connected_with_remote_proxy = 0;
proxy_protocol(stunnel);
/* If --encrypt is specified, wrap all traffic after the proxy handoff in SSL */

View file

@ -43,6 +43,7 @@ int read_fd; /* The file descriptor to read from */
int write_fd; /* The file destriptor to write to */
char *program_name; /* Guess what? */
int i_am_daemon; /* Also... */
int connected_with_remote_proxy;
PTSTREAM *stunnel; /* The stream representing the socket from us to the proxy */
PTSTREAM *std; /* The stream representing stdin/stdout */

View file

@ -187,7 +187,10 @@ int stream_enable_ssl(PTSTREAM *pts)
SSL_METHOD *meth;
SSL *ssl;
SSL_CTX *ctx;
if ( pts->ssl != NULL ){
return 1;
}
/* Initialise the connection */
SSLeay_add_ssl_algorithms();
meth = SSLv23_client_method();