AC_MSG_CHECKING([for cracklib support])
AC_MSG_RESULT([$netatalk_cv_with_cracklib])
-netatalk_cv_ddp_enabled=no
-AC_MSG_CHECKING([whether to enable DDP])
-AC_ARG_ENABLE(ddp,
- [ --enable-ddp enable DDP (AppleTalk)],[
- if test "$enableval" = "yes"; then
- AC_MSG_RESULT([yes])
- netatalk_cv_ddp_enabled=yes
- else
- AC_MSG_RESULT([yes])
- AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
- fi
- ],[
- AC_MSG_RESULT([no])
- AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
- ]
-)
-
-AC_MSG_CHECKING([whether to enable debug code])
-AC_ARG_ENABLE(debug1,
- [ --enable-debug1 enable debug code],[
- if test "$enableval" != "no"; then
- if test "$enableval" = "yes"; then
- AC_DEFINE(DEBUG1, 1, [Define if debugging information should be included])
- else
- AC_DEFINE_UNQUOTED(DEBUG1, $enableval, [Define if debugging information should be included])
- fi
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
- ],[
- AC_MSG_RESULT([no])
- ]
-)
-
AC_MSG_CHECKING([whether to enable verbose debug code])
AC_ARG_ENABLE(debug,
[ --enable-debug enable verbose debug code],[
AC_SYS_LARGEFILE([], AC_MSG_ERROR([AFP 3.x support requires Large File Support.]))
AC_CHECK_ICONV
-dnl ----------- A NOTE ABOUT DROPKLUDGE
-dnl The trouble with this fix is that if you know what the file is called, it
-dnl can be read from the Unix side. That's okay for most academic institutions
-dnl since the students don't have telnet access to the Mac servers. There is
-dnl currently no one working on further development/fixes of DROPKLUDGE.
-dnl -----------
-
-netatalk_cv_dropkludge=no
-AC_MSG_CHECKING([whether to enable experimental dropbox support])
-AC_ARG_ENABLE(dropkludge,
- [ --enable-dropkludge enable the experimental dropbox fix (INSECURE!) ],[
- if test "$enableval" = "yes"; then
- AC_DEFINE(DROPKLUDGE, 1, [Define if you want to use the experimental dropkludge support])
- AC_MSG_RESULT([yes])
- netatalk_cv_dropkludge=yes
- else
- AC_MSG_RESULT([no])
- fi
- ],[
- AC_MSG_RESULT([no])
- ]
-)
-
-netatalk_cv_force_uidgid=no
-AC_MSG_CHECKING([whether to enable forcing of uid/gid per volume])
-AC_ARG_ENABLE(force-uidgid,
- [ --enable-force-uidgid allow forcing of uid/gid per volume (BROKEN) ],[
- if test "$enableval" = "yes"; then
- AC_DEFINE(FORCE_UIDGID, 1, [Define if you want forcing of uid/gid per volume])
- AC_MSG_RESULT([enabling forcing of uid/gid per volume])
- AC_MSG_RESULT([yes])
- netatalk_cv_force_uidgid=yes
- else
- AC_MSG_RESULT([no])
- fi
- ],[
- AC_MSG_RESULT([no])
- ]
-)
-
dnl Check for CNID database backends
bdb_required=no
AC_NETATALK_CNID([bdb_required=yes],[bdb_required=no])
AC_CHECK_QUOTA
dnl Check for optional server location protocol support (used by MacOS X)
-NETATALK_SRVLOC
+AC_NETATALK_SRVLOC
dnl Check for optional Zeroconf support
-NETATALK_ZEROCONF
+AC_NETATALK_ZEROCONF
+
+dnl Check for optional TCP-wrappers support
+AC_NETATALK_TCP_WRAPPERS
dnl Check for PAM libs
netatalk_cv_use_pam=no
AC_DEFINE(USE_PAM, 1, [Define to enable PAM support])
])
+dnl Check for optional shadow password support
netatalk_cv_use_shadowpw=no
AC_ARG_WITH(shadow,
[ --with-shadow enable shadow password support [[auto]]],
AC_MSG_RESULT([no])
fi
-
-
+dnl Check for optional valid-shell-check support
netatalk_cv_use_shellcheck=yes
AC_MSG_CHECKING([whether checking for a valid shell should be enabled])
AC_ARG_ENABLE(shell-check,
]
)
-NETATALK_TCP_WRAPPERS
-
-AC_MSG_CHECKING([whether system (fcntl) locking should be disabled])
-AC_ARG_ENABLE(locking,
- [ --disable-locking disable system locking],[
- if test "$enableval" = "no"; then
- AC_DEFINE(DISABLE_LOCKING, 1, [Define if system (fcntl) locking should be disabled])
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
-
- ],[
- AC_MSG_RESULT([no])
- ]
-
-)
-
-
+dnl OS specific configuration
AC_ARG_ENABLE(redhat,
[ --enable-redhat use redhat-style sysv configuration ],[
if test "$enableval" = "yes"; then
]
)
-dnl ----- timelord compilation (disabled by default)
-AC_MSG_CHECKING([whether timelord should be compiled])
-compile_timelord=no
-AC_ARG_ENABLE(timelord,
- [ --enable-timelord enable compilation of timelord server],
- [compile_timelord="$enableval"],
- [compile_timelord="no"]
-)
-AC_MSG_RESULT([$compile_timelord])
-
-dnl ----- a2boot compilation (disabled by default)
-AC_MSG_CHECKING([whether a2boot should be compiled])
-compile_a2boot=no
-AC_ARG_ENABLE(a2boot,
- [ --enable-a2boot enable compilation of Apple2 boot server],
- [compile_a2boot="$enableval"],
- [compile_a2boot="no"]
-)
-AC_MSG_RESULT([$compile_a2boot])
-
+dnl Path where UAM modules shall be installed
AC_ARG_WITH(uams-path,
[ --with-uams-path=PATH path to UAMs [[PKGCONF/uams]]],[
uams_path="$withval"
]
)
-NETATALK_AC_CUPS
-
dnl check if we can use attribute unused (gcc only) from ethereal
AC_MSG_CHECKING(to see if we can add '__attribute__((unused))' to CFLAGS)
if test x$GCC != x ; then
dnl post-FHS substitutions, etc
dnl --------------------------------------------------------------------------
-dnl ***** UAMS_PATH
-dnl AC_DEFINE_UNQUOTED(UAMS_PATH, "${uams_path}",
-dnl [path to UAMs [default=PKGCONF/uams]])
UAMS_PATH="${uams_path}"
AC_SUBST(UAMS_PATH)
powerpc|ppc) this_cpu=ppc ;;
esac
-dnl --------------------- GNU source
-case "$this_os" in
- linux) AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
- ;;
-esac
-
dnl --------------------- operating system specific flags (port from sys/*)
-dnl ----- AIX specific -----
-if test x"$this_os" = "xaix"; then
- AC_MSG_RESULT([ * AIX specific configuration])
- AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
-
- dnl This is probably a lie; AIX 4.3 supports a 64-bit long
- dnl compilation environment. It's enough to get things defined
- dnl right in endian.h provided that long long is supported, though.
- AC_DEFINE(HAVE_32BIT_LONGS, 1, [Define if the data type long has 32 bit])
-fi
-
dnl ----- FreeBSD specific -----
if test x"$this_os" = "xfreebsd"; then
AC_MSG_RESULT([ * FreeBSD specific configuration])
AC_DEFINE(OPEN_NOFOLLOW_ERRNO, EMLINK, errno returned by open with O_NOFOLLOW)
fi
-dnl ----- HP-UX 11 specific -----
-if test x"$this_os" = "xhpux11"; then
- AC_MSG_RESULT([ * HP-UX 11 specific configuration])
-
- AC_DEFINE(_ISOC9X_SOURCE, 1, [Compatibility macro])
- AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
-fi
-
-dnl ----- IRIX specific -----
-if test x"$this_os" = "xirix"; then
- AC_MSG_RESULT([ * IRIX specific configuration])
-
- AC_DEFINE(NO_STRUCT_TM_GMTOFF, 1, [Define if the gmtoff member of struct tm is not available])
-fi
-
dnl ----- Linux specific -----
if test x"$this_os" = "xlinux"; then
AC_MSG_RESULT([ * Linux specific configuration])
- dnl ----- kernel 2.6 changed struct at_addr to atalk_addr
- AC_MSG_CHECKING([for struct atalk_addr])
-dnl AC_COMPILE_IFELSE([
- AC_TRY_COMPILE([
-#include <sys/socket.h>
-#include <asm/types.h>
-#include <linux/atalk.h>
-
- struct atalk_addr foo;
-],
-[ ], [
- ac_have_atalk_addr=yes
- AC_MSG_RESULT([yes])
- ], [
- AC_MSG_RESULT([no])
- ])
-
-if test "x$ac_have_atalk_addr" = "xyes"; then
- AC_DEFINE(HAVE_ATALK_ADDR, 1, [set if struct at_addr is called atalk_addr])
-fi
-
dnl ----- check if we need the quotactl wrapper
-# AC_CHECK_HEADERS(sys/quota.h linux/quota.h)
-# AC_CHECK_FUNC(quotactl,,
-# AC_DEFINE(NEED_QUOTACTL_WRAPPER, 1, [Define if the quotactl wrapper is needed])
-# AC_MSG_RESULT([enabling quotactl wrapper])
-# )
-
- # For quotas on Linux XFS filesystems
-
- # For linux > 2.5.56
- AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
+ AC_CHECK_HEADERS(linux/dqblk_xfs.h,,
[AC_CHECK_HEADERS(linux/xqm.h linux/xfs_fs.h)
AC_CHECK_HEADERS(xfs/libxfs.h xfs/xqm.h xfs/xfs_fs.h)]
)
fi
fi
- dnl ----- Linux/alpha specific -----
- if test x"$this_cpu" = "xalpha"; then
- AC_MSG_RESULT([enabling gcc memcpy bug workaround])
- AC_DEFINE(HAVE_GCC_MEMCPY_BUG, 1, [Define if memcpy is buggy])
- fi
need_dash_r=no
-
-
fi
dnl ----- Mac OSX specific -----
AC_SUBST(KLDFLAGS)
fi
-dnl ----- Tru64 specific -----
-if test x"$this_os" = "xtru64"; then
- AC_MSG_RESULT([ * Tru64 specific configuration])
- AC_DEFINE(NO_DDP, 1, [Define if DDP should be disabled])
- AC_DEFINE(HAVE_64BIT_LONGS, 1, [Define if the data type long has 64 bit])
- dnl AC_DEFINE(USE_MOUNT_H)
- AC_DEFINE(USE_OLD_RQUOTA, 1, [Define to use old rquota])
- dnl AC_DEFINE(USE_UFS_QUOTA_H)
- AC_DEFINE(TRU64, 1, [Define on Tru64 platforms])
- AC_DEFINE(_OSF_SOURCE, 1, [Define if the *passwd UAMs should be used])
- AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Define for Berkeley DB 4])
- AC_CHECK_LIB(security,set_auth_parameters)
- CFLAGS="-I\$(top_srcdir)/sys/tru64 $CFLAGS"
- need_dash_r=no
- sysv_style=tru64
-fi
-
dnl -- check for libgcrypt, if found enables DHX UAM
AM_PATH_LIBGCRYPT([1:1.2.3],[neta_cv_compile_dhx2=yes
neta_cv_have_libgcrypt=yes
AC_SUBST(OVERWRITE_CONFIG)
AM_CONDITIONAL(SOLARIS_MODULE, test x$solaris_module = xyes)
-AM_CONDITIONAL(COMPILE_TIMELORD, test x$compile_timelord = xyes)
-AM_CONDITIONAL(COMPILE_A2BOOT, test x$compile_a2boot = xyes)
AM_CONDITIONAL(HAVE_LIBGCRYPT, test x$neta_cv_have_libgcrypt = xyes)
AM_CONDITIONAL(HAVE_OPENSSL, test x$neta_cv_have_openssl = xyes)
AM_CONDITIONAL(HAVE_ACLS, test x"$with_acl_support" = x"yes")
contrib/shell_utils/afpd-mtab.pl
contrib/shell_utils/apple_dump
contrib/shell_utils/asip-status.pl
- contrib/timelord/Makefile
- contrib/a2boot/Makefile
distrib/Makefile
distrib/config/Makefile
distrib/config/netatalk-config
SUBDIRS = macusers shell_utils
-if COMPILE_TIMELORD
-SUBDIRS += timelord
-endif
-
-if COMPILE_A2BOOT
-SUBDIRS += a2boot
-endif
-
if USE_APPLETALK
SUBDIRS += printing
endif
+++ /dev/null
-Makefile
-Makefile.in
-a2boot
-.deps
-.libs
-.gitignore
-*.o
+++ /dev/null
-/*
- Recoding circa Dec 2002-early 2003 by Marsha Jackson
- support booting of Apple 2 computers, with aid of Steven N. Hirsch
- Code is copyrighted as listed below...
- M. Jackson is establishing no personal copyright
- or personal restrictions on this software. Only the below rights exist
-*/
-
-/*
- * Copyright (c) 1990,1994 Regents of The University of Michigan.
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appears in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation, and that the name of The University
- * of Michigan not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. This software is supplied as is without expressed or
- * implied warranties of any kind.
- *
- * Research Systems Unix Group
- * The University of Michigan
- * c/o Wesley Craig
- * 535 W. William Street
- * Ann Arbor, Michigan
- * +1 313 764 2278
- * netatalk@umich.edu
- */
-
-/*
- * The "timelord protocol" was reverse engineered from Timelord,
- * distributed with CAP, Copyright (c) 1990, The University of
- * Melbourne. The following copyright, supplied by The University
- * of Melbourne, may apply to this code:
- *
- * This version of timelord.c is based on code distributed
- * by the University of Melbourne as part of the CAP package.
- *
- * The tardis/Timelord package for Macintosh/CAP is
- * Copyright (c) 1990, The University of Melbourne.
- */
+++ /dev/null
-# Makefile.am for contrib/a2boot/
-
-sbin_PROGRAMS = a2boot
-
-a2boot_SOURCES = a2boot.c
-a2boot_LDADD = $(top_builddir)/libatalk/libatalk.la
-
-LIBS = @LIBS@
-
-EXTRA_DIST = COPYRIGHT VERSION
-
-AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/sys \
- @SLP_CFLAGS@ \
- -D_PATH_A_GS_BLOCKS=\"$(PKGCONFDIR)/a2boot/ProDOS16\ Boot\ Blocks\" \
- -D_PATH_A_2E_BLOCKS=\"$(PKGCONFDIR)/a2boot/Apple\ :2f:2fe\ Boot\ Blocks\" \
- -D_PATH_P16_IMAGE=\"$(PKGCONFDIR)/a2boot/ProDOS16\ Image\"
+++ /dev/null
-/*
- * $Id: a2boot.c,v 1.2 2003-01-15 06:24:28 jmarcus Exp $
- * Apple II boot support code. with aid of Steven N. Hirsch
- *
- * based on timelord 1.6 so below copyrights still apply
- *
- * Copyright (c) 1990,1992 Regents of The University of Michigan.
- * All Rights Reserved. See COPYRIGHT.
- *
- * The "timelord protocol" was reverse engineered from Timelord,
- * distributed with CAP, Copyright (c) 1990, The University of
- * Melbourne. The following copyright, supplied by The University
- * of Melbourne, may apply to this code:
- *
- * This version of timelord.c is based on code distributed
- * by the University of Melbourne as part of the CAP package.
- *
- * The tardis/Timelord package for Macintosh/CAP is
- * Copyright (c) 1990, The University of Melbourne.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-
-#include <unistd.h>
-
-#include <netatalk/at.h>
-#include <netatalk/endian.h>
-#include <atalk/atp.h>
-#include <atalk/nbp.h>
-
-#ifdef HAVE_SGTTY_H
-#include <sgtty.h>
-#endif /* HAVE_SGTTY_H */
-
-#include <errno.h>
-#include <signal.h>
-#include <atalk/logger.h>
-#include <stdio.h>
-#include <string.h>
-
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif /* HAVE_NETDB_H */
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif /* HAVE_FCNTL_H */
-#ifdef HAVE_SYS_FCNTL_H
-#include <sys/fcntl.h>
-#endif /* HAVE_SYS_FCNTL_H */
-
-#ifdef HAVE_TERMIOS_H
-#include <termios.h>
-#endif /* HAVE_TERMIOS_H */
-#ifdef HAVE_SYS_TERMIOS_H
-#include <sys/termios.h>
-#endif /* HAVE_SYS_TERMIOS_H */
-
-#define TL_OK '\0'
-#define TL_EOF '\1'
-
-int debug = 0;
-char *bad = "Bad request!";
-char buf[ 4624 ];
-char *server;
-int32_t fileoff;
-
-long a2bootreq(char *fname);
-
-void usage( char *p )
-{
- char *s;
-
- if (( s = rindex( p, '/' )) == NULL ) {
- s = p;
- } else {
- s++;
- }
- fprintf( stderr, "Usage:\t%s -d -n nbpname\n", s );
- exit( 1 );
-}
-
-/*
- * Unregister ourself on signal.
- */
-void
-goaway(int signal)
-{
- int regerr;
- regerr = nbp_unrgstr( server, "Apple //gs", "*", NULL );
- regerr += nbp_unrgstr( server, "Apple //e Boot", "*", NULL );
- regerr += nbp_unrgstr( server, "ProDOS16 Image", "*", NULL );
- if ( regerr < 0 ) {
- LOG(log_error, logtype_default, "Can't unregister Apple II boot files %s", server );
- exit( 1 );
- }
- LOG(log_info, logtype_default, "going down" );
- exit( 0 );
-}
-
-int main( int ac, char **av )
-{
- ATP atp;
- struct sockaddr_at sat;
- struct atp_block atpb;
- struct iovec iov;
- char hostname[ MAXHOSTNAMELEN ];
- char *p;
- int c;
- int32_t req, resp;
- int regerr;
- extern char *optarg;
- extern int optind;
-
-
- if ( gethostname( hostname, sizeof( hostname )) < 0 ) {
- perror( "gethostname" );
- exit( 1 );
- }
- if (( server = index( hostname, '.' )) != 0 ) {
- *server = '\0';
- }
- server = hostname;
-
- while (( c = getopt( ac, av, "dn:" )) != EOF ) {
- switch ( c ) {
- case 'd' :
- debug++;
- break;
- case 'n' :
- server = optarg;
- break;
- default :
- fprintf( stderr, "Unknown option -- '%c'\n", c );
- usage( *av );
- }
- }
-
- /*
- * Disassociate from controlling tty.
- */
- if ( !debug ) {
- int i, dt;
-
- switch ( fork()) {
- case 0 :
- dt = getdtablesize();
- for ( i = 0; i < dt; i++ ) {
- (void)close( i );
- }
- if (( i = open( "/dev/tty", O_RDWR )) >= 0 ) {
- (void)ioctl( i, TIOCNOTTY, 0 );
- setpgid( 0, getpid());
- (void)close( i );
- }
- break;
- case -1 :
- perror( "fork" );
- exit( 1 );
- default :
- exit( 0 );
- }
- }
-
- if (( p = rindex( *av, '/' )) == NULL ) {
- p = *av;
- } else {
- p++;
- }
-
-#ifdef ultrix
- openlog( p, LOG_PID );
-#else /* ultrix */
- set_processname(p);
- syslog_setup(log_debug, logtype_default, logoption_ndelay|logoption_pid, logfacility_daemon );
-#endif /* ultrix */
-
- /* allocate memory */
- memset (&sat.sat_addr, 0, sizeof (sat.sat_addr));
-
-/*
- force port 3 as the semi-official ATP access port MJ 2002
-*/
- if (( atp = atp_open( (u_int8_t)3, &sat.sat_addr )) == NULL ) {
- LOG(log_error, logtype_default, "main: atp_open: %s", strerror( errno ) );
- exit( 1 );
- }
-
- regerr = nbp_rgstr( atp_sockaddr( atp ), server, "Apple //gs", "*" );
- regerr += nbp_rgstr( atp_sockaddr( atp ), server, "Apple //e Boot", "*" );
- regerr += nbp_rgstr( atp_sockaddr( atp ), server, "ProDOS16 Image", "*" );
- if ( regerr < 0 ) {
- LOG(log_error, logtype_default, "Can't register Apple II boot files %s", server );
- exit( 1 );
- }
-
- LOG(log_info, logtype_default, "%s:Apple 2 Boot started", server );
-
- signal(SIGHUP, goaway);
- signal(SIGTERM, goaway);
-
- for (;;) {
- /*
- * Something seriously wrong with atp, since these assigns must
- * be in the loop...
- */
- atpb.atp_saddr = &sat;
- atpb.atp_rreqdata = buf;
- bzero( &sat, sizeof( struct sockaddr_at ));
- atpb.atp_rreqdlen = sizeof( buf );
-
- if ( atp_rreq( atp, &atpb ) < 0 ) {
- LOG(log_error, logtype_default, "main: atp_rreq: %s", strerror( errno ) );
- exit( 1 );
- }
-
- p = buf;
- bcopy( p, &req, sizeof( int32_t ));
- req = ntohl( req );
- p += sizeof( int32_t );
-
-/*
- LOG(log_info, logtype_default, "req = %08lx",(long)req );
-*/
- /* Byte-swap and multiply by 0x200. Converts block number to
- file offset. */
- fileoff = (( req & 0x00ff0000 ) >> 7 ) | (( req & 0x0000ff00 ) << 9 );
- req &= 0xff000000;
-
-/*
- LOG(log_info, logtype_default, " reqblklo = %02x",(int)reqblklo );
- LOG(log_info, logtype_default, " reqblkhi = %02x",(int)reqblkhi );
- LOG(log_info, logtype_default, " req now = %08lx",(long)req );
-*/
-
- switch( req ) {
- case 0x01000000 : /* Apple IIgs both ROM 1 and ROM 3 */
-/* LOG(log_info, logtype_default, " Req ProDOS16 Boot Blocks" ); */
- resp = a2bootreq(_PATH_A_GS_BLOCKS);
- break;
-
- case 0x02000000 : /* Apple 2 Workstation card */
-/* LOG(log_info, logtype_default, " Req Apple //e Boot" ); */
- resp = a2bootreq(_PATH_A_2E_BLOCKS);
- break;
-
- case 0x03000000 : /* Apple IIgs both ROM 1 and ROM 3 */
-/* LOG(log_info, logtype_default, " Req ProDOS16 Image" ); */
- resp = a2bootreq(_PATH_P16_IMAGE);
- break;
-
- default :
- LOG(log_error, logtype_default, bad );
-
- resp = TL_EOF;
- *( buf + sizeof( int32_t ) ) = (unsigned char)strlen( bad );
- strcpy( buf + 1 + sizeof( int32_t ), bad );
-
- break;
- }
-
- bcopy( &resp, buf, sizeof( int32_t ));
-
- iov.iov_len = sizeof( int32_t ) + 512;
- iov.iov_base = buf;
- atpb.atp_sresiov = &iov;
- atpb.atp_sresiovcnt = 1;
-
- if ( atp_sresp( atp, &atpb ) < 0 ) {
- LOG(log_error, logtype_default, "main: atp_sresp: %s", strerror( errno ) );
- exit( 1 );
- }
- }
-}
-
-
-/* below MJ 2002 (initially borrowed from aep_packet */
-long a2bootreq(fname)
- char *fname;
-{
- int f,m;
- int32_t readlen;
-/*
- LOG(log_info, logtype_default, " a2bootreq( %s )",fname );
-*/
- f=open(fname,O_RDONLY );
- if(f==EOF) {
- LOG(log_error, logtype_default, "a2boot open error on %s",fname);
- return close(f);
- }
-
-/*
- LOG(log_info, logtype_default, "would lseek to %08lx",fileoff);
-*/
- lseek(f,fileoff,0);
- readlen=read(f, buf + sizeof( int32_t ), 512 );
-
-/*
- LOG(log_info, logtype_default, "length is %08lx", readlen);
-*/
-
- if(readlen < 0x200) {
-/* LOG(log_info, logtype_default, "Read to EOF"); */
- close(f);
- return TL_EOF;
- }
- close(f);
- return TL_OK;
-}
-
+++ /dev/null
-Makefile
-Makefile.in
-timelord
-.deps
-.libs
-.gitignore
-*.o
+++ /dev/null
-/*
- * Copyright (c) 1990,1994 Regents of The University of Michigan.
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this software and
- * its documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appears in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation, and that the name of The University
- * of Michigan not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. This software is supplied as is without expressed or
- * implied warranties of any kind.
- *
- * Research Systems Unix Group
- * The University of Michigan
- * c/o Wesley Craig
- * 535 W. William Street
- * Ann Arbor, Michigan
- * +1 313 764 2278
- * netatalk@umich.edu
- */
-
-/*
- * The "timelord protocol" was reverse engineered from Timelord,
- * distributed with CAP, Copyright (c) 1990, The University of
- * Melbourne. The following copyright, supplied by The University
- * of Melbourne, may apply to this code:
- *
- * This version of timelord.c is based on code distributed
- * by the University of Melbourne as part of the CAP package.
- *
- * The tardis/Timelord package for Macintosh/CAP is
- * Copyright (c) 1990, The University of Melbourne.
- */
+++ /dev/null
-# Makefile.am for contrib/timelord/
-
-sbin_PROGRAMS = timelord
-
-timelord_SOURCES = timelord.c
-timelord_LDADD = $(top_builddir)/libatalk/libatalk.la
-
-LIBS = @LIBS@
-
-EXTRA_DIST = COPYRIGHT README VERSION
+++ /dev/null
-$Id: README,v 1.3 2002-02-21 09:59:24 srittau Exp $
-
-This is the README file for timelord 1.0 (previously known as
-ntimelord), for use with netatalk 1.5. Previous versions of this
-software were designed to work with netatalk 1.3, but this has
-been patched to work with netatalk 1.5. Please see the COPYRIGHT
-file. This package's COPYRIGHT is *not* the same as netatalk's.
-
-Building timelord:
-
-1. Run ./configure from the base directory of your netatalk
- distribution, and add --enable-timelord to your command line
- options.
-
-2. Run "make all" for netatalk, and timelord will be built along
- with the rest of netatalk.
-
-Installing timelord:
-
-1. To install the binaries, type "make install" from either the base
- directory of your netatalk distribution or from this directory.
- This will install all of the binaries in the directory specified
- by ./configure.
-
-2. The file rc.atalk as distributed with netatalk 1.5 includes lines to
- start timelord.
+++ /dev/null
-/*
- * $Id: timelord.c,v 1.8 2005-04-28 20:49:36 bfernhomberg Exp $
- *
- * Copyright (c) 1990,1992 Regents of The University of Michigan.
- * All Rights Reserved. See COPYRIGHT.
- *
- * The "timelord protocol" was reverse engineered from Timelord,
- * distributed with CAP, Copyright (c) 1990, The University of
- * Melbourne. The following copyright, supplied by The University
- * of Melbourne, may apply to this code:
- *
- * This version of timelord.c is based on code distributed
- * by the University of Melbourne as part of the CAP package.
- *
- * The tardis/Timelord package for Macintosh/CAP is
- * Copyright (c) 1990, The University of Melbourne.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <stdlib.h>
-
-#include <unistd.h>
-
-#include <netatalk/at.h>
-#include <netatalk/endian.h>
-#include <atalk/atp.h>
-#include <atalk/nbp.h>
-
-#include <time.h>
-#ifdef HAVE_SGTTY_H
-#include <sgtty.h>
-#endif /* HAVE_SGTTY_H */
-#include <errno.h>
-#include <signal.h>
-#pragma warn "testing 123"
-#include <atalk/logger.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif /* HAVE_NETDB_H */
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif /* HAVE_FCNTL_H */
-#ifdef HAVE_SYS_FCNTL_H
-#include <sys/fcntl.h>
-#endif /* HAVE_SYS_FCNTL_H */
-
-#ifdef HAVE_TERMIOS_H
-#include <termios.h>
-#endif /* HAVE_TERMIOS_H */
-#ifdef HAVE_SYS_TERMIOS_H
-#include <sys/termios.h>
-#endif /* HAVE_SYS_TERMIOS_H */
-
-#define TL_GETTIME 0
-#define TL_OK 12
-#define TL_BAD 10
-#define EPOCH 0x7C25B080 /* 00:00:00 GMT Jan 1, 1970 for Mac */
-
-int debug = 0;
-char *bad = "Bad request!";
-char buf[ 4624 ];
-char *server;
-
-void usage( char *p )
-{
- char *s;
-
- if (( s = rindex( p, '/' )) == NULL ) {
- s = p;
- } else {
- s++;
- }
- fprintf( stderr, "Usage:\t%s -d -n nbpname\n", s );
- exit( 1 );
-}
-
-/*
- * Unregister ourself on signal.
- */
-void
-goaway(int signal)
-{
- if ( nbp_unrgstr( server, "TimeLord", "*", NULL ) < 0 ) {
- LOG(log_error, logtype_default, "Can't unregister %s", server );
- exit( 1 );
- }
- LOG(log_info, logtype_default, "going down" );
- exit( 0 );
-}
-
-int main( int ac, char **av )
-{
- ATP atp;
- struct sockaddr_at sat;
- struct atp_block atpb;
- struct timeval tv;
- struct timezone tz;
- struct iovec iov;
- struct tm *tm;
- char hostname[ MAXHOSTNAMELEN ];
- char *p;
- int c;
- long req, mtime, resp;
- extern char *optarg;
- extern int optind;
-
- if ( gethostname( hostname, sizeof( hostname )) < 0 ) {
- perror( "gethostname" );
- exit( 1 );
- }
- if (( server = index( hostname, '.' )) != 0 ) {
- *server = '\0';
- }
- server = hostname;
-
- while (( c = getopt( ac, av, "dn:" )) != EOF ) {
- switch ( c ) {
- case 'd' :
- debug++;
- break;
- case 'n' :
- server = optarg;
- break;
- default :
- fprintf( stderr, "Unknown option -- '%c'\n", c );
- usage( *av );
- }
- }
-
- /*
- * Disassociate from controlling tty.
- */
- if ( !debug ) {
- int i, dt;
-
- switch ( fork()) {
- case 0 :
- dt = getdtablesize();
- for ( i = 0; i < dt; i++ ) {
- (void)close( i );
- }
- if (( i = open( "/dev/tty", O_RDWR )) >= 0 ) {
- (void)ioctl( i, TIOCNOTTY, 0 );
- setpgid( 0, getpid());
- (void)close( i );
- }
- break;
- case -1 :
- perror( "fork" );
- exit( 1 );
- default :
- exit( 0 );
- }
- }
-
- if (( p = rindex( *av, '/' )) == NULL ) {
- p = *av;
- } else {
- p++;
- }
-
-#ifdef ultrix
- openlog( p, LOG_PID );
-#else /* ultrix */
- set_processname(p);
- syslog_setup(log_debug, logtype_default, logoption_ndelay|logoption_pid, logfacility_daemon );
-#endif /* ultrix */
-
- /* allocate memory */
- memset (&sat.sat_addr, 0, sizeof (sat.sat_addr));
-
- if (( atp = atp_open( ATADDR_ANYPORT, &sat.sat_addr )) == NULL ) {
- LOG(log_error, logtype_default, "main: atp_open: %s", strerror( errno ) );
- exit( 1 );
- }
-
- if ( nbp_rgstr( atp_sockaddr( atp ), server, "TimeLord", "*" ) < 0 ) {
- LOG(log_error, logtype_default, "Can't register %s", server );
- exit( 1 );
- }
- LOG(log_info, logtype_default, "%s:TimeLord started", server );
-
- signal(SIGHUP, goaway);
- signal(SIGTERM, goaway);
-
- for (;;) {
- /*
- * Something seriously wrong with atp, since these assigns must
- * be in the loop...
- */
- atpb.atp_saddr = &sat;
- atpb.atp_rreqdata = buf;
- bzero( &sat, sizeof( struct sockaddr_at ));
- atpb.atp_rreqdlen = sizeof( buf );
- if ( atp_rreq( atp, &atpb ) < 0 ) {
- LOG(log_error, logtype_default, "main: atp_rreq: %s", strerror( errno ) );
- exit( 1 );
- }
-
- p = buf;
- bcopy( p, &req, sizeof( long ));
- req = ntohl( req );
- p += sizeof( long );
-
- switch( req ) {
- case TL_GETTIME :
- if ( atpb.atp_rreqdlen > 5 ) {
- bcopy( p + 1, &mtime, sizeof( long ));
- mtime = ntohl( mtime );
- LOG(log_info, logtype_default, "gettime from %s %s was %lu",
- (*( p + 5 ) == '\0' ) ? "<unknown>" : p + 5,
- ( *p == 0 ) ? "at boot" : "in chooser",
- mtime );
- } else {
- LOG(log_info, logtype_default, "gettime" );
- }
-
- if ( gettimeofday( &tv, &tz ) < 0 ) {
- LOG(log_error, logtype_default, "main: gettimeofday: %s", strerror( errno ) );
- exit( 1 );
- }
- if (( tm = gmtime( &tv.tv_sec )) == 0 ) {
- perror( "localtime" );
- exit( 1 );
- }
-
- mtime = tv.tv_sec + EPOCH;
- mtime = htonl( mtime );
-
- resp = TL_OK;
- bcopy( &resp, buf, sizeof( long ));
- bcopy( &mtime, buf + sizeof( long ), sizeof( long ));
- iov.iov_len = sizeof( long ) + sizeof( long );
- break;
-
- default :
- LOG(log_error, logtype_default, bad );
-
- resp = TL_BAD;
- bcopy( &resp, buf, sizeof( long ));
- *( buf + 4 ) = (unsigned char)strlen( bad );
- strcpy( buf + 5, bad );
- iov.iov_len = sizeof( long ) + 2 + strlen( bad );
- break;
- }
-
- iov.iov_base = buf;
- atpb.atp_sresiov = &iov;
- atpb.atp_sresiovcnt = 1;
- if ( atp_sresp( atp, &atpb ) < 0 ) {
- LOG(log_error, logtype_default, "main: atp_sresp: %s", strerror( errno ) );
- exit( 1 );
- }
- }
-}
#include "fork.h"
#include "dircache.h"
-#ifdef FORCE_UIDGID
-#warning UIDGID
-#include "uid.h"
-#endif /* FORCE_UIDGID */
-
/*
* We generally pass this from afp_over_dsi to all afp_* funcs, so it should already be
* available everywhere. Unfortunately some funcs (eg acltoownermode) need acces to it
dir_free_invalid_q();
-#ifdef FORCE_UIDGID
- /* bring everything back to old euid, egid */
- if (obj->force_uid)
- restore_uidgid ( &obj->uidgid );
-#endif /* FORCE_UIDGID */
dsi->flags &= ~DSI_RUNNING;
/* Add result to the AFP replay cache */
AfpNum2name(function), AfpErr2name(err));
dsi->flags &= ~DSI_RUNNING;
-#ifdef FORCE_UIDGID
- /* bring everything back to old euid, egid */
- if (obj->force_uid)
- restore_uidgid ( &obj->uidgid );
-#endif /* FORCE_UIDGID */
} else {
LOG(log_error, logtype_afpd, "(write) bad function %x", function);
dsi->datalen = 0;
puts( "No" );
#endif
- printf( " Dropbox kludge:\t" );
-#ifdef DROPKLUDGE
- puts( "Yes" );
-#else
- puts( "No" );
-#endif
-
- printf( " Force volume uid/gid:\t" );
-#ifdef FORCE_UIDGID
- puts( "Yes" );
-#else
- puts( "No" );
-#endif
-
printf( " ACL support:\t" );
#ifdef HAVE_ACLS
puts( "Yes" );
obj->uid = geteuid();
obj->logout = logout;
-#ifdef FORCE_UIDGID
- obj->force_uid = 1;
- save_uidgid ( &obj->uidgid );
-#endif
-
return( AFP_OK );
}
if ((asp_wrtcont(obj->handle, rbuf, &buflen) < 0) || buflen != bsize)
return( AFPERR_PARAM );
-#ifdef DEBUG1
- if (obj->options.flags & OPTION_DEBUG) {
- printf("(write) len: %d\n", buflen);
- bprint(rbuf, buflen);
- }
-#endif
-
/*
* We're at the end of the file, add the headers, etc. */
if ( cc == 0 ) {
createfile_done:
curdir->offcnt++;
-#ifdef DROPKLUDGE
- if (vol->v_flags & AFPVOL_DROPBOX) {
- retvalue = matchfile2dirperms(upath, vol, did);
- }
-#endif /* DROPKLUDGE */
-
setvoltime(obj, vol );
return (retvalue);
goto copy_exit;
}
-#ifdef FORCE_UIDGID
- /* FIXME svid != dvid && dvid's user can't read svid */
-#endif
if (NULL == ( d_vol = getvolbyvid( dvid )) ) {
retvalue = AFPERR_PARAM;
goto copy_exit;
}
curdir->offcnt++;
-#ifdef DROPKLUDGE
- if (vol->v_flags & AFPVOL_DROPBOX) {
- retvalue=matchfile2dirperms(upath, vol, ddid); /* FIXME sdir or ddid */
- }
-#endif /* DROPKLUDGE */
-
setvoltime(obj, d_vol );
copy_exit:
#include "filedir.h"
#include "unix.h"
-#ifdef DROPKLUDGE
-int matchfile2dirperms(
-/* Since it's kinda' big; I decided against an
- inline function */
- char *upath,
- struct vol *vol,
- int did)
-/* The below code changes the way file ownership is determined in the name of
- fixing dropboxes. It has known security problem. See the netatalk FAQ for
- more information */
-{
- struct stat st, sb;
- struct dir *dir;
- char *adpath;
- uid_t uid;
- int ret = AFP_OK;
-#ifdef DEBUG
- LOG(log_debug9, logtype_afpd, "begin matchfile2dirperms:");
-#endif
-
- if (stat(upath, &st ) < 0) {
- LOG(log_error, logtype_afpd, "Could not stat %s: %s", upath, strerror(errno));
- return AFPERR_NOOBJ ;
- }
-
- adpath = vol->vfs->ad_path( upath, ADFLAGS_HF );
- /* FIXME dirsearch doesn't move cwd to did ! */
- if (( dir = dirlookup( vol, did )) == NULL ) {
- LOG(log_error, logtype_afpd, "matchfile2dirperms: Unable to get directory info.");
- ret = AFPERR_NOOBJ;
- }
- else if (stat(".", &sb) < 0) {
- LOG(log_error, logtype_afpd,
- "matchfile2dirperms: Error checking directory \"%s\": %s",
- dir->d_m_name, strerror(errno));
- ret = AFPERR_NOOBJ;
- }
- else {
- uid=geteuid();
- if ( uid != sb.st_uid )
- {
- seteuid(0);
- if (lchown(upath, sb.st_uid, sb.st_gid) < 0)
- {
- LOG(log_error, logtype_afpd,
- "matchfile2dirperms(%s): Error changing owner/gid: %s",
- upath, strerror(errno));
- ret = AFPERR_ACCESS;
- }
- else if ((!S_ISLNK(st->st_mode)) && (chmod(upath,(st.st_mode&~default_options.umask)| S_IRGRP| S_IROTH) < 0))
- {
- LOG(log_error, logtype_afpd,
- "matchfile2dirperms(%s): Error adding file read permissions: %s",
- upath, strerror(errno));
- ret = AFPERR_ACCESS;
- }
- else if (lchown(adpath, sb.st_uid, sb.st_gid) < 0)
- {
- LOG(log_error, logtype_afpd,
- "matchfile2dirperms(%s): Error changing AppleDouble owner/gid: %s",
- adpath, strerror(errno));
- ret = AFPERR_ACCESS;
- }
- else if (chmod(adpath, (st.st_mode&~default_options.umask)| S_IRGRP| S_IROTH) < 0)
- {
- LOG(log_error, logtype_afpd,
- "matchfile2dirperms(%s): Error adding AD file read permissions: %s",
- adpath, strerror(errno));
- ret = AFPERR_ACCESS;
- }
- seteuid(uid);
- }
- } /* end else if stat success */
-
-#ifdef DEBUG
- LOG(log_debug9, logtype_afpd, "end matchfile2dirperms:");
-#endif
- return ret;
-}
-#endif
-
int afp_getfildirparams(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen)
{
struct stat *st;
int plen;
u_int16_t vid;
int rc;
-#ifdef DROPKLUDGE
- int retvalue;
-#endif /* DROPKLUDGE */
int sdir_fd = -1;
}
curdir->offcnt++;
sdir->offcnt--;
-#ifdef DROPKLUDGE
- if (vol->v_flags & AFPVOL_DROPBOX) {
- /* FIXME did is not always the source id */
- if ((retvalue=matchfile2dirperms (upath, vol, did)) != AFP_OK) {
- rc = retvalue;
- goto exit;
- }
- }
- else
-#endif /* DROPKLUDGE */
- /* if unix priv don't try to match perm with dest folder */
- if (!isdir && !vol_unix_priv(vol)) {
- int admode = ad_mode("", 0777) | vol->v_fperm;
+ /* if unix priv don't try to match perm with dest folder */
+ if (!isdir && !vol_unix_priv(vol)) {
+ int admode = ad_mode("", 0777) | vol->v_fperm;
- setfilmode(upath, admode, NULL, vol->v_umask);
- vol->vfs->vfs_setfilmode(vol, upath, admode, NULL);
- }
+ setfilmode(upath, admode, NULL, vol->v_umask);
+ vol->vfs->vfs_setfilmode(vol, upath, admode, NULL);
+ }
setvoltime(obj, vol );
}
#include "desktop.h"
#include "volume.h"
-#ifdef DEBUG1
-#define Debug(a) ((a)->options.flags & OPTION_DEBUG)
-#else
-#define Debug(a) (0)
-#endif
-
#ifdef AFS
struct ofork *writtenfork;
#endif
/* due to the nature of afp packets, we have to exit if we get
an error. we can't do this with translation on. */
#ifdef WITH_SENDFILE
- if (!(xlate || Debug(obj) )) {
+ if (!(xlate)) {
int fd;
fd = ad_readfile_init(ofork->of_ad, eid, &offset, 0);
goto afp_read_exit;
offset += *rbuflen;
-#ifdef DEBUG1
- if (obj->options.flags & OPTION_DEBUG) {
- printf( "(read) reply: %d, %d\n", *rbuflen, dsi->clientID);
- bprint(rbuf, *rbuflen);
- }
-#endif
/* dsi_read() also returns buffer size of next allocation */
cc = dsi_read(dsi, rbuf, *rbuflen); /* send it off */
if (cc < 0)
return( AFPERR_PARAM );
}
-#ifdef DEBUG1
- if (obj->options.flags & OPTION_DEBUG) {
- printf("(write) len: %d\n", *rbuflen);
- bprint(rbuf, *rbuflen);
- }
-#endif
if ((cc = write_file(ofork, eid, offset, rbuf, *rbuflen,
xlate)) < 0) {
*rbuflen = 0;
struct dir *, const char *,
struct dir *, const char *);
extern int of_flush (const struct vol *);
-extern void of_pforkdesc (FILE *);
extern int of_stat (struct path *);
extern int of_statdir (struct vol *vol, struct path *);
extern int of_closefork (struct ofork *ofork);
#define OPTION_ACL2MACCESS (1 << 8)
#define OPTION_NOZEROCONF (1 << 9)
-#ifdef FORCE_UIDGID
-/* set up a structure for this */
-typedef struct uidgidset_t {
- uid_t uid;
- gid_t gid;
-} uidgidset;
-#endif /* FORCE_UIDGID */
-
/* a couple of these options could get stuck in unions to save
* space. */
struct afp_volume_name {
struct session_info sinfo;
uid_t uid; /* client running user id */
int ipc_fd; /* anonymous PF_UNIX socket for IPC with afpd parent */
-#ifdef FORCE_UIDGID
- int force_uid;
- uidgidset uidgid;
-#endif
} AFPObj;
/* typedef for AFP functions handlers */
}
}
-#ifdef DEBUG1
-void of_pforkdesc( FILE *f)
-{
- int ofrefnum;
-
- if (!oforks)
- return;
-
- for ( ofrefnum = 0; ofrefnum < nforks; ofrefnum++ ) {
- if ( oforks[ ofrefnum ] != NULL ) {
- fprintf( f, "%hu <%s>\n", ofrefnum, of_name(oforks[ ofrefnum ]));
- }
- }
-}
-#endif
-
int of_flush(const struct vol *vol)
{
int refnum;
#include "config.h"
#endif /* HAVE_CONFIG_H */
-/* don't compile this file at all unless FORCE_UIDGID is set */
-#ifdef FORCE_UIDGID
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <atalk/logger.h>
-
-/* functions for username and group */
-#include <pwd.h>
-#include <grp.h>
-#include "uid.h"
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-extern uid_t uuid;
-
-void save_uidgid ( pair )
-uidgidset *pair;
-{
- pair->uid = geteuid ();
- pair->gid = getegid ();
-}
-
-void restore_uidgid ( pair )
-uidgidset *pair;
-{
- uid_t uid
- gid_t gid;
-
- uid = geteuid ();
- gid = getegid ();
-
- if (uid == pair->uid && gid == pair->gid)
- return;
-
- if (seteuid(0) < 0) {
- LOG(log_error, logtype_afpd, "set_uidgid: Could not switch back to root: %s",
- strerror(errno));
- }
-
- if ( setegid ( pair->gid ) < 0 )
- LOG(log_error, logtype_afpd, "restore_uidgid: unable to setegid '%s': %s",
- pair->gid, strerror(errno) );
-
- if ( seteuid ( pair->uid ) < 0 )
- LOG(log_error, logtype_afpd, "restore_uidgid: unable to seteuid '%s': %s",
- pair->uid, strerror(errno) );
- else
- uuid = pair->uid; /* ugly hack for utommode */
-}
-
-void set_uidgid ( this_volume )
-const struct vol *this_volume;
-{
- int uid, gid; /* derived ones go in here */
-
- /* check to see if we have to switch users */
- uid = user_to_uid ( (this_volume)->v_forceuid);
- gid = group_to_gid ( (this_volume)->v_forcegid);
-
- if ((!uid || uid == geteuid()) && (!gid || gid == getegid()))
- return;
-
- if ( seteuid(0) < 0) {
- LOG(log_error, logtype_afpd, "set_uidgid: Could not switch back to root: %s",
- strerror(errno));
- return;
- }
-
- /* check to see if we have to switch groups */
- if ( gid ) {
- if ( setegid ( gid ) < 0 )
- LOG(log_error, logtype_afpd, "set_uidgid: unable to setegid '%s': %s",
- (this_volume)->v_forcegid, strerror(errno) );
- } /* end of checking for (this_volume)->v_forcegid */
-
- if ( uid) {
- if ( seteuid ( uid ) < 0 )
- LOG(log_error, logtype_afpd, "set_uidgid: unable to seteuid '%s': %s",
- (this_volume)->v_forceuid, strerror(errno) );
- else
- uuid = uid; /* ugly hack for utommode */
-
- } /* end of checking for (this_volume)->v_forceuid */
-
-} /* end function void set_uidgid ( username, group ) */
-
-int user_to_uid ( username )
-char *username;
-{
- struct passwd *this_passwd;
-
- /* check for anything */
- if ( !username || strlen ( username ) < 1 ) return 0;
-
- /* grab the /etc/passwd record relating to username */
- this_passwd = getpwnam ( username );
-
- /* return false if there is no structure returned */
- if (this_passwd == NULL) return 0;
-
- /* return proper uid */
- return this_passwd->pw_uid;
-
-} /* end function int user_to_uid ( username ) */
-
-int group_to_gid ( group )
-char *group;
-{
- struct group *this_group;
-
- /* check for anything */
- if ( !group || strlen ( group ) < 1 ) return 0;
-
- /* grab the /etc/groups record relating to group */
- this_group = getgrnam ( group );
-
- /* return false if there is no structure returned */
- if (this_group == NULL) return 0;
-
- /* return proper gid */
- return this_group->gr_gid;
-
-} /* end function int group_to_gid ( group ) */
-
-#endif /* FORCE_UIDGID */
#ifndef AFPD_UID_H
#define AFPD_UID_H 1
-#ifdef FORCE_UIDGID
-
-/* have to make sure struct vol is defined */
-#include "volume.h"
-
-/* functions to save and restore uid/gid pairs */
-extern void save_uidgid ( uidgidset * );
-extern void restore_uidgid ( uidgidset * );
-extern void set_uidgid ( const struct vol * );
-
-/* internal functions to convert user and group names to ids */
-extern int user_to_uid ( char * );
-extern int group_to_gid ( char * );
-
-#endif /* FORCE_UIDGID */
-
#endif
/* --------------------- */
int setdirunixmode(const struct vol *vol, const char *name, mode_t mode)
{
-
- int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
-
LOG(log_debug, logtype_afpd, "setdirunixmode('%s', mode:%04o) {v_dperm:%04o}",
fullpathname(name), mode, vol->v_dperm);
if (dir_rx_set(mode)) {
/* extending right? dir first then .AppleDouble in rf_setdirmode */
- if ( stickydirmode(name, DIRBITS | mode, dropbox, vol->v_umask) < 0 )
+ if ( stickydirmode(name, DIRBITS | mode, 0, vol->v_umask) < 0 )
return -1;
}
if (vol->vfs->vfs_setdirunixmode(vol, name, mode, NULL) < 0 && !vol_noadouble(vol)) {
return -1 ;
}
if (!dir_rx_set(mode)) {
- if ( stickydirmode(name, DIRBITS | mode, dropbox, vol->v_umask) < 0 )
+ if ( stickydirmode(name, DIRBITS | mode, 0, vol->v_umask) < 0 )
return -1;
}
return 0;
struct dirent *dirp;
DIR *dir;
mode_t hf_mode;
- int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
mode |= vol->v_dperm;
hf_mode = ad_hf_mode(mode);
if (dir_rx_set(mode)) {
/* extending right? dir first */
- if ( stickydirmode(name, DIRBITS | mode, dropbox, vol->v_umask) < 0 )
+ if ( stickydirmode(name, DIRBITS | mode, 0, vol->v_umask) < 0 )
return -1;
}
}
if (!dir_rx_set(mode)) {
- if ( stickydirmode(name, DIRBITS | mode, dropbox, vol->v_umask) < 0 )
+ if ( stickydirmode(name, DIRBITS | mode, 0, vol->v_umask) < 0 )
return -1;
}
return( 0 );
#define VOLOPT_MACCHARSET 16
#define VOLOPT_CNIDSCHEME 17
#define VOLOPT_ADOUBLE 18 /* adouble version */
-
-#ifdef FORCE_UIDGID
-#warning UIDGID
-#include "uid.h"
-
-#define VOLOPT_FORCEUID 19 /* force uid for username x */
-#define VOLOPT_FORCEGID 20 /* force gid for group x */
-#endif /* FORCE_UIDGID */
-
+/* Usable slot: 19/20 */
#define VOLOPT_UMASK 21
#define VOLOPT_ALLOWED_HOSTS 22
#define VOLOPT_DENIED_HOSTS 23
options[VOLOPT_FLAGS].i_value |= AFPVOL_USEDOTS | AFPVOL_INV_DOTS;
else if (strcasecmp(p, "limitsize") == 0)
options[VOLOPT_FLAGS].i_value |= AFPVOL_LIMITSIZE;
- /* support for either "dropbox" or "dropkludge" */
- else if (strcasecmp(p, "dropbox") == 0)
- options[VOLOPT_FLAGS].i_value |= AFPVOL_DROPBOX;
- else if (strcasecmp(p, "dropkludge") == 0)
- options[VOLOPT_FLAGS].i_value |= AFPVOL_DROPBOX;
else if (strcasecmp(p, "nofileid") == 0)
options[VOLOPT_FLAGS].i_value |= AFPVOL_NOFILEID;
else if (strcasecmp(p, "nostat") == 0)
options[VOLOPT_DFLTPERM].i_value = (int)strtol(val+1, NULL, 8);
} else if (optionok(tmp, "password:", val)) {
setoption(options, save, VOLOPT_PASSWORD, val);
-
-#ifdef FORCE_UIDGID
-
- /* this code allows forced uid/gid per volume settings */
- } else if (optionok(tmp, "forceuid:", val)) {
- setoption(options, save, VOLOPT_FORCEUID, val);
- } else if (optionok(tmp, "forcegid:", val)) {
- setoption(options, save, VOLOPT_FORCEGID, val);
-
-#endif /* FORCE_UIDGID */
} else if (optionok(tmp, "root_preexec:", val)) {
setoption(options, save, VOLOPT_ROOTPREEXEC, val);
if ((volume->v_flags & AFPVOL_EILSEQ))
volume->v_utom_flags |= CONV__EILSEQ;
-#ifdef FORCE_UIDGID
- if (options[VOLOPT_FORCEUID].c_value) {
- volume->v_forceuid = strdup(options[VOLOPT_FORCEUID].c_value);
- } else {
- volume->v_forceuid = NULL; /* set as null so as to return 0 later on */
- }
-
- if (options[VOLOPT_FORCEGID].c_value) {
- volume->v_forcegid = strdup(options[VOLOPT_FORCEGID].c_value);
- } else {
- volume->v_forcegid = NULL; /* set as null so as to return 0 later on */
- }
-#endif
if (!user) {
if (options[VOLOPT_PREEXEC].c_value)
volume->v_preexec = volxlate(obj, NULL, MAXPATHLEN, options[VOLOPT_PREEXEC].c_value, pwd, path, name);
free(vol->v_cnidscheme);
free(vol->v_dbpath);
free(vol->v_gvs);
-#ifdef FORCE_UIDGID
- free(vol->v_forceuid);
- free(vol->v_forcegid);
-#endif /* FORCE_UIDGID */
if (vol->v_uuid)
free(vol->v_uuid);
}
#ifndef NO_LARGE_VOL_SUPPORT
case VOLPBIT_XBFREE :
xbfree = hton64( xbfree );
-#if defined(__GNUC__) && defined(HAVE_GCC_MEMCPY_BUG)
- bcopy(&xbfree, data, sizeof(xbfree));
-#else /* __GNUC__ && HAVE_GCC_MEMCPY_BUG */
memcpy(data, &xbfree, sizeof( xbfree ));
-#endif /* __GNUC__ && HAVE_GCC_MEMCPY_BUG */
data += sizeof( xbfree );
break;
case VOLPBIT_XBTOTAL :
xbtotal = hton64( xbtotal );
-#if defined(__GNUC__) && defined(HAVE_GCC_MEMCPY_BUG)
- bcopy(&xbtotal, data, sizeof(xbtotal));
-#else /* __GNUC__ && HAVE_GCC_MEMCPY_BUG */
memcpy(data, &xbtotal, sizeof( xbtotal ));
-#endif /* __GNUC__ && HAVE_GCC_MEMCPY_BUG */
data += sizeof( xbfree );
break;
#endif /* ! NO_LARGE_VOL_SUPPORT */
if (( volume->v_flags & AFPVOL_OPEN ) ) {
/* the volume is already open */
-#ifdef FORCE_UIDGID
- set_uidgid ( volume );
-#endif
return stat_vol(bitmap, volume, rbuf, rbuflen);
}
}
}
-#ifdef FORCE_UIDGID
- set_uidgid ( volume );
-#endif
-
if (volume->v_preexec) {
if ((ret = afprun(0, volume->v_preexec, NULL)) && volume->v_preexec_close) {
LOG(log_error, logtype_afpd, "afp_openvol(%s): preexec : %d", volume->v_path, ret );
return( NULL );
}
-#ifdef FORCE_UIDGID
- set_uidgid ( vol );
-#endif /* FORCE_UIDGID */
-
current_vol = vol;
return( vol );
static void log_ctx_flags( OM_uint32 flags )
{
-#ifdef DEBUG1
+#ifdef DEBUG
if (flags & GSS_C_DELEG_FLAG)
LOG(log_debug, logtype_uams, "uams_gss.c :context flag: GSS_C_DELEG_FLAG" );
if (flags & GSS_C_MUTUAL_FLAG)
#include <sys/types.h>
#include <inttypes.h>
-extern int locktable_init(void);
+extern int locktable_init(const char *path);
#endif /* ATALK_LOCKING_H */
extern "C" {
#endif
-#include "signal.h"
+#include <sys/types.h>
+#include <signal.h>
/* flags to tdb_store() */
#define TDB_REPLACE 1 /* Unused */
int v_root_preexec_close;
int v_preexec_close;
char *v_uuid; /* For TimeMachine zeroconf record */
-#ifdef FORCE_UIDGID
- char *v_forceuid;
- char *v_forcegid;
-#endif
#ifdef __svr4__
int v_qfd;
#endif /*__svr4__*/
#define AFPVOL_USEDOTS (1 << 11) /* use real dots */
#define AFPVOL_LIMITSIZE (1 << 12) /* limit size for older macs */
#define AFPVOL_MAPASCII (1 << 13) /* map the ascii range as well */
-#define AFPVOL_DROPBOX (1 << 14) /* dropkludge dropbox support */
#define AFPVOL_NOFILEID (1 << 15) /* don't advertise createid resolveid and deleteid calls */
#define AFPVOL_NOSTAT (1 << 16) /* advertise the volume even if we can't stat() it
* maybe because it will be mounted later in preexec */
((type) == ADLOCK_WR ? LOCK_EX : \
((type) == ADLOCK_CLR ? LOCK_UN : -1)))
-#ifdef DISABLE_LOCKING
-#define fcntl(a, b, c ) (0)
-#endif
-
/* ----------------------- */
static int set_lock(int fd, int cmd, struct flock *lock)
{
# Makefile.am for libatalk/locking/
noinst_LTLIBRARIES = liblocking.la
+noinst_HEADERS = smb_share_modes.h
-liblocking_la_SOURCES = locking.c
+liblocking_la_SOURCES = locking.c smb_share_modes.c
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <pthread.h>
+#include <unistd.h>
#include <atalk/logger.h>
#include <atalk/errchk.h>
#include <atalk/locking.h>
#include <atalk/cnid.h>
-#define AFP_LOCKTABLE_SIZE (8*1024*1024)
+#include <atalk/paths.h>
+
+#include "smb_share_modes.h"
+
+/***************************************************************************
+ * structures and defines
+ ***************************************************************************/
+
+#define LOCKTABLE_PATH "/tmp/netatalk-afp-locks.tdb"
/*
* Struct for building the the main database of file locks.
* vid + cnid build the primary key for database access.
*/
-struct afp_lock {
+typedef struct afp_lock {
/* Keys */
- uint32_t vid;
- cnid_t cnid;
+ uint32_t l_vid;
+ cnid_t l_cnid;
+ uint64_t l_dev;
+ uint64_t l_ino;
+
+ /* pid holding the lock, also secondary key */
+ pid_t l_pid;
/* Refcounting access and deny modes */
- uint16_t amode_r;
- uint16_t amode_w;
- uint16_t dmode_r;
- uint16_t dmode_w;
-};
+ uint16_t l_amode_r;
+ uint16_t l_amode_w;
+ uint16_t l_dmode_r;
+ uint16_t l_dmode_w;
+} afp_lock_t;
-/*
- * Structure for building a table which provides the way to find locks by pid
- */
-struct pid_lock {
- /* Key */
- pid_t pid;
+#define PACKED_AFP_LOCK_SIZE \
+ sizeof(((afp_lock_t *)0)->l_vid) + \
+ sizeof(((afp_lock_t *)0)->l_cnid) + \
+ sizeof(((afp_lock_t *)0)->l_dev) + \
+ sizeof(((afp_lock_t *)0)->l_ino) + \
+ sizeof(((afp_lock_t *)0)->l_pid) + \
+ sizeof(((afp_lock_t *)0)->l_amode_r) + \
+ sizeof(((afp_lock_t *)0)->l_amode_w) + \
+ sizeof(((afp_lock_t *)0)->l_dmode_r) + \
+ sizeof(((afp_lock_t *)0)->l_dmode_r)
- /* Key for afp_lock */
- uint32_t vid;
- cnid_t cnid;
-};
+/***************************************************************************
+ * Data
+ ***************************************************************************/
+
+static struct smbdb_ctx *tdb;
/***************************************************************************
- * Public functios
+ * Private functions
***************************************************************************/
-int locktable_init(void)
+/***************************************************************************
+ * Public functions
+ ***************************************************************************/
+
+/*!
+ * Open locktable from path
+ */
+int locktable_init(const char *path)
{
EC_INIT;
+ EC_NULL_LOG(tdb = smb_share_mode_db_open(path));
EC_CLEANUP:
EC_EXIT;
#include "config.h"
#endif
-#ifdef DEBUG1
+#ifdef DEBUG
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
{AFPVOL_USEDOTS, "USEDOTS"}, /* use real dots */
{AFPVOL_LIMITSIZE, "LIMITSIZE"}, /* limit size for older macs */
{AFPVOL_MAPASCII, "MAPASCII"}, /* map the ascii range as well */
- {AFPVOL_DROPBOX, "DROPBOX"}, /* dropkludge dropbox support */
{AFPVOL_NOFILEID, "NOFILEID"}, /* don't advertise createid resolveid and deleteid calls */
{AFPVOL_NOSTAT, "NOSTAT"}, /* advertise the volume even if we can't stat() it
* maybe because it will be mounted later in preexec */
{
int retval = 0;
-#ifdef DROPKLUDGE
- /* Turn on the sticky bit if this is a drop box, also turn off the setgid bit */
- if ((dropbox & AFPVOL_DROPBOX)) {
- int uid;
-
- if ( ( (mode & S_IWOTH) && !(mode & S_IROTH)) ||
- ( (mode & S_IWGRP) && !(mode & S_IRGRP)) )
- {
- uid=geteuid();
- if ( seteuid(0) < 0) {
- LOG(log_error, logtype_afpd, "stickydirmode: unable to seteuid root: %s", strerror(errno));
- }
- if ( (retval=chmod( name, ( (DIRBITS | mode | S_ISVTX) & ~v_umask) )) < 0) {
- LOG(log_error, logtype_afpd, "stickydirmode: chmod \"%s\": %s", fullpathname(name), strerror(errno) );
- } else {
- LOG(log_debug, logtype_afpd, "stickydirmode: chmod \"%s\": %s", fullpathname(name), strerror(retval) );
- }
- seteuid(uid);
- return retval;
- }
- }
-#endif /* DROPKLUDGE */
-
/*
* Ignore EPERM errors: We may be dealing with a directory that is
* group writable, in which case chmod will fail.
+++ /dev/null
-dnl $Id: cups.m4,v 1.3 2010-04-12 14:28:47 franklahm Exp $
-dnl Autoconf macros to check for CUPS
-
-AC_DEFUN([NETATALK_AC_CUPS], [
-
- dnl Don't use spool unless it's needed
- spool_required=no
- netatalk_cv_use_cups=no
-
- AC_ARG_ENABLE(cups,
- [ --enable-cups Turn on CUPS support (default=auto)])
-
- if test x$enable_cups != xno; then
- AC_PATH_PROG(CUPS_CONFIG, cups-config)
-
- if test "x$CUPS_CONFIG" != x; then
- AC_DEFINE(HAVE_CUPS, 1, [Define to enable CUPS Support])
- CUPS_CFLAGS="`$CUPS_CONFIG --cflags`"
- CUPS_LDFLAGS="`$CUPS_CONFIG --ldflags`"
- CUPS_LIBS="`$CUPS_CONFIG --libs`"
- CUPS_VERSION="`$CUPS_CONFIG --version`"
- AC_DEFINE_UNQUOTED(CUPS_API_VERSION, "`$CUPS_CONFIG --api-version`", [CUPS API Version])
- AC_SUBST(CUPS_CFLAGS)
- AC_SUBST(CUPS_LDFLAGS)
- AC_SUBST(CUPS_LIBS)
-
- AC_MSG_CHECKING([CUPS version])
- AC_MSG_RESULT([$CUPS_VERSION])
- netatalk_cv_use_cups=yes
-
- if test x"$netatalk_cv_HAVE_USABLE_ICONV" = x"no" ; then
- AC_WARN([*** Warning: iconv not found on your system, using simple ascii mapping***])
- fi
- spool_required="yes"
- elif test x"$enable_cups" = "xyes"; then
- AC_MSG_ERROR([*** CUPS not found. You might need to specify the path to cups-config ***])
- fi
- fi
-
- AC_MSG_CHECKING([whether CUPS support can be enabled])
- AC_MSG_RESULT([$netatalk_cv_use_cups])
-
-
- AC_ARG_WITH(spooldir,
- [ --with-spooldir=PATH path for spooldir used for CUPS support (LOCALSTATEDIR/spool/netatalk)],[
-
- if test "$withval" = "no"; then
- if test x"$spool_required" = x"yes"; then
- AC_MSG_ERROR([*** CUPS support requires a spooldir ***])
- else
- AC_DEFINE(DISABLE_SPOOL, 1, [Define to enable spooldir support])
- AC_MSG_RESULT([spool disabled])
- fi
- elif test "$withval" != "yes"; then
- SPOOLDIR="$withval"
- AC_MSG_RESULT([spooldir set to $withval])
- else
- SPOOLDIR="${localstatedir}/spool/netatalk"
- AC_MSG_RESULT([spool set to default])
- fi
- ],[
- SPOOLDIR="${localstatedir}/spool/netatalk"
- ])
-
- AM_CONDITIONAL(USE_SPOOLDIR, test x"$spool_required" = x"yes")
- AC_SUBST(SPOOLDIR)
-])
dnl Check for optional server location protocol support (used by MacOS X)
-dnl $Id: srvloc.m4,v 1.10 2009-12-13 11:58:30 franklahm Exp $
-
-AC_DEFUN([NETATALK_SRVLOC], [
+AC_DEFUN([AC_NETATALK_SRVLOC], [
SLP_LIBS=""
SLP_CFLAGS=""
dnl $Id: tcp-wrappers.m4,v 1.4 2008-08-11 20:44:03 didg Exp $
-AC_DEFUN([NETATALK_TCP_WRAPPERS], [
+AC_DEFUN([AC_NETATALK_TCP_WRAPPERS], [
check=maybe
AC_ARG_ENABLE(tcp-wrappers,
[ --disable-tcp-wrappers disable TCP wrappers support],
dnl Check for optional Zeroconf support
-AC_DEFUN([NETATALK_ZEROCONF], [
+AC_DEFUN([AC_NETATALK_ZEROCONF], [
ZEROCONF_LIBS=""
ZEROCONF_CFLAGS=""
found_zeroconf=no
+++ /dev/null
-/*
- * $Id: endian.h,v 1.9 2009-01-06 20:05:00 morgana Exp $
- *
- * Copyright (c) 1990,1991 Regents of The University of Michigan.
- * All Rights Reserved. See COPYRIGHT.
- *
- * This file handles both byte ordering and integer sizes.
- */
-
-#ifndef _ATALK_ENDIAN_H_
-#define _ATALK_ENDIAN_H_
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#include <sys/types.h>
-#include <netinet/in.h>
-
-#ifdef _IBMR2
-#include <sys/machine.h>
-#endif /*_IBMR2*/
-
-#ifdef _ISOC9X_SOURCE
-#include <inttypes.h>
-#ifndef __BIT_TYPES_DEFINED__
-#define __BIT_TYPES_DEFINED__
-typedef uint8_t u_int8_t;
-typedef uint16_t u_int16_t;
-typedef uint32_t u_int32_t;
-typedef uint64_t u_int64_t;
-#endif /* ! __BIT_TYPES_DEFINED__ */
-#else
-
-/* handle sunos and solaris */
-#ifdef sun
-#ifdef BSD4_3
-#include <sys/bitypes.h>
-#else /* BSD4_3 */
-/* solaris and sunos don't consistently define u_int*_t. */
-typedef unsigned char u_int8_t;
-typedef unsigned short u_int16_t;
-typedef unsigned int u_int32_t;
-typedef int int32_t;
-#endif /* BSD4_3 */
-
-typedef unsigned long long u_int64_t;
-
-#ifndef _SSIZE_T
-#define _SSIZE_T
-typedef int ssize_t;
-#endif /* ssize_t */
-
-#else /* sun */
-
-/* luckily ultrix is dead. as a result, we know what the sizes of
- * various types are forever. this makes some assumptions about integer
- * sizes. */
-#if defined (ultrix) || defined(HAVE_32BIT_LONGS) || defined(HAVE_64BIT_LONGS)
-#ifndef __BIT_TYPES_DEFINED__
-#define __BIT_TYPES_DEFINED__
-typedef unsigned char u_int8_t;
-typedef unsigned short u_int16_t;
-typedef unsigned int u_int32_t;
-typedef int int32_t;
-#endif
-#endif /* ultrix || HAVE_32BIT_LONGS || HAVE_64BIT_LONGS */
-
-#ifdef ultrix
-typedef int ssize_t;
-#endif /* ultrix */
-
-#ifdef HAVE_64BIT_LONGS
-typedef unsigned long u_int64_t;
-#else /* HAVE_64BIT_LONGS */
-/* check for long long support. currently, i assume that if 64-bit
- * ints exist that their made available via long long */
-#ifdef linux
-#include <endian.h> /* i think this is here for libc4 */
-#else /* linux */
-#if defined(HAVE_32BIT_LONGS) && !(defined(BSD4_4) || \
- defined(NO_LARGE_VOL_SUPPORT))
-typedef unsigned long long u_int64_t;
-#endif /* HAVE_32BIT_LONGS || !BSD4_4 || NO_LARGE_VOL_SUPPORT */
-#endif /* linux */
-#endif /* HAVE_64BIT_LONGS */
-#endif /* sun */
-#endif /* ISOC9X */
-
-# ifndef BYTE_ORDER
-#define LITTLE_ENDIAN 1234
-#define BIG_ENDIAN 4321
-#define PDP_ENDIAN 3412
-
-
-#if defined(WORDS_BIGENDIAN) || defined(_BIG_ENDIAN)
-#define BYTE_ORDER BIG_ENDIAN
-#else
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif /* WORDS_BIGENDIAN */
-
-# ifndef ntohl
-# if defined( sun ) || defined( ultrix ) || defined( _IBMR2 )
-#if BYTE_ORDER == BIG_ENDIAN
-#define ntohl(x) (x)
-#define ntohs(x) (x)
-#define htonl(x) (x)
-#define htons(x) (x)
-
-#else /* BYTE_ORDER == BIG_ENDIAN */
-#if defined( mips ) && defined( KERNEL )
-#define ntohl(x) nuxi_l(x)
-#define ntohs(x) nuxi_s(x)
-#define htonl(x) nuxi_l(x)
-#define htons(x) nuxi_s(x)
-
-#else /* mips && KERNEL */
-
-#if !( defined( sun ) && ( defined( i386 ) || defined(__x86_64) ) )
-unsigned short ntohs(), htons();
-unsigned int ntohl(), htonl();
-#endif /* ! ( sun && i386 ) */
-
-#endif /* mips && KERNEL */
-#endif /* BYTE_ORDER == BIGENDIAN*/
-# endif /* sun ultrix _IBMR2 */
-# endif /* ntohl */
-#endif /* BYTE_ORDER */
-
-#endif /* _ATALK_ENDIAN_H_ */
-