* FIX: Problems with unexpected EOF when reading files on a ddp connection
Photoshop, old finder.
* FIX: --with-nls-dir option does now work
+* NEW: Allow afpd debugging to be enabled by sending the afpd process
+ a SIGUSR1.
+* NEW: Allow SLP to be disabled per afpd process by adding a new -noslp flag
+ to afpd.conf.
+* FIX: Use server name (if not NULL) for the SLP URL.
Changes from 1.5.2
==================
# if you don't want the proxy server to act as
# a ddp server as well, set -uamlist to an
# empty string.
+# -noslp Don't register this server with the Service
+# Location Protocol.
#
#
# Authentication Methods:
/*
- * $Id: afp_config.c,v 1.7.2.4 2002-03-12 14:19:46 srittau Exp $
+ * $Id: afp_config.c,v 1.7.2.5 2002-08-05 18:45:24 jmarcus Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
SLPError err;
SLPError callbackerr;
SLPHandle hslp;
+
+ /* Do nothing if we didn't register. */
+ if (srvloc_url[0] == '\0')
+ return;
+
err = SLPOpen("en", SLP_FALSE, &hslp);
if (err != SLP_OK) {
syslog(LOG_ERR, "dsi_cleanup: Error opening SRVLOC handle");
SLPHandle hslp;
struct servent *afpovertcp;
int afp_port = 548;
+ char *srvloc_hostname;
#endif /* USE_SRVLOC */
if ((config = (AFPConfig *) calloc(1, sizeof(AFPConfig))) == NULL) {
}
#ifdef USE_SRVLOC
- err = SLPOpen("en", SLP_FALSE, &hslp);
- if (err != SLP_OK) {
- syslog(LOG_ERR, "DSIConfigInit: Error opening SRVLOC handle");
- goto srvloc_reg_err;
- }
-
- /* XXX We don't want to tack on the port number if we don't have to. Why?
- * Well, this seems to break MacOS < 10. If the user _really_ wants to
- * use a non-default port, they can, but be aware, this server might not
- * show up int the Network Browser. */
- afpovertcp = getservbyname("afpovertcp", "tcp");
- if (afpovertcp != NULL) {
- afp_port = afpovertcp->s_port;
- }
- if (strlen(options->hostname) > (sizeof(srvloc_url) - strlen(inet_ntoa(dsi->server.sin_addr)) - 21)) {
- syslog(LOG_ERR, "DSIConfigInit: Hostname is too long for SRVLOC");
- goto srvloc_reg_err;
- }
- if (dsi->server.sin_port == afp_port) {
- sprintf(srvloc_url, "afp://%s/?NAME=%s", inet_ntoa(dsi->server.sin_addr), options->hostname);
- }
- else {
- sprintf(srvloc_url, "afp://%s:%d/?NAME=%s", inet_ntoa(dsi->server.sin_addr), ntohs(dsi->server.sin_port), options->hostname);
- }
-
- err = SLPReg(hslp,
- srvloc_url,
- SLP_LIFETIME_MAXIMUM,
- "",
- "",
- SLP_TRUE,
- SRVLOC_callback,
- &callbackerr);
- if (err != SLP_OK) {
- syslog(LOG_ERR, "DSIConfigInit: Error registering %s with SRVLOC", srvloc_url);
- goto srvloc_reg_err;
- }
-
- if (callbackerr != SLP_OK) {
- syslog(LOG_ERR, "DSIConfigInit: Error in callback trying to register %s with SRVLOC", srvloc_url);
- goto srvloc_reg_err;
- }
-
- syslog(LOG_INFO, "Sucessfully registered %s with SRVLOC", srvloc_url);
+ srvloc_url[0] = '\0'; /* Mark that we haven't registered. */
+ if (!(options->flags & OPTION_NOSLP)) {
+ err = SLPOpen("en", SLP_FALSE, &hslp);
+ if (err != SLP_OK) {
+ syslog( LOG_ERR, "DSIConfigInit: Error opening SRVLOC handle");
+ goto srvloc_reg_err;
+ }
+ /* XXX We don't want to tack on the port number if we don't have to.
+ * Why?
+ * Well, this seems to break MacOS < 10. If the user _really_ wants to
+ * use a non-default port, they can, but be aware, this server might
+ * not show up int the Network Browser.
+ */
+ afpovertcp = getservbyname("afpovertcp", "tcp");
+ srvloc_hostname = (options->server ? options->server : (char *)options->hostname);
+ if (afpovertcp != NULL) {
+ afp_port = afpovertcp->s_port;
+ }
+ if (strlen(srvloc_hostname) > (sizeof(srvloc_url) - strlen(inet_ntoa(dsi->server.sin_addr)) - 21)) {
+ syslog( LOG_ERR, "DSIConfigInit: Hostname is too long for SRVLOC");
+ srvloc_url[0] = '\0';
+ goto srvloc_reg_err;
+ }
+ if (dsi->server.sin_port == afp_port) {
+ sprintf(srvloc_url, "afp://%s/?NAME=%s", inet_ntoa(dsi->server.sin_addr), srvloc_hostname);
+ }
+ else {
+ sprintf(srvloc_url, "afp://%s:%d/?NAME=%s", inet_ntoa(dsi->server.sin_addr), ntohs(dsi->server.sin_port), srvloc_hostname);
+ }
+
+ err = SLPReg(hslp,
+ srvloc_url,
+ SLP_LIFETIME_MAXIMUM,
+ "",
+ "",
+ SLP_TRUE,
+ SRVLOC_callback,
+ &callbackerr);
+ if (err != SLP_OK) {
+ syslog( LOG_ERR, "DSIConfigInit: Error registering %s with SRVLOC", srvloc_url);
+ srvloc_url[0] = '\0';
+ goto srvloc_reg_err;
+ }
+
+ if (callbackerr != SLP_OK) {
+ syslog( LOG_ERR, "DSIConfigInit: Error in callback trying to register %s with SRVLOC", srvloc_url);
+ srvloc_url[0] = '\0';
+ goto srvloc_reg_err;
+ }
+
+ syslog(LOG_INFO, "Sucessfully registered %s with SRVLOC", srvloc_url);
srvloc_reg_err:
- SLPClose(hslp);
+ SLPClose(hslp);
+ }
#endif /* USE_SRVLOC */
/*
- * $Id: afp_dsi.c,v 1.9.2.4 2002-01-23 18:34:14 jmarcus Exp $
+ * $Id: afp_dsi.c,v 1.9.2.5 2002-08-05 18:45:24 jmarcus Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
}
}
+
+/*
+ * Signal handler for SIGUSR1 - set the debug flag and
+ * redirect stdout to <tmpdir>/afpd-debug-<pid>.
+ */
+void afp_set_debug (int sig)
+{
+ char fname[MAXPATHLEN];
+
+ snprintf(fname, MAXPATHLEN-1, "%safpd-debug-%d", P_tmpdir, getpid());
+ freopen(fname, "w", stdout);
+ child.obj->options.flags |= OPTION_DEBUG;
+
+ return;
+}
+
+
/* afp over dsi. this never returns. */
void afp_over_dsi(AFPObj *obj)
{
}
#endif /* SERVERTEXT */
+ /* SIGUSR1 - set "debug" flag on this process. */
+ action.sa_handler = afp_set_debug;
+ sigemptyset( &action.sa_mask );
+ sigaddset(&action.sa_mask, SIGUSR1);
+ action.sa_flags = SA_RESTART;
+ if ( sigaction( SIGUSR1, &action, 0) < 0 ) {
+ syslog( LOG_ERR, "afp_over_dsi: sigaction: %s", strerror(errno) );
+ afp_dsi_die(1);
+ }
+
/* tickle handler */
action.sa_handler = alarm_handler;
sigemptyset(&action.sa_mask);
/*
- * $Id: afp_options.c,v 1.13.2.7 2002-03-12 14:21:18 srittau Exp $
+ * $Id: afp_options.c,v 1.13.2.8 2002-08-05 18:45:24 jmarcus Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
/* parse toggles */
if (strstr(buf, " -nodebug"))
options->flags &= ~OPTION_DEBUG;
-
+#ifdef USE_SRVLOC
+ if (strstr(buf, " -noslp"))
+ options->flags |= OPTION_NOSLP;
+#endif /* USE_SRVLOC */
if (strstr(buf, " -nouservolfirst"))
options->flags &= ~OPTION_USERVOLFIRST;
if (strstr(buf, " -uservolfirst"))
/*
- * $Id: globals.h,v 1.6.2.5 2002-02-11 17:46:40 jmarcus Exp $
+ * $Id: globals.h,v 1.6.2.6 2002-08-05 18:45:24 jmarcus Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#define OPTION_NOUSERVOL (1 << 2)
#define OPTION_PROXY (1 << 3)
#define OPTION_CUSTOMICON (1 << 4)
+#define OPTION_NOSLP (1 << 5)
/* a couple of these options could get stuck in unions to save
* space. */
-.\" $Id: afpd.conf.5.tmpl,v 1.2 2001-06-26 23:58:32 srittau Exp $
+.\" $Id: afpd.conf.5.tmpl,v 1.2.2.1 2002-08-05 18:45:24 jmarcus Exp $
.TH afpd.conf 5 "28 September 2000" "netatalk 1.5"
.UC 4
.SH NAME
maximum value is 0xFFFFFFFFF. If you specify a value that is out of
range, the default value will be set (which is the minimum).
+.TP
+.B -noslp
+Do not register this server using the Service Location Protocol (if SLP
+support was compiled in). This is useful if you are running multiple
+servers and want one to be hidden, perhaps because it is advertised elsewhere.
+
.TP
.I Miscellaneous Options
.LP
Unix filenames that are longer than 31 characters are inaccessible from
the Macintosh.
+
+.SH SIGNALS
+Signals that are sent to the main
+.B afpd
+process are propagated to the children, so all will be affected.
+.TP 13
+.B SIGHUP
+The
+.B afpd
+process will send the message "The server is going down for maintenance."
+to the client and shut itself down in 5 minutes. New connections are not
+allowed. If this is sent to a child
+.BR afpd ,
+the other children are not affected. However, the main process will still
+exit, disabling all new connections.
+.TP 13
+.B SIGUSR1
+If the
+.B --with-message-dir
+configure option was used, the
+.B afpd
+process will set the
+.B debug
+option and redirect the messages to
+.RI /var/tmp/afpd-debug- pid .
+This should only be sent to a child
+.BR afpd .
+.B Warning:
+If the
+.B --with-message-dir
+option was not used, this will kill the
+.B afpd
+process.
+
+.TP 13
+.B SIGUSR2
+The
+.B afpd
+process will look in the
+.I msg
+directory for a file named
+.RI message. pid .
+For each one found, a the contents will be sent as a message to the
+associated AFP client. The file is removed after the message is sent.
+
.SH FILES
.TP 20
.B :ETCDIR:/AppleVolumes.default
.TP 20
.B ~/AppleVolumes
user's list of volumes to mount
+.TP 20
+.BI :ETCDIR:/msg/message. pid
+contains messages to be sent to users.
+.TP 20
+.BI /var/tmp/afpd-debug- pid
+contains debug output, if triggered.
.SH BUGS
A few calls from the AFP specification are not implemented, because the
Macintosh does not use them.