]> arthur.barton.de Git - netatalk.git/commitdiff
Eddie's wincheck() fix.
authorsrittau <srittau>
Wed, 13 Mar 2002 19:29:14 +0000 (19:29 +0000)
committersrittau <srittau>
Wed, 13 Mar 2002 19:29:14 +0000 (19:29 +0000)
etc/afpd/directory.c
etc/afpd/file.c
etc/afpd/file.h
etc/afpd/filedir.c
etc/afpd/volume.c
etc/afpd/volume.h

index 3ad6d1d46c31b460ad994903ef5e441f4fbd0567..f7a5351b5a42ea89318a2da8da74f29bb95aed26 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.26 2002-01-19 21:29:55 jmarcus Exp $
+ * $Id: directory.c,v 1.27 2002-03-13 19:29:14 srittau Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1424,12 +1424,12 @@ int             ibuflen, *rbuflen;
         }
     }
 
-    /* check for illegal bits */
-    if (!wincheck(vol, path))
-        return AFPERR_PARAM;
-
     upath = mtoupath(vol, path);
 
+    /* check for illegal bits in the unix filename */
+    if (!wincheck(vol, upath))
+        return AFPERR_PARAM;
+
     if ((vol->v_flags & AFPVOL_NOHEX) && strchr(upath, '/'))
         return AFPERR_PARAM;
 
index 0f3280fe814b64ccfda02c1038862be305bc1ed3..36d0046cc000badee6ac3a5bb8b7015a39fd834d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.40 2002-03-05 02:04:46 jmarcus Exp $
+ * $Id: file.c,v 1.41 2002-03-13 19:29:17 srittau Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -422,11 +422,12 @@ int               ibuflen, *rbuflen;
         return( AFPERR_NOOBJ );
     }
 
-    if (!wincheck(vol, path))
-        return AFPERR_PARAM;
-
     upath = mtoupath(vol, path);
 
+    /* check for illegal bits in the unix filename */
+    if (!wincheck(vol, upath))
+        return AFPERR_PARAM;
+
     if ((vol->v_flags & AFPVOL_NOHEX) && strchr(upath, '/'))
         return AFPERR_PARAM;
 
@@ -1727,7 +1728,7 @@ int               ibuflen, *rbuflen;
 
     /* all this stuff is so that we can unwind a failed operation
      * properly. */
-err_temp_to_dest:
+
     /* rename dest to temp */
     renamefile(upath, temp, temp, vol_noadouble(vol));
     of_rename(vol, curdir, upath, curdir, temp);
index 477526decefadca101b77baf644a70dc6cbcaf8c..a6af6bb857c6a9ea53710df2aa3e923466e60b4e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.h,v 1.4 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: file.h,v 1.5 2002-03-13 19:29:17 srittau Exp $
  *
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
@@ -71,7 +71,6 @@ struct extmap {
     char               em_type[ 4 ];
 };
 
-extern struct extmap   *extmap;
 extern struct extmap   *getextmap __P((const char *));
 
 extern int getfilparams __P((struct vol *, u_int16_t, char *,
index f47d5f7af64cd9f4c7955e98728109ee34beb530..a50c33b771d622d5e593b8451305123c326eb938 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: filedir.c,v 1.23 2002-03-05 01:41:36 srittau Exp $
+ * $Id: filedir.c,v 1.24 2002-03-13 19:29:17 srittau Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -378,13 +378,13 @@ int               ibuflen, *rbuflen;
     if (strcmp(path, ibuf) == 0)
         return AFP_OK;
 
-    /* check for illegal characters */
-    if (!wincheck(vol, ibuf))
-        return AFPERR_PARAM;
-
     newpath = obj->oldtmp;
     strcpy( newpath, mtoupath(vol, ibuf ));
 
+    /* check for illegal characters in the unix filename */
+    if (!wincheck(vol, newpath))
+        return AFPERR_PARAM;
+
     if ((vol->v_flags & AFPVOL_NOHEX) && strchr(newpath, '/'))
         return AFPERR_PARAM;
 
@@ -672,12 +672,12 @@ int               ibuflen, *rbuflen;
         newname[ plen ] = '\0';
     }
 
-    /* check for illegal characters */
-    if (!wincheck(vol, newname))
-        return AFPERR_PARAM;
-
     upath = mtoupath(vol, newname);
 
+    /* check for illegal characters in the unix filename */
+    if (!wincheck(vol, upath))
+        return AFPERR_PARAM;
+
     if ((vol->v_flags & AFPVOL_NOHEX) && strchr(upath, '/'))
         return AFPERR_PARAM;
 
index 09b9841eb141d7a35b4b7dfe778166aa4b3602db..ddfc6186468e860e6f00150e9a9ddaeacf3d962a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.22 2002-02-06 21:58:50 jmarcus Exp $
+ * $Id: volume.c,v 1.23 2002-03-13 19:29:17 srittau Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1410,8 +1410,10 @@ int wincheck(struct vol *vol, const char *path)
     if ((len = strlen(path)) == 0)
         return 0;
 
-    /* leading or trailing whitespaces are not allowed */
-    if ((*path == ' ') || (path[len-1] == ' '))
+    /* leading or trailing whitespaces are not allowed, carriage returns
+     * and probably other whitespace is okay, tabs are not allowed
+     */
+    if ((path[0] == ' ') || (path[len-1] == ' '))
         return 0;
 
     /* certain characters are not allowed */
index eb78adac3673b3e8532d7b3f6351dd839109e9e9..fac777c24d18463a00c81a434be9efca56cef37c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.h,v 1.9 2002-01-02 21:14:10 srittau Exp $
+ * $Id: volume.h,v 1.10 2002-03-13 19:29:17 srittau Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -102,7 +102,7 @@ this is going away. */
 #define AFPVOL_UUPPERMLOWER    (AFPVOL_MTOUUPPER | AFPVOL_UTOMLOWER)
 #define AFPVOL_ULOWERMUPPER    (AFPVOL_MTOULOWER | AFPVOL_UTOMUPPER)
 
-#define MSWINDOWS_BADCHARS "\\/<>*?|\""
+#define MSWINDOWS_BADCHARS ":\t\\/<>*?|\""
 #define MSWINDOWS_CODEPAGE "maccode.iso8859-1"
 
 int wincheck(struct vol *vol, const char *path);