bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Freeing non-heap pointer in normalize_cvsroot


From: Jon Miner
Subject: Re: Freeing non-heap pointer in normalize_cvsroot
Date: Wed, 18 Oct 2000 15:19:12 -0500
User-agent: Mutt/1.2i

* Derek R. Price (derek.price@openavenue.com) [001018 15:05]:
> Actually, you shouldn't need the port in the login unless you don't want to
> use the default.  That was the point of the change.  Assuming you were
> logged into a machine as dprice, the following are now equivalent
> repository names:
> 
>     :pserver:cvs.cvshome.org/home2/cvsroot
>     :pserver:dprice@cvs.cvshome.org/home2/cvsroot
>     :pserver::password@cvs.cvshome.org/home2/cvsroot
>     :pserver:dprice@cvs.cvshome.org:/home2/cvsroot
>     :pserver:dprice@cvs.cvshome.org:2401/home2/cvsroot
> 
> But, they would all use the following entry in .cvspass:
> 
>     :pserver:dprice@cvs.cvshome.org:2401/home2/cvsroot

BUT, if you have the entry already existing in your .cvspass file, it
will never work..  Until you explicitly log in again with the full name.

I've got a hack that inserts the default port in to the line as read
from .cvspass, but doesn't save it back to the file in the new form.
(well, it only inserts the line if there isn't a port there already..)

The patch is attached for your thoughts..  It's not ready for prime
time, but I've got to get back to my day job. :)

jon

Index: src/login.c
===================================================================
RCS file: /home2/cvsroot/ccvs/src/login.c,v
retrieving revision 1.59
diff -u -r1.59 login.c
--- src/login.c 2000/10/17 18:42:28 1.59
+++ src/login.c 2000/10/18 20:17:53
@@ -320,6 +320,9 @@
     char *passfile;
     int line_length;
     char *cvsroot_canonical;
+    char port_s[11];
+    char * tmpbuf;
+    char *p;
 
     if (CVSroot_password)
    return (scramble(CVSroot_password));
@@ -367,6 +370,21 @@
     /* Check each line to see if we have this entry already. */
     while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
     {
+    p = strchr(linebuf, '@'); /* Find the @ */
+    p = strchr(p, ':');       /* And the next : is followed by the port/path */
+    if (!isdigit(*(p + 1))) 
+       {
+           sprintf (port_s, "%d", get_port_number ("CVS_CLIENT_PORT", 
"cvspserver", CVS_AUTH_PORT));
+
+           tmpbuf = xmalloc(strlen(linebuf) + strlen(port_s) + 1);
+
+           *p = '\0';
+           p++;
+           sprintf(tmpbuf, "%s:%s%s", linebuf, port_s, p);
+
+           linebuf = tmpbuf;
+           linebuf_len = strlen(tmpbuf);
+       }
    if (strncmp (cvsroot_canonical, linebuf, root_len) == 0)
         {
        /* This is it!  So break out and deal with linebuf. */


-- 
.Jonathan J. Miner------------------Division of Information Technology.
|miner@doit.wisc.edu                 University Of Wisconsin - Madison|
|608/262.9655                               Room 3149 Computer Science|
`---------------------------------------------------------------------'

 That is a known bug in 5.00550.  Either an upgrade or a downgrade will
 fix it.
              -- Larry Wall in <6vu1vo$89c@kiev.wall.org>
                                                                 (279)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]