From: uhees Date: Mon, 27 Aug 2001 15:26:16 +0000 (+0000) Subject: removed unneeded cnid_lookups; fixed a bug in afp_createid. X-Git-Tag: netatalk-1-5-rc1~251 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=23241a97632f2ea87d2fedc7b2a7bd4b6511aa82 removed unneeded cnid_lookups; fixed a bug in afp_createid. --- diff --git a/etc/afpd/enumerate.c b/etc/afpd/enumerate.c index de5873ae..b67672e1 100644 --- a/etc/afpd/enumerate.c +++ b/etc/afpd/enumerate.c @@ -1,5 +1,5 @@ /* - * $Id: enumerate.c,v 1.7 2001-08-15 01:37:34 srittau Exp $ + * $Id: enumerate.c,v 1.8 2001-08-27 15:26:16 uhees Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -62,24 +62,15 @@ adddir( vol, dir, name, namlen, upath, upathlen, st ) strcpy( cdir->d_name, name ); cdir->d_name[namlen] = '\0'; - cdir->d_did = 0; + cdir->d_did = 0; -#ifdef CNID_DB - /* find out if we have a fixed did already */ - cdir->d_did = cnid_lookup(vol->v_db, st, dir->d_did, upath, - upathlen); -#endif /* CNID_DB */ - - if (cdir->d_did == 0) { #if AD_VERSION > AD_VERSION1 - memset(&ad, 0, sizeof(ad)); - if (ad_open(upath, ADFLAGS_HF|ADFLAGS_DIR, O_RDONLY, 0, &ad) < 0) { - /* if we can't parse the AppleDouble header, return 0 for the DID */ - cdir->d_did = 0; - } else { - /* ... else retrieve the DID entry into cdir->d_did */ - memcpy(&cdir->d_did, ad_entry(&ad, ADEID_DID), sizeof(cdir->d_did)); - ad_close(&ad, ADFLAGS_HF); + /* look in AD v2 header */ + memset(&ad, 0, sizeof(ad)); + if (ad_open(upath, ADFLAGS_HF|ADFLAGS_DIR, O_RDONLY, 0, &ad) >= 0) { + /* if we can parse the AppleDouble header, retrieve the DID entry into cdir->d_did */ + memcpy(&cdir->d_did, ad_entry(&ad, ADEID_DID), sizeof(cdir->d_did)); + ad_close(&ad, ADFLAGS_HF); } #endif /* AD_VERSION */ @@ -88,7 +79,6 @@ adddir( vol, dir, name, namlen, upath, upathlen, st ) cdir->d_did = cnid_add(vol->v_db, st, dir->d_did, upath, upathlen, cdir->d_did); #endif /* CNID_DB */ - } if (cdir->d_did == 0) { #ifdef USE_LASTDID diff --git a/etc/afpd/file.c b/etc/afpd/file.c index 2a3c83a2..d25c50f6 100644 --- a/etc/afpd/file.c +++ b/etc/afpd/file.c @@ -1,5 +1,5 @@ /* - * $Id: file.c,v 1.26 2001-08-15 01:37:34 srittau Exp $ + * $Id: file.c,v 1.27 2001-08-27 15:26:16 uhees Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -200,25 +200,16 @@ int getfilparams(struct vol *vol, case FILPBIT_FNUM : aint = 0; -#ifdef CNID_DB - /* find out if we have a fixed did already */ - aint = cnid_lookup(vol->v_db, st, dir->d_did, upath, - strlen(upath)); -#endif /* CNID_DB */ - - /* look in AD v2 header */ - if (aint == 0) - { #if AD_VERSION > AD_VERSION1 - if (isad) + /* look in AD v2 header */ + if (isad) memcpy(&aint, ad_entry(adp, ADEID_DID), sizeof(aint)); #endif /* AD_VERSION > AD_VERSION1 */ #ifdef CNID_DB - aint = cnid_add(vol->v_db, st, dir->d_did, upath, + aint = cnid_add(vol->v_db, st, dir->d_did, upath, strlen(upath), aint); #endif /* CNID_DB */ - } if (aint == 0) { /* @@ -1339,19 +1330,17 @@ int afp_createid(obj, ibuf, ibuflen, rbuf, rbuflen ) #if AD_VERSION > AD_VERSION1 memset(&ad, 0, sizeof(ad)); - if (ad_open( upath, ADFLAGS_HF, O_RDONLY, 0, &ad ) < 0) - id = 0; - else { + if (ad_open( upath, ADFLAGS_HF, O_RDONLY, 0, &ad ) >= 0) { memcpy(&id, ad_entry(&ad, ADEID_DID), sizeof(id)); ad_close(&ad, ADFLAGS_HF); } +#endif /* AD_VERSION > AD_VERSION1 */ if (id = cnid_add(vol->v_db, &st, did, upath, len, id)) { memcpy(rbuf, &id, sizeof(id)); *rbuflen = sizeof(id); return AFP_OK; } -#endif /* AD_VERSION > AD_VERSION1 */ #ifdef DEBUG syslog(LOG_INFO, "ending afp_createid...:"); diff --git a/etc/afpd/fork.c b/etc/afpd/fork.c index 67446661..f0bab5ec 100644 --- a/etc/afpd/fork.c +++ b/etc/afpd/fork.c @@ -1,5 +1,5 @@ /* - * $Id: fork.c,v 1.7 2001-08-15 01:37:34 srittau Exp $ + * $Id: fork.c,v 1.8 2001-08-27 15:26:16 uhees Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -176,27 +176,17 @@ static int getforkparams(ofork, bitmap, buf, buflen, attrbits ) case FILPBIT_FNUM : aint = 0; -#ifdef CNID_DB - /* find out if we have a fixed did already */ - aint = cnid_lookup(ofork->of_vol->v_db, &st, - ofork->of_dir->d_did, - upath, strlen(upath)); -#endif /* CNID_DB */ - - /* look in AD v2 header */ - if (aint == 0) - { #if AD_VERSION > AD_VERSION1 - if (isad) + /* look in AD v2 header */ + if (isad) memcpy(&aint, ad_entry(ofork->of_ad, ADEID_DID), sizeof(aint)); #endif /* AD_VERSION > AD_VERSION1 */ #ifdef CNID_DB - aint = cnid_add(ofork->of_vol->v_db, &st, + aint = cnid_add(ofork->of_vol->v_db, &st, ofork->of_dir->d_did, upath, strlen(upath), aint); #endif /* CNID_DB */ - } if (aint == 0) { #ifdef AFS