diffs for socket-1.1 for SSL tunnel

From: Andrew Gillham <gillhaa@dont-contact.us>
Date: Sat, 7 Mar 1998 13:57:22 -0500 (EST)

Well, I finally realized I had never sent these diffs.
These are against socket-1.1, and include the patches from the
NetBSD 'pkgsrc' kit, so aren't just my changes. I can rework
them slightly if they aren't clear to people.

What this patch allows, is for you to create a ssh connection
via a proxy server that supports SSL. The appropriate entry
for ~/.ssh/config is:

        Host x.x.x.x
                ProxyCommand socket -t %h proxy.hostname 8080

Since proxy servers often only allow SSL connections to the official
ports, my patch attempts to connect to port 443. You obviously
will need to do 'sshd -p 443' on the remote end. It would be simple
to add support for passing the port on the commandline. I haven't
needed it, so never bothered.

Anyway, here is the patch:

Index: Makefile
===================================================================
RCS file: /u1/cvs/gillhaa/socket/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
3c3
< # $Header: /u1/cvs/gillhaa/socket/Makefile,v 1.1.1.1 1998/03/07 17:59:02 gillhaa Exp $

---
> # $Header: /u1/cvs/gillhaa/socket/Makefile,v 1.2 1998/03/07 18:07:06 gillhaa Exp $
11c11
< INSTALLBASE = /usr/local
---
> INSTALLBASE = ${PREFIX}
46c46,47
< 
---
> # FreeBSD 2.x (4.4BSD)
> SWITCHES=-DHAVE_SYS_PARAM_H -Wall
Index: README
===================================================================
RCS file: /u1/cvs/gillhaa/socket/README,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
169c169
<     <nickel@cs.tu-berlin.de>
---
> Juergen Nickelsen <jn@berlin.snafu.de>
Index: globals.h
===================================================================
RCS file: /u1/cvs/gillhaa/socket/globals.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
3c3
< $Header: /u1/cvs/gillhaa/socket/globals.h,v 1.1.1.1 1998/03/07 17:59:02 gillhaa Exp $
---
> $Header: /u1/cvs/gillhaa/socket/globals.h,v 1.2 1998/03/07 18:07:07 gillhaa Exp $
10a11,15
>  
> #if HAVE_SYS_PARAM_H
> # include <sys/param.h>
> #endif
> 
52c57,60
< extern char *sys_errlist[], *sys_siglist[] ;
---
> 
> #if !(defined(BSD) && (BSD >=199306))
>      extern char *sys_errlist[], *sys_siglist[] ;
> #endif
Index: io.c
===================================================================
RCS file: /u1/cvs/gillhaa/socket/io.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
3c3
< $Header: /u1/cvs/gillhaa/socket/io.c,v 1.1.1.1 1998/03/07 17:59:02 gillhaa Exp $
---
> $Header: /u1/cvs/gillhaa/socket/io.c,v 1.2 1998/03/07 18:07:07 gillhaa Exp $
18a19,20
> #include <string.h>
> #include <unistd.h>
93c95
< do_io()
---
> void do_io()
Index: siglist.c
===================================================================
RCS file: /u1/cvs/gillhaa/socket/siglist.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
35c35,37
< char *sys_siglist[NSIG];
---
> #if HAVE_SYS_PARAM_H
> # include <sys/param.h>
> #endif
36a39,41
> #if !(defined(BSD) && (BSD >=199306))
> char *sys_siglist[NSIG];
> #endif
39c44
< initialize_siglist ()
---
> void initialize_siglist ()
40a46
> #if !(defined(BSD) && (BSD >=199306))
221a228
> #endif /* !(defined(BSD) && (BSD >=199306)) */
Index: socket.1
===================================================================
RCS file: /u1/cvs/gillhaa/socket/socket.1,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
3c3
< $Header: /u1/cvs/gillhaa/socket/socket.1,v 1.1.1.1 1998/03/07 17:59:03 gillhaa Exp $
---
> $Header: /u1/cvs/gillhaa/socket/socket.1,v 1.2 1998/03/07 18:07:08 gillhaa Exp $
161c161
< Juergen Nickelsen <nickel@cs.tu-berlin.de>
---
> Juergen Nickelsen <jn@berlin.snafu.de>
Index: socket.c
===================================================================
RCS file: /u1/cvs/gillhaa/socket/socket.c,v
retrieving revision 1.1.1.1
retrieving revision 1.5
diff -r1.1.1.1 -r1.5
3c3
< $Header: /u1/cvs/gillhaa/socket/socket.c,v 1.1.1.1 1998/03/07 17:59:03 gillhaa Exp $
---
> $Header: /u1/cvs/gillhaa/socket/socket.c,v 1.5 1998/03/07 18:17:58 gillhaa Exp $
20a21,22
> #include <stdlib.h>
> #include <unistd.h>
35a38
> char *remote_host = NULL ;	/* remote host to connect via SSL proxy */
39a43,44
> extern void init_signals A((void)) ;
> extern void do_io A((void)) ;
49c54
<     char *host ;		/* name of remote host */
---
>     /* char *host ; */		/* name of remote host */
61c66
<     if (cp = strrchr(progname, '/')) progname = cp + 1 ;
---
>     if ((cp = strrchr(progname, '/'))) progname = cp + 1 ;
64c69
<     while ((opt = getopt(argc, argv, "bcflp:qrsvw?")) != -1) {
---
>     while ((opt = getopt(argc, argv, "bcflpt:qrsvw?")) != -1) {
86a92,94
> 	  case 't':
> 	    remote_host = argv[optind - 1] ;
> 	    break ;
188c196
< 		he = gethostbyaddr(&sa.sin_addr.s_addr,
---
> 		he = gethostbyaddr((char *)&sa.sin_addr.s_addr,
193,196c201,204
< 			    (norder >> 24) & 0xff,
< 			    (norder >> 16) & 0xff,
< 			    (norder >>  8) & 0xff,
< 			    norder & 0xff) ;
---
> 			    (int)((norder >> 24) & 0xff),
> 			    (int)((norder >> 16) & 0xff),
> 			    (int)((norder >>  8) & 0xff),
> 			    (int)(norder & 0xff)) ;
262a271,278
>     }
> 
>     /* issue SSL connect if requested */
>     if (remote_host != NULL ) {
> 	char mystring[128];
> 	sprintf(mystring, "CONNECT %s:443 HTTP/1.0\n\n", remote_host);
> 	write(active_socket, &mystring, strlen(mystring));
> 	read(active_socket, &mystring, 127);
Index: socketp.c
===================================================================
RCS file: /u1/cvs/gillhaa/socket/socketp.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
3c3
< $Header: /u1/cvs/gillhaa/socket/socketp.c,v 1.1.1.1 1998/03/07 17:59:03 gillhaa Exp $
---
> $Header: /u1/cvs/gillhaa/socket/socketp.c,v 1.2 1998/03/07 18:07:09 gillhaa Exp $
13a14
> #include <arpa/inet.h>
15a17,19
> #include <stdlib.h>
> #include <string.h>
> #include <unistd.h>
17a22,23
> extern int is_number A((char *));
> 
55c61
<     int a, s ;
---
>     int s ;
79c85
<     if (connect(s, &sa, sizeof(sa)) < 0) {                  /* connect */
---
>     if (connect(s, (struct sockaddr *)&sa, sizeof(sa)) < 0) { /* connect */
Index: utils.c
===================================================================
RCS file: /u1/cvs/gillhaa/socket/utils.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -r1.1.1.1 -r1.3
3c3
< $Header: /u1/cvs/gillhaa/socket/utils.c,v 1.1.1.1 1998/03/07 17:59:03 gillhaa Exp $
---
> $Header: /u1/cvs/gillhaa/socket/utils.c,v 1.3 1998/03/07 18:09:35 gillhaa Exp $
27a28
> #include <unistd.h>
29a31
> extern void initialize_siglist A((void)) ;
45c47
< 	"Usage: %s [-bclqrvw] [-p prog] [-s | host] port\n" ;
---
> 	"Usage: %s [-bclqrvw] [-p prog] [-t remote host ] [-s | host] port\n" ;
73c75
< init_signals()
---
> void init_signals()
-- 
-----------------------------------------------------------------
Andrew Gillham                            | This space left blank
gillham@whirlpool.com                     | inadvertently.
I speak for myself, not for my employer.  | Contact the publisher.
Received on Sat Mar 07 1998 - 11:06:27 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:39:11 MST