The branch, v4-1-stable has been updated
       via  b02db8d VERSION: Disable git snapshots for the 4.1.8 release.
       via  7413eb3 WHATSNEW: Add release notes for Samba 4.1.8.
       via  814b88c printing: fix purge of all print jobs
       via  af13e3e s3: smb2: Move from using SBVAL to put NTTIMEs on the wire 
to put_long_date_timespec.
       via  f3fd95f s3: smb2: Move from using SBVAL to put NTTIMEs on the wire 
to put_long_date_timespec.
       via  bb0871c bug #10609: CVE-2014-0239 Don't reply to replies
       via  60dbfbd lib-util: rename memdup to smb_memdup and fix all callers 
(bug #10556)
       via  2763d0f ad-dc: use exit_daemon() to communicate status of startup 
to systemd
       via  93979e0 winbindd: use exit_daemon() to pass startup status to 
systemd
       via  59d9a27 nmbd: use exit_daemon() to report status to systemd
       via  def308a smbd: use exit_daemon() to support reporting to systemd 
from smbd
       via  2c61618 add systemd integration
       via  7982500 pidl/lib/wscript_build: make use of PERL_LIB_INSTALL_DIR
       via  7a6173d script/autobuild: make use of 
--with-perl-{arch,lib}-install-dir
       via  a76395b wafsamba: Fail with error message if perl doesn't provide 
valid dirs.
       via  992e693 wafsamba: If perl can't provide defaults, define them.
       via  dbe2ef7 FSCTL_GET_SHADOW_COPY_DATA: Don't return 4 extra bytes at 
end
       via  ab51cd9 FSCTL_GET_SHADOW_COPY_DATA: Initialize output array to zero
       via  3b7b670 s3: smbd : Fix wildcard unlink to fail if we get an error 
rather than trying to continue.
       via  d514226 s3: smbd: Remove open_file_fchmod().
       via  690aab2 s3: smbd: change file_set_dosmode() to use 
get_file_handle_for_metadata() instead of open_file_fchmod().
       via  db4743a s3: smbd : Ensure file_new doesn't call into 
smbXsrv_open_create() for INTERNAL_OPEN_ONLY.
       via  90871a5 s3 : smbd : Protect all possible code paths from fsp->op == 
NULL.
       via  8f0c74e byteorder: do not assume PowerPC is big-endian
       via  1d255d2 Fix an empty if statement.
       via  a790773 Minor typo fix in source3/wscript.
       via  15a2d25 s3: smbd - smb1 - fix read of deleted memory in 
reply_writeclose().
       via  7346e39 idmap_autorid: fix failure in reverse lookup if ID is from 
domain range index #0
       via  c573720 dsdb: Do checks for invalid renames in samldb, before 
repl_meta_data
       via  423987a build: fix ordering problems with lib-provided and internal 
RPATHs
       via  cebdd0d s4:torture/netlogon: Test netlogon with additional attrs
       via  b81797c s4:torture/ldap: Add test for netlogon over tcp
       via  11a9d8c libcli/cldap: Add utility to create netlogon filter
       via  2e10364 s4:dsdb: Move cldap netlogon functions into 
samdb/ldb_modules
       via  bb6fda9 s4:cldap_server: Do not handle netlogon ourself anymore
       via  a7a61ec s4:dsdb/rootdse: Support netlogon request
       via  19a5ac2 s4:dsdb/rootdse: Pass rootdse context to rootdse_add_dynamic
       via  1e75825 provision: Fix string replacement ordering
       via  2c82031 s4:cldap_server: Move netlogon parsing into utility function
       via  161699f s4:torture/cldap: Fix a typo
       via  aa82073 s3-lib/util: fix logic inside set_namearray loops.
       via  9dbafdc s3-lib/util: fix read across end of namelist string
       via  bb79bdb s3-nmbd: reset debug settings after reading config file 
(bug #10239)
       via  675782c VERSION: Bump version number up to 4.1.8...
      from  9da023a WHATSNEW: Add release notes for Samba 4.1.7.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-1-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                            |    2 +-
 WHATSNEW.txt                                       |  121 ++++++-
 buildtools/wafadmin/Tools/config_c.py              |   13 +
 buildtools/wafadmin/Tools/perl.py                  |   52 ++-
 lib/util/become_daemon.c                           |   37 ++-
 lib/util/byteorder.h                               |   10 +-
 lib/util/samba_util.h                              |   14 +-
 lib/util/util.c                                    |    2 +-
 lib/util/wscript_build                             |    2 +-
 libcli/cldap/cldap.c                               |   90 +++--
 libcli/cldap/cldap.h                               |    2 +
 packaging/systemd/nmb.service                      |    3 +-
 packaging/systemd/samba.service                    |    3 +-
 packaging/systemd/smb.service                      |    3 +-
 packaging/systemd/winbind.service                  |    3 +-
 pidl/lib/wscript_build                             |    4 +-
 python/samba/provision/__init__.py                 |    2 +-
 python/samba/tests/dns.py                          |   29 ++
 script/autobuild.py                                |    4 +-
 source3/lib/interface.c                            |    4 +-
 source3/lib/smbldap.c                              |    2 +-
 source3/lib/util.c                                 |   33 +-
 source3/libsmb/clirap.c                            |    4 +-
 source3/locking/brlock.c                           |   18 +-
 source3/modules/vfs_btrfs.c                        |    5 +
 source3/modules/vfs_default.c                      |   15 +-
 source3/nmbd/nmbd.c                                |   47 ++--
 source3/passdb/secrets.c                           |    2 +-
 source3/printing/printing.c                        |   23 +-
 source3/smbd/aio.c                                 |   10 +
 source3/smbd/dosmode.c                             |  104 +++++-
 source3/smbd/files.c                               |    5 +-
 source3/smbd/open.c                                |   47 +--
 source3/smbd/proto.h                               |    3 -
 source3/smbd/reply.c                               |   27 +-
 source3/smbd/scavenger.c                           |    3 +
 source3/smbd/seal.c                                |    2 +-
 source3/smbd/sec_ctx.c                             |    4 +-
 source3/smbd/server.c                              |   48 ++--
 source3/smbd/smb2_close.c                          |  127 +++----
 source3/smbd/smb2_create.c                         |   85 +++--
 source3/winbindd/idmap_autorid.c                   |    2 +-
 source3/winbindd/winbindd.c                        |   18 +-
 source3/winbindd/winbindd_cache.c                  |    2 +-
 source3/wscript                                    |    2 +-
 source4/cldap_server/cldap_server.c                |   12 -
 source4/cldap_server/cldap_server.h                |   15 -
 source4/cldap_server/rootdse.c                     |    5 +
 source4/cldap_server/wscript_build                 |    2 +-
 source4/dns_server/dns_server.c                    |    6 +
 .../samdb/ldb_modules}/netlogon.c                  |   94 ++---
 source4/dsdb/samdb/ldb_modules/rootdse.c           |  122 +++++--
 source4/dsdb/samdb/ldb_modules/samldb.c            |  261 +++++++++++++-
 source4/dsdb/samdb/ldb_modules/subtree_rename.c    |  248 +------------
 source4/dsdb/samdb/ldb_modules/util.h              |    2 +
 source4/dsdb/samdb/ldb_modules/wscript_build       |    2 +-
 source4/ldap_server/ldap_backend.c                 |    3 +
 source4/libnet/libnet_domain.c                     |    2 +-
 source4/nbt_server/dgram/netlogon.c                |    2 +-
 source4/nbt_server/wscript_build                   |    2 +-
 source4/rpc_server/netlogon/dcerpc_netlogon.c      |    2 +-
 source4/rpc_server/wscript_build                   |    2 +-
 source4/smbd/process_thread.c                      |    4 +-
 source4/smbd/server.c                              |   23 +-
 source4/torture/ldap/cldap.c                       |  331 +----------------
 source4/torture/ldap/common.c                      |    2 +
 source4/torture/ldap/{cldap.c => netlogon.c}       |  394 ++++++++++++--------
 source4/torture/wscript_build                      |    2 +-
 wscript                                            |   27 ++-
 69 files changed, 1407 insertions(+), 1196 deletions(-)
 rename source4/{cldap_server => dsdb/samdb/ldb_modules}/netlogon.c (87%)
 copy source4/torture/ldap/{cldap.c => netlogon.c} (61%)


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 3e45362..7d071c9 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=1
-SAMBA_VERSION_RELEASE=7
+SAMBA_VERSION_RELEASE=8
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 131cab6..fc93ef5 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,121 @@
                    =============================
+                   Release Notes for Samba 4.1.8
+                           June 3, 2014
+                   =============================
+
+
+This is the latest stable release of Samba 4.1.
+
+Please note that this bug fix release also addresses two minor security issues
+without being a dedicated security release:
+
+  o CVE-2014-0239: dns: Don't reply to replies (bug #10609).
+  o CVE-2014-0178: Malformed FSCTL_SRV_ENUMERATE_SNAPSHOTS response
+    (bug #10549).
+
+For more details including security advisories and patches, please see
+
+  http://www.samba.org/samba/history/security.html
+
+
+Changes since 4.1.7:
+--------------------
+
+o   Michael Adam <ob...@samba.org>
+    * BUG 10548: build: Fix ordering problems with lib-provided and internal
+      RPATHs.
+
+
+o   Jeremy Allison <j...@samba.org>
+    * BUG 3124: s3: smb2: Fix 'xcopy /d' with samba shares.
+    * BUG 10544: s3: lib/util: Fix logic inside set_namearray loops.
+    * BUG 10564: Fix lock order violation and file lost.
+    * BUG 10577: Fix wildcard unlink to fail if we get an error rather than
+      trying to continue.
+
+
+o   Andrew Bartlett <abart...@samba.org>
+    * BUG 10569: dsdb: Do checks for invalid renames in samldb, before
+      repl_meta_data.
+
+
+o   Björn Baumbach <b...@sernet.de>
+    * BUG 10239: s3: nmbd: Reset debug settings after reading config file.
+    * BUG 10544: s3: lib/util: set_namearray reads across end of namelist
+    * BUG 10556: lib-util: Rename memdup to smb_memdup and fix all callers.
+
+
+o   Kai Blin <k...@samba.org>
+    * BUG 10609: CVE-2014-0239: dns: Don't reply to replies.
+
+
+o   Alexander Bokovoy <a...@samba.org>
+    * BUG 10517: Use exit_daemon() to communicate status of startup to
+      systemd.
+
+
+o   David Disseldorp <dd...@samba.org>
+    * BUG 10590: byteorder: Do not assume PowerPC is big-endian.
+    * BUG 10612: printing: Fix purge of all print jobs.
+
+
+o   Benjamin Franzke <benjaminfran...@googlemail.com>
+    * BUG 10524: Fix adding NetApps.
+
+
+o   Abhidnya Joshi <achir...@in.ibm.com>
+    * BUG 10547: idmap_autorid: Fix failure in reverse lookup if ID is from
+      domain range index #0.
+
+
+o   Stefan Metzmacher <me...@samba.org>
+    * BUG 10472: script/autobuild: Make use of
+      '--with-perl-{arch,lib}-install-dir'.
+
+
+o   Noel Power <nopo...@suse.com>
+    * BUG 10554: Fix read of deleted memory in reply_writeclose()'.
+
+
+o   Jose A. Rivera <jar...@redhat.com>
+    * BUG 10151: Extra ':' in msg for Waf Cross Compile Build System with
+      Cross-answers command.
+    * BUG 10348: Fix empty body in if-statement in continue_domain_open_lookup.
+
+
+o   Christof Schmitt <christof.schm...@us.ibm.com>
+    * BUG 10549: CVE-2014-0178: Malformed FSCTL_SRV_ENUMERATE_SNAPSHOTS
+      response.
+
+
+o   Andreas Schneider <a...@samba.org>
+    * BUG 10472: wafsamba: Fix the installation on FreeBSD.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the Samba 4.1 product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
+                   =============================
                    Release Notes for Samba 4.1.7
                            April 17, 2014
                    =============================
@@ -108,8 +225,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
 
                    =============================
                    Release Notes for Samba 4.1.6
diff --git a/buildtools/wafadmin/Tools/config_c.py 
b/buildtools/wafadmin/Tools/config_c.py
index a32d8aa..d0bc617 100644
--- a/buildtools/wafadmin/Tools/config_c.py
+++ b/buildtools/wafadmin/Tools/config_c.py
@@ -73,6 +73,19 @@ def parse_flags(line, uselib, env):
                        app('CCFLAGS_' + uselib, x)
                        app('CXXFLAGS_' + uselib, x)
                        app('LINKFLAGS_' + uselib, x)
+               #
+               # NOTE on special treatment of -Wl,-R and -Wl,-rpath:
+               #
+               # It is important to not put a library provided RPATH
+               # into the LINKFLAGS but in the RPATH instead, since
+               # the provided LINKFLAGS get prepended to our own internal
+               # RPATH later, and hence can potentially lead to linking
+               # in too old versions of our internal libs.
+               #
+               elif x.startswith('-Wl,-R'):
+                       app('RPATH_' + uselib, x[6:])
+               elif x.startswith('-Wl,-rpath,'):
+                       app('RPATH_' + uselib, x[11:])
                elif x.startswith('-Wl'):
                        app('LINKFLAGS_' + uselib, x)
                elif x.startswith('-m') or x.startswith('-f'):
diff --git a/buildtools/wafadmin/Tools/perl.py 
b/buildtools/wafadmin/Tools/perl.py
index 8f13e28..0f34e79 100644
--- a/buildtools/wafadmin/Tools/perl.py
+++ b/buildtools/wafadmin/Tools/perl.py
@@ -98,27 +98,53 @@ def check_perl_ext_devel(conf):
        conf.env.EXTUTILS_TYPEMAP  = read_out('print 
"$Config{privlib}/ExtUtils/typemap"')
        conf.env.perlext_PATTERN   = '%s.' + read_out('print $Config{dlext}')[0]
 
-       if getattr(Options.options, 'perl_vendorarch_dir', None):
-               conf.env.PERL_VENDORARCH_DIR = 
Options.options.perl_vendorarch_dir
-       else:
-               conf.env.PERL_VENDORARCH_DIR = read_out('print 
$Config{vendorarch}')[0]
-
-       if getattr(Options.options, 'perl_vendorlib_dir', None):
-               conf.env.PERL_VENDORLIB_DIR = Options.options.perl_vendorlib_dir
-       else:
-               conf.env.PERL_VENDORLIB_DIR = read_out('print 
$Config{vendorlib}')[0]
+       def try_any(keys):
+               for k in keys:
+                       conf.start_msg("Checking for perl $Config{%s}:" % k)
+                       try:
+                               v = read_out('print $Config{%s}' % k)[0]
+                               conf.end_msg("'%s'" % (v), 'GREEN')
+                               return v
+                       except IndexError:
+                               conf.end_msg(False, 'YELLOW')
+                               pass
+               return None
+
+       perl_arch_install_dir = None
+       if getattr(Options.options, 'perl_arch_install_dir', None):
+               perl_arch_install_dir = Options.options.perl_arch_install_dir
+       if perl_arch_install_dir is None:
+               perl_arch_install_dir = try_any(['vendorarch', 'sitearch', 
'archlib'])
+       if perl_arch_install_dir is None:
+               conf.fatal('No perl arch install directory autodetected.' +
+                          'Please define it with 
--with-perl-arch-install-dir.')
+       conf.start_msg("PERL_ARCH_INSTALL_DIR: ")
+       conf.end_msg("'%s'" % (perl_arch_install_dir), 'GREEN')
+       conf.env.PERL_ARCH_INSTALL_DIR = perl_arch_install_dir
+
+       perl_lib_install_dir = None
+       if getattr(Options.options, 'perl_lib_install_dir', None):
+               perl_lib_install_dir = Options.options.perl_lib_install_dir
+       if perl_lib_install_dir is None:
+               perl_lib_install_dir = try_any(['vendorlib', 'sitelib', 
'privlib'])
+       if perl_lib_install_dir is None:
+               conf.fatal('No perl lib install directory autodetected. ' +
+                          'Please define it with --with-perl-lib-install-dir.')
+       conf.start_msg("PERL_LIB_INSTALL_DIR: ")
+       conf.end_msg("'%s'" % (perl_lib_install_dir), 'GREEN')
+       conf.env.PERL_LIB_INSTALL_DIR = perl_lib_install_dir
 
 def set_options(opt):
        opt.add_option("--with-perl-binary", type="string", dest="perlbinary", 
help = 'Specify alternate perl binary', default=None)
 
-       opt.add_option("--with-perl-vendorarch",
+       opt.add_option("--with-perl-arch-install-dir",
                       type="string",
-                      dest="perl_vendorarch_dir",
+                      dest="perl_arch_install_dir",
                       help = ('Specify directory where to install arch 
specific files'),
                       default=None)
 
-       opt.add_option("--with-perl-vendorlib",
+       opt.add_option("--with-perl-lib-install-dir",
                       type="string",
-                      dest="perl_vendorlib_dir",
+                      dest="perl_lib_install_dir",
                       help = ('Specify directory where to install vendor 
specific files'),
                       default=None)
diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 2ca0478..35c8b32 100644
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -24,6 +24,9 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "system/locale.h"
+#if HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
 
 /*******************************************************************
  Close the low 3 fd's and open dev/null in their place.
@@ -75,8 +78,13 @@ _PUBLIC_ void close_low_fds(bool stdin_too, bool stdout_too, 
bool stderr_too)
 
 _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool 
log_stdout)
 {
+       pid_t newpid;
        if (do_fork) {
-               if (fork()) {
+               newpid = fork();
+               if (newpid) {
+#if HAVE_SYSTEMD
+                       sd_notifyf(0, "READY=0\nSTATUS=Starting 
process...\nMAINPID=%lu", (unsigned long) newpid);
+#endif /* HAVE_SYSTEMD */
                        _exit(0);
                }
        }
@@ -100,3 +108,30 @@ _PUBLIC_ void become_daemon(bool do_fork, bool 
no_process_group, bool log_stdout
         * never close stderr (but debug might dup it onto a log file) */
        close_low_fds(do_fork, !log_stdout, false);
 }
+
+_PUBLIC_ void exit_daemon(const char *msg, int error)
+{
+#ifdef HAVE_SYSTEMD
+       if (msg == NULL) {
+               msg = strerror(error);
+       }
+
+       sd_notifyf(0, "STATUS=daemon failed to start: %s\n"
+                                 "ERRNO=%i",
+                                 msg,
+                                 error);
+#endif
+       DEBUG(0, ("STATUS=daemon failed to start: %s, error code %d\n", msg, 
error));
+       exit(1);
+}
+
+_PUBLIC_ void daemon_ready(const char *daemon)
+{
+       if (daemon == NULL) {
+               daemon = "Samba";
+       }
+#ifdef HAVE_SYSTEMD
+       sd_notifyf(0, "READY=1\nSTATUS=%s: ready to serve connections...", 
daemon);
+#endif
+       DEBUG(0, ("STATUS=daemon '%s' finished starting up and ready to serve 
connections", daemon));
+}
diff --git a/lib/util/byteorder.h b/lib/util/byteorder.h
index 58cd68a..297be52 100644
--- a/lib/util/byteorder.h
+++ b/lib/util/byteorder.h
@@ -89,10 +89,12 @@ it also defines lots of intermediate macros, just ignore 
those :-)
 
 
 /*
-  on powerpc we can use the magic instructions to load/store
-  in little endian
-*/
-#if (defined(__powerpc__) && defined(__GNUC__))
+ * On powerpc we can use the magic instructions to load/store in little endian.
+ * The instructions are reverse-indexing, so assume a big endian Power
+ * processor. Power8 can be big or little endian, so we need to explicitly
+ * check.
+ */
+#if (defined(__powerpc__) && defined(__GNUC__) && HAVE_BIG_ENDIAN)
 static __inline__ uint16_t ld_le16(const uint16_t *addr)
 {
        uint16_t val;
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index f52347e..e3fe6a6 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -739,7 +739,7 @@ char *smb_xstrndup(const char *s, size_t n);
 /**
  Like strdup but for memory.
 **/
-_PUBLIC_ void *memdup(const void *p, size_t size);
+_PUBLIC_ void *smb_memdup(const void *p, size_t size);
 
 /**
  * Write a password to the log file.
@@ -842,6 +842,18 @@ _PUBLIC_ void close_low_fds(bool stdin_too, bool 
stdout_too, bool stderr_too);
 _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool 
log_stdout);
 
 /**
+ Exit daemon and print error message to the log at level 0
+ Optionally report failure to systemd if systemd integration is enabled
+**/
+_PUBLIC_ void exit_daemon(const char *msg, int error);
+
+/**
+ Report that the daemon is ready to serve connections to the log at level 0
+ Optionally report status to systemd if systemd integration is enabled
+**/
+_PUBLIC_ void daemon_ready(const char *daemon);
+
+/**
  * @brief Get a password from the console.
  *
  * You should make sure that the buffer is an empty string!
diff --git a/lib/util/util.c b/lib/util/util.c
index 3e9047c..35c1896 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -693,7 +693,7 @@ char *smb_xstrndup(const char *s, size_t n)
  Like strdup but for memory.
 **/
 
-_PUBLIC_ void *memdup(const void *p, size_t size)
+_PUBLIC_ void *smb_memdup(const void *p, size_t size)
 {
        void *p2;
        if (size == 0)
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 39a1613..5087116 100755
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -10,7 +10,7 @@ bld.SAMBA_LIBRARY('samba-util',
                     server_id.c dprintf.c parmlist.c bitmap.c pidfile.c
                     tevent_debug.c util_process.c''',
                   deps='DYNCONFIG',
-                  public_deps='talloc tevent execinfo uid_wrapper pthread 
LIBCRYPTO charset util_setid',
+                  public_deps='talloc tevent execinfo uid_wrapper pthread 
LIBCRYPTO charset util_setid systemd-daemon',
                   public_headers='debug.h attr.h byteorder.h data_blob.h 
memory.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h samba_util.h 
string_wrappers.h',
                   header_path= [ ('dlinklist.h samba_util.h', '.'), ('*', 
'util') ],
                   local_include=False,
diff --git a/libcli/cldap/cldap.c b/libcli/cldap/cldap.c
index 24ce39f..e543091 100644
--- a/libcli/cldap/cldap.c
+++ b/libcli/cldap/cldap.c
@@ -882,81 +882,91 @@ struct cldap_netlogon_state {
        struct cldap_search search;
 };
 
-static void cldap_netlogon_state_done(struct tevent_req *subreq);
-/*
-  queue a cldap netlogon for send
-*/
-struct tevent_req *cldap_netlogon_send(TALLOC_CTX *mem_ctx,
-                                      struct tevent_context *ev,
-                                      struct cldap_socket *cldap,
-                                      const struct cldap_netlogon *io)
+char *cldap_netlogon_create_filter(TALLOC_CTX *mem_ctx,
+                                  const struct cldap_netlogon *io)
 {
-       struct tevent_req *req, *subreq;
-       struct cldap_netlogon_state *state;
        char *filter;
-       static const char * const attr[] = { "NetLogon", NULL };
 
-       req = tevent_req_create(mem_ctx, &state,
-                               struct cldap_netlogon_state);
-       if (!req) {
+       filter = talloc_asprintf(mem_ctx, "(&(NtVer=%s)",
+                                ldap_encode_ndr_uint32(mem_ctx, 
io->in.version));
+       if (filter == NULL)
                return NULL;
-       }
 
-       filter = talloc_asprintf(state, "(&(NtVer=%s)", 
-                                ldap_encode_ndr_uint32(state, io->in.version));
-       if (tevent_req_nomem(filter, req)) {
-               goto post;
-       }
        if (io->in.user) {
                filter = talloc_asprintf_append_buffer(filter, "(User=%s)", 
io->in.user);
-               if (tevent_req_nomem(filter, req)) {
-                       goto post;
+               if (filter == NULL) {
+                       return NULL;
                }
        }
        if (io->in.host) {
                filter = talloc_asprintf_append_buffer(filter, "(Host=%s)", 
io->in.host);
-               if (tevent_req_nomem(filter, req)) {
-                       goto post;
+               if (filter == NULL) {
+                       return NULL;
                }
        }
        if (io->in.realm) {
                filter = talloc_asprintf_append_buffer(filter, 
"(DnsDomain=%s)", io->in.realm);
-               if (tevent_req_nomem(filter, req)) {
-                       goto post;
+               if (filter == NULL) {
+                       return NULL;
                }
        }
        if (io->in.acct_control != -1) {
                filter = talloc_asprintf_append_buffer(filter, "(AAC=%s)", 
-                                               ldap_encode_ndr_uint32(state, 
io->in.acct_control));
-               if (tevent_req_nomem(filter, req)) {
-                       goto post;
+                                               ldap_encode_ndr_uint32(mem_ctx, 
io->in.acct_control));
+               if (filter == NULL) {
+                       return NULL;
                }
        }
        if (io->in.domain_sid) {
-               struct dom_sid *sid = dom_sid_parse_talloc(state, 
io->in.domain_sid);
-               if (tevent_req_nomem(sid, req)) {
-                       goto post;
+               struct dom_sid *sid = dom_sid_parse_talloc(mem_ctx, 
io->in.domain_sid);
+               if (filter == NULL) {
+                       return NULL;
                }
                filter = talloc_asprintf_append_buffer(filter, "(domainSid=%s)",
-                                               ldap_encode_ndr_dom_sid(state, 
sid));
-               if (tevent_req_nomem(filter, req)) {
-                       goto post;
+                                               
ldap_encode_ndr_dom_sid(mem_ctx, sid));
+               if (filter == NULL) {
+                       return NULL;
                }
        }
        if (io->in.domain_guid) {
                struct GUID guid;
                NTSTATUS status;
                status = GUID_from_string(io->in.domain_guid, &guid);
-               if (tevent_req_nterror(req, status)) {
-                       goto post;
+               if (filter == NULL) {
+                       return NULL;
                }
                filter = talloc_asprintf_append_buffer(filter, 
"(DomainGuid=%s)",
-                                               ldap_encode_ndr_GUID(state, 
&guid));
-               if (tevent_req_nomem(filter, req)) {
-                       goto post;
+                                               ldap_encode_ndr_GUID(mem_ctx, 
&guid));
+               if (filter == NULL) {
+                       return NULL;
                }
        }
        filter = talloc_asprintf_append_buffer(filter, ")");
+
+       return filter;
+}
+
+static void cldap_netlogon_state_done(struct tevent_req *subreq);
+/*
+  queue a cldap netlogon for send
+*/


-- 
Samba Shared Repository

Reply via email to