summaryrefslogtreecommitdiff
path: root/packaging/Debian/debian-sarge/patches
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/Debian/debian-sarge/patches')
-rw-r--r--packaging/Debian/debian-sarge/patches/VERSION.patch8
-rw-r--r--packaging/Debian/debian-sarge/patches/cups.patch14
-rw-r--r--packaging/Debian/debian-sarge/patches/documentation.patch66
-rw-r--r--packaging/Debian/debian-sarge/patches/fhs.patch558
-rw-r--r--packaging/Debian/debian-sarge/patches/installswat.sh.patch15
-rw-r--r--packaging/Debian/debian-sarge/patches/make-distclean.patch27
-rw-r--r--packaging/Debian/debian-sarge/patches/nmbd-signalling.patch20
-rw-r--r--packaging/Debian/debian-sarge/patches/non-linux-ports.patch62
-rw-r--r--packaging/Debian/debian-sarge/patches/samba.patch64
-rw-r--r--packaging/Debian/debian-sarge/patches/smbclient-pager.patch12
-rw-r--r--packaging/Debian/debian-sarge/patches/smbclient-tar.patch.unused43
-rw-r--r--packaging/Debian/debian-sarge/patches/smbmount-mtab-flags.patch15
-rw-r--r--packaging/Debian/debian-sarge/patches/smbmount-nomtab.patch160
-rw-r--r--packaging/Debian/debian-sarge/patches/smbstatus-locking.patch20
-rw-r--r--packaging/Debian/debian-sarge/patches/undefined-symbols.patch22
-rw-r--r--packaging/Debian/debian-sarge/patches/version-fix-vscan.patch37
16 files changed, 1143 insertions, 0 deletions
diff --git a/packaging/Debian/debian-sarge/patches/VERSION.patch b/packaging/Debian/debian-sarge/patches/VERSION.patch
new file mode 100644
index 0000000000..efa7d85d4d
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/VERSION.patch
@@ -0,0 +1,8 @@
+--- samba-3.0.0rc2/source/VERSION.orig 2003-09-02 21:56:11.000000000 -0400
++++ samba-3.0.0rc2/source/VERSION 2003-09-02 21:56:30.000000000 -0400
+@@ -78,4 +78,4 @@
+ # e.g. SAMBA_VERSION_VENDOR_SUFFIX=vendor_version() #
+ # -> "CVS 3.0.0rc2-VendorVersion" #
+ ########################################################
+-SAMBA_VERSION_VENDOR_SUFFIX=
++SAMBA_VERSION_VENDOR_SUFFIX="Debian"
diff --git a/packaging/Debian/debian-sarge/patches/cups.patch b/packaging/Debian/debian-sarge/patches/cups.patch
new file mode 100644
index 0000000000..8b1b8653d9
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/cups.patch
@@ -0,0 +1,14 @@
+--- samba-3.0.10.orig/source/include/includes.h
++++ samba-3.0.10/source/include/includes.h
+@@ -940,10 +940,7 @@
+ #endif
+
+ #ifndef DEFAULT_PRINTING
+-#ifdef HAVE_CUPS
+-#define DEFAULT_PRINTING PRINT_CUPS
+-#define PRINTCAP_NAME "cups"
+-#elif defined(SYSV)
++#if defined(SYSV)
+ #define DEFAULT_PRINTING PRINT_SYSV
+ #define PRINTCAP_NAME "lpstat"
+ #else
diff --git a/packaging/Debian/debian-sarge/patches/documentation.patch b/packaging/Debian/debian-sarge/patches/documentation.patch
new file mode 100644
index 0000000000..505a53c51b
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/documentation.patch
@@ -0,0 +1,66 @@
+--- samba-3.0.4/docs/manpages/swat.8.orig 2004-05-05 10:22:50.000000000 -0400
++++ samba-3.0.4/docs/manpages/swat.8 2004-05-10 13:25:53.000000000 -0400
+@@ -80,6 +80,13 @@
+ .SH "INSTALLATION"
+
+ .PP
++\fBDebian-specific Note\fR: all these steps have already been done for
++you. However, by default, swat is not enabled. This has been done for
++security reasons. To enable swat you need to edit /etc/inetd.conf,
++uncomment the swat entry (usually at the end of the file), and then
++restart inetd.
++
++.PP
+ Swat is included as binary package with most distributions\&. The package manager in this case takes care of the installation and configuration\&. This section is only for those who have compiled swat from scratch\&.
+
+ .PP
+@@ -87,13 +94,13 @@
+
+ .TP 3
+ \(bu
+-/usr/local/samba/sbin/swat
++/usr/sbin/swat
+ .TP
+ \(bu
+-/usr/local/samba/swat/images/*
++/usr/share/samba/swat/images/*
+ .TP
+ \(bu
+-/usr/local/samba/swat/help/*
++/usr/share/samba/swat/help/*
+ .LP
+
+ .SS "Inetd Installation"
+@@ -102,7 +109,7 @@
+ You need to edit your \fI/etc/inetd\&.conf \fR and \fI/etc/services\fR to enable SWAT to be launched via \fBinetd\fR\&.
+
+ .PP
+-In \fI/etc/services\fR you need to add a line like this:
++In \fI/etc/services\fR you need to add a line like this (not needed for Debian):
+
+ .PP
+ \fBswat 901/tcp\fR
+@@ -114,10 +121,10 @@
+ the choice of port number isn't really important except that it should be less than 1024 and not currently used (using a number above 1024 presents an obscure security hole depending on the implementation details of your\fBinetd\fR daemon)\&.
+
+ .PP
+-In \fI/etc/inetd\&.conf\fR you should add a line like this:
++In \fI/etc/inetd\&.conf\fR you should add a line like this (not needed for Debian since the maintainer scripts do it automatically. You need to uncomment the line, though, because it is added commented out for security reasons):
+
+ .PP
+-\fBswat stream tcp nowait\&.400 root /usr/local/samba/sbin/swat swat\fR
++\fBswat stream tcp nowait\&.400 root /usr/sbin/swat swat\fR
+
+ .PP
+ Once you have edited \fI/etc/services\fR and \fI/etc/inetd\&.conf\fR you need to send a HUP signal to inetd\&. To do this use \fBkill \-1 PID \fR where PID is the process ID of the inetd daemon\&.
+@@ -141,8 +148,8 @@
+ This file must contain a mapping of service name (e\&.g\&., swat) to service port (e\&.g\&., 901) and protocol type (e\&.g\&., tcp)\&.
+
+ .TP
+-\fI/usr/local/samba/lib/smb\&.conf\fR
+-This is the default location of the \fBsmb\&.conf\fR(5) server configuration file that swat edits\&. Other common places that systems install this file are \fI /usr/samba/lib/smb\&.conf\fR and \fI/etc/smb\&.conf \fR\&. This file describes all the services the server is to make available to clients\&.
++\fI/etc/samba/smb\&.conf\fR
++This is the default location of the \fBsmb\&.conf\fR(5) server configuration file that swat edits\&. This file describes all the services the server is to make available to clients\&.
+
+ .SH "WARNINGS"
+
diff --git a/packaging/Debian/debian-sarge/patches/fhs.patch b/packaging/Debian/debian-sarge/patches/fhs.patch
new file mode 100644
index 0000000000..0790c17b2f
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/fhs.patch
@@ -0,0 +1,558 @@
+diff -uNr samba-3.0.10.orig/source/Makefile.in samba-3.0.10/source/Makefile.in
+--- samba-3.0.10.orig/source/Makefile.in 2004-12-17 03:50:08.000000000 -0800
++++ samba-3.0.10/source/Makefile.in 2004-12-17 03:55:29.000000000 -0800
+@@ -90,6 +90,13 @@
+ # the directory where lock files go
+ LOCKDIR = @lockdir@
+
++# FHS directories; equal to LOCKDIR if not using --with-fhs
++CACHEDIR = @cachedir@
++STATEDIR = @statedir@
++
++# Where to look for (and install) codepage databases.
++CODEPAGEDIR = @codepagedir@
++
+ # the directory where pid files go
+ PIDDIR = @piddir@
+ # man pages language(s)
+@@ -114,7 +121,7 @@
+ PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
+ PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \
+ -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"
+-PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\"
++PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" -DCODEPAGEDIR=\"$(CODEPAGEDIR)\" -DCACHEDIR=\"$(CACHEDIR)\" -DSTATEDIR=\"$(STATEDIR)\"
+ PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS)
+
+ # Note that all executable programs now provide for an optional executable suffix.
+@@ -1319,7 +1326,7 @@
+ @$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
+
+ installdat: installdirs
+- @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
++ @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(CODEPAGEDIR) $(srcdir)
+
+ installmsg: installdirs
+ @$(SHELL) $(srcdir)/script/installmsg.sh $(DESTDIR)$(LIBDIR) $(srcdir)
+diff -uNr samba-3.0.10.orig/source/configure.in samba-3.0.10/source/configure.in
+--- samba-3.0.10.orig/source/configure.in 2004-12-17 03:50:08.000000000 -0800
++++ samba-3.0.10/source/configure.in 2004-12-17 03:55:29.000000000 -0800
+@@ -35,7 +35,7 @@
+ [ --with-fhs Use FHS-compliant paths (default=no)],
+ [ case "$withval" in
+ yes)
+- lockdir="\${VARDIR}/lib/samba"
++ lockdir="\${VARDIR}/run/samba"
+ piddir="\${VARDIR}/run"
+ mandir="\${prefix}/share/man"
+ logfilebase="\${VARDIR}/log/samba"
+@@ -43,6 +43,10 @@
+ libdir="\${prefix}/lib/samba"
+ configdir="${sysconfdir}/samba"
+ swatdir="\${DATADIR}/samba/swat"
++ codepagedir="\${DATADIR}/samba"
++ statedir="\${VARDIR}/lib/samba"
++ cachedir="\${VARDIR}/cache/samba"
++ AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths])
+ ;;
+ esac])
+
+@@ -201,6 +205,9 @@
+ AC_SUBST(swatdir)
+ AC_SUBST(bindir)
+ AC_SUBST(sbindir)
++AC_SUBST(codepagedir)
++AC_SUBST(statedir)
++AC_SUBST(cachedir)
+
+ dnl Unique-to-Samba variables we'll be playing with.
+ AC_SUBST(SHELL)
+diff -uNr samba-3.0.10.orig/source/dynconfig.c samba-3.0.10/source/dynconfig.c
+--- samba-3.0.10.orig/source/dynconfig.c 2004-12-17 03:50:08.000000000 -0800
++++ samba-3.0.10/source/dynconfig.c 2004-12-17 03:55:29.000000000 -0800
+@@ -53,6 +53,13 @@
+ pstring dyn_LMHOSTSFILE = LMHOSTSFILE;
+
+ /**
++ * @brief Samba data directory.
++ *
++ * @sa data_path() to get the path to a file inside the CODEPAGEDIR.
++ **/
++pstring dyn_CODEPAGEDIR = CODEPAGEDIR;
++
++/**
+ * @brief Samba library directory.
+ *
+ * @sa lib_path() to get the path to a file inside the LIBDIR.
+@@ -70,3 +77,27 @@
+
+ const pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
+ const pstring dyn_PRIVATE_DIR = PRIVATE_DIR;
++
++
++/* In non-FHS mode, these should be configurable using 'lock dir =';
++ but in FHS mode, they are their own directory. Implement as wrapper
++ functions so that everything can still be kept in dynconfig.c.
++ */
++
++char *dyn_STATEDIR(void)
++{
++#ifdef FHS_COMPATIBLE
++ return STATEDIR;
++#else
++ return lp_lockdir();
++#endif
++}
++
++char *dyn_CACHEDIR(void)
++{
++#ifdef FHS_COMPATIBLE
++ return CACHEDIR;
++#else
++ return lp_lockdir();
++#endif
++}
+diff -uNr samba-3.0.10.orig/source/groupdb/mapping.c samba-3.0.10/source/groupdb/mapping.c
+--- samba-3.0.10.orig/source/groupdb/mapping.c 2004-12-17 03:50:08.000000000 -0800
++++ samba-3.0.10/source/groupdb/mapping.c 2004-12-17 03:55:29.000000000 -0800
+@@ -140,7 +140,7 @@
+
+ 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 -uNr samba-3.0.10.orig/source/include/dynconfig.h samba-3.0.10/source/include/dynconfig.h
+--- samba-3.0.10.orig/source/include/dynconfig.h 2004-12-17 03:50:08.000000000 -0800
++++ samba-3.0.10/source/include/dynconfig.h 2004-12-17 03:55:29.000000000 -0800
+@@ -31,8 +31,12 @@
+ extern pstring dyn_CONFIGFILE;
+ extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE;
+ extern pstring dyn_LIBDIR;
++extern pstring dyn_CODEPAGEDIR;
+ extern const fstring dyn_SHLIBEXT;
+ extern const pstring dyn_LOCKDIR;
+ extern const pstring dyn_PIDDIR;
+ extern const pstring dyn_SMB_PASSWD_FILE;
+ extern const pstring dyn_PRIVATE_DIR;
++
++char *dyn_STATEDIR(void);
++char *dyn_CACHEDIR(void);
+diff -uNr samba-3.0.10.orig/source/intl/lang_tdb.c samba-3.0.10/source/intl/lang_tdb.c
+--- samba-3.0.10.orig/source/intl/lang_tdb.c 2004-12-17 03:50:08.000000000 -0800
++++ samba-3.0.10/source/intl/lang_tdb.c 2004-12-17 03:55:29.000000000 -0800
+@@ -128,7 +128,7 @@
+ if (!lang)
+ return True;
+
+- asprintf(&msg_path, "%s.msg", lib_path((const char *)lang));
++ asprintf(&msg_path, "%s.msg", data_path((const char *)lang));
+ if (stat(msg_path, &st) != 0) {
+ /* the msg file isn't available */
+ DEBUG(10, ("lang_tdb_init: %s: %s\n", msg_path,
+diff -uNr samba-3.0.10.orig/source/lib/account_pol.c samba-3.0.10/source/lib/account_pol.c
+--- samba-3.0.10.orig/source/lib/account_pol.c 2004-12-17 03:50:08.000000000 -0800
++++ samba-3.0.10/source/lib/account_pol.c 2004-12-17 03:55:29.000000000 -0800
+@@ -35,7 +35,7 @@
+
+ if (tdb)
+ return True;
+- 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 -uNr samba-3.0.10.orig/source/lib/util.c samba-3.0.10/source/lib/util.c
+--- samba-3.0.10.orig/source/lib/util.c 2004-12-17 03:50:08.000000000 -0800
++++ samba-3.0.10/source/lib/util.c 2004-12-17 03:55:29.000000000 -0800
+@@ -2362,6 +2362,61 @@
+ }
+
+ /**
++ * @brief Returns an absolute path to a file in the Samba data directory.
++ *
++ * @param name File to find, relative to CODEPAGEDIR.
++ *
++ * @retval Pointer to a static #pstring containing the full path.
++ **/
++
++char *data_path(const char *name)
++{
++ static pstring fname;
++ snprintf(fname, sizeof(fname), "%s/%s", dyn_CODEPAGEDIR, name);
++ return fname;
++}
++
++/*****************************************************************
++a useful function for returning a path in the Samba state directory
++ *****************************************************************/
++char *state_path(char *name)
++{
++ static pstring fname;
++
++ pstrcpy(fname,dyn_STATEDIR());
++ trim_string(fname,"","/");
++
++ 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 cache directory
++ *****************************************************************/
++char *cache_path(char *name)
++{
++ static pstring fname;
++
++ pstrcpy(fname,dyn_CACHEDIR());
++ trim_string(fname,"","/");
++
++ if (!directory_exist(fname,NULL)) {
++ mkdir(fname,0755);
++ }
++
++ pstrcat(fname,"/");
++ pstrcat(fname,name);
++
++ return fname;
++}
++
++/**
+ * @brief Returns the platform specific shared library extension.
+ *
+ * @retval Pointer to a static #fstring containing the extension.
+diff -uNr samba-3.0.10.orig/source/lib/util_unistr.c samba-3.0.10/source/lib/util_unistr.c
+--- samba-3.0.10.orig/source/lib/util_unistr.c 2004-12-17 03:50:08.000000000 -0800
++++ samba-3.0.10/source/lib/util_unistr.c 2004-12-17 03:55:29.000000000 -0800
+@@ -54,8 +54,8 @@
+ if (initialised) return;
+ initialised = 1;
+
+- upcase_table = map_file(lib_path("upcase.dat"), 0x20000);
+- lowcase_table = map_file(lib_path("lowcase.dat"), 0x20000);
++ upcase_table = map_file(data_path("upcase.dat"), 0x20000);
++ lowcase_table = map_file(data_path("lowcase.dat"), 0x20000);
+
+ /* we would like Samba to limp along even if these tables are
+ not available */
+@@ -161,7 +161,7 @@
+ return;
+ }
+
+- valid_file = map_file(lib_path("valid.dat"), 0x10000);
++ valid_file = map_file(data_path("valid.dat"), 0x10000);
+ if (valid_file) {
+ valid_table = valid_file;
+ mapped_file = 1;
+diff -uNr samba-3.0.10.orig/source/libsmb/samlogon_cache.c samba-3.0.10/source/libsmb/samlogon_cache.c
+--- samba-3.0.10.orig/source/libsmb/samlogon_cache.c 2004-12-17 03:50:08.000000000 -0800
++++ samba-3.0.10/source/libsmb/samlogon_cache.c 2004-12-17 03:55:29.000000000 -0800
+@@ -34,7 +34,7 @@
+ BOOL netsamlogon_cache_init(void)
+ {
+ if (!netsamlogon_tdb) {
+- netsamlogon_tdb = tdb_open_log(lock_path(NETSAMLOGON_TDB), 0,
++ netsamlogon_tdb = tdb_open_log(cache_path(NETSAMLOGON_TDB), 0,
+ TDB_DEFAULT, O_RDWR | O_CREAT, 0600);
+ }
+
+@@ -67,7 +67,7 @@
+ winbindd_cache.tdb open. Open the tdb if a NULL is passed. */
+
+ if (!tdb) {
+- tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 5000,
++ tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 5000,
+ TDB_DEFAULT, O_RDWR, 0600);
+ if (!tdb) {
+ DEBUG(5, ("netsamlogon_clear_cached_user: failed to open cache\n"));
+diff -uNr samba-3.0.10.orig/source/nmbd/nmbd_serverlistdb.c samba-3.0.10/source/nmbd/nmbd_serverlistdb.c
+--- samba-3.0.10.orig/source/nmbd/nmbd_serverlistdb.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/nmbd/nmbd_serverlistdb.c 2004-12-17 03:55:29.000000000 -0800
+@@ -327,7 +327,7 @@
+
+ updatecount++;
+
+- pstrcpy(fname,lp_lockdir());
++ pstrcpy(fname,dyn_CACHEDIR());
+ trim_char(fname,'\0' ,'/');
+ pstrcat(fname,"/");
+ pstrcat(fname,SERVER_LIST);
+diff -uNr samba-3.0.10.orig/source/nmbd/nmbd_winsserver.c samba-3.0.10/source/nmbd/nmbd_winsserver.c
+--- samba-3.0.10.orig/source/nmbd/nmbd_winsserver.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/nmbd/nmbd_winsserver.c 2004-12-17 03:55:30.000000000 -0800
+@@ -234,7 +234,7 @@
+
+ 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;
+@@ -1810,7 +1810,7 @@
+ }
+ }
+
+- slprintf(fname,sizeof(fname)-1,"%s/%s", lp_lockdir(), WINS_LIST);
++ slprintf(fname,sizeof(fname)-1,"%s/%s", dyn_STATEDIR(), WINS_LIST);
+ all_string_sub(fname,"//", "/", 0);
+ slprintf(fnamenew,sizeof(fnamenew)-1,"%s.%u", fname, (unsigned int)sys_getpid());
+
+diff -uNr samba-3.0.10.orig/source/nsswitch/winbindd_cache.c samba-3.0.10/source/nsswitch/winbindd_cache.c
+--- samba-3.0.10.orig/source/nsswitch/winbindd_cache.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/nsswitch/winbindd_cache.c 2004-12-17 03:55:30.000000000 -0800
+@@ -57,7 +57,7 @@
+ if (opt_nocache)
+ return;
+
+- wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 5000,
++ wcache->tdb = tdb_open_log(cache_path("winbindd_cache.tdb"), 5000,
+ TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT, 0600);
+
+ if (!wcache->tdb) {
+diff -uNr samba-3.0.10.orig/source/nsswitch/winbindd_util.c samba-3.0.10/source/nsswitch/winbindd_util.c
+--- samba-3.0.10.orig/source/nsswitch/winbindd_util.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/nsswitch/winbindd_util.c 2004-12-17 03:55:30.000000000 -0800
+@@ -957,7 +957,7 @@
+ SMB_STRUCT_STAT stbuf;
+ TDB_CONTEXT *idmap_tdb;
+
+- pstrcpy(idmap_name, lock_path("winbindd_idmap.tdb"));
++ pstrcpy(idmap_name, state_path("winbindd_idmap.tdb"));
+
+ if (!file_exist(idmap_name, &stbuf)) {
+ /* nothing to convert return */
+diff -uNr samba-3.0.10.orig/source/param/loadparm.c samba-3.0.10/source/param/loadparm.c
+--- samba-3.0.10.orig/source/param/loadparm.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/param/loadparm.c 2004-12-17 03:55:30.000000000 -0800
+@@ -104,6 +104,9 @@
+ char *szAddPrinterCommand;
+ char *szDeletePrinterCommand;
+ char *szOs2DriverMap;
++#ifdef FHS_COMPATIBLE
++ char *szLockDirStub;
++#endif
+ char *szLockDir;
+ char *szPidDir;
+ char *szRootdir;
+@@ -1105,8 +1108,13 @@
+ {"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE},
+ {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED},
+ {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED},
++#ifdef FHS_COMPATIBLE
++ {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDirStub, NULL, NULL, 0},
++ {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDirStub, NULL, NULL, 0},
++#else
+ {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_ADVANCED},
+ {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_HIDE},
++#endif
+ {"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},
+diff -uNr samba-3.0.10.orig/source/passdb/pdb_tdb.c samba-3.0.10/source/passdb/pdb_tdb.c
+--- samba-3.0.10.orig/source/passdb/pdb_tdb.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/passdb/pdb_tdb.c 2004-12-17 03:55:30.000000000 -0800
+@@ -734,10 +734,7 @@
+ if (location) {
+ tdb_state->tdbsam_location = talloc_strdup(pdb_context->mem_ctx, location);
+ } else {
+- pstring tdbfile;
+- get_private_directory(tdbfile);
+- pstrcat(tdbfile, "/");
+- pstrcat(tdbfile, PASSDB_FILE_NAME);
++ char *tdbfile = state_path(PASSDB_FILE_NAME);
+ tdb_state->tdbsam_location = talloc_strdup(pdb_context->mem_ctx, tdbfile);
+ }
+
+diff -uNr samba-3.0.10.orig/source/passdb/secrets.c samba-3.0.10/source/passdb/secrets.c
+--- samba-3.0.10.orig/source/passdb/secrets.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/passdb/secrets.c 2004-12-17 03:55:30.000000000 -0800
+@@ -55,8 +55,7 @@
+ if (tdb)
+ return True;
+
+- pstrcpy(fname, lp_private_dir());
+- pstrcat(fname,"/secrets.tdb");
++ pstrcpy(fname, state_path("secrets.tdb"));
+
+ tdb = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+
+diff -uNr samba-3.0.10.orig/source/printing/nt_printing.c samba-3.0.10/source/printing/nt_printing.c
+--- samba-3.0.10.orig/source/printing/nt_printing.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/printing/nt_printing.c 2004-12-17 03:55:31.000000000 -0800
+@@ -298,28 +298,28 @@
+
+ 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 -uNr samba-3.0.10.orig/source/printing/printing.c samba-3.0.10/source/printing/printing.c
+--- samba-3.0.10.orig/source/printing/printing.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/printing/printing.c 2004-12-17 03:55:31.000000000 -0800
+@@ -177,8 +177,8 @@
+ int services = lp_numservices();
+ int snum;
+
+- unlink(lock_path("printing.tdb"));
+- pstrcpy(printing_path,lock_path("printing"));
++ unlink(cache_path("printing.tdb"));
++ pstrcpy(printing_path,cache_path("printing"));
+ mkdir(printing_path,0755);
+
+ /* handle a Samba upgrade */
+diff -uNr samba-3.0.10.orig/source/printing/printing_db.c samba-3.0.10/source/printing/printing_db.c
+--- samba-3.0.10.orig/source/printing/printing_db.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/printing/printing_db.c 2004-12-17 03:55:31.000000000 -0800
+@@ -89,7 +89,7 @@
+ DLIST_ADD(print_db_head, p);
+ }
+
+- pstrcpy(printdb_path, lock_path("printing/"));
++ pstrcpy(printdb_path, cache_path("printing/"));
+ pstrcat(printdb_path, printername);
+ pstrcat(printdb_path, ".tdb");
+
+diff -uNr samba-3.0.20b.orig/source/registry/reg_db.c samba-3.0.20b/source/registry/reg_db.c
+--- samba-3.0.20b.orig/source/registry/reg_db.c 2003-07-02 23:26:47.000000000 -0500
++++ samba-3.0.20b/source/registry/reg_db.c 2003-07-02 23:19:02.000000000 -0500
+@@ -198,13 +198,13 @@
+ 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,("init_registry: Failed to open registry %s (%s)\n",
+- lock_path("registry.tdb"), strerror(errno) ));
++ state_path("registry.tdb"), strerror(errno) ));
+ return False;
+ }
+
+ DEBUG(10,("init_registry: Successfully created registry tdb\n"));
+diff -uNr samba-3.0.10.orig/source/rpc_server/srv_srvsvc_nt.c samba-3.0.10/source/rpc_server/srv_srvsvc_nt.c
+--- samba-3.0.10.orig/source/rpc_server/srv_srvsvc_nt.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/rpc_server/srv_srvsvc_nt.c 2004-12-17 03:55:31.000000000 -0800
+@@ -133,10 +133,10 @@
+
+ if (share_tdb && local_pid == sys_getpid())
+ 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 -uNr samba-3.0.10.orig/source/sam/idmap_tdb.c samba-3.0.10/source/sam/idmap_tdb.c
+--- samba-3.0.10.orig/source/sam/idmap_tdb.c 2004-12-17 03:50:09.000000000 -0800
++++ samba-3.0.10/source/sam/idmap_tdb.c 2004-12-17 03:55:31.000000000 -0800
+@@ -487,7 +487,7 @@
+ BOOL tdb_is_new = False;
+
+ /* use the old database if present */
+- tdbfile = SMB_STRDUP(lock_path("winbindd_idmap.tdb"));
++ tdbfile = SMB_STRDUP(state_path("winbindd_idmap.tdb"));
+ if (!tdbfile) {
+ DEBUG(0, ("idmap_init: out of memory!\n"));
+ return NT_STATUS_NO_MEMORY;
+diff -uNr samba-3.0.10.orig/source/smbd/lanman.c samba-3.0.10/source/smbd/lanman.c
+--- samba-3.0.10.orig/source/smbd/lanman.c 2004-12-17 03:50:10.000000000 -0800
++++ samba-3.0.10/source/smbd/lanman.c 2004-12-17 03:55:31.000000000 -0800
+@@ -969,9 +969,9 @@
+ BOOL local_list_only;
+ int i;
+
+- lines = file_lines_load(lock_path(SERVER_LIST), NULL);
++ lines = file_lines_load(cache_path(SERVER_LIST), NULL);
+ if (!lines) {
+- DEBUG(4,("Can't open %s - %s\n",lock_path(SERVER_LIST),strerror(errno)));
++ DEBUG(4,("Can't open %s - %s\n",cache_path(SERVER_LIST),strerror(errno)));
+ return(0);
+ }
+
+diff -uNr samba-3.0.10.orig/source/utils/net_idmap.c samba-3.0.10/source/utils/net_idmap.c
+--- samba-3.0.10.orig/source/utils/net_idmap.c 2004-12-17 03:50:10.000000000 -0800
++++ samba-3.0.10/source/utils/net_idmap.c 2004-12-17 03:55:32.000000000 -0800
+@@ -126,7 +126,7 @@
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+- tdbfile = SMB_STRDUP(lock_path("winbindd_idmap.tdb"));
++ tdbfile = SMB_STRDUP(state_path("winbindd_idmap.tdb"));
+ if (!tdbfile) {
+ DEBUG(0, ("idmap_init: out of memory!\n"));
+ return NT_STATUS_NO_MEMORY;
+diff -uNr samba-3.0.10.orig/source/wrepld/process.c samba-3.0.10/source/wrepld/process.c
+--- samba-3.0.10.orig/source/wrepld/process.c 2004-12-17 03:50:10.000000000 -0800
++++ samba-3.0.10/source/wrepld/process.c 2004-12-17 03:55:32.000000000 -0800
+@@ -197,7 +197,7 @@
+ {
+ TDB_CONTEXT *tdb;
+
+- tdb = tdb_open_log(lock_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
++ tdb = tdb_open_log(state_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
+ if (!tdb) {
+ DEBUG(2,("get_our_last_id: Can't open wins database file %s. Error was %s\n", WINS_LIST, strerror(errno) ));
+ return;
+@@ -489,7 +489,7 @@
+ }
+
+
+- tdb = tdb_open_log(lock_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
++ tdb = tdb_open_log(state_path(WINS_LIST), 0, TDB_DEFAULT, O_RDONLY, 0600);
+ if (!tdb) {
+ DEBUG(2,("send_entry_request: Can't open wins database file %s. Error was %s\n", WINS_LIST, strerror(errno) ));
+ return;
+diff -uNr samba-3.0.11.orig/source/printing/nt_printing.c samba-3.0.11/source/printing/nt_printing.c
+--- samba-3.0.11.orig/source/printing/nt_printing.c 2005-03-23 02:51:08.000000000 -0800
++++ samba-3.0.11/source/printing/nt_printing.c 2005-03-23 02:54:33.000000000 -0800
+@@ -2065,7 +2065,7 @@
+ close_all_print_db();
+
+ if (geteuid() == 0) {
+- pstrcpy(printdb_path, lock_path("printing/"));
++ pstrcpy(printdb_path, cache_path("printing/"));
+ pstrcat(printdb_path, sharename);
+ pstrcat(printdb_path, ".tdb");
+
diff --git a/packaging/Debian/debian-sarge/patches/installswat.sh.patch b/packaging/Debian/debian-sarge/patches/installswat.sh.patch
new file mode 100644
index 0000000000..81e3dcd444
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/installswat.sh.patch
@@ -0,0 +1,15 @@
+--- samba-3.0.1/source/script/installswat.sh.orig 2004-01-13 13:43:42.000000000 -0500
++++ samba-3.0.1/source/script/installswat.sh 2004-01-13 12:56:49.000000000 -0500
+@@ -114,7 +114,11 @@
+
+ # Install Using Samba book (but only if it is there)
+
+-if [ "x$BOOKDIR" != "x" -a -f $SRCDIR../docs/htmldocs/using_samba/toc.html ]; then
++# Under Debian we don't actually install the book. The book is part of
++# the samba-doc package, so we just provide a symlink that points to
++# where the book is actually installed. The symlink is created in
++# debian/rules.
++if /bin/false; then
+
+ # Create directories
+
diff --git a/packaging/Debian/debian-sarge/patches/make-distclean.patch b/packaging/Debian/debian-sarge/patches/make-distclean.patch
new file mode 100644
index 0000000000..e859575290
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/make-distclean.patch
@@ -0,0 +1,27 @@
+diff -uNr samba-3.0.7.orig/source/Makefile.in samba-3.0.7/source/Makefile.in
+--- samba-3.0.7.orig/source/Makefile.in 2004-10-25 10:06:08.000000000 -0700
++++ samba-3.0.7/source/Makefile.in 2004-10-25 10:03:31.000000000 -0700
+@@ -1371,6 +1371,7 @@
+
+ python_clean:
+ @-if test -n "$(PYTHON)"; then $(PYTHON) python/setup.py clean; fi
++ @-rm -rf build/
+
+ # revert to the previously installed version
+ revert:
+@@ -1437,6 +1438,7 @@
+ @rm -f include/proto.h include/build_env.h include/wrepld_proto.h \
+ nsswitch/winbindd_proto.h web/swat_proto.h \
+ client/client_proto.h utils/net_proto.h \
++ utils/ntlm_auth_proto.h \
+ smbd/build_options.c
+
+ MKPROTO_SH = $(srcdir)/script/mkproto.sh
+@@ -1512,6 +1514,7 @@
+
+ distclean: realclean
+ -rm -f include/stamp-h
++ -rm -f script/gen-8bit-gap.sh smbadduser
+ -rm -f include/config.h Makefile
+ -rm -f config.status config.cache so_locations
+ -rm -rf .deps TAGS
diff --git a/packaging/Debian/debian-sarge/patches/nmbd-signalling.patch b/packaging/Debian/debian-sarge/patches/nmbd-signalling.patch
new file mode 100644
index 0000000000..ca04cce3bf
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/nmbd-signalling.patch
@@ -0,0 +1,20 @@
+diff -uNr samba-2.999+3.0.alpha21.orig/source/nmbd/nmbd_subnetdb.c samba-2.999+3.0.alpha21/source/nmbd/nmbd_subnetdb.c
+--- samba-2.999+3.0.alpha21.orig/source/nmbd/nmbd_subnetdb.c 2002-11-26 20:54:19.000000000 -0600
++++ samba-2.999+3.0.alpha21/source/nmbd/nmbd_subnetdb.c 2002-12-16 23:34:13.000000000 -0600
+@@ -214,12 +214,16 @@
+ extern struct in_addr loopback_ip;
+
+ if(num_interfaces == 0) {
++ void (*old_handler)(int);
++
+ DEBUG(0,("create_subnets: No local interfaces !\n"));
+ DEBUG(0,("create_subnets: Waiting for an interface to appear ...\n"));
++ old_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
+ while (iface_count() == 0) {
+ sleep(5);
+ load_interfaces();
+ }
++ CatchSignal( SIGTERM, SIGNAL_CAST old_handler );
+ }
+
+ num_interfaces = iface_count();
diff --git a/packaging/Debian/debian-sarge/patches/non-linux-ports.patch b/packaging/Debian/debian-sarge/patches/non-linux-ports.patch
new file mode 100644
index 0000000000..ac2ee1dcf5
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/non-linux-ports.patch
@@ -0,0 +1,62 @@
+diff -uNr samba-3.0.11.orig/source/configure.in samba-3.0.11/source/configure.in
+--- samba-3.0.11.orig/source/configure.in 2005-03-23 02:39:11.000000000 -0800
++++ samba-3.0.11/source/configure.in 2005-03-23 02:43:01.000000000 -0800
+@@ -573,6 +573,15 @@
+ fi
+ ;;
+
++# Systems with LFS support.
++#
++ gnu* | k*bsd*-gnu)
++ CPPFLAGS="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $CPPFLAGS"
++ AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support])
++ AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits])
++ AC_DEFINE(_GNU_SOURCE, 1, [Whether to use GNU libc extensions])
++ ;;
++
+ # Tests for linux LFS support. Need kernel 2.4 and glibc2.2 or greater support.
+ #
+ *linux*)
+@@ -1040,7 +1049,7 @@
+ #
+ #
+ case "$host_os" in
+- *linux*)
++ linux*-gnu* | gnu* | k*bsd*-gnu)
+ # glibc <= 2.3.2 has a broken getgrouplist
+ AC_TRY_RUN([
+ #include <unistd.h>
+@@ -1172,7 +1181,10 @@
+
+ # and these are for particular systems
+ case "$host_os" in
+- *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux])
++ linux*-gnu* | gnu* | k*bsd*-gnu)
++ case "$host_os" in linux*)
++ AC_DEFINE(LINUX,1,[Whether the host os is linux]) ;;
++ esac
+ BLDSHARED="true"
+ if test "${ac_cv_gnu_ld_no_default_allow_shlib_undefined}" = "yes"; then
+ LDSHFLAGS="-shared -Wl,-Bsymbolic -Wl,--allow-shlib-undefined"
+@@ -4044,7 +4056,7 @@
+ AC_MSG_RESULT(yes);
+
+ case "$host_os" in
+- *linux*)
++ linux*-gnu* | gnu* | k*bsd*-gnu)
+ AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
+ AC_TRY_LINK([#include <sys/sendfile.h>],
+ [\
+@@ -4307,10 +4319,10 @@
+ WINBIND_NSS_LDSHFLAGS=$LDSHFLAGS
+
+ case "$host_os" in
+- *linux*)
++ linux*-gnu* | gnu* | k*bsd*-gnu)
+ WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_linux.o"
+ ;;
+- *freebsd[[5-9]]*)
++ freebsd5*|*freebsd[[6-9]]*)
+ # FreeBSD winbind client is implemented as a wrapper around
+ # the Linux version.
+ WINBIND_NSS_EXTRA_OBJS="nsswitch/winbind_nss_freebsd.o \
diff --git a/packaging/Debian/debian-sarge/patches/samba.patch b/packaging/Debian/debian-sarge/patches/samba.patch
new file mode 100644
index 0000000000..f4c8ca8742
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/samba.patch
@@ -0,0 +1,64 @@
+diff -uNr samba-3.0.0beta1.orig/source/client/smbmount.c samba-3.0.0beta1/source/client/smbmount.c
+--- samba-3.0.0beta1.orig/source/client/smbmount.c 2003-06-07 12:57:32.000000000 -0500
++++ samba-3.0.0beta1/source/client/smbmount.c 2003-06-30 20:12:22.000000000 -0500
+@@ -766,7 +766,7 @@
+ *lp = 0;
+ pstrcpy(password,lp+1);
+ got_pass = True;
+- memset(strchr_m(opteq+1,'%')+1,'X',strlen(password));
++ memset(strchr_m(opteq+1,'%')+1,'\0',strlen(password));
+ }
+ if ((lp=strchr_m(username,'/'))) {
+ *lp = 0;
+@@ -776,7 +776,7 @@
+ !strcmp(opts, "password")) {
+ pstrcpy(password,opteq+1);
+ got_pass = True;
+- memset(opteq+1,'X',strlen(password));
++ memset(opteq+1,'\0',strlen(password));
+ } else if(!strcmp(opts, "credentials")) {
+ pstrcpy(credentials,opteq+1);
+ } else if(!strcmp(opts, "netbiosname")) {
+@@ -890,7 +902,7 @@
+ *p = 0;
+ pstrcpy(password,p+1);
+ got_pass = True;
+- memset(strchr_m(getenv("USER"),'%')+1,'X',strlen(password));
++ memset(strchr_m(getenv("USER"),'%')+1,'\0',strlen(password));
+ }
+ strupper_m(username);
+ }
+diff -uNr samba-3.0.0beta1.orig/source/web/diagnose.c samba-3.0.0beta1/source/web/diagnose.c
+--- samba-3.0.0beta1.orig/source/web/diagnose.c 2003-06-07 12:57:41.000000000 -0500
++++ samba-3.0.0beta1/source/web/diagnose.c 2003-06-30 20:12:22.000000000 -0500
+@@ -66,6 +66,7 @@
+ static struct cli_state cli;
+ extern struct in_addr loopback_ip;
+
++ loopback_ip.s_addr = htonl((127 << 24) + 1);
+ if (!cli_initialise(&cli))
+ return False;
+
+--- samba-3.0.1/source/script/installbin.sh.orig 2003-10-10 14:08:36.000000000 -0400
++++ samba-3.0.1/source/script/installbin.sh 2003-12-17 10:51:45.000000000 -0500
+@@ -24,12 +24,14 @@
+ chmod $INSTALLPERMS $BINDIR/$p2
+
+ # this is a special case, mount needs this in a specific location
+- if [ $p2 = smbmount ]; then
+- if [ ! -d $DESTDIR/sbin ]; then
+- mkdir $DESTDIR/sbin
+- fi
+- ln -sf $BINDIR/$p2 $DESTDIR/sbin/mount.smbfs
+- fi
++# Commented out for the Debian Samba package. We take care of this
++# important symlink in debian/rules. (peloy@debian.org)
++# if [ $p2 = smbmount ]; then
++# if [ ! -d $DESTDIR/sbin ]; then
++# mkdir $DESTDIR/sbin
++# fi
++# ln -sf $BINDIR/$p2 $DESTDIR/sbin/mount.smbfs
++# fi
+ done
+
+
diff --git a/packaging/Debian/debian-sarge/patches/smbclient-pager.patch b/packaging/Debian/debian-sarge/patches/smbclient-pager.patch
new file mode 100644
index 0000000000..3ee85d4118
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/smbclient-pager.patch
@@ -0,0 +1,12 @@
+diff -uNr samba-2.999+3.0cvs20020906.orig/source/include/local.h samba-2.999+3.0cvs20020906/source/include/local.h
+--- samba-2.999+3.0cvs20020906.orig/source/include/local.h 2002-09-04 14:13:06.000000000 -0500
++++ samba-2.999+3.0cvs20020906/source/include/local.h 2002-09-08 14:19:24.000000000 -0500
+@@ -109,7 +109,7 @@
+ /* the default pager to use for the client "more" command. Users can
+ override this with the PAGER environment variable */
+ #ifndef PAGER
+-#define PAGER "more"
++#define PAGER "/usr/bin/pager"
+ #endif
+
+ /* the size of the uid cache used to reduce valid user checks */
diff --git a/packaging/Debian/debian-sarge/patches/smbclient-tar.patch.unused b/packaging/Debian/debian-sarge/patches/smbclient-tar.patch.unused
new file mode 100644
index 0000000000..e2a4c3ce2c
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/smbclient-tar.patch.unused
@@ -0,0 +1,43 @@
+diff -uNr samba-3.0.0beta2.orig/source/client/client.c samba-3.0.0beta2/source/client/client.c
+--- samba-3.0.0beta2.orig/source/client/client.c 2003-07-01 22:36:24.000000000 -0500
++++ samba-3.0.0beta2/source/client/client.c 2003-07-06 15:17:36.000000000 -0500
+@@ -2773,6 +2773,7 @@
+ int opt;
+ pstring query_host;
+ BOOL message = False;
++ char* tar_args = NULL;
+ extern char tar_type;
+ pstring term_code;
+ static const char *new_name_resolve_order = NULL;
+@@ -2816,7 +2817,7 @@
+ max_protocol = interpret_protocol(poptGetOptArg(pc), max_protocol);
+ break;
+ case 'T':
+- if (!tar_parseargs(argc, argv, poptGetOptArg(pc), optind)) {
++ if (!(tar_args = poptGetOptArg(pc))) {
+ poptPrintUsage(pc, stderr, 0);
+ exit(1);
+ }
+@@ -2917,6 +2917,22 @@
+ pstrcpy(cmdline_auth_info.password,poptGetArg(pc));
+ }
+
++ /* The tar command may take a number of string options; pass
++ everything we have left to tar_parseargs(). */
++ if (tar_args) {
++ const char **argv2 = poptGetArgs(pc);
++ int argc2 = 0;
++
++ if (argv2) {
++ while (argv2[argc2]) argc2++;
++ }
++
++ if (!tar_parseargs(argc2, argv2, tar_args, 0)) {
++ poptPrintUsage(pc, stderr, 0);
++ exit(1);
++ }
++ }
++
+ init_names();
+
+ if(new_name_resolve_order)
diff --git a/packaging/Debian/debian-sarge/patches/smbmount-mtab-flags.patch b/packaging/Debian/debian-sarge/patches/smbmount-mtab-flags.patch
new file mode 100644
index 0000000000..dac999dd63
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/smbmount-mtab-flags.patch
@@ -0,0 +1,15 @@
+diff -ur samba-2.2.4.orig/source/client/smbmnt.c samba-2.2.4/source/client/smbmnt.c
+--- samba-2.2.4.orig/source/client/smbmnt.c Sun Apr 8 15:22:51 2001
++++ samba-2.2.4/source/client/smbmnt.c Sun May 5 16:42:29 2002
+@@ -259,7 +259,10 @@
+ ment.mnt_fsname = share_name ? share_name : "none";
+ ment.mnt_dir = mount_point;
+ ment.mnt_type = "smbfs";
+- ment.mnt_opts = "";
++ if (mount_ro)
++ ment.mnt_opts = "ro";
++ else
++ ment.mnt_opts = "rw";
+ ment.mnt_freq = 0;
+ ment.mnt_passno= 0;
+
diff --git a/packaging/Debian/debian-sarge/patches/smbmount-nomtab.patch b/packaging/Debian/debian-sarge/patches/smbmount-nomtab.patch
new file mode 100644
index 0000000000..f7e9ce4f69
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/smbmount-nomtab.patch
@@ -0,0 +1,160 @@
+diff -uNr samba-3.0alpha22.orig/source/client/smbmnt.c samba-3.0alpha22/source/client/smbmnt.c
+--- samba-3.0alpha22.orig/source/client/smbmnt.c 2003-03-15 12:11:39.000000000 -0600
++++ samba-3.0alpha22/source/client/smbmnt.c 2003-03-15 12:11:49.000000000 -0600
+@@ -28,6 +28,7 @@
+ static uid_t mount_uid;
+ static gid_t mount_gid;
+ static int mount_ro;
++static int no_mtab;
+ static unsigned mount_fmask;
+ static unsigned mount_dmask;
+ static int user_mount;
+@@ -40,6 +41,7 @@
+ printf("Usage: smbmnt mount-point [options]\n");
+ printf("Version %s\n\n",VERSION);
+ printf("-s share share name on server\n"
++ "-n don't update /etc/mtab\n"
+ "-r mount read-only\n"
+ "-u uid mount as uid\n"
+ "-g gid mount as gid\n"
+@@ -54,7 +56,7 @@
+ {
+ int opt;
+
+- while ((opt = getopt (argc, argv, "s:u:g:rf:d:o:")) != EOF)
++ while ((opt = getopt (argc, argv, "s:u:g:nrf:d:o:")) != EOF)
+ {
+ switch (opt)
+ {
+@@ -71,6 +73,9 @@
+ mount_gid = strtol(optarg, NULL, 0);
+ }
+ break;
++ case 'n':
++ no_mtab = 1;
++ break;
+ case 'r':
+ mount_ro = 1;
+ break;
+@@ -274,36 +279,38 @@
+ return -1;
+ }
+
+- if ((fd = open(MOUNTED"~", O_RDWR|O_CREAT|O_EXCL, 0600)) == -1)
+- {
+- fprintf(stderr, "Can't get "MOUNTED"~ lock file");
+- return 1;
+- }
+- close(fd);
++ if (!no_mtab) {
++ if ((fd = open(MOUNTED"~", O_RDWR|O_CREAT|O_EXCL, 0600)) == -1)
++ {
++ fprintf(stderr, "Can't get "MOUNTED"~ lock file");
++ return 1;
++ }
++ close(fd);
+
+- if ((mtab = setmntent(MOUNTED, "a+")) == NULL)
+- {
+- fprintf(stderr, "Can't open " MOUNTED);
+- return 1;
+- }
++ if ((mtab = setmntent(MOUNTED, "a+")) == NULL)
++ {
++ fprintf(stderr, "Can't open " MOUNTED);
++ return 1;
++ }
+
+- if (addmntent(mtab, &ment) == 1)
+- {
+- fprintf(stderr, "Can't write mount entry");
+- return 1;
+- }
+- if (fchmod(fileno(mtab), 0644) == -1)
+- {
+- fprintf(stderr, "Can't set perms on "MOUNTED);
+- return 1;
+- }
+- endmntent(mtab);
++ if (addmntent(mtab, &ment) == 1)
++ {
++ fprintf(stderr, "Can't write mount entry");
++ return 1;
++ }
++ if (fchmod(fileno(mtab), 0644) == -1)
++ {
++ fprintf(stderr, "Can't set perms on "MOUNTED);
++ return 1;
++ }
++ endmntent(mtab);
+
+- if (unlink(MOUNTED"~") == -1)
+- {
+- fprintf(stderr, "Can't remove "MOUNTED"~");
+- return 1;
+- }
++ if (unlink(MOUNTED"~") == -1)
++ {
++ fprintf(stderr, "Can't remove "MOUNTED"~");
++ return 1;
++ }
++ }
+
+ return 0;
+ }
+diff -uNr samba-3.0alpha22.orig/source/client/smbmount.c samba-3.0alpha22/source/client/smbmount.c
+--- samba-3.0alpha22.orig/source/client/smbmount.c 2003-03-15 12:04:29.000000000 -0600
++++ samba-3.0alpha22/source/client/smbmount.c 2003-03-15 12:15:10.000000000 -0600
+@@ -48,6 +48,7 @@
+ static int mount_ro;
+ static unsigned mount_fmask;
+ static unsigned mount_dmask;
++static BOOL no_mtab = False;
+ static BOOL use_kerberos;
+ /* TODO: Add code to detect smbfs version in kernel */
+ static BOOL status32_smbfs = False;
+@@ -273,6 +274,9 @@
+ return;
+ }
+
++ if (no_mtab)
++ return;
++
+ if ((fd = open(MOUNTED"~", O_RDWR|O_CREAT|O_EXCL, 0600)) == -1) {
+ DEBUG(0,("%d: Can't get "MOUNTED"~ lock file", sys_getpid()));
+ return;
+@@ -467,6 +471,9 @@
+ args[i++] = "-s";
+ args[i++] = svc2;
+
++ if (no_mtab) {
++ args[i++] = "-n";
++ }
+ if (mount_ro) {
+ args[i++] = "-r";
+ }
+@@ -662,7 +669,7 @@
+ ****************************************************************************/
+ static void usage(void)
+ {
+- printf("Usage: mount.smbfs service mountpoint [-o options,...]\n");
++ printf("Usage: mount.smbfs service mountpoint [-n] [-o options,...]\n");
+
+ printf("Version %s\n\n",VERSION);
+
+@@ -740,8 +747,13 @@
+ argc -= 2;
+ argv += 2;
+
+- opt = getopt(argc, argv, "o:");
+- if(opt != 'o') {
++ opt = getopt(argc, argv, "no:");
++ if (opt == 'n') {
++ DEBUG(3,("No mtab!\n"));
++ no_mtab = True;
++ opt = getopt(argc, argv, "o:");
++ }
++ if (opt != 'o') {
+ return;
+ }
+
diff --git a/packaging/Debian/debian-sarge/patches/smbstatus-locking.patch b/packaging/Debian/debian-sarge/patches/smbstatus-locking.patch
new file mode 100644
index 0000000000..db7fccc68b
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/smbstatus-locking.patch
@@ -0,0 +1,20 @@
+diff -uNr samba-2.999+3.0.alpha21.orig/source/utils/status.c samba-2.999+3.0.alpha21/source/utils/status.c
+--- samba-2.999+3.0.alpha21.orig/source/utils/status.c 2002-11-26 20:54:22.000000000 -0600
++++ samba-2.999+3.0.alpha21/source/utils/status.c 2002-12-16 23:37:14.000000000 -0600
+@@ -686,6 +686,16 @@
+ if (!shares_only) {
+ int ret;
+
++ tdb = tdb_open_log(lock_path("locking.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0);
++
++ if (!tdb) {
++ d_printf("%s not initialised\n", lock_path("locking.tdb"));
++ d_printf("This is normal if an SMB client has never connected to your server.\n");
++ exit(0);
++ } else {
++ tdb_close(tdb);
++ }
++
+ if (!locking_init(1)) {
+ d_printf("Can't initialise locking module - exiting\n");
+ exit(1);
diff --git a/packaging/Debian/debian-sarge/patches/undefined-symbols.patch b/packaging/Debian/debian-sarge/patches/undefined-symbols.patch
new file mode 100644
index 0000000000..e9a376ea9b
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/undefined-symbols.patch
@@ -0,0 +1,22 @@
+diff -uNr samba-3.0.11.orig/source/Makefile.in samba-3.0.11/source/Makefile.in
+--- samba-3.0.11.orig/source/Makefile.in 2005-03-23 02:40:40.000000000 -0800
++++ samba-3.0.11/source/Makefile.in 2005-03-23 02:48:59.000000000 -0800
+@@ -631,7 +631,8 @@
+ $(RPC_ECHO_OBJ) $(SMBLDAP_OBJ) $(IDMAP_OBJ) libsmb/spnego.o $(PASSCHANGE_OBJ)
+
+ WINBIND_WINS_NSS_OBJ = nsswitch/wins.o $(PARAM_OBJ) \
+- $(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) $(NSSWINS_OBJ) $(KRBCLIENT_OBJ)
++ $(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) $(NSSWINS_OBJ) $(KRBCLIENT_OBJ) \
++ $(SECRETS_OBJ)
+
+ WINBIND_WINS_NSS_PICOBJS = $(WINBIND_WINS_NSS_OBJ:.o=.@PICSUFFIX@)
+
+@@ -997,7 +998,7 @@
+
+ bin/libsmbclient.@SHLIBEXT@: $(LIBSMBCLIENT_PICOBJS)
+ @echo Linking libsmbclient shared library $@
+- @$(SHLD) $(LDSHFLAGS) -o $@ $(LIBSMBCLIENT_PICOBJS) $(LDFLAGS) $(LIBS) \
++ @$(SHLD) $(LDSHFLAGS) -Wl,-z,defs -o $@ $(LIBSMBCLIENT_PICOBJS) $(LDFLAGS) $(LIBS) \
+ $(KRB5LIBS) $(LDAP_LIBS) \
+ @SONAMEFLAG@`basename $@`.$(LIBSMBCLIENT_MAJOR)
+
diff --git a/packaging/Debian/debian-sarge/patches/version-fix-vscan.patch b/packaging/Debian/debian-sarge/patches/version-fix-vscan.patch
new file mode 100644
index 0000000000..0f35598297
--- /dev/null
+++ b/packaging/Debian/debian-sarge/patches/version-fix-vscan.patch
@@ -0,0 +1,37 @@
+Author: Lars Mueller <lmuelle at SuSE dot de>
+Subject: Non integer SAMBA_VERSION_RELEASE breaks samba-vscan build
+Bugzilla: bugzilla.Samba.org #2618
+
+--- samba-3.0.20b/source/script/mkversion.sh
++++ samba-3.0.20b/source/script/mkversion.sh 2005-10-22 12:56:30
+@@ -17,6 +17,7 @@
+ SAMBA_VERSION_MAJOR=`sed -n 's/^SAMBA_VERSION_MAJOR=//p' $SOURCE_DIR$VERSION_FILE`
+ SAMBA_VERSION_MINOR=`sed -n 's/^SAMBA_VERSION_MINOR=//p' $SOURCE_DIR$VERSION_FILE`
+ SAMBA_VERSION_RELEASE=`sed -n 's/^SAMBA_VERSION_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
++SAMBA_VERSION_RELEASE_SUFFIX=`sed -n 's/^SAMBA_VERSION_RELEASE_SUFFIX=//p' $SOURCE_DIR$VERSION_FILE`
+
+ SAMBA_VERSION_PRE_RELEASE=`sed -n 's/^SAMBA_VERSION_PRE_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
+
+@@ -31,9 +32,10 @@
+ echo "#define SAMBA_VERSION_MAJOR ${SAMBA_VERSION_MAJOR}" >> $OUTPUT_FILE
+ echo "#define SAMBA_VERSION_MINOR ${SAMBA_VERSION_MINOR}" >> $OUTPUT_FILE
+ echo "#define SAMBA_VERSION_RELEASE ${SAMBA_VERSION_RELEASE}" >> $OUTPUT_FILE
++echo "#define SAMBA_VERSION_RELEASE_SUFFIX ${SAMBA_VERSION_RELEASE_SUFFIX}" >> $OUTPUT_FILE
+
+
+-SAMBA_VERSION_STRING="${SAMBA_VERSION_MAJOR}.${SAMBA_VERSION_MINOR}.${SAMBA_VERSION_RELEASE}"
++SAMBA_VERSION_STRING="${SAMBA_VERSION_MAJOR}.${SAMBA_VERSION_MINOR}.${SAMBA_VERSION_RELEASE}${SAMBA_VERSION_RELEASE_SUFFIX}"
+
+
+ if test -n "${SAMBA_VERSION_PRE_RELEASE}";then
+--- samba-3.0.20b/source/VERSION
++++ samba-3.0.20b/source/VERSION 2005-10-22 12:56:30
+@@ -19,7 +19,8 @@
+ ########################################################
+ SAMBA_VERSION_MAJOR=3
+ SAMBA_VERSION_MINOR=0
+ SAMBA_VERSION_RELEASE=20
++SAMBA_VERSION_RELEASE_SUFFIX=b
+
+ ########################################################
+ # For 'pre' releases the version will be #