New option "veto messages" can be used to enable sending messages.
Then whenever a client tries to access any file or directory
with a vetoed name, it will be sent an AFP message indicating
the name and the directory.
Feature request #81.
* NEW: New global/volume option "ignored attributes"
* FIX: "afp listen" option failed to take IPv6 addresses. Bug #515.
* FIX: Fix a possible crash in set_groups. Bug #518.
+* NEW: Send optional AFP messages for vetoed files, new option
+ "veto messages" can be used to enable sending messages.
+ Then whenever a client tries to access any file or directory
+ with a vetoed name, it will be sent an AFP message indicating
+ the name and the directory. From FR #81.
Changes in 3.0.4
================
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>veto message = <replaceable>BOOLEAN</replaceable> (default:
+ <emphasis>no</emphasis>) <type>(G)</type></term>
+
+ <listitem>
+ <para>Use section <option>name</option> as option preset for all
+ volumes (when set in the [Global] section) or for one volume (when
+ set in that volume's section).</para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>vol dbpath = <replaceable>path</replaceable>
<type>(G)</type></term>
/* the name is illegal */
LOG(log_info, logtype_afpd, "cname: illegal path: '%s'", ret.u_name);
afp_errno = AFPERR_PARAM;
+ if (vol->v_obj->options.flags & OPTION_VETOMSG) {
+ bstring message = bformat("Attempt to access vetoed file or directory \"%s\" in directory \"%s\"",
+ ret.u_name, bdata(dir->d_u_name));
+ if (setmessage(bdata(message)) == 0)
+ /* Client may make multiple attempts, only send the message the first time */
+ kill(getpid(), SIGUSR2);
+ bdestroy(message);
+ }
return NULL;
}
static char servermesg[MAXPATHLEN] = "";
static char localized_message[MAXPATHLEN] = "";
-void setmessage(const char *message)
+/*!
+ * Copy AFP message to message buffer
+ * @param message (r) message to send
+ * @returns 0 if this message is being set the first time, return 1 if the preceeding
+ * message was the same
+ */
+int setmessage(const char *message)
{
+ if (strncmp(message, servermesg, MAXMESGSIZE) == 0)
+ return 1;
strlcpy(servermesg, message, MAXMESGSIZE);
+ return 0;
}
void readmessage(AFPObj *obj)
*rbuflen += 1;
}
*rbuflen += outlen;
- *message = 0;
+// *message = 0;
return AFP_OK;
}
#define OPTION_CLOSEVOL (1 << 1)
#define OPTION_SERVERNOTIF (1 << 2)
#define OPTION_NOSENDFILE (1 << 3)
-/* #define OPTION_CUSTOMICON (1 << 4) */
+#define OPTION_VETOMSG (1 << 4) /* whether to send an AFP message for veto file access */
#define OPTION_AFP_READ_LOCK (1 << 5) /* whether to do AFP spec conforming read locks (default: no) */
#define OPTION_ANNOUNCESSH (1 << 6)
#define OPTION_UUID (1 << 7)
extern int get_afp_errno (const int param);
extern void afp_options_init (struct afp_options *);
extern void afp_options_parse_cmdline(AFPObj *obj, int ac, char **av);
-extern void setmessage (const char *);
+extern int setmessage (const char *);
extern void readmessage (AFPObj *);
/* afp_util.c */
options->flags |= OPTION_DBUS_AFPSTATS;
if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "afp read locks", 0))
options->flags |= OPTION_AFP_READ_LOCK;
+ if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "veto message", 0))
+ options->flags |= OPTION_VETOMSG;
if (!atalk_iniparser_getboolean(config, INISEC_GLOBAL, "save password", 1))
options->passwdbits |= PASSWD_NOSAVE;
if (atalk_iniparser_getboolean(config, INISEC_GLOBAL, "set password", 0))
Use share reservations on Solaris\&. Solaris CIFS server uses this too, so this makes a lock coherent multi protocol server\&.
.RE
.PP
+veto message = \fIBOOLEAN\fR (default: \fIno\fR) \fB(G)\fR
+.RS 4
+Use section
+\fBname\fR
+as option preset for all volumes (when set in the [Global] section) or for one volume (when set in that volume\*(Aqs section)\&.
+.RE
+.PP
vol dbpath = \fIpath\fR \fB(G)\fR
.RS 4
Sets the database information to be stored in path\&. You have to specify a writable location, even if the volume is read only\&. The default is