Can be used to ignore Finder locks by setting "ignored attributes = all".
From FR#80.
Changes in 3.0.5
================
* FIX: Fix a crash when using pam_winbind. Fixes bug #516.
+* NEW: New global/volume option "ignored attributes"
Changes in 3.0.4
================
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>ignored attributes = <replaceable>all | nowrite | nodelete | norename</replaceable>
+ <type>(G)/(V)</type></term>
+
+ <listitem>
+ <para>Speficy a set of file and directory attributes that shall
+ be ignored by the server, <attribute>all</attribute> includes all
+ the other options.</para>
+ <para>In OS X when the Finder sets a lock on a file/directory or you
+ set the BSD uchg flag in the Terminal, all three attributes are
+ used. Thus in order to ignore the Finder lock/BSD uchg flag, add
+ set <emphasis>ignored attributes = all</emphasis>.</para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>mimic model = <replaceable>model</replaceable>
<type>(G)</type></term>
ashort = htons(ATTRBIT_INVISIBLE);
} else
ashort = 0;
+ ashort &= ~htons(vol->v_ignattr);
memcpy( data, &ashort, sizeof( ashort ));
data += sizeof( ashort );
break;
ad_getattr(&ad, &bshort);
oshort = bshort;
if ( ntohs( ashort ) & ATTRBIT_SETCLR ) {
+ ashort &= ~htons(vol->v_ignattr);
bshort |= htons( ntohs( ashort ) & ~ATTRBIT_SETCLR );
} else {
bshort &= ~ashort;
ad_getattr(&ad, &ashort);
ad_close(&ad, ADFLAGS_HF);
- if ((ashort & htons(ATTRBIT_NODELETE))) {
+ if (!(vol->v_ignattr & ATTRBIT_NODELETE) && (ashort & htons(ATTRBIT_NODELETE))) {
return AFPERR_OLOCK;
}
}
ashort = htons(ATTRBIT_INVISIBLE);
} else
ashort = 0;
+ ashort &= ~htons(vol->v_ignattr);
#if 0
/* FIXME do we want a visual clue if the file is read only
*/
ad_getattr(adp, &bshort);
oshort = bshort;
if ( ntohs( ashort ) & ATTRBIT_SETCLR ) {
+ ashort &= ~htons(vol->v_ignattr);
bshort |= htons( ntohs( ashort ) & ~ATTRBIT_SETCLR );
} else {
bshort &= ~ashort;
WRITE lock on read only file.
*/
-static int check_attrib(struct adouble *adp)
+static int check_attrib(const struct vol *vol, struct adouble *adp)
{
uint16_t bshort = 0;
/*
* Does kFPDeleteInhibitBit (bit 8) set?
*/
- if ((bshort & htons(ATTRBIT_NODELETE))) {
+ if (!(vol->v_ignattr & ATTRBIT_NODELETE) && (bshort & htons(ATTRBIT_NODELETE))) {
return AFPERR_OLOCK;
}
- if ((bshort & htons(ATTRBIT_DOPEN | ATTRBIT_ROPEN))) {
+ if ((bshort & htons(ATTRBIT_DOPEN | ATTRBIT_ROPEN))) {
return AFPERR_BUSY;
}
return 0;
* ad_open would create a 0 byte resource fork
*/
if ( ad_metadataat(dirfd, file, ADFLAGS_CHECK_OF, &ad) == 0 ) {
- if ((err = check_attrib(&ad))) {
+ if ((err = check_attrib(vol, &ad))) {
ad_close(&ad, ADFLAGS_HF | ADFLAGS_CHECK_OF);
return err;
}
ad_getattr(adp, &bshort);
ad_close(adp, ADFLAGS_HF);
- if ((bshort & htons(ATTRBIT_NORENAME))) {
+ if (!(vol->v_ignattr & ATTRBIT_NORENAME) && (bshort & htons(ATTRBIT_NORENAME))) {
rc = AFPERR_OLOCK;
goto exit;
}
char *logfile;
char *mimicmodel;
char *adminauthuser;
+ char *ignored_attr;
struct afp_volume_name volfile;
};
int v_preexec_close;
char *v_uuid; /* For TimeMachine zeroconf record */
int v_qfd;
+ uint32_t v_ignattr; /* AFP attributes that shall be ignored */
};
/* load_volumes() flags */
if (getoption_bool(obj->iniconfig, section, "root preexec close", preset, 0))
volume->v_root_preexec_close = 1;
+ if ((val = getoption(obj->iniconfig, section, "ignored attributes", preset, obj->options.ignored_attr))) {
+ if (strstr(val, "all")) {
+ volume->v_ignattr |= ATTRBIT_NOWRITE | ATTRBIT_NORENAME | ATTRBIT_NODELETE;
+ }
+ if (strstr(val, "nowrite")) {
+ volume->v_ignattr |= ATTRBIT_NOWRITE;
+ }
+ if (strstr(val, "norename")) {
+ volume->v_ignattr |= ATTRBIT_NORENAME;
+ }
+ if (strstr(val, "nodelete")) {
+ volume->v_ignattr |= ATTRBIT_NODELETE;
+ }
+ }
+
/*
* Handle read-only behaviour. semantics:
* 1) neither the rolist nor the rwlist exist -> rw
options->ntseparator = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "nt separator", NULL);
options->mimicmodel = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "mimic model", NULL);
options->adminauthuser = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "admin auth user",NULL);
+ options->ignored_attr = atalk_iniparser_getstrdup(config, INISEC_GLOBAL, "ignored attributes", NULL);
options->connections = atalk_iniparser_getint (config, INISEC_GLOBAL, "max connections",200);
options->passwdminlen = atalk_iniparser_getint (config, INISEC_GLOBAL, "passwd minlen", 0);
options->tickleval = atalk_iniparser_getint (config, INISEC_GLOBAL, "tickleval", 30);
CONFIG_ARG_FREE(obj->options.Cnid_port);
if (obj->options.fqdn)
CONFIG_ARG_FREE(obj->options.fqdn);
+ if (obj->options.ignored_attr)
+ CONFIG_ARG_FREE(obj->options.ignored_attr);
if (obj->options.unixcodepage)
CONFIG_ARG_FREE(obj->options.unixcodepage);
and should be quoted\&. Extended characters are allowed\&.
.RE
.PP
+ignored attributes = \fIall | nowrite | nodelete | norename\fR \fB(G)/(V)\fR
+.RS 4
+Speficy a set of file and directory attributes that shall be ignored by the server,
+<attribute>all</attribute>
+includes all the other options\&.
+.sp
+In OS X when the Finder sets a lock on a file/directory or you set the BSD uchg flag in the Terminal, all three attributes are used\&. Thus in order to ignore the Finder lock/BSD uchg flag, add set
+\fIignored attributes = all\fR\&.
+.RE
+.PP
mimic model = \fImodel\fR \fB(G)\fR
.RS 4
Specifies the icon model that appears on clients\&. Defaults to off\&. Note that afpd must support Zeroconf\&. Examples: RackMac (same as Xserve), PowerBook, PowerMac, Macmini, iMac, MacBook, MacBookPro, MacBookAir, MacPro, AppleTV1,1, AirPort\&.