]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/filedir.c
Merge master
[netatalk.git] / etc / afpd / filedir.c
1 /*
2  * Copyright (c) 1990,1993 Regents of The University of Michigan.
3  * All Rights Reserved.  See COPYRIGHT.
4  */
5
6 #ifdef HAVE_CONFIG_H
7 #include "config.h"
8 #endif /* HAVE_CONFIG_H */
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <errno.h>
14 #include <sys/param.h>
15
16 #include <atalk/adouble.h>
17 #include <atalk/vfs.h>
18 #include <atalk/afp.h>
19 #include <atalk/util.h>
20 #include <atalk/cnid.h>
21 #include <atalk/logger.h>
22 #include <atalk/unix.h>
23 #include <atalk/bstrlib.h>
24 #include <atalk/bstradd.h>
25 #include <atalk/acl.h>
26
27 #include "directory.h"
28 #include "dircache.h"
29 #include "desktop.h"
30 #include "volume.h"
31 #include "fork.h"
32 #include "file.h"
33 #include "globals.h"
34 #include "filedir.h"
35 #include "unix.h"
36
37 int afp_getfildirparams(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen)
38 {
39     struct stat     *st;
40     struct vol      *vol;
41     struct dir      *dir;
42     u_int32_t           did;
43     int         ret;
44     size_t      buflen;
45     u_int16_t       fbitmap, dbitmap, vid;
46     struct path         *s_path;
47
48     *rbuflen = 0;
49     ibuf += 2;
50
51     memcpy( &vid, ibuf, sizeof( vid ));
52     ibuf += sizeof( vid );
53     if (NULL == ( vol = getvolbyvid( vid )) ) {
54         /* was AFPERR_PARAM but it helps OS 10.3 when a volume has been removed
55          * from the list.
56          */
57         return( AFPERR_ACCESS );
58     }
59
60     memcpy( &did, ibuf, sizeof( did ));
61     ibuf += sizeof( did );
62
63     if (NULL == ( dir = dirlookup( vol, did )) ) {
64         return afp_errno;
65     }
66
67     memcpy( &fbitmap, ibuf, sizeof( fbitmap ));
68     fbitmap = ntohs( fbitmap );
69     ibuf += sizeof( fbitmap );
70     memcpy( &dbitmap, ibuf, sizeof( dbitmap ));
71     dbitmap = ntohs( dbitmap );
72     ibuf += sizeof( dbitmap );
73
74     if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
75         return get_afp_errno(AFPERR_NOOBJ);
76     }
77
78     LOG(log_debug, logtype_afpd, "getfildirparams(vid:%u, did:%u, f/d:%04x/%04x) {cwdid:%u, cwd: %s, name:'%s'}",
79         ntohs(vid), ntohl(dir->d_did), fbitmap, dbitmap,
80         ntohl(curdir->d_did), cfrombstr(curdir->d_fullpath), s_path->u_name);
81
82     st   = &s_path->st;
83     if (!s_path->st_valid) {
84         /* it's a dir and it should be there
85          * because we chdir in it in cname or
86          * it's curdir (maybe deleted, but then we can't know).
87          * So we need to try harder.
88          */
89         of_statdir(vol, s_path);
90     }
91     if ( s_path->st_errno != 0 ) {
92         if (afp_errno != AFPERR_ACCESS) {
93             return( AFPERR_NOOBJ );
94         }
95     }
96
97
98     buflen = 0;
99     if (S_ISDIR(st->st_mode)) {
100         if (dbitmap) {
101             dir = s_path->d_dir;
102             if (!dir)
103                 return AFPERR_NOOBJ;
104
105             ret = getdirparams(vol, dbitmap, s_path, dir,
106                                rbuf + 3 * sizeof( u_int16_t ), &buflen );
107             if (ret != AFP_OK )
108                 return( ret );
109         }
110         /* this is a directory */
111         *(rbuf + 2 * sizeof( u_int16_t )) = (char) FILDIRBIT_ISDIR;
112     } else {
113         if (fbitmap && AFP_OK != (ret = getfilparams(vol, fbitmap, s_path, curdir,
114                                                      rbuf + 3 * sizeof( u_int16_t ), &buflen )) ) {
115             return( ret );
116         }
117         /* this is a file */
118         *(rbuf + 2 * sizeof( u_int16_t )) = FILDIRBIT_ISFILE;
119     }
120     *rbuflen = buflen + 3 * sizeof( u_int16_t );
121     fbitmap = htons( fbitmap );
122     memcpy( rbuf, &fbitmap, sizeof( fbitmap ));
123     rbuf += sizeof( fbitmap );
124     dbitmap = htons( dbitmap );
125     memcpy( rbuf, &dbitmap, sizeof( dbitmap ));
126     rbuf += sizeof( dbitmap ) + sizeof( u_char );
127     *rbuf = 0;
128
129     return( AFP_OK );
130 }
131
132 int afp_setfildirparams(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
133 {
134     struct stat *st;
135     struct vol  *vol;
136     struct dir  *dir;
137     struct path *path;
138     u_int16_t   vid, bitmap;
139     int     did, rc;
140
141     *rbuflen = 0;
142     ibuf += 2;
143     memcpy( &vid, ibuf, sizeof(vid));
144     ibuf += sizeof( vid );
145
146     if (NULL == ( vol = getvolbyvid( vid )) ) {
147         return( AFPERR_PARAM );
148     }
149
150     if (vol->v_flags & AFPVOL_RO)
151         return AFPERR_VLOCK;
152
153     memcpy( &did, ibuf, sizeof( did));
154     ibuf += sizeof( did);
155
156     if (NULL == ( dir = dirlookup( vol, did )) ) {
157         return afp_errno;
158     }
159
160     memcpy( &bitmap, ibuf, sizeof( bitmap ));
161     bitmap = ntohs( bitmap );
162     ibuf += sizeof( bitmap );
163
164     if (NULL == ( path = cname( vol, dir, &ibuf ))) {
165         return get_afp_errno(AFPERR_NOOBJ);
166     }
167
168     st   = &path->st;
169     if (!path->st_valid) {
170         /* it's a dir and it should be there
171          * because we chdir in it in cname
172          */
173         of_statdir(vol, path);
174     }
175
176     if ( path->st_errno != 0 ) {
177         if (afp_errno != AFPERR_ACCESS)
178             return( AFPERR_NOOBJ );
179     }
180     /*
181      * If ibuf is odd, make it even.
182      */
183     if ((u_long)ibuf & 1 ) {
184         ibuf++;
185     }
186
187     if (S_ISDIR(st->st_mode)) {
188         rc = setdirparams(vol, path, bitmap, ibuf );
189     } else {
190         rc = setfilparams(vol, path, bitmap, ibuf );
191     }
192     if ( rc == AFP_OK ) {
193         setvoltime(obj, vol );
194     }
195
196     return( rc );
197 }
198
199 /* --------------------------------------------
200    Factorise some checks on a pathname
201 */
202 int check_name(const struct vol *vol, char *name)
203 {
204     /* check for illegal characters in the unix filename */
205     if (!wincheck(vol, name))
206         return AFPERR_PARAM;
207
208     if ((vol->v_flags & AFPVOL_NOHEX) && strchr(name, '/'))
209         return AFPERR_PARAM;
210
211     if (!vol->vfs->vfs_validupath(vol, name)) {
212         LOG(log_error, logtype_afpd, "check_name: illegal name: '%s'", name);
213         return AFPERR_EXIST;
214     }
215
216     /* check for vetoed filenames */
217     if (veto_file(vol->v_veto, name))
218         return AFPERR_EXIST;
219     return 0;
220 }
221
222 /* ------------------------- 
223     move and rename sdir:oldname to curdir:newname in volume vol
224     special care is needed for lock   
225 */
226 static int moveandrename(const struct vol *vol,
227                          struct dir *sdir,
228                          int sdir_fd,
229                          char *oldname,
230                          char *newname,
231                          int isdir)
232 {
233     char            *oldunixname = NULL;
234     char            *upath;
235     int             rc;
236     struct stat     *st, nst;
237     int             adflags;
238     struct adouble      ad;
239     struct adouble      *adp;
240     struct ofork        *opened = NULL;
241     struct path     path;
242     cnid_t          id;
243     int             cwd_fd = -1;
244
245     LOG(log_debug, logtype_afpd,
246         "moveandrename: [\"%s\"/\"%s\"] -> \"%s\"",
247         cfrombstr(sdir->d_u_name), oldname, newname);
248
249     ad_init(&ad, vol->v_adouble, vol->v_ad_options);
250     adp = &ad;
251     adflags = 0;
252
253     if (!isdir) {
254         if ((oldunixname = strdup(mtoupath(vol, oldname, sdir->d_did, utf8_encoding()))) == NULL)
255             return AFPERR_PARAM; /* can't convert */
256         id = cnid_get(vol->v_cdb, sdir->d_did, oldunixname, strlen(oldunixname));
257
258 #ifndef HAVE_ATFUNCS
259         /* Need full path */
260         free(oldunixname);
261         if ((oldunixname = strdup(ctoupath(vol, sdir, oldname))) == NULL)
262             return AFPERR_PARAM; /* pathname too long */
263 #endif /* HAVE_ATFUNCS */
264
265         path.st_valid = 0;
266         path.u_name = oldunixname;
267
268 #ifdef HAVE_ATFUNCS
269         opened = of_findnameat(sdir_fd, &path);
270 #else
271         opened = of_findname(&path);
272 #endif /* HAVE_ATFUNCS */
273
274         if (opened) {
275             /* reuse struct adouble so it won't break locks */
276             adp = opened->of_ad;
277         }
278     } else {
279         id = sdir->d_did; /* we already have the CNID */
280         if ((oldunixname = strdup(ctoupath( vol, dirlookup(vol, sdir->d_pdid), oldname))) == NULL)
281             return AFPERR_PARAM;
282         adflags = ADFLAGS_DIR;
283     }
284
285     /*
286      * oldunixname now points to either
287      *   a) full pathname of the source fs object (if renameat is not available)
288      *   b) the oldname (renameat is available)
289      * we are in the dest folder so we need to use 
290      *   a) oldunixname for ad_open
291      *   b) fchdir sdir_fd before eg ad_open or use *at functions where appropiate
292      */
293
294     if (sdir_fd != -1) {
295         if ((cwd_fd = open(".", O_RDONLY)) == -1)
296             return AFPERR_MISC;
297         if (fchdir(sdir_fd) != 0) {
298             rc = AFPERR_MISC;
299             goto exit;
300         }
301     }
302     if (!ad_metadata(oldunixname, adflags, adp)) {
303         u_int16_t bshort;
304
305         ad_getattr(adp, &bshort);
306         
307         ad_close_metadata( adp);
308         if ((bshort & htons(ATTRBIT_NORENAME))) {
309             rc = AFPERR_OLOCK;
310             goto exit;
311         }
312     }
313     if (sdir_fd != -1) {
314         if (fchdir(cwd_fd) != 0) {
315             LOG(log_error, logtype_afpd, "moveandrename: %s", strerror(errno) );
316             rc = AFPERR_MISC;
317             goto exit;
318         }
319     }
320
321     if (NULL == (upath = mtoupath(vol, newname, curdir->d_did, utf8_encoding()))){ 
322         rc = AFPERR_PARAM;
323         goto exit;
324     }
325     path.u_name = upath;
326     st = &path.st;
327     if (0 != (rc = check_name(vol, upath))) {
328         goto exit;
329     }
330
331     /* source == destination. we just silently accept this. */
332     if ((!isdir && curdir == sdir) || (isdir && curdir->d_did == sdir->d_pdid)) {
333         if (strcmp(oldname, newname) == 0) {
334             rc = AFP_OK;
335             goto exit;
336         }
337
338         if (stat(upath, st) == 0 || caseenumerate(vol, &path, curdir) == 0) {
339             if (!stat(oldunixname, &nst) && !(nst.st_dev == st->st_dev && nst.st_ino == st->st_ino) ) {
340                 /* not the same file */
341                 rc = AFPERR_EXIST;
342                 goto exit;
343             }
344             errno = 0;
345         }
346     } else if (stat(upath, st ) == 0 || caseenumerate(vol, &path, curdir) == 0) {
347         rc = AFPERR_EXIST;
348         goto exit;
349     }
350
351     if ( !isdir ) {
352         path.st_valid = 1;
353         path.st_errno = errno;
354         if (of_findname(&path)) {
355             rc = AFPERR_EXIST; /* was AFPERR_BUSY; */
356         } else {
357             rc = renamefile(vol, sdir_fd, oldunixname, upath, newname, adp );
358             if (rc == AFP_OK)
359                 of_rename(vol, opened, sdir, oldname, curdir, newname);
360         }
361     } else {
362         rc = renamedir(vol, sdir_fd, oldunixname, upath, sdir, curdir, newname);
363     }
364     if ( rc == AFP_OK && id ) {
365         /* renaming may have moved the file/dir across a filesystem */
366         if (stat(upath, st) < 0) {
367             rc = AFPERR_MISC;
368             goto exit;
369         }
370
371         /* Remove it from the cache */
372         struct dir *cacheddir = dircache_search_by_did(vol, id);
373         if (cacheddir) {
374             LOG(log_warning, logtype_afpd,"Still cached: \"%s/%s\"", getcwdpath(), upath);
375             (void)dir_remove(vol, cacheddir);
376         }
377
378         /* Fixup adouble info */
379         if (!ad_metadata(upath, adflags, adp)) {
380             ad_setid(adp, st->st_dev, st->st_ino, id, curdir->d_did, vol->v_stamp);
381             ad_flush(adp);
382             ad_close_metadata(adp);
383         }
384
385         /* fix up the catalog entry */
386         cnid_update(vol->v_cdb, id, st, curdir->d_did, upath, strlen(upath));
387     }
388
389 exit:
390     if (cwd_fd != -1)
391         close(cwd_fd);
392     if (oldunixname)
393         free(oldunixname);
394     return rc;
395 }
396
397 /* -------------------------------------------- */
398 int afp_rename(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
399 {
400     struct vol  *vol;
401     struct dir  *sdir;
402     char        *oldname, *newname;
403     struct path *path;
404     u_int32_t   did;
405     int         plen;
406     u_int16_t   vid;
407     int         isdir = 0;
408     int         rc;
409
410     *rbuflen = 0;
411     ibuf += 2;
412
413     memcpy( &vid, ibuf, sizeof( vid ));
414     ibuf += sizeof( vid );
415     if (NULL == ( vol = getvolbyvid( vid )) ) {
416         return( AFPERR_PARAM );
417     }
418
419     if (vol->v_flags & AFPVOL_RO)
420         return AFPERR_VLOCK;
421
422     memcpy( &did, ibuf, sizeof( did ));
423     ibuf += sizeof( did );
424     if (NULL == ( sdir = dirlookup( vol, did )) ) {
425         return afp_errno;
426     }
427
428     /* source pathname */
429     if (NULL == ( path = cname( vol, sdir, &ibuf )) ) {
430         return get_afp_errno(AFPERR_NOOBJ);
431     }
432
433     sdir = curdir;
434     newname = obj->newtmp;
435     oldname = obj->oldtmp;
436     isdir = path_isadir(path);
437     if ( *path->m_name != '\0' ) {
438         strcpy(oldname, path->m_name); /* an extra copy for of_rename */
439         if (isdir) {
440             /* curdir parent dir, need to move sdir back */
441             sdir = path->d_dir;
442         }
443     }
444     else {
445         if ( sdir->d_did == DIRDID_ROOT ) { /* root directory */
446             return( AFPERR_NORENAME );
447         }
448         /* move to destination dir */
449         if ( movecwd( vol, dirlookup(vol, sdir->d_pdid) ) < 0 ) {
450             return afp_errno;
451         }
452         memcpy(oldname, cfrombstr(sdir->d_m_name), blength(sdir->d_m_name) +1);
453     }
454
455     /* another place where we know about the path type */
456     if ((plen = copy_path_name(vol, newname, ibuf)) < 0) {
457         return( AFPERR_PARAM );
458     }
459
460     if (!plen) {
461         return AFP_OK; /* newname == oldname same dir */
462     }
463     
464     rc = moveandrename(vol, sdir, -1, oldname, newname, isdir);
465     if ( rc == AFP_OK ) {
466         setvoltime(obj, vol );
467     }
468
469     return( rc );
470 }
471
472 /* ------------------------------- */
473 int afp_delete(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
474 {
475     struct vol      *vol;
476     struct dir      *dir;
477     struct path         *s_path;
478     char        *upath;
479     int         did, rc;
480     u_int16_t       vid;
481
482     *rbuflen = 0;
483     ibuf += 2;
484
485     memcpy( &vid, ibuf, sizeof( vid ));
486     ibuf += sizeof( vid );
487     if (NULL == ( vol = getvolbyvid( vid )) ) {
488         return( AFPERR_PARAM );
489     }
490
491     if (vol->v_flags & AFPVOL_RO)
492         return AFPERR_VLOCK;
493
494     memcpy( &did, ibuf, sizeof( did ));
495     ibuf += sizeof( int );
496
497     if (NULL == ( dir = dirlookup( vol, did )) ) {
498         return afp_errno;
499     }
500
501     if (NULL == ( s_path = cname( vol, dir, &ibuf )) ) {
502         return get_afp_errno(AFPERR_NOOBJ);
503     }
504
505     upath = s_path->u_name;
506     if ( path_isadir( s_path) ) {
507         if (*s_path->m_name != '\0' || curdir->d_did == DIRDID_ROOT)
508             rc = AFPERR_ACCESS;
509         else
510             rc = deletecurdir( vol);
511     } else if (of_findname(s_path)) {
512         rc = AFPERR_BUSY;
513     } else {
514         /* it's a file st_valid should always be true
515          * only test for ENOENT because EACCES needs
516          * to read meta data in deletefile
517          */
518         if (s_path->st_valid && s_path->st_errno == ENOENT) {
519             rc = AFPERR_NOOBJ;
520         }
521         else {
522             rc = deletefile(vol, -1, upath, 1);
523
524             struct dir *cachedfile;
525             if ((cachedfile = dircache_search_by_name(vol, dir, upath, strlen(upath), s_path->st.st_ctime))) {
526                 dircache_remove(vol, cachedfile, DIRCACHE | DIDNAME_INDEX | QUEUE_INDEX);
527                 dir_free(cachedfile);
528             }
529         }
530     }
531     if ( rc == AFP_OK ) {
532         curdir->offcnt--;
533         setvoltime(obj, vol );
534     }
535
536     return( rc );
537 }
538 /* ------------------------ */
539 char *absupath(const struct vol *vol, struct dir *dir, char *u)
540 {
541     static char pathbuf[MAXPATHLEN + 1];
542     bstring path;
543
544     if (u == NULL || dir == NULL || vol == NULL)
545         return NULL;
546
547     if ((path = bstrcpy(dir->d_fullpath)) == NULL)
548         return NULL;
549     if (bcatcstr(path, "/") != BSTR_OK)
550         return NULL;
551     if (bcatcstr(path, u) != BSTR_OK)
552         return NULL;
553     if (path->slen > MAXPATHLEN)
554         return NULL;
555
556     LOG(log_debug, logtype_afpd, "absupath: %s", cfrombstr(path));
557
558     strncpy(pathbuf, cfrombstr(path), blength(path) + 1);
559     bdestroy(path);
560
561     return(pathbuf);
562 }
563
564 char *ctoupath(const struct vol *vol, struct dir *dir, char *name)
565 {
566     if (vol == NULL || dir == NULL || name == NULL)
567         return NULL;
568     return absupath(vol, dir, mtoupath(vol, name, dir->d_did, utf8_encoding()));
569 }
570
571 /* ------------------------- */
572 int afp_moveandrename(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
573 {
574     struct vol  *vol;
575     struct dir  *sdir, *ddir;
576     int         isdir;
577     char    *oldname, *newname;
578     struct path *path;
579     int     did;
580     int     pdid;
581     int         plen;
582     u_int16_t   vid;
583     int         rc;
584     int     sdir_fd = -1;
585
586
587     *rbuflen = 0;
588     ibuf += 2;
589
590     memcpy( &vid, ibuf, sizeof( vid ));
591     ibuf += sizeof( vid );
592     if (NULL == ( vol = getvolbyvid( vid )) ) {
593         return( AFPERR_PARAM );
594     }
595
596     if (vol->v_flags & AFPVOL_RO)
597         return AFPERR_VLOCK;
598
599     /* source did followed by dest did */
600     memcpy( &did, ibuf, sizeof( did ));
601     ibuf += sizeof( int );
602     if (NULL == ( sdir = dirlookup( vol, did )) ) {
603         return afp_errno; /* was AFPERR_PARAM */
604     }
605
606     memcpy( &did, ibuf, sizeof( did ));
607     ibuf += sizeof( int );
608
609     /* source pathname */
610     if (NULL == ( path = cname( vol, sdir, &ibuf )) ) {
611         return get_afp_errno(AFPERR_NOOBJ);
612     }
613
614     sdir = curdir;
615     newname = obj->newtmp;
616     oldname = obj->oldtmp;
617
618     isdir = path_isadir(path);
619     if ( *path->m_name != '\0' ) {
620         if (isdir) {
621             sdir = path->d_dir;
622         }
623         strcpy(oldname, path->m_name); /* an extra copy for of_rename */
624     } else {
625         memcpy(oldname, cfrombstr(sdir->d_m_name), blength(sdir->d_m_name) + 1);
626     }
627
628 #ifdef HAVE_ATFUNCS
629     if ((sdir_fd = open(".", O_RDONLY)) == -1)
630         return AFPERR_MISC;
631 #endif
632
633     /* get the destination directory */
634     if (NULL == ( ddir = dirlookup( vol, did )) ) {
635         rc = afp_errno; /*  was AFPERR_PARAM */
636         goto exit;
637     }
638     if (NULL == ( path = cname( vol, ddir, &ibuf ))) {
639         rc = AFPERR_NOOBJ;
640         goto exit;
641     }
642     pdid = curdir->d_did;
643     if ( *path->m_name != '\0' ) {
644         rc = path_error(path, AFPERR_NOOBJ);
645         goto exit;
646     }
647
648     /* one more place where we know about path type */
649     if ((plen = copy_path_name(vol, newname, ibuf)) < 0) {
650         rc = AFPERR_PARAM;
651         goto exit;
652     }
653
654     if (!plen) {
655         strcpy(newname, oldname);
656     }
657
658     /* This does the work */
659     LOG(log_debug, logtype_afpd, "afp_move(oldname:'%s', newname:'%s', isdir:%u)",
660         oldname, newname, isdir);
661     rc = moveandrename(vol, sdir, sdir_fd, oldname, newname, isdir);
662
663     if ( rc == AFP_OK ) {
664         char *upath = mtoupath(vol, newname, pdid, utf8_encoding());
665
666         if (NULL == upath) {
667             rc = AFPERR_PARAM;
668             goto exit;
669         }
670         curdir->offcnt++;
671         sdir->offcnt--;
672         /* if unix priv don't try to match perm with dest folder */
673         if (!isdir && !vol_unix_priv(vol)) {
674             int  admode = ad_mode("", 0777) | vol->v_fperm;
675
676             setfilmode(upath, admode, NULL, vol->v_umask);
677             vol->vfs->vfs_setfilmode(vol, upath, admode, NULL);
678         }
679         setvoltime(obj, vol );
680     }
681
682 exit:
683 #ifdef HAVE_ATFUNCS
684     if (sdir_fd != -1)
685         close(sdir_fd);
686 #endif
687
688     return( rc );
689 }
690
691 int veto_file(const char*veto_str, const char*path)
692 /* given a veto_str like "abc/zxc/" and path "abc", return 1
693  * veto_str should be '/' delimited
694  * if path matches any one of the veto_str elements exactly, then 1 is returned
695  * otherwise, 0 is returned.
696  */
697 {
698     int i;  /* index to veto_str */
699     int j;  /* index to path */
700
701     if ((veto_str == NULL) || (path == NULL))
702         return 0;
703
704     for(i=0, j=0; veto_str[i] != '\0'; i++) {
705         if (veto_str[i] == '/') {
706             if ((j>0) && (path[j] == '\0')) {
707                 LOG(log_debug, logtype_afpd, "vetoed file:'%s'", path);
708                 return 1;
709             }
710             j = 0;
711         } else {
712             if (veto_str[i] != path[j]) {
713                 while ((veto_str[i] != '/')
714                        && (veto_str[i] != '\0'))
715                     i++;
716                 j = 0;
717                 continue;
718             }
719             j++;
720         }
721     }
722     return 0;
723 }
724