summaryrefslogtreecommitdiff
path: root/net/samba30/patches
diff options
context:
space:
mode:
Diffstat (limited to 'net/samba30/patches')
-rw-r--r--net/samba30/patches/patch-aa13
-rw-r--r--net/samba30/patches/patch-ac17
-rw-r--r--net/samba30/patches/patch-ae15
-rw-r--r--net/samba30/patches/patch-af57
-rw-r--r--net/samba30/patches/patch-ag23
-rw-r--r--net/samba30/patches/patch-ak13
-rw-r--r--net/samba30/patches/patch-at298
-rw-r--r--net/samba30/patches/patch-au161
-rw-r--r--net/samba30/patches/patch-av13
-rw-r--r--net/samba30/patches/patch-aw13
-rw-r--r--net/samba30/patches/patch-ax13
-rw-r--r--net/samba30/patches/patch-ay13
-rw-r--r--net/samba30/patches/patch-ba118
-rw-r--r--net/samba30/patches/patch-bc13
-rw-r--r--net/samba30/patches/patch-bd16
-rw-r--r--net/samba30/patches/patch-be31
-rw-r--r--net/samba30/patches/patch-bg49
-rw-r--r--net/samba30/patches/patch-bh34
-rw-r--r--net/samba30/patches/patch-bi17
-rw-r--r--net/samba30/patches/patch-bm17
-rw-r--r--net/samba30/patches/patch-bn11
-rw-r--r--net/samba30/patches/patch-bo15
-rw-r--r--net/samba30/patches/patch-bp14
-rw-r--r--net/samba30/patches/patch-bq17
-rw-r--r--net/samba30/patches/patch-br31
-rw-r--r--net/samba30/patches/patch-bs77
-rw-r--r--net/samba30/patches/patch-bu36
-rw-r--r--net/samba30/patches/patch-bv71
-rw-r--r--net/samba30/patches/patch-bw34
-rw-r--r--net/samba30/patches/patch-ca11
-rw-r--r--net/samba30/patches/patch-ce13
-rw-r--r--net/samba30/patches/patch-cf13
-rw-r--r--net/samba30/patches/patch-cg13
-rw-r--r--net/samba30/patches/patch-ch22
-rw-r--r--net/samba30/patches/patch-ci13
-rw-r--r--net/samba30/patches/patch-da47
-rw-r--r--net/samba30/patches/patch-ee40
-rw-r--r--net/samba30/patches/patch-lib_replace_test_os2__delete.c14
-rw-r--r--net/samba30/patches/patch-libsmb_clikrb5.c15
39 files changed, 1451 insertions, 0 deletions
diff --git a/net/samba30/patches/patch-aa b/net/samba30/patches/patch-aa
new file mode 100644
index 00000000000..ddd99da9f16
--- /dev/null
+++ b/net/samba30/patches/patch-aa
@@ -0,0 +1,13 @@
+$NetBSD: patch-aa,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- nsswitch/pam_winbind.c.orig 2009-09-30 21:21:56.000000000 +0900
++++ nsswitch/pam_winbind.c
+@@ -1295,6 +1295,8 @@ static char *_pam_delete(register char *
+ return NULL;
+ }
+
++PAM_EXTERN int pam_sm_close_session(pam_handle_t *, int, int, const char **);
++
+ /*
+ * obtain a password from the user
+ */
diff --git a/net/samba30/patches/patch-ac b/net/samba30/patches/patch-ac
new file mode 100644
index 00000000000..59524819778
--- /dev/null
+++ b/net/samba30/patches/patch-ac
@@ -0,0 +1,17 @@
+$NetBSD: patch-ac,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- include/local.h.orig 2005-10-12 13:03:38.000000000 -0400
++++ include/local.h
+@@ -170,10 +170,10 @@
+ * Default passwd chat script.
+ */
+
+-#define DEFAULT_PASSWD_CHAT "*new*password* %n\\n *new*password* %n\\n *changed*"
++#define DEFAULT_PASSWD_CHAT "*\\n*ew\\spassword* %n\\n *ew\\spassword* %n\\n *updating\\sthe\\sdatabase...\\npasswd:\\sdone\\n"
+
+ /* Minimum length of allowed password when changing UNIX password. */
+-#define MINPASSWDLENGTH 5
++#define MINPASSWDLENGTH 6
+
+ /* maximum ID number used for session control. This cannot be larger
+ than 62*62 for the current code */
diff --git a/net/samba30/patches/patch-ae b/net/samba30/patches/patch-ae
new file mode 100644
index 00000000000..262206e5a15
--- /dev/null
+++ b/net/samba30/patches/patch-ae
@@ -0,0 +1,15 @@
+$NetBSD: patch-ae,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- auth/pampass.c.orig 2005-10-12 13:03:28.000000000 -0400
++++ auth/pampass.c
+@@ -43,6 +43,10 @@
+
+ #include <security/pam_appl.h>
+
++#if defined(PAM_AUTHTOK_RECOVERY_ERR) && !defined(PAM_AUTHTOK_RECOVER_ERR)
++#define PAM_AUTHTOK_RECOVER_ERR PAM_AUTHTOK_RECOVERY_ERR
++#endif
++
+ /*
+ * Structure used to communicate between the conversation function
+ * and the server_login/change password functions.
diff --git a/net/samba30/patches/patch-af b/net/samba30/patches/patch-af
new file mode 100644
index 00000000000..60b9a0499fb
--- /dev/null
+++ b/net/samba30/patches/patch-af
@@ -0,0 +1,57 @@
+$NetBSD: patch-af,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- ../examples/smb.conf.default.orig 2007-02-04 18:59:31.000000000 +0000
++++ ../examples/smb.conf.default 2007-02-11 15:22:45.000000000 +0000
+@@ -26,7 +26,7 @@
+ workgroup = MYGROUP
+
+ # server string is the equivalent of the NT Description field
+- server string = Samba Server
++ server string = Samba %v (%h)
+
+ # Security mode. Defines in which mode Samba will operate. Possible
+ # values are share, user, server, domain and ads. Most people will want
+@@ -63,10 +63,10 @@
+
+ # this tells Samba to use a separate log file for each machine
+ # that connects
+- log file = /usr/local/samba/var/log.%m
++; log file = /usr/local/samba/var/log.%m
+
+ # Put a capping on the size of the log files (in Kb).
+- max log size = 50
++; max log size = 50
+
+ # Use password server option only with security = server
+ # The argument list may include:
+@@ -145,7 +145,7 @@
+
+ # DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
+ # via DNS nslookups. The default is NO.
+- dns proxy = no
++; dns proxy = no
+
+ # These scripts are used on a domain controller or stand-alone
+ # machine to add or delete corresponding unix accounts
+@@ -182,14 +182,14 @@
+
+ # NOTE: If you have a BSD-style print system there is no need to
+ # specifically define each individual printer
+-[printers]
+- comment = All Printers
+- path = /usr/spool/samba
+- browseable = no
++;[printers]
++; comment = All Printers
++; path = /var/tmp
++; browseable = no
+ # Set public = yes to allow user 'guest account' to print
+- guest ok = no
+- writable = no
+- printable = yes
++; guest ok = no
++; writable = no
++; printable = yes
+
+ # This one is useful for people to share files
+ ;[tmp]
diff --git a/net/samba30/patches/patch-ag b/net/samba30/patches/patch-ag
new file mode 100644
index 00000000000..0a30b826ae0
--- /dev/null
+++ b/net/samba30/patches/patch-ag
@@ -0,0 +1,23 @@
+$NetBSD: patch-ag,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- passdb/passdb.c.orig 2007-05-24 00:29:17.000000000 +0900
++++ passdb/passdb.c
+@@ -135,6 +135,7 @@ static NTSTATUS samu_set_unix_internal(s
+ const char *guest_account = lp_guestaccount();
+ const char *domain = global_myname();
+ uint32 urid;
++ char *gecos;
+
+ if ( !pwd ) {
+ return NT_STATUS_NO_SUCH_USER;
+@@ -143,7 +144,9 @@ static NTSTATUS samu_set_unix_internal(s
+ /* Basic properties based upon the Unix account information */
+
+ pdb_set_username(user, pwd->pw_name, PDB_SET);
+- pdb_set_fullname(user, pwd->pw_gecos, PDB_SET);
++ gecos = passwd_expand_gecos(pwd);
++ pdb_set_fullname(user, gecos, PDB_SET);
++ SAFE_FREE(gecos);
+ pdb_set_domain (user, get_global_sam_name(), PDB_DEFAULT);
+ #if 0
+ /* This can lead to a primary group of S-1-22-2-XX which
diff --git a/net/samba30/patches/patch-ak b/net/samba30/patches/patch-ak
new file mode 100644
index 00000000000..d4cee8d8042
--- /dev/null
+++ b/net/samba30/patches/patch-ak
@@ -0,0 +1,13 @@
+$NetBSD: patch-ak,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- pam_smbpass/general.h.orig 2005-10-12 13:03:29.000000000 -0400
++++ pam_smbpass/general.h
+@@ -1,8 +1,4 @@
+-#ifndef LINUX
+-/* This is only needed by modules in the Sun implementation. */
+ #include <security/pam_appl.h>
+-#endif /* LINUX */
+-
+ #include <security/pam_modules.h>
+
+ #ifndef PAM_AUTHTOK_RECOVER_ERR
diff --git a/net/samba30/patches/patch-at b/net/samba30/patches/patch-at
new file mode 100644
index 00000000000..97d04a2d4f5
--- /dev/null
+++ b/net/samba30/patches/patch-at
@@ -0,0 +1,298 @@
+$NetBSD: patch-at,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- configure.orig 2009-09-30 22:08:58.000000000 +0900
++++ configure
+@@ -765,6 +765,7 @@ swatdir
+ privatedir
+ logfilebase
+ piddir
++statedir
+ lockdir
+ configdir
+ target_os
+@@ -827,6 +828,7 @@ with_fhs
+ with_privatedir
+ with_rootsbindir
+ with_lockdir
++with_statedir
+ with_piddir
+ with_swatdir
+ with_configdir
+@@ -1537,6 +1539,7 @@ Optional Packages:
+ --with-privatedir=DIR Where to put smbpasswd ($ac_default_prefix/private)
+ --with-rootsbindir=DIR Which directory to use for root sbin ($ac_default_prefix/sbin)
+ --with-lockdir=DIR Where to put lock files ($ac_default_prefix/var/locks)
++ --with-statedir=DIR Where to put state files ($ac_default_prefix/var/locks)
+ --with-piddir=DIR Where to put pid files ($ac_default_prefix/var/locks)
+ --with-swatdir=DIR Where to put SWAT files ($ac_default_prefix/swat)
+ --with-configdir=DIR Where to put configuration files ($libdir)
+@@ -2296,6 +2299,7 @@ fi
+
+ rootsbindir="\${SBINDIR}"
+ lockdir="\${VARDIR}/locks"
++statedir="\${VARDIR}/locks"
+ piddir="\${VARDIR}/locks"
+ test "${mandir}" || mandir="\${prefix}/man"
+ logfilebase="\${VARDIR}"
+@@ -2310,7 +2314,8 @@ swatdir="\${prefix}/swat"
+ if test "${with_fhs+set}" = set; then
+ withval=$with_fhs; case "$withval" in
+ yes)
+- lockdir="\${VARDIR}/lib/samba"
++ lockdir="\${VARDIR}/run/samba"
++ statedir="\${VARDIR}/lib/samba"
+ piddir="\${VARDIR}/run"
+ mandir="\${prefix}/share/man"
+ logfilebase="\${VARDIR}/log/samba"
+@@ -2384,6 +2389,26 @@ fi
+
+
+ #################################################
++# set state directory location
++
++# Check whether --with-statedir was given.
++if test "${with_statedir+set}" = set; then
++ withval=$with_statedir; case "$withval" in
++ yes|no)
++ #
++ # Just in case anybody calls it without argument
++ #
++ { $as_echo "$as_me:$LINENO: WARNING: --with-statedir called without argument - will use default" >&5
++$as_echo "$as_me: WARNING: --with-statedir called without argument - will use default" >&2;}
++ ;;
++ * )
++ statedir="$withval"
++ ;;
++ esac
++fi
++
++
++#################################################
+ # set pid directory location
+
+ # Check whether --with-piddir was given.
+@@ -2624,6 +2649,7 @@ fi
+
+
+
++
+ ## check for --enable-debug first before checking CFLAGS before
+ ## so that we don't mix -O and -g
+ # Check whether --enable-debug was given.
+@@ -33670,7 +33696,8 @@ done
+
+
+
+-for ac_func in getdents getdents64
++
++for ac_func in getdents getdents64 getpwent_r
+ do
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+@@ -49983,6 +50010,77 @@ done
+ ##################
+ # look for a method of finding the list of network interfaces
+ iface=no;
++{ $as_echo "$as_me:$LINENO: checking for iface ifaddrs" >&5
++$as_echo_n "checking for iface ifaddrs... " >&6; }
++if test "${samba_cv_HAVE_IFACE_IFADDRS+set}" = set; then
++ $as_echo_n "(cached) " >&6
++else
++
++SAVE_CPPFLAGS="$CPPFLAGS"
++CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
++if test "$cross_compiling" = yes; then
++ samba_cv_HAVE_IFACE_IFADDRS=cross
++else
++ cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++
++#define HAVE_IFACE_IFADDRS 1
++#define AUTOCONF_TEST 1
++#include "${srcdir-.}/lib/interfaces.c"
++_ACEOF
++rm -f conftest$ac_exeext
++if { (ac_try="$ac_link"
++case "(($ac_try" in
++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++ *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++ (eval "$ac_link") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
++ { (case "(($ac_try" in
++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++ *) ac_try_echo=$ac_try;;
++esac
++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
++$as_echo "$ac_try_echo") >&5
++ (eval "$ac_try") 2>&5
++ ac_status=$?
++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }; then
++ samba_cv_HAVE_IFACE_IFADDRS=yes
++else
++ $as_echo "$as_me: program exited with status $ac_status" >&5
++$as_echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++( exit $ac_status )
++samba_cv_HAVE_IFACE_IFADDRS=no
++fi
++rm -rf conftest.dSYM
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
++fi
++
++
++fi
++{ $as_echo "$as_me:$LINENO: result: $samba_cv_HAVE_IFACE_IFADDRS" >&5
++$as_echo "$samba_cv_HAVE_IFACE_IFADDRS" >&6; }
++CPPFLAGS="$SAVE_CPPFLAGS"
++if test x"$samba_cv_HAVE_IFACE_IFADDRS" = x"yes"; then
++ iface=yes;
++cat >>confdefs.h <<\_ACEOF
++#define HAVE_IFACE_IFADDRS 1
++_ACEOF
++
++fi
++
++if test $iface = no; then
+ { $as_echo "$as_me:$LINENO: checking for iface AIX" >&5
+ $as_echo_n "checking for iface AIX... " >&6; }
+ if test "${samba_cv_HAVE_IFACE_AIX+set}" = set; then
+@@ -50053,6 +50151,7 @@ cat >>confdefs.h <<\_ACEOF
+ _ACEOF
+
+ fi
++fi
+
+ if test $iface = no; then
+ { $as_echo "$as_me:$LINENO: checking for iface ifconf" >&5
+@@ -53580,9 +53679,9 @@ LIBS="-lcrypto $KRB5_LIBS $LIBS"
+
+
+
+- { $as_echo "$as_me:$LINENO: checking for des_set_key in -lcrypto" >&5
+-$as_echo_n "checking for des_set_key in -lcrypto... " >&6; }
+-if test "${ac_cv_lib_ext_crypto_des_set_key+set}" = set; then
++ { $as_echo "$as_me:$LINENO: checking for EVP_des_cbc in -lcrypto" >&5
++$as_echo_n "checking for EVP_des_cbc in -lcrypto... " >&6; }
++if test "${ac_cv_lib_ext_crypto_EVP_des_cbc+set}" = set; then
+ $as_echo_n "(cached) " >&6
+ else
+ cat >conftest.$ac_ext <<_ACEOF
+@@ -53598,11 +53697,11 @@ cat >>conftest.$ac_ext <<_ACEOF
+ #ifdef __cplusplus
+ extern "C"
+ #endif
+-char des_set_key ();
++char EVP_des_cbc ();
+ int
+ main ()
+ {
+-return des_set_key ();
++return EVP_des_cbc ();
+ ;
+ return 0;
+ }
+@@ -53628,13 +53727,13 @@ $as_echo "$ac_try_echo") >&5
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+- ac_cv_lib_ext_crypto_des_set_key=yes;
++ ac_cv_lib_ext_crypto_EVP_des_cbc=yes;
+ ac_cv_lib_ext_crypto=yes
+ else
+ $as_echo "$as_me: failed program was:" >&5
+ sed 's/^/| /' conftest.$ac_ext >&5
+
+- ac_cv_lib_ext_crypto_des_set_key=no;
++ ac_cv_lib_ext_crypto_EVP_des_cbc=no;
+ ac_cv_lib_ext_crypto=no
+ fi
+
+@@ -53643,11 +53742,11 @@ rm -f core conftest.err conftest.$ac_obj
+ conftest$ac_exeext conftest.$ac_ext
+
+ fi
+-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ext_crypto_des_set_key" >&5
+-$as_echo "$ac_cv_lib_ext_crypto_des_set_key" >&6; }
+- if test $ac_cv_lib_ext_crypto_des_set_key = yes; then
++{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ext_crypto_EVP_des_cbc" >&5
++$as_echo "$ac_cv_lib_ext_crypto_EVP_des_cbc" >&6; }
++ if test $ac_cv_lib_ext_crypto_EVP_des_cbc = yes; then
+ cat >>confdefs.h <<_ACEOF
+-#define HAVE_DES_SET_KEY 1
++#define HAVE_EVP_DES_CBC 1
+ _ACEOF
+
+ fi
+@@ -67399,31 +67498,39 @@ case "$host_os" in
+ NSSSONAMEVERSIONSUFFIX=".2"
+ WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_linux.o"
+ ;;
+- *freebsd[5-9]*)
+- # 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_NSS="nsswitch/nss_winbind.$SHLIBEXT"
+- WINBIND_WINS_NSS="nsswitch/nss_wins.$SHLIBEXT"
+- ;;
+-
+- *netbsd*[3-9]*)
+- # NetBSD winbind client is implemented as a wrapper
+- # around the Linux version. It needs getpwent_r() to
+- # indicate libc's use of the correct nsdispatch API.
+- #
+- if test x"$ac_cv_func_getpwent_r" = x"yes"; then
+- WINBIND_NSS_EXTRA_OBJS="\
+- nsswitch/winbind_nss_netbsd.o \
++ *freebsd*)
++ case "$UNAME_R" in
++ [5-9]*)
++ # 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_NSS="nsswitch/nss_winbind.$SHLIBEXT"
+ WINBIND_WINS_NSS="nsswitch/nss_wins.$SHLIBEXT"
+- else
+- HAVE_WINBIND=no
+- winbind_no_reason=", getpwent_r is missing on $host_os so winbind is unsupported"
+- fi
++ ;;
++ esac
++ ;;
++
++ *netbsd*)
++ case "$UNAME_R" in
++ [3-9]*)
++ # NetBSD winbind client is implemented as a wrapper
++ # around the Linux version. It needs getpwent_r() to
++ # indicate libc's use of the correct nsdispatch API.
++ #
++ if test x"$ac_cv_func_getpwent_r" = x"yes"; then
++ WINBIND_NSS_EXTRA_OBJS="\
++ nsswitch/winbind_nss_netbsd.o \
++ nsswitch/winbind_nss_linux.o"
++ WINBIND_NSS="nsswitch/nss_winbind.$SHLIBEXT"
++ WINBIND_WINS_NSS="nsswitch/nss_wins.$SHLIBEXT"
++ else
++ HAVE_WINBIND=no
++ winbind_no_reason=", getpwent_r is missing on $host_os so winbind is unsupported"
++ fi
++ ;;
++ esac
+ ;;
+ *irix*)
+ # IRIX has differently named shared libraries
diff --git a/net/samba30/patches/patch-au b/net/samba30/patches/patch-au
new file mode 100644
index 00000000000..cf8c9a9bdbf
--- /dev/null
+++ b/net/samba30/patches/patch-au
@@ -0,0 +1,161 @@
+$NetBSD: patch-au,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+--- configure.in.orig 2009-09-30 21:21:56.000000000 +0900
++++ configure.in
+@@ -38,6 +38,7 @@ AC_PREFIX_DEFAULT(/usr/local/samba)
+
+ rootsbindir="\${SBINDIR}"
+ lockdir="\${VARDIR}/locks"
++statedir="\${VARDIR}/locks"
+ piddir="\${VARDIR}/locks"
+ test "${mandir}" || mandir="\${prefix}/man"
+ logfilebase="\${VARDIR}"
+@@ -51,7 +52,8 @@ AC_ARG_WITH(fhs,
+ [ --with-fhs Use FHS-compliant paths (default=no)],
+ [ case "$withval" in
+ yes)
+- lockdir="\${VARDIR}/lib/samba"
++ lockdir="\${VARDIR}/run/samba"
++ statedir="\${VARDIR}/lib/samba"
+ piddir="\${VARDIR}/run"
+ mandir="\${prefix}/share/man"
+ logfilebase="\${VARDIR}/log/samba"
+@@ -111,6 +113,22 @@ AC_ARG_WITH(lockdir,
+ esac])
+
+ #################################################
++# set state directory location
++AC_ARG_WITH(statedir,
++[ --with-statedir=DIR Where to put state files ($ac_default_prefix/var/locks)],
++[ case "$withval" in
++ yes|no)
++ #
++ # Just in case anybody calls it without argument
++ #
++ AC_MSG_WARN([--with-statedir called without argument - will use default])
++ ;;
++ * )
++ statedir="$withval"
++ ;;
++ esac])
++
++#################################################
+ # set pid directory location
+ AC_ARG_WITH(piddir,
+ [ --with-piddir=DIR Where to put pid files ($ac_default_prefix/var/locks)],
+@@ -257,6 +275,7 @@ fi
+
+ AC_SUBST(configdir)
+ AC_SUBST(lockdir)
++AC_SUBST(statedir)
+ AC_SUBST(piddir)
+ AC_SUBST(logfilebase)
+ AC_SUBST(privatedir)
+@@ -1245,7 +1264,7 @@ AC_CHECK_FUNCS(lstat64 fopen64 atexit gr
+ AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf)
+ AC_CHECK_FUNCS(opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64)
+ AC_CHECK_FUNCS(getpwent_r)
+-AC_CHECK_FUNCS(getdents getdents64)
++AC_CHECK_FUNCS(getdents getdents64 getpwent_r)
+ AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
+ AC_CHECK_FUNCS(syslog vsyslog timegm)
+ AC_CHECK_FUNCS(setlocale nl_langinfo)
+@@ -2824,6 +2843,20 @@ AC_CHECK_FUNCS(getpagesize)
+ ##################
+ # look for a method of finding the list of network interfaces
+ iface=no;
++AC_CACHE_CHECK([for iface ifaddrs],samba_cv_HAVE_IFACE_IFADDRS,[
++SAVE_CPPFLAGS="$CPPFLAGS"
++CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
++AC_TRY_RUN([
++#define HAVE_IFACE_IFADDRS 1
++#define AUTOCONF_TEST 1
++#include "${srcdir-.}/lib/interfaces.c"],
++ samba_cv_HAVE_IFACE_IFADDRS=yes,samba_cv_HAVE_IFACE_IFADDRS=no,samba_cv_HAVE_IFACE_IFADDRS=cross)])
++CPPFLAGS="$SAVE_CPPFLAGS"
++if test x"$samba_cv_HAVE_IFACE_IFADDRS" = x"yes"; then
++ iface=yes;AC_DEFINE(HAVE_IFACE_IFADDRS,1,[Whether iface ifaddrs is available])
++fi
++
++if test $iface = no; then
+ AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}"
+@@ -2837,6 +2870,7 @@ CPPFLAGS="$SAVE_CPPFLAGS"
+ if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then
+ iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
+ fi
++fi
+
+ if test $iface = no; then
+ AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[
+@@ -3531,7 +3565,7 @@ if test x"$with_ads_support" != x"no"; t
+ AC_CHECK_LIB_EXT(k5crypto, KRB5_LIBS, krb5_encrypt_data)
+
+ # Heimdal checks.
+- AC_CHECK_LIB_EXT(crypto, KRB5_LIBS, des_set_key)
++ AC_CHECK_LIB_EXT(crypto, KRB5_LIBS, EVP_des_cbc)
+ AC_CHECK_LIB_EXT(asn1, KRB5_LIBS, copy_Authenticator)
+ AC_CHECK_LIB_EXT(roken, KRB5_LIBS, roken_getaddrinfo_hostspec)
+
+@@ -5830,31 +5864,39 @@ case "$host_os" in
+ NSSSONAMEVERSIONSUFFIX=".2"
+ WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_linux.o"
+ ;;
+- *freebsd[[5-9]]*)
+- # 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_NSS="nsswitch/nss_winbind.$SHLIBEXT"
+- WINBIND_WINS_NSS="nsswitch/nss_wins.$SHLIBEXT"
+- ;;
+-
+- *netbsd*[[3-9]]*)
+- # NetBSD winbind client is implemented as a wrapper
+- # around the Linux version. It needs getpwent_r() to
+- # indicate libc's use of the correct nsdispatch API.
+- #
+- if test x"$ac_cv_func_getpwent_r" = x"yes"; then
+- WINBIND_NSS_EXTRA_OBJS="\
+- nsswitch/winbind_nss_netbsd.o \
++ *freebsd*)
++ case "$UNAME_R" in
++ [[5-9]]*)
++ # 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_NSS="nsswitch/nss_winbind.$SHLIBEXT"
+ WINBIND_WINS_NSS="nsswitch/nss_wins.$SHLIBEXT"
+- else
+- HAVE_WINBIND=no
+- winbind_no_reason=", getpwent_r is missing on $host_os so winbind is unsupported"
+- fi
++ ;;
++ esac
++ ;;
++
++ *netbsd*)
++ case "$UNAME_R" in
++ [[3-9]]*)
++ # NetBSD winbind client is implemented as a wrapper
++ # around the Linux version. It needs getpwent_r() to
++ # indicate libc's use of the correct nsdispatch API.
++ #
++ if test x"$ac_cv_func_getpwent_r" = x"yes"; then
++ WINBIND_NSS_EXTRA_OBJS="\
++ nsswitch/winbind_nss_netbsd.o \
++ nsswitch/winbind_nss_linux.o"
++ WINBIND_NSS="nsswitch/nss_winbind.$SHLIBEXT"
++ WINBIND_WINS_NSS="nsswitch/nss_wins.$SHLIBEXT"
++ else
++ HAVE_WINBIND=no
++ winbind_no_reason=", getpwent_r is missing on $host_os so winbind is unsupported"
++ fi
++ ;;
++ esac
+ ;;
+ *irix*)
+ # IRIX has differently named shared libraries
diff --git a/net/samba30/patches/patch-av b/net/samba30/patches/patch-av
new file mode 100644
index 00000000000..920291426cb
--- /dev/null
+++ b/net/samba30/patches/patch-av
@@ -0,0 +1,13 @@
+$NetBSD: patch-av,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- script/installman.sh.orig 2007-03-01 13:55:02.000000000 +0900
++++ script/installman.sh
+@@ -33,7 +33,7 @@ for lang in $langs; do
+ langdir=$MANDIR/$lang
+ for d in $MANDIR $langdir $langdir/man1 $langdir/man5 $langdir/man7 $langdir/man8; do
+ if [ ! -d $d ]; then
+- mkdir $d
++ mkdir -p $d
+ if [ ! -d $d ]; then
+ echo Failed to make directory $d, does $USER have privileges?
+ exit 1
diff --git a/net/samba30/patches/patch-aw b/net/samba30/patches/patch-aw
new file mode 100644
index 00000000000..2d80b3b6cc3
--- /dev/null
+++ b/net/samba30/patches/patch-aw
@@ -0,0 +1,13 @@
+$NetBSD: patch-aw,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- script/installmodules.sh.orig 2006-04-20 03:29:42.000000000 +0100
++++ script/installmodules.sh 2007-02-11 17:24:32.000000000 +0000
+@@ -11,7 +11,7 @@
+
+ for d in $prefix $LIBDIR; do
+ if [ ! -d $DESTDIR/$d ]; then
+-mkdir $DESTDIR/$d
++mkdir -p $DESTDIR/$d
+ if [ ! -d $DESTDIR/$d ]; then
+ echo Failed to make directory $DESTDIR/$d
+ exit 1
diff --git a/net/samba30/patches/patch-ax b/net/samba30/patches/patch-ax
new file mode 100644
index 00000000000..433677403a9
--- /dev/null
+++ b/net/samba30/patches/patch-ax
@@ -0,0 +1,13 @@
+$NetBSD: patch-ax,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- script/installscripts.sh.orig 2007-11-14 22:15:04.000000000 -0500
++++ script/installscripts.sh
+@@ -12,7 +12,7 @@ echo Installing scripts in $BINDIR
+
+ for d in $BINDIR; do
+ if [ ! -d $d ]; then
+- mkdir $d
++ mkdir -p $d
+ if [ ! -d $d ]; then
+ echo Failed to make directory $d
+ echo Have you run installbin first?
diff --git a/net/samba30/patches/patch-ay b/net/samba30/patches/patch-ay
new file mode 100644
index 00000000000..1965646857f
--- /dev/null
+++ b/net/samba30/patches/patch-ay
@@ -0,0 +1,13 @@
+$NetBSD: patch-ay,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- script/installswat.sh.orig 2007-11-14 22:15:04.000000000 -0500
++++ script/installswat.sh
+@@ -140,7 +140,7 @@ if [ -d $SRCDIR../docs/htmldocs/ ]; then
+
+ INSTALLDIR="$DESTDIR/$SWATDIR/help/`echo $dir | sed 's/htmldocs\///g'`"
+ if test ! -d "$INSTALLDIR" -a "$mode" = 'install'; then
+- mkdir "$INSTALLDIR"
++ mkdir -p "$INSTALLDIR"
+ if test ! -d "$INSTALLDIR"; then
+ echo "Failed to make directory $INSTALLDIR, does $USER have privileges? "
+ exit 1
diff --git a/net/samba30/patches/patch-ba b/net/samba30/patches/patch-ba
new file mode 100644
index 00000000000..6e4aa9995a2
--- /dev/null
+++ b/net/samba30/patches/patch-ba
@@ -0,0 +1,118 @@
+$NetBSD: patch-ba,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- Makefile.in.orig Mon Jan 19 10:40:09 2009
++++ Makefile.in Wed Sep 9 11:00:17 2009
+@@ -106,6 +106,9 @@
+ # the directory where lock files go
+ LOCKDIR = @lockdir@
+
++# the directory where persistent-state files go
++STATEDIR = @statedir@
++
+ # the directory where pid files go
+ PIDDIR = @piddir@
+
+@@ -136,7 +139,7 @@
+ PATH_FLAGS1 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DSBINDIR=\"$(SBINDIR)\"
+ PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"$(BINDIR)\"
+ PATH_FLAGS3 = $(PATH_FLAGS2) -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"
+-PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
++PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DSTATEDIR=\"$(STATEDIR)\" -DPIDDIR=\"$(PIDDIR)\"
+ PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \
+ -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"
+ PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\"
+@@ -1059,7 +1062,7 @@
+
+ bin/smbget@EXEEXT@: proto_exists $(SMBGET_OBJ) @BUILD_POPT@ bin/.dummy
+ @echo Linking $@
+- @$(CC) $(FLAGS) -o $@ $(SMBGET_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
++ @$(CC) $(FLAGS) -o $@ $(SMBGET_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(PASSDB_LIBS)
+
+ bin/samtest@EXEEXT@: $(SAMTEST_OBJ) @BUILD_POPT@ bin/.dummy
+ @echo Linking $@
+@@ -1094,12 +1097,12 @@
+ bin/smbcacls@EXEEXT@: proto_exists $(SMBCACLS_OBJ) @BUILD_POPT@ bin/.dummy
+ @echo Linking $@
+ @$(CC) $(FLAGS) -o $@ $(SMBCACLS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ \
+- $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
++ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(PASSDB_LIBS)
+
+ bin/smbcquotas@EXEEXT@: proto_exists $(SMBCQUOTAS_OBJ) @BUILD_POPT@ bin/.dummy
+ @echo Linking $@
+ @$(CC) $(FLAGS) -o $@ $(SMBCQUOTAS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ \
+- $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
++ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(PASSDB_LIBS)
+
+ bin/eventlogadm@EXEEXT@: proto_exists $(EVTLOGADM_OBJ) @BUILD_POPT@ bin/.dummy
+ @echo Linking $@
+@@ -1162,7 +1165,7 @@
+ bin/libsmbclient.@SHLIBEXT@: proto_exists $(LIBSMBCLIENT_OBJ)
+ @echo Linking libsmbclient shared library $@
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(LIBSMBCLIENT_OBJ) $(LIBS) \
+- $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \
++ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(PASSDB_LIBS) \
+ @SONAMEFLAG@`basename $@`.$(LIBSMBCLIENT_MAJOR)
+
+ bin/libsmbclient.a: proto_exists $(LIBSMBCLIENT_OBJ)
+@@ -1534,11 +1537,11 @@
+ @echo Linking $@
+ @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(DYNEXP) $(NTLM_AUTH_OBJ) \
+ $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(LIBS) \
+- @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS)
++ @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(PASSDB_LIBS)
+
+ bin/pam_smbpass.@SHLIBEXT@: $(PAM_SMBPASS_OBJ)
+ @echo "Linking shared library $@"
+- @$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_SMBPASS_OBJ) -lpam $(DYNEXP) $(LIBS) $(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS)
++ @$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_SMBPASS_OBJ) -lpam $(DYNEXP) $(LIBS) $(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS) $(PASSDB_LIBS)
+
+ bin/tdbbackup@EXEEXT@: proto_exists $(TDBBACKUP_OBJ) bin/.dummy
+ @echo Linking $@
+@@ -1573,7 +1576,7 @@
+ @echo Linking $@
+ @$(CC) $(FLAGS) -o $@ $(DYNEXP) script/tests/timelimit.o
+
+-install: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSUPCALL@ installman installscripts installdat installswat installmodules @INSTALL_LIBSMBCLIENT@ @INSTALL_LIBMSRPC@ @INSTALL_PAM_MODULES@ @INSTALL_LIBSMBSHAREMODES@
++install: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSUPCALL@ installman installscripts installdat installswat installmodules @INSTALL_LIBSMBCLIENT@ @INSTALL_LIBMSRPC@ @INSTALL_PAM_MODULES@ @INSTALL_LIBSMBSHAREMODES@ @INSTALL_LIBADDNS@
+
+ install-everything: install installmodules
+
+@@ -1586,7 +1589,7 @@
+ # is not used
+
+ installdirs:
+- @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(BINDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(PRIVATEDIR) $(PIDDIR) $(LOCKDIR) $(MANDIR)
++ @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(BINDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(STATEDIR) $(PRIVATEDIR) $(PIDDIR) $(LOCKDIR) $(MANDIR)
+
+ installservers: all installdirs
+ @$(SHELL) script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(SBINDIR) $(SBIN_PROGS)
+@@ -1609,7 +1612,9 @@
+ @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(PDBLIBDIR) $(PDB_MODULES)
+ @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(RPCLIBDIR) $(RPC_MODULES)
+ @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(IDMAPLIBDIR) $(IDMAP_MODULES)
+- @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(NSSINFOLIBDIR) $(NSS_INFO_MODULES)
++ @if [ -n "$(NSS_INFO_MODULES)" ]; then \
++ $(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(NSSINFOLIBDIR) $(NSS_INFO_MODULES); \
++ fi
+ @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(CHARSETLIBDIR) $(CHARSET_MODULES)
+ @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR) $(prefix) $(AUTHLIBDIR) $(AUTH_MODULES)
+ @$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(PDBLIBDIR) ldapsam.@SHLIBEXT@ ldapsam_compat.@SHLIBEXT@
+@@ -1617,7 +1622,9 @@
+ @$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(AUTHLIBDIR) sam.@SHLIBEXT@ sam_ignoredomain.@SHLIBEXT@
+ @$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(AUTHLIBDIR) domain.@SHLIBEXT@ trustdomain.@SHLIBEXT@ ntdomain.@SHLIBEXT@
+ @$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(AUTHLIBDIR) builtin.@SHLIBEXT@ guest.@SHLIBEXT@ fixed_challenge.@SHLIBEXT@ name_to_ntstatus.@SHLIBEXT@
+- @$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(NSSINFOLIBDIR) ../idmap/ad.@SHLIBEXT@ rfc2307.@SHLIBEXT@ sfu.@SHLIBEXT@
++ @if [ -n "$(NSS_INFO_MODULES)" ]; then \
++ $(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(NSSINFOLIBDIR) ../idmap/ad.@SHLIBEXT@ rfc2307.@SHLIBEXT@ sfu.@SHLIBEXT@; \
++ fi
+
+ installscripts: installdirs
+ @$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
+@@ -1715,6 +1722,7 @@
+ @echo " privatedir: $(PRIVATE_DIR)"
+ @echo " configdir: $(CONFIGDIR)"
+ @echo " lockdir: $(LOCKDIR)"
++ @echo " statedir: $(STATEDIR)"
+ @echo " piddir: $(PIDDIR)"
+ @echo " swatdir: $(SWATDIR)"
+
diff --git a/net/samba30/patches/patch-bc b/net/samba30/patches/patch-bc
new file mode 100644
index 00000000000..c35378ab2fd
--- /dev/null
+++ b/net/samba30/patches/patch-bc
@@ -0,0 +1,13 @@
+$NetBSD: patch-bc,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- intl/lang_tdb.c.orig 2007-03-01 13:54:31.000000000 +0900
++++ intl/lang_tdb.c
+@@ -139,7 +139,7 @@ BOOL lang_tdb_init(const char *lang)
+ goto done;
+ }
+
+- asprintf(&path, "%s%s.tdb", lock_path("lang_"), lang);
++ asprintf(&path, "%s%s.tdb", state_path("lang_"), lang);
+
+ DEBUG(10, ("lang_tdb_init: loading %s\n", path));
+
diff --git a/net/samba30/patches/patch-bd b/net/samba30/patches/patch-bd
new file mode 100644
index 00000000000..36192e126d5
--- /dev/null
+++ b/net/samba30/patches/patch-bd
@@ -0,0 +1,16 @@
+$NetBSD: patch-bd,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- lib/account_pol.c.orig 2007-03-01 13:54:30.000000000 +0900
++++ lib/account_pol.c
+@@ -213,9 +213,9 @@ BOOL init_account_policy(void)
+ return True;
+ }
+
+- tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
++ tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
+ if (!tdb) { /* the account policies files does not exist or open failed, try to create a new one */
+- tdb = tdb_open_log(lock_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++ tdb = tdb_open_log(state_path("account_policy.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ if (!tdb) {
+ DEBUG(0,("Failed to open account policy database\n"));
+ return False;
diff --git a/net/samba30/patches/patch-be b/net/samba30/patches/patch-be
new file mode 100644
index 00000000000..f079ed11130
--- /dev/null
+++ b/net/samba30/patches/patch-be
@@ -0,0 +1,31 @@
+$NetBSD: patch-be,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- nmbd/nmbd_winsserver.c.orig 2008-03-08 10:33:35.000000000 -0500
++++ nmbd/nmbd_winsserver.c
+@@ -574,7 +574,7 @@ BOOL initialise_wins(void)
+ }
+
+ /* Open the wins.tdb. */
+- wins_tdb = tdb_open_log(lock_path("wins.tdb"), 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST, O_CREAT|O_RDWR, 0600);
++ wins_tdb = tdb_open_log(state_path("wins.tdb"), 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST, O_CREAT|O_RDWR, 0600);
+ if (!wins_tdb) {
+ DEBUG(0,("initialise_wins: failed to open wins.tdb. Error was %s\n",
+ strerror(errno) ));
+@@ -585,7 +585,7 @@ BOOL initialise_wins(void)
+
+ add_samba_names_to_subnet(wins_server_subnet);
+
+- if((fp = x_fopen(lock_path(WINS_LIST),O_RDONLY,0)) == NULL) {
++ if((fp = x_fopen(state_path(WINS_LIST),O_RDONLY,0)) == NULL) {
+ DEBUG(2,("initialise_wins: Can't open wins database file %s. Error was %s\n",
+ WINS_LIST, strerror(errno) ));
+ return True;
+@@ -2338,7 +2338,7 @@ void wins_write_database(time_t t, BOOL
+ }
+ }
+
+- slprintf(fname,sizeof(fname)-1,"%s/%s", lp_lockdir(), WINS_LIST);
++ pstrcpy(fname, state_path(WINS_LIST));
+ all_string_sub(fname,"//", "/", 0);
+ slprintf(fnamenew,sizeof(fnamenew)-1,"%s.%u", fname, (unsigned int)sys_getpid());
+
diff --git a/net/samba30/patches/patch-bg b/net/samba30/patches/patch-bg
new file mode 100644
index 00000000000..fa7337fae14
--- /dev/null
+++ b/net/samba30/patches/patch-bg
@@ -0,0 +1,49 @@
+$NetBSD: patch-bg,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- printing/nt_printing.c.orig 2009-09-30 21:21:56.000000000 +0900
++++ printing/nt_printing.c
+@@ -351,8 +351,7 @@ static int sec_desc_upg_fn( TDB_CONTEXT
+ SEC_DESC *sec, *new_sec;
+ TALLOC_CTX *ctx = state;
+ int result, i;
+- uint32 sd_size;
+- size_t size_new_sec;
++ size_t sd_size, size_new_sec;
+ DOM_SID sid;
+
+ if (!data.dptr || data.dsize == 0) {
+@@ -560,28 +559,28 @@ BOOL nt_printing_init(void)
+
+ if (tdb_drivers)
+ tdb_close(tdb_drivers);
+- tdb_drivers = tdb_open_log(lock_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++ tdb_drivers = tdb_open_log(state_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ if (!tdb_drivers) {
+ DEBUG(0,("nt_printing_init: Failed to open nt drivers database %s (%s)\n",
+- lock_path("ntdrivers.tdb"), strerror(errno) ));
++ state_path("ntdrivers.tdb"), strerror(errno) ));
+ return False;
+ }
+
+ if (tdb_printers)
+ tdb_close(tdb_printers);
+- tdb_printers = tdb_open_log(lock_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++ tdb_printers = tdb_open_log(state_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ if (!tdb_printers) {
+ DEBUG(0,("nt_printing_init: Failed to open nt printers database %s (%s)\n",
+- lock_path("ntprinters.tdb"), strerror(errno) ));
++ state_path("ntprinters.tdb"), strerror(errno) ));
+ return False;
+ }
+
+ if (tdb_forms)
+ tdb_close(tdb_forms);
+- tdb_forms = tdb_open_log(lock_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++ tdb_forms = tdb_open_log(state_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ if (!tdb_forms) {
+ DEBUG(0,("nt_printing_init: Failed to open nt forms database %s (%s)\n",
+- lock_path("ntforms.tdb"), strerror(errno) ));
++ state_path("ntforms.tdb"), strerror(errno) ));
+ return False;
+ }
+
diff --git a/net/samba30/patches/patch-bh b/net/samba30/patches/patch-bh
new file mode 100644
index 00000000000..df73b1c3b91
--- /dev/null
+++ b/net/samba30/patches/patch-bh
@@ -0,0 +1,34 @@
+$NetBSD: patch-bh,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- registry/reg_db.c.orig 2007-03-01 13:55:05.000000000 +0900
++++ registry/reg_db.c
+@@ -234,12 +234,12 @@ BOOL regdb_init( void )
+ if ( tdb_reg )
+ return True;
+
+- if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
++ if ( !(tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) )
+ {
+- tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++ tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ if ( !tdb_reg ) {
+ DEBUG(0,("regdb_init: Failed to open registry %s (%s)\n",
+- lock_path("registry.tdb"), strerror(errno) ));
++ state_path("registry.tdb"), strerror(errno) ));
+ return False;
+ }
+
+@@ -281,11 +281,11 @@ WERROR regdb_open( void )
+
+ become_root();
+
+- tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
++ tdb_reg = tdb_open_log(state_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600);
+ if ( !tdb_reg ) {
+ result = ntstatus_to_werror( map_nt_error_from_unix( errno ) );
+ DEBUG(0,("regdb_open: Failed to open %s! (%s)\n",
+- lock_path("registry.tdb"), strerror(errno) ));
++ state_path("registry.tdb"), strerror(errno) ));
+ }
+
+ unbecome_root();
diff --git a/net/samba30/patches/patch-bi b/net/samba30/patches/patch-bi
new file mode 100644
index 00000000000..92ae1df7b75
--- /dev/null
+++ b/net/samba30/patches/patch-bi
@@ -0,0 +1,17 @@
+$NetBSD: patch-bi,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- lib/sharesec.c.orig 2007-03-01 13:54:29.000000000 +0900
++++ lib/sharesec.c
+@@ -47,10 +47,10 @@ BOOL share_info_db_init(void)
+ return True;
+ }
+
+- share_tdb = tdb_open_log(lock_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++ share_tdb = tdb_open_log(state_path("share_info.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ if (!share_tdb) {
+ DEBUG(0,("Failed to open share info database %s (%s)\n",
+- lock_path("share_info.tdb"), strerror(errno) ));
++ state_path("share_info.tdb"), strerror(errno) ));
+ return False;
+ }
+
diff --git a/net/samba30/patches/patch-bm b/net/samba30/patches/patch-bm
new file mode 100644
index 00000000000..cb7b5d1ace4
--- /dev/null
+++ b/net/samba30/patches/patch-bm
@@ -0,0 +1,17 @@
+$NetBSD: patch-bm,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- dynconfig.c.orig 2007-02-04 18:59:28.000000000 +0000
++++ dynconfig.c 2007-02-11 17:51:32.000000000 +0000
+@@ -68,5 +68,12 @@
+ pstring dyn_LOCKDIR = LOCKDIR;
+ pstring dyn_PIDDIR = PIDDIR;
+
++/**
++ * @brief Directory holding persistent-state files.
++ *
++ * Not writable, but used to set a default in the parameter table.
++ **/
++pstring dyn_STATEDIR = STATEDIR;
++
+ pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
+ pstring dyn_PRIVATE_DIR = PRIVATE_DIR;
diff --git a/net/samba30/patches/patch-bn b/net/samba30/patches/patch-bn
new file mode 100644
index 00000000000..4a8aa39d972
--- /dev/null
+++ b/net/samba30/patches/patch-bn
@@ -0,0 +1,11 @@
+$NetBSD: patch-bn,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- include/dynconfig.h.orig 2007-02-04 18:59:23.000000000 +0000
++++ include/dynconfig.h 2007-02-11 17:52:33.000000000 +0000
+@@ -34,5 +34,6 @@
+ extern fstring dyn_SHLIBEXT;
+ extern pstring dyn_LOCKDIR;
+ extern pstring dyn_PIDDIR;
++extern pstring dyn_STATEDIR;
+ extern pstring dyn_SMB_PASSWD_FILE;
+ extern pstring dyn_PRIVATE_DIR;
diff --git a/net/samba30/patches/patch-bo b/net/samba30/patches/patch-bo
new file mode 100644
index 00000000000..8c14ec32564
--- /dev/null
+++ b/net/samba30/patches/patch-bo
@@ -0,0 +1,15 @@
+$NetBSD: patch-bo,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- nmbd/nmbd.c.orig 2009-09-30 21:21:56.000000000 +0900
++++ nmbd/nmbd.c
+@@ -769,6 +769,10 @@ static BOOL open_sockets(BOOL isdaemon,
+ mkdir(lp_lockdir(), 0755);
+ }
+
++ if (!directory_exist(lp_statedir(), NULL)) {
++ mkdir(lp_statedir(), 0755);
++ }
++
+ pidfile_create("nmbd");
+ message_init();
+ message_register(MSG_FORCE_ELECTION, nmbd_message_election, NULL);
diff --git a/net/samba30/patches/patch-bp b/net/samba30/patches/patch-bp
new file mode 100644
index 00000000000..58391f39063
--- /dev/null
+++ b/net/samba30/patches/patch-bp
@@ -0,0 +1,14 @@
+$NetBSD: patch-bp,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- smbd/server.c.orig 2009-09-30 21:21:56.000000000 +0900
++++ smbd/server.c
+@@ -1008,6 +1008,9 @@ extern void build_options(BOOL screen);
+ if (!directory_exist(lp_lockdir(), NULL))
+ mkdir(lp_lockdir(), 0755);
+
++ if (!directory_exist(lp_statedir(), NULL))
++ mkdir(lp_statedir(), 0755);
++
+ if (is_daemon)
+ pidfile_create("smbd");
+
diff --git a/net/samba30/patches/patch-bq b/net/samba30/patches/patch-bq
new file mode 100644
index 00000000000..6f093da3a37
--- /dev/null
+++ b/net/samba30/patches/patch-bq
@@ -0,0 +1,17 @@
+$NetBSD: patch-bq,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- utils/testparm.c.orig 2005-10-12 13:03:42.000000000 -0400
++++ utils/testparm.c
+@@ -67,6 +67,12 @@ cannot be set in the smb.conf file. nmbd
+ ret = 1;
+ }
+
++ if (!directory_exist(lp_statedir(), &st)) {
++ fprintf(stderr, "ERROR: state directory %s does not exist\n",
++ lp_statedir());
++ ret = 1;
++ }
++
+ if (!directory_exist(lp_piddir(), &st)) {
+ fprintf(stderr, "ERROR: pid directory %s does not exist\n",
+ lp_piddir());
diff --git a/net/samba30/patches/patch-br b/net/samba30/patches/patch-br
new file mode 100644
index 00000000000..92f521b675e
--- /dev/null
+++ b/net/samba30/patches/patch-br
@@ -0,0 +1,31 @@
+$NetBSD: patch-br,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- lib/util.c.orig 2008-03-08 10:33:34.000000000 -0500
++++ lib/util.c
+@@ -2598,6 +2598,26 @@ char *lock_path(const char *name)
+ }
+
+ /*****************************************************************
++ A useful function for returning a path in the Samba state directory.
++*****************************************************************/
++
++char *state_path(const char *name)
++{
++ static pstring fname;
++
++ pstrcpy(fname,lp_statedir());
++ trim_char(fname,'\0','/');
++
++ if (!directory_exist(fname,NULL))
++ mkdir(fname,0755);
++
++ pstrcat(fname,"/");
++ pstrcat(fname,name);
++
++ return fname;
++}
++
++/*****************************************************************
+ A useful function for returning a path in the Samba pid directory.
+ *****************************************************************/
+
diff --git a/net/samba30/patches/patch-bs b/net/samba30/patches/patch-bs
new file mode 100644
index 00000000000..74435ad09ad
--- /dev/null
+++ b/net/samba30/patches/patch-bs
@@ -0,0 +1,77 @@
+$NetBSD: patch-bs,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- param/loadparm.c.orig 2009-09-30 12:21:56.000000000 +0000
++++ param/loadparm.c
+@@ -109,6 +109,7 @@ typedef struct {
+ char *szDeletePrinterCommand;
+ char *szOs2DriverMap;
+ char *szLockDir;
++ char *szStateDir;
+ char *szPidDir;
+ char *szRootdir;
+ char *szDefaultService;
+@@ -276,6 +277,7 @@ typedef struct {
+ BOOL bUnixPasswdSync;
+ BOOL bPasswdChatDebug;
+ int iPasswdChatTimeout;
++ BOOL bPasswdExpandGecos;
+ BOOL bTimestampLogs;
+ BOOL bNTSmbSupport;
+ BOOL bNTPipeSupport;
+@@ -564,7 +566,7 @@ static service sDefault = {
+ True, /* bLevel2OpLocks */
+ False, /* bOnlyUser */
+ True, /* bMangledNames */
+- True, /* bWidelinks */
++ False, /* bWidelinks */
+ True, /* bSymlinks */
+ False, /* bSyncAlways */
+ False, /* bStrictAllocate */
+@@ -890,6 +892,7 @@ static struct parm_struct parm_table[] =
+ {"passwd chat", P_STRING, P_GLOBAL, &Globals.szPasswdChat, NULL, NULL, FLAG_ADVANCED},
+ {"passwd chat debug", P_BOOL, P_GLOBAL, &Globals.bPasswdChatDebug, NULL, NULL, FLAG_ADVANCED},
+ {"passwd chat timeout", P_INTEGER, P_GLOBAL, &Globals.iPasswdChatTimeout, NULL, NULL, FLAG_ADVANCED},
++ {"passwd expand gecos", P_BOOL, P_GLOBAL, &Globals.bPasswdExpandGecos, NULL, NULL, FLAG_ADVANCED},
+ {"check password script", P_STRING, P_GLOBAL, &Globals.szCheckPasswordScript, NULL, NULL, FLAG_ADVANCED},
+ {"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL, NULL, FLAG_ADVANCED},
+ {"password level", P_INTEGER, P_GLOBAL, &Globals.pwordlevel, NULL, NULL, FLAG_ADVANCED},
+@@ -1212,6 +1215,7 @@ static struct parm_struct parm_table[] =
+ {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED},
+ {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_ADVANCED},
+ {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_HIDE},
++ {"state directory", P_STRING, P_GLOBAL, &Globals.szStateDir, NULL, NULL, FLAG_ADVANCED},
+ {"pid directory", P_STRING, P_GLOBAL, &Globals.szPidDir, NULL, NULL, FLAG_ADVANCED},
+ #ifdef WITH_UTMP
+ {"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED},
+@@ -1476,6 +1480,7 @@ static void init_globals(BOOL first_time
+ string_set(&Globals.szPasswdProgram, "");
+ string_set(&Globals.szPidDir, dyn_PIDDIR);
+ string_set(&Globals.szLockDir, dyn_LOCKDIR);
++ string_set(&Globals.szStateDir, dyn_STATEDIR);
+ string_set(&Globals.szSocketAddress, "0.0.0.0");
+ pstrcpy(s, "Samba ");
+ pstrcat(s, SAMBA_VERSION_STRING);
+@@ -1559,6 +1564,7 @@ static void init_globals(BOOL first_time
+ Globals.bPamPasswordChange = False;
+ Globals.bPasswdChatDebug = False;
+ Globals.iPasswdChatTimeout = 2; /* 2 second default. */
++ Globals.bPasswdExpandGecos = False;
+ Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
+ Globals.bNTStatusSupport = True; /* Use NT status by default. */
+ Globals.bStatCache = True; /* use stat cache by default */
+@@ -1806,6 +1812,7 @@ FN_GLOBAL_STRING(lp_addprinter_cmd, &Glo
+ FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
+ FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
+ FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
++FN_GLOBAL_STRING(lp_statedir, &Globals.szStateDir)
+ FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
+ FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
+ FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
+@@ -1979,6 +1986,7 @@ FN_GLOBAL_BOOL(lp_pam_password_change, &
+ FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
+ FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
+ FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
++FN_GLOBAL_BOOL(lp_passwd_expand_gecos, &Globals.bPasswdExpandGecos)
+ FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
+ FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
+ FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
diff --git a/net/samba30/patches/patch-bu b/net/samba30/patches/patch-bu
new file mode 100644
index 00000000000..db85542c21b
--- /dev/null
+++ b/net/samba30/patches/patch-bu
@@ -0,0 +1,36 @@
+$NetBSD: patch-bu,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- ../docs/manpages/smb.conf.5.orig 2009-09-30 21:28:02.000000000 +0900
++++ ../docs/manpages/smb.conf.5
+@@ -7084,6 +7084,15 @@ Example:
+ \fI\fIpasswd chat\fR\fR\fI = \fR\fI\FC"*Enter NEW password*" %n\en "*Reenter NEW password*" %n\en "*Password changed*"\F[]\fR\fI \fR
+ .RE
+
++passwd expand gecos (G)
++.PP
++.RS 4
++This boolean specifies if ampersand characters in the GECOS field of a passwd database entry should be replaced with the capitalized login name for that entry when the information is used by various Samba programs\&. This parameter is off by default\&.
++.sp
++Default: \fB\fIpasswd expand gecos\fR = no \fR
++.TP 3n
++.sp
++
+ passwd program (G)
+ .\" passwd program
+ .PP
+@@ -9199,6 +9208,15 @@ Default:
+ \fI\fIstat cache\fR\fR\fI = \fR\fI\FCyes\F[]\fR\fI \fR
+ .RE
+
++state directory (G)
++.PP
++.RS 4
++This parameter defines the directory the Samba daemon processes will use for storing state files that must persist across machine reboots.
++.sp
++Default:
++\fB\fIstate directory\fR = /var/db/samba \fR
++.RE
++
+ store dos attributes (S)
+ .\" store dos attributes
+ .PP
diff --git a/net/samba30/patches/patch-bv b/net/samba30/patches/patch-bv
new file mode 100644
index 00000000000..e2b101ca725
--- /dev/null
+++ b/net/samba30/patches/patch-bv
@@ -0,0 +1,71 @@
+$NetBSD: patch-bv,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- lib/util_pw.c.orig 2006-04-20 03:29:23.000000000 +0100
++++ lib/util_pw.c 2007-02-11 17:57:22.000000000 +0000
+@@ -4,6 +4,7 @@
+ Safe versions of getpw* calls
+
+ Copyright (C) Andrew Bartlett 2002
++ Copyright (C) Luke Mewburn 2004
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+@@ -25,6 +26,7 @@
+ struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from)
+ {
+ struct passwd *ret = TALLOC_P(mem_ctx, struct passwd);
++ char *gecos;
+ if (!ret) {
+ return NULL;
+ }
+@@ -32,7 +34,10 @@
+ ret->pw_passwd = talloc_strdup(ret, from->pw_passwd);
+ ret->pw_uid = from->pw_uid;
+ ret->pw_gid = from->pw_gid;
+- ret->pw_gecos = talloc_strdup(ret, from->pw_gecos);
++ gecos = (from->pw_gecos != NULL) ? passwd_expand_gecos(from) : NULL;
++ ret->pw_gecos = talloc_strdup(ret, gecos);
++ if (gecos != NULL)
++ SAFE_FREE(gecos);
+ ret->pw_dir = talloc_strdup(ret, from->pw_dir);
+ ret->pw_shell = talloc_strdup(ret, from->pw_shell);
+ return ret;
+@@ -126,3 +131,38 @@
+
+ return tcopy_passwd(mem_ctx, temp);
+ }
++
++
++/****************************************************************
++ Expand any `&' characters in pw_gecos with a capitalized pw_name.
++****************************************************************/
++
++char *passwd_expand_gecos(const struct passwd *pw)
++{
++ char *p, *bp, *buf;
++ size_t ac, buflen;
++
++ if (!lp_passwd_expand_gecos()) {
++ return smb_xstrdup(pw->pw_gecos);
++ }
++
++ ac = 0;
++ /* count number of `&' in pw_gecos */
++ for (p = pw->pw_gecos; *p; p++) {
++ if (*p == '&')
++ ac++;
++ }
++ buflen = strlen(pw->pw_gecos) + (ac * (strlen(pw->pw_name) - 1)) + 1;
++ buf = smb_xmalloc_array(sizeof(char), buflen);
++ bp = buf;
++ for (p = pw->pw_gecos; *p; p++) {
++ if (*p == '&') { /* replace & with capitalized pw_name */
++ ac = snprintf(bp, buflen - (bp - buf),
++ "%s", pw->pw_name);
++ *bp = toupper((unsigned char)*bp);
++ bp += ac;
++ } else
++ *bp++ = *p;
++ }
++ return buf;
++}
diff --git a/net/samba30/patches/patch-bw b/net/samba30/patches/patch-bw
new file mode 100644
index 00000000000..2b5f1e00c3c
--- /dev/null
+++ b/net/samba30/patches/patch-bw
@@ -0,0 +1,34 @@
+$NetBSD: patch-bw,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- include/config.h.in.orig 2009-09-30 22:08:50.000000000 +0900
++++ include/config.h.in
+@@ -324,9 +324,6 @@
+ /* Define to 1 if you have the `delproplist' function. */
+ #undef HAVE_DELPROPLIST
+
+-/* Define to 1 if you have the `des_set_key' function. */
+-#undef HAVE_DES_SET_KEY
+-
+ /* Whether the 'dev64_t' type is available */
+ #undef HAVE_DEV64_T
+
+@@ -391,6 +388,9 @@
+ /* Whether the EncryptedData struct has a etype property */
+ #undef HAVE_ETYPE_IN_ENCRYPTEDDATA
+
++/* Define to 1 if you have the `EVP_des_cbc' function. */
++#undef HAVE_EVP_DES_CBC
++
+ /* Define to 1 if you have the <execinfo.h> header file. */
+ #undef HAVE_EXECINFO_H
+
+@@ -664,6 +664,9 @@
+ /* Whether iface AIX is available */
+ #undef HAVE_IFACE_AIX
+
++/* Whether iface ifaddrs is available */
++#undef HAVE_IFACE_IFADDRS
++
+ /* Whether iface ifconf is available */
+ #undef HAVE_IFACE_IFCONF
+
diff --git a/net/samba30/patches/patch-ca b/net/samba30/patches/patch-ca
new file mode 100644
index 00000000000..a3f92f399e4
--- /dev/null
+++ b/net/samba30/patches/patch-ca
@@ -0,0 +1,11 @@
+$NetBSD: patch-ca,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- VERSION.orig 2008-03-08 10:56:26.000000000 -0500
++++ VERSION
+@@ -95,5 +95,5 @@ SAMBA_VERSION_IS_GIT_SNAPSHOT=
+ # e.g. SAMBA_VERSION_VENDOR_SUFFIX=vendor_version() #
+ # -> "CVS 3.0.0rc2-VendorVersion" #
+ ########################################################
+-SAMBA_VERSION_VENDOR_SUFFIX=
++SAMBA_VERSION_VENDOR_SUFFIX="pkgsrc"
+ SAMBA_VERSION_VENDOR_PATCH=
diff --git a/net/samba30/patches/patch-ce b/net/samba30/patches/patch-ce
new file mode 100644
index 00000000000..3999b378f5b
--- /dev/null
+++ b/net/samba30/patches/patch-ce
@@ -0,0 +1,13 @@
+$NetBSD: patch-ce,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- groupdb/mapping_tdb.c.orig 2007-04-25 18:38:59.000000000 +0900
++++ groupdb/mapping_tdb.c
+@@ -39,7 +39,7 @@ static TDB_CONTEXT *tdb; /* used for dri
+ if (tdb)
+ return True;
+
+- tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
++ tdb = tdb_open_log(state_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ if (!tdb) {
+ DEBUG(0,("Failed to open group mapping database\n"));
+ return False;
diff --git a/net/samba30/patches/patch-cf b/net/samba30/patches/patch-cf
new file mode 100644
index 00000000000..6b5dc6ce18c
--- /dev/null
+++ b/net/samba30/patches/patch-cf
@@ -0,0 +1,13 @@
+$NetBSD: patch-cf,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- nsswitch/idmap_tdb.c.orig 2007-05-11 07:09:34.000000000 +0900
++++ nsswitch/idmap_tdb.c
+@@ -247,7 +247,7 @@ static NTSTATUS idmap_tdb_open_db(TALLOC
+ }
+
+ /* use the old database if present */
+- tdbfile = talloc_strdup(ctx, lock_path("winbindd_idmap.tdb"));
++ tdbfile = talloc_strdup(ctx, state_path("winbindd_idmap.tdb"));
+ if (!tdbfile) {
+ DEBUG(0, ("Out of memory!\n"));
+ ret = NT_STATUS_NO_MEMORY;
diff --git a/net/samba30/patches/patch-cg b/net/samba30/patches/patch-cg
new file mode 100644
index 00000000000..b365976b87d
--- /dev/null
+++ b/net/samba30/patches/patch-cg
@@ -0,0 +1,13 @@
+$NetBSD: patch-cg,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- passdb/pdb_tdb.c.orig 2007-03-01 13:54:41.000000000 +0900
++++ passdb/pdb_tdb.c
+@@ -1559,7 +1559,7 @@ static BOOL tdbsam_new_rid(struct pdb_me
+ uint32 rid;
+ BOOL ret = False;
+
+- tdb = tdb_open_log(lock_path("winbindd_idmap.tdb"), 0,
++ tdb = tdb_open_log(state_path("winbindd_idmap.tdb"), 0,
+ TDB_DEFAULT, O_RDWR | O_CREAT, 0644);
+
+ if (tdb == NULL) {
diff --git a/net/samba30/patches/patch-ch b/net/samba30/patches/patch-ch
new file mode 100644
index 00000000000..a56d88f57d7
--- /dev/null
+++ b/net/samba30/patches/patch-ch
@@ -0,0 +1,22 @@
+$NetBSD: patch-ch,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- rpc_server/srv_eventlog_lib.c.orig 2007-03-01 13:54:40.000000000 +0900
++++ rpc_server/srv_eventlog_lib.c
+@@ -67,7 +67,7 @@ char *elog_tdbname( const char *name )
+ {
+ fstring path;
+ char *tdb_fullpath;
+- char *eventlogdir = lock_path( "eventlog" );
++ char *eventlogdir = state_path( "eventlog" );
+
+ pstr_sprintf( path, "%s/%s.tdb", eventlogdir, name );
+ strlower_m( path );
+@@ -349,7 +349,7 @@ ELOG_TDB *elog_open_tdb( char *logname,
+
+ /* make sure that the eventlog dir exists */
+
+- eventlogdir = lock_path( "eventlog" );
++ eventlogdir = state_path( "eventlog" );
+ if ( !directory_exist( eventlogdir, NULL ) )
+ mkdir( eventlogdir, 0755 );
+
diff --git a/net/samba30/patches/patch-ci b/net/samba30/patches/patch-ci
new file mode 100644
index 00000000000..622ce0a7cc5
--- /dev/null
+++ b/net/samba30/patches/patch-ci
@@ -0,0 +1,13 @@
+$NetBSD: patch-ci,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- libsmb/samlogon_cache.c.orig 2009-09-30 21:21:56.000000000 +0900
++++ libsmb/samlogon_cache.c
+@@ -34,7 +34,7 @@ static TDB_CONTEXT *netsamlogon_tdb = NU
+ BOOL netsamlogon_cache_init(void)
+ {
+ if (!netsamlogon_tdb) {
+- netsamlogon_tdb = tdb_open_log(lock_path(NETSAMLOGON_TDB), 0,
++ netsamlogon_tdb = tdb_open_log(state_path(NETSAMLOGON_TDB), 0,
+ TDB_DEFAULT, O_RDWR | O_CREAT, 0600);
+ }
+
diff --git a/net/samba30/patches/patch-da b/net/samba30/patches/patch-da
new file mode 100644
index 00000000000..45561a5a02e
--- /dev/null
+++ b/net/samba30/patches/patch-da
@@ -0,0 +1,47 @@
+$NetBSD: patch-da,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+--- lib/interfaces.c.orig 2007-03-01 05:54:30.000000000 +0100
++++ lib/interfaces.c
+@@ -343,6 +343,42 @@ static int _get_interfaces(struct iface_
+
+ #define _FOUND_IFACE_ANY
+ #endif /* HAVE_IFACE_AIX */
++#ifdef HAVE_IFACE_IFADDRS
++
++#include <ifaddrs.h>
++
++static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces)
++{
++ struct ifaddrs *ia;
++ int total;
++
++ if (getifaddrs(&ia) < 0)
++ return -1;
++
++ total = 0;
++ while (ia && total < max_interfaces) {
++ if (ia->ifa_addr->sa_family != AF_INET ||
++ !(ia->ifa_flags & IFF_UP)) {
++ ia = ia->ifa_next;
++ continue;
++ }
++ strncpy(ifaces[total].name, ia->ifa_name,
++ sizeof(ifaces[total].name) - 1);
++ ifaces[total].name[sizeof(ifaces[total].name) - 1] = 0;
++ ifaces[total].ip = ((struct sockaddr_in *)(ia->ifa_addr))
++ ->sin_addr;
++ ifaces[total].netmask = ((struct sockaddr_in *)(ia->ifa_netmask))
++ ->sin_addr;
++ total++;
++ ia = ia->ifa_next;
++ }
++
++ freeifaddrs(ia);
++ return total;
++}
++
++#define _FOUND_IFACE_ANY
++#endif /* HAVE_IFACE_IFADDRS */
+ #ifndef _FOUND_IFACE_ANY
+ static int _get_interfaces(struct iface_struct *ifaces, int max_interfaces)
+ {
diff --git a/net/samba30/patches/patch-ee b/net/samba30/patches/patch-ee
new file mode 100644
index 00000000000..f242b8d6f29
--- /dev/null
+++ b/net/samba30/patches/patch-ee
@@ -0,0 +1,40 @@
+$NetBSD: patch-ee,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+Patch to fix CVE-2010-2063.
+
+--- smbd/process.c.orig 2009-09-30 12:21:56.000000000 +0000
++++ smbd/process.c
+@@ -1159,6 +1159,7 @@ int chain_reply(char *inbuf,char *outbuf
+ {
+ static char *orig_inbuf;
+ static char *orig_outbuf;
++ static int orig_size;
+ int smb_com1, smb_com2 = CVAL(inbuf,smb_vwv0);
+ unsigned smb_off2 = SVAL(inbuf,smb_vwv1);
+ char *inbuf2, *outbuf2;
+@@ -1178,6 +1179,13 @@ int chain_reply(char *inbuf,char *outbuf
+ /* this is the first part of the chain */
+ orig_inbuf = inbuf;
+ orig_outbuf = outbuf;
++ orig_size = size;
++ }
++
++ /* Validate smb_off2 */
++ if ((smb_off2 < smb_wct - 4) || orig_size < (smb_off2 + 4 - smb_wct)) {
++ exit_server_cleanly("Bad chained packet");
++ return -1;
+ }
+
+ /*
+@@ -1192,6 +1200,11 @@ int chain_reply(char *inbuf,char *outbuf
+ SSVAL(outbuf,smb_vwv1,smb_offset(outbuf+outsize,outbuf));
+ SCVAL(outbuf,smb_vwv0,smb_com2);
+
++ if (outsize <= smb_wct) {
++ exit_server_cleanly("Bad chained packet");
++ return -1;
++ }
++
+ /* remember how much the caller added to the chain, only counting stuff
+ after the parameter words */
+ chain_size += outsize - smb_wct;
diff --git a/net/samba30/patches/patch-lib_replace_test_os2__delete.c b/net/samba30/patches/patch-lib_replace_test_os2__delete.c
new file mode 100644
index 00000000000..3bc1e81b795
--- /dev/null
+++ b/net/samba30/patches/patch-lib_replace_test_os2__delete.c
@@ -0,0 +1,14 @@
+$NetBSD: patch-lib_replace_test_os2__delete.c,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+Workaround for NetBSD 5.99.54.
+
+--- lib/replace/test/os2_delete.c.orig 2009-09-30 12:21:56.000000000 +0000
++++ lib/replace/test/os2_delete.c
+@@ -103,6 +103,7 @@ int test_readdir_os2_delete(void)
+ while (1) {
+ int n = os2_delete(d);
+ if (n == 0) break;
++ if (test_readdir_os2_delete_ret != 0) break; /* if FAILED */
+ total_deleted += n;
+ }
+ closedir(d);
diff --git a/net/samba30/patches/patch-libsmb_clikrb5.c b/net/samba30/patches/patch-libsmb_clikrb5.c
new file mode 100644
index 00000000000..79ea8e1f5fc
--- /dev/null
+++ b/net/samba30/patches/patch-libsmb_clikrb5.c
@@ -0,0 +1,15 @@
+$NetBSD: patch-libsmb_clikrb5.c,v 1.1.1.1 2011/12/15 22:23:24 asau Exp $
+
+* KRB5_DEPRECATED would not be defined as boolean 0 or 1.
+
+--- libsmb/clikrb5.c.orig 2009-09-30 12:21:56.000000000 +0000
++++ libsmb/clikrb5.c
+@@ -22,7 +22,7 @@
+ */
+
+ #define KRB5_PRIVATE 1 /* this file uses PRIVATE interfaces! */
+-#define KRB5_DEPRECATED 1 /* this file uses DEPRECATED interfaces! */
++#define KRB5_DEPRECATED /* this file uses DEPRECATED interfaces! */
+
+ #include "includes.h"
+