X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fvolume.c;h=3bff6e88e0fb7a4b4232a50263b0d64142954dd1;hb=fff7b0b7ecaec9c34f702aa1b8dd8854ac7052ef;hp=36e52fb5742cd3fafba647b245492cfc9c1f62d0;hpb=b9b23b5b1586993eb313af2b058b0fbbaeb7fab1;p=netatalk.git diff --git a/etc/afpd/volume.c b/etc/afpd/volume.c index 36e52fb5..3bff6e88 100644 --- a/etc/afpd/volume.c +++ b/etc/afpd/volume.c @@ -1,5 +1,5 @@ /* - * $Id: volume.c,v 1.15 2001-12-03 05:03:38 jmarcus Exp $ + * $Id: volume.c,v 1.16 2002-01-02 21:14:10 srittau Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -1395,3 +1395,27 @@ int ibuflen, *rbuflen; 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; +}