mirror of
https://github.com/proxytunnel/proxytunnel.git
synced 2026-01-23 02:34:59 +00:00
Changed basicauth interface.
git-svn-id: https://proxytunnel.svn.sourceforge.net/svnroot/proxytunnel/trunk/proxytunnel@206 bc163920-b10d-0410-b2c5-a5491ca2ceef
This commit is contained in:
parent
a63b545d46
commit
f515473938
4 changed files with 12 additions and 11 deletions
12
basicauth.c
12
basicauth.c
|
|
@ -31,24 +31,28 @@
|
|||
* Create the HTTP basic authentication cookie for use by the proxy. Result
|
||||
* is stored in basicauth.
|
||||
*/
|
||||
void make_basicauth() {
|
||||
int len = strlen( args_info.user_arg ) + strlen( args_info.pass_arg ) + 2;
|
||||
char *basicauth(char *user, char *pass) {
|
||||
char b64str[80]; /* Buffer to hold the proxies basic authentication data */
|
||||
|
||||
int len = strlen( user ) + strlen( pass ) + 2;
|
||||
char *p = (char *) malloc( len );
|
||||
|
||||
/* Set up the cookie in clear text */
|
||||
sprintf( p, "%s:%s", args_info.user_arg, args_info.pass_arg );
|
||||
sprintf( p, "%s:%s", user, pass );
|
||||
|
||||
/*
|
||||
* Base64 encode the clear text cookie to create the HTTP base64
|
||||
* authentication cookie
|
||||
*/
|
||||
base64( (unsigned char *)basicauth, (unsigned char *)p, strlen(p) );
|
||||
base64( (unsigned char *)b64str, (unsigned char *)p, strlen(p) );
|
||||
|
||||
// if( args_info.verbose_flag ) {
|
||||
// message( "Proxy basic auth of %s is %s\n", p, basicauth );
|
||||
// }
|
||||
|
||||
free( p );
|
||||
|
||||
return b64str;
|
||||
}
|
||||
|
||||
// vim:noexpandtab:ts=4
|
||||
|
|
|
|||
|
|
@ -18,9 +18,8 @@
|
|||
*/
|
||||
|
||||
/* basicauth.h */
|
||||
char basicauth[80]; /* Buffer to hold the proxies basic authentication data */
|
||||
|
||||
/* Functions */
|
||||
void make_basicauth();
|
||||
char *basicauth(char *user, char *pass);
|
||||
|
||||
// vim:noexpandtab:ts=4
|
||||
|
|
|
|||
6
http.c
6
http.c
|
|
@ -122,7 +122,7 @@ void proxy_protocol(PTSTREAM *pts) {
|
|||
strzcat( buf, "Proxy-Authorization: NTLM %s\r\n", ntlm_type1_buf );
|
||||
}
|
||||
} else {
|
||||
strzcat( buf, "Proxy-Authorization: Basic %s\r\n", basicauth );
|
||||
strzcat( buf, "Proxy-Authorization: Basic %s\r\n", basicauth(args_info.user_arg, args_info.pass_arg ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,8 +161,8 @@ void proxy_protocol(PTSTREAM *pts) {
|
|||
message( "\nTunneling to %s (destination)\n", args_info.dest_arg );
|
||||
sprintf( buf, "CONNECT %s HTTP/1.0\r\n", args_info.dest_arg);
|
||||
|
||||
if ( args_info.user_given && args_info.pass_given )
|
||||
strzcat( buf, "Proxy-Authorization: Basic %s\r\n", basicauth );
|
||||
if ( args_info.remuser_given && args_info.rempass_given )
|
||||
strzcat( buf, "Proxy-Authorization: Basic %s\r\n", basicauth(args_info.remuser_arg, args_info.rempass_arg ));
|
||||
|
||||
strzcat( buf, "Proxy-Connection: Keep-Alive\r\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -346,8 +346,6 @@ int main( int argc, char *argv[] ) {
|
|||
build_type1();
|
||||
if ( args_info.verbose_flag )
|
||||
message("Build Type 1 NTLM Message : %s\n", ntlm_type1_buf);
|
||||
} else {
|
||||
make_basicauth();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue