AFPVOL_MSWINDOWS volumes.
* FIX: Really fix Tru64 compilation (see last entry).
* FIX: Hand correct error value back to AFP client when deleting files or
directories fails.
+* FIX: Leading or trailing spaces are now forbidden on volumes that have
+ the AFPVOL_MSWINDOWS flag set.
* FIX: Minor code cleanups and warning fixes.
* FIX: Make quota support work on FreeBSD.
/*
- * $Id: directory.c,v 1.19.2.2 2002-01-02 17:21:39 srittau Exp $
+ * $Id: directory.c,v 1.19.2.3 2002-01-14 02:50:34 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
}
/* check for illegal bits */
- if ((vol->v_flags & AFPVOL_MSWINDOWS) &&
- strpbrk(path, MSWINDOWS_BADCHARS))
+ if (!wincheck(vol, path))
return AFPERR_PARAM;
upath = mtoupath(vol, path);
/*
- * $Id: file.c,v 1.29.2.2 2002-01-02 17:23:56 srittau Exp $
+ * $Id: file.c,v 1.29.2.3 2002-01-14 02:50:34 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
return( AFPERR_NOOBJ );
}
- if ((vol->v_flags & AFPVOL_MSWINDOWS) &&
- strpbrk(path, MSWINDOWS_BADCHARS))
+ if (!wincheck(vol, path))
return AFPERR_PARAM;
upath = mtoupath(vol, path);
/*
- * $Id: filedir.c,v 1.15.2.1 2001-12-03 05:01:04 jmarcus Exp $
+ * $Id: filedir.c,v 1.15.2.2 2002-01-14 02:50:34 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
return AFP_OK;
/* check for illegal characters */
- if ((vol->v_flags & AFPVOL_MSWINDOWS) &&
- strpbrk(ibuf, MSWINDOWS_BADCHARS))
+ if (!wincheck(vol, ibuf))
return AFPERR_PARAM;
newpath = obj->oldtmp;
}
/* check for illegal characters */
- if ((vol->v_flags & AFPVOL_MSWINDOWS) &&
- strpbrk(newname, MSWINDOWS_BADCHARS))
+ if (!wincheck(vol, ibuf))
return AFPERR_PARAM;
upath = mtoupath(vol, newname);
/*
- * $Id: volume.c,v 1.14.2.1 2001-12-03 05:01:04 jmarcus Exp $
+ * $Id: volume.c,v 1.14.2.2 2002-01-14 02:50:34 srittau Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
ad_close(&ad, ADFLAGS_HF);
return( AFP_OK );
}
+
+
+int wincheck(struct vol *vol, const char *path)
+{
+ int len;
+
+ if (!(vol->v_flags & AFPVOL_MSWINDOWS))
+ return 1;
+
+ /* empty paths are not allowed */
+ if ((len = strlen(path)) == 0)
+ return 0;
+
+ /* leading or trailing whitespaces are not allowed */
+ if ((*path == ' ') || (path[len-1] == ' '))
+ return 0;
+
+ /* certain characters are not allowed */
+ if (strpbrk(path, MSWINDOWS_BADCHARS))
+ return 0;
+
+ /* everything else is okay */
+ return 1;
+}
/*
- * $Id: volume.h,v 1.7.2.1 2001-12-03 05:01:04 jmarcus Exp $
+ * $Id: volume.h,v 1.7.2.2 2002-01-14 02:50:34 srittau Exp $
*
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#define MSWINDOWS_BADCHARS "\\/<>*?|\""
#define MSWINDOWS_CODEPAGE "maccode.iso8859-1"
+int wincheck(struct vol *vol, const char *path);
+
#define AFPVOLSIG_FLAT 0x0001 /* flat fs */
#define AFPVOLSIG_FIX 0x0002 /* fixed ids */
#define AFPVOLSIG_VAR 0x0003 /* variable ids */