3 * Copyright (C) 1990, 1993 Regents of The University of Michigan
4 * All Rights Reserved. See COPYRIGHT
9 * This file contains FPCatSearch implementation. FPCatSearch performs
10 * file/directory search based on specified criteria. It is used by client
11 * to perform fast searches on (propably) big volumes. So, it has to be
14 * This implementation bypasses most of adouble/libatalk stuff as long as
15 * possible and does a standard filesystem search. It calls higher-level
16 * libatalk/afpd functions only when it is really needed, mainly while
17 * returning some non-UNIX information or filtering by non-UNIX criteria.
19 * Initial version written by Rafal Lewczuk <rlewczuk@pronet.pl>
25 #endif /* HAVE_CONFIG_H */
38 #define memcpy(d,s,n) bcopy ((s), (d), (n))
39 #define memmove(d,s,n) bcopy ((s), (d), (n))
40 #endif /* ! HAVE_MEMCPY */
44 #include <netinet/in.h>
46 #include <atalk/afp.h>
47 #include <atalk/adouble.h>
48 #include <atalk/logger.h>
50 #include <atalk/cnid.h>
53 #include "directory.h"
64 u_int16_t attrs; /* File attributes (high 8 bits)*/
65 u_int16_t label; /* Label (low 8 bits )*/
66 char reserved[22]; /* Unknown (at least for now...) */
69 typedef char packed_finder[ADEDLEN_FINDERI];
72 * 0x04 - has a custom icon
73 * 0x20 - name/icon is locked
87 /* This is our search-criteria structure. */
89 u_int32_t rbitmap; /* Request bitmap - which values should we check ? */
90 u_int16_t fbitmap, dbitmap; /* file & directory bitmap - which values should we return ? */
91 u_int16_t attr; /* File attributes */
92 time_t cdate; /* Creation date */
93 time_t mdate; /* Last modification date */
94 time_t bdate; /* Last backup date */
95 u_int32_t pdid; /* Parent DID */
96 u_int16_t offcnt; /* Offspring count */
97 struct finderinfo finfo; /* Finder info */
98 char lname[64]; /* Long name */
99 char utf8name[514]; /* UTF8 or UCS2 name */ /* for convert_charset dest_len parameter +2 */
103 * Directory tree search is recursive by its nature. But AFP specification
104 * requires FPCatSearch to pause after returning n results and be able to
105 * resume the search later. So we have to do recursive search using flat
106 * (iterative) algorithm and remember all directories to look into in an
107 * stack-like structure. The structure below is one item of directory stack.
111 struct dir *dir; /* Structure describing this directory */
112 int pidx; /* Parent's dsitem structure index. */
113 int checked; /* Have we checked this directory ? */
115 char *path; /* absolute UNIX path to this directory */
120 static int save_cidx = -1; /* Saved index of currently scanned directory. */
122 static struct dsitem *dstack = NULL; /* Directory stack data... */
123 static int dssize = 0; /* Directory stack (allocated) size... */
124 static int dsidx = 0; /* First free item index... */
126 static struct scrit c1, c2; /* search criteria */
128 /* Puts new item onto directory stack. */
129 static int addstack(char *uname, struct dir *dir, int pidx)
134 /* check if we have some space on stack... */
135 if (dsidx >= dssize) {
137 dstack = realloc(dstack, dssize * sizeof(struct dsitem));
142 /* Put new element. Allocate and copy lname and path. */
143 ds = dstack + dsidx++;
148 l = dstack[pidx].path_len;
149 u = strlen(uname) +1;
150 if (!(ds->path = malloc(l + u + 1) ))
152 memcpy(ds->path, dstack[pidx].path, l);
154 memcpy(&ds->path[l+1], uname, u);
158 ds->path = strdup(uname);
159 ds->path_len = strlen(uname);
164 /* Removes checked items from top of directory stack. Returns index of the first unchecked elements or -1. */
165 static int reducestack(void)
168 if (save_cidx != -1) {
175 if (dstack[dsidx-1].checked) {
177 free(dstack[dsidx].path);
184 /* Clears directory stack. */
185 static void clearstack(void)
190 free(dstack[dsidx].path);
194 /* Looks up for an opened adouble structure, opens resource fork of selected file.
195 * FIXME What about noadouble?
197 static struct adouble *adl_lkup(struct vol *vol, struct path *path, struct adouble *adp)
199 static struct adouble ad;
207 isdir = S_ISDIR(path->st.st_mode);
209 if (!isdir && (of = of_findname(path))) {
212 ad_init(&ad, vol->v_adouble, vol->v_ad_options);
216 if ( ad_metadata( path->u_name, ((isdir) ? ADFLAGS_DIR : 0), adp) < 0 ) {
217 adp = NULL; /* FIXME without resource fork adl_lkup will be call again */
223 /* -------------------- */
224 static struct finderinfo *unpack_buffer(struct finderinfo *finfo, char *buffer)
226 memcpy(&finfo->f_type, buffer +FINDERINFO_FRTYPEOFF, sizeof(finfo->f_type));
227 memcpy(&finfo->creator, buffer +FINDERINFO_FRCREATOFF, sizeof(finfo->creator));
228 memcpy(&finfo->attrs, buffer +FINDERINFO_FRFLAGOFF, sizeof(finfo->attrs));
229 memcpy(&finfo->label, buffer +FINDERINFO_FRFLAGOFF, sizeof(finfo->label));
230 finfo->attrs &= 0xff00; /* high 8 bits */
231 finfo->label &= 0xff; /* low 8 bits */
236 /* -------------------- */
237 static struct finderinfo *
238 unpack_finderinfo(struct vol *vol, struct path *path, struct adouble **adp, struct finderinfo *finfo, int islnk)
243 *adp = adl_lkup(vol, path, *adp);
244 ptr = get_finderinfo(vol, path->u_name, *adp, &buf,islnk);
245 return unpack_buffer(finfo, ptr);
248 /* -------------------- */
249 #define CATPBIT_PARTIAL 31
250 /* Criteria checker. This function returns a 2-bit value. */
251 /* bit 0 means if checked file meets given criteria. */
252 /* bit 1 means if it is a directory and we should descent into it. */
254 * fname - our fname (translated to UNIX)
255 * cidx - index in directory stack
257 static int crit_check(struct vol *vol, struct path *path) {
259 u_int16_t attr, flags = CONV_PRECOMPOSE;
260 struct finderinfo *finfo = NULL, finderinfo;
261 struct adouble *adp = NULL;
262 time_t c_date, b_date;
263 u_int32_t ac_date, ab_date;
264 static char convbuf[514]; /* for convert_charset dest_len parameter +2 */
267 islnk=S_ISLNK(path->st.st_mode);
269 if (S_ISDIR(path->st.st_mode)) {
277 /* compute the Mac name
278 * first try without id (it's slow to find it)
279 * An other option would be to call get_id in utompath but
280 * we need to pass parent dir
282 if (!(path->m_name = utompath(vol, path->u_name, 0 , utf8_encoding()) )) {
283 /*retry with the right id */
287 adp = adl_lkup(vol, path, adp);
288 id = get_id(vol, adp, &path->st, path->d_dir->d_did, path->u_name, strlen(path->u_name));
293 /* save the id for getfilparm */
295 if (!(path->m_name = utompath(vol, path->u_name, id , utf8_encoding()))) {
301 /* Kind of optimization:
302 * -- first check things we've already have - filename
303 * -- last check things we get from ad_open()
304 * FIXME strmcp strstr (icase)
307 /* Check for filename */
308 if ((c1.rbitmap & (1<<DIRPBIT_LNAME))) {
309 if ( (size_t)(-1) == (len = convert_string(vol->v_maccharset, CH_UCS2, path->m_name, -1, convbuf, 512)) )
312 if ((c1.rbitmap & (1<<CATPBIT_PARTIAL))) {
313 if (strcasestr_w( (ucs2_t*) convbuf, (ucs2_t*) c1.lname) == NULL)
316 if (strcasecmp_w((ucs2_t*) convbuf, (ucs2_t*) c1.lname) != 0)
320 if ((c1.rbitmap & (1<<FILPBIT_PDINFO))) {
321 if ( (size_t)(-1) == (len = convert_charset( CH_UTF8_MAC, CH_UCS2, CH_UTF8, path->m_name, strlen(path->m_name), convbuf, 512, &flags))) {
325 if (c1.rbitmap & (1<<CATPBIT_PARTIAL)) {
326 if (strcasestr_w((ucs2_t *) convbuf, (ucs2_t*)c1.utf8name) == NULL)
329 if (strcasecmp_w((ucs2_t *)convbuf, (ucs2_t*)c1.utf8name) != 0)
335 if ((unsigned)c2.mdate > 0x7fffffff)
336 c2.mdate = 0x7fffffff;
337 if ((unsigned)c2.cdate > 0x7fffffff)
338 c2.cdate = 0x7fffffff;
339 if ((unsigned)c2.bdate > 0x7fffffff)
340 c2.bdate = 0x7fffffff;
342 /* Check for modification date */
343 if ((c1.rbitmap & (1<<DIRPBIT_MDATE))) {
344 if (path->st.st_mtime < c1.mdate || path->st.st_mtime > c2.mdate)
348 /* Check for creation date... */
349 if ((c1.rbitmap & (1<<DIRPBIT_CDATE))) {
350 c_date = path->st.st_mtime;
351 adp = adl_lkup(vol, path, adp);
352 if (adp && ad_getdate(adp, AD_DATE_CREATE, &ac_date) >= 0)
353 c_date = AD_DATE_TO_UNIX(ac_date);
355 if (c_date < c1.cdate || c_date > c2.cdate)
359 /* Check for backup date... */
360 if ((c1.rbitmap & (1<<DIRPBIT_BDATE))) {
361 b_date = path->st.st_mtime;
362 adp = adl_lkup(vol, path, adp);
363 if (adp && ad_getdate(adp, AD_DATE_BACKUP, &ab_date) >= 0)
364 b_date = AD_DATE_TO_UNIX(ab_date);
366 if (b_date < c1.bdate || b_date > c2.bdate)
370 /* Check attributes */
371 if ((c1.rbitmap & (1<<DIRPBIT_ATTR)) && c2.attr != 0) {
372 if ((adp = adl_lkup(vol, path, adp))) {
373 ad_getattr(adp, &attr);
374 if ((attr & c2.attr) != c1.attr)
380 /* Check file type ID */
381 if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.f_type != 0) {
382 finfo = unpack_finderinfo(vol, path, &adp, &finderinfo,islnk);
383 if (finfo->f_type != c1.finfo.f_type)
387 /* Check creator ID */
388 if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.creator != 0) {
390 finfo = unpack_finderinfo(vol, path, &adp, &finderinfo,islnk);
392 if (finfo->creator != c1.finfo.creator)
396 /* Check finder info attributes */
397 if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.attrs != 0) {
399 finfo = unpack_finderinfo(vol, path, &adp, &finderinfo,islnk);
402 if ((finfo->attrs & c2.finfo.attrs) != c1.finfo.attrs)
407 if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.label != 0) {
409 finfo = unpack_finderinfo(vol, path, &adp, &finderinfo,islnk);
411 if ((finfo->label & c2.finfo.label) != c1.finfo.label)
414 /* FIXME: Attributes check ! */
416 /* All criteria are met. */
420 ad_close_metadata(adp);
424 /* ------------------------------ */
425 static int rslt_add ( struct vol *vol, struct path *path, char **buf, int ext)
431 u_int16_t resultsize;
432 int isdir = S_ISDIR(path->st.st_mode);
434 /* Skip resultsize */
436 p += sizeof(resultsize);
441 *p++ = isdir ? FILDIRBIT_ISDIR : FILDIRBIT_ISFILE; /* IsDir ? */
448 ret = getdirparams(vol, c1.dbitmap, path, path->d_dir, p , &tbuf );
451 /* FIXME slow if we need the file ID, we already know it, done ? */
452 ret = getfilparams ( vol, c1.fbitmap, path, path->d_dir, p, &tbuf);
458 /* Make sure entry length is even */
465 resultsize = htons(tbuf);
466 memcpy ( *buf, &resultsize, sizeof(resultsize) );
478 "./../.AppleDouble/.AppleDB/Network Trash Folder/TheVolumeSettingsFolder/TheFindByContentFolder/.AppleDesktop/.Parent/"
480 /* This function performs search. It is called directly from afp_catsearch
481 * vol - volume we are searching on ...
482 * dir - directory we are starting from ...
483 * c1, c2 - search criteria
484 * rmatches - maximum number of matches we can return
485 * pos - position we've stopped recently
486 * rbuf - output buffer
487 * rbuflen - output buffer length
489 #define NUM_ROUNDS 200
490 static int catsearch(struct vol *vol, struct dir *dir,
491 int rmatches, u_int32_t *pos, char *rbuf, u_int32_t *nrecs, int *rsize, int ext)
493 static u_int32_t cur_pos; /* Saved position index (ID) - used to remember "position" across FPCatSearch calls */
494 static DIR *dirpos; /* UNIX structure describing currently opened directory. */
496 struct dirent *entry;
500 char *vpath = vol->v_realpath;
503 int num_rounds = NUM_ROUNDS;
508 if (*pos != 0 && *pos != cur_pos) {
509 result = AFPERR_CATCHNG;
513 /* FIXME: Category "offspring count ! */
516 /* We need to initialize all mandatory structures/variables and change working directory appropriate... */
519 if (dirpos != NULL) {
524 if (addstack(vpath, dir, -1) == -1) {
525 result = AFPERR_MISC;
528 /* FIXME: Sometimes DID is given by client ! (correct this one above !) */
531 /* Save current path */
532 if ((cwd = open(".", O_RDONLY)) < 0) {
533 result = AFPERR_MISC;
537 /* So we are beginning... */
538 start_time = time(NULL);
540 while ((cidx = reducestack()) != -1) {
544 error = chdir(dstack[cidx].path);
546 if (!error && dirpos == NULL) {
547 dirpos = opendir(".");
548 cached = (dstack[cidx].dir->d_child != NULL);
550 if (error || dirpos == NULL) {
553 dstack[cidx].checked = 1;
558 result = AFPERR_NFILE;
563 result = AFPERR_MISC;
564 } /* switch (errno) */
568 while ((entry=readdir(dirpos)) != NULL) {
571 if (!check_dirent(vol, entry->d_name))
574 memset(&path, 0, sizeof(path));
575 path.u_name = entry->d_name;
576 if (of_stat(&path) != 0) {
587 result = AFPERR_MISC;
591 if (S_ISDIR(path.st.st_mode)) {
592 /* here we can short cut
593 ie if in the same loop the parent dir wasn't in the cache
594 ALL dirsearch_byname will fail.
597 path.d_dir = dirsearch_byname(vol, dstack[cidx].dir, path.u_name);
601 /* path.m_name is set by adddir */
602 if (NULL == (path.d_dir = adddir( vol, dstack[cidx].dir, &path) ) ) {
603 result = AFPERR_MISC;
607 path.m_name = path.d_dir->d_m_name;
609 if (addstack(path.u_name, path.d_dir, cidx) == -1) {
610 result = AFPERR_MISC;
615 /* yes it sucks for directory d_dir is the directory, for file it's the parent directory*/
616 path.d_dir = dstack[cidx].dir;
618 ccr = crit_check(vol, &path);
620 /* bit 0 means that criteria has been met */
622 r = rslt_add ( vol, &path, &rrbuf, ext);
625 result = AFPERR_MISC;
629 /* Number of matches limit */
631 goto catsearch_pause;
632 /* Block size limit */
633 if (rrbuf - rbuf >= 448)
634 goto catsearch_pause;
636 /* MacOS 9 doesn't like servers executing commands longer than few seconds */
637 if (--num_rounds <= 0) {
638 if (start_time != time(NULL)) {
640 goto catsearch_pause;
642 num_rounds = NUM_ROUNDS;
644 } /* while ((entry=readdir(dirpos)) != NULL) */
647 dstack[cidx].checked = 1;
648 } /* while (current_idx = reducestack()) != -1) */
650 /* We have finished traversing our tree. Return EOF here. */
658 catsearch_end: /* Exiting catsearch: error condition */
659 *rsize = rrbuf - rbuf;
661 if ((fchdir(cwd)) != 0) {
662 LOG(log_debug, logtype_afpd, "error chdiring back: %s", strerror(errno));
669 /* -------------------------- */
670 static int catsearch_afp(AFPObj *obj _U_, char *ibuf, size_t ibuflen,
671 char *rbuf, size_t *rbuflen, int ext)
676 u_int32_t rmatches, reserved;
681 unsigned char *spec1, *spec2, *bspec1, *bspec2;
689 /* min header size */
694 memset(&c1, 0, sizeof(c1));
695 memset(&c2, 0, sizeof(c2));
698 memcpy(&vid, ibuf, sizeof(vid));
701 if ((vol = getvolbyvid(vid)) == NULL) {
705 memcpy(&rmatches, ibuf, sizeof(rmatches));
706 rmatches = ntohl(rmatches);
707 ibuf += sizeof(rmatches);
709 /* FIXME: (rl) should we check if reserved == 0 ? */
710 ibuf += sizeof(reserved);
712 memcpy(catpos, ibuf, sizeof(catpos));
713 ibuf += sizeof(catpos);
715 memcpy(&c1.fbitmap, ibuf, sizeof(c1.fbitmap));
716 c1.fbitmap = c2.fbitmap = ntohs(c1.fbitmap);
717 ibuf += sizeof(c1.fbitmap);
719 memcpy(&c1.dbitmap, ibuf, sizeof(c1.dbitmap));
720 c1.dbitmap = c2.dbitmap = ntohs(c1.dbitmap);
721 ibuf += sizeof(c1.dbitmap);
723 memcpy(&c1.rbitmap, ibuf, sizeof(c1.rbitmap));
724 c1.rbitmap = c2.rbitmap = ntohl(c1.rbitmap);
725 ibuf += sizeof(c1.rbitmap);
727 if (! (c1.fbitmap || c1.dbitmap)) {
728 return AFPERR_BITMAP;
732 memcpy(&spec_len, ibuf, sizeof(spec_len));
733 spec_len = ntohs(spec_len);
736 /* with catsearch only name and parent id are allowed */
737 c1.fbitmap &= (1<<FILPBIT_LNAME) | (1<<FILPBIT_PDID);
738 c1.dbitmap &= (1<<DIRPBIT_LNAME) | (1<<DIRPBIT_PDID);
739 spec_len = *(unsigned char*)ibuf;
742 /* Parse file specifications */
743 spec1 = (unsigned char*)ibuf;
744 spec2 = (unsigned char*)ibuf + spec_len + 2;
751 /* File attribute bits... */
752 if (c1.rbitmap & (1 << FILPBIT_ATTR)) {
753 memcpy(&c1.attr, spec1, sizeof(c1.attr));
754 spec1 += sizeof(c1.attr);
755 memcpy(&c2.attr, spec2, sizeof(c2.attr));
756 spec2 += sizeof(c1.attr);
760 if (c1.rbitmap & (1 << FILPBIT_PDID)) {
761 memcpy(&c1.pdid, spec1, sizeof(pdid));
762 spec1 += sizeof(c1.pdid);
763 memcpy(&c2.pdid, spec2, sizeof(pdid));
764 spec2 += sizeof(c2.pdid);
765 } /* FIXME: PDID - do we demarshall this argument ? */
768 if (c1.rbitmap & (1 << FILPBIT_CDATE)) {
769 memcpy(&c1.cdate, spec1, sizeof(c1.cdate));
770 spec1 += sizeof(c1.cdate);
771 c1.cdate = AD_DATE_TO_UNIX(c1.cdate);
772 memcpy(&c2.cdate, spec2, sizeof(c2.cdate));
773 spec2 += sizeof(c1.cdate);
774 ibuf += sizeof(c1.cdate);;
775 c2.cdate = AD_DATE_TO_UNIX(c2.cdate);
778 /* Modification date */
779 if (c1.rbitmap & (1 << FILPBIT_MDATE)) {
780 memcpy(&c1.mdate, spec1, sizeof(c1.mdate));
781 c1.mdate = AD_DATE_TO_UNIX(c1.mdate);
782 spec1 += sizeof(c1.mdate);
783 memcpy(&c2.mdate, spec2, sizeof(c2.mdate));
784 c2.mdate = AD_DATE_TO_UNIX(c2.mdate);
785 spec2 += sizeof(c1.mdate);
789 if (c1.rbitmap & (1 << FILPBIT_BDATE)) {
790 memcpy(&c1.bdate, spec1, sizeof(c1.bdate));
791 spec1 += sizeof(c1.bdate);
792 c1.bdate = AD_DATE_TO_UNIX(c1.bdate);
793 memcpy(&c2.bdate, spec2, sizeof(c2.bdate));
794 spec2 += sizeof(c2.bdate);
795 c1.bdate = AD_DATE_TO_UNIX(c2.bdate);
799 if (c1.rbitmap & (1 << FILPBIT_FINFO)) {
802 memcpy(buf, spec1, sizeof(buf));
803 unpack_buffer(&c1.finfo, buf);
804 spec1 += sizeof(buf);
806 memcpy(buf, spec2, sizeof(buf));
807 unpack_buffer(&c2.finfo, buf);
808 spec2 += sizeof(buf);
811 if ((c1.rbitmap & (1 << DIRPBIT_OFFCNT)) != 0) {
812 /* Offspring count - only directories */
813 if (c1.fbitmap == 0) {
814 memcpy(&c1.offcnt, spec1, sizeof(c1.offcnt));
815 spec1 += sizeof(c1.offcnt);
816 c1.offcnt = ntohs(c1.offcnt);
817 memcpy(&c2.offcnt, spec2, sizeof(c2.offcnt));
818 spec2 += sizeof(c2.offcnt);
819 c2.offcnt = ntohs(c2.offcnt);
821 else if (c1.dbitmap == 0) {
822 /* ressource fork length */
825 return AFPERR_BITMAP; /* error */
827 } /* Offspring count/ressource fork length */
830 if (c1.rbitmap & (1 << FILPBIT_LNAME)) {
831 /* Get the long filename */
832 memcpy(tmppath, bspec1 + spec1[1] + 1, (bspec1 + spec1[1])[0]);
833 tmppath[(bspec1 + spec1[1])[0]]= 0;
834 len = convert_string ( vol->v_maccharset, CH_UCS2, tmppath, -1, c1.lname, sizeof(c1.lname));
835 if (len == (size_t)(-1))
839 /* FIXME: do we need it ? It's always null ! */
840 memcpy(c2.lname, bspec2 + spec2[1] + 1, (bspec2 + spec2[1])[0]);
841 c2.lname[(bspec2 + spec2[1])[0]]= 0;
845 if (c1.rbitmap & (1 << FILPBIT_PDINFO)) {
848 memcpy(&namelen, spec1, sizeof(namelen));
849 namelen = ntohs (namelen);
851 spec1 = bspec1+namelen+4; /* Skip Unicode Hint */
854 memcpy(&namelen, spec1, sizeof(namelen));
855 namelen = ntohs (namelen);
856 if (namelen > 255) /* Safeguard */
859 memcpy (c1.utf8name, spec1+2, namelen);
860 c1.utf8name[(namelen+1)] =0;
862 /* convert charset */
863 flags = CONV_PRECOMPOSE;
864 len = convert_charset(CH_UTF8_MAC, CH_UCS2, CH_UTF8, c1.utf8name, namelen, c1.utf8name, 512, &flags);
865 if (len == (size_t)(-1))
871 ret = catsearch(vol, vol->v_dir, rmatches, &catpos[0], rbuf+24, &nrecs, &rsize, ext);
872 memcpy(rbuf, catpos, sizeof(catpos));
873 rbuf += sizeof(catpos);
875 c1.fbitmap = htons(c1.fbitmap);
876 memcpy(rbuf, &c1.fbitmap, sizeof(c1.fbitmap));
877 rbuf += sizeof(c1.fbitmap);
879 c1.dbitmap = htons(c1.dbitmap);
880 memcpy(rbuf, &c1.dbitmap, sizeof(c1.dbitmap));
881 rbuf += sizeof(c1.dbitmap);
883 nrecs = htonl(nrecs);
884 memcpy(rbuf, &nrecs, sizeof(nrecs));
885 rbuf += sizeof(nrecs);
889 } /* catsearch_afp */
891 /* -------------------------- */
892 int afp_catsearch (AFPObj *obj, char *ibuf, size_t ibuflen,
893 char *rbuf, size_t *rbuflen)
895 return catsearch_afp( obj, ibuf, ibuflen, rbuf, rbuflen, 0);
899 int afp_catsearch_ext (AFPObj *obj, char *ibuf, size_t ibuflen,
900 char *rbuf, size_t *rbuflen)
902 return catsearch_afp( obj, ibuf, ibuflen, rbuf, rbuflen, 1);
905 /* FIXME: we need a clean separation between afp stubs and 'real' implementation */
906 /* (so, all buffer packing/unpacking should be done in stub, everything else
907 should be done in other functions) */