diff options
Diffstat (limited to 'net/samba36/files')
21 files changed, 1594 insertions, 0 deletions
diff --git a/net/samba36/files/README.FreeBSD b/net/samba36/files/README.FreeBSD new file mode 100644 index 00000000000..6070b61c81b --- /dev/null +++ b/net/samba36/files/README.FreeBSD @@ -0,0 +1,32 @@ +If you want to run this port: + +1. Copy /usr/local/etc/smb.conf.default to /usr/local/etc/smb.conf and edit + it. +2. Put string 'samba_enable="YES"' into your /etc/rc.conf. +3. Run '/usr/local/etc/rc.d/samba start' or reboot. + +This port doesn't create 'smbpasswd' file automatically anymore. Users +are encouraged to use 'tdbsam' backend instead: + + [global] + passdb backend = tdbsam, smbpasswd + +You can use pdbedit to migrate accounts from 'smbpasswd' to 'tdbsam', +see the Samba3-HOWTO-Collection. + +You still can create 'smbpasswd' file with the supplied 'make_smbpasswd' +script: + + cat /etc/passwd | grep -v "^#" | make_smbpasswd > smbpasswd + chmod 600 smbpasswd + +But the usage of it is deprecated. + +See document files in /usr/local/share/doc/samba and example config files in +/usr/local/share/examples/samba for details. + +This port doesn't come anymore with the IDEALX Samba LDAP management tools. +They are a separate port now, net/smbldap-tools. Please, install it, if you +are going to use Samba LDAP back end. + +FreeBSD Samba3 port maintainer: Timur I. Bakeyev <timur@FreeBSD.org> diff --git a/net/samba36/files/patch-lib__replace__libreplace_macros.m4 b/net/samba36/files/patch-lib__replace__libreplace_macros.m4 new file mode 100644 index 00000000000..6cfd58e5ca2 --- /dev/null +++ b/net/samba36/files/patch-lib__replace__libreplace_macros.m4 @@ -0,0 +1,11 @@ +--- ./lib/replace/libreplace_macros.m4.orig 2011-10-12 01:38:14.000000000 +0200 ++++ ./lib/replace/libreplace_macros.m4 2011-10-12 01:39:36.000000000 +0200 +@@ -298,7 +298,7 @@ + eval AS_TR_SH([ac_cv_c_prototype_$1])=no + ]) + ) +-AS_IF([test $AS_TR_SH([ac_cv_c_prototype_$1]) = yes],[$3],[$4]) ++AS_IF([eval test \$AS_TR_SH([ac_cv_c_prototype_$1]) = yes],[$3],[$4]) + ]) + + AC_DEFUN(LIBREPLACE_PROVIDE_HEADER, diff --git a/net/samba36/files/patch-lib__replace__system__wait.h b/net/samba36/files/patch-lib__replace__system__wait.h new file mode 100644 index 00000000000..3cfa995371b --- /dev/null +++ b/net/samba36/files/patch-lib__replace__system__wait.h @@ -0,0 +1,21 @@ +--- ./lib/replace/system/wait.h.orig 2010-04-01 15:26:22.000000000 +0200 ++++ ./lib/replace/system/wait.h 2010-04-23 01:08:35.000000000 +0200 +@@ -32,6 +32,18 @@ + + #include <signal.h> + ++#ifndef SIGRTMIN ++# ifdef NSIG ++# define SIGRTMIN (NSIG+1) ++# else ++# define SIGRTMIN 33 ++# endif ++#endif ++ ++#ifndef SIGRTMAX ++#define SIGRTMAX (SIGRTMIN+64) ++#endif ++ + #ifndef SIGCLD + #define SIGCLD SIGCHLD + #endif diff --git a/net/samba36/files/patch-lib__tevent__tevent_signal.c b/net/samba36/files/patch-lib__tevent__tevent_signal.c new file mode 100644 index 00000000000..8d591533983 --- /dev/null +++ b/net/samba36/files/patch-lib__tevent__tevent_signal.c @@ -0,0 +1,11 @@ +--- ./lib/tevent/tevent_signal.c.orig 2010-04-01 15:26:22.000000000 +0200 ++++ ./lib/tevent/tevent_signal.c 2010-04-23 01:08:35.000000000 +0200 +@@ -30,7 +30,7 @@ + #include "tevent_internal.h" + #include "tevent_util.h" + +-#define TEVENT_NUM_SIGNALS 64 ++#define TEVENT_NUM_SIGNALS SIGRTMAX + + /* maximum number of SA_SIGINFO signals to hold in the queue. + NB. This *MUST* be a power of 2, in order for the ring buffer diff --git a/net/samba36/files/patch-nsswitch__pam_winbind.c b/net/samba36/files/patch-nsswitch__pam_winbind.c new file mode 100644 index 00000000000..9c32da334bd --- /dev/null +++ b/net/samba36/files/patch-nsswitch__pam_winbind.c @@ -0,0 +1,52 @@ +--- ./nsswitch/pam_winbind.c.orig 2011-08-09 13:17:47.000000000 +0200 ++++ ./nsswitch/pam_winbind.c 2011-09-06 23:23:18.000000000 +0200 +@@ -163,7 +163,6 @@ + } + #endif + +- + /* + * Work around the pam API that has functions with void ** as parameters + * These lead to strict aliasing warnings with gcc. +@@ -173,14 +172,20 @@ + const void *_item) + { + const void **item = (const void **)_item; +- return pam_get_item(pamh, item_type, item); ++ return pam_get_item((pam_handle_t *)pamh, item_type, item); + } ++ + static int _pam_get_data(const pam_handle_t *pamh, + const char *module_data_name, + const void *_data) + { ++#if PAM_GET_DATA_ARG3_CONST_VOID_PP + const void **data = (const void **)_data; +- return pam_get_data(pamh, module_data_name, data); ++ return pam_get_data((pam_handle_t *)pamh, module_data_name, data); ++#else ++ void **data = (void **)_data; ++ return pam_get_data((pam_handle_t *)pamh, module_data_name, data); ++#endif + } + + /* some syslogging */ +@@ -311,7 +316,7 @@ + if (item_type != 0) { + pam_get_item(ctx->pamh, item_type, &data); + } else { +- pam_get_data(ctx->pamh, key, &data); ++ _pam_get_data(ctx->pamh, key, &data); + } + if (data != NULL) { + const char *type = (item_type != 0) ? "ITEM" : "DATA"; +@@ -2835,8 +2840,7 @@ + ret = PAM_USER_UNKNOWN; + goto out; + case 0: +- pam_get_data(pamh, PAM_WINBIND_NEW_AUTHTOK_REQD, +- (const void **)&tmp); ++ _pam_get_data(pamh, PAM_WINBIND_NEW_AUTHTOK_REQD, &tmp); + if (tmp != NULL) { + ret = atoi((const char *)tmp); + switch (ret) { diff --git a/net/samba36/files/patch-nsswitch__wins_freebsd.c b/net/samba36/files/patch-nsswitch__wins_freebsd.c new file mode 100644 index 00000000000..b526acc5373 --- /dev/null +++ b/net/samba36/files/patch-nsswitch__wins_freebsd.c @@ -0,0 +1,82 @@ +--- ./nsswitch/wins_freebsd.c.orig 2010-04-23 01:08:35.000000000 +0200 ++++ ./nsswitch/wins_freebsd.c 2010-04-23 01:08:35.000000000 +0200 +@@ -0,0 +1,79 @@ ++/* ++ Unix SMB/CIFS implementation. ++ ++ Copyright (C) Timur I. Bakeyev 2007 ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public ++ License as published by the Free Software Foundation; either ++ version 2 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public ++ License along with this library; if not, write to the ++ Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. ++*/ ++ ++#include "winbind_client.h" ++ ++NSS_STATUS _nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *he, ++ char *buffer, size_t buflen, int *h_errnop); ++ ++NSS_METHOD_PROTOTYPE(__nss_wins_freebsd_gethostbyname2_r); ++ ++static ns_mtab methods[] = ++{ ++ { NSDB_HOSTS, "getaddrinfo", NULL, NULL }, ++ { NSDB_HOSTS, "ghbyname", NULL, NULL }, ++ { NSDB_HOSTS, "ghbyaddr", NULL, NULL }, ++ { NSDB_HOSTS, "gethostbyaddr_r", NULL, NULL }, ++ { NSDB_HOSTS, "gethostbyname2_r", __nss_wins_freebsd_gethostbyname2_r, _nss_wins_gethostbyname2_r }, ++ { NSDB_HOSTS, "getnetbyname_r", NULL, NULL }, ++ { NSDB_HOSTS, "getnetbyaddr_r", NULL, NULL }, ++ { NSDB_HOSTS, "gethostbyname", NULL, NULL }, ++ { NSDB_HOSTS, "gethostbyaddr", NULL, NULL }, ++ { NSDB_HOSTS, "getnetbyname", NULL, NULL }, ++ { NSDB_HOSTS, "getnetbyaddr", NULL, NULL } ++}; ++ ++int ++__nss_wins_freebsd_gethostbyname2_r(void *retval, void *mdata, va_list ap) ++{ ++ int (*fn)(const char *, int, struct hostent *, char *, size_t, int *); ++ const char *hostname; ++ int af; ++ struct hostent *he; ++ char *buffer; ++ size_t buflen; ++ int *h_errnop; ++ enum nss_status status; ++ ++ fn = mdata; ++ hostname = va_arg(ap, const char *); ++ af = va_arg(ap, int); ++ he = va_arg(ap, struct hostent *); ++ buffer = va_arg(ap, char *); ++ buflen = va_arg(ap, size_t); ++ h_errnop = va_arg(ap, int *); ++ ++ status = fn(hostname, af, he, buffer, buflen, h_errnop); ++ status = __nss_compat_result(status, *h_errnop); ++ if (status == NS_SUCCESS) ++ *(struct hostent **)retval = he; ++ ++ return (status); ++} ++ ++ns_mtab * ++nss_module_register(const char *source __unused, unsigned int *mtabsize, ++ nss_module_unregister_fn *unreg) ++{ ++ *mtabsize = sizeof(methods) / sizeof(methods[0]); ++ *unreg = NULL; ++ return (methods); ++} diff --git a/net/samba36/files/patch-source3__Makefile.in b/net/samba36/files/patch-source3__Makefile.in new file mode 100644 index 00000000000..85dfb9829ab --- /dev/null +++ b/net/samba36/files/patch-source3__Makefile.in @@ -0,0 +1,68 @@ +--- ./source3/Makefile.in.orig 2011-08-09 13:17:47.000000000 +0200 ++++ ./source3/Makefile.in 2011-09-06 23:35:41.000000000 +0200 +@@ -149,7 +149,7 @@ + # These can be overridden by command line switches (see smbd(8)) + # or in smb.conf (see smb.conf(5)) + LOGFILEBASE = @logfilebase@ +-CONFIGFILE = $(CONFIGDIR)/smb.conf ++CONFIGFILE = $(CONFIGDIR)/%%SAMBA_CONFIG%% + LMHOSTSFILE = $(CONFIGDIR)/lmhosts + NCALRPCDIR = @ncalrpcdir@ + +@@ -1302,8 +1302,8 @@ + $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \ + $(LIBNDR_GEN_OBJ0) + +-WINBIND_WINS_NSS_OBJ = ../nsswitch/wins.o $(PARAM_OBJ) \ +- $(LIB_NONSMBD_OBJ) $(LIBSMB_ERR_OBJ) $(LIBNMB_OBJ) ++WINBIND_WINS_NSS_OBJ = ../nsswitch/wins.o @WINBIND_WINS_NSS_EXTRA_OBJS@ \ ++ $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(LIBSMB_ERR_OBJ) $(LIBNMB_OBJ) + + PAM_SMBPASS_OBJ_0 = pam_smbpass/pam_smb_auth.o pam_smbpass/pam_smb_passwd.o \ + pam_smbpass/pam_smb_acct.o pam_smbpass/support.o ../lib/util/asn1.o +@@ -1620,6 +1620,7 @@ + + .SUFFIXES: + .SUFFIXES: .c .o .lo ++.SUFFIXES: .h .h.gch + + .PHONY: showflags SHOWFLAGS + +@@ -1681,6 +1682,9 @@ + $(COMPILE_CC) >/dev/null 2>&1 + @BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@ + ++.h.h.gch: ++ @echo Compiling $*.h ++ + PRECOMPILED_HEADER = $(builddir)/include/includes.h.gch + + # this adds support for precompiled headers. To use it, install a snapshot +@@ -2762,14 +2766,15 @@ + $(LDAP_LIBS) $(KRB5LIBS) $(LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS) \ + @SONAMEFLAG@`basename $@`@NSSSONAMEVERSIONSUFFIX@ + +-bin/winbind_krb5_locator.@SHLIBEXT@: $(BINARY_PREREQS) $(WINBIND_KRB5_LOCATOR_OBJ) $(LIBWBCLIENT) ++bin/winbind_krb5_locator.@SHLIBEXT@: $(BINARY_PREREQS) $(WINBIND_KRB5_LOCATOR_OBJ) $(LIBTALLOC) $(LIBWBCLIENT) + @echo "Linking $@" +- @$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_KRB5_LOCATOR_OBJ) $(LIBWBCLIENT_LIBS) $(KRB5LIBS) \ ++ @$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_KRB5_LOCATOR_OBJ) $(LIBTALLOC_LIBS) $(LIBWBCLIENT_LIBS) $(KRB5LIBS) \ + @SONAMEFLAG@`basename $@` + + bin/pam_winbind.@SHLIBEXT@: $(BINARY_PREREQS) $(PAM_WINBIND_OBJ) $(LIBTALLOC) $(LIBWBCLIENT) + @echo "Linking shared library $@" + @$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_WINBIND_OBJ) -lpam @INIPARSERLIBS@ \ ++ $(LIBS) $(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS) \ + $(LIBREPLACE_LIBS) $(LIBTALLOC_LIBS) $(LIBWBCLIENT_LIBS) @SONAMEFLAG@`basename $@` + + ########## +@@ -3117,7 +3122,8 @@ + @echo "Linking shared library $@" + @$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_SMBPASS_OBJ) $(LIBCLI_LDAP_NDR_OBJ) -lpam $(DYNEXP) \ + $(LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \ +- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(LIBWBCLIENT_LIBS) ++ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(LIBWBCLIENT_LIBS) \ ++ @SONAMEFLAG@`basename $@` + + bin/tdbbackup@EXEEXT@: $(BINARY_PREREQS) $(TDBBACKUP_OBJ) $(LIBTALLOC) $(LIBTDB) + @echo Linking $@ diff --git a/net/samba36/files/patch-source3__configure.in b/net/samba36/files/patch-source3__configure.in new file mode 100644 index 00000000000..cb309b9ef24 --- /dev/null +++ b/net/samba36/files/patch-source3__configure.in @@ -0,0 +1,205 @@ +--- ./source3/configure.in.orig 2011-08-09 13:17:47.000000000 +0200 ++++ ./source3/configure.in 2011-10-13 23:29:28.000000000 +0200 +@@ -831,9 +831,13 @@ + AC_PATH_PROG(CUPS_CONFIG, cups-config) + + if test "x$CUPS_CONFIG" != x; then ++ ac_save_PRINT_CPPFLAGS=$CPPFLAGS ++ ac_save_PRINT_LDFLAGS=$LDFLAGS + +- ac_save_LDFLAGS=$LDFLAGS + ac_save_PRINT_LIBS=$PRINT_LIBS ++ CPPFLAGS="$CPPFLAGS `$CUPS_CONFIG --cflags`" ++ LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`" ++ + AC_CHECK_HEADERS(cups/cups.h cups/language.h) + + if test x"$ac_cv_header_cups_cups_h" = xyes -a \ +@@ -842,7 +846,7 @@ + # underlinked. With cups-config --libs we pull in unwanted and unneeded + # dendencies including thread libraries - use cups-config only if really + # required. +- AC_CHECK_LIB_EXT(cups, ac_save_PRINT_LIBS , httpConnect, ++ AC_CHECK_LIB_EXT(cups, ac_save_PRINT_LIBS, httpConnect, + [PRINT_LIBS="$ac_save_PRINT_LIBS -lcups"], + [AC_MSG_WARN([your cups library doesn't link with -lcups alone, it might be underlinked.]) ; + PRINT_LIBS="$ac_save_PRINT_LIBS `$CUPS_CONFIG --libs`"]) +@@ -852,10 +856,10 @@ + AC_CHECK_LIB_EXT(cups, PRINT_LIBS, httpConnectEncrypt) + else + AC_MSG_WARN([cups-config around but cups-devel not installed]) +- CFLAGS=$ac_save_CFLAGS +- LDFLAGS=$ac_save_LDFLAGS + PRINT_LIBS=$ac_save_PRINT_LIBS + fi ++ CPPFLAGS=$ac_save_PRINT_CPPFLAGS ++ LDFLAGS=$ac_save_PRINT_LDFLAGS + + elif test x"$enable_cups" = x"yes"; then + AC_MSG_ERROR(Cups support required but cups-config not located. Make sure cups-devel related files are installed.) +@@ -1943,9 +1947,6 @@ + AC_MSG_CHECKING([PICFLAG]) + AC_MSG_RESULT([$PICFLAG]) + +-AC_MSG_CHECKING([NSSSONAMEVERSIONSUFFIX]) +-AC_MSG_RESULT([$NSSSONAMEVERSIONSUFFIX]) +- + AC_CACHE_CHECK([whether building shared libraries actually works], + [ac_cv_shlib_works],[ + # try building a trivial shared library +@@ -4601,15 +4602,51 @@ + x"$ac_cv_header_pam_pam_modules_h" = x"no" ; then + if test x"${try_pam}" = x"yes";then + AC_MSG_ERROR([--with-pam=yes but pam_modules.h not found]) +- fi ++ fi + create_pam_modules=no +- fi ++ fi + + if test x"$use_pam" = x"yes"; then +- AC_DEFINE(WITH_PAM,1,[Whether to include PAM support]) ++ AC_DEFINE(WITH_PAM,1,[Whether to include PAM support]) + AC_DEFINE(HAVE_LIBPAM,1,[Whether libpam is available]) + AUTH_LIBS="$AUTH_LIBS $PAM_LIBS" +- with_pam_for_crypt=yes ++ with_pam_for_crypt=yes ++ ++ AC_VERIFY_C_PROTOTYPE( ++ [int pam_get_data(const pam_handle_t *pamh, const char *module_data_name, const void **data)], ++ [return 0;], ++ [AC_DEFINE(PAM_GET_DATA_ARG3_CONST_VOID_PP, 1, [Whether pam_get_data 3 argument is a const pointer to pointer])], ++ [ ++ dnl Old OpenPAM declaration ++ AC_VERIFY_C_PROTOTYPE( ++ [int pam_get_data(pam_handle_t *pamh, const char *module_data_name, void **data)], ++ [return 0;], ++ [AC_DEFINE(PAM_GET_DATA_ARG3_VOID_PP, 1, [Whether pam_get_data 3 argument is a void pointer to pointer])], ++ [], [ ++ #include <sys/types.h> ++ #if HAVE_SECURITY_PAM_APPL_H ++ #include <security/pam_appl.h> ++ #endif ++ #if HAVE_PAM_PAM_APPL_H ++ #include <pam/pam_appl.h> ++ #endif ++ #if HAVE_SECURITY_PAM_MODULES_H ++ #include <security/pam_modules.h> ++ #endif ++ ] ++ )],[ ++ #include <sys/types.h> ++ #if HAVE_SECURITY_PAM_APPL_H ++ #include <security/pam_appl.h> ++ #endif ++ #if HAVE_PAM_PAM_APPL_H ++ #include <pam/pam_appl.h> ++ #endif ++ #if HAVE_SECURITY_PAM_MODULES_H ++ #include <security/pam_modules.h> ++ #endif ++ ] ++ ) + + if test x"$create_pam_modules" = x"yes"; then + AC_DEFINE(WITH_PAM_MODULES,1,[Whether to include PAM MODULES support]) +@@ -4619,7 +4656,7 @@ + AC_CHECK_HEADERS(pam/pam_ext.h pam/_pam_macros.h) + AC_CHECK_FUNC_EXT(pam_vsyslog,$PAM_LIBS) + else +- AC_MSG_WARN([PAM support detected but PAM MODULES support is missing]) ++ AC_MSG_WARN([PAM support detected but PAM MODULES support is missing]) + fi + fi + AC_MSG_CHECKING(whether to use PAM support) +@@ -5821,9 +5858,17 @@ + [AC_MSG_RESULT(no)]) + + AC_MSG_CHECKING(for aio_suspend) +- AC_LINK_IFELSE([#include <aio.h> +-int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }], +-[AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)], ++ AC_LINK_IFELSE([ ++ #include <aio.h> ++ #if STDC_HEADERS ++ #include <stdlib.h> ++ #include <stddef.h> ++ #endif ++ int main() { ++ struct aiocb *a[1]; ++ return aio_suspend((const struct aiocb**)&a, 1, NULL); ++ } ++ ], [AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)]) + fi + +@@ -6276,12 +6321,13 @@ + NSSSONAMEVERSIONSUFFIX=".2" + WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_linux.o" + ;; +- *freebsd[[5-9]]*) ++ *freebsd*) + # FreeBSD winbind client is implemented as a wrapper around + # the Linux version. + NSSSONAMEVERSIONSUFFIX=".1" + WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_freebsd.o \ + ../nsswitch/winbind_nss_linux.o" ++ WINBIND_WINS_NSS_EXTRA_OBJS="../nsswitch/wins_freebsd.o" + WINBIND_NSS="../nsswitch/nss_winbind.$SHLIBEXT" + WINBIND_WINS_NSS="../nsswitch/nss_wins.$SHLIBEXT" + ;; +@@ -6426,10 +6474,14 @@ + AC_MSG_RESULT(no$winbind_no_reason) + fi + ++AC_MSG_CHECKING([NSSSONAMEVERSIONSUFFIX]) ++AC_MSG_RESULT([$NSSSONAMEVERSIONSUFFIX]) ++ + AC_SUBST(WINBIND_NSS) + AC_SUBST(WINBIND_WINS_NSS) + AC_SUBST(WINBIND_NSS_LDSHFLAGS) + AC_SUBST(WINBIND_NSS_EXTRA_OBJS) ++AC_SUBST(WINBIND_WINS_NSS_EXTRA_OBJS) + AC_SUBST(NSSSONAMEVERSIONSUFFIX) + + AC_SUBST(WINBIND_KRB5_LOCATOR) +@@ -6745,13 +6797,21 @@ + # Start + AC_CHECK_FUNC(getmntent) + +-AC_CHECK_HEADERS(sys/statfs.h) ++AC_CHECK_HEADERS(sys/statfs.h sys/mount.h) + + AC_MSG_CHECKING([vfs_fileid: checking for statfs() and struct statfs.f_fsid)]) + AC_CACHE_VAL(vfsfileid_cv_statfs,[ + AC_TRY_RUN([ + #include <sys/types.h> ++ #ifdef HAVE_SYS_PARAM_H ++ #include <sys/param.h> ++ #endif ++ #ifdef HAVE_SYS_MOUNT_H ++ #include <sys/mount.h> ++ #endif ++ #ifdef HAVE_SYS_STATFS_H + #include <sys/statfs.h> ++ #endif + int main(void) + { + struct statfs fsd; +@@ -7050,6 +7110,16 @@ + LIBS="$LIBS -ldmalloc" + fi + ++AC_ARG_ENABLE(dmalloc, [AS_HELP_STRING([--enable-dmalloc], [Enable heap debugging [default=no]])]) ++ ++if test "x$enable_dmalloc" = xyes ++then ++ AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging]) ++ AC_DEFINE(DMALLOC_FUNC_CHECK, 1, ++ [Define to check invariants around some common functions]) ++ LIBS="$LIBS -ldmalloc" ++fi ++ + dnl Remove -L/usr/lib/? from LDFLAGS and LIBS + LIB_REMOVE_USR_LIB(LDFLAGS) + LIB_REMOVE_USR_LIB(LIBS) diff --git a/net/samba36/files/patch-source3__include__includes.h b/net/samba36/files/patch-source3__include__includes.h new file mode 100644 index 00000000000..2f6978cafb5 --- /dev/null +++ b/net/samba36/files/patch-source3__include__includes.h @@ -0,0 +1,24 @@ +--- ./source3/include/includes.h.orig 2011-08-09 13:17:47.000000000 +0200 ++++ ./source3/include/includes.h 2011-10-04 00:34:33.000000000 +0200 +@@ -161,6 +161,10 @@ + #include <sys/uio.h> + #endif + ++#ifdef HAVE_SYS_SYSCTL_H ++#include <sys/sysctl.h> ++#endif ++ + #if HAVE_LANGINFO_H + #include <langinfo.h> + #endif +@@ -548,10 +552,6 @@ + #define SIGCLD SIGCHLD + #endif + +-#ifndef SIGRTMIN +-#define SIGRTMIN NSIG +-#endif +- + #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS) + #define OSF1_ENH_SEC 1 + #endif diff --git a/net/samba36/files/patch-source3__lib__fault.c b/net/samba36/files/patch-source3__lib__fault.c new file mode 100644 index 00000000000..07b573deedc --- /dev/null +++ b/net/samba36/files/patch-source3__lib__fault.c @@ -0,0 +1,164 @@ +--- ./source3/lib/fault.c.orig 2010-04-01 15:26:22.000000000 +0200 ++++ ./source3/lib/fault.c 2010-04-23 01:08:35.000000000 +0200 +@@ -25,6 +25,10 @@ + #endif + + ++#ifdef HAVE_SYS_SYSCTL_H ++#include <sys/sysctl.h> ++#endif ++ + #ifdef HAVE_SYS_PRCTL_H + #include <sys/prctl.h> + #endif +@@ -143,52 +147,93 @@ + * before dump_core() calls abort. + */ + #if (defined(FREEBSD) && defined(HAVE_SYSCTLBYNAME)) +-static char *get_freebsd_corepath(void) ++/* ++ * Expand the name described in corefilename, using name, uid, and pid. ++ * corefilename is a printf-like string, with three format specifiers: ++ * %N name of process ("name") ++ * %P process id (pid) ++ * %U user id (uid) ++ * For example, "%N.core" is the default; they can be disabled completely ++ * by using "/dev/null", or all core files can be stored in "/cores/%U/%N-%P". ++ */ ++static char *get_freebsd_corepath(const char *name) + { +- char *tmp_corepath = NULL; +- char *end = NULL; +- size_t len = 128; ++ TALLOC_CTX *tmp_ctx; ++ char format[MAXPATHLEN]; ++ char *freebsd_corepath = NULL, *buffer = NULL; ++ char *start, *end; ++ size_t len; + int ret; + +- /* Loop with increasing sizes so we don't allocate too much. */ +- do { +- if (len > 1024) { +- goto err_out; +- } +- +- tmp_corepath = (char *)talloc_realloc(NULL, tmp_corepath, +- char, len); +- if (!tmp_corepath) { +- return NULL; +- } +- +- ret = sysctlbyname("kern.corefile", tmp_corepath, &len, NULL, +- 0); +- if (ret == -1) { +- if (errno != ENOMEM) { +- DEBUG(0, ("sysctlbyname failed getting " +- "kern.corefile %s\n", +- strerror(errno))); +- goto err_out; +- } +- +- /* Not a large enough array, try a bigger one. */ +- len = len << 1; +- } +- } while (ret == -1); +- ++ len = sizeof(format); ++ /* Read format string */ ++ if((ret = sysctlbyname("kern.corefile", format, &len, NULL, 0)) == -1) { ++ return NULL; ++ } + /* Strip off the common filename expansion */ +- if ((end = strrchr_m(tmp_corepath, '/'))) { ++ if ((end=strrchr_m(format, '/')) != NULL) { + *end = '\0'; + } ++ /* Core file is relative to the cwd */ ++ if(!format[0] || format[0] != '/') { ++ return NULL; ++ } + +- return tmp_corepath; +- +- err_out: +- if (tmp_corepath) { +- talloc_free(tmp_corepath); ++ if((tmp_ctx = talloc_new(NULL)) == NULL) { ++ DEBUG(0, ("talloc_new failed\n")); ++ return NULL; + } +- return NULL; ++ if((buffer = talloc_strdup(tmp_ctx, "")) == NULL) { ++ DEBUG(0, ("talloc_strdup: Out of memory!\n")); ++ goto failed; ++ } ++ /* Parse format string and expand variables */ ++ start = format; ++ while((end=strchr_m(start, '%')) != NULL) { ++ /* Copy part of the string without format arguments */ ++ if(end != start) { ++ buffer = talloc_strndup_append_buffer(buffer, start, end - start); ++ if(buffer == NULL) { ++ DEBUG(0, ("talloc_strdup: Out of memory!\n")); ++ goto failed; ++ } ++ } ++ start = end + 1; ++ switch (*start) { ++ case '%': ++ buffer = talloc_strdup_append_buffer(buffer, "%%"); ++ break; ++ case 'N': /* process name */ ++ buffer = talloc_asprintf_append_buffer(buffer, "%s", name); ++ break; ++ case 'P': /* process id */ ++ buffer = talloc_asprintf_append_buffer(buffer, "%u", getpid()); ++ break; ++ case 'U': /* user id */ ++ buffer = talloc_asprintf_append_buffer(buffer, "%u", getuid()); ++ break; ++ default: ++ DEBUG(0,( ++ "Unknown format character %c in " ++ "corename `%s'\n", *start, format)); ++ } ++ if(buffer == NULL) { ++ DEBUG(0, ("talloc_asprintf_append_buffer: Out of memory!\n")); ++ goto failed; ++ } ++ start++; ++ } ++ /* Copy remaining part, if any */ ++ if((buffer = talloc_strdup_append_buffer(buffer, start)) == NULL) { ++ DEBUG(0, ("talloc_strdup_append_buffer: Out of memory!\n")); ++ goto failed; ++ } ++ /* Duplicate assembled string in the unattached contenxt */ ++ freebsd_corepath = talloc_strdup(NULL, buffer); ++failed: ++ TALLOC_FREE(tmp_ctx); ++ ++ return freebsd_corepath; + } + #endif + +@@ -204,8 +249,7 @@ + /* @todo: Add support for the linux corepath. */ + + char *tmp_corepath = NULL; +- tmp_corepath = get_freebsd_corepath(); +- ++ tmp_corepath = get_freebsd_corepath(progname); + /* If this has been set correctly, we're done. */ + if (tmp_corepath) { + return tmp_corepath; +@@ -281,7 +325,7 @@ + SAFE_FREE(logbase); + } + +- void dump_core(void) ++void dump_core(void) + { + static bool called; + diff --git a/net/samba36/files/patch-source3__lib__system.c b/net/samba36/files/patch-source3__lib__system.c new file mode 100644 index 00000000000..19b93038404 --- /dev/null +++ b/net/samba36/files/patch-source3__lib__system.c @@ -0,0 +1,19 @@ +--- ./source3/lib/system.c.orig 2011-08-09 13:17:47.000000000 +0200 ++++ ./source3/lib/system.c 2011-10-13 23:38:02.000000000 +0200 +@@ -2584,14 +2584,14 @@ + } + + /******************************************************************* +- An aio_fsync wrapper that will deal with 64-bit sizes. ++ An aio_suspend wrapper that will deal with 64-bit sizes. + ********************************************************************/ + + int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout) + { + #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64) && defined(HAVE_AIO_SUSPEND64) + return aio_suspend64(cblist, n, timeout); +-#elif defined(HAVE_AIO_FSYNC) ++#elif defined(HAVE_AIO_SUSPEND) + return aio_suspend(cblist, n, timeout); + #else + errno = ENOSYS; diff --git a/net/samba36/files/patch-source3__m4__aclocal.m4 b/net/samba36/files/patch-source3__m4__aclocal.m4 new file mode 100644 index 00000000000..090f4c9db49 --- /dev/null +++ b/net/samba36/files/patch-source3__m4__aclocal.m4 @@ -0,0 +1,172 @@ +--- ./source3/m4/aclocal.m4.orig 2011-08-09 13:17:47.000000000 +0200 ++++ ./source3/m4/aclocal.m4 2011-10-05 22:59:19.000000000 +0200 +@@ -379,11 +379,15 @@ + ac_new_flags="" + for i in [$]$1; do + case [$]i in +- -I/usr/include|-I/usr/include/) ;; ++ -I/usr/include|-I/usr/include/|-I/usr/local/include/|-I/usr/local/include) f=1;; + *) ac_new_flags="[$]ac_new_flags [$]i" ;; + esac + done +- $1=[$]ac_new_flags ++ if test [$]f; then ++ $1="[$]ac_new_flags -I/usr/local/include" ++ else ++ $1=[$]ac_new_flags ++ fi + ]) + + dnl Removes '-L/usr/lib[/]', '-Wl,-rpath,/usr/lib[/]' +@@ -431,104 +435,81 @@ + dnl those with the standalone portable libiconv installed). + AC_MSG_CHECKING(for iconv in $1) + jm_cv_func_iconv="no" ++ jm_cv_include="" + jm_cv_lib_iconv="" +- jm_cv_giconv=no ++ jm_cv_giconv="no" + jm_save_LIBS="$LIBS" + +- dnl Check for include in giconv.h but no lib needed +- if test "$jm_cv_func_iconv" != yes; then +- AC_TRY_LINK([#include <stdlib.h> ++ dnl Check for include in funny place but no lib needed ++ if test "$jm_cv_func_iconv" != yes; then ++ AC_TRY_LINK([#include <stdlib.h> + #include <giconv.h>], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], +- jm_cv_func_iconv=yes +- jm_cv_include="giconv.h" +- jm_cv_giconv="yes" +- jm_cv_lib_iconv="") ++ jm_cv_func_iconv=yes ++ jm_cv_include="giconv.h" ++ jm_cv_lib_iconv="" ++ jm_cv_giconv="yes") + +- dnl Standard iconv.h include, lib in glibc or libc ... +- if test "$jm_cv_func_iconv" != yes; then +- AC_TRY_LINK([#include <stdlib.h> ++ dnl Standard iconv.h include, lib in glibc or libc ... ++ if test "$jm_cv_func_iconv" != yes; then ++ AC_TRY_LINK([#include <stdlib.h> + #include <iconv.h>], +- [iconv_t cd = iconv_open("",""); ++ [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], +- jm_cv_include="iconv.h" +- jm_cv_func_iconv=yes +- jm_cv_lib_iconv="") +- +- dnl Include in giconv.h, libgiconv needed to link +- if test "$jm_cv_func_iconv" != yes; then +- jm_save_LIBS="$LIBS" +- LIBS="$LIBS -lgiconv" +- AC_TRY_LINK([#include <stdlib.h> ++ jm_cv_func_iconv=yes ++ jm_cv_include="iconv.h" ++ jm_cv_lib_iconv="") ++ ++ dnl Include in giconv.h, libgiconv needed to link ++ if test "$jm_cv_func_iconv" != yes; then ++ jm_save_LIBS="$LIBS" ++ LIBS="$LIBS -lgiconv" ++ AC_TRY_LINK([#include <stdlib.h> + #include <giconv.h>], +- [iconv_t cd = iconv_open("",""); ++ [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], +- jm_cv_lib_iconv=yes + jm_cv_func_iconv=yes + jm_cv_include="giconv.h" +- jm_cv_giconv=yes +- jm_cv_lib_iconv="giconv") ++ jm_cv_lib_iconv="giconv" ++ jm_cv_giconv=yes) + +- LIBS="$jm_save_LIBS" ++ LIBS="$jm_save_LIBS" + +- dnl Include in iconv.h, libiconv needed to link +- if test "$jm_cv_func_iconv" != yes; then +- jm_save_LIBS="$LIBS" +- LIBS="$LIBS -liconv" +- AC_TRY_LINK([#include <stdlib.h> ++ dnl Include in iconv.h, libiconv needed to link ++ if test "$jm_cv_func_iconv" != yes; then ++ jm_save_LIBS="$LIBS" ++ LIBS="$LIBS -liconv" ++ AC_TRY_LINK([#include <stdlib.h> + #include <iconv.h>], +- [iconv_t cd = iconv_open("",""); +- iconv(cd,NULL,NULL,NULL,NULL); +- iconv_close(cd);], +- jm_cv_include="iconv.h" +- jm_cv_func_iconv=yes +- jm_cv_lib_iconv="iconv") +- LIBS="$jm_save_LIBS" +- +- dnl Include in biconv.h, libbiconv needed to link +- if test "$jm_cv_func_iconv" != yes; then +- jm_save_LIBS="$LIBS" +- LIBS="$LIBS -lbiconv" +- AC_TRY_LINK([#include <stdlib.h> +-#include <biconv.h>], +- [iconv_t cd = iconv_open("",""); +- iconv(cd,NULL,NULL,NULL,NULL); +- iconv_close(cd);], +- jm_cv_lib_iconv=yes +- jm_cv_func_iconv=yes +- jm_cv_include="biconv.h" +- jm_cv_biconv=yes +- jm_cv_lib_iconv="biconv") ++ [iconv_t cd = iconv_open("",""); ++ iconv(cd,NULL,NULL,NULL,NULL); ++ iconv_close(cd);], ++ jm_cv_func_iconv=yes ++ jm_cv_include="iconv.h" ++ jm_cv_lib_iconv="iconv") + +- LIBS="$jm_save_LIBS" +- fi +- fi ++ LIBS="$jm_save_LIBS" ++ fi ++ fi + fi + fi +- fi +- if test "$jm_cv_func_iconv" = yes; then +- if test "$jm_cv_giconv" = yes; then +- AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h]) +- AC_MSG_RESULT(yes) +- ICONV_FOUND=yes +- else +- if test "$jm_cv_biconv" = yes; then +- AC_DEFINE(HAVE_BICONV, 1, [What header to include for iconv() function: biconv.h]) +- AC_MSG_RESULT(yes) +- ICONV_FOUND=yes ++ if test "$jm_cv_func_iconv" = yes; then ++ if test "$jm_cv_giconv" = yes; then ++ AC_DEFINE(HAVE_GICONV, 1, [What header to include for iconv() function: giconv.h]) ++ AC_MSG_RESULT(yes) ++ ICONV_FOUND=yes + else + AC_DEFINE(HAVE_ICONV, 1, [What header to include for iconv() function: iconv.h]) + AC_MSG_RESULT(yes) + ICONV_FOUND=yes + fi ++ else ++ AC_MSG_RESULT(no) + fi +- else +- AC_MSG_RESULT(no) +- fi + ]) + + AC_DEFUN(rjs_CHARSET,[ diff --git a/net/samba36/files/patch-source3__smbd__quotas.c b/net/samba36/files/patch-source3__smbd__quotas.c new file mode 100644 index 00000000000..deb36c3507b --- /dev/null +++ b/net/samba36/files/patch-source3__smbd__quotas.c @@ -0,0 +1,19 @@ +--- ./source3/smbd/quotas.c.orig 2010-04-01 15:26:22.000000000 +0200 ++++ ./source3/smbd/quotas.c 2010-04-23 01:08:35.000000000 +0200 +@@ -1035,6 +1035,7 @@ + if (!cutstr) + return False; + ++ memset(&D, '\0', sizeof(D)); + memset(cutstr, '\0', len+1); + host = strncat(cutstr,mnttype, sizeof(char) * len ); + DEBUG(5,("nfs_quotas: looking for mount on \"%s\"\n", cutstr)); +@@ -1043,7 +1044,7 @@ + args.gqa_pathp = testpath+1; + args.gqa_uid = uid; + +- DEBUG(5,("nfs_quotas: Asking for host \"%s\" rpcprog \"%i\" rpcvers \"%i\" network \"%s\"\n", host, RQUOTAPROG, RQUOTAVERS, "udp")); ++ DEBUG(5,("nfs_quotas: Asking for host \"%s\" rpcprog \"%lu\" rpcvers \"%lu\" network \"%s\"\n", host, RQUOTAPROG, RQUOTAVERS, "udp")); + + if ((clnt = clnt_create(host, RQUOTAPROG, RQUOTAVERS, "udp")) == NULL) { + ret = False; diff --git a/net/samba36/files/patch-source3__smbd__statvfs.c b/net/samba36/files/patch-source3__smbd__statvfs.c new file mode 100644 index 00000000000..141b13556c4 --- /dev/null +++ b/net/samba36/files/patch-source3__smbd__statvfs.c @@ -0,0 +1,64 @@ +--- ./source3/smbd/statvfs.c.orig 2010-04-01 15:26:22.000000000 +0200 ++++ ./source3/smbd/statvfs.c 2010-04-23 01:08:35.000000000 +0200 +@@ -3,6 +3,7 @@ + VFS API's statvfs abstraction + Copyright (C) Alexander Bokovoy 2005 + Copyright (C) Steve French 2005 ++ Copyright (C) Timur I. Bakeyev 2005 + Copyright (C) James Peach 2006 + + This program is free software; you can redistribute it and/or modify +@@ -47,9 +48,42 @@ + } + return result; + } +-#endif ++#elif defined(FREEBSD) ++static int bsd_statvfs(const char *path, vfs_statvfs_struct *statbuf) ++{ ++ struct statfs statfs_buf; ++ int result; + +-#if defined(DARWINOS) ++ result = statfs(path, &statfs_buf); ++ if(result != 0) { ++ return result; ++ } ++ ++ statbuf->OptimalTransferSize = statfs_buf.f_iosize; ++ statbuf->BlockSize = statfs_buf.f_bsize; ++ statbuf->TotalBlocks = statfs_buf.f_blocks; ++ statbuf->BlocksAvail = statfs_buf.f_bfree; ++ statbuf->UserBlocksAvail = statfs_buf.f_bavail; ++ statbuf->TotalFileNodes = statfs_buf.f_files; ++ statbuf->FreeFileNodes = statfs_buf.f_ffree; ++ statbuf->FsIdentifier = ++ (((uint64_t)statfs_buf.f_fsid.val[0]<<32) & 0xffffffff00000000LL) | (uint64_t)statfs_buf.f_fsid.val[1]; ++ /* Try to extrapolate some of the fs flags into the ++ * capabilities ++ */ ++ statbuf->FsCapabilities = ++ FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES; ++ if(statfs_buf.f_flags & MNT_ACLS) ++ statbuf->FsCapabilities |= FILE_PERSISTENT_ACLS; ++ if(statfs_buf.f_flags & MNT_QUOTA) ++ statbuf->FsCapabilities |= FILE_VOLUME_QUOTAS; ++ if(statfs_buf.f_flags & MNT_RDONLY) ++ statbuf->FsCapabilities |= FILE_READ_ONLY_VOLUME; ++ ++ return 0; ++} ++ ++#elif defined(DARWINOS) + + #include <sys/attr.h> + +@@ -135,6 +169,8 @@ + { + #if defined(LINUX) && defined(HAVE_FSID_INT) + return linux_statvfs(path, statbuf); ++#elif defined(FREEBSD) ++ return bsd_statvfs(path, statbuf); + #elif defined(DARWINOS) + return darwin_statvfs(path, statbuf); + #else diff --git a/net/samba36/files/patch-source3__utils__net_time.c b/net/samba36/files/patch-source3__utils__net_time.c new file mode 100644 index 00000000000..47c4125c43a --- /dev/null +++ b/net/samba36/files/patch-source3__utils__net_time.c @@ -0,0 +1,19 @@ +--- ./source3/utils/net_time.c.orig 2010-04-01 15:26:22.000000000 +0200 ++++ ./source3/utils/net_time.c 2010-04-23 01:08:35.000000000 +0200 +@@ -85,10 +85,15 @@ + if (!tm) { + return "unknown"; + } +- ++#if defined(FREEBSD) ++ return talloc_asprintf(talloc_tos(), "%02d%02d%02d%02d%02d.%02d", ++ tm->tm_year + 1900, tm->tm_mon+1, tm->tm_mday, ++ tm->tm_hour, tm->tm_min, tm->tm_sec); ++#else + return talloc_asprintf(talloc_tos(), "%02d%02d%02d%02d%04d.%02d", + tm->tm_mon+1, tm->tm_mday, tm->tm_hour, + tm->tm_min, tm->tm_year + 1900, tm->tm_sec); ++#endif + } + + int net_time_usage(struct net_context *c, int argc, const char **argv) diff --git a/net/samba36/files/pkg-deinstall.in b/net/samba36/files/pkg-deinstall.in new file mode 100644 index 00000000000..29ecc2cc31b --- /dev/null +++ b/net/samba36/files/pkg-deinstall.in @@ -0,0 +1,46 @@ +#! /bin/sh +# +PATH=/bin:/usr/sbin:/usr/bin:/usr/sbin + +SAMBA_CONFIG="%%SAMBA_CONFIG%%" +SAMBA_CONFDIR="%%SAMBA_CONFDIR%%" +SAMBA_SPOOL="%%SAMBA_SPOOL%%" +SAMBA_LOGDIR="%%SAMBA_LOGDIR%%" +SAMBA_RUNDIR="%%SAMBA_RUNDIR%%" +SAMBA_LOCKDIR="%%SAMBA_LOCKDIR%%" +SAMBA_PRIVATEDIR="%%SAMBA_PRIVATEDIR%%" +SAMBA_OWNER=root +SAMBA_GROUP=wheel +CMP="cmp" +RM="rm" +RMDIR="rmdir" +ECHO_CMD="echo" + +post-deinstall() { + if ${CMP} -s ${SAMBA_CONFDIR}/${SAMBA_CONFIG} ${SAMBA_CONFDIR}/${SAMBA_CONFIG}.sample; then + ${RM} -f ${SAMBA_CONFDIR}/${SAMBA_CONFIG} + fi + ${RM} -f ${SAMBA_CONFDIR}/${SAMBA_CONFIG}.sample + ${RM} -rf ${SAMBA_SPOOL} + ${RMDIR} ${SAMBA_LOGDIR} 2>/dev/null || true + for f in connections.tdb locking.tdb messages.tdb sessionid.tdb \ + unexpected.tdb brlock.tdb namelist.debug + do + ${RM} -f "${SAMBA_LOCKDIR}/${f}" + done + ${RMDIR} ${SAMBA_RUNDIR} 2>/dev/null || true + ${RMDIR} ${SAMBA_LOCKDIR} 2>/dev/null || true + ${RMDIR} ${SAMBA_PRIVATEDIR} 2>/dev/null || true + ${ECHO_CMD} "WARNING: If you will *NOT* use this package anymore, please remove the" + ${ECHO_CMD} " following directories manually:" + ${ECHO_CMD} " ${SAMBA_PRIVATEDIR}" + ${ECHO_CMD} " ${SAMBA_LOGDIR}" + ${ECHO_CMD} " ${SAMBA_LOCKDIR}" + ${ECHO_CMD} +} + +case $2 in + POST-DEINSTALL) + post-deinstall + ;; +esac diff --git a/net/samba36/files/pkg-install.in b/net/samba36/files/pkg-install.in new file mode 100644 index 00000000000..d9d9279e7da --- /dev/null +++ b/net/samba36/files/pkg-install.in @@ -0,0 +1,44 @@ +#! /bin/sh +# +PATH=/bin:/usr/sbin:/usr/bin:/usr/sbin + +EXAMPLESDIR="%%EXAMPLESDIR%%" +SAMBA_CONFIG="%%SAMBA_CONFIG%%" +SAMBA_CONFDIR="%%SAMBA_CONFDIR%%" +SAMBA_SPOOL="%%SAMBA_SPOOL%%" +SAMBA_LOGDIR="%%SAMBA_LOGDIR%%" +SAMBA_RUNDIR="%%SAMBA_RUNDIR%%" +SAMBA_LOCKDIR="%%SAMBA_LOCKDIR%%" +SAMBA_PRIVATEDIR="%%SAMBA_PRIVATEDIR%%" +SAMBA_OWNER=root +SAMBA_GROUP=wheel +INSTALL_DATA="install -c -m 0444" +MKDIR="mkdir -p" +CHMOD="chmod" +CHOWN="chown" + +post-install() { + ${MKDIR} ${SAMBA_SPOOL} && ${CHMOD} 1777 ${SAMBA_SPOOL} + ${MKDIR} ${SAMBA_LOGDIR} && ${CHMOD} 0755 ${SAMBA_LOGDIR} + ${MKDIR} ${SAMBA_RUNDIR} && ${CHMOD} 0755 ${SAMBA_RUNDIR} + ${MKDIR} ${SAMBA_LOCKDIR} && ${CHMOD} 0755 ${SAMBA_LOCKDIR} + ${MKDIR} ${SAMBA_PRIVATEDIR} && ${CHMOD} 0700 ${SAMBA_PRIVATEDIR} + if [ $(id -u) -eq 0 ]; then + INSTALL_DATA="${INSTALL_DATA} -o ${SAMBA_OWNER} -g ${SAMBA_GROUP}" + ${CHOWN} ${SAMBA_OWNER}:${SAMBA_GROUP} ${SAMBA_SPOOL} + ${CHOWN} ${SAMBA_OWNER}:${SAMBA_GROUP} ${SAMBA_LOGDIR} + ${CHOWN} ${SAMBA_OWNER}:${SAMBA_GROUP} ${SAMBA_RUNDIR} + ${CHOWN} ${SAMBA_OWNER}:${SAMBA_GROUP} ${SAMBA_LOCKDIR} + ${CHOWN} ${SAMBA_OWNER}:${SAMBA_GROUP} ${SAMBA_PRIVATEDIR} + fi + ${INSTALL_DATA} ${EXAMPLESDIR}/${SAMBA_CONFIG}.sample ${SAMBA_CONFDIR} + if [ ! -f ${SAMBA_CONFDIR}/${SAMBA_CONFIG} ]; then + ${INSTALL_DATA} ${EXAMPLESDIR}/${SAMBA_CONFIG}.sample ${SAMBA_CONFDIR}/${SAMBA_CONFIG} + fi +} + +case $2 in + POST-INSTALL) + post-install + ;; +esac diff --git a/net/samba36/files/pkg-message.in b/net/samba36/files/pkg-message.in new file mode 100644 index 00000000000..98866a899ff --- /dev/null +++ b/net/samba36/files/pkg-message.in @@ -0,0 +1,7 @@ +=============================================================================== +Samba3 *package* now doesn't include ADS support due the portability problems +with Kerberos5 libraries on different installations. You need to compile the +port yourself to get this functionality. + +For additional hints and directions, please, look into the README.FreeBSD file. +=============================================================================== diff --git a/net/samba36/files/samba.in b/net/samba36/files/samba.in new file mode 100644 index 00000000000..58f8fbb0b7e --- /dev/null +++ b/net/samba36/files/samba.in @@ -0,0 +1,168 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: nmbd smbd +%%WINBIND%%# PROVIDE: winbindd +# REQUIRE: NETWORKING SERVERS DAEMON ldconfig resolv +%%CUPS%%# REQUIRE: cupsd +# BEFORE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +#samba_enable="YES" +# or, for fine grain control: +#nmbd_enable="YES" +#smbd_enable="YES" +%%WINBIND%%# You need to enable winbindd separately, by adding: +%%WINBIND%%#winbindd_enable="YES" +# +# Configuration file can be set with: +#samba_config="%%SAMBA_CONFDIR%%/%%SAMBA_CONFIG%%" +# + +. /etc/rc.subr + +name="samba" +rcvar=$(set_rcvar) +set_rcvar ${rcvar} "NO" "Samba service" > /dev/null +# Defaults +eval ${rcvar}=\${${rcvar}:=NO} +samba_config_default="%%SAMBA_CONFDIR%%/%%SAMBA_CONFIG%%" +samba_config=${samba_config="${samba_config_default}"} +command_args=${samba_config:+-s "${samba_config}"} +# Fetch parameters from configuration file +testparm_command="%%PREFIX%%/bin/testparm" +smbcontrol_command="%%PREFIX%%/bin/smbcontrol" +samba_parm="${testparm_command} -s -v --parameter-name" +samba_idmap=$(${samba_parm} 'idmap uid' "${samba_config}" 2>/dev/null) +samba_lockdir=$(${samba_parm} 'lock directory' "${samba_config}" 2>/dev/null) +# Load configuration +load_rc_config "${name}" +# Setup dependent variables +if [ -n "${rcvar}" ] && checkyesno "${rcvar}"; then + nmbd_enable=${nmbd_enable=YES} + smbd_enable=${smbd_enable=YES} +%%WINBIND%% # Check that winbindd is actually configured +%%WINBIND%% if [ -n "${samba_idmap}" ]; then +%%WINBIND%% winbindd_enable=${winbindd_enable=YES} +%%WINBIND%% fi +fi +# XXX: Hack to enable check of the dependent variables +eval real_${rcvar}="\${${rcvar}:=NO}" ${rcvar}=YES +# nmbd +nmbd_enable=${nmbd_enable:=NO} +nmbd_flags=${nmbd_flags="-D"} +set_rcvar nmbd_enable "NO" "nmb daemon" >/dev/null +# smbd +smbd_enable=${smbd_enable:=NO} +smbd_flags=${smbd_flags="-D"} +set_rcvar smbd_enable "NO" "smb daemon" >/dev/null +%%WINBIND%%# winbindd +%%WINBIND%%winbindd_enable=${winbindd_enable:=NO} +%%WINBIND%%winbindd_flags=${winbindd_flags=''} +%%WINBIND%%set_rcvar winbindd_enable "NO" "winbind daemon" >/dev/null +# Custom commands +extra_commands="reload status" +start_precmd="samba_start_precmd" +start_cmd="samba_cmd" +stop_cmd="samba_cmd" +status_cmd="samba_cmd" +restart_precmd="samba_checkconfig" +reload_precmd="samba_checkconfig" +reload_cmd="samba_reload_cmd" +rcvar_cmd="samba_rcvar_cmd" +# +samba_daemons="nmbd smbd" +%%WINBIND%%samba_daemons="${samba_daemons} winbindd" +# Requirements +required_files="${samba_config}" +required_dirs="${samba_lockdir}" + +samba_checkconfig() { + echo -n "Performing sanity check on Samba configuration: " + if ${testparm_command} -s ${samba_config:+"${samba_config}"} >/dev/null 2>&1; then + echo "OK" + else + echo "FAILED" + return 1 + fi + return 0 +} + +samba_start_precmd() { + # XXX: Never delete winbindd_idmap, winbindd_cache and group_mapping + if [ -n "${samba_lockdir}" -a -d "${samba_lockdir}" ]; then + echo -n "Removing stale Samba tdb files: " + for file in brlock.tdb browse.dat connections.tdb gencache.tdb \ + locking.tdb messages.tdb namelist.debug sessionid.tdb \ + unexpected.tdb + do + rm "${samba_lockdir}/${file}" </dev/null 2>/dev/null && echo -n '.' + done + echo " done" + fi +} + +samba_rcvar_cmd() { + local rcvar + rcvar=$(set_rcvar ${name}) + eval ${rcvar}=\${real_${rcvar}} + # Prevent recursive calling + unset "${rc_arg}_cmd" "${rc_arg}_precmd" "${rc_arg}_postcmd" + # Check master variable + run_rc_command "${_rc_prefix}${rc_arg}" ${rc_extra_args} +} + +samba_reload_cmd() { + local name rcvar command pidfile + # Prevent recursive calling + unset "${rc_arg}_cmd" "${rc_arg}_precmd" "${rc_arg}_postcmd" + # Apply to all daemons + for name in ${samba_daemons}; do + rcvar=$(set_rcvar ${name}) + command="%%PREFIX%%/sbin/${name}" + pidfile="%%SAMBA_RUNDIR%%/${name}${pid_extra}.pid" + # Daemon should be enabled and running + if [ -n "${rcvar}" ] && checkyesno "${rcvar}"; then + if [ -n "$(check_pidfile "${pidfile}" "${command}")" ]; then + debug "reloading ${name} configuration" + echo "Reloading ${name}." + # XXX: Hack with pid_extra + ${smbcontrol_command} "${name}${pid_extra}" 'reload-config' ${command_args} >/dev/null 2>&1 + fi + fi + done +} + +samba_cmd() { + local name rcvar rcvars v command pidfile samba_daemons result + # Prevent recursive calling + unset "${rc_arg}_cmd" "${rc_arg}_precmd" "${rc_arg}_postcmd" + # Stop processes in the reverse order + if [ "${rc_arg}" = "stop" ] ; then + samba_daemons=$(reverse_list ${samba_daemons}) + fi + # Assume success + result=0 + # Apply to all daemons + for name in ${samba_daemons}; do + rcvar=$(set_rcvar ${name}) + # XXX + rcvars=''; v='' + command="%%PREFIX%%/sbin/${name}" + pidfile="%%SAMBA_RUNDIR%%/${name}${pid_extra}.pid" + # Daemon should be enabled and running + if [ -n "${rcvar}" ] && checkyesno "${rcvar}"; then + run_rc_command "${_rc_prefix}${rc_arg}" ${rc_extra_args} + # If any of the of the commands failed, take it as a total result + result=$((${result} || $?)) + fi + done + return ${result} +} + +run_rc_command "$1" diff --git a/net/samba36/files/sernet.patch b/net/samba36/files/sernet.patch new file mode 100644 index 00000000000..435b78109ce --- /dev/null +++ b/net/samba36/files/sernet.patch @@ -0,0 +1,60 @@ +0001-s3-vfs_prealloc-fix-build-on-SLES8.patch +samba3-3.4-honor-all-loopback-ips.patch + +From a1cd413de5493b06d7505a441bc5965f27ae38d4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bj@sernet.de> +Date: Tue, 9 Aug 2011 17:02:29 +0200 +Subject: [PATCH] s3:vfs_prealloc: fix build on SLES8 + +Signed-off-by: Stefan Metzmacher <metze@samba.org> +--- + source3/modules/vfs_prealloc.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/source3/modules/vfs_prealloc.c b/source3/modules/vfs_prealloc.c +index 4d1b2e1..fb2e46e 100644 +--- a/source3/modules/vfs_prealloc.c ++++ b/source3/modules/vfs_prealloc.c +@@ -18,6 +18,7 @@ + */ + + #include "includes.h" ++#include "system/filesys.h" + #include "smbd/smbd.h" + + /* Extent preallocation module. +-- +1.7.6 + +commit b6afe7ef236a454d8a6abf104b8846f817378f73 +Author: Björn Jacke <bj@sernet.de> +Date: Thu Oct 15 02:02:30 2009 +0200 + + util: cope the all loopback addresses IPv4 knows + + The fact that we just recogniced 127.0.0.1 as loopback IP address and not the + rest of the 127.0.0.0/8 IP address range we used the lo interface for sending + packages even though we should send them to some more physical interface. This + way we ended up with failing WINS registration and so on like in #6348. + On the lo interface sendto() returned "Invalid Argument" (EINVAL). + +diff --git a/lib/util/util_net.c b/lib/util/util_net.c +index 0ce495e..0511a28 100644 +--- a/lib/util/util_net.c ++++ b/lib/util/util_net.c +@@ -351,13 +351,11 @@ bool is_broadcast_addr(const struct sockaddr *pss) + } + + /** +- * Check if an IPv7 is 127.0.0.1 ++ * Check if an IPv4 is in IN_LOOPBACKNET (127.0.0.0/8) + */ + bool is_loopback_ip_v4(struct in_addr ip) + { +- struct in_addr a; +- a.s_addr = htonl(INADDR_LOOPBACK); +- return(ip.s_addr == a.s_addr); ++ return ((ntohl(ip.s_addr) & IN_CLASSA_NET) == (IN_LOOPBACKNET << IN_CLASSA_NSHIFT)); + } + + /** diff --git a/net/samba36/files/smb.conf.sample.in b/net/samba36/files/smb.conf.sample.in new file mode 100644 index 00000000000..4c7e56dbdf5 --- /dev/null +++ b/net/samba36/files/smb.conf.sample.in @@ -0,0 +1,306 @@ +# This is the main Samba configuration file. You should read the +# smb.conf(5) manual page in order to understand the options listed +# here. Samba has a huge number of configurable options (perhaps too +# many!) most of which are not shown in this example +# +# For a step to step guide on installing, configuring and using samba, +# read the Samba-HOWTO-Collection. This may be obtained from: +# http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf +# +# Many working examples of smb.conf files can be found in the +# Samba-Guide which is generated daily and can be downloaded from: +# http://www.samba.org/samba/docs/Samba-Guide.pdf +# +# Any line which starts with a ; (semi-colon) or a # (hash) +# is a comment and is ignored. In this example we will use a # +# for commentry and a ; for parts of the config file that you +# may wish to enable +# +# NOTE: Whenever you modify this file you should run the command "testparm" +# to check that you have not made any basic syntactic errors. +# +#======================= Global Settings ===================================== +[global] + +# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH + workgroup = MYGROUP + +# server string is the equivalent of the NT Description field + server string = Samba Server + +# Security mode. Defines in which mode Samba will operate. Possible +# values are share, user, server, domain and ads. Most people will want +# user level security. See the Samba-HOWTO-Collection for details. + security = user + +# This option is important for security. It allows you to restrict +# connections to machines which are on your local network. The +# following example restricts access to two C class networks and +# the "loopback" interface. For more examples of the syntax see +# the smb.conf man page +; hosts allow = 192.168.1. 192.168.2. 127. + +# If you want to automatically load your printer list rather +# than setting them up individually then you'll need this + load printers = yes + +# you may wish to override the location of the printcap file +; printcap name = /etc/printcap + +# on SystemV system setting printcap name to lpstat should allow +# you to automatically obtain a printer list from the SystemV spool +# system +; printcap name = lpstat + +# It should not be necessary to specify the print system type unless +# it is non-standard. Currently supported print systems include: +# bsd, cups, sysv, plp, lprng, aix, hpux, qnx +; printing = cups + +# Uncomment this if you want a guest account, you must add this to /etc/passwd +# otherwise the user "nobody" is used +; guest account = pcguest + +# this tells Samba to use a separate log file for each machine +# that connects + log file = %%SAMBA_LOGDIR%%/log.%m + +# Put a capping on the size of the log files (in Kb). + max log size = 50 + +# Use password server option only with security = server +# The argument list may include: +# password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name] +# or to auto-locate the domain controller/s +# password server = * +; password server = <NT-Server-Name> + +# Use the realm option only with security = ads +# Specifies the Active Directory realm the host is part of +; realm = MY_REALM + +# Backend to store user information in. New installations should +# use either tdbsam or ldapsam. smbpasswd is available for backwards +# compatibility. tdbsam requires no further configuration. +; passdb backend = tdbsam + +# Using the following line enables you to customise your configuration +# on a per machine basis. The %m gets replaced with the netbios name +# of the machine that is connecting. +# Note: Consider carefully the location in the configuration file of +# this line. The included file is read at that point. +; include = %%SAMBA_CONFDIR%%/smb.conf.%m + +# Most people will find that this option gives better performance. +# See the chapter 'Samba performance issues' in the Samba HOWTO Collection +# and the manual pages for details. +# You may want to add the following on a Linux system: +; socket options = SO_RCVBUF=8192 SO_SNDBUF=8192 + +# Configure Samba to use multiple interfaces +# If you have multiple network interfaces then you must list them +# here. See the man page for details. +; interfaces = 192.168.12.2/24 192.168.13.2/24 + +# Browser Control Options: +# set local master to no if you don't want Samba to become a master +# browser on your network. Otherwise the normal election rules apply +; local master = no + +# OS Level determines the precedence of this server in master browser +# elections. The default value should be reasonable +; os level = 33 + +# Domain Master specifies Samba to be the Domain Master Browser. This +# allows Samba to collate browse lists between subnets. Don't use this +# if you already have a Windows NT domain controller doing this job +; domain master = yes + +# Preferred Master causes Samba to force a local browser election on startup +# and gives it a slightly higher chance of winning the election +; preferred master = yes + +# Enable this if you want Samba to be a domain logon server for +# Windows95 workstations. +; domain logons = yes + +# if you enable domain logons then you may want a per-machine or +# per user logon script +# run a specific logon batch file per workstation (machine) +; logon script = %m.bat +# run a specific logon batch file per username +; logon script = %U.bat + +# Where to store roving profiles (only for Win95 and WinNT) +# %L substitutes for this servers netbios name, %U is username +# You must uncomment the [Profiles] share below +; logon path = \\%L\Profiles\%U + +# Windows Internet Name Serving Support Section: +# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server +; wins support = yes + +# WINS Server - Tells the NMBD components of Samba to be a WINS Client +# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both +; wins server = w.x.y.z + +# WINS Proxy - Tells Samba to answer name resolution queries on +# behalf of a non WINS capable client, for this to work there must be +# at least one WINS Server on the network. The default is NO. +; wins proxy = yes + +# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names +# via DNS nslookups. The default is NO. + dns proxy = no + +# Charset settings +; display charset = koi8-r +; unix charset = koi8-r +; dos charset = cp866 + +# Use extended attributes to store file modes +; store dos attributes = yes +; map hidden = no +; map system = no +; map archive = no + +# Use inherited ACLs for directories +; nt acl support = yes +; inherit acls = yes +; map acl inherit = yes + +# These scripts are used on a domain controller or stand-alone +# machine to add or delete corresponding unix accounts +; add user script = /usr/sbin/useradd %u +; add group script = /usr/sbin/groupadd %g +; add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null -s /bin/false %u +; delete user script = /usr/sbin/userdel %u +; delete user from group script = /usr/sbin/deluser %u %g +; delete group script = /usr/sbin/groupdel %g + + +#============================ Share Definitions ============================== +[homes] + comment = Home Directories + browseable = no + writable = yes + +# Un-comment the following and create the netlogon directory for Domain Logons +; [netlogon] +; comment = Network Logon Service +; path = /usr/local/samba/lib/netlogon +; guest ok = yes +; writable = no +; share modes = no + + +# Un-comment the following to provide a specific roving profile share +# the default is to use the user's home directory +;[Profiles] +; path = /usr/local/samba/profiles +; browseable = no +; guest ok = yes + + +# NOTE: If you have a BSD-style print system there is no need to +# specifically define each individual printer +[printers] + comment = All Printers + path = %%SAMBA_SPOOL%% + browseable = no +# Set public = yes to allow user 'guest account' to print + guest ok = no + writable = no + printable = yes + +# This one is useful for people to share files +;[tmp] +; comment = Temporary file space +; path = /tmp +; read only = no +; public = yes + +# A publicly accessible directory, but read only, except for people in +# the "staff" group +;[public] +; comment = Public Stuff +; path = /home/samba +; public = yes +; writable = yes +; printable = no +; write list = @staff + +# Other examples. +# +# A private printer, usable only by fred. Spool data will be placed in fred's +# home directory. Note that fred must have write access to the spool directory, +# wherever it is. +;[fredsprn] +; comment = Fred's Printer +; valid users = fred +; path = /homes/fred +; printer = freds_printer +; public = no +; writable = no +; printable = yes + +# A private directory, usable only by fred. Note that fred requires write +# access to the directory. +;[fredsdir] +; comment = Fred's Service +; path = /usr/somewhere/private +; valid users = fred +; public = no +; writable = yes +; printable = no + +# a service which has a different directory for each machine that connects +# this allows you to tailor configurations to incoming machines. You could +# also use the %U option to tailor it by user name. +# The %m gets replaced with the machine name that is connecting. +;[pchome] +; comment = PC Directories +; path = /usr/pc/%m +; public = no +; writable = yes + +# A publicly accessible directory, read/write to all users. Note that all files +# created in the directory by users will be owned by the default user, so +# any user with access can delete any other user's files. Obviously this +# directory must be writable by the default user. Another user could of course +# be specified, in which case all files would be owned by that user instead. +;[public] +; path = /usr/somewhere/else/public +; public = yes +; only guest = yes +; writable = yes +; printable = no + +# The following two entries demonstrate how to share a directory so that two +# users can place files there that will be owned by the specific users. In this +# setup, the directory should be writable by both users and should have the +# sticky bit set on it to prevent abuse. Obviously this could be extended to +# as many users as required. +;[myshare] +; comment = Mary's and Fred's stuff +; path = /usr/somewhere/shared +; valid users = mary fred +; public = no +; writable = yes +; printable = no +; create mask = 0765 +; + +# This is a DRAFT sample configuration for the ACLs on the ZFS partition. +# +; nt acl support = yes +; inherit acls = no +; map acl inherit = yes +; +;[zpool] +; path = /tank/zpool +; unix extensions = no +; vfs objects = zfsacl +; nfs4:mode = special +; nfs4:acedup = merge +; nfs4:chown = yes |