Subject: misc/2970: UUCP doesn't handle directories correctly in edge case
To: None <gnats-bugs@gnats.netbsd.org, darcy@druid.com>
From: None <darcy@druid.com>
List: netbsd-bugs
Date: 11/26/1996 09:02:30
>Number:         2970
>Category:       misc
>Synopsis:       UUCP doesn't handle directories correctly in edge case
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 26 06:20:01 1996
>Last-Modified:
>Originator:     D'Arcy J.M. Cain
>Organization:
D'Arcy J.M. Cain                           |  Democracy is three wolves
darcy@{druid.com|vex.net}                  |  and a sheep voting on         
+1 416 943 5281     (DoD#0082)    (eNTP)   |  what's for dinner.
                --  http://www.druid.com/darcy  --                       
>Release:        NetBSD-current
>Environment:
	
System: NetBSD druid.com 1.2B NetBSD 1.2B (DRUID) #0: Sun Nov 24 10:11:21 EST 1996 darcy@druid.com:/usr/src/sys/arch/i386/compile/DRUID i386


>Description:
The comments in the existing code show that the problem is known but
the fix doesn't handle some pathological cases.
>How-To-Repeat:
You just have to set up UUCP and try it.  It may depend on the sending
system.  I was having problems with OSF1 sending to NetBSD.
>Fix:
*** ../src.original/./gnu/libexec/uucp/libunix/mkdirs.c	Mon Nov 18 18:01:18 1996
--- ./gnu/libexec/uucp/libunix/mkdirs.c	Fri Aug 25 03:24:20 1995
***************
*** 28,38 ****
      {
        if (*z == '/' && z != zcopy)
  	{
- 	  /* Some versions of uuto will send a double slash.  Some
-              systems will fail to create a directory ending in a
-              slash.  */
- 	  if (z[-1] == '/')
- 	    continue;
  	  *z = '\0';
  	  if (mkdir (zcopy, imode) != 0
  	      && errno != EEXIST
--- 28,33 ----
***************
*** 48,53 ****
--- 43,53 ----
  	      return FALSE;
  	    }
  	  *z = '/';
+ 	  /* Some versions of uuto will send a double slash.  Some
+              systems will fail to create a directory ending in a
+              slash.  */
+       while (z[1] == '/')
+         z++;
  	}
      }
  
>Audit-Trail:
>Unformatted: