X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fcatsearch.c;h=bec7b15245b195e1311fde72d72eba838108a9d2;hb=d3dff4ba4b8db3131a16641d35a6554be5fb5160;hp=1a2b898910f14e574743424f4ad2480ea65a3203;hpb=935187883217fb64a5fb9fc858b93509601d3f32;p=netatalk.git diff --git a/etc/afpd/catsearch.c b/etc/afpd/catsearch.c index 1a2b8989..bec7b152 100644 --- a/etc/afpd/catsearch.c +++ b/etc/afpd/catsearch.c @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include @@ -137,7 +137,6 @@ static void clearstack(void) static int addstack(char *uname, struct dir *dir, int pidx) { struct dsitem *ds; - size_t l, u; struct dsitem *tmpds = NULL; /* check if we have some space on stack... */ @@ -194,7 +193,7 @@ static struct adouble *adl_lkup(struct vol *vol, struct path *path, struct adoub isdir = S_ISDIR(path->st.st_mode); - if (!isdir && (of = of_findname(path))) { + if (!isdir && (of = of_findname(vol, path))) { adp = of->of_ad; } else { ad_init(&ad, vol); @@ -551,7 +550,7 @@ static int catsearch(const AFPObj *obj, dirpos = opendir("."); if (dirpos == NULL) - dirpos = opendir(bdata(currentdir->d_fullpath)); + dirpos = opendir(cfrombstr(currentdir->d_fullpath)); if (error || dirpos == NULL) { switch (errno) { @@ -583,7 +582,7 @@ static int catsearch(const AFPObj *obj, memset(&path, 0, sizeof(path)); path.u_name = entry->d_name; - if (of_stat(&path) != 0) { + if (of_stat(vol, &path) != 0) { switch (errno) { case EACCES: case ELOOP: @@ -744,11 +743,14 @@ static int catsearch_db(const AFPObj *obj, LOG(log_debug, logtype_afpd, "catsearch_db: %s", buffer); - if ((num_matches = cnid_find(vol->v_cdb, - buffer, - strlen(uname), - resbuf, - sizeof(resbuf))) == -1) { + AFP_CNID_START("cnid_find"); + num_matches = cnid_find(vol->v_cdb, + buffer, + strlen(uname), + resbuf, + sizeof(resbuf)); + AFP_CNID_DONE(); + if (num_matches == -1) { result = AFPERR_MISC; goto catsearch_end; } @@ -764,8 +766,12 @@ static int catsearch_db(const AFPObj *obj, memcpy(&cnid, resbuf + cur_pos * sizeof(cnid_t), sizeof(cnid_t)); did = cnid; - if ((name = cnid_resolve(vol->v_cdb, &did, resolvebuf, 12 + MAXPATHLEN + 1)) == NULL) + AFP_CNID_START("cnid_resolve"); + name = cnid_resolve(vol->v_cdb, &did, resolvebuf, 12 + MAXPATHLEN + 1); + AFP_CNID_DONE(); + if (name == NULL) goto next; + LOG(log_debug, logtype_afpd, "catsearch_db: {pos: %u, name:%s, cnid: %u}", cur_pos, name, ntohl(cnid)); if ((dir = dirlookup(vol, did)) == NULL) @@ -777,7 +783,7 @@ static int catsearch_db(const AFPObj *obj, path.u_name = name; path.m_name = utompath(vol, name, cnid, utf8_encoding(vol->v_obj)); - if (of_stat(&path) != 0) { + if (of_stat(vol, &path) != 0) { switch (errno) { case EACCES: case ELOOP: