/*
- * $Id: file.c,v 1.116 2009-10-27 23:35:17 didg Exp $
+ * $Id: file.c,v 1.120 2009-11-02 14:35:27 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
struct maccess ma;
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin getmetadata:");
+ LOG(log_debug9, logtype_afpd, "begin getmetadata:");
#endif /* DEBUG */
upath = path->u_name;
char *buf, size_t *buflen )
{
struct adouble ad, *adp;
- struct ofork *of;
- char *upath;
int opened = 0;
int rc;
#ifdef DEBUG
- LOG(log_info, logtype_default, "begin getfilparams:");
+ LOG(log_debug9, logtype_default, "begin getfilparams:");
#endif /* DEBUG */
opened = PARAM_NEED_ADP(bitmap);
adp = NULL;
if (opened) {
- int flags = (bitmap & (1 << FILPBIT_ATTR))?ADFLAGS_OPENFORKS:0;
+ char *upath;
+ int flags = (bitmap & (1 << FILPBIT_ATTR))?ADFLAGS_OPENFORKS:0;
+
+ adp = of_ad(vol, path, &ad);
upath = path->u_name;
- if ((of = of_findname(path))) {
- adp = of->of_ad;
- } else {
- ad_init(&ad, vol->v_adouble, vol->v_ad_options);
- adp = &ad;
- }
if ( ad_metadata( upath, flags, adp) < 0 ) {
switch (errno) {
ad_close_metadata( adp);
}
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end getfilparams:");
+ LOG(log_debug9, logtype_afpd, "end getfilparams:");
#endif /* DEBUG */
return( rc );
u_int16_t vid;
struct path *s_path;
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin afp_createfile:");
-#endif /* DEBUG */
-
*rbuflen = 0;
ibuf++;
creatf = (unsigned char) *ibuf++;
setvoltime(obj, vol );
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end afp_createfile");
-#endif /* DEBUG */
-
return (retvalue);
}
int did, rc;
u_int16_t vid, bitmap;
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin afp_setfilparams:");
-#endif /* DEBUG */
-
*rbuflen = 0;
ibuf += 2;
setvoltime(obj, vol );
}
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end afp_setfilparams:");
-#endif /* DEBUG */
-
return( rc );
}
u_char finder_buf[32];
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin setfilparams:");
+ LOG(log_debug9, logtype_afpd, "begin setfilparams:");
#endif /* DEBUG */
- upath = path->u_name;
adp = of_ad(vol, path, &ad);
-
+ upath = path->u_name;
if (!vol_unix_priv(vol) && check_access(upath, OPENACC_WR ) < 0) {
return AFPERR_ACCESS;
}
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end setfilparams:");
+ LOG(log_debug9, logtype_afpd, "end setfilparams:");
#endif /* DEBUG */
return err;
}
int rc;
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin renamefile:");
+ LOG(log_debug9, logtype_afpd, "begin renamefile:");
#endif /* DEBUG */
if ( unix_rename( src, dst ) < 0 ) {
ad_close( adp, ADFLAGS_HF );
}
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end renamefile:");
+ LOG(log_debug9, logtype_afpd, "end renamefile:");
#endif /* DEBUG */
return( AFP_OK );
struct adouble ad, *adp;
int denyreadset;
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin afp_copyfile:");
-#endif /* DEBUG */
-
*rbuflen = 0;
ibuf += 2;
setvoltime(obj, d_vol );
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end afp_copyfile:");
-#endif /* DEBUG */
-
return( retvalue );
}
ssize_t cc;
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin copy_all:");
+ LOG(log_debug9, logtype_afpd, "begin copy_all:");
#endif /* DEBUG */
while (buflen > 0) {
}
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end copy_all:");
+ LOG(log_debug9, logtype_afpd, "end copy_all:");
#endif /* DEBUG */
return 0;
struct stat st;
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin copyfile:");
+ LOG(log_debug9, logtype_afpd, "begin copyfile:");
#endif /* DEBUG */
if (adp == NULL) {
}
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end copyfile:");
+ LOG(log_debug9, logtype_afpd, "end copyfile:");
#endif /* DEBUG */
done:
int adflags, err = AFP_OK;
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin deletefile:");
+ LOG(log_debug9, logtype_afpd, "begin deletefile:");
#endif /* DEBUG */
/* try to open both forks at once */
ad_close( &ad, adflags ); /* ad_close removes locks if any */
#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end deletefile:");
+ LOG(log_debug9, logtype_afpd, "end deletefile:");
#endif /* DEBUG */
return err;
u_short vid;
struct path *s_path;
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin afp_createid:");
-#endif /* DEBUG */
-
*rbuflen = 0;
ibuf += 2;
return AFP_OK;
}
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "ending afp_createid...:");
-#endif /* DEBUG */
return afp_errno;
}
cnid_t did = param->did;
cnid_t aint;
- memset(&path, 0, sizeof(path));
-
if ( stat(de->d_name, &path.st)<0 )
return 0;
static char buffer[12 + MAXPATHLEN + 1];
int len = 12 + MAXPATHLEN + 1;
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin afp_resolveid:");
-#endif /* DEBUG */
-
*rbuflen = 0;
ibuf += 2;
return AFPERR_NOID;
}
retry:
- memset(&path, 0, sizeof(path));
if (NULL == (upath = cnid_resolve(vol->v_cdb, &id, buffer, len)) ) {
return AFPERR_NOID; /* was AFPERR_BADID, but help older Macs */
}
if (NULL == ( dir = dirlookup( vol, id )) ) {
return AFPERR_NOID; /* idem AFPERR_PARAM */
}
- path.u_name = upath;
if (movecwd(vol, dir) < 0) {
switch (errno) {
case EACCES:
}
}
+ memset(&path, 0, sizeof(path));
+ path.u_name = upath;
if ( of_stat(&path) < 0 ) {
#ifdef ESTALE
/* with nfs and our working directory is deleted */
*rbuflen = buflen + sizeof(bitmap);
memcpy(rbuf, ibuf, sizeof(bitmap));
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end afp_resolveid:");
-#endif /* DEBUG */
-
return AFP_OK;
}
static char buffer[12 + MAXPATHLEN + 1];
int len = 12 + MAXPATHLEN + 1;
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin afp_deleteid:");
-#endif /* DEBUG */
-
*rbuflen = 0;
ibuf += 2;
}
}
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "end afp_deleteid:");
-#endif /* DEBUG */
-
return err;
}
uid_t uid;
gid_t gid;
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "begin afp_exchangefiles:");
-#endif /* DEBUG */
-
*rbuflen = 0;
ibuf += 2;
exit(EXITERR_SYS);
}
-#ifdef DEBUG
- LOG(log_info, logtype_afpd, "ending afp_exchangefiles:");
-#endif /* DEBUG */
-
err = AFP_OK;
goto err_exchangefile;