[samba] Update to 4.0.0rc1.

asn asn at fedoraproject.org
Wed Sep 26 12:57:47 UTC 2012


commit f6791b27d83d3e0ade96e902e57b8b7f923b97cb
Author: Andreas Schneider <asn at redhat.com>
Date:   Wed Sep 26 14:23:24 2012 +0200

    Update to 4.0.0rc1.

 Makefile                                           |   21 -
 README.dc                                          |   20 +
 README.downgrade                                   |   29 +
 nmb.init                                           |  114 --
 samba-3.0.0rc3-nmbd-netbiosname.patch              |   90 --
 samba-3.2.0pre1-grouppwd.patch                     |   11 -
 samba-3.2.0pre1-pipedir.patch                      |   11 -
 samba-3.2.5-inotify.patch                          |   47 -
 samba-3.6.4-krb5_locate_kdc.patch                  |  251 ----
 samba-4.0.0rc2-build_idmap_manpages.patch          |   33 +
 samba-4.0.0rc2-create_smbldaphelper.patch          |   84 ++
 samba-4.0.0rc2-fix_panic_action.patch              |   42 +
 samba-4.0.0rc2-fix_smb.conf_manpage_build.patch    |  155 ++
 ...a-4.0.0rc2-fix_smbldaphelper_without_ldap.patch |   26 +
 samba-4.0.0rc2-make_smbldaphelper_lib.patch        |  112 ++
 samba-4.0.0rc2-use_smb_man_style.patch             |   30 +
 samba.conf.tmp                                     |    1 +
 samba.spec                                         | 1560 +++++++++++++-------
 samba.sysconfig                                    |   14 -
 smb.init                                           |  114 --
 sources                                            |    2 +-
 winbind.init                                       |  102 --
 22 files changed, 1589 insertions(+), 1280 deletions(-)
---
diff --git a/README.dc b/README.dc
new file mode 100644
index 0000000..b690f28
--- /dev/null
+++ b/README.dc
@@ -0,0 +1,20 @@
+MIT Kerberos 5 Support
+=======================
+
+Fedora is using MIT Kerberos implementation as its Kerberos infrastructure of
+choice.  Samba 4 build in Fedora is using MIT Kerberos implementation in order
+to allow system-wide interoperability between both desktop and server
+applications running on the same machine.
+
+At the moment Samba 4 Active Directory Domain Controller implementation is not
+available with MIT Kereberos. FreeIPA and Samba Team members are currently
+working on Samba 4 MIT Kerberos support as this is a requirement for a
+GNU/Linux distribution integration of Samba 4 AD DC features.
+
+We have just finished migrating the file server and all client utilities to MIT
+Kerberos.  The result of this work is available in samba4-* packages in Fedora.
+We'll provide Samba 4 AD DC functionality as soon as its support of MIT
+Kerberos KDC will be ready.
+
+In case of further questions do not hesitate to send your inquiries to
+samba4-owner at fedoraproject.org
diff --git a/README.downgrade b/README.downgrade
new file mode 100644
index 0000000..5cb0aaa
--- /dev/null
+++ b/README.downgrade
@@ -0,0 +1,29 @@
+Downgrading Samba
+=================
+
+Short version: data-preserving downgrades between Samba versions are not supported
+
+Long version:
+With Samba development there are cases when on-disk database format evolves.
+In general, Samba Team attempts to maintain forward compatibility and
+automatically upgrade databases during runtime when requires.
+However, when downgrade is required Samba will not perform downgrade to
+existing databases. It may be impossible if new features that caused database
+upgrade are in use. Thus, one needs to consider a downgrade procedure before
+actually downgrading Samba setup.
+
+Please always perform back up prior both upgrading and downgrading across major
+version changes. Restoring database files is easiest and simplest way to get to
+previously working setup.
+
+Easiest way to downgrade is to remove all created databases and start from scratch.
+This means losing all authentication and domain relationship data, as well as
+user databases (in case of tdb storage), printers, registry settings, and winbindd
+caches.
+
+Remove databases in following locations:
+/var/lib/samba/*.tdb
+/var/lib/samba/private/*.tdb
+
+In particular, registry settings are known to prevent running downgraded versions
+(Samba 4 to Samba 3) as registry format has changed between Samba 3 and Samba 4.
diff --git a/samba-4.0.0rc2-build_idmap_manpages.patch b/samba-4.0.0rc2-build_idmap_manpages.patch
new file mode 100644
index 0000000..0f4fc4f
--- /dev/null
+++ b/samba-4.0.0rc2-build_idmap_manpages.patch
@@ -0,0 +1,33 @@
+From a7a6a368f87c8b8af80511f1a3b32a457e48aa99 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn at samba.org>
+Date: Thu, 13 Sep 2012 17:52:13 +0200
+Subject: [PATCH] docs: Fix generating idmap manpages.
+
+
+Signed-off-by: Andreas Schneider <asn at samba.org>
+---
+ docs-xml/wscript_build | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
+index 14fa152..9a17be3 100644
+--- a/docs-xml/wscript_build
++++ b/docs-xml/wscript_build
+@@ -6,6 +6,14 @@ manpages='''
+          manpages/libsmbclient.7
+          manpages/lmhosts.5
+          manpages/log2pcap.1
++         manpages/idmap_ad.8
++         manpages/idmap_autorid.8
++         manpages/idmap_hash.8
++         manpages/idmap_ldap.8
++         manpages/idmap_nss.8
++         manpages/idmap_rid.8
++         manpages/idmap_tdb.8
++         manpages/idmap_tdb2.8
+          manpages/net.8
+          manpages/nmbd.8
+          manpages/nmblookup.1
+-- 
+1.7.12
+
diff --git a/samba-4.0.0rc2-create_smbldaphelper.patch b/samba-4.0.0rc2-create_smbldaphelper.patch
new file mode 100644
index 0000000..5f728c6
--- /dev/null
+++ b/samba-4.0.0rc2-create_smbldaphelper.patch
@@ -0,0 +1,84 @@
+commit be7a856f5bd251dc84a72eb56cf011facd10988f
+Author:     Alexander Bokovoy <ab at samba.org>
+AuthorDate: Thu Sep 13 15:40:31 2012 +0300
+Commit:     Alexander Bokovoy <ab at samba.org>
+CommitDate: Thu Sep 13 17:36:07 2012 +0200
+
+    s3: make ldapsam-related functions a smbldaphelper subsystem
+    
+    Since these functions are used in pdb_ldap and idmap_ldap, and
+    pdb_ldap might be statically linked to libpdb (default), it is
+    better to keep them as separate subsystem to avoid polluting libpdb
+    namespace.
+    
+    This is first step in refactoring libpdb. Right now I cannot move
+    these functions into proper libsmbldaphelper as it uses more of
+    libpdb-included functions and linking pdb_ldap against libsmbldaphelper
+    library would have created a loop if pdb_ldap is included into libpdb.
+    
+    Autobuild-User(master): Alexander Bokovoy <ab at samba.org>
+    Autobuild-Date(master): Thu Sep 13 17:36:07 CEST 2012 on sn-devel-104
+---
+ source3/passdb/wscript_build   | 4 ++--
+ source3/winbindd/wscript_build | 2 +-
+ source3/wscript_build          | 5 ++++-
+ 3 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/source3/passdb/wscript_build b/source3/passdb/wscript_build
+index 1dfdfd0..d26afc2 100644
+--- a/source3/passdb/wscript_build
++++ b/source3/passdb/wscript_build
+@@ -1,7 +1,7 @@
+ #!/usr/bin/env python
+ 
+ PDB_TDBSAM_SRC =    'pdb_tdb.c'
+-PDB_LDAP_SRC =      'pdb_ldap.c pdb_nds.c pdb_ipa.c pdb_ldap_util.c'
++PDB_LDAP_SRC =      'pdb_ldap.c pdb_nds.c pdb_ipa.c'
+ PDB_SMBPASSWD_SRC = 'pdb_smbpasswd.c'
+ PDB_WBC_SAM_SRC =   'pdb_wbc_sam.c'
+ 
+@@ -15,7 +15,7 @@ bld.SAMBA3_MODULE('pdb_tdbsam',
+ 
+ bld.SAMBA3_MODULE('pdb_ldap',
+                  subsystem='pdb',
+-                 deps='smbldap',
++                 deps='smbldap smbldaphelper',
+                  source=PDB_LDAP_SRC,
+                  init_function='',
+                  internal_module=bld.SAMBA3_IS_STATIC_MODULE('pdb_ldap'),
+diff --git a/source3/winbindd/wscript_build b/source3/winbindd/wscript_build
+index 9f11aff..af3741b 100644
+--- a/source3/winbindd/wscript_build
++++ b/source3/winbindd/wscript_build
+@@ -62,7 +62,7 @@ bld.SAMBA3_MODULE('idmap_passdb',
+ bld.SAMBA3_MODULE('idmap_ldap',
+                  subsystem='idmap',
+                  source=IDMAP_LDAP_SRC,
+-                 deps='smbldap',
++                 deps='smbldap smbldaphelper',
+                  init_function='',
+                  internal_module=bld.SAMBA3_IS_STATIC_MODULE('idmap_ldap'),
+                  enabled=bld.SAMBA3_IS_ENABLED_MODULE('idmap_ldap') and bld.env.HAVE_LDAP)
+diff --git a/source3/wscript_build b/source3/wscript_build
+index c7395e7..c534ae6 100755
+--- a/source3/wscript_build
++++ b/source3/wscript_build
+@@ -215,7 +215,6 @@ PASSDB_SRC = '''${PASSDB_GET_SET_SRC} passdb/passdb.c
+                 passdb/account_pol.c ${PRIVILEGES_SRC}
+                 lib/util_nscd.c lib/winbind_util.c
+                 passdb/pdb_util.c passdb/pdb_interface.c
+-                passdb/pdb_ldap_schema.c
+                 passdb/pdb_secrets.c
+                 passdb/pdb_unixid.c'''
+ #FIXME: lib/winbind_util.c probably is not part of PASSDB_SRC
+@@ -733,6 +732,10 @@ bld.SAMBA3_LIBRARY('pdb',
+                    vnum='0',
+                    vars=locals())
+ 
++bld.SAMBA3_SUBSYSTEM('smbldaphelper',
++                   source='passdb/pdb_ldap_schema.c passdb/pdb_ldap_util.c',
++                   deps='smbldap secrets3 pdb')
++
+ bld.SAMBA3_SUBSYSTEM('SERVER_MUTEX',
+                      source=SERVER_MUTEX_SRC,
+ 		     deps='talloc')
diff --git a/samba-4.0.0rc2-fix_panic_action.patch b/samba-4.0.0rc2-fix_panic_action.patch
new file mode 100644
index 0000000..dc28abb
--- /dev/null
+++ b/samba-4.0.0rc2-fix_panic_action.patch
@@ -0,0 +1,42 @@
+commit 2a7484eb7286a6896826ad1ed15aa7b1760a451c
+Author:     Matthieu Patou <mat at matws.net>
+AuthorDate: Mon Sep 17 16:51:02 2012 -0700
+Commit:     Stefan Metzmacher <metze at samba.org>
+CommitDate: Tue Sep 18 06:12:00 2012 +0200
+
+    panic action is defined as GLOBAL_VAR(szPanicAction) not GLOBAL_VAR(panic_action)
+    
+    Signed-off-by: Stefan Metzmacher <metze at samba.org>
+    
+    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
+    Autobuild-Date(master): Tue Sep 18 06:12:00 CEST 2012 on sn-devel-104
+---
+ lib/param/loadparm.c     | 2 +-
+ source3/param/loadparm.c | 1 -
+ 2 files changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
+index 990dd29..b2e4218 100644
+--- a/lib/param/loadparm.c
++++ b/lib/param/loadparm.c
+@@ -2295,7 +2295,7 @@ static bool lpcfg_update(struct loadparm_context *lp_ctx)
+ 		return true;
+ 	}
+ 
+-	panic_action = lp_ctx->globals->panic_action;
++	panic_action = lp_ctx->globals->szPanicAction;
+ 
+ 	reload_charcnv(lp_ctx);
+ 
+diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
+index f1999ad..61606ce 100644
+--- a/source3/param/loadparm.c
++++ b/source3/param/loadparm.c
+@@ -131,7 +131,6 @@ static bool defaults_saved = false;
+ 	char *tls_cafile;						\
+ 	char *tls_crlfile;						\
+ 	char *tls_dhpfile;						\
+-	char *panic_action;						\
+ 	int bPreferredMaster;
+ 
+ #include "param/param_global.h"
diff --git a/samba-4.0.0rc2-fix_smb.conf_manpage_build.patch b/samba-4.0.0rc2-fix_smb.conf_manpage_build.patch
new file mode 100644
index 0000000..15824d5
--- /dev/null
+++ b/samba-4.0.0rc2-fix_smb.conf_manpage_build.patch
@@ -0,0 +1,155 @@
+commit 73ed1533105ac3f90813e5a0e7888a095eff4b75
+Author:     Alexander Bokovoy <ab at samba.org>
+AuthorDate: Mon Sep 17 13:07:26 2012 +0300
+Commit:     Alexander Bokovoy <ab at samba.org>
+CommitDate: Mon Sep 17 14:18:31 2012 +0200
+
+    docs-xml: convert smb.conf.5 build to waf
+    
+    smb.conf(5) is different from other manpages because before it is
+    built, it gets merged together from a number of smaller files, one
+    per parameter. So we first create a parameters.all.xml file that
+    references all these files and then include it into master smb.conf.5.xml
+    
+    One small issue is how to handle generated files in WAF build
+    from xi:include perspective as the files are generated in bin/default/docs-xml
+    rather than in docs-xml. We solve this by further expanding use of XML catalogs
+    and rewriting virtual path http://www.samba.org/samba/smbdotconf/ to proper
+    location.
+    
+    Both docs-xml autoconf and waf builds work correctly now.
+    
+    Autobuild-User(master): Alexander Bokovoy <ab at samba.org>
+    Autobuild-Date(master): Mon Sep 17 14:18:31 CEST 2012 on sn-devel-104
+---
+ buildtools/wafsamba/wafsamba.py  |  6 ++++--
+ docs-xml/build/catalog.xml.in    |  7 +++++--
+ docs-xml/manpages/smb.conf.5.xml |  5 ++++-
+ docs-xml/wscript_build           | 25 +++++++++++++++++++++++--
+ wscript_build                    |  6 ++++--
+ 5 files changed, 40 insertions(+), 9 deletions(-)
+
+diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
+index 1f71bd3..50bd4fa 100644
+--- a/buildtools/wafsamba/wafsamba.py
++++ b/buildtools/wafsamba/wafsamba.py
+@@ -789,14 +789,16 @@ def SAMBAMANPAGES(bld, manpages):
+     '''build and install manual pages'''
+     bld.env.SAMBA_EXPAND_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/expand-sambadoc.xsl'
+     bld.env.SAMBA_MAN_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/man.xsl'
+-    os.environ["XML_CATALOG_FILES"] = 'file:///etc/xml/catalog file://' + bld.srcnode.abspath() + '/bin/default/docs-xml/build/catalog.xml'
++    bld.env.SAMBA_CATALOGS = 'file:///etc/xml/catalog file://' + bld.srcnode.abspath() + '/bin/default/docs-xml/build/catalog.xml'
+     for m in manpages.split():
+         source = m + '.xml'
+         bld.SAMBA_GENERATOR(m,
+                             source=source,
+                             target=m,
+                             group='final',
+-                            rule='${XSLTPROC} --xinclude --stringparam noreference 0 -o ${TGT}.xml --nonet ${SAMBA_EXPAND_XSL} ${SRC} && ${XSLTPROC} --nonet -o ${TGT} ${SAMBA_MAN_XSL} ${TGT}.xml'
++                            rule='''export XML_CATALOG_FILES="${SAMBA_CATALOGS}"
++                                    ${XSLTPROC} --xinclude --stringparam noreference 0 -o ${TGT}.xml --nonet ${SAMBA_EXPAND_XSL} ${SRC}
++                                    ${XSLTPROC} --nonet -o ${TGT} ${SAMBA_MAN_XSL} ${TGT}.xml'''
+                             )
+         bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
+ Build.BuildContext.SAMBAMANPAGES = SAMBAMANPAGES
+diff --git a/docs-xml/build/catalog.xml.in b/docs-xml/build/catalog.xml.in
+index 4b99cf5..56d13a6 100644
+--- a/docs-xml/build/catalog.xml.in
++++ b/docs-xml/build/catalog.xml.in
+@@ -6,9 +6,12 @@
+ 
+     <rewriteURI
+ 			uriStartString="http://www.samba.org/samba/DTD/"
+-			rewritePrefix="file://@abs_top_builddir@/build/DTD/"/>
++			rewritePrefix="file://@abs_top_srcdir@/build/DTD/"/>
+ 
+     <rewriteURI
+ 			uriStartString="http://www.gnu.org/licenses/"
+-			rewritePrefix="file://@abs_top_builddir@/Samba3-ByExample/"/>
++			rewritePrefix="file://@abs_top_srcdir@/Samba3-ByExample/"/>
++    <rewriteURI
++			uriStartString="http://www.samba.org/samba/smbdotconf/"
++			rewritePrefix="file://@abs_top_builddir@/smbdotconf/"/>
+ </catalog>
+diff --git a/docs-xml/manpages/smb.conf.5.xml b/docs-xml/manpages/smb.conf.5.xml
+index e09eee0..a73382f 100644
+--- a/docs-xml/manpages/smb.conf.5.xml
++++ b/docs-xml/manpages/smb.conf.5.xml
+@@ -757,7 +757,10 @@ chmod 1770 /usr/local/samba/lib/usershares
+ 	<title>EXPLANATION OF EACH PARAMETER</title>
+ 	
+ 	<samba:parameterlist>
+-		<xi:include href="../smbdotconf/parameters.all.xml" parse="xml"/>
++		<!-- The URI below is resolved to local generated version of parameters.all.xml //-->
++		<!-- WAF build places it in bin/default/docs-xml/smbdotconf/parameters.all.xml //-->
++		<!-- and we redirect there via use of XML_CATALOG_FILES, see docs-xml/build/catalog.xml.in //-->
++		<xi:include href="http://www.samba.org/samba/smbdotconf/parameters.all.xml" parse="xml"/>
+ 	</samba:parameterlist>
+ 
+ </refsect1>
+diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
+index 011854b..c5d5839 100644
+--- a/docs-xml/wscript_build
++++ b/docs-xml/wscript_build
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from samba_utils import save_file
+ manpages='''
+          manpages/eventlogadm.8
+          manpages/findsmb.1
+@@ -23,7 +23,6 @@ manpages='''
+          manpages/rpcclient.1
+          manpages/samba.7
+          manpages/sharesec.1
+-         manpages/smb.conf.5
+          manpages/smbcacls.1
+          manpages/smbclient.1
+          manpages/smbcontrol.1
+@@ -87,8 +86,30 @@ pam_winbind_manpages = '''
+ 
+ krb5_locator_manpages = 'manpages/winbind_krb5_locator.7'
+ 
++def smbdotconf_generate_parameter_list(task):
++    parameter_all = task.outputs[0].bldpath(task.env)
++    articles = task.inputs
++
++    t = '<section xmlns:xi="http://www.w3.org/2003/XInclude">\n'
++    for article in articles:
++        t += "<xi:include href='file://" + article.abspath(task.env) + "' parse='xml'/>\n"
++    t += "</section>\n"
++    save_file(parameter_all, t , create_dir=True)
++    return 0
++
++def SMBDOTCONF_MANPAGE(bld, target):
++    ''' assemble and build smb.conf.5 manual page'''
++    articles = bld.path.ant_glob("smbdotconf/**/*.xml")
++    parameter_all = 'smbdotconf/parameters.all.xml'
++    bld.SAMBA_GENERATOR(parameter_all,
++                        source=articles,
++                        target=parameter_all,
++                        rule=smbdotconf_generate_parameter_list)
++    bld.SAMBAMANPAGES(target)
++
+ if ('XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']):
+ 
++    SMBDOTCONF_MANPAGE(bld, 'manpages/smb.conf.5')
+     bld.SAMBAMANPAGES(manpages)
+ 
+     if bld.CONFIG_SET('WITH_PAM_MODULES') and bld.CONFIG_SET('HAVE_PAM_START'):
+diff --git a/wscript_build b/wscript_build
+index 5434056..0098036 100755
+--- a/wscript_build
++++ b/wscript_build
+@@ -144,7 +144,9 @@ bld.RECURSE('testsuite/headers')
+ bld.SYMBOL_CHECK()
+ bld.DUP_SYMBOL_CHECK()
+ 
+-bld.env.ABS_TOP_BUILDDIR = bld.srcnode.abspath() + '/docs-xml'
++bld.env.ABS_TOP_SRCDIR = bld.srcnode.abspath() + '/docs-xml'
++bld.env.ABS_TOP_BUILDDIR = bld.srcnode.abspath() + '/bin/default/docs-xml'
+ bld.CONFIGURE_FILE('docs-xml/build/catalog.xml',
+-                   ABS_TOP_BUILDDIR = bld.env.ABS_TOP_BUILDDIR)
++                   ABS_TOP_BUILDDIR = bld.env.ABS_TOP_BUILDDIR,
++                   ABS_TOP_SRCDIR=bld.env.ABS_TOP_SRCDIR)
+ bld.RECURSE('docs-xml')
diff --git a/samba-4.0.0rc2-fix_smbldaphelper_without_ldap.patch b/samba-4.0.0rc2-fix_smbldaphelper_without_ldap.patch
new file mode 100644
index 0000000..dabbc4a
--- /dev/null
+++ b/samba-4.0.0rc2-fix_smbldaphelper_without_ldap.patch
@@ -0,0 +1,26 @@
+commit 35a4a1ed1f0fc6f1cbccd31bb7db9431b2518a5b
+Author:     Andrew Bartlett <abartlet at samba.org>
+AuthorDate: Fri Sep 14 11:58:02 2012 -0700
+Commit:     Andrew Bartlett <abartlet at samba.org>
+CommitDate: Fri Sep 14 22:53:30 2012 +0200
+
+    build: Fix build on systems without ldap development headers
+    
+    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
+    Autobuild-Date(master): Fri Sep 14 22:53:30 CEST 2012 on sn-devel-104
+---
+ source3/wscript_build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/source3/wscript_build b/source3/wscript_build
+index 60965ef..7e39ec3 100755
+--- a/source3/wscript_build
++++ b/source3/wscript_build
+@@ -740,6 +740,7 @@ bld.SAMBA3_LIBRARY('smbldaphelper',
+                    source='passdb/pdb_ldap_schema.c passdb/pdb_ldap_util.c',
+                    deps='smbldap secrets3',
+                    allow_undefined_symbols=True,
++                   enabled=bld.env.HAVE_LDAP,
+                    private_library=True)
+ 
+ bld.SAMBA3_SUBSYSTEM('SERVER_MUTEX',
diff --git a/samba-4.0.0rc2-make_smbldaphelper_lib.patch b/samba-4.0.0rc2-make_smbldaphelper_lib.patch
new file mode 100644
index 0000000..88eca27
--- /dev/null
+++ b/samba-4.0.0rc2-make_smbldaphelper_lib.patch
@@ -0,0 +1,112 @@
+commit 86a4ca28649141f77556208b833db2e076c0125d
+Author:     Alexander Bokovoy <ab at samba.org>
+AuthorDate: Thu Sep 13 20:29:25 2012 +0300
+Commit:     Alexander Bokovoy <ab at samba.org>
+CommitDate: Fri Sep 14 01:02:21 2012 +0200
+
+    s3: make smbldaphelper subsystem an internal library
+    
+    Break pdb_ldap -> smbldaphelper -> pdb -> pdb_ldap loop by
+    making smbldaphelp intentionally underlinked internal library.
+    
+    It means that libsmbldaphelp is not usable unless its user is
+    also linked to libpdb (that is the case for both its users,
+    idmap_ldap and pdb_ldap, already) but gives us a break of
+    the circular dependency in case pdb_ldap statically linked
+    into pdb (default).
+    
+    This should solve case when idmap_ldap and pdb_ldap are dynamically
+    loaded modules
+    
+    Autobuild-User(master): Alexander Bokovoy <ab at samba.org>
+    Autobuild-Date(master): Fri Sep 14 01:02:21 CEST 2012 on sn-devel-104
+---
+ source3/passdb/ABI/pdb-0.sigs  |  7 -------
+ source3/winbindd/wscript_build |  2 +-
+ source3/wscript_build          | 12 +++++++++---
+ 3 files changed, 10 insertions(+), 11 deletions(-)
+
+diff --git a/source3/passdb/ABI/pdb-0.sigs b/source3/passdb/ABI/pdb-0.sigs
+index 2b57301..bc82ff3 100644
+--- a/source3/passdb/ABI/pdb-0.sigs
++++ b/source3/passdb/ABI/pdb-0.sigs
+@@ -16,19 +16,14 @@ algorithmic_pdb_rid_is_user: bool (uint32_t)
+ algorithmic_pdb_uid_to_user_rid: uint32_t (uid_t)
+ algorithmic_pdb_user_rid_to_uid: uid_t (uint32_t)
+ algorithmic_rid_base: int (void)
+-attrib_map_to_delete_v30: {attrib = 5, name = 0xXXXX "sambaPwdLastSet"}, {attrib = 6, name = 0xXXXX "sambaPwdCanChange"}, {attrib = 7, name = 0xXXXX "sambaPwdMustChange"}, {attrib = 8, name = 0xXXXX "sambaLogonTime"}, {attrib = 9, name = 0xXXXX "sambaLogoffTime"}, {attrib = 10, name = 0xXXXX "sambaKickoffTime"}, {attrib = 12, name = 0xXXXX "displayName"}, {attrib = 29, name = 0xXXXX "sambaHomeDrive"}, {attrib = 13, name = 0xXXXX "sambaHomePath"}, {attrib = 14, name = 0xXXXX "sambaLogonScript"}, {attrib = 15, name = 0xXXXX "sambaProfilePath"}, {attrib = 17, name = 0xXXXX "sambaUserWorkstations"}, {attrib = 18, name = 0xXXXX "sambaSID"}, {attrib = 19, name = 0xXXXX "sambaPrimaryGroupSID"}, {attrib = 21, name = 0xXXXX "sambaLMPassword"}, {attrib = 22, name = 0xXXXX "sambaNTPassword"}, {attrib = 23, name = 0xXXXX "sambaDomainName"}, {attrib = 25, name = 0xXXXX "sambaAcctFlags"}, {attrib = 37, name = 0xXXXX "sambaMungedDial"}, {attrib = 35, name = 0xXXXX "sambaBadPasswordCount"}
 , {attrib = 38, name = 0xXXXX "sambaBadPasswordTime"}, {attrib = 39, name = 0xXXXX "sambaPasswordHistory"}, {attrib = 42, name = 0xXXXX "sambaLogonHours"}, {attrib = 0, name = 0xXXXX}
+-attrib_map_v30: {attrib = 1, name = 0xXXXX "uid"}, {attrib = 2, name = 0xXXXX "uidNumber"}, {attrib = 3, name = 0xXXXX "gidNumber"}, {attrib = 4, name = 0xXXXX "homeDirectory"}, {attrib = 5, name = 0xXXXX "sambaPwdLastSet"}, {attrib = 6, name = 0xXXXX "sambaPwdCanChange"}, {attrib = 7, name = 0xXXXX "sambaPwdMustChange"}, {attrib = 8, name = 0xXXXX "sambaLogonTime"}, {attrib = 9, name = 0xXXXX "sambaLogoffTime"}, {attrib = 10, name = 0xXXXX "sambaKickoffTime"}, {attrib = 11, name = 0xXXXX "cn"}, {attrib = 44, name = 0xXXXX "sn"}, {attrib = 12, name = 0xXXXX "displayName"}, {attrib = 29, name = 0xXXXX "sambaHomeDrive"}, {attrib = 13, name = 0xXXXX "sambaHomePath"}, {attrib = 14, name = 0xXXXX "sambaLogonScript"}, {attrib = 15, name = 0xXXXX "sambaProfilePath"}, {attrib = 16, name = 0xXXXX "description"}, {attrib = 17, name = 0xXXXX "sambaUserWorkstations"}, {attrib = 18, name = 0xXXXX "sambaSID"}, {attrib = 19, name = 0xXXXX "sambaPrimaryGroupSID"}, {attrib = 21, name = 0xXX
 XX "sambaLMPassword"}, {attrib = 22, name = 0xXXXX "sambaNTPassword"}, {attrib = 23, name = 0xXXXX "sambaDomainName"}, {attrib = 24, name = 0xXXXX "objectClass"}, {attrib = 25, name = 0xXXXX "sambaAcctFlags"}, {attrib = 37, name = 0xXXXX "sambaMungedDial"}, {attrib = 35, name = 0xXXXX "sambaBadPasswordCount"}, {attrib = 38, name = 0xXXXX "sambaBadPasswordTime"}, {attrib = 39, name = 0xXXXX "sambaPasswordHistory"}, {attrib = 41, name = 0xXXXX "modifyTimestamp"}, {attrib = 42, name = 0xXXXX "sambaLogonHours"}, {attrib = 0, name = 0xXXXX}
+ builtin_domain_name: const char *(void)
+ cache_account_policy_get: bool (enum pdb_policy_type, uint32_t *)
+ cache_account_policy_set: bool (enum pdb_policy_type, uint32_t)
+ create_builtin_administrators: NTSTATUS (const struct dom_sid *)
+ create_builtin_users: NTSTATUS (const struct dom_sid *)
+ decode_account_policy_name: const char *(enum pdb_policy_type)
+-dominfo_attr_list: {attrib = 23, name = 0xXXXX "sambaDomainName"}, {attrib = 34, name = 0xXXXX "sambaNextRid"}, {attrib = 26, name = 0xXXXX "sambaNextUserRid"}, {attrib = 27, name = 0xXXXX "sambaNextGroupRid"}, {attrib = 28, name = 0xXXXX "sambaSID"}, {attrib = 33, name = 0xXXXX "sambaAlgorithmicRidBase"}, {attrib = 24, name = 0xXXXX "objectClass"}, {attrib = 0, name = 0xXXXX}
+ get_account_pol_db: struct db_context *(void)
+ get_account_policy_attr: const char *(enum pdb_policy_type)
+-get_attr_key2string: const char *(ATTRIB_MAP_ENTRY *, int)
+-get_attr_list: const char **(TALLOC_CTX *, ATTRIB_MAP_ENTRY *)
+ get_domain_group_from_sid: bool (struct dom_sid, GROUP_MAP *)
+ get_primary_group_sid: NTSTATUS (TALLOC_CTX *, const char *, struct passwd **, struct dom_sid **)
+ get_privileges_for_sid_as_set: NTSTATUS (TALLOC_CTX *, PRIVILEGE_SET **, struct dom_sid *)
+@@ -42,7 +37,6 @@ grant_all_privileges: bool (const struct dom_sid *)
+ grant_privilege_by_name: bool (const struct dom_sid *, const char *)
+ grant_privilege_set: bool (const struct dom_sid *, struct lsa_PrivilegeSet *)
+ groupdb_tdb_init: const struct mapping_backend *(void)
+-idpool_attr_list: {attrib = 2, name = 0xXXXX "uidNumber"}, {attrib = 3, name = 0xXXXX "gidNumber"}, {attrib = 24, name = 0xXXXX "objectClass"}, {attrib = 0, name = 0xXXXX}
+ init_account_policy: bool (void)
+ init_buffer_from_samu: uint32_t (uint8_t **, struct samu *, bool)
+ init_samu_from_buffer: bool (struct samu *, uint32_t, uint8_t *, uint32_t)
+@@ -272,7 +266,6 @@ sid_check_is_wellknown_builtin: bool (const struct dom_sid *)
+ sid_check_is_wellknown_domain: bool (const struct dom_sid *, const char **)
+ sid_to_gid: bool (const struct dom_sid *, gid_t *)
+ sid_to_uid: bool (const struct dom_sid *, uid_t *)
+-sidmap_attr_list: {attrib = 32, name = 0xXXXX "sambaSID"}, {attrib = 2, name = 0xXXXX "uidNumber"}, {attrib = 3, name = 0xXXXX "gidNumber"}, {attrib = 24, name = 0xXXXX "objectClass"}, {attrib = 0, name = 0xXXXX}
+ sids_to_unixids: bool (const struct dom_sid *, uint32_t, struct unixid *)
+ smb_add_user_group: int (const char *, const char *)
+ smb_create_group: int (const char *, gid_t *)
+diff --git a/source3/winbindd/wscript_build b/source3/winbindd/wscript_build
+index af3741b..302b9ee 100644
+--- a/source3/winbindd/wscript_build
++++ b/source3/winbindd/wscript_build
+@@ -62,7 +62,7 @@ bld.SAMBA3_MODULE('idmap_passdb',
+ bld.SAMBA3_MODULE('idmap_ldap',
+                  subsystem='idmap',
+                  source=IDMAP_LDAP_SRC,
+-                 deps='smbldap smbldaphelper',
++                 deps='smbldap smbldaphelper pdb',
+                  init_function='',
+                  internal_module=bld.SAMBA3_IS_STATIC_MODULE('idmap_ldap'),
+                  enabled=bld.SAMBA3_IS_ENABLED_MODULE('idmap_ldap') and bld.env.HAVE_LDAP)
+diff --git a/source3/wscript_build b/source3/wscript_build
+index c534ae6..60965ef 100755
+--- a/source3/wscript_build
++++ b/source3/wscript_build
+@@ -710,7 +710,11 @@ private_pdb_match.append('!idmap_xids_to_sids')
+ 
+ # ldap module is actually three modules merged together: ldapsam, ipa, and nds
+ static_pdb_match = static_pdb_match + ['ldap', 'ipa', 'nds']
+-ldapsam_pdb_match = ['!priv2ld', '!smbldap_search_domain_info', '!ldapsam_*', '!groupmap_attr_list*', '!get_userattr_list']
++ldapsam_pdb_match = ['!priv2ld', '!smbldap_search_domain_info',
++                     '!ldapsam_*', '!groupmap_attr_list*', '!get_userattr_list',
++                     '!dominfo_attr_list', '!get_attr_key2string',
++                     '!sidmap_attr_list', '!attrib_map_*', '!idpool_attr_list',
++                     '!get_attr_list']
+ private_pdb_match.append('!pdb_nds_*')
+ private_pdb_match.append('!pdb_init_ldapsam')
+ private_pdb_match = private_pdb_match + ldapsam_pdb_match
+@@ -732,9 +736,11 @@ bld.SAMBA3_LIBRARY('pdb',
+                    vnum='0',
+                    vars=locals())
+ 
+-bld.SAMBA3_SUBSYSTEM('smbldaphelper',
++bld.SAMBA3_LIBRARY('smbldaphelper',
+                    source='passdb/pdb_ldap_schema.c passdb/pdb_ldap_util.c',
+-                   deps='smbldap secrets3 pdb')
++                   deps='smbldap secrets3',
++                   allow_undefined_symbols=True,
++                   private_library=True)
+ 
+ bld.SAMBA3_SUBSYSTEM('SERVER_MUTEX',
+                      source=SERVER_MUTEX_SRC,
diff --git a/samba-4.0.0rc2-use_smb_man_style.patch b/samba-4.0.0rc2-use_smb_man_style.patch
new file mode 100644
index 0000000..73dc3cf
--- /dev/null
+++ b/samba-4.0.0rc2-use_smb_man_style.patch
@@ -0,0 +1,30 @@
+commit e7a58bc251bd74c3c7c64ee4f5cb85ec76852a8d
+Author:     Alexander Bokovoy <ab at samba.org>
+AuthorDate: Mon Sep 17 19:09:35 2012 +0300
+Commit:     Alexander Bokovoy <ab at samba.org>
+CommitDate: Mon Sep 17 19:52:53 2012 +0200
+
+    docs-xml: fix build of winbindd- and krb5 locator-related manpages
+    
+    These manpages depend on docs-xml infrastructure (samba DTDs)
+    
+    Autobuild-User(master): Alexander Bokovoy <ab at samba.org>
+    Autobuild-Date(master): Mon Sep 17 19:52:53 CEST 2012 on sn-devel-104
+---
+ docs-xml/wscript_build | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
+index c5d5839..32cf9be 100644
+--- a/docs-xml/wscript_build
++++ b/docs-xml/wscript_build
+@@ -113,7 +113,7 @@ if ('XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']):
+     bld.SAMBAMANPAGES(manpages)
+ 
+     if bld.CONFIG_SET('WITH_PAM_MODULES') and bld.CONFIG_SET('HAVE_PAM_START'):
+-        bld.MANPAGES(pam_winbind_manpages)
++        bld.SAMBAMANPAGES(pam_winbind_manpages)
+ 
+     if bld.CONFIG_SET('HAVE_KRB5_LOCATE_PLUGIN_H'):
+-        bld.MANPAGES(krb5_locator_manpages)
++        bld.SAMBAMANPAGES(krb5_locator_manpages)
diff --git a/samba.conf.tmp b/samba.conf.tmp
index 8a29577..2d6d626 100644
--- a/samba.conf.tmp
+++ b/samba.conf.tmp
@@ -1 +1,2 @@
 d /var/run/samba  755 root root
+d /var/run/winbindd  755 root root
diff --git a/samba.spec b/samba.spec
index b3463b4..bb2b8ec 100644
--- a/samba.spec
+++ b/samba.spec
@@ -1,124 +1,286 @@
-%define main_release 94
-%define samba_version 3.6.7
-%define tdb_version 1.2.9
-%define talloc_version 2.0.5
-#%define pre_release rc3
-%define pre_release %nil
-
-%define samba_release %{main_release}%{pre_release}%{?dist}
-
-%define samba_source source3
-Summary: Server and Client software to interoperate with Windows machines
-Name: samba
-Epoch: 2
-Version: %{samba_version}
-Release: %{samba_release}.2
-License: GPLv3+ and LGPLv3+
-Group: System Environment/Daemons
-URL: http://www.samba.org/
-
-Source: http://www.samba.org/samba/ftp/%{name}-%{samba_version}%{pre_release}.tar.gz
+%define main_release 95
+
+%define samba_version 4.0.0
+%define talloc_version 2.0.7
+%define ntdb_version 0.9
+%define tdb_version 1.2.10
+%define tevent_version 0.9.17
+%define ldb_version 1.1.12
+%define pre_release rc1
+
+%define samba_release %{main_release}%{?dist}.%{pre_release}
+
+%global with_libsmbclient 1
+%global with_libwbclient 1
+
+%global with_pam_smbpass 0
+%global with_talloc 0
+%global with_tevent 0
+%global with_tdb 0
+%global with_ntdb 1
+%global with_ldb 0
+
+%global with_mitkrb5 1
+%global with_dc 0
+
+%global with_clustering_support 1
+
+%{!?python_libdir: %define python_libdir %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1,1)")}
+%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
+
+Name:           samba
+Version:        %{samba_version}
+Release:        %{samba_release}
+
+%if 0%{?rhel}
+Epoch:          0
+%else
+Epoch:          2
+%endif
+
+%if 0%{?epoch} > 0
+%define samba_depver %{epoch}:%{version}-%{release}
+%define samba_conflict_ver %{epoch}:3.9.9
+%else
+%define samba_depver %{version}-%{release}
+%define samba_conflict_ver 3.9.9
+%endif
+
+Summary:        Server and Client software to interoperate with Windows machines
+License:        GPLv3+ and LGPLv3+
+Group:          System Environment/Daemons
+URL:            http://www.samba.org/
+
+Source0:        samba-%{version}%{pre_release}.tar.bz2
 
 # Red Hat specific replacement-files
 Source1: samba.log
 Source2: samba.xinetd
 Source3: swat.desktop
-Source4: samba.sysconfig
-Source5: smb.service
+Source4: smb.conf.default
+Source5: pam_winbind.conf
 Source6: samba.pamd
-Source7: smbprint
-Source8: winbind.service
-Source9: smb.conf.default
-Source10: nmb.service
-Source11: pam_winbind.conf
-Source12: samba.conf.tmp
-
-# Don't depend on Net::LDAP
-Source999: filter-requires-samba.sh
-
-# upstream patches.  Applied first so that they'll break our patches rather
-# than the other way around
-# (none right now)
-
-# generic patches
-Patch102: samba-3.2.0pre1-pipedir.patch
-Patch104: samba-3.0.0rc3-nmbd-netbiosname.patch
-# The passwd part has been applied, but not the group part
-Patch107: samba-3.2.0pre1-grouppwd.patch
-Patch200: samba-3.2.5-inotify.patch
-Patch201: samba-3.6.4-krb5_locate_kdc.patch
-
-Requires(pre): samba-common = %{epoch}:%{samba_version}-%{release}
-Requires: pam >= 0:0.64
-Requires: logrotate >= 0:3.4
-Requires(post): systemd-sysv
+Source7: samba.conf.tmp
+
+Source200: README.dc
+Source201: README.downgrade
+
+Patch1: samba-4.0.0rc2-build_idmap_manpages.patch
+Patch2: samba-4.0.0rc2-create_smbldaphelper.patch
+Patch3: samba-4.0.0rc2-make_smbldaphelper_lib.patch
+Patch4: samba-4.0.0rc2-fix_smbldaphelper_without_ldap.patch
+Patch5: samba-4.0.0rc2-fix_smb.conf_manpage_build.patch
+Patch6: samba-4.0.0rc2-use_smb_man_style.patch
+Patch7: samba-4.0.0rc2-fix_panic_action.patch
+
+BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+
+Requires(pre): /usr/sbin/groupadd
 Requires(post): systemd-units
 Requires(preun): systemd-units
 Requires(postun): systemd-units
-BuildRequires: systemd-units, gettext
-BuildRequires: pam-devel, readline-devel, ncurses-devel, libacl-devel, krb5-devel, openldap-devel, openssl-devel, cups-devel, ctdb-devel
-BuildRequires: autoconf, gawk, popt-devel, gtk2-devel, libcap-devel, libuuid-devel, quota-devel
-BuildRequires: libtalloc-devel, libtdb-devel, iniparser-devel
 
-# Working around perl dependency problem from docs
-%define __perl_requires %{SOURCE999}
+Requires(pre): %{name}-common = %{samba_depver}
+Requires: %{name}-libs = %{samba_depver}
 
+Requires: logrotate
+Requires: pam
+Requires: perl(Parse::Yapp)
 
-%description
+Obsoletes: samba4
+Provides: samba4
+
+BuildRequires: autoconf
+%if %with_clustering_support
+BuildRequires: ctdb-devel
+%endif
+BuildRequires: cups-devel
+BuildRequires: docbook-style-xsl
+BuildRequires: e2fsprogs-devel
+BuildRequires: gawk
+BuildRequires: iniparser-devel
+BuildRequires: krb5-devel
+BuildRequires: libacl-devel
+BuildRequires: libaio-devel
+BuildRequires: libattr-devel
+BuildRequires: libcap-devel
+BuildRequires: libuuid-devel
+BuildRequires: libxslt
+BuildRequires: ncurses-devel
+BuildRequires: openldap-devel
+BuildRequires: pam-devel
+BuildRequires: perl(ExtUtils::MakeMaker)
+BuildRequires: perl(Parse::Yapp)
+BuildRequires: popt-devel
+BuildRequires: python-devel
+BuildRequires: python-tevent
+BuildRequires: quota-devel
+BuildRequires: readline-devel
+BuildRequires: sed
+BuildRequires: zlib-devel >= 1.2.3
+BuildRequires: libbsd-devel
+
+%if ! %with_talloc
+%global libtalloc_version 2.0.7
+
+BuildRequires: libtalloc-devel >= %{libtalloc_version}
+BuildRequires: pytalloc-devel >= %{libtalloc_version}
+%endif
+
+%if ! %with_tevent
+%global libtevent_version 0.9.17
 
-Samba is the suite of programs by which a lot of PC-related machines
-share files, printers, and other information (such as lists of
-available files and printers). The Windows NT, OS/2, and Linux
-operating systems support this natively, and add-on packages can
-enable the same thing for DOS, Windows, VMS, UNIX of all kinds, MVS,
-and more. This package provides an SMB/CIFS server that can be used to
-provide network services to SMB/CIFS clients.
-Samba uses NetBIOS over TCP/IP (NetBT) protocols and does NOT
-need the NetBEUI (Microsoft Raw NetBIOS frame) protocol.
+BuildRequires: libtevent-devel >= %{libtevent_version}
+BuildRequires: python-tevent >= %{libtevent_version}
+%endif
+
+%if ! %with_ldb
+%global libldb_version 1.1.11
+
+BuildRequires: libldb-devel >= %{libldb_version}
+BuildRequires: pyldb-devel >= %{libldb_version}
+%endif
 
+%if ! %with_tdb
+%global libtdb_version 1.2.10
+
+BuildRequires: libtdb-devel >= %{libtdb_version}
+BuildRequires: python-tdb >= %{libtdb_version}
+%endif
+
+# UGLY HACK: Fix 'Provides' for libsmbclient and libwbclient
+%if ! %with_libsmbclient && ! %with_libwbclient
+%{?filter_setup:
+%filter_from_provides /libsmbclient.so.0()/d; /libwbclient.so.0()/d
+%filter_setup
+}
+%endif
+
+%description
+Samba is the standard Windows interoperability suite of programs for Linux and Unix.
 
 %package client
 Summary: Samba client programs
 Group: Applications/System
-Requires: samba-common = %{epoch}:%{samba_version}-%{release}
+Requires: %{name}-common = %{samba_depver}
+Requires: %{name}-libs = %{samba_depver}
+
+Obsoletes: samba4-client
+Provides: samba4-client
 
 %description client
-The samba-client package provides some SMB/CIFS clients to complement
+The samba4-client package provides some SMB/CIFS clients to complement
 the built-in SMB/CIFS filesystem in Linux. These clients allow access
 of SMB/CIFS shares and printing to SMB/CIFS printers.
 
+%package libs
+Summary: Samba libraries
+Group: Applications/System
+%if %with_libwbclient
+Requires: libwbclient
+%endif
+
+Obsoletes: samba4-libs
+Provides: samba4-libs
+
+%description libs
+The samba4-libs package contains the libraries needed by programs that
+link against the SMB, RPC and other protocols provided by the Samba suite.
+
+%package python
+Summary: Samba Python libraries
+Group: Applications/System
+Requires: %{name} = %{samba_depver}
+Requires: %{name}-libs = %{samba_depver}
+
+Obsoletes: samba4-python
+Provides: samba4-python
+
+%description python
+The samba4-python package contains the Python libraries needed by programs
+that use SMB, RPC and other Samba provided protocols in Python programs.
+
+%package devel
+Summary: Developer tools for Samba libraries
+Group: Development/Libraries
+Requires: %{name}-common = %{samba_depver}
+Requires: %{name}-libs = %{samba_depver}
+Requires: %{name}-test = %{samba_depver}
+
+Obsoletes: samba4-devel
+Provides: samba4-devel
+
+%description devel
+The samba4-devel package contains the header files for the libraries
+needed to develop programs that link against the SMB, RPC and other
+libraries in the Samba suite.
+
+%package pidl
+Summary: Perl IDL compiler
+Group: Development/Tools
+Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+
+Obsoletes: samba4-pidl
+Provides: samba4-pidl
+
+%description pidl
+The samba4-pidl package contains the Perl IDL compiler used by Samba
+and Wireshark to parse IDL and similar protocols
+
 %package common
 Summary: Files used by both Samba servers and clients
-Requires: libtdb >= 0:%{tdb_version}
-Requires: libtalloc >= 0:%{talloc_version}
 Group: Applications/System
-Requires(pre): /usr/sbin/groupadd
-Requires(post): coreutils
+Requires: %{name}-libs = %{samba_depver}
 Requires(post): systemd
 
+Obsoletes: samba4-common
+Provides: samba4-common
+
 %description common
-Samba-common provides files necessary for both the server and client
+samba4-common provides files necessary for both the server and client
 packages of Samba.
 
+%package test
+Summary: Testing tools for Samba servers and clients
+Group: Applications/System
+Requires: %{name} = %{samba_depver}
+Requires: %{name}-common = %{samba_depver}
+Requires: %{name}-dc = %{samba_depver}
+Requires: %{name}-libs = %{samba_depver}
+Requires: %{name}-winbind = %{samba_depver}
+
+Obsoletes: samba4-test
+Provides: samba4-test
+
+%description test
+samba4-test provides testing tools for both the server and client
+packages of Samba.
 
 %package winbind
 Summary: Samba winbind
 Group: Applications/System
-Requires: samba-common = %{epoch}:%{samba_version}-%{release}
-Requires: samba-winbind-clients = %{epoch}:%{samba_version}-%{release}
-Requires(pre): /usr/sbin/groupadd
-Requires(post): coreutils
+Requires: %{name}-common = %{samba_depver}
+Requires: %{name}-libs = %{samba_depver}
 
-%description winbind
-The samba-winbind package provides the winbind daemon and some client tools.
-Winbind enables Linux to be a full member in Windows domains and to use
-Windows user and group accounts on Linux.
+Obsoletes: samba4-winbind
+Provides: samba4-winbind
 
+%description winbind
+The samba-winbind package provides the winbind NSS library, and some
+client tools.  Winbind enables Linux to be a full member in Windows
+domains and to use Windows user and group accounts on Linux.
 
 %package winbind-krb5-locator
 Summary: Samba winbind krb5 locator
-Requires: samba-winbind-clients = %{epoch}:%{samba_version}-%{release}
 Group: Applications/System
+%if %with_libwbclient
+Requires: libwbclient
+%else
+Requires: %{name}-libs = %{samba_depver}
+%endif
+
+Obsoletes: samba4-winbind-krb5-locator
+Provides: samba4-winbind-krb5-locator
 
 %description winbind-krb5-locator
 The winbind krb5 locator is a plugin for the system kerberos library to allow
@@ -127,403 +289,318 @@ the local kerberos library to use the same KDC as samba and winbind use
 %package winbind-clients
 Summary: Samba winbind clients
 Group: Applications/System
+Requires: %{name}-common = %{samba_depver}
+Requires: %{name}-libs = %{samba_depver}
+%if %with_libwbclient
+Requires: libwbclient
+%endif
+
+Obsoletes: samba4-winbind-clients
+Provides: samba4-winbind-clients
 
 %description winbind-clients
 The samba-winbind-clients package provides the NSS library and a PAM
 module necessary to communicate to the Winbind Daemon
 
 
-%package winbind-devel
-Summary: Developer tools for the winbind library
-Group: Development
-Requires: samba-winbind = %{epoch}:%{samba_version}-%{release}
-
-%description winbind-devel
-The samba-winbind package provides developer tools for the wbclient library.
-
-
 %package swat
 Summary: The Samba SMB server Web configuration program
 Group: Applications/System
-Requires: samba = %{epoch}:%{samba_version}-%{release}, xinetd
+Requires: %{name} = %{samba_depver}
+Requires: %{name}-common = %{samba_depver}
+Requires: %{name}-libs = %{samba_depver}
+Requires: xinetd
+
+Obsoletes: samba4-swat
+Provides: samba4-swat
 
 %description swat
 The samba-swat package includes the new SWAT (Samba Web Administration
 Tool), for remotely managing Samba's smb.conf file using your favorite
 Web browser.
 
-
-%package doc
-Summary: Documentation for the Samba suite
-Group: Documentation
-Requires: samba-common = %{epoch}:%{samba_version}-%{release}
-
-%description doc
-The samba-doc package includes all the non-manpage documentation for the
-Samba suite.
-
-
-%package domainjoin-gui
-Summary: Domainjoin GUI
-Group: Applications/System
-Requires: samba-common = %{epoch}:%{samba_version}-%{release}, gtk2
-
-%description domainjoin-gui
-The samba-domainjoin-gui package includes a domainjoin gtk application.
-
-
+%if %with_libsmbclient
 %package -n libsmbclient
 Summary: The SMB client library
 Group: Applications/System
+Requires: %{name}-common = %{samba_depver}
 
 %description -n libsmbclient
 The libsmbclient contains the SMB client library from the Samba suite.
 
-
 %package -n libsmbclient-devel
 Summary: Developer tools for the SMB client library
-Group: Development
-Requires: libsmbclient = %{epoch}:%{samba_version}-%{release}
+Group: Development/Libraries
+Requires: libsmbclient = %{samba_depver}
 
 %description -n libsmbclient-devel
 The libsmbclient-devel package contains the header files and libraries needed to
 develop programs that link against the SMB client library in the Samba suite.
+%endif # with_libsmbclient
 
+%if %with_libwbclient
 %package -n libwbclient
-Summary: The Winbind client library
+Summary: The winbind client library
 Group: Applications/System
 
 %description -n libwbclient
-The libwbclient contains the Winbind client library from the Samba suite.
+The libwbclient package contains the winbind client library from the Samba suite.
 
 %package -n libwbclient-devel
-Summary: Developer tools for the Winbind client library
-Group: Development
-Requires: libwbclient = %{epoch}:%{samba_version}-%{release}
-
-Obsoletes: samba-winbind-devel
-Provides: samba-winbind-devel = %{epoch}:%{samba_version}-%{release}
+Summary: Developer tools for the winbind library
+Group: Development/Libraries
+Requires: libwbclient = %{samba_depver}
 
 %description -n libwbclient-devel
-The libwbclient-devel package contains the header files and libraries needed to
-develop programs that link against the Winbind client library in the Samba suite.
+The libwbclient-devel package provides developer tools for the wbclient library.
+%endif # with_libwbclient
+
+%package dc
+Summary: Samba AD Domain Controller
+Group: Applications/System
+Requires: %{name}-libs = %{samba_depver}
+Requires: %{name}-dc-libs = %{samba_depver}
+Requires: %{name}-python = %{samba_depver}
+
+Obsoletes: samba4-dc
+Provides: samba4-dc
+
+%description dc
+The samba-dc package provides AD Domain Controller functionality
+
+%package dc-libs
+Summary: Samba AD Domain Controller Libraries
+Group: Applications/System
+Requires: %{name}-common = %{samba_depver}
+Requires: %{name}-libs = %{samba_depver}
+
+Obsoletes: samba4-dc-libs
+Provides: samba4-dc-libs
+
+%description dc-libs
+The samba4-dc-libs package contains the libraries needed by the DC to
+link against the SMB, RPC and other protocols.
 
 %prep
-# TAG: change for non-pre
-%setup -q -n %{name}-%{samba_version}%{pre_release}
-#%setup -q
-
-# copy Red Hat specific scripts
-mkdir packaging/Fedora
-cp packaging/RHEL/setup/smbusers packaging/Fedora/
-cp %{SOURCE5} packaging/Fedora/
-cp %{SOURCE6} packaging/Fedora/
-cp %{SOURCE7} packaging/Fedora/
-cp %{SOURCE8} packaging/Fedora/winbind.service
-cp %{SOURCE9} packaging/Fedora/
-cp %{SOURCE10} packaging/Fedora/
-cp %{SOURCE11} packaging/Fedora/
-
-# Upstream patches
-#(none)
-# generic patches
-%patch102 -p1 -b .pipedir
-#%patch103 -p1 -b .logfiles
-#%patch104 -p1 -b .nmbd-netbiosname # FIXME: does not apply
-%patch107 -p1 -b .grouppwd
-%patch200 -p0 -b .inotify
-%patch201 -p1 -b .krb5_locate_kdc
-
-mv %samba_source/VERSION %samba_source/VERSION.orig
-sed -e 's/SAMBA_VERSION_VENDOR_SUFFIX=$/&\"%{samba_release}\"/' < %samba_source/VERSION.orig > %samba_source/VERSION
-cd %samba_source
-script/mkversion.sh
-cd ..
-
-#Remove smbldap-tools, they are already packaged separately in Fedora
-rm -fr examples/LDAP/smbldap-tools-*/
+%setup -q -n samba-%{version}%{pre_release}
 
+%patch1 -p1 -b .build_idmap_manpages
+%patch2 -p1 -b .create_smbldaphelper
+%patch3 -p1 -b .smbldaphelper_lib
+%patch4 -p1 -b .smbldaphed_without_ldap
+%patch5 -p1 -b .smb.conf_manpage
+%patch6 -p1 -b .smb_man_style
+%patch7 -p1 -b .fix_panic_action
 
 %build
-cd %samba_source
-sh autogen.sh
-%ifarch i386 sparc
-RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
+%global _talloc_lib ,talloc,pytalloc,pytalloc-util
+%global _tevent_lib ,tevent,pytevent
+%global _tdb_lib ,tdb,pytdb
+%global _ldb_lib ,ldb,pyldb
+
+%if ! %{with_talloc}
+%global _talloc_lib ,!talloc,!pytalloc,!pytalloc-util
+%endif
+
+%if ! %{with_tevent}
+%global _tevent_lib ,!tevent,!pytevent
+%endif
+
+%if ! %{with_tdb}
+%global _tdb_lib ,!tdb,!pytdb
 %endif
-%ifarch ia64
-#libtoolize --copy --force     # get it to recognize IA-64
-#autoheader
-#autoconf
-EXTRA="-D_LARGEFILE64_SOURCE"
+
+%if ! %{with_ldb}
+%global _ldb_lib ,!ldb,!pyldb
 %endif
-CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -DLDAP_DEPRECATED" %configure \
-    --with-dnsupdate \
-    --with-ads \
-    --with-acl-support \
-    --with-automount \
-    --with-dnsupdate \
-    --with-libsmbclient \
-    --with-libsmbsharemodes \
-    --with-mmap \
-    --with-pam \
-    --with-pam_smbpass \
-    --with-quotas \
-    --with-sendfile-support \
-    --with-syslog \
-    --with-utmp \
-    --with-vfs \
-    --with-winbind \
-    --without-smbwrapper \
-    --with-lockdir=/var/lib/samba \
-    --with-piddir=/run \
-    --with-mandir=%{_mandir} \
-    --with-privatedir=/var/lib/samba/private \
-    --with-logfilebase=/var/log/samba \
-    --with-libdir=%{_libdir} \
-    --with-modulesdir=%{_libdir}/samba \
-    --with-configdir=%{_sysconfdir}/samba \
-    --with-pammodulesdir=%{_lib}/security \
-    --with-swatdir=%{_datadir}/swat \
-    --with-shared-modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2 \
-    --with-cluster-support=auto \
-    --with-libtalloc=no \
-    --enable-external-libtalloc=yes \
-    --with-libtdb=no \
-    --with-nmbdsocketdir=/var/run/nmbd
-#    --enable-external-libtdb=yes \
-#    --with-aio-support \
-
-
-make samba3-idl
-
-make  pch
-
-make  LD_LIBRARY_PATH=$RPM_BUILD_DIR/%{name}-%{samba_version}%{pre_release}/%samba_source/bin \
-    %{?_smp_mflags} \
-    all ../nsswitch/libnss_wins.so modules test_pam_modules test_nss_modules test_shlibs
-
-make  LD_LIBRARY_PATH=$RPM_BUILD_DIR/%{name}-%{samba_version}%{pre_release}/%samba_source/bin \
-    %{?_smp_mflags} \
-    -C lib/netapi/examples
-
-make  debug2html smbfilter
 
+%global _samba4_libraries heimdal,!zlib,!popt%{_talloc_lib}%{_tevent_lib}%{_tdb_lib}%{_ldb_lib}
+
+%global _samba4_idmap_modules idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2
+%global _samba4_pdb_modules pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
+%global _samba4_auth_modules auth_sam,auth_unix,auth_winbind,auth_wbc,auth_server,auth_builtin,auth_netlogond,auth_script,auth_samba4
+# auth_domain needs to be static
+
+%global _samba4_modules %{_samba4_idmap_modules},%{_samba4_pdb_modules},%{_samba4_auth_modules}
+
+%global _libsmbclient %nil
+%global _libwbclient %nil
+
+%if ! %with_libsmbclient
+%global _libsmbclient smbclient,smbsharemodes,
+%endif
+
+%if ! %with_libwbclient
+%global _libwbclient wbclient,
+%endif
+
+%global _samba4_private_libraries %{_libsmbclient}%{_libwbclient}
+
+%configure \
+        --enable-fhs \
+        --with-piddir=/run \
+        --with-sockets-dir=/run/samba \
+        --with-modulesdir=%{_libdir}/samba \
+        --with-pammodulesdir=%{_libdir}/security \
+        --with-lockdir=/var/lib/samba \
+        --disable-gnutls \
+        --disable-rpath-install \
+        --with-shared-modules=%{_samba4_modules} \
+        --builtin-libraries=ccan \
+        --bundled-libraries=%{_samba4_libraries} \
+        --disable-ntdb \
+%if (! %with_libsmbclient) || (! %with_libwbclient)
+        --private-libraries=%{_samba4_private_libraries} \
+%endif
+%if %with_mitkrb5
+        --with-system-mitkrb5 \
+%endif
+%if ! %with_dc
+        --without-ad-dc \
+%endif
+%if %with_clustering_support
+        --with-cluster-support \
+%endif
+%if ! %with_pam_smbpass
+        --without-pam_smbpass
+%endif
+
+export WAFCACHE=/tmp/wafcache
+mkdir -p $WAFCACHE
+make %{?_smp_mflags}
+
+# Build PIDL for installation into vendor directories before
+# 'make proto' gets to it.
+(cd pidl && %{__perl} Makefile.PL INSTALLDIRS=vendor )
 
 %install
-mkdir -p $RPM_BUILD_ROOT/sbin
-mkdir -p $RPM_BUILD_ROOT/usr/{sbin,bin}
-mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
-mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/{pam.d,logrotate.d,security}
-mkdir -p $RPM_BUILD_ROOT/%{_lib}/security
-mkdir -p $RPM_BUILD_ROOT/var/lib/samba
-mkdir -p $RPM_BUILD_ROOT/var/lib/samba/private
-mkdir -p $RPM_BUILD_ROOT/var/lib/samba/winbindd_privileged
-mkdir -p $RPM_BUILD_ROOT/var/lib/samba/scripts
-mkdir -p $RPM_BUILD_ROOT/var/log/samba/old
-mkdir -p $RPM_BUILD_ROOT/var/spool/samba
-mkdir -p $RPM_BUILD_ROOT/%{_datadir}/swat/using_samba
-mkdir -p $RPM_BUILD_ROOT/var/run/nmbd
-mkdir -p $RPM_BUILD_ROOT/var/run/winbindd
-mkdir -p $RPM_BUILD_ROOT/%{_libdir}/samba
-mkdir -p $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
-
-cd %samba_source
-
-%makeinstall \
-    BINDIR=$RPM_BUILD_ROOT%{_bindir} \
-    BASEDIR=$RPM_BUILD_ROOT%{_prefix} \
-    SBINDIR=$RPM_BUILD_ROOT%{_sbindir} \
-    DATADIR=$RPM_BUILD_ROOT%{_datadir} \
-    LOCKDIR=$RPM_BUILD_ROOT/var/lib/samba \
-    PRIVATEDIR=$RPM_BUILD_ROOT%{_sysconfdir}/samba \
-    LIBDIR=$RPM_BUILD_ROOT%{_libdir}/ \
-    MODULESDIR=$RPM_BUILD_ROOT%{_libdir}/samba \
-    CONFIGDIR=$RPM_BUILD_ROOT%{_sysconfdir}/samba \
-    PAMMODULESDIR=$RPM_BUILD_ROOT/%{_lib}/security \
-    MANDIR=$RPM_BUILD_ROOT%{_mandir} \
-    VARDIR=$RPM_BUILD_ROOT/var/log/samba \
-    CODEPAGEDIR=$RPM_BUILD_ROOT%{_libdir}/samba \
-    SWATDIR=$RPM_BUILD_ROOT%{_datadir}/swat \
-    SAMBABOOK=$RPM_BUILD_ROOT%{_datadir}/swat/using_samba \
-    PIDDIR=$RPM_BUILD_ROOT/var/run \
-    NMBDSOCKETDIR=$RPM_BUILD_ROOT/var/run/nmbd
-
-cd ..
+rm -rf %{buildroot}
+make install DESTDIR=%{buildroot}
+
+install -d -m 0755 %{buildroot}/usr/{sbin,bin}
+install -d -m 0755 %{buildroot}%{_sysconfdir}/{pam.d,logrotate.d,security}
+install -d -m 0755 %{buildroot}%{_libdir}/security
+install -d -m 0755 %{buildroot}/var/lib/samba
+install -d -m 0755 %{buildroot}/var/lib/samba/private
+install -d -m 0755 %{buildroot}/var/lib/samba/winbindd_privileged
+install -d -m 0755 %{buildroot}/var/lib/samba/scripts
+install -d -m 0755 %{buildroot}/var/lib/samba/sysvol
+install -d -m 0755 %{buildroot}/var/log/samba/old
+install -d -m 0755 %{buildroot}/var/spool/samba
+install -d -m 0755 %{buildroot}/%{_datadir}/swat/using_samba
+install -d -m 0755 %{buildroot}/var/run/samba
+install -d -m 0755 %{buildroot}/var/run/winbindd
+install -d -m 0755 %{buildroot}/%{_libdir}/samba
+install -d -m 0755 %{buildroot}/%{_libdir}/pkgconfig
+
+# Undo the PIDL install, we want to try again with the right options.
+rm -rf %{buildroot}/%{_libdir}/perl5
+rm -rf %{buildroot}/%{_datadir}/perl5
+
+# Install PIDL.
+( cd pidl && make install PERL_INSTALL_ROOT=%{buildroot} )
+
+# winbind
+ln -sf %{_libdir}/libnss_winbind.so.2  %{buildroot}%{_libdir}/libnss_winbind.so
+ln -sf %{_libdir}/libnss_wins.so.2  %{buildroot}%{_libdir}/libnss_wins.so
 
 # Install other stuff
-install -m644 packaging/Fedora/smb.conf.default $RPM_BUILD_ROOT%{_sysconfdir}/samba/smb.conf
-install -m755 %samba_source/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir}
-install -m644 packaging/Fedora/smbusers $RPM_BUILD_ROOT%{_sysconfdir}/samba/smbusers
-install -m755 packaging/Fedora/smbprint $RPM_BUILD_ROOT%{_bindir}
-install -m644 packaging/Fedora/smb.service $RPM_BUILD_ROOT%{_unitdir}/smb.service
-install -m644 packaging/Fedora/nmb.service $RPM_BUILD_ROOT%{_unitdir}/nmb.service
-install -m644 packaging/Fedora/winbind.service $RPM_BUILD_ROOT%{_unitdir}/winbind.service
-install -m644 packaging/Fedora/pam_winbind.conf $RPM_BUILD_ROOT%{_sysconfdir}/security
-#ln -s ../..%{_initrddir}/smb  $RPM_BUILD_ROOT%{_sbindir}/samba
-install -m644 packaging/Fedora/samba.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/samba
-install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/samba
-echo 127.0.0.1 localhost > $RPM_BUILD_ROOT%{_sysconfdir}/samba/lmhosts
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/openldap/schema
-install -m644 examples/LDAP/samba.schema $RPM_BUILD_ROOT%{_sysconfdir}/openldap/schema/samba.schema
+install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/samba
+install -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/samba/smb.conf
+install -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/security/pam_winbind.conf
+install -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/pam.d/samba
+
+echo 127.0.0.1 localhost > %{buildroot}%{_sysconfdir}/samba/lmhosts
+
+install -d -m 0755 %{buildroot}%{_sysconfdir}/openldap/schema
+install -m644 examples/LDAP/samba.schema %{buildroot}%{_sysconfdir}/openldap/schema/samba.schema
+
+install -d -m 0755 %{buildroot}%{_sysconfdir}/xinetd.d
+install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/xinetd.d/swat
 
 install -d -m 0755 %{buildroot}%{_sysconfdir}/tmpfiles.d/
-install -m644 %{SOURCE12} %{buildroot}%{_sysconfdir}/tmpfiles.d/samba.conf
+install -m644 %{SOURCE7} %{buildroot}%{_sysconfdir}/tmpfiles.d/samba.conf
 
-# winbind
-mkdir -p $RPM_BUILD_ROOT%{_libdir}
-install -m 755 nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/%{_lib}/libnss_winbind.so.2
-ln -sf /%{_lib}/libnss_winbind.so.2  $RPM_BUILD_ROOT%{_libdir}/libnss_winbind.so
-install -m 755 nsswitch/libnss_wins.so $RPM_BUILD_ROOT/%{_lib}/libnss_wins.so.2
-ln -sf /%{_lib}/libnss_wins.so.2  $RPM_BUILD_ROOT%{_libdir}/libnss_wins.so
+install -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig
+install -m 0644 packaging/systemd/samba.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/samba
+
+install -d -m 0755 %{buildroot}%{_defaultdocdir}/%{name}
+install -m 0644 %{SOURCE201} %{buildroot}%{_defaultdocdir}/%{name}/README.downgrade
+
+%if ! %with_dc
+install -m 0644 %{SOURCE200} %{buildroot}%{_defaultdocdir}/%{name}/README.dc
+install -m 0644 %{SOURCE200} %{buildroot}%{_defaultdocdir}/%{name}/README.dc-libs
+%endif
+
+install -d -m 0755 %{buildroot}%{_unitdir}
+for i in nmb smb winbind ; do
+    cat packaging/systemd/$i.service | sed -e 's at Type=forking at Type=forking\nEnvironment=KRB5CCNAME=/run/samba/krb5cc_samba at g' >tmp$i.service
+    install -m 0644 tmp$i.service %{buildroot}%{_unitdir}/$i.service
+done
 
 # winbind krb5 locator
-#mkdir -p $RPM_BUILD_ROOT%{_libdir}/krb5/plugins/libkrb5
 install -d -m 0755 %{buildroot}%{_libdir}/krb5/plugins/libkrb5
-install -m 755 source3/bin/winbind_krb5_locator.so $RPM_BUILD_ROOT/%{_libdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so
+install -m 755 %{buildroot}/%{_libdir}/winbind_krb5_locator.so %{buildroot}/%{_libdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so
+rm -f %{buildroot}/%{_libdir}/winbind_krb5_locator.so
 
-# libraries {
-mkdir -p $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir}
-build_libdir="$RPM_BUILD_ROOT%{_libdir}"
+# cleanup stuff that does not belong here
+rm -f %{buildroot}/%{_mandir}/man3/ldb.3*
+rm -f %{buildroot}/%{_mandir}/man3/talloc.3*
 
-# make install puts libraries in the wrong place
-# (but at least gets the versioning right now)
+# Clean out crap left behind by the PIDL install.
+find %{buildroot} -type f -name .packlist -exec rm -f {} \;
+rm -f %{buildroot}%{perl_vendorlib}/wscript_build
+rm -rf %{buildroot}%{perl_vendorlib}/Parse/Yapp
 
-list="smbclient smbsharemodes netapi talloc tdb wbclient"
-for i in $list; do
-    install -m 644 %samba_source/pkgconfig/$i.pc $build_libdir/pkgconfig/ || true
-done
+# This makes the right links, as rpmlint requires that
+# the ldconfig-created links be recorded in the RPM.
+/sbin/ldconfig -N -n %{buildroot}%{_libdir}
 
+# Fix up permission on perl install.
+%{_fixperms} %{buildroot}%{perl_vendorlib}
 
-/sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}/
-
-# }
-
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
-install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/swat
-
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
-install -m644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/samba
-
-install -m 755 %samba_source/lib/netapi/examples/bin/netdomjoin-gui $RPM_BUILD_ROOT/%{_sbindir}/netdomjoin-gui
-mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}
-install -m 644 %samba_source/lib/netapi/examples/netdomjoin-gui/samba.ico $RPM_BUILD_ROOT/%{_datadir}/pixmaps/%{name}/samba.ico
-install -m 644 %samba_source/lib/netapi/examples/netdomjoin-gui/logo.png $RPM_BUILD_ROOT/%{_datadir}/pixmaps/%{name}/logo.png
-install -m 644 %samba_source/lib/netapi/examples/netdomjoin-gui/logo-small.png $RPM_BUILD_ROOT/%{_datadir}/pixmaps/%{name}/logo-small.png
-
-rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/editreg.1*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
-#rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbget.1*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man5/smbgetrc.5*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/vfstest.1*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/testprns.1*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man8/smbmount.8*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man8/smbmnt.8*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man8/smbumount.8*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man8/{u,}mount.cifs.8*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man8/{u,}cifs.upcall.8*
-
-rm -f $RPM_BUILD_ROOT%{_sbindir}/{u,}mount.cifs
-rm -f $RPM_BUILD_ROOT%{_sbindir}/cifs.upcall
-
-#rm -f $RPM_BUILD_ROOT%{_libdir}/libtalloc.so.*
-#rm -f $RPM_BUILD_ROOT%{_includedir}/talloc.h
-#rm -f $RPM_BUILD_ROOT%{_libdir}/libtalloc.so
-#rm -f $RPM_BUILD_ROOT%{_libdir}/pkgconfig/talloc.pc
-
-#rm -f $RPM_BUILD_ROOT%{_libdir}/libtdb.so.*
-#rm -f $RPM_BUILD_ROOT%{_includedir}/tdb.h
-#rm -f $RPM_BUILD_ROOT%{_libdir}/libtdb.so
-#rm -f $RPM_BUILD_ROOT%{_libdir}/pkgconfig/tdb.pc
-rm -f $RPM_BUILD_ROOT%{_bindir}/tdbbackup
-rm -f $RPM_BUILD_ROOT%{_bindir}/tdbdump
-rm -f $RPM_BUILD_ROOT%{_bindir}/tdbtool
-rm -f $RPM_BUILD_ROOT%{_bindir}/tdbrestore
-rm -f $RPM_BUILD_ROOT%{_mandir}/man8/tdbbackup.8*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man8/tdbdump.8*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man8/tdbtool.8*
-
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/ldbadd.1*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/ldbdel.1*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/ldbedit.1*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/ldbmodify.1*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/ldbsearch.1*
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/ldbrename.1*
-
-%find_lang net
-%find_lang pam_winbind
+# Remove stuff the buildsystem did not handle correctly
+rm -f %{buildroot}%{_libdir}/security/pam_smbpass.so
+rm -f %{buildroot}%{python_sitelib}/tevent.py
 
 %post
-if [ $1 -eq 1 ] ; then 
-    # Initial installation 
-    /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
+%systemd_post smb.service
+%systemd_post nmb.service
 
 %preun
-if [ $1 -eq 0 ] ; then
-    # Package removal, not upgrade
-    /usr/bin/systemctl --no-reload disable smb.service > /dev/null 2>&1 || :
-    /usr/bin/systemctl --no-reload disable nmb.service > /dev/null 2>&1 || :
-    /usr/bin/systemctl stop smb.service > /dev/null 2>&1 || :
-    /usr/bin/systemctl stop nmb.service > /dev/null 2>&1 || :
-fi
+%systemd_preun smb.service
+%systemd_preun nmb.service
 
 %postun
-/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
-    # Package upgrade, not uninstall
-    /usr/bin/systemctl try-restart smb.service >/dev/null 2>&1 || :
-    /usr/bin/systemctl try-restart nmb.service >/dev/null 2>&1 || :
-fi
-
-%triggerun -- samba < 1:3.6.0-72
-# Save the current service runlevel info
-# User must manually run 
-#   systemd-sysv-convert --apply smb
-#   systemd-sysv-convert --apply nmb
-# to migrate them to systemd targets
-/usr/bin/systemd-sysv-convert --save smb >/dev/null 2>&1 ||:
-/usr/bin/systemd-sysv-convert --save nmb >/dev/null 2>&1 ||:
-
-# Run these because the SysV package being removed won't do them
-/usr/sbin/chkconfig --del smb >/dev/null 2>&1 || :
-/usr/sbin/chkconfig --del nmb >/dev/null 2>&1 || :
-/usr/bin/systemctl try-restart smb.service >/dev/null 2>&1 || :
-/usr/bin/systemctl try-restart nmb.service >/dev/null 2>&1 || :
+%systemd_postun_with_restart smb.service
+%systemd_postun_with_restart nmb.service
+
+%post libs -p /sbin/ldconfig
+
+%postun libs -p /sbin/ldconfig
+
+%if %with_dc
+%post dc-libs -p /sbin/ldconfig
+
+%postun dc-libs -p /sbin/ldconfig
+%endif # with_dc
+
+%post test -p /sbin/ldconfig
+
+%postun test -p /sbin/ldconfig
 
 %pre winbind
 /usr/sbin/groupadd -g 88 wbpriv >/dev/null 2>&1 || :
 
 %post winbind
-if [ $1 -eq 1 ] ; then 
-    # Initial installation 
-    /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
+%systemd_post winbind.service
 
 %preun winbind
-if [ $1 -eq 0 ] ; then
-    # Package removal, not upgrade
-    /usr/bin/systemctl --no-reload disable winbind.service > /dev/null 2>&1 || :
-    /usr/bin/systemctl stop winbind.service > /dev/null 2>&1 || :
-fi
+%systemd_preun winbind.service
 
 %postun winbind
-/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
-    # Package upgrade, not uninstall
-    /usr/bin/systemctl try-restart winbind.service >/dev/null 2>&1 || :
-fi
-
-%triggerun winbind -- samba-winbind < 1:3.6.0-72
-# Save the current service runlevel info
-# User must manually run
-#   systemd-sysv-convert --apply winbind
-# to migrate them to systemd targets
-/usr/bin/systemd-sysv-convert --save winbind >/dev/null 2>&1 ||:
-
-# Run these because the SysV package being removed won't do them
-/usr/sbin/chkconfig --del winbind >/dev/null 2>&1 || :
-/usr/bin/systemctl try-restart winbind.service >/dev/null 2>&1 || :
+%systemd_postun_with_restart smb.service
+%systemd_postun_with_restart nmb.service
 
 %post common
 /sbin/ldconfig
@@ -531,183 +608,658 @@ fi
 
 %postun common -p /sbin/ldconfig
 
-
 %post winbind-clients -p /sbin/ldconfig
 
 %postun winbind-clients -p /sbin/ldconfig
 
+%if %with_libsmbclient
 %post -n libsmbclient -p /sbin/ldconfig
 
 %postun -n libsmbclient -p /sbin/ldconfig
+%endif # with_libsmbclient
 
+%if %with_libwbclient
 %post -n libwbclient -p /sbin/ldconfig
 
 %postun -n libwbclient -p /sbin/ldconfig
+%endif # with_libwbclient
+
+%clean
+rm -rf %{buildroot}
 
 %files
-%{_sbindir}/smbd
-%{_sbindir}/nmbd
-%{_bindir}/mksmbpasswd.sh
+%defattr(-,root,root,-)
+%doc COPYING
 %{_bindir}/smbstatus
 %{_bindir}/eventlogadm
-%config(noreplace) %{_sysconfdir}/samba/smbusers
-%{_unitdir}/smb.service
+%{_sbindir}/nmbd
+%{_sbindir}/smbd
+%{_libdir}/samba/libsmbd_base.so
+%{_libdir}/samba/libsmbd_conn.so
+%{_libdir}/samba/auth
+%{_libdir}/samba/vfs
 %{_unitdir}/nmb.service
+%{_unitdir}/smb.service
 %config(noreplace) %{_sysconfdir}/logrotate.d/samba
 %config(noreplace) %{_sysconfdir}/pam.d/samba
-%{_mandir}/man7/samba.7*
-%{_mandir}/man8/nmbd.8*
-%{_mandir}/man8/smbd.8*
-%{_mandir}/man8/eventlogadm.8*
-%{_mandir}/man8/vfs_*.8*
-%{_libdir}/samba/vfs
-%{_libdir}/samba/auth
-%{_libdir}/samba/charset
+%attr(0700,root,root) %dir /var/log/samba
+%attr(0700,root,root) %dir /var/log/samba/old
 %attr(1777,root,root) %dir /var/spool/samba
 %dir %{_sysconfdir}/openldap/schema
 %{_sysconfdir}/openldap/schema/samba.schema
-%ghost %dir /var/run/nmbd
+%doc %{_defaultdocdir}/%{name}/README.downgrade
+%{_mandir}/man1/smbstatus.1*
+%{_mandir}/man8/eventlogadm.8*
+%{_mandir}/man8/smbd.8*
+%{_mandir}/man8/nmbd.8*
+%{_mandir}/man8/vfs_*.8*
 
-%doc examples/autofs examples/LDAP examples/libsmbclient examples/misc examples/printer-accounting
-%doc examples/printing
+%files libs
+%defattr(-,root,root)
+%{_libdir}/libdcerpc-atsvc.so.*
+%{_libdir}/libdcerpc-binding.so.*
+%{_libdir}/libdcerpc-samr.so.*
+%{_libdir}/libdcerpc.so.*
+%{_libdir}/libgensec.so.*
+%{_libdir}/libndr-krb5pac.so.*
+%{_libdir}/libndr-nbt.so.*
+%{_libdir}/libndr-standard.so.*
+%{_libdir}/libndr.so.*
+%{_libdir}/libregistry.so.*
+%{_libdir}/libsamba-credentials.so.*
+%{_libdir}/libsamba-hostconfig.so.*
+%{_libdir}/libsamba-policy.so.*
+%{_libdir}/libsamba-util.so.*
+%{_libdir}/libsamdb.so.*
+%{_libdir}/libsmbclient-raw.so.*
+%{_libdir}/libsmbconf.so.*
+%{_libdir}/libtevent-util.so.*
+%{_libdir}/libpdb.so.*
+%{_libdir}/libsmbldap.so.*
+
+# libraries needed by the public libraries
+%{_libdir}/samba/libCHARSET3.so
+%{_libdir}/samba/libMESSAGING.so
+%{_libdir}/samba/libLIBWBCLIENT_OLD.so
+%{_libdir}/samba/libaddns.so
+%{_libdir}/samba/libads.so
+%{_libdir}/samba/libasn1util.so
+%{_libdir}/samba/libauth4.so
+%{_libdir}/samba/libauth_sam_reply.so
+%{_libdir}/samba/libauth_unix_token.so
+%{_libdir}/samba/libauthkrb5.so
+%{_libdir}/samba/libcli-ldap-common.so
+%{_libdir}/samba/libcli-ldap.so
+%{_libdir}/samba/libcli-nbt.so
+%{_libdir}/samba/libcli_cldap.so
+%{_libdir}/samba/libcli_smb_common.so
+%{_libdir}/samba/libcli_spoolss.so
+%{_libdir}/samba/libcliauth.so
+#%{_libdir}/samba/libclidns.so
+%{_libdir}/samba/libcluster.so
+%{_libdir}/samba/libcmdline-credentials.so
+%{_libdir}/samba/libdbwrap.so
+%{_libdir}/samba/libdcerpc-samba.so
+%{_libdir}/samba/libdcerpc-samba4.so
+%{_libdir}/samba/liberrors.so
+%{_libdir}/samba/libevents.so
+%{_libdir}/samba/libflag_mapping.so
+%{_libdir}/samba/libgpo.so
+%{_libdir}/samba/libgse.so
+%{_libdir}/samba/libinterfaces.so
+%{_libdir}/samba/libkrb5samba.so
+%{_libdir}/samba/libldbsamba.so
+%{_libdir}/samba/liblibcli_lsa3.so
+%{_libdir}/samba/liblibcli_netlogon3.so
+%{_libdir}/samba/liblibsmb.so
+%{_libdir}/samba/libsmb_transport.so
+%{_libdir}/samba/libmsrpc3.so
+%{_libdir}/samba/libndr-samba.so
+%{_libdir}/samba/libndr-samba4.so
+%{_libdir}/samba/libnet_keytab.so
+%{_libdir}/samba/libnetif.so
+%{_libdir}/samba/libnpa_tstream.so
+%{_libdir}/samba/libreplace.so
+%{_libdir}/samba/libsamba-modules.so
+%{_libdir}/samba/libsamba-net.so
+%{_libdir}/samba/libsamba-security.so
+%{_libdir}/samba/libsamba-sockets.so
+%{_libdir}/samba/libsamba_python.so
+%{_libdir}/samba/libsamdb-common.so
+%{_libdir}/samba/libsecrets3.so
+%{_libdir}/samba/libserver-role.so
+%{_libdir}/samba/libshares.so
+%{_libdir}/samba/libsamba3-util.so
+%{_libdir}/samba/libsmbd_shim.so
+%{_libdir}/samba/libsmbldaphelper.so
+%{_libdir}/samba/libsmbpasswdparser.so
+%{_libdir}/samba/libsmbregistry.so
+%{_libdir}/samba/libtdb-wrap.so
+%{_libdir}/samba/libtdb_compat.so
+%{_libdir}/samba/libtrusts_util.so
+%{_libdir}/samba/libutil_cmdline.so
+#%{_libdir}/samba/libutil_ntdb.so
+%{_libdir}/samba/libutil_reg.so
+%{_libdir}/samba/libutil_setid.so
+%{_libdir}/samba/libutil_tdb.so
+%{_libdir}/samba/libxattr_tdb.so
+
+%if %with_dc
+%{_libdir}/samba/libdb-glue.so
+%{_libdir}/samba/libHDB_SAMBA4.so
+%{_libdir}/samba/libasn1-samba4.so.8
+%{_libdir}/samba/libasn1-samba4.so.8.0.0
+%{_libdir}/samba/libgssapi-samba4.so.2
+%{_libdir}/samba/libgssapi-samba4.so.2.0.0
+%{_libdir}/samba/libhcrypto-samba4.so.5
+%{_libdir}/samba/libhcrypto-samba4.so.5.0.1
+%{_libdir}/samba/libhdb-samba4.so.11
+%{_libdir}/samba/libhdb-samba4.so.11.0.2
+%{_libdir}/samba/libheimbase-samba4.so.1
+%{_libdir}/samba/libheimbase-samba4.so.1.0.0
+%{_libdir}/samba/libhx509-samba4.so.5
+%{_libdir}/samba/libhx509-samba4.so.5.0.0
+%{_libdir}/samba/libkrb5-samba4.so.26
+%{_libdir}/samba/libkrb5-samba4.so.26.0.0
+%{_libdir}/samba/libroken-samba4.so.19
+%{_libdir}/samba/libroken-samba4.so.19.0.1
+%{_libdir}/samba/libwind-samba4.so.0
+%{_libdir}/samba/libwind-samba4.so.0.0.0
+%endif
 
-%files swat
-%config(noreplace) %{_sysconfdir}/xinetd.d/swat
-%{_datadir}/swat
-%{_sbindir}/swat
-%{_mandir}/man8/swat.8*
-%attr(755,root,root) %{_libdir}/samba/*.msg
+%if %{with_ldb}
+%{_libdir}/samba/libldb.so.1
+%{_libdir}/samba/libldb.so.%{ldb_version}
+%{_libdir}/samba/libpyldb-util.so.1
+%{_libdir}/samba/libpyldb-util.so.%{ldb_version}
+%endif
+%if %{with_talloc}
+%{_libdir}/samba/libtalloc.so.2
+%{_libdir}/samba/libtalloc.so.%{talloc_version}
+%{_libdir}/samba/libpytalloc-util.so.2
+%{_libdir}/samba/libpytalloc-util.so.%{talloc_version}
+%endif
+%if %{with_tevent}
+%{_libdir}/samba/libtevent.so.0
+%{_libdir}/samba/libtevent.so.%{tevent_version}
+%endif
+%if %{with_tdb}
+%{_libdir}/samba/libtdb.so.1
+%{_libdir}/samba/libtdb.so.%{tdb_version}
+%endif
+## we don't build it for now
+#%if %{with_ntdb}
+#%{_libdir}/samba/libntdb.so.0
+#%{_libdir}/samba/libntdb.so.%{ntdb_version}
+#%endif
+
+%if ! %with_libsmbclient
+%{_libdir}/samba/libsmbclient.so.*
+%{_libdir}/samba/libsmbsharemodes.so.*
+%{_mandir}/man7/libsmbclient.7*
+%endif # ! with_libsmbclient
 
-%files client
-%{_bindir}/rpcclient
-%{_bindir}/smbcacls
-%{_bindir}/findsmb
-%{_bindir}/smbget
-%{_bindir}/nmblookup
-%{_bindir}/smbclient
-%{_bindir}/smbprint
-%{_bindir}/smbspool
-%{_bindir}/smbtar
-%{_bindir}/smbtree
-%{_bindir}/sharesec
-%{_bindir}/smbta-util
-%{_mandir}/man1/findsmb.1*
-%{_mandir}/man1/nmblookup.1*
-%{_mandir}/man1/rpcclient.1*
-%{_mandir}/man1/smbcacls.1*
-%{_mandir}/man1/smbclient.1*
-%{_mandir}/man1/smbtar.1*
-%{_mandir}/man1/smbtree.1*
-%{_mandir}/man1/smbget.1*
-%{_mandir}/man1/sharesec.1*
-%{_mandir}/man8/smbspool.8*
-%{_mandir}/man8/smbta-util.8*
+%if ! %with_libwbclient
+%{_libdir}/samba/libwbclient.so.*
+%{_libdir}/samba/libwinbind-client.so
+%endif # ! with_libwbclient
 
-%files common -f net.lang
-%attr(755,root,root) /%{_lib}/security/pam_smbpass.so
+%files common
+%defattr(-,root,root)
+#%{_libdir}/samba/charset ???
 %{_sysconfdir}/tmpfiles.d/samba.conf
-%dir %{_libdir}/samba
-%{_libdir}/samba/lowcase.dat
-%{_libdir}/samba/upcase.dat
-%{_libdir}/samba/valid.dat
-%{_libdir}/libnetapi.so
-%attr(755,root,root) %{_libdir}/libnetapi.so.*
-%{_includedir}/netapi.h
-%{_libdir}/pkgconfig/netapi.pc
 %{_bindir}/net
-%{_bindir}/testparm
-%{_bindir}/smbpasswd
 %{_bindir}/pdbedit
 %{_bindir}/profiles
-%{_bindir}/smbcquotas
 %{_bindir}/smbcontrol
-%dir /var/lib/samba
+%{_bindir}/testparm
+%{_libdir}/libnetapi.so.*
+%{_libdir}/samba/libprinting_migrate.so
+%{_datadir}/samba/codepages
+%ghost %dir /var/run/samba
+%ghost %dir /var/run/winbindd
 %attr(700,root,root) %dir /var/lib/samba/private
-%dir /var/lib/samba/scripts
+%attr(755,root,root) %dir %{_sysconfdir}/samba
 %config(noreplace) %{_sysconfdir}/samba/smb.conf
 %config(noreplace) %{_sysconfdir}/samba/lmhosts
 %config(noreplace) %{_sysconfdir}/sysconfig/samba
-%dir %{_sysconfdir}/samba
-%attr(0700,root,root) %dir /var/log/samba
-%attr(0700,root,root) %dir /var/log/samba/old
 %{_mandir}/man1/profiles.1*
-%{_mandir}/man1/smbcquotas.1*
 %{_mandir}/man1/smbcontrol.1*
-#%{_mandir}/man1/vfstest.1*
 %{_mandir}/man1/testparm.1*
-%{_mandir}/man1/smbstatus.1*
-%{_mandir}/man5/smbpasswd.5*
-%{_mandir}/man5/smb.conf.5*
 %{_mandir}/man5/lmhosts.5*
-%{_mandir}/man8/smbpasswd.8*
-%{_mandir}/man8/pdbedit.8*
+%{_mandir}/man5/smb.conf.5*
+%{_mandir}/man5/smbpasswd.5*
+%{_mandir}/man7/samba.7*
 %{_mandir}/man8/net.8*
+%{_mandir}/man8/pdbedit.8*
 
-%doc README COPYING Manifest
-%doc WHATSNEW.txt Roadmap
+# common libraries
+%{_libdir}/samba/libauth.so
+%{_libdir}/samba/libpopt_samba3.so
+%{_libdir}/samba/pdb
 
-%files winbind -f pam_winbind.lang
-%{_bindir}/ntlm_auth
-%{_bindir}/wbinfo
+%if %with_pam_smbpass
+%{_libdir}/security/pam_smbpass.so
+%endif
+
+%files dc
+%defattr(-,root,root)
+%{_bindir}/samba-dig
+%{_libdir}/samba/ldb
+%{_libdir}/samba/libdfs_server_ad.so
+%{_libdir}/samba/libdsdb-module.so
+
+%if %with_dc
+%{_bindir}/samba-tool
+%{_sbindir}/samba
+%{_sbindir}/samba_kcc
+%{_sbindir}/samba_dnsupdate
+%{_sbindir}/samba_spnupdate
+%{_sbindir}/samba_upgradedns
+%{_sbindir}/samba_upgradeprovision
+%{_libdir}/mit_samba.so
+%{_libdir}/samba/bind9/dlz_bind9.so
+%{_libdir}/samba/libheimntlm-samba4.so.1
+%{_libdir}/samba/libheimntlm-samba4.so.1.0.1
+%{_libdir}/samba/libkdc-samba4.so.2
+%{_libdir}/samba/libkdc-samba4.so.2.0.0
+%{_libdir}/samba/libpac.so
+%{_libdir}/samba/gensec
+%dir /var/lib/samba/sysvol
+%{_datadir}/samba/setup
+%{_mandir}/man8/samba.8.gz
+%else # with_dc
+%doc %{_defaultdocdir}/%{name}/README.dc
+%endif # with_dc
+
+%files dc-libs
+%defattr(-,root,root)
+%if %with_dc
+%{_libdir}/samba/libprocess_model.so
+%{_libdir}/samba/libservice.so
+%{_libdir}/samba/process_model
+%{_libdir}/samba/service
+%{_libdir}/libdcerpc-server.so.*
+%{_libdir}/samba/libntvfs.so
+%{_libdir}/samba/libposix_eadb.so
+%{_libdir}/samba/bind9/dlz_bind9_9.so
+%else
+%doc %{_defaultdocdir}/%{name}/README.dc-libs
+%endif # with_dc
+
+%files winbind
+%defattr(-,root,root)
+#%{_bindir}/wbinfo3
 %{_libdir}/samba/idmap
 %{_libdir}/samba/nss_info
+%{_libdir}/samba/libnss_info.so
+%{_libdir}/samba/libidmap.so
 %{_sbindir}/winbindd
-%ghost %dir /var/run/winbindd
 %attr(750,root,wbpriv) %dir /var/lib/samba/winbindd_privileged
 %config(noreplace) %{_sysconfdir}/security/pam_winbind.conf
 %{_unitdir}/winbind.service
-%{_mandir}/man1/ntlm_auth.1*
 %{_mandir}/man1/wbinfo.1*
 %{_mandir}/man5/pam_winbind.conf.5*
 %{_mandir}/man8/pam_winbind.8*
 %{_mandir}/man8/winbindd.8*
 %{_mandir}/man8/idmap_*.8*
+#%{_datadir}/locale/*/LC_MESSAGES/pam_winbind.mo
 
 %files winbind-krb5-locator
-%{_mandir}/man7/winbind_krb5_locator.7*
+%defattr(-,root,root)
 %{_libdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so
+%{_mandir}/man7/winbind_krb5_locator.7*
 
 %files winbind-clients
-%{_libdir}/libnss_winbind.so
-/%{_lib}/libnss_winbind.so.2
-%{_libdir}/libnss_wins.so
-/%{_lib}/libnss_wins.so.2
-/%{_lib}/security/pam_winbind.so
+%defattr(-,root,root)
+%{_bindir}/ntlm_auth
+%{_bindir}/ntlm_auth3
+%{_bindir}/wbinfo
+%{_libdir}/libnss_winbind.so*
+%{_libdir}/libnss_wins.so*
+%{_libdir}/security/pam_winbind.so
+%{_mandir}/man1/ntlm_auth.1.gz
 
-%files doc
-%doc docs/Samba3-Developers-Guide.pdf docs/Samba3-ByExample.pdf
-%doc docs/Samba3-HOWTO.pdf
-%doc docs/htmldocs
+%files client
+%defattr(-,root,root)
+%{_bindir}/cifsdd
+%{_bindir}/dbwrap_tool
+%{_bindir}/debug2html
+%{_bindir}/log2pcap
+%{_bindir}/nmblookup
+%{_bindir}/nmblookup4
+%{_bindir}/oLschema2ldif
+%{_bindir}/regdiff
+%{_bindir}/regpatch
+%{_bindir}/regshell
+%{_bindir}/regtree
+%{_bindir}/rpcclient
+%{_bindir}/sharesec
+%{_bindir}/smbcacls
+%{_bindir}/smbclient
+%{_bindir}/smbclient4
+%{_bindir}/smbcquotas
+%{_bindir}/smbfilter
+%{_bindir}/smbget
+#%{_bindir}/smbiconv
+%{_bindir}/smbpasswd
+%{_bindir}/smbspool
+%{_bindir}/smbta-util
+%{_bindir}/smbtree
+%{_bindir}/split_tokens
+%{_libdir}/samba/libldb-cmdline.so
+%{_mandir}/man1/nmblookup.1*
+%{_mandir}/man1/oLschema2ldif.1*
+%{_mandir}/man1/regdiff.1*
+%{_mandir}/man1/regpatch.1*
+%{_mandir}/man1/regshell.1*
+%{_mandir}/man1/regtree.1*
+%exclude %{_mandir}/man1/findsmb.1*
+%{_mandir}/man1/log2pcap.1*
+%{_mandir}/man1/nmblookup4.1*
+%{_mandir}/man1/rpcclient.1*
+%{_mandir}/man1/sharesec.1*
+%{_mandir}/man1/smbcacls.1*
+%{_mandir}/man1/smbclient.1*
+%{_mandir}/man1/smbcquotas.1*
+%{_mandir}/man1/smbget.1*
+%{_mandir}/man5/smbgetrc.5*
+%exclude %{_mandir}/man1/smbtar.1*
+%{_mandir}/man1/smbtree.1*
+%{_mandir}/man8/smbpasswd.8*
+%{_mandir}/man8/smbspool.8*
+%{_mandir}/man8/smbta-util.8*
+
+## we don't build it for now
+#%if %{with_ntdb}
+#%{_bindir}/ntdbbackup
+#%{_bindir}/ntdbdump
+#%{_bindir}/ntdbrestore
+#%{_bindir}/ntdbtool
+#%endif
+
+%if %{with_tdb}
+%{_bindir}/tdbbackup
+%{_bindir}/tdbdump
+%{_bindir}/tdbrestore
+%{_bindir}/tdbtool
+%{_mandir}/man8/tdbbackup.8.gz
+%{_mandir}/man8/tdbdump.8.gz
+%{_mandir}/man8/tdbrestore.8.gz
+%{_mandir}/man8/tdbtool.8.gz
+%endif
+
+%if %with_ldb
+%{_bindir}/ldbadd
+%{_bindir}/ldbdel
+%{_bindir}/ldbedit
+%{_bindir}/ldbmodify
+%{_bindir}/ldbrename
+%{_bindir}/ldbsearch
+%{_mandir}/man1/ldbadd.1.gz
+%{_mandir}/man1/ldbdel.1.gz
+%{_mandir}/man1/ldbedit.1.gz
+%{_mandir}/man1/ldbmodify.1.gz
+%{_mandir}/man1/ldbrename.1.gz
+%{_mandir}/man1/ldbsearch.1.gz
+%endif
 
+%files test
+%defattr(-,root,root)
+%{_bindir}/asystest
+%{_bindir}/dbwrap_torture
+%{_bindir}/gentest
+%{_bindir}/locktest
+%{_bindir}/locktest2
+%{_bindir}/locktest3
+%{_bindir}/masktest
+%{_bindir}/masktest3
+%{_bindir}/msgtest
+%{_bindir}/ndrdump
+%{_bindir}/nsstest
+%{_bindir}/pdbtest
+%{_bindir}/pthreadpooltest
+%{_bindir}/rpc_open_tcp
+%{_bindir}/smbconftort
+%{_bindir}/smbtorture
+%{_bindir}/smbtorture3
+%{_bindir}/test_lp_load
+%{_bindir}/timelimit
+%{_bindir}/versiontest
+%{_bindir}/vfstest
+%{_bindir}/vlp
+%{_libdir}/libtorture.so.*
+%{_libdir}/samba/libsubunit.so
+%if %with_dc
+%{_libdir}/samba/libdlz_bind9_for_torture.so
+%endif
+%{_mandir}/man1/gentest.1*
+%{_mandir}/man1/locktest.1*
+%{_mandir}/man1/masktest.1*
+%{_mandir}/man1/ndrdump.1*
+%{_mandir}/man1/smbtorture.1*
+%{_mandir}/man1/vfstest.1*
+
+%files devel
+%defattr(-,root,root)
+%{_includedir}/samba-4.0/charset.h
+%{_includedir}/samba-4.0/core/doserr.h
+%{_includedir}/samba-4.0/core/error.h
+%{_includedir}/samba-4.0/core/ntstatus.h
+%{_includedir}/samba-4.0/core/werror.h
+%{_includedir}/samba-4.0/credentials.h
+%{_includedir}/samba-4.0/dcerpc.h
+%{_includedir}/samba-4.0/dlinklist.h
+%{_includedir}/samba-4.0/domain_credentials.h
+%{_includedir}/samba-4.0/gen_ndr/atsvc.h
+%{_includedir}/samba-4.0/gen_ndr/auth.h
+%{_includedir}/samba-4.0/gen_ndr/dcerpc.h
+%{_includedir}/samba-4.0/gen_ndr/epmapper.h
+%{_includedir}/samba-4.0/gen_ndr/krb5pac.h
+%{_includedir}/samba-4.0/gen_ndr/lsa.h
+%{_includedir}/samba-4.0/gen_ndr/mgmt.h
+%{_includedir}/samba-4.0/gen_ndr/misc.h
+%{_includedir}/samba-4.0/gen_ndr/nbt.h
+%{_includedir}/samba-4.0/gen_ndr/drsblobs.h
+%{_includedir}/samba-4.0/gen_ndr/drsuapi.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_drsblobs.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_drsuapi.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_atsvc.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_atsvc_c.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_dcerpc.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_epmapper.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_epmapper_c.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_krb5pac.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_mgmt.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_mgmt_c.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_misc.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_nbt.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_samr.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_samr_c.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_svcctl.h
+%{_includedir}/samba-4.0/gen_ndr/ndr_svcctl_c.h
+%{_includedir}/samba-4.0/gen_ndr/netlogon.h
+%{_includedir}/samba-4.0/gen_ndr/samr.h
+%{_includedir}/samba-4.0/gen_ndr/security.h
+%{_includedir}/samba-4.0/gen_ndr/server_id.h
+%{_includedir}/samba-4.0/gen_ndr/svcctl.h
+%{_includedir}/samba-4.0/gensec.h
+%{_includedir}/samba-4.0/ldap-util.h
+%{_includedir}/samba-4.0/ldap_errors.h
+%{_includedir}/samba-4.0/ldap_message.h
+%{_includedir}/samba-4.0/ldap_ndr.h
+%{_includedir}/samba-4.0/ldb_wrap.h
+%{_includedir}/samba-4.0/lookup_sid.h
+%{_includedir}/samba-4.0/machine_sid.h
+%{_includedir}/samba-4.0/ndr.h
+%{_includedir}/samba-4.0/ndr/ndr_drsblobs.h
+%{_includedir}/samba-4.0/ndr/ndr_drsuapi.h
+%{_includedir}/samba-4.0/ndr/ndr_svcctl.h
+%{_includedir}/samba-4.0/ndr/ndr_nbt.h
+%{_includedir}/samba-4.0/netapi.h
+%{_includedir}/samba-4.0/param.h
+%{_includedir}/samba-4.0/passdb.h
+%{_includedir}/samba-4.0/policy.h
+%{_includedir}/samba-4.0/read_smb.h
+%{_includedir}/samba-4.0/registry.h
+%{_includedir}/samba-4.0/roles.h
+%{_includedir}/samba-4.0/rpc_common.h
+%{_includedir}/samba-4.0/samba/session.h
+%{_includedir}/samba-4.0/samba/version.h
+%{_includedir}/samba-4.0/share.h
+%{_includedir}/samba-4.0/smb2.h
+%{_includedir}/samba-4.0/smb2_constants.h
+%{_includedir}/samba-4.0/smb2_create_blob.h
+%{_includedir}/samba-4.0/smb2_signing.h
+%{_includedir}/samba-4.0/smb_cli.h
+%{_includedir}/samba-4.0/smb_cliraw.h
+%{_includedir}/samba-4.0/smb_common.h
+%{_includedir}/samba-4.0/smb_composite.h
+%{_includedir}/samba-4.0/smbconf.h
+%{_includedir}/samba-4.0/smb_constants.h
+%{_includedir}/samba-4.0/smb_ldap.h
+%{_includedir}/samba-4.0/smbldap.h
+%{_includedir}/samba-4.0/smb_raw.h
+%{_includedir}/samba-4.0/smb_raw_interfaces.h
+%{_includedir}/samba-4.0/smb_raw_signing.h
+%{_includedir}/samba-4.0/smb_raw_trans2.h
+%{_includedir}/samba-4.0/smb_request.h
+%{_includedir}/samba-4.0/smb_seal.h
+%{_includedir}/samba-4.0/smb_signing.h
+%{_includedir}/samba-4.0/smb_unix_ext.h
+%{_includedir}/samba-4.0/smb_util.h
+%{_includedir}/samba-4.0/tdr.h
+%{_includedir}/samba-4.0/torture.h
+%{_includedir}/samba-4.0/tsocket.h
+%{_includedir}/samba-4.0/tsocket_internal.h
+%{_includedir}/samba-4.0/samba_util.h
+%{_includedir}/samba-4.0/util/attr.h
+%{_includedir}/samba-4.0/util/byteorder.h
+%{_includedir}/samba-4.0/util/data_blob.h
+%{_includedir}/samba-4.0/util/debug.h
+%{_includedir}/samba-4.0/util/memory.h
+%{_includedir}/samba-4.0/util/safe_string.h
+%{_includedir}/samba-4.0/util/string_wrappers.h
+%{_includedir}/samba-4.0/util/talloc_stack.h
+%{_includedir}/samba-4.0/util/tevent_ntstatus.h
+%{_includedir}/samba-4.0/util/tevent_unix.h
+%{_includedir}/samba-4.0/util/tevent_werror.h
+%{_includedir}/samba-4.0/util/time.h
+%{_includedir}/samba-4.0/util/xfile.h
+%{_includedir}/samba-4.0/util_ldb.h
+%{_libdir}/libdcerpc-atsvc.so
+%{_libdir}/libdcerpc-binding.so
+%{_libdir}/libdcerpc-samr.so
+%{_libdir}/libdcerpc.so
+%{_libdir}/libgensec.so
+%{_libdir}/libndr-krb5pac.so
+%{_libdir}/libndr-nbt.so
+%{_libdir}/libndr-standard.so
+%{_libdir}/libndr.so
+%{_libdir}/libnetapi.so
+%{_libdir}/libregistry.so
+%{_libdir}/libsamba-credentials.so
+%{_libdir}/libsamba-hostconfig.so
+%{_libdir}/libsamba-policy.so
+%{_libdir}/libsamba-util.so
+%{_libdir}/libsamdb.so
+%{_libdir}/libsmbclient-raw.so
+%{_libdir}/libsmbconf.so
+%{_libdir}/libtevent-util.so
+%{_libdir}/libtorture.so
+%{_libdir}/pkgconfig/dcerpc.pc
+%{_libdir}/pkgconfig/dcerpc_atsvc.pc
+%{_libdir}/pkgconfig/dcerpc_samr.pc
+%{_libdir}/pkgconfig/gensec.pc
+%{_libdir}/pkgconfig/ndr.pc
+%{_libdir}/pkgconfig/ndr_krb5pac.pc
+%{_libdir}/pkgconfig/ndr_nbt.pc
+%{_libdir}/pkgconfig/ndr_standard.pc
+%{_libdir}/pkgconfig/netapi.pc
+%{_libdir}/pkgconfig/registry.pc
+%{_libdir}/pkgconfig/samba-credentials.pc
+%{_libdir}/pkgconfig/samba-hostconfig.pc
+%{_libdir}/pkgconfig/samba-policy.pc
+%{_libdir}/pkgconfig/samba-util.pc
+%{_libdir}/pkgconfig/samdb.pc
+%{_libdir}/pkgconfig/smbclient-raw.pc
+%{_libdir}/pkgconfig/torture.pc
+%{_libdir}/libpdb.so
+%{_libdir}/libsmbldap.so
+
+%if %with_dc
+%{_includedir}/samba-4.0/dcerpc_server.h
+%{_libdir}/libdcerpc-server.so
+%{_libdir}/pkgconfig/dcerpc_server.pc
+%endif
+
+%if %with_talloc
+%{_includedir}/samba-4.0/pytalloc.h
+%endif
+
+%if ! %with_libsmbclient
+%{_includedir}/samba-4.0/libsmbclient.h
+%{_includedir}/samba-4.0/smb_share_modes.h
+%endif # ! with_libsmbclient
+
+%if ! %with_libwbclient
+%{_libdir}/samba/libwbclient.so
+%{_includedir}/samba-4.0/wbclient.h
+%endif # ! with_libwbclient
+
+%files python
+%defattr(-,root,root,-)
+%{python_sitearch}/*
+
+%files pidl
+%defattr(-,root,root,-)
+%{perl_vendorlib}/Parse/Pidl*
+%{_mandir}/man1/pidl*
+%{_mandir}/man3/Parse::Pidl*
+%attr(755,root,root) %{_bindir}/pidl
+
+%files swat
+%defattr(-,root,root)
+%config(noreplace) %{_sysconfdir}/xinetd.d/swat
+%{_datadir}/samba/swat
+%{_sbindir}/swat
+%{_mandir}/man8/swat.8*
+#%attr(755,root,root) %{_libdir}/samba/*.msg
+
+%if %with_libsmbclient
 %files -n libsmbclient
+%defattr(-,root,root)
 %attr(755,root,root) %{_libdir}/libsmbclient.so.*
 %attr(755,root,root) %{_libdir}/libsmbsharemodes.so.*
 
 %files -n libsmbclient-devel
-%{_includedir}/libsmbclient.h
-%{_includedir}/smb_share_modes.h
+%defattr(-,root,root)
+%{_includedir}/samba-4.0/libsmbclient.h
+%{_includedir}/samba-4.0/smb_share_modes.h
 %{_libdir}/libsmbclient.so
 %{_libdir}/libsmbsharemodes.so
 %{_libdir}/pkgconfig/smbclient.pc
 %{_libdir}/pkgconfig/smbsharemodes.pc
 %{_mandir}/man7/libsmbclient.7*
+%endif # with_libsmbclient
 
+%if %with_libwbclient
 %files -n libwbclient
-%attr(755,root,root) %{_libdir}/libwbclient.so.*
+%defattr(-,root,root)
+%{_libdir}/libwbclient.so.*
+%{_libdir}/samba/libwinbind-client.so
 
 %files -n libwbclient-devel
-%{_includedir}/wbclient.h
+%defattr(-,root,root)
+%{_includedir}/samba-4.0/wbclient.h
 %{_libdir}/libwbclient.so
 %{_libdir}/pkgconfig/wbclient.pc
-
-%files domainjoin-gui
-%{_sbindir}/netdomjoin-gui
-%dir %{_datadir}/pixmaps/samba
-%{_datadir}/pixmaps/samba/samba.ico
-%{_datadir}/pixmaps/samba/logo.png
-%{_datadir}/pixmaps/samba/logo-small.png
+%endif # with_libwbclient
 
 %changelog
+* Wed Sep 26 2012 - Andreas Schneider <asn at redhat.com> - 2:4.0.0-95.rc1
+- Update to 4.0.0rc1.
+
 * Mon Aug 20 2012 Guenther Deschner <gdeschner at redhat.com> - 2:3.6.7-94.2
 - Update to 3.6.7
 
diff --git a/sources b/sources
index 5b8f01b..ed94bb0 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-b23be56c15dd52f64eb7ba54c0ea1ed5  samba-3.6.7.tar.gz
+9fd5a6ac70f724a66c6fa53b9161ea06  samba-4.0.0rc1.tar.bz2


More information about the scm-commits mailing list