# string.
# -slp Register this server with the Service Location
# Protocol (if SLP support was compiled in).
+# -nozeroconf Don't register this server with the Multicats
+# DNS Protocol.
# -advertise_ssh Allows Mac OS X clients (10.3.3-10.4) to
# automagically establish a tunneled AFP connection
# through SSH. This option is not so significant
dnl Check for optional server location protocol support (used by MacOS X)
NETATALK_SRVLOC
+dnl Check for optional Zeroconf support
+NETATALK_ZEROCONF
+
dnl Check for PAM libs
netatalk_cv_use_pam=no
AC_PATH_PAM([
file.c enumerate.c desktop.c filedir.c fork.c appl.c gettok.c \
mangle.c status.c afp_options.c afp_asp.c afp_dsi.c messages.c \
afp_config.c nfsquota.c quota.c uam.c afs.c uid.c afp_util.c \
- catsearch.c afprun.c hash.c extattrs.c dircache.c
+ catsearch.c afprun.c hash.c extattrs.c dircache.c \
+ afp_zeroconf.c afp_avahi.c
afpd_LDADD = $(top_builddir)/libatalk/cnid/libcnid.la \
$(top_builddir)/libatalk/libatalk.la \
- @QUOTA_LIBS@ @SLP_LIBS@ @WRAP_LIBS@ @LIBADD_DL@ @ACL_LIBS@
+ @QUOTA_LIBS@ @SLP_LIBS@ @WRAP_LIBS@ @LIBADD_DL@ @ACL_LIBS@ @ZEROCONF_LIBS@
afpd_LDFLAGS = -export-dynamic
afpd_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/sys \
- @SLP_CFLAGS@ \
+ @SLP_CFLAGS@ @ZEROCONF_CFLAGS@ \
-D_PATH_AFPDDEFVOL=\"$(pkgconfdir)/AppleVolumes.default\" \
-D_PATH_AFPDSYSVOL=\"$(pkgconfdir)/AppleVolumes.system\" \
-D_PATH_AFPDPWFILE=\"$(pkgconfdir)/afppasswd\" \
return buf;
}
#endif /* USE_SRVLOC */
+#ifdef USE_ZEROCONF
+#include "afp_zeroconf.h"
+#endif /* USE_ZEROCONF */
-#ifdef USE_SRVLOC
static void dsi_cleanup(const AFPConfig *config)
{
+#ifdef USE_SRVLOC
SLPError err;
SLPError callbackerr;
SLPHandle hslp;
srvloc_dereg_err:
dsi->srvloc_url[0] = '\0';
SLPClose(hslp);
-}
+#elif defined (USE_ZEROCONF)
+ DSI *dsi = (DSI *)config->obj.handle;
+
+ /* Do nothing if we didn't register. */
+ if (!dsi || dsi->zeroconf_registered == 0)
+ return;
+
+ zeroconf_deregister();
#endif /* USE_SRVLOC */
+}
#ifndef NO_DDP
static void asp_cleanup(const AFPConfig *config)
}
#endif /* USE_SRVLOC */
+#ifdef USE_ZEROCONF
+ struct servent *afpovertcp;
+ int afp_port = 548;
+ char *hostname = NULL;
+
+ dsi->zeroconf_registered = 0; /* Mark that we haven't registered. */
+
+ if (!(options->flags & OPTION_NOZEROCONF)) {
+ /* 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 = ntohs(afpovertcp->s_port);
+ }
+
+ /* If specified use the FQDN to register with srvloc, otherwise use IP. */
+ p = NULL;
+ if (options->fqdn) {
+ hostname = options->fqdn;
+ p = strchr(hostname, ':');
+ }
+ else
+ hostname = inet_ntoa(dsi->server.sin_addr);
+
+ if (!(options->flags & OPTION_NOSLP)) {
+ zeroconf_register(afp_port, hostname);
+ dsi->zeroconf_registered = 1; /* Mark that we have registered. */
+ }
+ }
+ config->server_cleanup = dsi_cleanup;
+#endif /* USE_ZEROCONF */
config->fd = dsi->serversock;
config->obj.handle = dsi;
if (strstr(buf, " -slp"))
options->flags &= ~OPTION_NOSLP;
#endif
-
+#ifdef USE_ZEROCONF
+ if (strstr(buf, " -nozeroconf"))
+ options->flags |= OPTION_NOZEROCONF;
+#endif
if (strstr(buf, " -nouservolfirst"))
options->flags &= ~OPTION_USERVOLFIRST;
if (strstr(buf, " -uservolfirst"))
puts( "No" );
#endif
+#ifdef USE_ZEROCONF
+ puts( "Yes" );
+#else
+ puts( "No" );
+#endif
+
printf( " TCP wrappers support:\t" );
#ifdef TCPWRAP
puts( "Yes" );
#define OPTION_ANNOUNCESSH (1 << 6)
#define OPTION_UUID (1 << 7)
#define OPTION_ACL2OS9MODE (1 << 8)
+#define OPTION_NOZEROCONF (1 << 9)
#ifdef FORCE_UIDGID
/* set up a structure for this */
char srvloc_url[512];
#endif
+#ifdef USE_ZEROCONF
+ int zeroconf_registered;
+#endif
+
/* buffer for OSX deadlock */
char *buffer;
char *start;
AC_MSG_RESULT([ Options:])
AC_MSG_RESULT([ CUPS support: $netatalk_cv_use_cups])
AC_MSG_RESULT([ SLP support: $netatalk_cv_srvloc])
+ AC_MSG_RESULT([ Zeroconf support: $netatalk_cv_zeroconf])
AC_MSG_RESULT([ tcp wrapper support: $netatalk_cv_tcpwrap])
dnl if test x"$netatalk_cv_linux_sendfile" != x; then
dnl AC_MSG_RESULT([ Linux sendfile support: $netatalk_cv_linux_sendfile])