/*
- * $Id: file.c,v 1.25 2001-08-14 14:00:10 rufustfirefly Exp $
+ * $Id: file.c,v 1.28 2001-09-04 13:52:45 rufustfirefly Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
0, 0, 0, 0, 0, 0, 0, 0
};
-int getfilparams(vol, bitmap, path, dir, st, buf, buflen )
- struct vol *vol;
- u_int16_t bitmap;
- char *path;
- struct dir *dir;
- struct stat *st;
- char *buf;
- int *buflen;
+int getfilparams(struct vol *vol,
+ u_int16_t bitmap,
+ char *path, struct dir *dir, struct stat *st,
+ char *buf, int *buflen )
{
#ifndef USE_LASTDID
struct stat hst, lst, *lstp;
struct ofork *of;
struct extmap *em;
char *data, *nameoff = NULL, *upath;
- int bit = 0, isad = 1, aint;
+ int bit = 0, isad = 1;
+ u_int32_t aint;
u_int16_t ashort;
u_char achar, fdType[4];
if ( ad_open( upath, ADFLAGS_HF, O_RDONLY, 0, adp) < 0 ) {
isad = 0;
} else if ( fstat( ad_hfileno( adp ), &hst ) < 0 ) {
- syslog( LOG_ERR, "getfilparams fstat: %m" );
+ syslog( LOG_ERR, "getfilparams fstat: %s", strerror(errno) );
}
data = buf;
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) {
/*
if (!validupath(vol, upath))
return AFPERR_EXIST;
+ /* check for vetoed filenames */
+ if (veto_file(vol->v_veto, upath))
+ return AFPERR_EXIST;
+
if ((of = of_findname(vol, curdir, path))) {
adp = of->of_ad;
} else {
}
-int setfilparams(vol, path, bitmap, buf )
- struct vol *vol;
- char *path, *buf;
- u_int16_t bitmap;
+int setfilparams(struct vol *vol,
+ char *path, u_int16_t bitmap, char *buf )
{
struct adouble ad, *adp;
struct ofork *of;
#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...:");