Brandon Craig Rhodes <[EMAIL PROTECTED]> writes:

> This edition of my unprivileged server patch is the first one which
> might actually work, marking a sort of milestone in our progress with
> it here.  It should be applied to the stock 1.11.2 distribution.

Note that my unprivileged server patch (attached to the message quoted
above) makes changes only to the server.  Any client able to do normal
:gserver: authentication can use the patched server.

I forgot to mention, however, that CVS 1.11.2 has a bug which prevents
its client code from ever making a :gserver: connection successfully.
So the thronging masses who have eagerly installed Kerberos to try the
above patch have doubtless been frustrated at not being able to
connect.

The following patch applies to your cvs-1.11.2 tree the changes
already in the development version of cvs to get :gserver: working:

diff -ur cvs-orig/src/buffer.c ccvs/src/buffer.c
--- cvs-orig/src/buffer.c	2001-08-09 15:26:35.000000000 -0400
+++ ccvs/src/buffer.c	2002-05-20 14:27:55.000000000 -0400
@@ -1247,6 +1247,20 @@
 			   (void *) bc);
 }
 
+/* Return the file associated with a stdio buffer. */
+FILE *
+stdio_buffer_get_file (buf)
+    struct buffer *buf;
+{
+    struct stdio_buffer_closure *bc;
+
+    assert(buf->shutdown == stdio_buffer_shutdown);
+
+    bc = (struct stdio_buffer_closure *) buf->closure;
+
+    return(bc->fp);
+}
+
 /* The buffer input function for a buffer built on a stdio FILE.  */
 
 static int
diff -ur cvs-orig/src/buffer.h ccvs/src/buffer.h
--- cvs-orig/src/buffer.h	2001-05-03 17:04:37.000000000 -0400
+++ ccvs/src/buffer.h	2002-05-20 14:27:55.000000000 -0400
@@ -112,6 +112,7 @@
 extern struct buffer *buf_nonio_initialize PROTO((void (*) (struct buffer *)));
 extern struct buffer *stdio_buffer_initialize
   PROTO((FILE *, int, int, void (*) (struct buffer *)));
+extern FILE *stdio_buffer_get_file PROTO((struct buffer *));
 extern struct buffer *compress_buffer_initialize
   PROTO((struct buffer *, int, int, void (*) (struct buffer *)));
 extern struct buffer *packetizing_buffer_initialize
diff -ur cvs-orig/src/client.c ccvs/src/client.c
--- cvs-orig/src/client.c	2001-08-09 16:27:26.000000000 -0400
+++ ccvs/src/client.c	2002-06-27 16:53:10.124296000 -0400
@@ -3957,10 +3957,11 @@
     if (do_gssapi)
     {
 #ifdef HAVE_GSSAPI
-	int fd = (int) lto_server->closure;
+	FILE *fp = stdio_buffer_get_file(lto_server);
+	int fd = fp ? fileno(fp) : -1;
 	struct stat s;
 
-	if (fstat (fd, &s) < 0 || !S_ISSOCK(s.st_mode))
+	if ((fd < 0) || (fstat (fd, &s) < 0) || !S_ISSOCK(s.st_mode))
 	{
 	    error (1, 0, "gserver currently only enabled for socket connections");
 	}

-- 
Brandon Craig Rhodes                         http://www.rhodesmill.org/brandon
Georgia Tech                                            [EMAIL PROTECTED]

Reply via email to