Eric Sommerlade wrote:

> I was searching for this CVSPORT variable desperately, yet
> unsuccessful.
> Does it exist (in cvs >=1.10.8), or is there another way to
> specify the client side port number to connect to?

My apologies.  Someone else posted something similar, I remembered
reading about CVS_CLIENT_PORT working with Kerberos, and thought I knew
what I was talking about.

Anyway, there IS another way to change the client port.  3 of them in
fact.  From what you were describing, each of your users would want a
separate client or separate machines for solutions 1 & 2, so I'd
probably go with solution 3.  I'll tell you about all of them so you can
decide for youself:

1) Change the port assigned to cvspserver on your client machine in your
/etc/services file.  This works fine if you have root access and
something like NIS or you only want to change one machine and that
machine isn't running a server.  Unfortunately, it's not dynamic and
might cause problems if you have more than one user on a machine.
2) Change the CVS_AUTH_PORT in src/client.h and recompile your client.
This has the same dynamic problems.
3) Apply the patch I included at the end of this file and recompile your
cvs.  Then use this script:

    #!/bin/sh
    lport=$$
    if test $$ -gt 9999; then
        lport=`expr $lport - 10000`
    fi
    ssh -fo -L3$lport:localhost:2401 magus
    sleep 1
    CVS_CLIENT_PORT=3$lport ~/work/rcvs/lccvs/src/cvs
-d:pserver:$USER@localhost:/cvsroot "$@"

I tested this this time (in fact I used it to create the patch below.
:), so I know it works.  To avoid the (probably rare) port-clash
failures this script might suffer, you could probably use netstat and
awk and grep to make sure your port is unused or something.  You'd
probably still have a race condition, but it should be very rare and
failures would only require you to rerun the command.  And I think the
only CVS option this wrapper script won't be happy about is -d.  Of
course you could try and parse that like I mentioned parsing CVSROOT,
but it might get messy.

Of course, if that Perl script you mentioned has any fancy tricks you
want, you might be able to apply the patch to your client, switch the
port the Perl script uses with my port generation technique and get the
rest of the functionality.

Again, sorry I mislead you the first time.

Derek

--
Derek Price                      CVS Solutions Architect ( http://CVSHome.org )
mailto:[EMAIL PROTECTED]     OpenAvenue ( http://OpenAvenue.com )
--
Where are we going?  And what's with this handbasket?

---------- Begin Included File ----------
Index: src/client.c
===================================================================
RCS file: /cvsroot/lccvs/src/client.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 client.c
--- src/client.c 2000/06/16 20:22:54 1.1.1.1
+++ src/client.c 2000/07/27 17:05:56
@@ -3657,9 +3657,12 @@
 static int
 auth_server_port_number ()
 {
-    struct servent *s = getservbyname ("cvspserver", "tcp");
+    struct servent *s;
+    char *port_s;

-    if (s)
+    if(port_s = getenv ("CVS_CLIENT_PORT"))
+ return (atoi(port_s));
+    else if (s = getservbyname ("cvspserver", "tcp"))
  return ntohs (s->s_port);
     else
  return CVS_AUTH_PORT;
---------- End Included File ----------


Reply via email to