/*
- $Id: cmd_dbd.c,v 1.18 2009-12-01 13:37:20 franklahm Exp $
+ $Id: cmd_dbd.c,v 1.19 2009-12-03 12:47:36 franklahm Exp $
Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
exit(EXIT_FAILURE);
}
+ /* Sanity checks to ensure we can touch this volume */
+ if (volinfo.v_vfs_ea != AFPVOL_EA_AD && volinfo.v_vfs_ea != AFPVOL_EA_SYS) {
+ dbd_log( LOGSTD, "Unknown Extended Attributes option: %u", volinfo.v_vfs_ea);
+ exit(EXIT_FAILURE);
+ }
+
/* Put "/.AppleDB" at end of volpath, get path from volinfo file */
if ( (strlen(volinfo.v_dbpath) + strlen("/.AppleDB")) > (PATH_MAX - 1) ) {
dbd_log( LOGSTD, "Volume pathname too long");
/*
- * $Id: volinfo.h,v 1.9 2009-12-01 16:36:14 franklahm Exp $
+ * $Id: volinfo.h,v 1.10 2009-12-03 12:47:37 franklahm Exp $
*/
#ifndef _ATALK_VOLINFO_H
charset_t v_maccharset;
int v_adouble; /* default adouble format */
int v_ad_options;
+ int v_vfs_ea;
char *(*ad_path)(const char *, int);
char *v_dbd_host;
int v_dbd_port;
};
-extern const vol_opt_name_t vol_opt_names[];
-extern const vol_opt_name_t vol_opt_casefold[];
-
extern int loadvolinfo(char *path, struct volinfo *vol);
extern int savevolinfo(const struct vol *vol, const char *Cnid_srv, const char *Cnid_port);
extern int vol_load_charsets(struct volinfo *vol);
/*
- * $Id: volume.h,v 1.7 2009-11-17 12:33:30 franklahm Exp $
+ * $Id: volume.h,v 1.8 2009-12-03 12:47:37 franklahm Exp $
*
* Copyright (c) 1990,1994 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#define AFPVOL_ACLS (1 << 25) /* Volume supports ACLS */
/* Extended Attributes vfs indirection */
-#define AFPVOL_EA_AD 0 /* Store them in adouble files. Default. */
-#define AFPVOL_EA_SYS 1 /* Store them in native EAs */
+#define AFPVOL_EA_AD 1 /* Store them in adouble files. Default. */
+#define AFPVOL_EA_SYS 2 /* Store them in native EAs */
/* FPGetSrvrParms options */
#define AFPSRVR_CONFIGINFO (1 << 0)
#include <atalk/cnid.h>
#endif /* CNID_DB*/
-/* Global: eg volume.c needs em */
-
-const vol_opt_name_t vol_opt_names[] = {
+static const vol_opt_name_t vol_opt_names[] = {
{AFPVOL_A2VOL, "PRODOS"}, /* prodos volume */
{AFPVOL_CRLF, "CRLF"}, /* cr/lf translation */
{AFPVOL_NOADOUBLE, "NOADOUBLE"}, /* don't create .AppleDouble by default */
{0, NULL}
};
-const vol_opt_name_t vol_opt_casefold[] = {
+static const vol_opt_name_t vol_opt_casefold[] = {
{AFPVOL_MTOUUPPER, "MTOULOWER"},
{AFPVOL_MTOULOWER, "MTOULOWER"},
{AFPVOL_UTOMUPPER, "UTOMUPPER"},
#define CNID_DBPATH 6
#define VOLUME_OPTS 7
#define VOLCASEFOLD 8
+#define EXTATTRTYPE 9
static const info_option_t info_options[] = {
{"MAC_CHARSET", MAC_CHARSET},
{"CNID_DBPATH", CNID_DBPATH},
{"VOLUME_OPTS", VOLUME_OPTS},
{"VOLCASEFOLD", VOLCASEFOLD},
- {NULL, 0}
+ {"EXTATTRTYPE", EXTATTRTYPE},
+ {NULL, 0}
};
static char* find_in_path( char *path, char *subdir, size_t maxlen)
case VOLCASEFOLD:
parse_options(value, &vol->v_casefold, &vol_opt_casefold[0]);
break;
+ case EXTATTRTYPE:
+ if (strcasecmp(value, "AFPVOL_EA_AD") == 0)
+ vol->v_vfs_ea = AFPVOL_EA_AD;
+ else if (strcasecmp(value, "AFPVOL_EA_SYS") == 0)
+ vol->v_vfs_ea = AFPVOL_EA_SYS;
+ break;
default:
fprintf (stderr, "unknown volume information: %s, %s", buf, value);
return (-1);
strlcat(item, "\n", sizeof(item));
strlcat(buf, item, sizeof(buf));
+ /* ExtendedAttrbutes */
+ strcpy(item, "EXTATTRTYPE:");
+ if (vol->v_vfs_ea & AFPVOL_EA_AD)
+ strlcat(item, "AFPVOL_EA_AD", sizeof(item));
+ else if (vol->v_vfs_ea & AFPVOL_EA_SYS)
+ strlcat(item, "AFPVOL_EA_SYS", sizeof(item));
+ else
+ strlcat(item, "AFPVOL_EA_UNKNOWN", sizeof(item));
+ strlcat(buf, item, sizeof(buf));
+
if (strlen(buf) >= sizeof(buf)-1)
LOG(log_debug, logtype_afpd,"Error writing .volinfo file: buffer too small, %s", buf);
-
-
if (write( fd, buf, strlen(buf)) < 0 || ftruncate(fd, strlen(buf)) < 0 ) {
LOG(log_debug, logtype_afpd,"Error writing .volinfo file: %s", strerror(errno));
}