--- src/client.c.org Tue Nov 30 13:49:23 2004
+++ src/client.c Wed Dec 1 12:42:01 2004
static size_t try_read_from_server PROTO ((char *, size_t));
+static void proxy_connect PROTO ((cvsroot_t *, int));
static void auth_server PROTO ((cvsroot_t *, struct buffer *, struct buffer *,
int, int, struct hostent *));
struct sockaddr_in client_sai;
struct hostent *hostinfo;
- struct buffer *to_server, *from_server;
+ struct buffer *local_to_server, *local_from_server;
sock = socket (AF_INET, SOCK_STREAM, 0);
error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO));
port_number = get_cvs_port_number (root);
+ /* if we have a proxy connect to that instead */
+ hostinfo = init_sockaddr (&client_sai, root->proxy, root->proxy_port);
hostinfo = init_sockaddr (&client_sai, root->hostname, port_number);
fprintf (stderr, " -> Connecting to %s(%s):%d\n",
if (connect (sock, (struct sockaddr *) &client_sai, sizeof (client_sai))
error (1, 0, "connect to %s(%s):%d failed: %s",
+ root->proxy ? root->proxy : root->hostname,
inet_ntoa (client_sai.sin_addr),
- port_number, SOCK_STRERROR (SOCK_ERRNO));
+ root->proxy ? root->proxy_port : port_number,
+ SOCK_STRERROR (SOCK_ERRNO));
- make_bufs_from_fds (sock, sock, 0, &to_server, &from_server, 1);
+ make_bufs_from_fds (sock, sock, 0, &local_to_server, &local_from_server, 1);
- auth_server (root, to_server, from_server, verify_only, do_gssapi, hostinfo);
+ // REALLY ugly hack to allow proxy_connect() to use send_to_server().
+ // The proper fix would be to remove the global to_server & from_server
+ // variables, and instead let send_to_server() etc. take the target
+ // server struct as a paramter.
+ to_server = local_to_server;
+ from_server = local_from_server;
+ proxy_connect (root, port_number);