]> arthur.barton.de Git - netatalk.git/commitdiff
Merge master
authorFrank Lahm <franklahm@googlemail.com>
Fri, 2 Dec 2011 09:48:30 +0000 (10:48 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Fri, 2 Dec 2011 09:48:30 +0000 (10:48 +0100)
21 files changed:
NEWS
configure.ac
distrib/initscripts/.gitignore
distrib/initscripts/Makefile.am
distrib/initscripts/rc.atalk.debian.tmpl
distrib/initscripts/rc.atalk.redhat-systemd.tmpl [deleted file]
distrib/initscripts/rc.atalk.suse-sysv.tmpl [new file with mode: 0755]
distrib/initscripts/rc.atalk.suse.tmpl [deleted file]
distrib/initscripts/rc.atalk.systemd.tmpl [new file with mode: 0644]
distrib/initscripts/service.atalk.redhat-systemd.tmpl [deleted file]
distrib/initscripts/service.atalk.systemd.tmpl [new file with mode: 0644]
etc/afpd/appl.c
etc/afpd/dircache.c
etc/afpd/unix.c
etc/cnid_dbd/dbif.c
etc/uams/uams_passwd.c
libatalk/adouble/ad_sendfile.c
libatalk/dsi/dsi_cmdreply.c
libatalk/dsi/dsi_stream.c
macros/netatalk.m4
macros/summary.m4

diff --git a/NEWS b/NEWS
index a56a194658f5e0ef699b11a08ab78ea0283f7540..8cdd6881acff2b71da4aa1b4357b3de3f6c2936f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,10 @@ Changes in 2.2.2
        created for the original connecting user. Said differently: if you
        know the password of adminauthuser, you can authenticate as any other
        user.
+* NEW: configure option "--enable-suse-systemd" for openSUSE12.1 and later.
+       "--enable-redhat-systemd" and "--enable-suse-systemd" are same as
+       "--enable-systemd".
+       "--enable-suse" is renamed "--enable-suse-sysv".
 * NEW: experimental systemd service files in distrib/systemd/
 * UPD: afpd: Enhanced POSIX ACL mapping semantics, from Laura Mueller
 * UPD: afpd: Reset options every time a :DEFAULT: line is found in a
index 4a03c6de53b04ae8ffd8419ecd8c0a3d70af57ee..00939774012a59a7401d105cf5dc64ac02c3351d 100644 (file)
@@ -307,13 +307,13 @@ AM_CONDITIONAL(USE_PGP, test x$compile_pgp = xyes)
 AM_CONDITIONAL(DEFAULT_HOOK, test x$neta_cv_have_libgcrypt != xyes && test x$neta_cv_have_openssl != xyes)
 AM_CONDITIONAL(USE_NETBSD, test x$sysv_style = xnetbsd)
 AM_CONDITIONAL(USE_REDHAT_SYSV, test x$sysv_style = xredhat-sysv)
-AM_CONDITIONAL(USE_REDHAT_SYSTEMD, test x$sysv_style = xredhat-systemd)
-AM_CONDITIONAL(USE_SUSE, test x$sysv_style = xsuse)
+AM_CONDITIONAL(USE_SUSE_SYSV, test x$sysv_style = xsuse-sysv)
 AM_CONDITIONAL(USE_SHADOWPW, test x$shadowpw = xyes)
 AM_CONDITIONAL(USE_TRU64, test x$sysv_style = xtru64)
 AM_CONDITIONAL(USE_SOLARIS, test x$sysv_style = xsolaris)
 AM_CONDITIONAL(USE_GENTOO, test x$sysv_style = xgentoo)
 AM_CONDITIONAL(USE_DEBIAN, test x$sysv_style = xdebian)
+AM_CONDITIONAL(USE_SYSTEMD, test x$sysv_style = xsystemd || test x$sysv_style = xredhat-systemd || test x$sysv_style = xsuse-systemd)
 AM_CONDITIONAL(USE_UNDEF, test x$sysv_style = x)
 AM_CONDITIONAL(USE_BDB, test x$bdb_required = xyes)
 AM_CONDITIONAL(HAVE_ATFUNCS, test x"$ac_neta_haveatfuncs" = x"yes")
index 150a119881a3e839df9631f4cb5f9366fd9bf92d..8600d948d60807980141689b845e0d14e5f2fafb 100644 (file)
@@ -2,11 +2,11 @@ Makefile
 Makefile.in
 rc.atalk.bsd
 rc.atalk.redhat-sysv
-rc.atalk.redhat-systemd
-rc.atalk.suse
+rc.atalk.systemd
+rc.atalk.suse-sysv
 rc.atalk.tru64
 rc.atalk.sysv
-service.atalk.redhat-systemd
+service.atalk.systemd
 netatalk
 atalk
 netatalk.service
index 5d73af0b2f24059c9ec348c3c79c85140d6cf482..360dfccd478762cdfe8c61b06589394ac5fcc9ce 100644 (file)
@@ -19,34 +19,34 @@ pkgconfdir = @PKGCONFDIR@
 GENERATED_FILES = \
        rc.afpd.netbsd          \
        rc.atalk.redhat-sysv    \
-       rc.atalk.redhat-systemd \
+       rc.atalk.systemd        \
        rc.atalk.tru64          \
        rc.atalk.bsd            \
        rc.atalkd.netbsd        \
-       rc.atalk.suse           \
+       rc.atalk.suse-sysv      \
        rc.cnid_metad.netbsd    \
        rc.papd.netbsd          \
        rc.timelord.netbsd      \
        rc.atalk.sysv           \
        rc.atalk.gentoo         \
        rc.atalk.debian         \
-       service.atalk.redhat-systemd
+       service.atalk.systemd
 
 TEMPLATES = \
        rc.afpd.netbsd.tmpl             \
        rc.atalk.redhat-sysv.tmpl       \
-       rc.atalk.redhat-systemd.tmpl    \
+       rc.atalk.systemd.tmpl           \
        rc.atalk.tru64.tmpl             \
        rc.atalk.bsd.tmpl               \
        rc.atalkd.netbsd.tmpl           \
-       rc.atalk.suse.tmpl              \
+       rc.atalk.suse-sysv.tmpl         \
        rc.cnid_metad.netbsd.tmpl       \
        rc.papd.netbsd.tmpl             \
        rc.timelord.netbsd.tmpl         \
        rc.atalk.sysv.tmpl              \
        rc.atalk.gentoo.tmpl            \
        rc.atalk.debian.tmpl            \
-       service.atalk.redhat-systemd.tmpl
+       service.atalk.systemd.tmpl
 
 CLEANFILES = $(GENERATED_FILES) $(sysv_SCRIPTS) $(service_DATA) afpd atalkd cnid_metad papd timelord
 EXTRA_DIST = $(TEMPLATES)
@@ -80,10 +80,10 @@ uninstall-startup:
 endif
 
 #
-# checking for "redhat" style systemd scripts:
+# checking for general systemd scripts:
 #
 
-if USE_REDHAT_SYSTEMD
+if USE_SYSTEMD
 
 sysvdir        = $(pkglibexecdir)
 sysv_SCRIPTS = netatalk.sh
@@ -91,12 +91,12 @@ sysv_SCRIPTS = netatalk.sh
 servicedir     = /lib/systemd/system
 service_DATA   = netatalk.service
 
-$(sysv_SCRIPTS): rc.atalk.redhat-systemd
-       cp -f rc.atalk.redhat-systemd $(sysv_SCRIPTS)
+$(sysv_SCRIPTS): rc.atalk.systemd
+       cp -f rc.atalk.systemd $(sysv_SCRIPTS)
        chmod a+x $(sysv_SCRIPTS)
 
-$(service_DATA): service.atalk.redhat-systemd
-       cp -f service.atalk.redhat-systemd $(service_DATA)
+$(service_DATA): service.atalk.systemd
+       cp -f service.atalk.systemd $(service_DATA)
 
 install-data-hook:
        -systemctl daemon-reload
@@ -113,13 +113,13 @@ endif
 # checking for "SuSE" style sysv scripts:
 #
 
-if USE_SUSE
+if USE_SUSE_SYSV
 
 sysvdir        = /etc/init.d
 sysv_SCRIPTS = netatalk
 
-$(sysv_SCRIPTS): rc.atalk.suse
-       cp -f rc.atalk.suse $(sysv_SCRIPTS)
+$(sysv_SCRIPTS): rc.atalk.suse-sysv
+       cp -f rc.atalk.suse-sysv $(sysv_SCRIPTS)
        chmod a+x $(sysv_SCRIPTS)
 
 install-data-hook:
index 219f4ac944ae0255c75f4926ba5d749824c16dea..ac5d8da0ac6337ef81b0805a8cea0530ca3abd25 100644 (file)
@@ -4,7 +4,7 @@
 # Required-Start:    $remote_fs $syslog
 # Required-Stop:     $remote_fs $syslog
 # Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
+# Default-Stop:      1
 ### END INIT INFO
 #
 # netatalk      Netatalk :NETATALK_VERSION: initscript
diff --git a/distrib/initscripts/rc.atalk.redhat-systemd.tmpl b/distrib/initscripts/rc.atalk.redhat-systemd.tmpl
deleted file mode 100644 (file)
index e0bd7fb..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/sh
-
-# Netatalk :NETATALK_VERSION: startup script for systemd.
-
-# The method of using this script is not suitable.
-# This script will be deleted in the future.
-
-ATALK_BIN=:BINDIR:
-ATALK_CONF_DIR=:ETCDIR:
-ATALK_SBIN=:SBINDIR:
-
-# default
-ATALK_NAME=`echo ${HOSTNAME}|cut -d. -f1`
-ATALK_UNIX_CHARSET='LOCALE'
-ATALK_MAC_CHARSET='MAC_ROMAN'
-
-CNID_METAD_RUN=yes
-AFPD_RUN=yes
-AFPD_MAX_CLIENTS=20
-AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so"
-AFPD_GUEST=nobody
-CNID_CONFIG="-l log_note"
-
-ATALKD_RUN=no
-PAPD_RUN=no
-TIMELORD_RUN=no
-A2BOOT_RUN=no
-ATALK_ZONE=
-ATALK_BGROUND=no
-
-# read in netatalk configuration
-if [ -f ${ATALK_CONF_DIR}/netatalk.conf ]; then
-    . ${ATALK_CONF_DIR}/netatalk.conf
-fi
-
-netatalk_startup() {
-    if [ x"${ATALKD_RUN}" != x"no" -a -x ${ATALK_SBIN}/atalkd ]; then
-       ${ATALK_SBIN}/atalkd
-       
-       if [ -x ${ATALK_BIN}/nbprgstr ]; then
-           ${ATALK_BIN}/nbprgstr -p 4 ${ATALK_NAME}:Workstation${ATALK_ZONE}
-           ${ATALK_BIN}/nbprgstr -p 4 ${ATALK_NAME}:netatalk${ATALK_ZONE}
-       fi      
-       
-       if [ x"${PAPD_RUN}" = x"yes"  -a -x ${ATALK_SBIN}/papd ]; then
-           ${ATALK_SBIN}/papd
-       fi
-       
-       # check for timelord in bin directory
-       if [ x"${TIMELORD_RUN}" = x"yes"  -a -x ${ATALK_BIN}/timelord ]; then
-           ${ATALK_BIN}/timelord
-       fi
-       
-       # check for timelord in sbin directory
-       if [ x"${TIMELORD_RUN}" = x"yes"  -a -x ${ATALK_SBIN}/timelord ]; then
-           ${ATALK_SBIN}/timelord
-       fi
-       
-       # check for a2boot in bin directory
-       if [ x"${A2BOOT_RUN}" = x"yes"  -a -x ${ATALK_BIN}/a2boot ]; then
-           ${ATALK_BIN}/a2boot
-       fi
-       
-       # check for a2boot in sbin directory
-       if [ x"${A2BOOT_RUN}" = x"yes"  -a -x ${ATALK_SBIN}/a2boot ]; then
-           ${ATALK_SBIN}/a2boot
-       fi
-    fi
-    
-    if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ]; then
-       ${ATALK_SBIN}/cnid_metad $CNID_CONFIG
-    fi
-    
-    if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then
-       ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
-            -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
-    fi
-}
-
-if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then 
-    netatalk_startup >& /dev/null &
-else
-    netatalk_startup
-fi
diff --git a/distrib/initscripts/rc.atalk.suse-sysv.tmpl b/distrib/initscripts/rc.atalk.suse-sysv.tmpl
new file mode 100755 (executable)
index 0000000..68328e6
--- /dev/null
@@ -0,0 +1,159 @@
+#! /bin/sh
+# Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany.  All rights reserved.
+#
+# Author: 
+#      Reinhold Sojer, <reinhold@suse.de>
+#      Olaf Hering, <olh@suse.de>
+# 
+### BEGIN INIT INFO
+# Provides:       netatalk
+# Required-Start: $local_fs
+# Required-Stop: $local_fs
+# Should-Start:  $network $named $remote_fs $syslog slpd
+# Should-Stop:   $remote_fs $network $syslog
+# Default-Start:  3 5
+# Default-Stop:
+# Description:    AFP over TCP and legacy AppleTalk daemons
+### END INIT INFO
+
+# Netatalk :NETATALK_VERSION:
+
+ATALK_NAME=`hostname|sed 's/\..*$//'`
+ATALK_UNIX_CHARSET='LOCALE'
+ATALK_MAC_CHARSET='MAC_ROMAN'
+
+CNID_METAD_RUN=yes
+AFPD_RUN=yes
+AFPD_MAX_CLIENTS=20
+AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so"
+AFPD_GUEST=nobody
+CNID_CONFIG="-l log_note"
+
+ATALKD_RUN=no
+PAPD_RUN=no
+TIMELORD_RUN=no
+#A2BOOT_RUN=no
+ATALK_ZONE=
+ATALK_BGROUND=no
+
+. /etc/rc.status
+. :ETCDIR:/netatalk.conf
+
+# startup code for everything
+atalk_startup() {
+    if [ x"${ATALKD_RUN}" != x"no" ]; then 
+       echo -n "  Starting atalkd ... "
+       :SBINDIR:/atalkd ; my_ec=$?
+
+       if [ -x :BINDIR:/nbprgstr -a "$my_ec" = "0" ]; then     
+           echo -n ".. "
+           :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:Workstation
+           echo -n ". "
+           :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:netatalk
+       fi      
+       if [ "$my_ec" != "0" ] ; then false ; fi
+       rc_status -v
+       
+       rc_reset
+
+       if [ x"${PAPD_RUN}" = x"yes"  -a -x :SBINDIR:/papd ]; then
+           echo -n "  Starting papd"
+           :SBINDIR:/papd
+           rc_status -v
+       fi
+
+       rc_reset
+
+       if [ x"${TIMELORD_RUN}" = x"yes"  -a -x :SBINDIR:/timelord ]; then
+           echo -n "  Starting timelord"
+           :SBINDIR:/timelord
+           rc_status -v
+       fi
+
+       rc_reset
+
+    fi
+
+    if [ x"${CNID_METAD_RUN}" = x"yes" -a -x :SBINDIR:/cnid_metad ] ; then
+           echo -n "  Starting cnid_metad "
+           startproc :SBINDIR:/cnid_metad ${CNID_CONFIG}
+           rc_status -v
+    fi
+
+    if [ x"${AFPD_RUN}" = x"yes" -a -x :SBINDIR:/afpd ] ; then
+           echo -n "  Starting afpd ("
+           echo -n ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
+               -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
+           echo -n ")"
+           startproc :SBINDIR:/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
+               ${AFPD_OPTIONS} \
+               -c ${AFPD_MAX_CLIENTS} -n "${ATALK_NAME}${ATALK_ZONE}"
+           rc_status -v
+    fi
+
+       touch /var/lock/subsys/atalk 
+}
+
+case "$1" in
+    start)
+       if test ! -z "$UID" -a "$UID" != 0 ; then
+               echo "you have to be root to start netatalk daemons"
+               rc_failed
+       else
+       if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then 
+           echo -n "Starting netatalk in the background ..."
+           atalk_startup >& /dev/null &
+           rc_status -v
+       else
+           echo "Starting netatalk (this may take a while) ..."
+           atalk_startup
+       fi
+       fi
+       ;;
+    stop)
+       echo -n "Shutting down netatalk"
+       if test -x :SBINDIR:/papd ; then
+           killproc -TERM :SBINDIR:/papd
+       fi
+       if test -x :SBINDIR:/timelord ; then
+           killproc -TERM :SBINDIR:/timelord
+       fi
+       if test -x :SBINDIR:/atalkd ; then
+           killproc -TERM :SBINDIR:/atalkd
+       fi
+       killproc -TERM :SBINDIR:/cnid_metad
+       killproc -TERM :SBINDIR:/afpd
+
+       rc_status -v
+       ;;
+    restart|reload|force-reload)
+       $0 stop
+       $0 start
+       rc_status
+       ;;
+    status)
+       echo "Checking for netatalk services"
+       if [ x"${ATALKD_RUN}" = x"yes" -a -x :SBINDIR:/atalkd ] ; then
+           checkproc :SBINDIR:/atalkd && echo -n "atalkd: OK   " || echo -n "atalkd: No process        "
+       fi
+       if [ x"${PAPD_RUN}" = x"yes" -a -x :SBINDIR:/papd ] ; then
+           checkproc :SBINDIR:/papd && echo -n "papd: OK       " || echo -n "papd: No process  "
+       fi
+       if [ x"${TIMELORD_RUN}" = x"yes" -a -x :SBINDIR:/timelord ] ; then
+           checkproc :SBINDIR:/timelord && echo -n   " timelord: OK    " || echo -n " timelord: No process     "
+       fi
+       if [ x"${CNID_METAD_RUN}" = x"yes" ] ; then
+           checkproc :SBINDIR:/cnid_metad && echo -n " cnid_metad: OK  " || echo -n " cnid_metad: No process   "
+       fi
+       checkproc :SBINDIR:/afpd && echo "afpd: OK" || echo "afpd: No process"
+       # assume that afpd is the "main" process ...
+       checkproc :SBINDIR:/afpd
+       rc_status -v
+       ;;
+    *)
+       echo "Usage: $0 {start|stop|restart|status}"
+       exit 1
+       ;;
+esac
+
+rc_exit
diff --git a/distrib/initscripts/rc.atalk.suse.tmpl b/distrib/initscripts/rc.atalk.suse.tmpl
deleted file mode 100755 (executable)
index 68328e6..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-#! /bin/sh
-# Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany.  All rights reserved.
-#
-# Author: 
-#      Reinhold Sojer, <reinhold@suse.de>
-#      Olaf Hering, <olh@suse.de>
-# 
-### BEGIN INIT INFO
-# Provides:       netatalk
-# Required-Start: $local_fs
-# Required-Stop: $local_fs
-# Should-Start:  $network $named $remote_fs $syslog slpd
-# Should-Stop:   $remote_fs $network $syslog
-# Default-Start:  3 5
-# Default-Stop:
-# Description:    AFP over TCP and legacy AppleTalk daemons
-### END INIT INFO
-
-# Netatalk :NETATALK_VERSION:
-
-ATALK_NAME=`hostname|sed 's/\..*$//'`
-ATALK_UNIX_CHARSET='LOCALE'
-ATALK_MAC_CHARSET='MAC_ROMAN'
-
-CNID_METAD_RUN=yes
-AFPD_RUN=yes
-AFPD_MAX_CLIENTS=20
-AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so"
-AFPD_GUEST=nobody
-CNID_CONFIG="-l log_note"
-
-ATALKD_RUN=no
-PAPD_RUN=no
-TIMELORD_RUN=no
-#A2BOOT_RUN=no
-ATALK_ZONE=
-ATALK_BGROUND=no
-
-. /etc/rc.status
-. :ETCDIR:/netatalk.conf
-
-# startup code for everything
-atalk_startup() {
-    if [ x"${ATALKD_RUN}" != x"no" ]; then 
-       echo -n "  Starting atalkd ... "
-       :SBINDIR:/atalkd ; my_ec=$?
-
-       if [ -x :BINDIR:/nbprgstr -a "$my_ec" = "0" ]; then     
-           echo -n ".. "
-           :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:Workstation
-           echo -n ". "
-           :BINDIR:/nbprgstr -p 4 ${ATALK_NAME}:netatalk
-       fi      
-       if [ "$my_ec" != "0" ] ; then false ; fi
-       rc_status -v
-       
-       rc_reset
-
-       if [ x"${PAPD_RUN}" = x"yes"  -a -x :SBINDIR:/papd ]; then
-           echo -n "  Starting papd"
-           :SBINDIR:/papd
-           rc_status -v
-       fi
-
-       rc_reset
-
-       if [ x"${TIMELORD_RUN}" = x"yes"  -a -x :SBINDIR:/timelord ]; then
-           echo -n "  Starting timelord"
-           :SBINDIR:/timelord
-           rc_status -v
-       fi
-
-       rc_reset
-
-    fi
-
-    if [ x"${CNID_METAD_RUN}" = x"yes" -a -x :SBINDIR:/cnid_metad ] ; then
-           echo -n "  Starting cnid_metad "
-           startproc :SBINDIR:/cnid_metad ${CNID_CONFIG}
-           rc_status -v
-    fi
-
-    if [ x"${AFPD_RUN}" = x"yes" -a -x :SBINDIR:/afpd ] ; then
-           echo -n "  Starting afpd ("
-           echo -n ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
-               -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
-           echo -n ")"
-           startproc :SBINDIR:/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
-               ${AFPD_OPTIONS} \
-               -c ${AFPD_MAX_CLIENTS} -n "${ATALK_NAME}${ATALK_ZONE}"
-           rc_status -v
-    fi
-
-       touch /var/lock/subsys/atalk 
-}
-
-case "$1" in
-    start)
-       if test ! -z "$UID" -a "$UID" != 0 ; then
-               echo "you have to be root to start netatalk daemons"
-               rc_failed
-       else
-       if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then 
-           echo -n "Starting netatalk in the background ..."
-           atalk_startup >& /dev/null &
-           rc_status -v
-       else
-           echo "Starting netatalk (this may take a while) ..."
-           atalk_startup
-       fi
-       fi
-       ;;
-    stop)
-       echo -n "Shutting down netatalk"
-       if test -x :SBINDIR:/papd ; then
-           killproc -TERM :SBINDIR:/papd
-       fi
-       if test -x :SBINDIR:/timelord ; then
-           killproc -TERM :SBINDIR:/timelord
-       fi
-       if test -x :SBINDIR:/atalkd ; then
-           killproc -TERM :SBINDIR:/atalkd
-       fi
-       killproc -TERM :SBINDIR:/cnid_metad
-       killproc -TERM :SBINDIR:/afpd
-
-       rc_status -v
-       ;;
-    restart|reload|force-reload)
-       $0 stop
-       $0 start
-       rc_status
-       ;;
-    status)
-       echo "Checking for netatalk services"
-       if [ x"${ATALKD_RUN}" = x"yes" -a -x :SBINDIR:/atalkd ] ; then
-           checkproc :SBINDIR:/atalkd && echo -n "atalkd: OK   " || echo -n "atalkd: No process        "
-       fi
-       if [ x"${PAPD_RUN}" = x"yes" -a -x :SBINDIR:/papd ] ; then
-           checkproc :SBINDIR:/papd && echo -n "papd: OK       " || echo -n "papd: No process  "
-       fi
-       if [ x"${TIMELORD_RUN}" = x"yes" -a -x :SBINDIR:/timelord ] ; then
-           checkproc :SBINDIR:/timelord && echo -n   " timelord: OK    " || echo -n " timelord: No process     "
-       fi
-       if [ x"${CNID_METAD_RUN}" = x"yes" ] ; then
-           checkproc :SBINDIR:/cnid_metad && echo -n " cnid_metad: OK  " || echo -n " cnid_metad: No process   "
-       fi
-       checkproc :SBINDIR:/afpd && echo "afpd: OK" || echo "afpd: No process"
-       # assume that afpd is the "main" process ...
-       checkproc :SBINDIR:/afpd
-       rc_status -v
-       ;;
-    *)
-       echo "Usage: $0 {start|stop|restart|status}"
-       exit 1
-       ;;
-esac
-
-rc_exit
diff --git a/distrib/initscripts/rc.atalk.systemd.tmpl b/distrib/initscripts/rc.atalk.systemd.tmpl
new file mode 100644 (file)
index 0000000..e0bd7fb
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+# Netatalk :NETATALK_VERSION: startup script for systemd.
+
+# The method of using this script is not suitable.
+# This script will be deleted in the future.
+
+ATALK_BIN=:BINDIR:
+ATALK_CONF_DIR=:ETCDIR:
+ATALK_SBIN=:SBINDIR:
+
+# default
+ATALK_NAME=`echo ${HOSTNAME}|cut -d. -f1`
+ATALK_UNIX_CHARSET='LOCALE'
+ATALK_MAC_CHARSET='MAC_ROMAN'
+
+CNID_METAD_RUN=yes
+AFPD_RUN=yes
+AFPD_MAX_CLIENTS=20
+AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so"
+AFPD_GUEST=nobody
+CNID_CONFIG="-l log_note"
+
+ATALKD_RUN=no
+PAPD_RUN=no
+TIMELORD_RUN=no
+A2BOOT_RUN=no
+ATALK_ZONE=
+ATALK_BGROUND=no
+
+# read in netatalk configuration
+if [ -f ${ATALK_CONF_DIR}/netatalk.conf ]; then
+    . ${ATALK_CONF_DIR}/netatalk.conf
+fi
+
+netatalk_startup() {
+    if [ x"${ATALKD_RUN}" != x"no" -a -x ${ATALK_SBIN}/atalkd ]; then
+       ${ATALK_SBIN}/atalkd
+       
+       if [ -x ${ATALK_BIN}/nbprgstr ]; then
+           ${ATALK_BIN}/nbprgstr -p 4 ${ATALK_NAME}:Workstation${ATALK_ZONE}
+           ${ATALK_BIN}/nbprgstr -p 4 ${ATALK_NAME}:netatalk${ATALK_ZONE}
+       fi      
+       
+       if [ x"${PAPD_RUN}" = x"yes"  -a -x ${ATALK_SBIN}/papd ]; then
+           ${ATALK_SBIN}/papd
+       fi
+       
+       # check for timelord in bin directory
+       if [ x"${TIMELORD_RUN}" = x"yes"  -a -x ${ATALK_BIN}/timelord ]; then
+           ${ATALK_BIN}/timelord
+       fi
+       
+       # check for timelord in sbin directory
+       if [ x"${TIMELORD_RUN}" = x"yes"  -a -x ${ATALK_SBIN}/timelord ]; then
+           ${ATALK_SBIN}/timelord
+       fi
+       
+       # check for a2boot in bin directory
+       if [ x"${A2BOOT_RUN}" = x"yes"  -a -x ${ATALK_BIN}/a2boot ]; then
+           ${ATALK_BIN}/a2boot
+       fi
+       
+       # check for a2boot in sbin directory
+       if [ x"${A2BOOT_RUN}" = x"yes"  -a -x ${ATALK_SBIN}/a2boot ]; then
+           ${ATALK_SBIN}/a2boot
+       fi
+    fi
+    
+    if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ]; then
+       ${ATALK_SBIN}/cnid_metad $CNID_CONFIG
+    fi
+    
+    if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then
+       ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
+            -c ${AFPD_MAX_CLIENTS} -n ${ATALK_NAME}${ATALK_ZONE}
+    fi
+}
+
+if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then 
+    netatalk_startup >& /dev/null &
+else
+    netatalk_startup
+fi
diff --git a/distrib/initscripts/service.atalk.redhat-systemd.tmpl b/distrib/initscripts/service.atalk.redhat-systemd.tmpl
deleted file mode 100644 (file)
index 1af8576..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# This file is part of netatalk :NETATALK_VERSION:.
-
-# The method of using shell-script "netatalk.sh" is not suitable.
-# The future service files are due to start daemons directly.
-# See netatalk-xxx/distrib/systemd/ directory in tarball.
-
-[Unit]
-Description=File and Printer sharing for Macintosh clients
-After=syslog.target network.target
-
-[Service]
-Type=oneshot
-ExecStart=/bin/sh -c "exec :PKGLIBEXECDIR:/netatalk.sh"
-RemainAfterExit=yes
-
-[Install]
-WantedBy=multi-user.target
diff --git a/distrib/initscripts/service.atalk.systemd.tmpl b/distrib/initscripts/service.atalk.systemd.tmpl
new file mode 100644 (file)
index 0000000..1af8576
--- /dev/null
@@ -0,0 +1,17 @@
+# This file is part of netatalk :NETATALK_VERSION:.
+
+# The method of using shell-script "netatalk.sh" is not suitable.
+# The future service files are due to start daemons directly.
+# See netatalk-xxx/distrib/systemd/ directory in tarball.
+
+[Unit]
+Description=File and Printer sharing for Macintosh clients
+After=syslog.target network.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c "exec :PKGLIBEXECDIR:/netatalk.sh"
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
index 2f3079f47b6f35fc91af185609c24523789ac615..59de70e37a4d2ab04a9719f0b80d0b89ea519106 100644 (file)
@@ -250,6 +250,7 @@ int afp_addappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, siz
     mpath = obj->newtmp;
     mp = makemacpath( vol, mpath, AFPOBJ_TMPSIZ, curdir, path->m_name );
     if (!mp) {
+        close(tfd);
         return AFPERR_PARAM;
     }
     mplen =  mpath + AFPOBJ_TMPSIZ - mp;
@@ -263,6 +264,7 @@ int afp_addappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, siz
     memcpy(p, appltag, sizeof( appltag ));
     cc = mpath + AFPOBJ_TMPSIZ - p;
     if ( write( tfd, p, cc ) != cc ) {
+        close(tfd);
         unlink( tempfile );
         return( AFPERR_PARAM );
     }
index d3b8b6fc5fea30c64fefe9da4ec7d259fa9c15c4..05eaff01561a60d992dc98784ee545962f00e4d8 100644 (file)
@@ -693,5 +693,6 @@ void dircache_dump(void)
 
     fprintf(dump, "\n");
     fflush(dump);
+    fclose(dump);
     return;
 }
index 54914f1991779f3c392cd807457823ade7c09e4c..01688c94e66c2fef5c94e6bd5dc6f6e3f14e1f3b 100644 (file)
@@ -368,7 +368,10 @@ int setdirmode(const struct vol *vol, const char *name, mode_t mode)
         }
 
         if (!S_ISDIR(st.st_mode)) {
-           if (setfilmode(dirp->d_name, mode, &st, vol->v_umask) < 0) {
+           int setmode = (osx && *dirp->d_name == '.')?hf_mode:mode;
+
+           if (setfilmode(dirp->d_name, setmode, &st, vol->v_umask) < 0) {
+               closedir( dir );
                 LOG(log_error, logtype_afpd, "setdirmode: chmod %s: %s",dirp->d_name, strerror(errno) );
                 return -1;
            }
index 2fde17bc86f5327c599e7c051fd8c54e00671ec7..217fdd6d73d7255e6e1a16acc8c9acc3f7ada82b 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <atalk/logger.h>
 #include <atalk/util.h>
+#include <atalk/errchk.h>
 
 #include "db_param.h"
 #include "dbif.h"
  */
 static int dbif_stamp(DBD *dbd, void *buffer, int size)
 {
+    EC_INIT;
     struct stat st;
-    int         rc,cwd;
+    int cwd = -1;
 
     if (size < 8)
-        return -1;
+        EC_FAIL;
 
     /* Remember cwd */
     if ((cwd = open(".", O_RDONLY)) < 0) {
         LOG(log_error, logtype_cnid, "error opening cwd: %s", strerror(errno));
-        return -1;
+        EC_FAIL;
     }
 
     /* chdir to db_envhome */
     if ((chdir(dbd->db_envhome)) != 0) {
         LOG(log_error, logtype_cnid, "error chdiring to db_env '%s': %s", dbd->db_envhome, strerror(errno));        
-        return -1;
+        EC_FAIL;
     }
 
-    if ((rc = stat(dbd->db_table[DBIF_CNID].name, &st)) < 0) {
+    if (stat(dbd->db_table[DBIF_CNID].name, &st) < 0) {
         LOG(log_error, logtype_cnid, "error stating database %s: %s", dbd->db_table[DBIF_CNID].name, db_strerror(errno));
-        return -1;
+        EC_FAIL;
     }
 
     LOG(log_maxdebug, logtype_cnid,"stamp: %s", asctime(localtime(&st.st_ctime)));
@@ -61,12 +63,15 @@ static int dbif_stamp(DBD *dbd, void *buffer, int size)
     memset(buffer, 0, size);
     memcpy(buffer, &st.st_ctime, sizeof(st.st_ctime));
 
-    if ((fchdir(cwd)) != 0) {
-        LOG(log_error, logtype_cnid, "error chdiring back: %s", strerror(errno));        
-        return -1;
+EC_CLEANUP:
+    if (cwd != -1) {
+        if (fchdir(cwd) != 0) {
+            LOG(log_error, logtype_cnid, "error chdiring back: %s", strerror(errno));        
+            EC_STATUS(-1);
+        }
+        close(cwd);
     }
-
-    return 0;
+    EC_EXIT;
 }
 
 /*!
index 6db3ce62028f0e3567e3b1cd96876b1067667a8b..bec45a360813bd502affc3a9ac5eed8902f6fae3 100644 (file)
@@ -90,7 +90,7 @@ static int pwd_login(void *obj, char *username, int ulen, struct passwd **uam_pw
     }
     pwd->pw_passwd = sp->sp_pwdp;
 
-    if (sp && sp->sp_max != -1 && sp->sp_lstchg) {
+    if (sp->sp_max != -1 && sp->sp_lstchg) {
         time_t now = time(NULL) / (60*60*24);
         int32_t expire_days = sp->sp_lstchg - now + sp->sp_max;
         if ( expire_days < 0 ) {
@@ -319,7 +319,7 @@ static int passwd_printer(char      *start, char *stop, char *username, struct papfil
     }
     pwd->pw_passwd = sp->sp_pwdp;
 
-    if (sp && sp->sp_max != -1 && sp->sp_lstchg) {
+    if (sp->sp_max != -1 && sp->sp_lstchg) {
         time_t now = time(NULL) / (60*60*24);
         int32_t expire_days = sp->sp_lstchg - now + sp->sp_max;
         if ( expire_days < 0 ) {
index 5452b271860174ddfe1cd03736c7636f83ba652c..113f30c9bf0f130b122ce732c7c03f3b1c639bff 100644 (file)
@@ -57,24 +57,12 @@ ssize_t sys_sendfile(int tofd, int fromfd, off_t *offset, size_t count)
 }
 
 #elif defined(SENDFILE_FLAVOR_BSD )
-#include <sys/sendfile.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h><
 ssize_t sys_sendfile(int tofd, int fromfd, off_t *offset, size_t count)
 {
-size_t total=0;
-int    ret;
-
-    total = count;
-    while (total) {
-        ssize_t nwritten;
-        do {
-           ret = sendfile(fromfd, tofd, offset, count, NULL, &nwritten, 0);
-        while (ret == -1 && errno == EINTR);
-        if (ret == -1)
-            return -1;
-        total -= nwritten;
-        offset += nwritten;
-    }
-    return count;
+  return sendfile(fromfd, tofd, *offset, count, NULL, offset, 0);
 }
 
 #else
index eb8cfd385b0d6a7d73539ec18d4ffc255b1e6763..5b0d627de2c788e7356ffeb50219163d6007cb3c 100644 (file)
@@ -20,8 +20,8 @@ int dsi_cmdreply(DSI *dsi, const int err)
 {
     int ret;
 
-    LOG(log_debug, logtype_dsi, "dsi_cmdreply(DSI ID: %u, len: %jd): START",
-        dsi->clientID, (intmax_t)dsi->datalen);
+    LOG(log_debug, logtype_dsi, "dsi_cmdreply(DSI ID: %u, len: %zd): START",
+        dsi->clientID, dsi->datalen);
 
     dsi->header.dsi_flags = DSIFL_REPLY;
     dsi->header.dsi_len = htonl(dsi->datalen);
@@ -29,8 +29,8 @@ int dsi_cmdreply(DSI *dsi, const int err)
 
     ret = dsi_stream_send(dsi, dsi->data, dsi->datalen);
 
-    LOG(log_debug, logtype_dsi, "dsi_cmdreply(DSI ID: %u, len: %jd): END",
-        dsi->clientID, (intmax_t)dsi->datalen);
+    LOG(log_debug, logtype_dsi, "dsi_cmdreply(DSI ID: %u, len: %zd): END",
+        dsi->clientID, dsi->datalen);
 
     return ret;
 }
index ef25275241e170c5563e730eba8260494cfa3d4e..ccb8b76eae25d4dc091448ab8dff81e58ee2039a 100644 (file)
@@ -341,7 +341,7 @@ ssize_t dsi_stream_read_file(DSI *dsi, int fromfd, off_t offset, const size_t le
           goto exit;
       }          
       if (errno == EAGAIN || errno == EWOULDBLOCK) {
-#ifdef SOLARIS
+#if defined(SOLARIS) || defined(FREEBSD)
           if (pos > offset) {
               /* we actually have sent sth., adjust counters and keep trying */
               len = pos - offset;
index 512e479a7aae8cd5fd3a4b7f21774a4056f4e8fe..b88498aedd281e4a080a8d2d10ca7803bffad38e 100644 (file)
@@ -145,7 +145,7 @@ AC_ARG_ENABLE(shell-check,
 dnl Check for optional sysv initscript install
 AC_DEFUN([AC_NETATALK_SYSV_STYLE], [
     AC_ARG_WITH(sysv-style,
-                [  --with-sysv-style       use OS specific sysv config [[redhat-sysv|redhat-systemd|suse|gentoo|netbsd|debian]]],
+                [  --with-sysv-style       use OS specific sysv config [[redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo|netbsd|debian|systemd]]],
                 sysv_style="$withval", sysv_style=none
     )
     case "$sysv_style" in 
@@ -159,8 +159,14 @@ AC_DEFUN([AC_NETATALK_SYSV_STYLE], [
            AC_MSG_RESULT([enabling redhat-style systemd support])
            ;;
     "suse")
-           AC_MSG_RESULT([enabling suse-style sysv support])
+           AC_MSG_RESULT([--enable-suse is obsoleted. Use --enable-suse-sysv or --enable-suse-systemd])
         ;;
+    "suse-sysv")
+           AC_MSG_RESULT([enabling suse-style sysv configuration])
+           ;;
+    "suse-systemd")
+           AC_MSG_RESULT([enabling suse-style systemd support (>=openSUSE12.1)])
+           ;;
     "gentoo")
            AC_MSG_RESULT([enabling gentoo-style sysv support])
         ;;
@@ -170,6 +176,9 @@ AC_DEFUN([AC_NETATALK_SYSV_STYLE], [
     "debian")
            AC_MSG_RESULT([enabling debian-style sysv support])
         ;;
+    "systemd")
+           AC_MSG_RESULT([use general systemd configuration])
+        ;;
     *)
            AC_MSG_RESULT([disabling sysv support])
         ;;
index 8498c4246e171f9a71cd32dc1fc4eec37a06c451..39d69cdceb12f5f5f1cb690133934191d6899252 100644 (file)
@@ -30,7 +30,7 @@ AC_DEFUN([AC_NETATALK_CONFIG_SUMMARY], [
                 AC_MSG_RESULT([         DHX2    ($uams_using_options)])
         fi
        if test "x$neta_cv_have_openssl" = "xyes"; then
-               AC_MSG_RESULT([         RANDNUM])
+               AC_MSG_RESULT([         RANDNUM (afppasswd)])
        fi
        if test x"$netatalk_cv_build_krb5_uam" = x"yes"; then
                AC_MSG_RESULT([         Kerberos V])