Merge branch 'master' of git://git.samba.org/samba into teventfix
authorJelmer Vernooij <jelmer@samba.org>
Sun, 1 Mar 2009 15:39:35 +0000 (16:39 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 1 Mar 2009 15:39:35 +0000 (16:39 +0100)
Conflicts:
lib/tevent/pytevent.c

343 files changed:
WHATSNEW4.txt
docs-xml/archives/THANKS
docs-xml/manpages-3/ldbrename.1.xml [new file with mode: 0644]
docs-xml/manpages-3/mount.cifs.8.xml
docs-xml/manpages-3/vfs_acl_tdb.8.xml [new file with mode: 0644]
docs-xml/manpages-3/vfs_acl_xattr.8.xml [new file with mode: 0644]
docs-xml/smbdotconf/browse/enhancedbrowsing.xml
docs-xml/smbdotconf/locking/strictlocking.xml
docs-xml/smbdotconf/misc/remoteannounce.xml
docs-xml/smbdotconf/misc/usershareallowguests.xml
docs-xml/smbdotconf/misc/usershareprefixallowlist.xml
docs-xml/smbdotconf/misc/usersharetemplateshare.xml
docs-xml/smbdotconf/printing/useclientdriver.xml
docs-xml/smbdotconf/protocol/aclcheckpermissions.xml
docs-xml/smbdotconf/protocol/enableasusupport.xml
docs-xml/smbdotconf/security/clientlanmanauth.xml
docs-xml/smbdotconf/security/clientsigning.xml
docs-xml/smbdotconf/security/lanmanauth.xml
docs-xml/smbdotconf/security/passwordserver.xml
docs-xml/smbdotconf/security/security.xml
docs-xml/smbdotconf/security/serverschannel.xml
docs-xml/smbdotconf/security/serversigning.xml
docs-xml/smbdotconf/security/smbencrypt.xml
docs-xml/smbdotconf/security/updateencrypted.xml
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
lib/async_req/async_sock.c
lib/async_req/async_sock.h
lib/replace/getifaddrs.c
lib/replace/libreplace_ld.m4
lib/replace/system/network.h
lib/smbconf/smbconf.c
lib/smbconf/smbconf.h
lib/smbconf/smbconf_private.h
lib/smbconf/smbconf_txt.c
lib/tdb/common/open.c
lib/tevent/libtevent.m4
lib/tevent/tevent.h
lib/tevent/tevent_queue.c [new file with mode: 0644]
lib/tevent/tevent_req.c
lib/torture/config.mk
lib/util/become_daemon.c
lib/util/system.c
lib/util/tevent_ntstatus.c [new file with mode: 0644]
lib/util/tevent_ntstatus.h [new file with mode: 0644]
lib/util/tevent_unix.c [new file with mode: 0644]
lib/util/tevent_unix.h [new file with mode: 0644]
lib/util/util.c
lib/util/util.h
libcli/ldap/config.mk [new file with mode: 0644]
libcli/ldap/ldap_errors.h [moved from source4/libcli/ldap/ldap_errors.h with 98% similarity]
libcli/ldap/ldap_message.c [moved from source4/libcli/ldap/ldap.c with 88% similarity]
libcli/ldap/ldap_message.h [moved from source3/include/smb_ldap.h with 70% similarity]
libcli/ldap/ldap_ndr.c [moved from source4/libcli/ldap/ldap_ndr.c with 98% similarity]
libcli/ldap/ldap_ndr.h [moved from source4/libcli/ldap/ldap_ndr.h with 100% similarity]
libcli/util/doserr.c
libcli/util/werror.h
librpc/gen_ndr/cli_eventlog.c
librpc/gen_ndr/cli_eventlog.h
librpc/gen_ndr/cli_spoolss.c
librpc/gen_ndr/cli_spoolss.h
librpc/gen_ndr/dfs.h
librpc/gen_ndr/drsblobs.h
librpc/gen_ndr/drsuapi.h
librpc/gen_ndr/dssetup.h
librpc/gen_ndr/echo.h
librpc/gen_ndr/epmapper.h
librpc/gen_ndr/eventlog.h
librpc/gen_ndr/initshutdown.h
librpc/gen_ndr/krb5pac.h
librpc/gen_ndr/lsa.h
librpc/gen_ndr/misc.h
librpc/gen_ndr/named_pipe_auth.h
librpc/gen_ndr/nbt.h
librpc/gen_ndr/ndr_eventlog.c
librpc/gen_ndr/ndr_eventlog.h
librpc/gen_ndr/ndr_spoolss.c
librpc/gen_ndr/ndr_spoolss.h
librpc/gen_ndr/netlogon.h
librpc/gen_ndr/ntsvcs.h
librpc/gen_ndr/samr.h
librpc/gen_ndr/security.h
librpc/gen_ndr/spoolss.h
librpc/gen_ndr/srv_eventlog.c
librpc/gen_ndr/srv_eventlog.h
librpc/gen_ndr/srv_spoolss.c
librpc/gen_ndr/srvsvc.h
librpc/gen_ndr/svcctl.h
librpc/gen_ndr/winreg.h
librpc/gen_ndr/wkssvc.h
librpc/gen_ndr/xattr.h
librpc/idl/eventlog.idl
librpc/idl/spoolss.idl
librpc/ndr/ndr_sec_helper.c
librpc/ndr/ndr_spoolss_buf.c
librpc/ndr/ndr_spoolss_buf.h
pidl/lib/Parse/Pidl/Samba4/Header.pm
pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
pidl/lib/Parse/Pidl/Samba4/Python.pm
selftest/target/Samba4.pm
source3/Makefile.in
source3/auth/auth.c
source3/auth/auth_compat.c
source3/auth/auth_ntlmssp.c
source3/auth/auth_util.c
source3/auth/auth_wbc.c [new file with mode: 0644]
source3/client/client.c
source3/client/mount.cifs.c
source3/configure.in
source3/include/auth.h
source3/include/dbwrap.h
source3/include/includes.h
source3/include/libsmbclient.h
source3/include/locking.h
source3/include/nt_printing.h
source3/include/ntlmssp.h
source3/include/proto.h
source3/include/reg_db.h
source3/include/reg_objects.h
source3/include/regfio.h
source3/include/rpc_secdes.h
source3/include/rpc_spoolss.h
source3/include/smb.h
source3/include/smb_share_modes.h
source3/include/smbprofile.h
source3/include/vfs.h
source3/include/vfs_macros.h
source3/lib/dbwrap.c
source3/lib/dbwrap_tdb.c
source3/lib/display_sec.c
source3/lib/events.c
source3/lib/fault.c
source3/lib/file_id.c
source3/lib/ldap_debug_handler.c
source3/lib/secdesc.c
source3/lib/smbconf/smbconf_reg.c
source3/lib/smbldap.c
source3/lib/system.c
source3/lib/tdb_validate.c
source3/lib/util.c
source3/lib/util_sock.c
source3/lib/util_str.c
source3/lib/wb_reqtrans.c
source3/lib/wbclient.c
source3/libaddns/dns.h
source3/libads/disp_sec.c
source3/libgpo/gpo_reg.c
source3/libgpo/gpo_sec.c
source3/libnet/libnet_join.c
source3/librpc/gen_ndr/ndr_notify.c
source3/librpc/gen_ndr/notify.h
source3/librpc/idl/notify.idl
source3/librpc/ndr/util.c
source3/libsmb/cliconnect.c
source3/libsmb/libsmb_context.c
source3/libsmb/libsmb_dir.c
source3/libsmb/libsmb_file.c
source3/libsmb/libsmb_path.c
source3/libsmb/libsmb_server.c
source3/libsmb/libsmb_stat.c
source3/libsmb/nmblib.c
source3/libsmb/ntlmssp.c
source3/libsmb/smb_share_modes.c
source3/locking/brlock.c
source3/locking/locking.c
source3/modules/nfs4_acls.c
source3/modules/nfs4_acls.h
source3/modules/onefs.h
source3/modules/onefs_acl.c
source3/modules/onefs_cbrl.c
source3/modules/onefs_notify.c [new file with mode: 0644]
source3/modules/onefs_shadow_copy.c [new file with mode: 0644]
source3/modules/onefs_shadow_copy.h [new file with mode: 0644]
source3/modules/onefs_streams.c
source3/modules/onefs_system.c
source3/modules/vfs_acl_tdb.c
source3/modules/vfs_acl_xattr.c
source3/modules/vfs_default.c
source3/modules/vfs_extd_audit.c
source3/modules/vfs_fileid.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_onefs.c
source3/modules/vfs_onefs_shadow_copy.c [new file with mode: 0644]
source3/modules/vfs_solarisacl.c
source3/modules/vfs_streams_depot.c
source3/modules/vfs_streams_xattr.c
source3/modules/vfs_xattr_tdb.c
source3/nmbd/nmbd.c
source3/param/loadparm.c
source3/passdb/pdb_interface.c
source3/passdb/pdb_ldap.c
source3/passdb/pdb_wbc_sam.c [new file with mode: 0644]
source3/printing/notify.c
source3/printing/nt_printing.c
source3/printing/printfsp.c
source3/printing/printing.c
source3/printing/tests/vlp.c
source3/profile/profile.c
source3/registry/reg_api.c
source3/registry/reg_backend_current_version.c
source3/registry/reg_backend_db.c
source3/registry/reg_backend_hkpt_params.c
source3/registry/reg_backend_netlogon_params.c
source3/registry/reg_backend_perflib.c
source3/registry/reg_backend_printing.c
source3/registry/reg_backend_prod_options.c
source3/registry/reg_backend_shares.c
source3/registry/reg_backend_smbconf.c
source3/registry/reg_backend_tcpip_params.c
source3/registry/reg_dispatcher.c
source3/registry/reg_eventlog.c
source3/registry/reg_objects.c
source3/registry/regfio.c
source3/rpc_client/cli_spoolss.c
source3/rpc_client/cli_spoolss_notify.c [deleted file]
source3/rpc_client/rpc_transport_sock.c
source3/rpc_parse/parse_sec.c
source3/rpc_parse/parse_spoolss.c
source3/rpc_server/srv_eventlog_nt.c
source3/rpc_server/srv_netlog_nt.c
source3/rpc_server/srv_pipe_hnd.c
source3/rpc_server/srv_spoolss.c
source3/rpc_server/srv_spoolss_nt.c
source3/rpc_server/srv_svcctl_nt.c
source3/rpcclient/cmd_eventlog.c
source3/rpcclient/cmd_netlogon.c
source3/rpcclient/cmd_samr.c
source3/rpcclient/cmd_spoolss.c
source3/services/services_db.c
source3/smbd/close.c
source3/smbd/fileio.c
source3/smbd/files.c
source3/smbd/globals.c
source3/smbd/negprot.c
source3/smbd/notify.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/oplock.c
source3/smbd/oplock_irix.c
source3/smbd/oplock_onefs.c
source3/smbd/posix_acls.c
source3/smbd/reply.c
source3/smbd/server.c
source3/smbd/sesssetup.c
source3/smbd/trans2.c
source3/smbd/vfs.c
source3/utils/net_conf.c
source3/utils/net_rpc_printer.c
source3/utils/net_rpc_registry.c
source3/utils/profiles.c
source3/utils/sharesec.c
source3/utils/smbfilter.c
source3/utils/smbget.c
source3/winbindd/idmap_ldap.c
source3/winbindd/winbindd.c
source3/winbindd/winbindd_cache.c
source3/winbindd/winbindd_dual.c
source4/Makefile
source4/VERSION
source4/build/m4/public.m4
source4/client/mount.cifs.c
source4/configure.ac
source4/dsdb/samdb/ldb_modules/config.mk
source4/dsdb/samdb/ldb_modules/linked_attributes.c
source4/dsdb/samdb/ldb_modules/objectclass.c
source4/dsdb/samdb/ldb_modules/ranged_results.c
source4/dsdb/samdb/ldb_modules/samba3sam.c
source4/dsdb/samdb/ldb_modules/update_keytab.c
source4/dsdb/schema/schema_set.c
source4/headermap.txt
source4/heimdal/kuser/kinit.c
source4/heimdal/kuser/kuser_locl.h
source4/heimdal/lib/krb5/context.c
source4/heimdal/lib/krb5/krb5_locl.h
source4/heimdal_build/internal.m4
source4/heimdal_build/internal.mk
source4/ldap_server/ldap_server.c
source4/lib/events/tevent_s4.c
source4/lib/ldb/Makefile.in
source4/lib/ldb/common/ldb.c
source4/lib/ldb/common/ldb_modules.c
source4/lib/ldb/include/ldb.h
source4/lib/ldb/include/ldb_includes.h
source4/lib/ldb/include/ldb_private.h
source4/lib/ldb/ldb_ildap/ldb_ildap.c
source4/lib/ldb/ldb_ldap/ldb_ldap.c
source4/lib/ldb/ldb_map/ldb_map.c
source4/lib/ldb/ldb_map/ldb_map.h
source4/lib/ldb/ldb_map/ldb_map_inbound.c
source4/lib/ldb/ldb_map/ldb_map_outbound.c
source4/lib/ldb/ldb_map/ldb_map_private.h
source4/lib/ldb/ldb_tdb/ldb_index.c
source4/lib/ldb/ldb_tdb/ldb_tdb.c
source4/lib/ldb/ldb_tdb/ldb_tdb.h
source4/lib/ldb/modules/operational.c
source4/lib/ldb/modules/paged_results.c
source4/lib/ldb/modules/rdn_name.c
source4/lib/ldb/tools/cmdline.c
source4/lib/ldb/tools/ldbedit.c
source4/lib/ldb/tools/ldbsearch.c
source4/lib/ldb/tools/ldbtest.c
source4/lib/tls/config.m4
source4/lib/tls/config.mk
source4/libcli/cldap/cldap.c
source4/libcli/ldap/config.mk
source4/libcli/ldap/ldap.h
source4/libcli/ldap/ldap_client.c
source4/libcli/ldap/ldap_controls.c
source4/libcli/ldap/ldap_msg.c [deleted file]
source4/libcli/util/nterr.c
source4/main.mk
source4/ntptr/ntptr.h
source4/ntptr/ntptr_interface.c
source4/ntptr/simple_ldb/ntptr_simple_ldb.c
source4/rpc_server/netlogon/dcerpc_netlogon.c
source4/rpc_server/spoolss/dcesrv_spoolss.c
source4/scripting/python/samba/__init__.py
source4/scripting/python/samba/provision.py
source4/scripting/python/samba/samdb.py
source4/scripting/python/samba/tests/__init__.py
source4/scripting/python/samba/tests/provision.py
source4/selftest/tests.sh
source4/setup/DB_CONFIG
source4/setup/mmr_serverids.conf
source4/setup/olc_acl.conf [new file with mode: 0644]
source4/setup/olc_mmr.conf [new file with mode: 0644]
source4/setup/olc_pass.conf [new file with mode: 0644]
source4/setup/olc_seed.ldif [new file with mode: 0644]
source4/setup/olc_serverid.conf [new file with mode: 0644]
source4/setup/olc_syncrepl.conf [new file with mode: 0644]
source4/setup/olc_syncrepl_seed.conf [new file with mode: 0644]
source4/setup/provision-backend
source4/setup/slapd.conf
source4/smbd/server.c
source4/torture/raw/notify.c
source4/torture/raw/rename.c
source4/torture/raw/samba3misc.c
source4/torture/raw/streams.c
source4/torture/rpc/eventlog.c
source4/torture/rpc/spoolss.c
source4/utils/net/net.c
source4/utils/net/net_join.c

index 03cd72c518636c4a41f9a76e3a85dc9f164ac6de..7c637ccd6601f7dd070d197c835f13223628c97b 100644 (file)
@@ -1,4 +1,4 @@
-What's new in Samba 4 alpha6
+What's new in Samba 4 alpha7
 ============================
 
 Samba 4 is the ambitious next version of the Samba suite that is being
@@ -6,13 +6,13 @@ developed in parallel to the stable 3.0 series. The main emphasis in
 this branch is support for the Active Directory logon protocols used
 by Windows 2000 and above.
 
-Samba4 alpha6 follows on from the alpha release series we have been
+Samba4 alpha7 follows on from the alpha release series we have been
 publishing since September 2007
 
 WARNINGS
 ========
 
-Samba4 alpha6 is not a final Samba release.  That is more a reference
+Samba4 alpha7 is not a final Samba release.  That is more a reference
 to Samba4's lack of the features we expect you will need than a
 statement of code quality, but clearly it hasn't seen a broad
 deployment yet.  If you were to upgrade Samba3 (or indeed Windows) to
@@ -62,85 +62,35 @@ working on modules to map between AD-like behaviours and this backend.
 We are aiming for Samba 4 to be powerful frontend to large
 directories.
 
-CHANGES SINCE Alpha5
+CHANGES SINCE alpha6
 =====================
 
-In the time since Samba4 Alpha5 was released in June 2008, Samba has
+In the time since Samba4 alpha6 was released in Janurary 2009, Samba has
 continued to evolve, but you may particularly notice these areas 
 (in no particular order):
 
- The source code for various libraries that are used by both Samba 3 and 
- Samba 4 are now shared between the two rather than duplicated 
- (and being slightly diverged).
+ Multi Master Replication (MMR) configuration can now be generated 
+ for the OpenLDAP-Backend.
 
- The tevent library has been split out and is now usable on its own.
+ OpenLDAP-Online-Configuration (olc) can now be generated for the 
+ OpenLDAP-Backend. (OpenLDAP-Versions >=2.4.15 required).
 
- Several crash bugs and memory leaks in the registry library have been fixed.
+ Support for Windows 7 beta as a member of the Samba4 domain
 
- The Python modules have been extended and are no longer generated using SWIG.
+ Issues with the nesting of LDB transactions have been fixed
 
- Stream renames are now supported.
+ A number of internal libraries (tevent, auth in particular has been
+ updated for easier use outside Samba4
 
- The provision script now has an interactive mode.
+ spoolss IDL updates to bring Samba3 to use PIDL code, and to merge
+ the corrected IDL back into Samba4
+ Fixes to allow use of C++ compilers and to increase portability
 
- The (broken) copy of CTDB has been removed.
-
- More work towards supporting an OpenLDAP backend. 
-
- Initial work on using the Microsoft LDAP schema.
-
- The storage of schemas in LDB is now much more efficient.
-
- Support for extended DNs in LDB has been added.
-
- Incoming trusts are now supported.
-
- Compatibility of the registry server with several Windows versions has been 
- improved.
-
- Improvements to LSA.idl for better functionality in the usrmgr.exe.
-
- Improved handling of non-standard characters in passwords.
-
- The embedded JavaScript library has been removed in favor of Python.
-
- The WMI implementation has been re-added, but does not completely work yet.
-
- xpress compression is now supported in the NDR layer.
-
- The main binary is now named "samba" rather than "smbd".
-
- A simple script for setting the expiration of a user was added.
-
- The LDB library is now completely asynchronous internally.
-
- Various unknowns and correctness issues in the drsblobs and drsuapi RPC 
- interface implementations have been fixed.
-
- It is now possible to connect to an LDAP backend using SASL credentials.
-
- Multi-fragment NTtrans request support has been added.
-
- The DCE/RPC server can now listen on a separate pipe to allow DCE/RPC 
- connections forwarded from Samba 3. The user credentials are provided 
- by the client.
-
- A large number of bugs in the SMB2 implementation have been fixed.
-
- Auxiliary classes in LDAP schema conversion are now collapsed.
-
- Several tests have been added to the SMB testsuite.
-
- Object GUIDs in DCE/RPC connections are now dealt with properly.
-
- The correctness of the LSA and NETLOGON implementations has been 
- improved.
-
- Multi Master Replication configuration can now be generated 
- for OpenLDAP.
-
-These are just some of the highlights of the work done in the past few
-months.  More details can be found in our GIT history.
+ Fixed TLS (SSL) support with modern versions of GnuTLS
+These are just some of the highlights of the work done in the past 
+month.  More details can be found in our GIT history.
 
 
 CHANGES
@@ -163,17 +113,13 @@ KNOWN ISSUES
 
 - Clock Synchronisation is critical.  Many 'wrong password' errors are
   actually due to Kerberos objecting to a clock skew between client
-  and server.  (The NTP work in the previous alpha is partly to assist
+  and server.  (The NTP work in the previous alphas are partly to assist
   with this problem).
 
-- Samba4 alpha6 is currently only portable to recent Linux
+- Samba4 alpha7 is currently only portable to recent Linux
   distributions.  Work to return support for other Unix varients is
-  expected during the next alpha cycle
+  expected during the next alpha cycles
 
-- Samba4 alpha6 is incompatible with GnuTLS 2.0, found in Fedora 9 and
-  recent Ubuntu releases.  GnuTLS use may be disabled using the
-  --disable-gnutls argument to ./configure. (otherwise 'make test' and
-  LDAPS operations will hang).
 
 RUNNING Samba4
 ==============
index 789042f78e186a47ae6c18216348afc4bf64a22f..37ecc99eebb95102a7113d6445b06eb4c779e37f 100644 (file)
@@ -86,7 +86,7 @@ Tom Haapanen (tomh@metrics.com)
     consulting firm located in Waterloo, Ontario, Canada.  We work
     with a variety of environments (such as Windows, Windows NT and
     Unix), tools and application areas, and can provide assistance for
-    development work ranging from a few days to to multiple man-year
+    development work ranging from a few days to multiple man-year
     projects.  You can find more information at http://www.metrics.com/.
     
 
diff --git a/docs-xml/manpages-3/ldbrename.1.xml b/docs-xml/manpages-3/ldbrename.1.xml
new file mode 100644 (file)
index 0000000..391ec84
--- /dev/null
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+<refentry id="ldbrename.1">
+
+<refmeta>
+       <refentrytitle>ldbrename</refentrytitle>
+       <manvolnum>1</manvolnum>
+</refmeta>
+
+
+<refnamediv>
+       <refname>ldbrename</refname>
+       <refpurpose>Edit LDB databases using your favorite editor</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+       <cmdsynopsis>
+               <command>ldbrename</command>
+               <arg choice="opt">-h</arg>
+               <arg choice="opt">-o options</arg>
+               <arg choice="req">olddn</arg>
+               <arg choice="req">newdb</arg>
+       </cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+       <title>DESCRIPTION</title>
+
+       <para>ldbrename is a utility that allows you to rename trees in 
+               an LDB database based by DN. This utility takes 
+               two arguments: the original 
+               DN name of the top element and the DN to change it to.
+       </para>
+
+</refsect1>
+
+
+<refsect1>
+       <title>OPTIONS</title>
+
+       <variablelist>
+               <varlistentry>
+               <term>-h</term>
+               <listitem><para>
+               Show list of available options.</para></listitem>
+               </varlistentry>
+
+               <varlistentry>
+                       <term>-H &lt;ldb-url&gt;</term>
+                       <listitem><para>
+                               LDB URL to connect to. See ldb(7) for details.
+                       </para></listitem>
+               </varlistentry>
+
+               <varlistentry>
+                       <term>-o options</term>
+                       <listitem><para>Extra ldb options, such as 
+                       modules.</para></listitem>
+               </varlistentry>
+               
+       </variablelist>
+       
+</refsect1>
+
+<refsect1>
+       <title>ENVIRONMENT</title>
+
+       <variablelist>
+               <varlistentry><term>LDB_URL</term>
+                       <listitem><para>LDB URL to connect to (can be overrided by using the 
+                                       -H command-line option.)</para></listitem>
+               </varlistentry>
+       </variablelist>
+       
+</refsect1>
+
+<refsect1>
+       <title>VERSION</title>
+
+       <para>This man page is correct for version 4.0 of the Samba suite.</para>
+</refsect1>
+
+<refsect1>
+       <title>SEE ALSO</title>
+
+       <para>ldb(7), ldbmodify, ldbdel, ldif(5)</para>
+
+</refsect1>
+
+<refsect1>
+       <title>AUTHOR</title>
+
+       <para> ldb was written by 
+                <ulink url="http://samba.org/~tridge/">Andrew Tridgell</ulink>.
+       </para>
+
+       <para>
+If you wish to report a problem or make a suggestion then please see
+the <ulink url="http://ldb.samba.org/"/> web site for
+current contact and maintainer information.
+       </para>
+
+       <para>This manpage was written by Jelmer Vernooij.</para>
+       
+</refsect1>
+
+</refentry>
index c386592f1df4622b844e0ff63888ad064cc9bcfa..ca8ae5f4bf7d4ebe9083254861b53d0dca24079d 100644 (file)
@@ -140,7 +140,7 @@ credentials file properly.
                 same domain (e.g. running winbind or nss_ldap) and
                 the server supports the Unix Extensions then the uid
                 and gid can be retrieved from the server (and uid
-                and gid would not have to be specifed on the mount. 
+                and gid would not have to be specified on the mount.
                 For servers which do not support the CIFS Unix
                 extensions, the default uid (and gid) returned on lookup 
                 of existing files will be the uid (gid) of the person
diff --git a/docs-xml/manpages-3/vfs_acl_tdb.8.xml b/docs-xml/manpages-3/vfs_acl_tdb.8.xml
new file mode 100644 (file)
index 0000000..086b86f
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+<refentry id="vfs_acl_tdb.8">
+
+<refmeta>
+       <refentrytitle>vfs_acl_tdb</refentrytitle>
+       <manvolnum>8</manvolnum>
+       <refmiscinfo class="source">Samba</refmiscinfo>
+       <refmiscinfo class="manual">System Administration tools</refmiscinfo>
+       <refmiscinfo class="version">3.3</refmiscinfo>
+</refmeta>
+
+
+<refnamediv>
+       <refname>vfs_acl_tdb</refname>
+       <refpurpose>Save NTFS-ACLs in a tdb file</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+       <cmdsynopsis>
+               <command>vfs objects = acl_tdb</command>
+       </cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+       <title>DESCRIPTION</title>
+
+       <para>This VFS module is part of the
+       <citerefentry><refentrytitle>samba</refentrytitle>
+       <manvolnum>7</manvolnum></citerefentry> suite.</para>
+
+       <para>The <command>vfs_acl_tdb</command> VFS module stores
+       NTFS Access Control Lists (ACLs) in a tdb file.
+       This enables the full mapping of Windows ACLs on Samba
+       servers.
+       </para>
+
+       <para>
+       The ACL settings are stored in
+       <filename>$LOCKDIR/file_ntacls.tdb</filename>.
+       </para>
+
+       <para>Please note that this module is
+       <emphasis>experimental</emphasis>!
+       </para>
+
+       <para>This module is stackable.</para>
+</refsect1>
+
+<refsect1>
+       <title>OPTIONS</title>
+       <para>
+       There are no options for <command>vfs_acl_tdb</command>.
+       </para>
+</refsect1>
+
+<refsect1>
+       <title>AUTHOR</title>
+
+       <para>The original Samba software and related utilities
+       were created by Andrew Tridgell. Samba is now developed
+       by the Samba Team as an Open Source project similar
+       to the way the Linux kernel is developed.</para>
+</refsect1>
+
+</refentry>
diff --git a/docs-xml/manpages-3/vfs_acl_xattr.8.xml b/docs-xml/manpages-3/vfs_acl_xattr.8.xml
new file mode 100644 (file)
index 0000000..7387824
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+<refentry id="vfs_acl_xattr.8">
+
+<refmeta>
+       <refentrytitle>vfs_acl_xattr</refentrytitle>
+       <manvolnum>8</manvolnum>
+       <refmiscinfo class="source">Samba</refmiscinfo>
+       <refmiscinfo class="manual">System Administration tools</refmiscinfo>
+       <refmiscinfo class="version">3.3</refmiscinfo>
+</refmeta>
+
+
+<refnamediv>
+       <refname>vfs_acl_xattr</refname>
+       <refpurpose>Save NTFS-ACLs in Extended Attributes (EAs)</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+       <cmdsynopsis>
+               <command>vfs objects = acl_xattr</command>
+       </cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+       <title>DESCRIPTION</title>
+
+       <para>This VFS module is part of the
+       <citerefentry><refentrytitle>samba</refentrytitle>
+       <manvolnum>7</manvolnum></citerefentry> suite.</para>
+
+       <para>The <command>vfs_acl_xattr</command> VFS module stores
+       NTFS Access Control Lists (ACLs) in Extended Attributes (EAs).
+       This enables the full mapping of Windows ACLs on Samba
+       servers.
+       </para>
+
+       <para>The ACLs are stored in the Extended Attribute
+       <parameter>security.NTACL</parameter> of a file or directory.
+       This Attribute is <emphasis>not</emphasis> listed by
+       <command>getfattr -d <filename>filename</filename></command>.
+       To show the current value, the name of the EA must be specified
+       (e.g. <command>getfattr -n security.NTACL <filename>filename</filename>
+       </command>).
+       </para>
+
+       <para>Please note that this module is
+       <emphasis>experimental</emphasis>!
+       </para>
+
+       <para>This module is stackable.</para>
+</refsect1>
+
+<refsect1>
+       <title>OPTIONS</title>
+       <para>
+       There are no options for <command>vfs_acl_xattr</command>.
+       </para>
+</refsect1>
+
+<refsect1>
+       <title>AUTHOR</title>
+
+       <para>The original Samba software and related utilities
+       were created by Andrew Tridgell. Samba is now developed
+       by the Samba Team as an Open Source project similar
+       to the way the Linux kernel is developed.</para>
+</refsect1>
+
+</refentry>
index 13f2cd644643f8db31d4fbaff9f0a371263fb1f7..7f85616c22287502ef25cb2ce06739a9eb946f2c 100644 (file)
@@ -17,7 +17,7 @@
 
        <para>You may wish to disable this option if you have a problem with empty
        workgroups not disappearing from browse lists. Due to the restrictions
-       of the browse protocols these enhancements can cause a empty workgroup
+       of the browse protocols, these enhancements can cause a empty workgroup
        to stay around forever which can be annoying.</para>
 
        <para>In general you should leave this option enabled as it makes
index e3a0ed7b4c5035b44052decd338cfc8f2a58fec4..15ad0ad07394e4c99baab0f40451209768ab4316 100644 (file)
@@ -12,7 +12,7 @@
        <para>
        When strict locking is set to Auto (the default), the server performs file lock checks only on non-oplocked files.
        As most Windows redirectors perform file locking checks locally on oplocked files this is a good trade off for
-       inproved performance.
+       improved performance.
        </para>
 
        <para>
index f23968b5015a5cdd205ea1a50fe40de93f25903c..a6bf0c546f5cabd89d347dafd888c10f1c1a2f47 100644 (file)
@@ -6,7 +6,7 @@
 <description>
        <para>
        This option allows you to setup <citerefentry><refentrytitle>nmbd</refentrytitle>
-       <manvolnum>8</manvolnum></citerefentry>to periodically announce itself 
+       <manvolnum>8</manvolnum></citerefentry> to periodically announce itself 
        to arbitrary IP addresses with an arbitrary workgroup name.
        </para>
 
@@ -23,7 +23,7 @@
 </programlisting>
        the above line would cause <command moreinfo="none">nmbd</command> to announce itself 
        to the two given IP addresses using the given workgroup names. If you leave out the 
-       workgroup name then the one given in the <smbconfoption name="workgroup"/> parameter 
+       workgroup name, then the one given in the <smbconfoption name="workgroup"/> parameter 
        is used instead.
        </para>
 
index 738f3a11bad1fa971412229682e92e255a746c5a..a3ae5183b090b8f74350ac323d1f439dad02489a 100644 (file)
@@ -8,7 +8,7 @@
        to be accessed by non-authenticated users or not. It is the equivalent
        of allowing people who can create a share the option of setting
        <parameter moreinfo="none">guest ok = yes</parameter> in a share
-       definition. Due to the security sensitive nature of this the default
+       definition. Due to its security sensitive nature, the default
        is set to off.</para>
 
 </description>
index bacc2e9530eafbbbdb2b792de7e05aac456c3679..6c1822a16583aa86a1c648df79c8ea748d7ab10c 100644 (file)
@@ -6,8 +6,8 @@
 <description>
        <para>This parameter specifies a list of absolute pathnames
        the root of which are allowed to be exported by user defined share definitions.
-       If the pathname exported doesn't start with one of the strings in this
-       list the user defined share will not be allowed. This allows the Samba
+       If the pathname to be exported doesn't start with one of the strings in this
+       list, the user defined share will not be allowed. This allows the Samba
        administrator to restrict the directories on the system that can be
        exported by user defined shares.
        </para>
index efe2e81d22c6268bec7cc0949db9c5085a74cdc0..9593a6c7e4a2faeb848d6e3254aae014a85db665 100644 (file)
@@ -5,7 +5,7 @@
                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
        <para>User defined shares only have limited possible parameters
-       such as path, guest ok etc. This parameter allows usershares to
+       such as path, guest ok, etc. This parameter allows usershares to
        "cloned" from an existing share. If "usershare template share"
        is set to the name of an existing share, then all usershares
        created have their defaults set from the parameters set on this
index 99e85568110cc0020f72f944763f15ae01f40ec2..4d9b7abfccc406c77d6078150a941132e5a95acc 100644 (file)
@@ -29,7 +29,7 @@
     <para>If this parameter is enabled for a printer, then any attempt
     to open the printer with the PRINTER_ACCESS_ADMINISTER right is mapped
     to PRINTER_ACCESS_USE instead.  Thus allowing the OpenPrinterEx()
-    call to succeed.  <emphasis>This parameter MUST not be able enabled
+    call to succeed.  <emphasis>This parameter MUST not be enabled
     on a print share which has valid print driver installed on the Samba 
        server.</emphasis></para>
 </description>
index 69162617596cb4b5737fd21d8f046691f50cc062..79b6da7afa5edaaaf5ec0520a4d039867cec550c 100644 (file)
@@ -21,7 +21,7 @@
     and allows the open. If the user doesn't have permission to delete the file this will only be
     discovered at close time, which is too late for the Windows user tools to display an error message
     to the user. The symptom of this is files that appear to have been deleted "magically" re-appearing
-    on a Windows explorer refersh. This is an extremely advanced protocol option which should not
+    on a Windows explorer refresh. This is an extremely advanced protocol option which should not
     need to be changed. This parameter was introduced in its final form in 3.0.21, an earlier version
     with slightly different semantics was introduced in 3.0.20. That older version is not documented here.
     </para>
index cd4f30fb8d62bda31079ec8ee9479e1cb28dd2e5..bb56b5ad0bd1ead56710e00a51f6b8696fd30cb6 100644 (file)
@@ -5,7 +5,7 @@
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
     <para>Hosts running the "Advanced Server for Unix (ASU)" product 
-    require some special accomodations such as creating a builting [ADMIN$] 
+    require some special accomodations such as creating a builtin [ADMIN$] 
     share that only supports IPC connections.  The has been the default
     behavior in smbd for many years.  However, certain Microsoft applications
     such as the Print Migrator tool require that the remote server support
index 5266fef6a24ee50529baf298c061e9d839592cc5..967eacf85bb199bff4011b88a71589f44c1b307d 100644 (file)
@@ -11,7 +11,7 @@
     password hashes (e.g. Windows NT/2000, Samba, etc... but not 
     Windows 95/98) will be able to be connected from the Samba client.</para>
 
-    <para>The LANMAN encrypted response is easily broken, due to it's
+    <para>The LANMAN encrypted response is easily broken, due to its
     case-insensitive nature, and the choice of algorithm.  Clients
     without Windows 95/98 servers are advised to disable
     this option.  </para>
index bf37cbb8746476d53434ce0f7270e47829b716df..c657e057118f66d5139d35ca489e6eadb3653e8c 100644 (file)
@@ -4,8 +4,7 @@
                  basic="1"
                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
-    <para>This controls whether the client offers or requires
-    the server it talks to to use SMB signing. Possible values 
+    <para>This controls whether the client is allowed or required to use SMB signing. Possible values 
     are <emphasis>auto</emphasis>, <emphasis>mandatory</emphasis> 
     and <emphasis>disabled</emphasis>. 
     </para>
index 341952205f6940809a41f84cd703c7e7bcb40155..4e68c5e03aa16b5c5529343c475f7f75e2cf7911 100644 (file)
@@ -12,7 +12,7 @@
     Windows 95/98 or the MS DOS network client) will be able to
     connect to the Samba host.</para>
 
-    <para>The LANMAN encrypted response is easily broken, due to it's
+    <para>The LANMAN encrypted response is easily broken, due to its
     case-insensitive nature, and the choice of algorithm.  Servers
     without Windows 95/98/ME or MS DOS clients are advised to disable
     this option.  </para>
index 0da247d27d5d0d4514569197bd9a0ba78a0811bf..0e92af9ebaeaff76dda2deb34c4e4066357dcc86 100644 (file)
@@ -7,7 +7,7 @@
     <para>By specifying the name of another SMB server 
     or Active Directory domain controller with this option, 
     and using <command moreinfo="none">security = [ads|domain|server]</command> 
-    it is possible to get Samba to 
+    it is possible to get Samba
     to do all its username/password validation using a specific remote server.</para>
 
     <para>This option sets the name or IP address of the password server to use. 
index 3ad5175712e7e1bf126e684568a9b14dce7ef4cd..514ea54e0ff65231255a54ad0c8abc1a26941fed 100644 (file)
@@ -47,7 +47,7 @@
     want to mainly setup shares without a password (guest shares). This 
     is commonly used for a shared printer server. It is more difficult 
     to setup guest shares with <command moreinfo="none">security = user</command>, see 
-    the <smbconfoption name="map to guest"/>parameter for details.</para>
+    the <smbconfoption name="map to guest"/> parameter for details.</para>
                
     <para>It is possible to use <command moreinfo="none">smbd</command> in a <emphasis>
     hybrid mode</emphasis> where it is offers both user and share 
@@ -58,7 +58,7 @@
 
     <para><anchor id="SECURITYEQUALSSHARE"/><emphasis>SECURITY = SHARE</emphasis></para> 
                
-    <para>When clients connect to a share level security server they 
+    <para>When clients connect to a share level security server, they 
     need not log onto the server with a valid username and password before 
     attempting to connect to a shared resource (although modern clients 
     such as Windows 95/98 and Windows NT will send a logon request with 
        </para></note>
 
        <note><para>From the client's point of 
-    view <command moreinfo="none">security = server</command> is the
+    view, <command moreinfo="none">security = server</command> is the
     same as <command moreinfo="none">security = user</command>.  It
     only affects how the server deals  with the authentication, it does
        not in any way affect what the  client sees.</para></note>
index 6317448fb62ecb89f353dfa836004c6ee95d81da..655463576f3540a45886d87c8e21f6457ce66fb6 100644 (file)
@@ -13,7 +13,7 @@
        </para>
 
     <para>
-       Please note that with this set to <literal>no</literal> you will have to apply the WindowsXP
+       Please note that with this set to <literal>no</literal>, you will have to apply the WindowsXP
        <filename>WinXP_SignOrSeal.reg</filename> registry patch found in the docs/registry subdirectory of the Samba distribution tarball.
        </para>
 </description>
index f2f5629586150f8e95d5748974c267b226c9d599..ea21a2c6f64d487b0ae9261d42a64c8f62f44ccd 100644 (file)
@@ -5,8 +5,7 @@
                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
 
-    <para>This controls whether the server offers or requires
-    the client it talks to to use SMB signing. Possible values 
+    <para>This controls whether the client is allowed or required to use SMB signing. Possible values 
     are <emphasis>auto</emphasis>, <emphasis>mandatory</emphasis> 
     and <emphasis>disabled</emphasis>. 
     </para>
index eb91ce51fa3ce389445ca5064c5bea2be8465750..d556166953697a54d384a9c50430d81a61367ed0 100644 (file)
@@ -16,8 +16,7 @@
     and MacOS/X clients. Windows clients do not support this feature.
     </para>
 
-    <para>This controls whether the server offers or requires
-    the client it talks to to use SMB encryption. Possible values 
+    <para>This controls whether the remote client is allowed or required to use SMB encryption. Possible values 
     are <emphasis>auto</emphasis>, <emphasis>mandatory</emphasis> 
     and <emphasis>disabled</emphasis>. This may be set on a per-share
     basis, but clients may chose to encrypt the entire session, not
index da493665cf2333448652ba0de77ef86ee7287084..eb54ed9bab6592e8a35b7d1bc9d62fc9ff7eda37 100644 (file)
@@ -9,7 +9,7 @@
        This boolean parameter allows a user logging on with a plaintext password to have their encrypted (hashed)
        password in the smbpasswd file to be updated automatically as they log on. This option allows a site to
        migrate from plaintext password authentication (users authenticate with plaintext password over the
-       wire, and are checked against a UNIX account atabase) to encrypted password authentication (the SMB
+       wire, and are checked against a UNIX account database) to encrypted password authentication (the SMB
        challenge/response authentication mechanism) without forcing all users to re-enter their passwords via
        smbpasswd at the time the change is made. This is a convenience option to allow the change over to encrypted
        passwords to be made over a longer period.  Once all users have encrypted representations of their passwords
@@ -24,7 +24,7 @@
        </para>
 
     <para>
-       Note that even when this parameter is set a user authenticating to <command moreinfo="none">smbd</command>
+       Note that even when this parameter is set, a user authenticating to <command moreinfo="none">smbd</command>
        must still enter a valid password in order to connect correctly, and to update their hashed (smbpasswd)
        passwords.
        </para>
index 2eb7a9477634729ad266037ffd77496d43928e24..118a5b9da7b888b274d365a8a84f291f36b03e5b 100644 (file)
@@ -85,9 +85,11 @@ static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle,  const char *fnam
        return vfswrap_opendir(NULL,  fname, mask, attr);
 }
 
-static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dirp)
+static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle,
+                                      SMB_STRUCT_DIR *dirp,
+                                      SMB_STRUCT_STAT *sbuf)
 {
-       return vfswrap_readdir(NULL,  dirp);
+       return vfswrap_readdir(NULL,  dirp, sbuf);
 }
 
 static void skel_seekdir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dirp, long offset)
@@ -292,7 +294,7 @@ static int skel_chflags(vfs_handle_struct *handle,  const char *path, uint flags
 }
 
 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
-                                         SMB_DEV_T dev, SMB_INO_T inode)
+                                         const SMB_STRUCT_STAT *sbuf)
 {
        struct file_id id_zero;
        ZERO_STRUCT(id_zero);
index 5670965417277617b7c4cf0a8ee416750365b2e5..a95b5ae6cd21192e275f18dbaab802b4c24fcb9a 100644 (file)
@@ -79,9 +79,11 @@ static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle,  const char *fnam
        return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
 }
 
-static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dirp)
+static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle,
+                                      SMB_STRUCT_DIR *dirp,
+                                      SMB_STRUCT_STAT *sbuf)
 {
-       return SMB_VFS_NEXT_READDIR(handle, dirp);
+       return SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
 }
 
 static void skel_seekdir(vfs_handle_struct *handle,  SMB_STRUCT_DIR *dirp, long offset)
@@ -284,9 +286,9 @@ static int skel_chflags(vfs_handle_struct *handle,  const char *path, uint flags
 }
 
 static struct file_id skel_file_id_create(vfs_handle_struct *handle,
-                                         SMB_DEV_T dev, SMB_INO_T inode)
+                                         const SMB_STRUCT_STAT *sbuf)
 {
-       return SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode);
+       return SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
 }
 
 static NTSTATUS skel_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
index 02ae88068380406366af07c4f6f665f668e31a73..1f48697f26f825a729c618165b36f0846de4fd9e 100644 (file)
 #include "lib/tevent/tevent.h"
 #include "lib/async_req/async_req.h"
 #include "lib/async_req/async_sock.h"
+#include "lib/util/tevent_unix.h"
 #include <fcntl.h>
 
 #ifndef TALLOC_FREE
 #define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0)
 #endif
 
-/**
- * Discriminator for async_syscall_state
- */
-enum async_syscall_type {
-       ASYNC_SYSCALL_SEND,
-       ASYNC_SYSCALL_SENDALL,
-       ASYNC_SYSCALL_RECV,
-       ASYNC_SYSCALL_RECVALL,
-       ASYNC_SYSCALL_CONNECT
-};
-
-/**
- * Holder for syscall arguments and the result
- */
-
-struct async_syscall_state {
-       enum async_syscall_type syscall_type;
-       struct tevent_fd *fde;
-
-       union {
-               struct param_send {
-                       int fd;
-                       const void *buffer;
-                       size_t length;
-                       int flags;
-               } param_send;
-               struct param_sendall {
-                       int fd;
-                       const void *buffer;
-                       size_t length;
-                       int flags;
-                       size_t sent;
-               } param_sendall;
-               struct param_recv {
-                       int fd;
-                       void *buffer;
-                       size_t length;
-                       int flags;
-               } param_recv;
-               struct param_recvall {
-                       int fd;
-                       void *buffer;
-                       size_t length;
-                       int flags;
-                       size_t received;
-               } param_recvall;
-               struct param_connect {
-                       /**
-                        * connect needs to be done on a nonblocking
-                        * socket. Keep the old flags around
-                        */
-                       long old_sockflags;
-                       int fd;
-                       const struct sockaddr *address;
-                       socklen_t address_len;
-               } param_connect;
-       } param;
-
-       union {
-               ssize_t result_ssize_t;
-               size_t result_size_t;
-               int result_int;
-       } result;
-       int sys_errno;
-};
-
 /**
  * @brief Map async_req states to unix-style errnos
  * @param[in]  req     The async req to get the state from
@@ -143,470 +78,138 @@ int async_req_simple_recv_errno(struct async_req *req)
        return 0;
 }
 
-/**
- * @brief Create a new async syscall req
- * @param[in] mem_ctx  The memory context to hang the result off
- * @param[in] ev       The event context to work from
- * @param[in] type     Which syscall will this be
- * @param[in] pstate   Where to put the newly created private_data state
- * @retval The new request
- *
- * This is a helper function to prepare a new struct async_req with an
- * associated struct async_syscall_state. The async_syscall_state will be put
- * into the async_req as private_data.
- */
-
-static struct async_req *async_syscall_new(TALLOC_CTX *mem_ctx,
-                                          struct tevent_context *ev,
-                                          enum async_syscall_type type,
-                                          struct async_syscall_state **pstate)
-{
-       struct async_req *result;
-       struct async_syscall_state *state;
-
-       if (!async_req_setup(mem_ctx, &result, &state,
-                            struct async_syscall_state)) {
-               return NULL;
-       }
-       state->syscall_type = type;
-
-       result->private_data = state;
-
-       *pstate = state;
+struct async_send_state {
+       int fd;
+       const void *buf;
+       size_t len;
+       int flags;
+       ssize_t sent;
+};
 
-       return result;
-}
+static void async_send_handler(struct tevent_context *ev,
+                              struct tevent_fd *fde,
+                              uint16_t flags, void *private_data);
 
-/**
- * @brief Create a new async syscall req based on a fd
- * @param[in] mem_ctx  The memory context to hang the result off
- * @param[in] ev       The event context to work from
- * @param[in] type     Which syscall will this be
- * @param[in] fd       The file descriptor we work on
- * @param[in] fde_flags TEVENT_FD_READ/WRITE -- what are we interested in?
- * @param[in] fde_cb   The callback function for the file descriptor event
- * @param[in] pstate   Where to put the newly created private_data state
- * @retval The new request
- *
- * This is a helper function to prepare a new struct async_req with an
- * associated struct async_syscall_state and an associated file descriptor
- * event.
- */
-
-static struct async_req *async_fde_syscall_new(
-       TALLOC_CTX *mem_ctx,
-       struct tevent_context *ev,
-       enum async_syscall_type type,
-       int fd,
-       uint16_t fde_flags,
-       void (*fde_cb)(struct tevent_context *ev,
-                      struct tevent_fd *fde, uint16_t flags,
-                      void *priv),
-       struct async_syscall_state **pstate)
+struct tevent_req *async_send_send(TALLOC_CTX *mem_ctx,
+                                  struct tevent_context *ev,
+                                  int fd, const void *buf, size_t len,
+                                  int flags)
 {
-       struct async_req *result;
-       struct async_syscall_state *state;
+       struct tevent_req *result;
+       struct async_send_state *state;
+       struct tevent_fd *fde;
 
-       result = async_syscall_new(mem_ctx, ev, type, &state);
+       result = tevent_req_create(mem_ctx, &state, struct async_send_state);
        if (result == NULL) {
-               return NULL;
+               return result;
        }
+       state->fd = fd;
+       state->buf = buf;
+       state->len = len;
+       state->flags = flags;
 
-       state->fde = tevent_add_fd(ev, state, fd, fde_flags, fde_cb, result);
-       if (state->fde == NULL) {
+       fde = tevent_add_fd(ev, state, fd, TEVENT_FD_WRITE, async_send_handler,
+                           result);
+       if (fde == NULL) {
                TALLOC_FREE(result);
                return NULL;
        }
-       *pstate = state;
        return result;
 }
 
-/**
- * Retrieve a ssize_t typed result from an async syscall
- * @param[in] req      The syscall that has just finished
- * @param[out] perrno  Where to put the syscall's errno
- * @retval The return value from the asynchronously called syscall
- */
-
-ssize_t async_syscall_result_ssize_t(struct async_req *req, int *perrno)
-{
-       struct async_syscall_state *state = talloc_get_type_abort(
-               req->private_data, struct async_syscall_state);
-
-       *perrno = state->sys_errno;
-       return state->result.result_ssize_t;
-}
-
-/**
- * Retrieve a size_t typed result from an async syscall
- * @param[in] req      The syscall that has just finished
- * @param[out] perrno  Where to put the syscall's errno
- * @retval The return value from the asynchronously called syscall
- */
-
-size_t async_syscall_result_size_t(struct async_req *req, int *perrno)
-{
-       struct async_syscall_state *state = talloc_get_type_abort(
-               req->private_data, struct async_syscall_state);
-
-       *perrno = state->sys_errno;
-       return state->result.result_size_t;
-}
-
-/**
- * Retrieve a int typed result from an async syscall
- * @param[in] req      The syscall that has just finished
- * @param[out] perrno  Where to put the syscall's errno
- * @retval The return value from the asynchronously called syscall
- */
-
-int async_syscall_result_int(struct async_req *req, int *perrno)
-{
-       struct async_syscall_state *state = talloc_get_type_abort(
-               req->private_data, struct async_syscall_state);
-
-       *perrno = state->sys_errno;
-       return state->result.result_int;
-}
-
-/**
- * fde event handler for the "send" syscall
- * @param[in] ev       The event context that sent us here
- * @param[in] fde      The file descriptor event associated with the send
- * @param[in] flags    Can only be TEVENT_FD_WRITE here
- * @param[in] priv     private data, "struct async_req *" in this case
- */
-
-static void async_send_callback(struct tevent_context *ev,
-                               struct tevent_fd *fde, uint16_t flags,
-                               void *priv)
+static void async_send_handler(struct tevent_context *ev,
+                              struct tevent_fd *fde,
+                              uint16_t flags, void *private_data)
 {
-       struct async_req *req = talloc_get_type_abort(
-               priv, struct async_req);
-       struct async_syscall_state *state = talloc_get_type_abort(
-               req->private_data, struct async_syscall_state);
-       struct param_send *p = &state->param.param_send;
-
-       if (state->syscall_type != ASYNC_SYSCALL_SEND) {
-               async_req_error(req, EIO);
+       struct tevent_req *req = talloc_get_type_abort(
+               private_data, struct tevent_req);
+       struct async_send_state *state = talloc_get_type_abort(
+               req->private_state, struct async_send_state);
+
+       state->sent = send(state->fd, state->buf, state->len, state->flags);
+       if (state->sent == -1) {
+               tevent_req_error(req, errno);
                return;
        }
-
-       state->result.result_ssize_t = send(p->fd, p->buffer, p->length,
-                                           p->flags);
-       state->sys_errno = errno;
-
-       TALLOC_FREE(state->fde);
-
-       async_req_done(req);
+       tevent_req_done(req);
 }
 
-/**
- * Async version of send(2)
- * @param[in] mem_ctx  The memory context to hang the result off
- * @param[in] ev       The event context to work from
- * @param[in] fd       The socket to send to
- * @param[in] buffer   The buffer to send
- * @param[in] length   How many bytes to send
- * @param[in] flags    flags passed to send(2)
- *
- * This function is a direct counterpart of send(2)
- */
-
-struct async_req *async_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                            int fd, const void *buffer, size_t length,
-                            int flags)
+ssize_t async_send_recv(struct tevent_req *req, int *perrno)
 {
-       struct async_req *result;
-       struct async_syscall_state *state;
+       struct async_send_state *state = talloc_get_type_abort(
+               req->private_state, struct async_send_state);
 
-       result = async_fde_syscall_new(
-               mem_ctx, ev, ASYNC_SYSCALL_SEND,
-               fd, TEVENT_FD_WRITE, async_send_callback,
-               &state);
-       if (result == NULL) {
-               return NULL;
+       if (tevent_req_is_unix_error(req, perrno)) {
+               return -1;
        }
-
-       state->param.param_send.fd = fd;
-       state->param.param_send.buffer = buffer;
-       state->param.param_send.length = length;
-       state->param.param_send.flags = flags;
-
-       return result;
+       return state->sent;
 }
 
-/**
- * fde event handler for the "sendall" syscall group
- * @param[in] ev       The event context that sent us here
- * @param[in] fde      The file descriptor event associated with the send
- * @param[in] flags    Can only be TEVENT_FD_WRITE here
- * @param[in] priv     private data, "struct async_req *" in this case
- */
-
-static void async_sendall_callback(struct tevent_context *ev,
-                                  struct tevent_fd *fde, uint16_t flags,
-                                  void *priv)
-{
-       struct async_req *req = talloc_get_type_abort(
-               priv, struct async_req);
-       struct async_syscall_state *state = talloc_get_type_abort(
-               req->private_data, struct async_syscall_state);
-       struct param_sendall *p = &state->param.param_sendall;
-
-       if (state->syscall_type != ASYNC_SYSCALL_SENDALL) {
-               async_req_error(req, EIO);
-               return;
-       }
-
-       state->result.result_ssize_t = send(p->fd,
-                                           (const char *)p->buffer + p->sent,
-                                           p->length - p->sent, p->flags);
-       state->sys_errno = errno;
-
-       if (state->result.result_ssize_t == -1) {
-               async_req_error(req, state->sys_errno);
-               return;
-       }
-
-       if (state->result.result_ssize_t == 0) {
-               async_req_error(req, EOF);
-               return;
-       }
-
-       p->sent += state->result.result_ssize_t;
-       if (p->sent > p->length) {
-               async_req_error(req, EIO);
-               return;
-       }
+struct async_recv_state {
+       int fd;
+       void *buf;
+       size_t len;
+       int flags;
+       ssize_t received;
+};
 
-       if (p->sent == p->length) {
-               TALLOC_FREE(state->fde);
-               async_req_done(req);
-       }
-}
+static void async_recv_handler(struct tevent_context *ev,
+                              struct tevent_fd *fde,
+                              uint16_t flags, void *private_data);
 
-/**
- * @brief Send all bytes to a socket
- * @param[in] mem_ctx  The memory context to hang the result off
- * @param[in] ev       The event context to work from
- * @param[in] fd       The socket to send to
- * @param[in] buffer   The buffer to send
- * @param[in] length   How many bytes to send
- * @param[in] flags    flags passed to send(2)
- *
- * async_sendall calls send(2) as long as it is necessary to send all of the
- * "length" bytes
- */
-
-struct async_req *sendall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                              int fd, const void *buffer, size_t length,
-                              int flags)
+struct tevent_req *async_recv_send(TALLOC_CTX *mem_ctx,
+                                  struct tevent_context *ev,
+                                  int fd, void *buf, size_t len, int flags)
 {
-       struct async_req *result;
-       struct async_syscall_state *state;
+       struct tevent_req *result;
+       struct async_recv_state *state;
+       struct tevent_fd *fde;
 
-       result = async_fde_syscall_new(
-               mem_ctx, ev, ASYNC_SYSCALL_SENDALL,
-               fd, TEVENT_FD_WRITE, async_sendall_callback,
-               &state);
+       result = tevent_req_create(mem_ctx, &state, struct async_recv_state);
        if (result == NULL) {
-               return NULL;
-       }
-
-       state->param.param_sendall.fd = fd;
-       state->param.param_sendall.buffer = buffer;
-       state->param.param_sendall.length = length;
-       state->param.param_sendall.flags = flags;
-       state->param.param_sendall.sent = 0;
-
-       return result;
-}
-
-ssize_t sendall_recv(struct async_req *req, int *perr)
-{
-       struct async_syscall_state *state = talloc_get_type_abort(
-               req->private_data, struct async_syscall_state);
-       int err;
-
-       err = async_req_simple_recv_errno(req);
-
-       if (err != 0) {
-               *perr = err;
-               return -1;
-       }
-
-       return state->result.result_ssize_t;
-}
-
-/**
- * fde event handler for the "recv" syscall
- * @param[in] ev       The event context that sent us here
- * @param[in] fde      The file descriptor event associated with the recv
- * @param[in] flags    Can only be TEVENT_FD_READ here
- * @param[in] priv     private data, "struct async_req *" in this case
- */
-
-static void async_recv_callback(struct tevent_context *ev,
-                               struct tevent_fd *fde, uint16_t flags,
-                               void *priv)
-{
-       struct async_req *req = talloc_get_type_abort(
-               priv, struct async_req);
-       struct async_syscall_state *state = talloc_get_type_abort(
-               req->private_data, struct async_syscall_state);
-       struct param_recv *p = &state->param.param_recv;
-
-       if (state->syscall_type != ASYNC_SYSCALL_RECV) {
-               async_req_error(req, EIO);
-               return;
+               return result;
        }
+       state->fd = fd;
+       state->buf = buf;
+       state->len = len;
+       state->flags = flags;
 
-       state->result.result_ssize_t = recv(p->fd, p->buffer, p->length,
-                                           p->flags);
-       state->sys_errno = errno;
-
-       TALLOC_FREE(state->fde);
-
-       async_req_done(req);
-}
-
-/**
- * Async version of recv(2)
- * @param[in] mem_ctx  The memory context to hang the result off
- * @param[in] ev       The event context to work from
- * @param[in] fd       The socket to recv from
- * @param[in] buffer   The buffer to recv into
- * @param[in] length   How many bytes to recv
- * @param[in] flags    flags passed to recv(2)
- *
- * This function is a direct counterpart of recv(2)
- */
-
-struct async_req *async_recv(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                            int fd, void *buffer, size_t length,
-                            int flags)
-{
-       struct async_req *result;
-       struct async_syscall_state *state;
-
-       result = async_fde_syscall_new(
-               mem_ctx, ev, ASYNC_SYSCALL_RECV,
-               fd, TEVENT_FD_READ, async_recv_callback,
-               &state);
-
-       if (result == NULL) {
+       fde = tevent_add_fd(ev, state, fd, TEVENT_FD_READ, async_recv_handler,
+                           result);
+       if (fde == NULL) {
+               TALLOC_FREE(result);
                return NULL;
        }
-
-       state->param.param_recv.fd = fd;
-       state->param.param_recv.buffer = buffer;
-       state->param.param_recv.length = length;
-       state->param.param_recv.flags = flags;
-
        return result;
 }
 
-/**
- * fde event handler for the "recvall" syscall group
- * @param[in] ev       The event context that sent us here
- * @param[in] fde      The file descriptor event associated with the recv
- * @param[in] flags    Can only be TEVENT_FD_READ here
- * @param[in] priv     private data, "struct async_req *" in this case
- */
-
-static void async_recvall_callback(struct tevent_context *ev,
-                                  struct tevent_fd *fde, uint16_t flags,
-                                  void *priv)
+static void async_recv_handler(struct tevent_context *ev,
+                              struct tevent_fd *fde,
+                              uint16_t flags, void *private_data)
 {
-       struct async_req *req = talloc_get_type_abort(
-               priv, struct async_req);
-       struct async_syscall_state *state = talloc_get_type_abort(
-               req->private_data, struct async_syscall_state);
-       struct param_recvall *p = &state->param.param_recvall;
-
-       if (state->syscall_type != ASYNC_SYSCALL_RECVALL) {
-               async_req_error(req, EIO);
-               return;
-       }
-
-       state->result.result_ssize_t = recv(p->fd,
-                                           (char *)p->buffer + p->received,
-                                           p->length - p->received, p->flags);
-       state->sys_errno = errno;
-
-       if (state->result.result_ssize_t == -1) {
-               async_req_error(req, state->sys_errno);
+       struct tevent_req *req = talloc_get_type_abort(
+               private_data, struct tevent_req);
+       struct async_recv_state *state = talloc_get_type_abort(
+               req->private_state, struct async_recv_state);
+
+       state->received = recv(state->fd, state->buf, state->len,
+                              state->flags);
+       if (state->received == -1) {
+               tevent_req_error(req, errno);
                return;
        }
-
-       if (state->result.result_ssize_t == 0) {
-               async_req_error(req, EIO);
-               return;
-       }
-
-       p->received += state->result.result_ssize_t;
-       if (p->received > p->length) {
-               async_req_error(req, EIO);
-               return;
-       }
-
-       if (p->received == p->length) {
-               TALLOC_FREE(state->fde);
-               async_req_done(req);
-       }
-}
-
-/**
- * Receive a specified number of bytes from a socket
- * @param[in] mem_ctx  The memory context to hang the result off
- * @param[in] ev       The event context to work from
- * @param[in] fd       The socket to recv from
- * @param[in] buffer   The buffer to recv into
- * @param[in] length   How many bytes to recv
- * @param[in] flags    flags passed to recv(2)
- *
- * async_recvall will call recv(2) until "length" bytes are received
- */
-
-struct async_req *recvall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                              int fd, void *buffer, size_t length,
-                              int flags)
-{
-       struct async_req *result;
-       struct async_syscall_state *state;
-
-       result = async_fde_syscall_new(
-               mem_ctx, ev, ASYNC_SYSCALL_RECVALL,
-               fd, TEVENT_FD_READ, async_recvall_callback,
-               &state);
-       if (result == NULL) {
-               return NULL;
-       }
-
-       state->param.param_recvall.fd = fd;
-       state->param.param_recvall.buffer = buffer;
-       state->param.param_recvall.length = length;
-       state->param.param_recvall.flags = flags;
-       state->param.param_recvall.received = 0;
-
-       return result;
+       tevent_req_done(req);
 }
 
-ssize_t recvall_recv(struct async_req *req, int *perr)
+ssize_t async_recv_recv(struct tevent_req *req, int *perrno)
 {
-       struct async_syscall_state *state = talloc_get_type_abort(
-               req->private_data, struct async_syscall_state);
-       int err;
+       struct async_recv_state *state = talloc_get_type_abort(
+               req->private_state, struct async_recv_state);
 
-       err = async_req_simple_recv_errno(req);
-
-       if (err != 0) {
-               *perr = err;
+       if (tevent_req_is_unix_error(req, perrno)) {
                return -1;
        }
-
-       return state->result.result_ssize_t;
+       return state->received;
 }
 
 struct async_connect_state {
@@ -633,17 +236,18 @@ static void async_connect_connected(struct tevent_context *ev,
  * connect in an async state. This will be reset when the request is finished.
  */
 
-struct async_req *async_connect_send(TALLOC_CTX *mem_ctx,
-                                    struct tevent_context *ev,
-                                    int fd, const struct sockaddr *address,
-                                    socklen_t address_len)
+struct tevent_req *async_connect_send(TALLOC_CTX *mem_ctx,
+                                     struct tevent_context *ev,
+                                     int fd, const struct sockaddr *address,
+                                     socklen_t address_len)
 {
-       struct async_req *result;
+       struct tevent_req *result;
        struct async_connect_state *state;
        struct tevent_fd *fde;
 
-       if (!async_req_setup(mem_ctx, &result, &state,
-                            struct async_connect_state)) {
+       result = tevent_req_create(
+               mem_ctx, &state, struct async_connect_state);
+       if (result == NULL) {
                return NULL;
        }
 
@@ -664,8 +268,8 @@ struct async_req *async_connect_send(TALLOC_CTX *mem_ctx,
 
        state->result = connect(fd, address, address_len);
        if (state->result == 0) {
-               state->sys_errno = 0;
-               goto post_status;
+               tevent_req_done(result);
+               goto done;
        }
 
        /**
@@ -680,6 +284,7 @@ struct async_req *async_connect_send(TALLOC_CTX *mem_ctx,
              errno == EISCONN ||
 #endif
              errno == EAGAIN || errno == EINTR)) {
+               state->sys_errno = errno;
                goto post_errno;
        }
 
@@ -687,21 +292,15 @@ struct async_req *async_connect_send(TALLOC_CTX *mem_ctx,
                           async_connect_connected, result);
        if (fde == NULL) {
                state->sys_errno = ENOMEM;
-               goto post_status;
+               goto post_errno;
        }
        return result;
 
  post_errno:
-       state->sys_errno = errno;
post_status:
+       tevent_req_error(result, state->sys_errno);
done:
        fcntl(fd, F_SETFL, state->old_sockflags);
-       if (!async_post_error(result, ev, state->sys_errno)) {
-               goto fail;
-       }
-       return result;
- fail:
-       TALLOC_FREE(result);
-       return NULL;
+       return tevent_req_post(result, ev);
 }
 
 /**
@@ -716,10 +315,10 @@ static void async_connect_connected(struct tevent_context *ev,
                                    struct tevent_fd *fde, uint16_t flags,
                                    void *priv)
 {
-       struct async_req *req = talloc_get_type_abort(
-               priv, struct async_req);
+       struct tevent_req *req = talloc_get_type_abort(
+               priv, struct tevent_req);
        struct async_connect_state *state = talloc_get_type_abort(
-               req->private_data, struct async_connect_state);
+               req->private_state, struct async_connect_state);
 
        TALLOC_FREE(fde);
 
@@ -743,27 +342,27 @@ static void async_connect_connected(struct tevent_context *ev,
                DEBUG(10, ("connect returned %s\n", strerror(errno)));
 
                fcntl(state->fd, F_SETFL, state->old_sockflags);
-               async_req_error(req, state->sys_errno);
+               tevent_req_error(req, state->sys_errno);
                return;
        }
 
        state->sys_errno = 0;
-       async_req_done(req);
+       tevent_req_done(req);
 }
 
-int async_connect_recv(struct async_req *req, int *perrno)
+int async_connect_recv(struct tevent_req *req, int *perrno)
 {
        struct async_connect_state *state = talloc_get_type_abort(
-               req->private_data, struct async_connect_state);
+               req->private_state, struct async_connect_state);
        int err;
 
        fcntl(state->fd, F_SETFL, state->old_sockflags);
 
-
-       if (async_req_is_errno(req, &err)) {
+       if (tevent_req_is_unix_error(req, &err)) {
                *perrno = err;
                return -1;
        }
+
        if (state->sys_errno == 0) {
                return 0;
        }
@@ -771,3 +370,226 @@ int async_connect_recv(struct async_req *req, int *perrno)
        *perrno = state->sys_errno;
        return -1;
 }
+
+struct writev_state {
+       struct tevent_context *ev;
+       int fd;
+       struct iovec *iov;
+       int count;
+       size_t total_size;
+};
+
+static void writev_handler(struct tevent_context *ev, struct tevent_fd *fde,
+                          uint16_t flags, void *private_data);
+
+struct tevent_req *writev_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+                              int fd, struct iovec *iov, int count)
+{
+       struct tevent_req *result;
+       struct writev_state *state;
+       struct tevent_fd *fde;
+
+       result = tevent_req_create(mem_ctx, &state, struct writev_state);
+       if (result == NULL) {
+               return NULL;
+       }
+       state->ev = ev;
+       state->fd = fd;
+       state->total_size = 0;
+       state->count = count;
+       state->iov = (struct iovec *)talloc_memdup(
+               state, iov, sizeof(struct iovec) * count);
+       if (state->iov == NULL) {
+               goto fail;
+       }
+
+       fde = tevent_add_fd(ev, state, fd, TEVENT_FD_WRITE, writev_handler,
+                           result);
+       if (fde == NULL) {
+               goto fail;
+       }
+       return result;
+
+ fail:
+       TALLOC_FREE(result);
+       return NULL;
+}
+
+static void writev_handler(struct tevent_context *ev, struct tevent_fd *fde,
+                          uint16_t flags, void *private_data)
+{
+       struct tevent_req *req = talloc_get_type_abort(
+               private_data, struct tevent_req);
+       struct writev_state *state = talloc_get_type_abort(
+               req->private_state, struct writev_state);
+       size_t to_write, written;
+       int i;
+
+       to_write = 0;
+
+       for (i=0; i<state->count; i++) {
+               to_write += state->iov[i].iov_len;
+       }
+
+       written = sys_writev(state->fd, state->iov, state->count);
+       if (written == -1) {
+               tevent_req_error(req, errno);
+               return;
+       }
+       if (written == 0) {
+               tevent_req_error(req, EPIPE);
+               return;
+       }
+       state->total_size += written;
+
+       if (written == to_write) {
+               tevent_req_done(req);
+               return;
+       }
+
+       /*
+        * We've written less than we were asked to, drop stuff from
+        * state->iov.
+        */
+
+       while (written > 0) {
+               if (written < state->iov[0].iov_len) {
+                       state->iov[0].iov_base =
+                               (char *)state->iov[0].iov_base + written;
+                       state->iov[0].iov_len -= written;
+                       break;
+               }
+               written = state->iov[0].iov_len;
+               state->iov += 1;
+               state->count -= 1;
+       }
+}
+
+ssize_t writev_recv(struct tevent_req *req, int *perrno)
+{
+       struct writev_state *state = talloc_get_type_abort(
+               req->private_state, struct writev_state);
+
+       if (tevent_req_is_unix_error(req, perrno)) {
+               return -1;
+       }
+       return state->total_size;
+}
+
+struct read_packet_state {
+       int fd;
+       uint8_t *buf;
+       size_t nread;
+       ssize_t (*more)(uint8_t *buf, size_t buflen, void *private_data);
+       void *private_data;
+};
+
+static void read_packet_handler(struct tevent_context *ev,
+                               struct tevent_fd *fde,
+                               uint16_t flags, void *private_data);
+
+struct tevent_req *read_packet_send(TALLOC_CTX *mem_ctx,
+                                   struct tevent_context *ev,
+                                   int fd, size_t initial,
+                                   ssize_t (*more)(uint8_t *buf,
+                                                   size_t buflen,
+                                                   void *private_data),
+                                   void *private_data)
+{
+       struct tevent_req *result;
+       struct read_packet_state *state;
+       struct tevent_fd *fde;
+
+       result = tevent_req_create(mem_ctx, &state, struct read_packet_state);
+       if (result == NULL) {
+               return NULL;
+       }
+       state->fd = fd;
+       state->nread = 0;
+       state->more = more;
+       state->private_data = private_data;
+
+       state->buf = talloc_array(state, uint8_t, initial);
+       if (state->buf == NULL) {
+               goto fail;
+       }
+
+       fde = tevent_add_fd(ev, state, fd, TEVENT_FD_READ, read_packet_handler,
+                           result);
+       if (fde == NULL) {
+               goto fail;
+       }
+       return result;
+ fail:
+       TALLOC_FREE(result);
+       return NULL;
+}
+
+static void read_packet_handler(struct tevent_context *ev,
+                               struct tevent_fd *fde,
+                               uint16_t flags, void *private_data)
+{
+       struct tevent_req *req = talloc_get_type_abort(
+               private_data, struct tevent_req);
+       struct read_packet_state *state = talloc_get_type_abort(
+               req->private_state, struct read_packet_state);
+       size_t total = talloc_get_size(state->buf);
+       ssize_t nread, more;
+       uint8_t *tmp;
+
+       nread = read(state->fd, state->buf+state->nread, total-state->nread);
+       if (nread == -1) {
+               tevent_req_error(req, errno);
+               return;
+       }
+       if (nread == 0) {
+               tevent_req_error(req, EPIPE);
+               return;
+       }
+
+       state->nread += nread;
+       if (state->nread < total) {
+               /* Come back later */
+               return;
+       }
+
+       /*
+        * We got what was initially requested. See if "more" asks for -- more.
+        */
+       if (state->more == NULL) {
+               /* Nobody to ask, this is a async read_data */
+               tevent_req_done(req);
+               return;
+       }
+
+       more = state->more(state->buf, total, state->private_data);
+       if (more == -1) {
+               /* We got an invalid packet, tell the caller */
+               tevent_req_error(req, EIO);
+               return;
+       }
+       if (more == 0) {
+               /* We're done, full packet received */
+               tevent_req_done(req);
+               return;
+       }
+
+       tmp = TALLOC_REALLOC_ARRAY(state, state->buf, uint8_t, total+more);
+       if (tevent_req_nomem(tmp, req)) {
+               return;
+       }
+       state->buf = tmp;
+}
+
+ssize_t read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                        uint8_t **pbuf, int *perrno)
+{
+       struct read_packet_state *state = talloc_get_type_abort(
+               req->private_state, struct read_packet_state);
+
+       if (tevent_req_is_unix_error(req, perrno)) {
+               return -1;
+       }
+       *pbuf = talloc_move(mem_ctx, &state->buf);
+       return talloc_get_size(*pbuf);
+}
index c8739e9ed6b3c383388065b674aa6caae7e13df7..e001709d2783b4f5696875e208bab330bc55fb9f 100644 (file)
 bool async_req_is_errno(struct async_req *req, int *err);
 int async_req_simple_recv_errno(struct async_req *req);
 
-ssize_t async_syscall_result_ssize_t(struct async_req *req, int *perrno);
-size_t async_syscall_result_size_t(struct async_req *req, int *perrno);
-int async_syscall_result_int(struct async_req *req, int *perrno);
-
-struct async_req *async_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                            int fd, const void *buffer, size_t length,
-                            int flags);
-struct async_req *async_recv(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                            int fd, void *buffer, size_t length,
-                            int flags);
-struct async_req *async_connect_send(TALLOC_CTX *mem_ctx,
-                                    struct tevent_context *ev,
-                                    int fd, const struct sockaddr *address,
-                                    socklen_t address_len);
-int async_connect_recv(struct async_req *req, int *perrno);
-
-struct async_req *sendall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                              int fd, const void *buffer, size_t length,
-                              int flags);
-ssize_t sendall_recv(struct async_req *req, int *perr);
-
-struct async_req *recvall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                              int fd, void *buffer, size_t length,
-                              int flags);
-ssize_t recvall_recv(struct async_req *req, int *perr);
+struct tevent_req *async_send_send(TALLOC_CTX *mem_ctx,
+                                  struct tevent_context *ev,
+                                  int fd, const void *buf, size_t len,
+                                  int flags);
+ssize_t async_send_recv(struct tevent_req *req, int *perrno);
+
+struct tevent_req *async_recv_send(TALLOC_CTX *mem_ctx,
+                                  struct tevent_context *ev,
+                                  int fd, void *buf, size_t len, int flags);
+ssize_t async_recv_recv(struct tevent_req *req, int *perrno);
+
+struct tevent_req *async_connect_send(TALLOC_CTX *mem_ctx,
+                                     struct tevent_context *ev,
+                                     int fd, const struct sockaddr *address,
+                                     socklen_t address_len);
+int async_connect_recv(struct tevent_req *req, int *perrno);
+
+struct tevent_req *writev_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+                              int fd, struct iovec *iov, int count);
+ssize_t writev_recv(struct tevent_req *req, int *perrno);
+
+struct tevent_req *read_packet_send(TALLOC_CTX *mem_ctx,
+                                   struct tevent_context *ev,
+                                   int fd, size_t initial,
+                                   ssize_t (*more)(uint8_t *buf,
+                                                   size_t buflen,
+                                                   void *private_data),
+                                   void *private_data);
+ssize_t read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+                        uint8_t **pbuf, int *perrno);
 
 #endif
index f6f0ec080c2e48ef085635c04c6af7d87c61753d..3a91bb40d2ac44c87b8ff1885d8ca0be22b23f5b 100644 (file)
@@ -84,9 +84,6 @@ int rep_getifaddrs(struct ifaddrs **ifap)
        char buff[8192];
        int fd, i, n;
        struct ifreq *ifr=NULL;
-       struct in_addr ipaddr;
-       struct in_addr nmask;
-       char *iname;
        struct ifaddrs *curif;
        struct ifaddrs *lastif = NULL;
 
@@ -164,9 +161,6 @@ int rep_getifaddrs(struct ifaddrs **ifap)
        char buff[8192];
        int fd, i, n;
        struct ifreq *ifr=NULL;
-       struct in_addr ipaddr;
-       struct in_addr nmask;
-       char *iname;
        struct ifaddrs *curif;
        struct ifaddrs *lastif = NULL;
 
@@ -265,9 +259,6 @@ int rep_getifaddrs(struct ifaddrs **ifap)
        int fd, i;
        struct ifconf ifc;
        struct ifreq *ifr=NULL;
-       struct in_addr ipaddr;
-       struct in_addr nmask;
-       char *iname;
        struct ifaddrs *curif;
        struct ifaddrs *lastif = NULL;
 
index 81bde46219e8e0dcba72230904ed46b95b5e09c7..9529c5e0a53db7b5d3907c626786bddeb4caebd4 100644 (file)
@@ -292,7 +292,7 @@ AC_DEFUN([AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR],
                *linux*)
                        LIB_PATH_VAR=LD_LIBRARY_PATH
                ;;
-               *netbsd*)
+               *bsd*)
                        LIB_PATH_VAR=LD_LIBRARY_PATH
                ;;
                *solaris*)
index 40d20db2d4a4ac7fc3504f8e092cf7a80d47c5d9..f135d175d43dcecfc6a2ec7bc92eb5d805528ce3 100644 (file)
@@ -327,10 +327,12 @@ struct addrinfo {
 #endif
 
 #ifdef SOCKET_WRAPPER
+#ifndef SOCKET_WRAPPER_DISABLE
 #ifndef SOCKET_WRAPPER_NOT_REPLACE
 #define SOCKET_WRAPPER_REPLACE
-#endif
+#endif /* SOCKET_WRAPPER_NOT_REPLACE */
 #include "../socket_wrapper/socket_wrapper.h"
-#endif
+#endif /* SOCKET_WRAPPER_DISABLE */
+#endif /* SOCKET_WRAPPER */
 
 #endif
index bcab0b97cd9afd276ac956dc1441dd35094735aa..f25ccae0d41c9f819bb8256ec3824e904ff41dcd 100644 (file)
@@ -203,10 +203,6 @@ WERROR smbconf_get_share(struct smbconf_ctx *ctx,
                         const char *servicename,
                         struct smbconf_service **service)
 {
-       if (!smbconf_share_exists(ctx, servicename)) {
-               return WERR_NO_SUCH_SERVICE;
-       }
-
        return ctx->ops->get_share(ctx, mem_ctx, servicename, service);
 }
 
@@ -403,3 +399,18 @@ WERROR smbconf_delete_global_includes(struct smbconf_ctx *ctx)
 
        return werr;
 }
+
+WERROR smbconf_transaction_start(struct smbconf_ctx *ctx)
+{
+       return ctx->ops->transaction_start(ctx);
+}
+
+WERROR smbconf_transaction_commit(struct smbconf_ctx *ctx)
+{
+       return ctx->ops->transaction_commit(ctx);
+}
+
+WERROR smbconf_transaction_cancel(struct smbconf_ctx *ctx)
+{
+       return ctx->ops->transaction_cancel(ctx);
+}
index 106fae6431d7f7ab65f4a0edd741888dc2a1e13f..517302ac883acf5cb54a6ca4664159adefdfc8ed 100644 (file)
@@ -94,4 +94,8 @@ WERROR smbconf_set_global_includes(struct smbconf_ctx *ctx,
 WERROR smbconf_delete_includes(struct smbconf_ctx *ctx, const char *service);
 WERROR smbconf_delete_global_includes(struct smbconf_ctx *ctx);
 
+WERROR smbconf_transaction_start(struct smbconf_ctx *ctx);
+WERROR smbconf_transaction_commit(struct smbconf_ctx *ctx);
+WERROR smbconf_transaction_cancel(struct smbconf_ctx *ctx);
+
 #endif /*  _LIBSMBCONF_H_  */
index c9e44181c6e57e1ff7c12daa6b6af55b57a16bed..e6998ad6392241a794167074a4adaefa7d7eacc3 100644 (file)
@@ -68,6 +68,9 @@ struct smbconf_ops {
                               uint32_t num_includes, const char **includes);
        WERROR (*delete_includes)(struct smbconf_ctx *ctx,
                                  const char *service);
+       WERROR (*transaction_start)(struct smbconf_ctx *ctx);
+       WERROR (*transaction_commit)(struct smbconf_ctx *ctx);
+       WERROR (*transaction_cancel)(struct smbconf_ctx *ctx);
 };
 
 struct smbconf_ctx {
index 1df4a9fdb73c0a5dd3ddf65f9d11969d65b335d1..501382cc5fd0416ab50fe61f69ffe7bc9ba69092 100644 (file)
@@ -612,6 +612,20 @@ static WERROR smbconf_txt_delete_includes(struct smbconf_ctx *ctx,
        return WERR_NOT_SUPPORTED;
 }
 
+static WERROR smbconf_txt_transaction_start(struct smbconf_ctx *ctx)
+{
+       return WERR_OK;
+}
+
+static WERROR smbconf_txt_transaction_commit(struct smbconf_ctx *ctx)
+{
+       return WERR_OK;
+}
+
+static WERROR smbconf_txt_transaction_cancel(struct smbconf_ctx *ctx)
+{
+       return WERR_OK;
+}
 
 static struct smbconf_ops smbconf_ops_txt = {
        .init                   = smbconf_txt_init,
@@ -633,6 +647,9 @@ static struct smbconf_ops smbconf_ops_txt = {
        .get_includes           = smbconf_txt_get_includes,
        .set_includes           = smbconf_txt_set_includes,
        .delete_includes        = smbconf_txt_delete_includes,
+       .transaction_start      = smbconf_txt_transaction_start,
+       .transaction_commit     = smbconf_txt_transaction_commit,
+       .transaction_cancel     = smbconf_txt_transaction_cancel,
 };
 
 
index b19e4cea293df769a588db89c71df25529d677ec..e58c8ca7ff3c5b309a164199d5dc457b34686054 100644 (file)
@@ -461,6 +461,10 @@ fail:
 /* reopen all tdb's */
 int tdb_reopen_all(int parent_longlived)
 {
+#if defined(LIBREPLACE_PREAD_NOT_REPLACED) && \
+       defined(LIBREPLACE_PWRITE_NOT_REPLACED)
+       return 0;
+#else
        struct tdb_context *tdb;
 
        for (tdb=tdbs; tdb; tdb = tdb->next) {
@@ -483,6 +487,7 @@ int tdb_reopen_all(int parent_longlived)
                if (tdb_reopen(tdb) != 0)
                        return -1;
        }
+#endif
 
        return 0;
 }
index 29a64ae3b3b822307666ed07dfaf35950171f7ab..c316823a715c42928d95288591b372b6b72ecf63 100644 (file)
@@ -27,7 +27,7 @@ AC_SUBST(TEVENT_LIBS)
 TEVENT_CFLAGS="-I$teventdir"
 
 TEVENT_OBJ="tevent.o tevent_fd.o tevent_timed.o tevent_signal.o tevent_debug.o tevent_util.o"
-TEVENT_OBJ="$TEVENT_OBJ tevent_req.o tevent_wakeup.o"
+TEVENT_OBJ="$TEVENT_OBJ tevent_req.o tevent_wakeup.o tevent_queue.o"
 TEVENT_OBJ="$TEVENT_OBJ tevent_standard.o tevent_select.o"
 
 AC_CHECK_HEADERS(sys/epoll.h)
index 16fac7327f05b73db3e587b69e924456457b16d3..8c119ffb8ed032fcdaa1a716d38148fb526a6c92 100644 (file)
@@ -31,6 +31,7 @@
 #include <stdint.h>
 #include <talloc.h>
 #include <sys/time.h>
+#include <stdbool.h>
 
 struct tevent_context;
 struct tevent_ops;
@@ -210,6 +211,15 @@ struct tevent_req {
         */
        void *private_state;
 
+       /**
+        * @brief A function to overwrite the default print function
+        *
+        * The implementation doing the work may want to imeplement a
+        * custom function to print the text representation of the async
+        * request.
+        */
+       char *(*private_print)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
+
        /**
         * @brief Internal state of the request
         *
@@ -266,6 +276,8 @@ struct tevent_req {
        } internal;
 };
 
+char *tevent_req_default_print(struct tevent_req *req, TALLOC_CTX *mem_ctx);
+
 char *tevent_req_print(TALLOC_CTX *mem_ctx, struct tevent_req *req);
 
 struct tevent_req *_tevent_req_create(TALLOC_CTX *mem_ctx,
@@ -295,6 +307,9 @@ struct tevent_req *tevent_req_post(struct tevent_req *req,
 
 bool tevent_req_is_in_progress(struct tevent_req *req);
 
+bool tevent_req_poll(struct tevent_req *req,
+                    struct tevent_context *ev);
+
 bool tevent_req_is_error(struct tevent_req *req,
                         enum tevent_req_state *state,
                         uint64_t *error);
@@ -323,6 +338,28 @@ struct timeval tevent_timeval_add(const struct timeval *tv, uint32_t secs,
 
 struct timeval tevent_timeval_current_ofs(uint32_t secs, uint32_t usecs);
 
+struct tevent_queue;
+
+struct tevent_queue *_tevent_queue_create(TALLOC_CTX *mem_ctx,
+                                         const char *name,
+                                         const char *location);
+
+#define tevent_queue_create(_mem_ctx, _name) \
+       _tevent_queue_create((_mem_ctx), (_name), __location__)
+
+typedef void (*tevent_queue_trigger_fn_t)(struct tevent_req *req,
+                                         void *private_data);
+bool tevent_queue_add(struct tevent_queue *queue,
+                     struct tevent_context *ev,
+                     struct tevent_req *req,
+                     tevent_queue_trigger_fn_t trigger,
+                     void *private_data);
+bool tevent_queue_start(struct tevent_queue *queue,
+                       struct tevent_context *ev);
+void tevent_queue_stop(struct tevent_queue *queue);
+
+size_t tevent_queue_length(struct tevent_queue *queue);
+
 #ifdef TEVENT_COMPAT_DEFINES
 
 #define event_context  tevent_context
diff --git a/lib/tevent/tevent_queue.c b/lib/tevent/tevent_queue.c
new file mode 100644 (file)
index 0000000..6c8fbe4
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+   Unix SMB/CIFS implementation.
+   Infrastructure for async requests
+   Copyright (C) Volker Lendecke 2008
+   Copyright (C) Stefan Metzmacher 2009
+
+     ** NOTE! The following LGPL license applies to the tevent
+     ** library. This does NOT imply that all of Samba is released
+     ** under the LGPL
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+#include "tevent.h"
+#include "tevent_internal.h"
+#include "tevent_util.h"
+
+struct tevent_queue_entry {
+       struct tevent_queue_entry *prev, *next;
+       struct tevent_queue *queue;
+
+       bool triggered;
+
+       struct tevent_req *req;
+
+       tevent_queue_trigger_fn_t trigger;
+       void *private_data;
+};
+
+struct tevent_queue {
+       const char *name;
+       const char *location;
+
+       bool running;
+       struct tevent_timer *timer;
+
+       size_t length;
+       struct tevent_queue_entry *list;
+};
+
+static int tevent_queue_entry_destructor(struct tevent_queue_entry *e)
+{
+       struct tevent_queue *q = e->queue;
+
+       if (!q) {
+               return 0;
+       }
+
+       DLIST_REMOVE(q->list, e);
+       q->length--;
+
+       if (e->triggered &&
+           q->running &&
+           q->list) {
+               q->list->triggered = true;
+               q->list->trigger(q->list->req,
+                                q->list->private_data);
+       }
+
+       return 0;
+}
+
+static int tevent_queue_destructor(struct tevent_queue *q)
+{
+       q->running = false;
+
+       while (q->list) {
+               struct tevent_queue_entry *e = q->list;
+               talloc_free(e);
+       }
+
+       return 0;
+}
+
+struct tevent_queue *_tevent_queue_create(TALLOC_CTX *mem_ctx,
+                                         const char *name,
+                                         const char *location)
+{
+       struct tevent_queue *queue;
+
+       queue = talloc_zero(mem_ctx, struct tevent_queue);
+       if (!queue) {
+               return NULL;
+       }
+
+       queue->name = talloc_strdup(queue, name);
+       if (!queue->name) {
+               talloc_free(queue);
+               return NULL;
+       }
+
+       queue->location = location;
+
+       /* queue is running by default */
+       queue->running = true;
+
+       talloc_set_destructor(queue, tevent_queue_destructor);
+       return queue;
+}
+
+static void tevent_queue_timer_start(struct tevent_context *ev,
+                                    struct tevent_timer *te,
+                                    struct timeval now,
+                                    void *private_data)
+{
+       struct tevent_queue *q = talloc_get_type(private_data,
+                                 struct tevent_queue);
+
+       talloc_free(te);
+       q->timer = NULL;
+
+       q->list->triggered = true;
+       q->list->trigger(q->list->req, q->list->private_data);
+}
+
+bool tevent_queue_add(struct tevent_queue *queue,
+                     struct tevent_context *ev,
+                     struct tevent_req *req,
+                     tevent_queue_trigger_fn_t trigger,
+                     void *private_data)
+{
+       struct tevent_queue_entry *e;
+
+       e = talloc_zero(req, struct tevent_queue_entry);
+       if (e == NULL) {
+               return false;
+       }
+
+       e->queue = queue;
+       e->req = req;
+       e->trigger = trigger;
+       e->private_data = private_data;
+
+       if (queue->running &&
+           !queue->timer &&
+           !queue->list) {
+               queue->timer = tevent_add_timer(ev, queue, tevent_timeval_zero(),
+                                               tevent_queue_timer_start,
+                                               queue);
+               if (!queue->timer) {
+                       talloc_free(e);
+                       return false;
+               }
+       }
+
+       DLIST_ADD_END(queue->list, e, struct tevent_queue_entry *);
+       queue->length++;
+       talloc_set_destructor(e, tevent_queue_entry_destructor);
+
+       return true;
+}
+
+bool tevent_queue_start(struct tevent_queue *queue,
+                       struct tevent_context *ev)
+{
+       if (queue->running) {
+               /* already started */
+               return true;
+       }
+
+       if (!queue->timer &&
+           queue->list) {
+               queue->timer = tevent_add_timer(ev, queue, tevent_timeval_zero(),
+                                               tevent_queue_timer_start,
+                                               queue);
+               if (!queue->timer) {
+                       return false;
+               }
+       }
+
+       queue->running = true;
+
+       return true;
+}
+
+void tevent_queue_stop(struct tevent_queue *queue)
+{
+       queue->running = false;
+       talloc_free(queue->timer);
+       queue->timer = NULL;
+}
+
+size_t tevent_queue_length(struct tevent_queue *queue)
+{
+       return queue->length;
+}
index 800e3855d1985ba0aa34ce13a5b202016590842c..e243c7de5de3d4787bf4a3a962be9022dfe5c42c 100644 (file)
 #include "tevent_util.h"
 
 /**
- * @brief Print an tevent_req structure in debug messages
- * @param[in] mem_ctx  The memory context for the result
+ * @brief The default print function for creating debug messages
  * @param[in] req      The request to be printed
+ * @param[in] mem_ctx  The memory context for the result
  * @retval             Text representation of req
  *
+ * The function should not be used by users of the asynx API,
+ * but custom print function can use it and append custom text
+ * to the string.
  */
 
-char *tevent_req_print(TALLOC_CTX *mem_ctx, struct tevent_req *req)
+char *tevent_req_default_print(struct tevent_req *req, TALLOC_CTX *mem_ctx)
 {
        return talloc_asprintf(mem_ctx,
                               "tevent_req[%p/%s]: state[%d] error[%lld (0x%llX)] "
@@ -50,6 +53,24 @@ char *tevent_req_print(TALLOC_CTX *mem_ctx, struct tevent_req *req)
                               );
 }
 
+/**
+ * @brief Print an tevent_req structure in debug messages
+ * @param[in] mem_ctx  The memory context for the result
+ * @param[in] req      The request to be printed
+ * @retval             Text representation of req
+ *
+ * This function should be used by callers of the async API
+ */
+
+char *tevent_req_print(TALLOC_CTX *mem_ctx, struct tevent_req *req)
+{
+       if (!req->private_print) {
+               return tevent_req_default_print(req, mem_ctx);
+       }
+
+       return req->private_print(req, mem_ctx);
+}
+
 /**
  * @brief Create an async request
  * @param[in] mem_ctx  The memory context for the result
@@ -235,6 +256,21 @@ bool tevent_req_is_in_progress(struct tevent_req *req)
        return false;
 }
 
+bool tevent_req_poll(struct tevent_req *req,
+                    struct tevent_context *ev)
+{
+       while (tevent_req_is_in_progress(req)) {
+               int ret;
+
+               ret = tevent_loop_once(ev);
+               if (ret != 0) {
+                       return false;
+               }
+       }
+
+       return true;
+}
+
 bool tevent_req_is_error(struct tevent_req *req, enum tevent_req_state *state,
                        uint64_t *error)
 {
index abd89260f676233b08f8a749f9678693e1fd3b30..b4ad9ae17f1c54448462359ad781d3aa723c632d 100644 (file)
@@ -3,7 +3,9 @@
 PUBLIC_DEPENDENCIES = \
                LIBSAMBA-HOSTCONFIG \
                LIBSAMBA-UTIL \
-               LIBTALLOC
+               LIBSAMBA-ERRORS \
+               LIBTALLOC \
+               LIBTEVENT
 CFLAGS = -I$(libtorturesrcdir) -I$(libtorturesrcdir)/../
 
 torture_VERSION = 0.0.1
index 034114eadedafa031b79f3284fb9843d85fb552a..3d06a4363df9b9097ac8dabe04e78de196ee0b95 100644 (file)
 /*******************************************************************
  Close the low 3 fd's and open dev/null in their place.
 ********************************************************************/
-static void close_low_fds(bool stderr_too)
+
+_PUBLIC_ void close_low_fds(bool stderr_too)
 {
 #ifndef VALGRIND
        int fd;
        int i;
 
        close(0);
-       close(1); 
+       close(1);
 
        if (stderr_too)
                close(2);
@@ -61,26 +62,26 @@ static void close_low_fds(bool stderr_too)
 #endif
 }
 
-/**
+/****************************************************************************
  Become a daemon, discarding the controlling terminal.
-**/
+****************************************************************************/
 
-_PUBLIC_ void become_daemon(bool Fork)
+_PUBLIC_ void become_daemon(bool do_fork, bool no_process_group)
 {
-       if (Fork) {
-               if (fork()) {
+       if (do_fork) {
+               if (sys_fork()) {
                        _exit(0);
                }
        }
 
-  /* detach from the terminal */
+       /* detach from the terminal */
 #ifdef HAVE_SETSID
-       setsid();
+       if (!no_process_group) setsid();
 #elif defined(TIOCNOTTY)
-       {
-               int i = open("/dev/tty", O_RDWR, 0);
+       if (!no_process_group) {
+               int i = sys_open("/dev/tty", O_RDWR, 0);
                if (i != -1) {
-                       ioctl(i, (int) TIOCNOTTY, (char *)0);      
+                       ioctl(i, (int) TIOCNOTTY, (char *)0);
                        close(i);
                }
        }
@@ -90,4 +91,3 @@ _PUBLIC_ void become_daemon(bool Fork)
        close_low_fds(false);  /* Don't close stderr, let the debug system
                                  attach it to the logfile */
 }
-
index 9bd180023356cff1970acf352e9c1776ddbe37b6..9bf5de1a83ee7ca605ffea6ba653585cd0ad7b39 100644 (file)
@@ -88,3 +88,32 @@ _PUBLIC_ struct in_addr sys_inet_makeaddr(int net, int host)
        return in2;
 }
 
+/**************************************************************************
+ Wrapper for fork. Ensures we clear our pid cache.
+****************************************************************************/
+
+static pid_t mypid = (pid_t)-1;
+
+_PUBLIC_ pid_t sys_fork(void)
+{
+       pid_t forkret = fork();
+
+       if (forkret == (pid_t)0) {
+               /* Child - reset mypid so sys_getpid does a system call. */
+               mypid = (pid_t) -1;
+       }
+
+       return forkret;
+}
+
+/**************************************************************************
+ Wrapper for getpid. Ensures we only do a system call *once*.
+****************************************************************************/
+
+_PUBLIC_ pid_t sys_getpid(void)
+{
+       if (mypid == (pid_t)-1)
+               mypid = getpid();
+
+       return mypid;
+}
diff --git a/lib/util/tevent_ntstatus.c b/lib/util/tevent_ntstatus.c
new file mode 100644 (file)
index 0000000..1a34e9c
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+   Unix SMB/CIFS implementation.
+   Wrap unix errno around tevent_req
+   Copyright (C) Volker Lendecke 2009
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "tevent_ntstatus.h"
+#include "../replace/replace.h"
+
+bool tevent_req_nterror(struct tevent_req *req,        NTSTATUS status)
+{
+       return tevent_req_error(req, NT_STATUS_V(status));
+}
+
+bool tevent_req_is_nterror(struct tevent_req *req, NTSTATUS *status)
+{
+       enum tevent_req_state state;
+       uint64_t err;
+
+       if (!tevent_req_is_error(req, &state, &err)) {
+               return false;
+       }
+       switch (state) {
+       case TEVENT_REQ_TIMED_OUT:
+               *status = NT_STATUS_IO_TIMEOUT;
+               break;
+       case TEVENT_REQ_NO_MEMORY:
+               *status = NT_STATUS_NO_MEMORY;
+               break;
+       case TEVENT_REQ_USER_ERROR:
+               *status = NT_STATUS(err);
+               break;
+       default:
+               *status = NT_STATUS_INTERNAL_ERROR;
+               break;
+       }
+       return true;
+}
diff --git a/lib/util/tevent_ntstatus.h b/lib/util/tevent_ntstatus.h
new file mode 100644 (file)
index 0000000..84c275f
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+   Unix SMB/CIFS implementation.
+   Wrap unix errno around tevent_req
+   Copyright (C) Volker Lendecke 2009
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _TEVENT_NTSTATUS_H
+#define _TEVENT_NTSTATUS_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "config.h"
+#include "../libcli/util/ntstatus.h"
+#include "../tevent/tevent.h"
+
+bool tevent_req_nterror(struct tevent_req *req, NTSTATUS status);
+bool tevent_req_is_nterror(struct tevent_req *req, NTSTATUS *pstatus);
+
+#endif
diff --git a/lib/util/tevent_unix.c b/lib/util/tevent_unix.c
new file mode 100644 (file)
index 0000000..b89d5cd
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+   Unix SMB/CIFS implementation.
+   Wrap unix errno around tevent_req
+   Copyright (C) Volker Lendecke 2009
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "tevent_unix.h"
+#include "../replace/replace.h"
+
+bool tevent_req_is_unix_error(struct tevent_req *req, int *perrno)
+{
+       enum tevent_req_state state;
+       uint64_t err;
+
+       if (!tevent_req_is_error(req, &state, &err)) {
+               return false;
+       }
+       switch (state) {
+       case TEVENT_REQ_TIMED_OUT:
+               *perrno = ETIMEDOUT;
+               break;
+       case TEVENT_REQ_NO_MEMORY:
+               *perrno = ENOMEM;
+               break;
+       case TEVENT_REQ_USER_ERROR:
+               *perrno = err;
+               break;
+       default:
+               *perrno = EINVAL;
+               break;
+       }
+       return true;
+}
diff --git a/lib/util/tevent_unix.h b/lib/util/tevent_unix.h
new file mode 100644 (file)
index 0000000..dc3ffae
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+   Unix SMB/CIFS implementation.
+   Wrap unix errno around tevent_req
+   Copyright (C) Volker Lendecke 2009
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _TEVENT_UNIX_H
+#define _TEVENT_UNIX_H
+
+#include "../tevent/tevent.h"
+
+bool tevent_req_is_unix_error(struct tevent_req *req, int *perrno);
+
+#endif
index 988d8f9fa02a479d05fc81a72af3905c3c35e12b..1f31f55e8b2fd1a39e3c545fe733cf4370682d04 100644 (file)
@@ -836,4 +836,104 @@ _PUBLIC_ size_t utf16_len_n(const void *src, size_t n)
        return len;
 }
 
+/**
+ * @file
+ * @brief String utilities.
+ **/
+
+static bool next_token_internal_talloc(TALLOC_CTX *ctx,
+                               const char **ptr,
+                                char **pp_buff,
+                                const char *sep,
+                                bool ltrim)
+{
+       char *s;
+       char *saved_s;
+       char *pbuf;
+       bool quoted;
+       size_t len=1;
+
+       *pp_buff = NULL;
+       if (!ptr) {
+               return(false);
+       }
+
+       s = (char *)*ptr;
+
+       /* default to simple separators */
+       if (!sep) {
+               sep = " \t\n\r";
+       }
+
+       /* find the first non sep char, if left-trimming is requested */
+       if (ltrim) {
+               while (*s && strchr_m(sep,*s)) {
+                       s++;
+               }
+       }
+
+       /* nothing left? */
+       if (!*s) {
+               return false;
+       }
+
+       /* When restarting we need to go from here. */
+       saved_s = s;
+
+       /* Work out the length needed. */
+       for (quoted = false; *s &&
+                       (quoted || !strchr_m(sep,*s)); s++) {
+               if (*s == '\"') {
+                       quoted = !quoted;
+               } else {
+                       len++;
+               }
+       }
+
+       /* We started with len = 1 so we have space for the nul. */
+       *pp_buff = talloc_array(ctx, char, len);
+       if (!*pp_buff) {
+               return false;
+       }
+
+       /* copy over the token */
+       pbuf = *pp_buff;
+       s = saved_s;
+       for (quoted = false; *s &&
+                       (quoted || !strchr_m(sep,*s)); s++) {
+               if ( *s == '\"' ) {
+                       quoted = !quoted;
+               } else {
+                       *pbuf++ = *s;
+               }
+       }
+
+       *ptr = (*s) ? s+1 : s;
+       *pbuf = 0;
+
+       return true;
+}
+
+bool next_token_talloc(TALLOC_CTX *ctx,
+                       const char **ptr,
+                       char **pp_buff,
+                       const char *sep)
+{
+       return next_token_internal_talloc(ctx, ptr, pp_buff, sep, true);
+}
+
+/*
+ * Get the next token from a string, return false if none found.  Handles
+ * double-quotes.  This version does not trim leading separator characters
+ * before looking for a token.
+ */
+
+bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
+                       const char **ptr,
+                       char **pp_buff,
+                       const char *sep)
+{
+       return next_token_internal_talloc(ctx, ptr, pp_buff, sep, false);
+}
+
 
index 7873f0e769f34c407e834636d80caff38362755d..1f6e3b193b3d0a9f9970428e19c45611e7401fca 100644 (file)
@@ -134,6 +134,16 @@ apparent reason.
 _PUBLIC_ struct hostent *sys_gethostbyname(const char *name);
 _PUBLIC_ struct in_addr sys_inet_makeaddr(int net, int host);
 
+/**
+ * Wrapper for fork used to invalid pid cache.
+ **/
+_PUBLIC_ pid_t sys_fork(void);
+
+/**
+ * Wrapper for getpid. Ensures we only do a system call *once*.
+ **/
+_PUBLIC_ pid_t sys_getpid(void);
+
 /* The following definitions come from lib/util/genrand.c  */
 
 /**
@@ -194,6 +204,21 @@ _PUBLIC_ void display_set_stderr(void);
 
 /* The following definitions come from lib/util/util_str.c  */
 
+bool next_token_talloc(TALLOC_CTX *ctx,
+                       const char **ptr,
+                       char **pp_buff,
+                       const char *sep);
+
+/**
+ * Get the next token from a string, return false if none found.  Handles
+ * double-quotes.  This version does not trim leading separator characters
+ * before looking for a token.
+ */
+bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
+                       const char **ptr,
+                       char **pp_buff,
+                       const char *sep);
+
 
 /**
  Trim the specified elements off the front and back of a string.
@@ -724,12 +749,15 @@ _PUBLIC_ int idr_remove(struct idr_context *idp, int id);
 
 /* The following definitions come from lib/util/become_daemon.c  */
 
-#if _SAMBA_BUILD_ == 4
+/**
+ Close the low 3 fd's and open dev/null in their place
+**/
+_PUBLIC_ void close_low_fds(bool stderr_too);
+
 /**
  Become a daemon, discarding the controlling terminal.
 **/
-_PUBLIC_ void become_daemon(bool fork);
-#endif
+_PUBLIC_ void become_daemon(bool do_fork, bool no_process_group);
 
 /**
  * Load a ini-style file.
diff --git a/libcli/ldap/config.mk b/libcli/ldap/config.mk
new file mode 100644 (file)
index 0000000..22cad8c
--- /dev/null
@@ -0,0 +1,15 @@
+[SUBSYSTEM::LIBCLI_LDAP_MESSAGE]
+PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBTALLOC LIBLDB
+PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL ASN1_UTIL
+
+LIBCLI_LDAP_MESSAGE_OBJ_FILES = $(addprefix ../libcli/ldap/, \
+                                               ldap_message.o)
+PUBLIC_HEADERS += ../libcli/ldap/ldap_message.h ../libcli/ldap/ldap_errors.h
+
+[SUBSYSTEM::LIBCLI_LDAP_NDR]
+PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBTALLOC
+PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBLDB NDR_MISC NDR_SECURITY
+
+LIBCLI_LDAP_NDR_OBJ_FILES = ../libcli/ldap/ldap_ndr.o
+PUBLIC_HEADERS += ../libcli/ldap/ldap_ndr.h
+
similarity index 98%
rename from source4/libcli/ldap/ldap_errors.h
rename to libcli/ldap/ldap_errors.h
index 17ac43814c30d18bd0e4e7a2b77ed87a07baef41..fa929c69364e80b95a2b4a864d1a10f2b4cdec8d 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef _SMB_LDAP_ERRORS_H_
 #define _SMB_LDAP_ERRORS_H_
 
+#ifndef LDAP_SUCCESS
 enum ldap_result_code {
        LDAP_SUCCESS                            = 0,
        LDAP_OPERATIONS_ERROR                   = 1,
@@ -62,5 +63,6 @@ enum ldap_result_code {
        LDAP_AFFECTS_MULTIPLE_DSAS              = 71,
        LDAP_OTHER                              = 80
 };
+#endif
 
 #endif /* _SMB_LDAP_ERRORS_H_ */
similarity index 88%
rename from source4/libcli/ldap/ldap.c
rename to libcli/ldap/ldap_message.c
index 7a65cc5c2746fad95cebc851d4a1240930a29488..9b00d0188d1ca0cb92071e0b2d1f8bcac2b79899 100644 (file)
 
 #include "includes.h"
 #include "../lib/util/asn1.h"
-#include "libcli/ldap/ldap.h"
-#include "libcli/ldap/ldap_proto.h"
+#include "../libcli/ldap/ldap_message.h"
 
+_PUBLIC_ struct ldap_message *new_ldap_message(TALLOC_CTX *mem_ctx)
+{
+       return talloc_zero(mem_ctx, struct ldap_message);
+}
+
+
+static bool add_value_to_attrib(TALLOC_CTX *mem_ctx, struct ldb_val *value,
+                               struct ldb_message_element *attrib)
+{
+       attrib->values = talloc_realloc(mem_ctx,
+                                       attrib->values,
+                                       DATA_BLOB,
+                                       attrib->num_values+1);
+       if (attrib->values == NULL)
+               return false;
+
+       attrib->values[attrib->num_values].data = talloc_steal(attrib->values,
+                                                              value->data);
+       attrib->values[attrib->num_values].length = value->length;
+       attrib->num_values += 1;
+       return true;
+}
+
+static bool add_attrib_to_array_talloc(TALLOC_CTX *mem_ctx,
+                                      const struct ldb_message_element *attrib,
+                                      struct ldb_message_element **attribs,
+                                      int *num_attribs)
+{
+       *attribs = talloc_realloc(mem_ctx,
+                                 *attribs,
+                                 struct ldb_message_element,
+                                 *num_attribs+1);
+
+       if (*attribs == NULL)
+               return false;
+
+       (*attribs)[*num_attribs] = *attrib;
+       talloc_steal(*attribs, attrib->values);
+       talloc_steal(*attribs, attrib->name);
+       *num_attribs += 1;
+       return true;
+}
+
+static bool add_mod_to_array_talloc(TALLOC_CTX *mem_ctx,
+                                   struct ldap_mod *mod,
+                                   struct ldap_mod **mods,
+                                   int *num_mods)
+{
+       *mods = talloc_realloc(mem_ctx, *mods, struct ldap_mod, (*num_mods)+1);
+
+       if (*mods == NULL)
+               return false;
+
+       (*mods)[*num_mods] = *mod;
+       *num_mods += 1;
+       return true;
+}
+
+static bool ldap_decode_control_value(void *mem_ctx, DATA_BLOB value,
+                                     const struct ldap_control_handler *handlers,
+                                     struct ldb_control *ctrl)
+{
+       int i;
+
+       if (!handlers) {
+               return true;
+       }
+
+       for (i = 0; handlers[i].oid != NULL; i++) {
+               if (strcmp(handlers[i].oid, ctrl->oid) == 0) {
+                       if (!handlers[i].decode || !handlers[i].decode(mem_ctx, value, &ctrl->data)) {
+                               return false;
+                       }
+                       break;
+               }
+       }
+       if (handlers[i].oid == NULL) {
+               return false;
+       }
+
+       return true;
+}
+
+static bool ldap_decode_control_wrapper(void *mem_ctx, struct asn1_data *data,
+                                       struct ldb_control *ctrl, DATA_BLOB *value)
+{
+       DATA_BLOB oid;
+
+       if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
+               return false;
+       }
+
+       if (!asn1_read_OctetString(data, mem_ctx, &oid)) {
+               return false;
+       }
+       ctrl->oid = talloc_strndup(mem_ctx, (char *)oid.data, oid.length);
+       if (!ctrl->oid) {
+               return false;
+       }
+
+       if (asn1_peek_tag(data, ASN1_BOOLEAN)) {
+               bool critical;
+               if (!asn1_read_BOOLEAN(data, &critical)) {
+                       return false;
+               }
+               ctrl->critical = critical;
+       } else {
+               ctrl->critical = false;
+       }
+
+       ctrl->data = NULL;
+
+       if (!asn1_peek_tag(data, ASN1_OCTET_STRING)) {
+               *value = data_blob(NULL, 0);
+               goto end_tag;
+       }
+
+       if (!asn1_read_OctetString(data, mem_ctx, value)) {
+               return false;
+       }
+
+end_tag:
+       if (!asn1_end_tag(data)) {
+               return false;
+       }
+
+       return true;
+}
+
+static bool ldap_encode_control(void *mem_ctx, struct asn1_data *data,
+                               const struct ldap_control_handler *handlers,
+                               struct ldb_control *ctrl)
+{
+       DATA_BLOB value;
+       int i;
+
+       if (!handlers) {
+               return false;
+       }
+
+       for (i = 0; handlers[i].oid != NULL; i++) {
+               if (strcmp(handlers[i].oid, ctrl->oid) == 0) {
+                       if (!handlers[i].encode) {
+                               if (ctrl->critical) {
+                                       return false;
+                               } else {
+                                       /* not encoding this control */
+                                       return true;
+                               }
+                       }
+                       if (!handlers[i].encode(mem_ctx, ctrl->data, &value)) {
+                               return false;
+                       }
+                       break;
+               }
+       }
+       if (handlers[i].oid == NULL) {
+               return false;
+       }
+
+       if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
+               return false;
+       }
+
+       if (!asn1_write_OctetString(data, ctrl->oid, strlen(ctrl->oid))) {
+               return false;
+       }
+
+       if (ctrl->critical) {
+               if (!asn1_write_BOOLEAN(data, ctrl->critical)) {
+                       return false;
+               }
+       }
+
+       if (!ctrl->data) {
+               goto pop_tag;
+       }
+
+       if (!asn1_write_OctetString(data, value.data, value.length)) {
+               return false;
+       }
+
+pop_tag:
+       if (!asn1_pop_tag(data)) {
+               return false;
+       }
+
+       return true;
+}
 
 static bool ldap_push_filter(struct asn1_data *data, struct ldb_parse_tree *tree)
 {
@@ -188,7 +376,9 @@ static void ldap_encode_response(struct asn1_data *data, struct ldap_Result *res
        }
 }
 
-_PUBLIC_ bool ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ctx)
+_PUBLIC_ bool ldap_encode(struct ldap_message *msg,
+                         const struct ldap_control_handler *control_handlers,
+                         DATA_BLOB *result, TALLOC_CTX *mem_ctx)
 {
        struct asn1_data *data = asn1_init(mem_ctx);
        int i, j;
@@ -475,7 +665,9 @@ _PUBLIC_ bool ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CT
                asn1_push_tag(data, ASN1_CONTEXT(0));
                
                for (i = 0; msg->controls[i] != NULL; i++) {
-                       if (!ldap_encode_control(mem_ctx, data, msg->controls[i])) {
+                       if (!ldap_encode_control(mem_ctx, data,
+                                                control_handlers,
+                                                msg->controls[i])) {
                                return false;
                        }
                }
@@ -867,13 +1059,13 @@ static struct ldb_parse_tree *ldap_decode_filter_tree(TALLOC_CTX *mem_ctx,
                                ret->u.extended.attr = talloc_strdup(ret, "*");
                        }
                        ret->u.extended.rule_id      = talloc_steal(ret, oid);
-                       ret->u.extended.value.data   = talloc_steal(ret, value);
+                       ret->u.extended.value.data   = (uint8_t *)talloc_steal(ret, value);
                        ret->u.extended.value.length = strlen(value);
                        ret->u.extended.dnAttributes = dnAttributes;
                } else {
                        ret->operation               = LDB_OP_EQUALITY;
                        ret->u.equality.attr         = talloc_steal(ret, attr);
-                       ret->u.equality.value.data   = talloc_steal(ret, value);
+                       ret->u.equality.value.data   = (uint8_t *)talloc_steal(ret, value);
                        ret->u.equality.value.length = strlen(value);
                }
                if (!asn1_end_tag(data)) {
@@ -883,7 +1075,6 @@ static struct ldb_parse_tree *ldap_decode_filter_tree(TALLOC_CTX *mem_ctx,
        }
 
        default:
-               DEBUG(0,("Unsupported LDAP filter operation 0x%x\n", filter_tag));
                goto failed;
        }
        
@@ -926,9 +1117,9 @@ void ldap_decode_attribs_bare(TALLOC_CTX *mem_ctx, struct asn1_data *data,
 }
 
 /* Decode a set of LDAP attributes, as found in a search entry */
-void ldap_decode_attribs(TALLOC_CTX *mem_ctx, struct asn1_data *data,
-                        struct ldb_message_element **attributes,
-                        int *num_attributes)
+static void ldap_decode_attribs(TALLOC_CTX *mem_ctx, struct asn1_data *data,
+                               struct ldb_message_element **attributes,
+                               int *num_attributes)
 {
        asn1_start_tag(data, ASN1_SEQUENCE(0));
        ldap_decode_attribs_bare(mem_ctx, data, 
@@ -938,7 +1129,9 @@ void ldap_decode_attribs(TALLOC_CTX *mem_ctx, struct asn1_data *data,
 
 /* This routine returns LDAP status codes */
 
-_PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg)
+_PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data,
+                             const struct ldap_control_handler *control_handlers,
+                             struct ldap_message *msg)
 {
        uint8_t tag;
 
@@ -1032,13 +1225,17 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg)
 
        case ASN1_APPLICATION(LDAP_TAG_SearchRequest): {
                struct ldap_SearchRequest *r = &msg->r.SearchRequest;
+               int sizelimit, timelimit;
+               const char **attrs = NULL;
                msg->type = LDAP_TAG_SearchRequest;
                asn1_start_tag(data, tag);
                asn1_read_OctetString_talloc(msg, data, &r->basedn);
                asn1_read_enumerated(data, (int *)&(r->scope));
                asn1_read_enumerated(data, (int *)&(r->deref));
-               asn1_read_Integer(data, &r->sizelimit);
-               asn1_read_Integer(data, &r->timelimit);
+               asn1_read_Integer(data, &sizelimit);
+               r->sizelimit = sizelimit;
+               asn1_read_Integer(data, &timelimit);
+               r->timelimit = timelimit;
                asn1_read_BOOLEAN(data, &r->attributesonly);
 
                r->tree = ldap_decode_filter_tree(msg, data);
@@ -1058,10 +1255,11 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg)
                                                          &attr))
                                return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);
                        if (!add_string_to_array(msg, attr,
-                                                &r->attributes,
+                                                &attrs,
                                                 &r->num_attributes))
                                return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);
                }
+               r->attributes = attrs;
 
                asn1_end_tag(data);
                asn1_end_tag(data);
@@ -1368,7 +1566,9 @@ _PUBLIC_ NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg)
                                return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR);
                        }
                        
-                       if (!ldap_decode_control_value(ctrl, value, ctrl[i])) {
+                       if (!ldap_decode_control_value(ctrl, value,
+                                                      control_handlers,
+                                                      ctrl[i])) {
                                if (ctrl[i]->critical) {
                                        ctrl[i]->data = NULL;
                                        decoded[i] = false;
similarity index 70%
rename from source3/include/smb_ldap.h
rename to libcli/ldap/ldap_message.h
index a3c270d95c1e9f630858bcdbbae7e9ebeef21be0..c50018465c88d83c30fbcd28d1336338e1bd2f9a 100644 (file)
    
 */
 
-#ifndef _SMB_LDAP_H
-#define _SMB_LDAP_H
+#ifndef _LIBCLI_LDAP_MESSAGE_H_
+#define _LIBCLI_LDAP_MESSAGE_H_
+
+#include "../libcli/ldap/ldap_errors.h"
+#include "lib/ldb/include/ldb.h"
 
 enum ldap_request_tag {
        LDAP_TAG_BindRequest = 0,
@@ -49,15 +52,6 @@ enum ldap_auth_mechanism {
        LDAP_AUTH_MECH_SASL = 3
 };
 
-#ifndef LDAP_SUCCESS
-enum ldap_result_code {
-       LDAP_SUCCESS = 0,
-       LDAP_SASL_BIND_IN_PROGRESS = 0x0e,
-       LDAP_INVALID_CREDENTIALS = 0x31,
-       LDAP_OTHER = 0x50
-};
-#endif /* LDAP_SUCCESS */
-
 struct ldap_Result {
        int resultcode;
        const char *dn;
@@ -65,12 +59,6 @@ struct ldap_Result {
        const char *referral;
 };
 
-struct ldap_attribute {
-       const char *name;
-       int num_values;
-       DATA_BLOB *values;
-};
-
 struct ldap_BindRequest {
        int version;
        const char *dn;
@@ -79,7 +67,7 @@ struct ldap_BindRequest {
                const char *password;
                struct {
                        const char *mechanism;
-                       DATA_BLOB secblob;
+                       DATA_BLOB *secblob;/* optional */
                } SASL;
        } creds;
 };
@@ -87,12 +75,12 @@ struct ldap_BindRequest {
 struct ldap_BindResponse {
        struct ldap_Result response;
        union {
-               DATA_BLOB secblob;
+               DATA_BLOB *secblob;/* optional */
        } SASL;
 };
 
 struct ldap_UnbindRequest {
-       uint8 __dummy;
+       uint8_t __dummy;
 };
 
 enum ldap_scope {
@@ -112,23 +100,22 @@ struct ldap_SearchRequest {
        const char *basedn;
        enum ldap_scope scope;
        enum ldap_deref deref;
-       uint32 timelimit;
-       uint32 sizelimit;
+       uint32_t timelimit;
+       uint32_t sizelimit;
        bool attributesonly;
-       char *filter;
+       struct ldb_parse_tree *tree;
        int num_attributes;
-       const char **attributes;
+       const char * const *attributes;
 };
 
 struct ldap_SearchResEntry {
        const char *dn;
        int num_attributes;
-       struct ldap_attribute *attributes;
+       struct ldb_message_element *attributes;
 };
 
 struct ldap_SearchResRef {
-       int num_referrals;
-       const char **referrals;
+       const char *referral;
 };
 
 enum ldap_modify_type {
@@ -140,7 +127,7 @@ enum ldap_modify_type {
 
 struct ldap_mod {
        enum ldap_modify_type type;
-       struct ldap_attribute attrib;
+       struct ldb_message_element attrib;
 };
 
 struct ldap_ModifyRequest {
@@ -152,7 +139,7 @@ struct ldap_ModifyRequest {
 struct ldap_AddRequest {
        const char *dn;
        int num_attributes;
-       struct ldap_attribute *attributes;
+       struct ldb_message_element *attributes;
 };
 
 struct ldap_DelRequest {
@@ -163,31 +150,32 @@ struct ldap_ModifyDNRequest {
        const char *dn;
        const char *newrdn;
        bool deleteolddn;
-       const char *newsuperior;
+       const char *newsuperior;/* optional */
 };
 
 struct ldap_CompareRequest {
        const char *dn;
        const char *attribute;
-       const char *value;
+       DATA_BLOB value;
 };
 
 struct ldap_AbandonRequest {
-       uint32 messageid;
+       int messageid;
 };
 
 struct ldap_ExtendedRequest {
        const char *oid;
-       DATA_BLOB value;
+       DATA_BLOB *value;/* optional */
 };
 
 struct ldap_ExtendedResponse {
        struct ldap_Result response;
-       const char *name;
-       DATA_BLOB value;
+       const char *oid;/* optional */
+       DATA_BLOB *value;/* optional */
 };
 
 union ldap_Request {
+       struct ldap_Result              GeneralResult;
        struct ldap_BindRequest         BindRequest;
        struct ldap_BindResponse        BindResponse;
        struct ldap_UnbindRequest       UnbindRequest;
@@ -210,46 +198,38 @@ union ldap_Request {
        struct ldap_ExtendedResponse    ExtendedResponse;
 };
 
-struct ldap_Control {
-       const char *oid;
-       bool        critical;
-       DATA_BLOB   value;
-};
 
 struct ldap_message {
-       TALLOC_CTX             *mem_ctx;
-       uint32                  messageid;
-       uint8                   type;
-       union  ldap_Request     r;
-       int                     num_controls;
-       struct ldap_Control    *controls;
+       int                     messageid;
+       enum ldap_request_tag   type;
+       union ldap_Request      r;
+       struct ldb_control    **controls;
+       bool                   *controls_decoded;
 };
 
-struct ldap_queue_entry {
-       struct ldap_queue_entry *next, *prev;
-       int msgid;
-       struct ldap_message *msg;
+struct ldap_control_handler {
+       const char *oid;
+       bool (*decode)(void *mem_ctx, DATA_BLOB in, void *_out);
+       bool (*encode)(void *mem_ctx, void *in, DATA_BLOB *out);
 };
 
-struct ldap_connection {
-       TALLOC_CTX *mem_ctx;
-       int sock;
-       int next_msgid;
-       char *host;
-       uint16 port;
-       bool ldaps;
-
-       const char *auth_dn;
-       const char *simple_pw;
+struct asn1_data;
 
-       /* Current outstanding search entry */
-       int searchid;
+struct ldap_message *new_ldap_message(TALLOC_CTX *mem_ctx);
+NTSTATUS ldap_decode(struct asn1_data *data,
+                    const struct ldap_control_handler *control_handlers,
+                    struct ldap_message *msg);
+bool ldap_encode(struct ldap_message *msg,
+                const struct ldap_control_handler *control_handlers,
+                DATA_BLOB *result, TALLOC_CTX *mem_ctx);
+NTSTATUS ldap_full_packet(void *private_data, DATA_BLOB blob, size_t *packet_size);
 
-       /* List for incoming search entries */
-       struct ldap_queue_entry *search_entries;
+bool asn1_read_OctetString_talloc(TALLOC_CTX *mem_ctx,
+                                 struct asn1_data *data,
+                                 const char **result);
 
-       /* Outstanding LDAP requests that have not yet been replied to */
-       struct ldap_queue_entry *outstanding;
-};
+void ldap_decode_attribs_bare(TALLOC_CTX *mem_ctx, struct asn1_data *data,
+                             struct ldb_message_element **attributes,
+                             int *num_attributes);
 
-#endif
+#endif 
similarity index 98%
rename from source4/libcli/ldap/ldap_ndr.c
rename to libcli/ldap/ldap_ndr.c
index f0a11ba41fd0e632e3576889e51b015d36f123bc..dd820ff8d5fcde86cb695061ce2218543ef41095 100644 (file)
@@ -21,7 +21,7 @@
 */
 
 #include "includes.h"
-#include "libcli/ldap/ldap.h"
+#include "lib/ldb/include/ldb.h"
 #include "librpc/gen_ndr/ndr_security.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 #include "libcli/ldap/ldap_ndr.h"
index 160e7bc3e0bb7ca7014beccbd9eb9f0dbb70b89a..1044ab351a125f55bc2dba637a3da552eff46fb2 100644 (file)
@@ -135,6 +135,7 @@ static const struct werror_code_struct dos_errs[] =
        { "WERR_INVALID_FLAGS", WERR_INVALID_FLAGS },
        { "WERR_NOT_FOUND", WERR_NOT_FOUND },
        { "WERR_SERVER_UNAVAILABLE", WERR_SERVER_UNAVAILABLE },
+       { "WERR_INVALID_USER_BUFFER", WERR_INVALID_USER_BUFFER },
        { "WERR_NO_TRUST_SAM_ACCOUNT", WERR_NO_TRUST_SAM_ACCOUNT },
        { "WERR_CLASS_NOT_REGISTERED", WERR_CLASS_NOT_REGISTERED },
        { "WERR_NO_SHUTDOWN_IN_PROGRESS", WERR_NO_SHUTDOWN_IN_PROGRESS },
@@ -168,6 +169,7 @@ static const struct werror_code_struct dos_errs[] =
        { "WERR_SERVICE_NEVER_STARTED", WERR_SERVICE_NEVER_STARTED },
        { "WERR_PASSWORD_MUST_CHANGE", WERR_PASSWORD_MUST_CHANGE },
        { "WERR_ACCOUNT_LOCKED_OUT", WERR_ACCOUNT_LOCKED_OUT },
+       { "WERR_UNKNOWN_PRINT_MONITOR", WERR_UNKNOWN_PRINT_MONITOR },
        { NULL, W_ERROR(0) }
 };
 
index d22516ae5c4aecebe46cffff80974e5be1453be3..15251a44fc8e0d14721b6c07254ad6e81f153320 100644 (file)
@@ -60,6 +60,18 @@ typedef uint32_t WERROR;
        }\
 } while (0)
 
+#define W_ERROR_NOT_OK_GOTO_DONE(x) do { \
+       if (!W_ERROR_IS_OK(x)) {\
+               goto done;\
+       }\
+} while (0)
+
+#define W_ERROR_NOT_OK_GOTO(x, y) do {\
+       if (!W_ERROR_IS_OK(x)) {\
+               goto y;\
+       }\
+} while(0)
+
 /* these are win32 error codes. There are only a few places where
    these matter for Samba, primarily in the NT printing code */
 #define WERR_OK W_ERROR(0)
@@ -136,6 +148,7 @@ typedef uint32_t WERROR;
 #define WERR_TIME_SKEW W_ERROR(1398)
 #define WERR_EVENTLOG_FILE_CORRUPT W_ERROR(1500)
 #define WERR_SERVER_UNAVAILABLE W_ERROR(1722)
+#define WERR_INVALID_USER_BUFFER W_ERROR(1784)
 #define WERR_NO_TRUST_SAM_ACCOUNT W_ERROR(1787)
 #define WERR_INVALID_FORM_NAME W_ERROR(1902)
 #define WERR_INVALID_FORM_SIZE W_ERROR(1903)
index 6b084d22171c9cb2870fbd92a1587b9af653296f..b9cf39dea0a2d4610d44e532a1c377e2b143036c 100644 (file)
@@ -902,7 +902,7 @@ NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli,
        return r.out.result;
 }
 
-NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli,
+NTSTATUS rpccli_eventlog_GetLogInformation(struct rpc_pipe_client *cli,
                                           TALLOC_CTX *mem_ctx,
                                           struct policy_handle *handle /* [in] [ref] */,
                                           uint32_t level /* [in]  */,
@@ -910,7 +910,7 @@ NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli,
                                           uint32_t buf_size /* [in] [range(0,1024)] */,
                                           uint32_t *bytes_needed /* [out] [ref] */)
 {
-       struct eventlog_GetLogIntormation r;
+       struct eventlog_GetLogInformation r;
        NTSTATUS status;
 
        /* In parameters */
@@ -919,13 +919,13 @@ NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli,
        r.in.buf_size = buf_size;
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_IN_DEBUG(eventlog_GetLogIntormation, &r);
+               NDR_PRINT_IN_DEBUG(eventlog_GetLogInformation, &r);
        }
 
        status = cli->dispatch(cli,
                                mem_ctx,
                                &ndr_table_eventlog,
-                               NDR_EVENTLOG_GETLOGINTORMATION,
+                               NDR_EVENTLOG_GETLOGINFORMATION,
                                &r);
 
        if (!NT_STATUS_IS_OK(status)) {
@@ -933,7 +933,7 @@ NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli,
        }
 
        if (DEBUGLEVEL >= 10) {
-               NDR_PRINT_OUT_DEBUG(eventlog_GetLogIntormation, &r);
+               NDR_PRINT_OUT_DEBUG(eventlog_GetLogInformation, &r);
        }
 
        if (NT_STATUS_IS_ERR(status)) {
index ae5544daf3aaeae7c622ed7e37de3efcee4775fc..d905676041afd94573f7b6da74e0ef151c9d4cc8 100644 (file)
@@ -93,7 +93,7 @@ NTSTATUS rpccli_eventlog_DeregisterClusterSvc(struct rpc_pipe_client *cli,
                                              TALLOC_CTX *mem_ctx);
 NTSTATUS rpccli_eventlog_WriteClusterEvents(struct rpc_pipe_client *cli,
                                            TALLOC_CTX *mem_ctx);
-NTSTATUS rpccli_eventlog_GetLogIntormation(struct rpc_pipe_client *cli,
+NTSTATUS rpccli_eventlog_GetLogInformation(struct rpc_pipe_client *cli,
                                           TALLOC_CTX *mem_ctx,
                                           struct policy_handle *handle /* [in] [ref] */,
                                           uint32_t level /* [in]  */,
index 02a05b94ff85a1ce918cbd519cfd40ab83fb35ca..2aa42b93bfb092a9d79aaa135877c5f9d367fe0b 100644 (file)
@@ -2540,7 +2540,7 @@ NTSTATUS rpccli_spoolss_GetPrinterDriver2(struct rpc_pipe_client *cli,
                                          uint32_t offered /* [in]  */,
                                          uint32_t client_major_version /* [in]  */,
                                          uint32_t client_minor_version /* [in]  */,
-                                         DATA_BLOB *info /* [out] [unique] */,
+                                         union spoolss_DriverInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
                                          uint32_t *needed /* [out] [ref] */,
                                          uint32_t *server_major_version /* [out] [ref] */,
                                          uint32_t *server_minor_version /* [out] [ref] */,
index bb38d59cfb1680e38d8d6689b937d5ab2af78062..83b2e28729ec4292cf39ba2fbb7ffa059d64b233 100644 (file)
@@ -331,7 +331,7 @@ NTSTATUS rpccli_spoolss_GetPrinterDriver2(struct rpc_pipe_client *cli,
                                          uint32_t offered /* [in]  */,
                                          uint32_t client_major_version /* [in]  */,
                                          uint32_t client_minor_version /* [in]  */,
-                                         DATA_BLOB *info /* [out] [unique] */,
+                                         union spoolss_DriverInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
                                          uint32_t *needed /* [out] [ref] */,
                                          uint32_t *server_major_version /* [out] [ref] */,
                                          uint32_t *server_minor_version /* [out] [ref] */,
index 07548c3742cb8771fe123e13a92da7bfb5e9c865..41be3bd28d84b34cab08c1c8eaf72fd14cbee5e9 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/misc.h"
 #ifndef _HEADER_netdfs
 #define _HEADER_netdfs
index bb33464c76778e4b92e0e52f7a0ab8328d9fda54..190e012cb524687cdf646ac5ce478dbcf0f8f4a6 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/drsuapi.h"
 #include "librpc/gen_ndr/misc.h"
 #include "librpc/gen_ndr/samr.h"
index e3d480365e460ba2db0ba30246c873c2849a2974..8f9b165631e0dc4cfdbc0a35399f89f493485cfa 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/security.h"
 #include "librpc/gen_ndr/misc.h"
 #include "librpc/gen_ndr/samr.h"
index d284a63375c47ff8c810b220e007a23a80336ff6..5d254fe92e6bbb275cf9b11c525d83442a6220dc 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/misc.h"
 #ifndef _HEADER_dssetup
 #define _HEADER_dssetup
index 79d4220714d40b121272919be953cb96ab69057f..9c783046f3b74d2fb245edf6674ab57900563157 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #ifndef _HEADER_rpcecho
 #define _HEADER_rpcecho
 
index e5155a8cad7f9bf4ef27dc61352fb86c5b913b14..ff80fbb4fd781e83bde9772b39850c96df6001c5 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/misc.h"
 #ifndef _HEADER_epmapper
 #define _HEADER_epmapper
index 94da688f5c846b3dd88870f37fb96eac7b1449ec..b6e792fdd37bca457898565f323609c3029834ba 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/lsa.h"
 #include "librpc/gen_ndr/security.h"
 #ifndef _HEADER_eventlog
@@ -39,32 +41,6 @@ struct eventlog_OpenUnknown0 {
        uint16_t unknown1;
 };
 
-struct eventlog_Record {
-       uint32_t size;
-       const char *reserved;/* [value("eLfL"),charset(DOS)] */
-       uint32_t record_number;
-       time_t time_generated;
-       time_t time_written;
-       uint32_t event_id;
-       enum eventlogEventTypes event_type;
-       uint16_t num_of_strings;/* [range(0,256)] */
-       uint16_t event_category;
-       uint16_t reserved_flags;
-       uint32_t closing_record_number;
-       uint32_t stringoffset;
-       uint32_t sid_size;/* [value(ndr_size_dom_sid0(&sid,ndr->flags))] */
-       uint32_t sid_offset;
-       uint32_t data_length;
-       uint32_t data_offset;
-       const char * source_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
-       const char * computer_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
-       struct dom_sid0 sid;/* [subcontext_size(sid_size),subcontext(0)] */
-       const char * *strings;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
-       const char * raw_data;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
-       DATA_BLOB _padding;/* [flag(LIBNDR_FLAG_ALIGN4)] */
-       uint32_t size2;/* [value(size)] */
-}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
-
 struct eventlog_Record_tdb {
        uint32_t size;
        const char *reserved;/* [value("eLfL"),charset(DOS)] */
@@ -437,7 +413,7 @@ struct eventlog_WriteClusterEvents {
 };
 
 
-struct eventlog_GetLogIntormation {
+struct eventlog_GetLogInformation {
        struct {
                struct policy_handle *handle;/* [ref] */
                uint32_t level;
index 014e2fe6898d7a87e71b9e07e08d705b8e58c80a..913eb8f740025a994f8ab292c0021b1f5f0e5693 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/lsa.h"
 #ifndef _HEADER_initshutdown
 #define _HEADER_initshutdown
index 73bd0d95bb1fd97c1f62b6fd3853e4e5c210123e..03b23bdaaeb99be287949dc8206bb21f5912990a 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/security.h"
 #include "librpc/gen_ndr/netlogon.h"
 #include "librpc/gen_ndr/samr.h"
index 03a0464d5bd791f20ba5509fcebfb5128aff1ffb..a6da7a6cef98e18b4c91266f209b85a18dd212d1 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/misc.h"
 #include "librpc/gen_ndr/security.h"
 #ifndef _HEADER_lsarpc
index e000cb0624e84e7f518e322802d2be2503406f5f..824483d29206a63de54cc8ae31ca9b1539fa2d29 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #ifndef _HEADER_misc
 #define _HEADER_misc
 
index 7ca7444c92703f2d2d903611d62181d23d94ecad..e35c22111866463aa672bc9d8de5540061c510b7 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/netlogon.h"
 #ifndef _HEADER_named_pipe_auth
 #define _HEADER_named_pipe_auth
index 1f3ad37d9bf5aa6c544a2592edab46828fd639e2..affbeffa08651a63de2f04ee7eaccd38d1033b77 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <stdint.h>
 
+#include "libcli/util/ntstatus.h"
+
 #include "librpc/gen_ndr/misc.h"
 #include "librpc/gen_ndr/security.h"
 #include "librpc/gen_ndr/svcctl.h"
index 0d5654c6401430660536f902f970f7f276f98a93..3f19902690d6dc27ae94511c2a42cd782e063780 100644 (file)
@@ -92,201 +92,6 @@ _PUBLIC_ void ndr_print_eventlog_OpenUnknown0(struct ndr_print *ndr, const char
        ndr->depth--;
 }
 
-_PUBLIC_ enum ndr_err_code ndr_push_eventlog_Record(struct ndr_push *ndr, int ndr_flags, const struct eventlog_Record *r)
-{
-       uint32_t cntr_strings_0;
-       {
-               uint32_t _flags_save_STRUCT = ndr->flags;
-               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
-               if (ndr_flags & NDR_SCALARS) {
-                       NDR_CHECK(ndr_push_align(ndr, 4));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
-                       NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, "eLfL", 4, sizeof(uint8_t), CH_DOS));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->record_number));
-                       NDR_CHECK(ndr_push_time_t(ndr, NDR_SCALARS, r->time_generated));
-                       NDR_CHECK(ndr_push_time_t(ndr, NDR_SCALARS, r->time_written));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->event_id));
-                       NDR_CHECK(ndr_push_eventlogEventTypes(ndr, NDR_SCALARS, r->event_type));
-                       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_of_strings));
-                       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->event_category));
-                       NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->reserved_flags));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->closing_record_number));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->stringoffset));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sid_offset));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->data_length));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->data_offset));
-                       {
-                               uint32_t _flags_save_string = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
-                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->source_name));
-                               ndr->flags = _flags_save_string;
-                       }
-                       {
-                               uint32_t _flags_save_string = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
-                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name));
-                               ndr->flags = _flags_save_string;
-                       }
-                       {
-                               struct ndr_push *_ndr_sid;
-                               NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
-                               NDR_CHECK(ndr_push_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
-                               NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
-                       }
-                       {
-                               uint32_t _flags_save_string = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
-                               for (cntr_strings_0 = 0; cntr_strings_0 < r->num_of_strings; cntr_strings_0++) {
-                                       NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->strings[cntr_strings_0]));
-                               }
-                               ndr->flags = _flags_save_string;
-                       }
-                       {
-                               uint32_t _flags_save_string = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
-                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->raw_data));
-                               ndr->flags = _flags_save_string;
-                       }
-                       {
-                               uint32_t _flags_save_DATA_BLOB = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
-                               NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_padding));
-                               ndr->flags = _flags_save_DATA_BLOB;
-                       }
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
-               }
-               if (ndr_flags & NDR_BUFFERS) {
-               }
-               ndr->flags = _flags_save_STRUCT;
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_eventlog_Record(struct ndr_pull *ndr, int ndr_flags, struct eventlog_Record *r)
-{
-       uint32_t cntr_strings_0;
-       TALLOC_CTX *_mem_save_strings_0;
-       {
-               uint32_t _flags_save_STRUCT = ndr->flags;
-               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
-               if (ndr_flags & NDR_SCALARS) {
-                       NDR_CHECK(ndr_pull_align(ndr, 4));
-                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
-                       NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->reserved, 4, sizeof(uint8_t), CH_DOS));
-                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->record_number));
-                       NDR_CHECK(ndr_pull_time_t(ndr, NDR_SCALARS, &r->time_generated));
-                       NDR_CHECK(ndr_pull_time_t(ndr, NDR_SCALARS, &r->time_written));
-                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->event_id));
-                       NDR_CHECK(ndr_pull_eventlogEventTypes(ndr, NDR_SCALARS, &r->event_type));
-                       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->num_of_strings));
-                       if (r->num_of_strings > 256) {
-                               return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
-                       }
-                       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->event_category));
-                       NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->reserved_flags));
-                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->closing_record_number));
-                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->stringoffset));
-                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size));
-                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_offset));
-                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->data_length));
-                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->data_offset));
-                       {
-                               uint32_t _flags_save_string = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
-                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->source_name));
-                               ndr->flags = _flags_save_string;
-                       }
-                       {
-                               uint32_t _flags_save_string = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
-                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name));
-                               ndr->flags = _flags_save_string;
-                       }
-                       {
-                               struct ndr_pull *_ndr_sid;
-                               NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sid, 0, r->sid_size));
-                               NDR_CHECK(ndr_pull_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
-                               NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sid, 0, r->sid_size));
-                       }
-                       {
-                               uint32_t _flags_save_string = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
-                               NDR_PULL_ALLOC_N(ndr, r->strings, r->num_of_strings);
-                               _mem_save_strings_0 = NDR_PULL_GET_MEM_CTX(ndr);
-                               NDR_PULL_SET_MEM_CTX(ndr, r->strings, 0);
-                               for (cntr_strings_0 = 0; cntr_strings_0 < r->num_of_strings; cntr_strings_0++) {
-                                       NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->strings[cntr_strings_0]));
-                               }
-                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_strings_0, 0);
-                               ndr->flags = _flags_save_string;
-                       }
-                       {
-                               uint32_t _flags_save_string = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
-                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->raw_data));
-                               ndr->flags = _flags_save_string;
-                       }
-                       {
-                               uint32_t _flags_save_DATA_BLOB = ndr->flags;
-                               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
-                               NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_padding));
-                               ndr->flags = _flags_save_DATA_BLOB;
-                       }
-                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size2));
-               }
-               if (ndr_flags & NDR_BUFFERS) {
-               }
-               ndr->flags = _flags_save_STRUCT;
-       }
-       return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_eventlog_Record(struct ndr_print *ndr, const char *name, const struct eventlog_Record *r)
-{
-       uint32_t cntr_strings_0;
-       ndr_print_struct(ndr, name, "eventlog_Record");
-       {
-               uint32_t _flags_save_STRUCT = ndr->flags;
-               ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
-               ndr->depth++;
-               ndr_print_uint32(ndr, "size", r->size);
-               ndr_print_string(ndr, "reserved", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?"eLfL":r->reserved);
-               ndr_print_uint32(ndr, "record_number", r->record_number);
-               ndr_print_time_t(ndr, "time_generated", r->time_generated);
-               ndr_print_time_t(ndr, "time_written", r->time_written);
-               ndr_print_uint32(ndr, "event_id", r->event_id);
-               ndr_print_eventlogEventTypes(ndr, "event_type", r->event_type);
-               ndr_print_uint16(ndr, "num_of_strings", r->num_of_strings);
-               ndr_print_uint16(ndr, "event_category", r->event_category);
-               ndr_print_uint16(ndr, "reserved_flags", r->reserved_flags);
-               ndr_print_uint32(ndr, "closing_record_number", r->closing_record_number);
-               ndr_print_uint32(ndr, "stringoffset", r->stringoffset);
-               ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size);
-               ndr_print_uint32(ndr, "sid_offset", r->sid_offset);
-               ndr_print_uint32(ndr, "data_length", r->data_length);
-               ndr_print_uint32(ndr, "data_offset", r->data_offset);
-               ndr_print_string(ndr, "source_name", r->source_name);
-               ndr_print_string(ndr, "computer_name", r->computer_name);
-               ndr_print_dom_sid0(ndr, "sid", &r->sid);
-               ndr->print(ndr, "%s: ARRAY(%d)", "strings", (int)r->num_of_strings);
-               ndr->depth++;
-               for (cntr_strings_0=0;cntr_strings_0<r->num_of_strings;cntr_strings_0++) {
-                       char *idx_0=NULL;
-                       if (asprintf(&idx_0, "[%d]", cntr_strings_0) != -1) {
-                               ndr_print_string(ndr, "strings", r->strings[cntr_strings_0]);
-                               free(idx_0);
-                       }
-               }
-               ndr->depth--;
-               ndr_print_string(ndr, "raw_data", r->raw_data);
-               ndr_print_DATA_BLOB(ndr, "_padding", r->_padding);
-               ndr_print_uint32(ndr, "size2", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->size:r->size2);
-               ndr->depth--;
-               ndr->flags = _flags_save_STRUCT;
-       }
-}
-
 _PUBLIC_ enum ndr_err_code ndr_push_eventlog_Record_tdb(struct ndr_push *ndr, int ndr_flags, const struct eventlog_Record_tdb *r)
 {
        uint32_t cntr_strings_0;
@@ -2589,7 +2394,7 @@ _PUBLIC_ void ndr_print_eventlog_WriteClusterEvents(struct ndr_print *ndr, const
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_eventlog_GetLogIntormation(struct ndr_push *ndr, int flags, const struct eventlog_GetLogIntormation *r)
+static enum ndr_err_code ndr_push_eventlog_GetLogInformation(struct ndr_push *ndr, int flags, const struct eventlog_GetLogInformation *r)
 {
        if (flags & NDR_IN) {
                if (r->in.handle == NULL) {
@@ -2614,7 +2419,7 @@ static enum ndr_err_code ndr_push_eventlog_GetLogIntormation(struct ndr_push *nd
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_eventlog_GetLogIntormation(struct ndr_pull *ndr, int flags, struct eventlog_GetLogIntormation *r)
+static enum ndr_err_code ndr_pull_eventlog_GetLogInformation(struct ndr_pull *ndr, int flags, struct eventlog_GetLogInformation *r)
 {
        TALLOC_CTX *_mem_save_handle_0;
        TALLOC_CTX *_mem_save_bytes_needed_0;
@@ -2659,15 +2464,15 @@ static enum ndr_err_code ndr_pull_eventlog_GetLogIntormation(struct ndr_pull *nd
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ void ndr_print_eventlog_GetLogIntormation(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_GetLogIntormation *r)
+_PUBLIC_ void ndr_print_eventlog_GetLogInformation(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_GetLogInformation *r)
 {
-       ndr_print_struct(ndr, name, "eventlog_GetLogIntormation");
+       ndr_print_struct(ndr, name, "eventlog_GetLogInformation");
        ndr->depth++;
        if (flags & NDR_SET_VALUES) {
                ndr->flags |= LIBNDR_PRINT_SET_VALUES;
        }
        if (flags & NDR_IN) {
-               ndr_print_struct(ndr, "in", "eventlog_GetLogIntormation");
+               ndr_print_struct(ndr, "in", "eventlog_GetLogInformation");
                ndr->depth++;
                ndr_print_ptr(ndr, "handle", r->in.handle);
                ndr->depth++;
@@ -2678,7 +2483,7 @@ _PUBLIC_ void ndr_print_eventlog_GetLogIntormation(struct ndr_print *ndr, const
                ndr->depth--;
        }
        if (flags & NDR_OUT) {
-               ndr_print_struct(ndr, "out", "eventlog_GetLogIntormation");
+               ndr_print_struct(ndr, "out", "eventlog_GetLogInformation");
                ndr->depth++;
                ndr_print_ptr(ndr, "buffer", r->out.buffer);
                ndr->depth++;
@@ -3267,11 +3072,11 @@ static const struct ndr_interface_call eventlog_calls[] = {
                false,
        },
        {
-               "eventlog_GetLogIntormation",
-               sizeof(struct eventlog_GetLogIntormation),
-               (ndr_push_flags_fn_t) ndr_push_eventlog_GetLogIntormation,
-               (ndr_pull_flags_fn_t) ndr_pull_eventlog_GetLogIntormation,
-               (ndr_print_function_t) ndr_print_eventlog_GetLogIntormation,
+               "eventlog_GetLogInformation",
+               sizeof(struct eventlog_GetLogInformation),
+               (ndr_push_flags_fn_t) ndr_push_eventlog_GetLogInformation,
+               (ndr_pull_flags_fn_t) ndr_pull_eventlog_GetLogInformation,
+               (ndr_print_function_t) ndr_print_eventlog_GetLogInformation,
                false,
        },
        {
index 34e6e09637c38f4c85e11c64f651ab9142f38c83..39f5f1bbc8ca3479bef805cc15e3e9b153b3f409 100644 (file)
@@ -55,7 +55,7 @@ extern const struct ndr_interface_table ndr_table_eventlog;
 
 #define NDR_EVENTLOG_WRITECLUSTEREVENTS (0x15)
 
-#define NDR_EVENTLOG_GETLOGINTORMATION (0x16)
+#define NDR_EVENTLOG_GETLOGINFORMATION (0x16)
 
 #define NDR_EVENTLOG_FLUSHEVENTLOG (0x17)
 
@@ -67,9 +67,6 @@ enum ndr_err_code ndr_push_eventlogEventTypes(struct ndr_push *ndr, int ndr_flag
 enum ndr_err_code ndr_pull_eventlogEventTypes(struct ndr_pull *ndr, int ndr_flags, enum eventlogEventTypes *r);
 void ndr_print_eventlogEventTypes(struct ndr_print *ndr, const char *name, enum eventlogEventTypes r);
 void ndr_print_eventlog_OpenUnknown0(struct ndr_print *ndr, const char *name, const struct eventlog_OpenUnknown0 *r);
-enum ndr_err_code ndr_push_eventlog_Record(struct ndr_push *ndr, int ndr_flags, const struct eventlog_Record *r);
-enum ndr_err_code ndr_pull_eventlog_Record(struct ndr_pull *ndr, int ndr_flags, struct eventlog_Record *r);
-void ndr_print_eventlog_Record(struct ndr_print *ndr, const char *name, const struct eventlog_Record *r);
 enum ndr_err_code ndr_push_eventlog_Record_tdb(struct ndr_push *ndr, int ndr_flags, const struct eventlog_Record_tdb *r);
 enum ndr_err_code ndr_pull_eventlog_Record_tdb(struct ndr_pull *ndr, int ndr_flags, struct eventlog_Record_tdb *r);
 void ndr_print_eventlog_Record_tdb(struct ndr_print *ndr, const char *name, const struct eventlog_Record_tdb *r);
@@ -109,7 +106,7 @@ void ndr_print_eventlog_ReportEventA(struct ndr_print *ndr, const char *name, in
 void ndr_print_eventlog_RegisterClusterSvc(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_RegisterClusterSvc *r);
 void ndr_print_eventlog_DeregisterClusterSvc(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_DeregisterClusterSvc *r);
 void ndr_print_eventlog_WriteClusterEvents(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_WriteClusterEvents *r);
-void ndr_print_eventlog_GetLogIntormation(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_GetLogIntormation *r);
+void ndr_print_eventlog_GetLogInformation(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_GetLogInformation *r);
 void ndr_print_eventlog_FlushEventLog(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_FlushEventLog *r);
 void ndr_print_eventlog_ReportEventAndSourceW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ReportEventAndSourceW *r);
 #endif /* _HEADER_NDR_eventlog */
index 9ec3f35930a88a9a10a50aa50303e945d801c0ca..31220edc6223e25ec63ecff77578c5817441dd13 100644 (file)
@@ -2520,6 +2520,40 @@ _PUBLIC_ void ndr_print_spoolss_DevmodeContainer(struct ndr_print *ndr, const ch
        ndr->depth--;
 }
 
+static enum ndr_err_code ndr_push_spoolss_JobStatus(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_spoolss_JobStatus(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_spoolss_JobStatus(struct ndr_print *ndr, const char *name, uint32_t r)
+{
+       ndr_print_uint32(ndr, name, r);
+       ndr->depth++;
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_PAUSED", JOB_STATUS_PAUSED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_ERROR", JOB_STATUS_ERROR, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_DELETING", JOB_STATUS_DELETING, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_SPOOLING", JOB_STATUS_SPOOLING, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_PRINTING", JOB_STATUS_PRINTING, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_OFFLINE", JOB_STATUS_OFFLINE, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_PAPEROUT", JOB_STATUS_PAPEROUT, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_PRINTED", JOB_STATUS_PRINTED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_DELETED", JOB_STATUS_DELETED, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_BLOCKED_DEVQ", JOB_STATUS_BLOCKED_DEVQ, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_USER_INTERVENTION", JOB_STATUS_USER_INTERVENTION, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_RESTART", JOB_STATUS_RESTART, r);
+       ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "JOB_STATUS_COMPLETE", JOB_STATUS_COMPLETE, r);
+       ndr->depth--;
+}
+
 static enum ndr_err_code ndr_push_spoolss_JobInfo1(struct ndr_push *ndr, int ndr_flags, const struct spoolss_JobInfo1 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
@@ -2561,12 +2595,12 @@ static enum ndr_err_code ndr_push_spoolss_JobInfo1(struct ndr_push *ndr, int ndr
                        NDR_CHECK(ndr_push_relative_ptr1(ndr, r->text_status));
                        ndr->flags = _flags_save_string;
                }
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->status));
+               NDR_CHECK(ndr_push_spoolss_JobStatus(ndr, NDR_SCALARS, r->status));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->priority));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->position));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->total_pages));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pages_printed));
-               NDR_CHECK(ndr_push_spoolss_Time(ndr, NDR_SCALARS, &r->time));
+               NDR_CHECK(ndr_push_spoolss_Time(ndr, NDR_SCALARS, &r->submitted));
        }
        if (ndr_flags & NDR_BUFFERS) {
                {
@@ -2716,12 +2750,12 @@ static enum ndr_err_code ndr_pull_spoolss_JobInfo1(struct ndr_pull *ndr, int ndr
                        }
                        ndr->flags = _flags_save_string;
                }
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->status));
+               NDR_CHECK(ndr_pull_spoolss_JobStatus(ndr, NDR_SCALARS, &r->status));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->position));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->total_pages));
                NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pages_printed));
-               NDR_CHECK(ndr_pull_spoolss_Time(ndr, NDR_SCALARS, &r->time));
+               NDR_CHECK(ndr_pull_spoolss_Time(ndr, NDR_SCALARS, &r->submitted));
        }
        if (ndr_flags & NDR_BUFFERS) {
                {
@@ -2859,78 +2893,2593 @@ _PUBLIC_ void ndr_print_spoolss_JobInfo1(struct ndr_print *ndr, const char *name
                ndr_print_string(ndr, "text_status", r->text_status);
        }
        ndr->depth--;
-       ndr_print_uint32(ndr, "status", r->status);
+       ndr_print_spoolss_JobStatus(ndr, "status", r->status);
        ndr_print_uint32(ndr, "priority", r->priority);
        ndr_print_uint32(ndr, "position", r->position);
        ndr_print_uint32(ndr, "total_pages", r->total_pages);
        ndr_print_uint32(ndr, "pages_printed", r->pages_printed);
-       ndr_print_spoolss_Time(ndr, "time", &r->time);
+       ndr_print_spoolss_Time(ndr, "submitted", &r->submitted);
        ndr->depth--;
 }
 
-_PUBLIC_ enum ndr_err_code ndr_push_spoolss_JobInfo(struct ndr_push *ndr, int ndr_flags, const union spoolss_JobInfo *r)
+static enum ndr_err_code ndr_push_spoolss_JobInfo2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_JobInfo2 *r)
 {
-       uint32_t _save_relative_base_offset = ndr_push_get_relative_base_offset(ndr);
        if (ndr_flags & NDR_SCALARS) {
-               int level = ndr_push_get_switch_value(ndr, r);
-               switch (level) {
-                       case 1: {
-                               NDR_CHECK(ndr_push_align(ndr, 4));
-                               NDR_CHECK(ndr_push_setup_relative_base_offset1(ndr, r, ndr->offset));
-                               NDR_CHECK(ndr_push_spoolss_JobInfo1(ndr, NDR_SCALARS, &r->info1));
-                       break; }
-
-                       case 2: {
-                       break; }
-
-                       case 3: {
-                       break; }
-
-                       default: {
-                       break; }
-
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->job_id));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printer_name));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->server_name));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->user_name));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->document_name));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->notify_name));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->data_type));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->print_processor));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->parameters));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->driver_name));
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_push_relative_ptr1(ndr, r->devmode));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->text_status));
+                       ndr->flags = _flags_save_string;
                }
+               NDR_CHECK(ndr_push_relative_ptr1(ndr, r->secdesc));
+               NDR_CHECK(ndr_push_spoolss_JobStatus(ndr, NDR_SCALARS, r->status));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->priority));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->position));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->start_time));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->until_time));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->total_pages));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
+               NDR_CHECK(ndr_push_spoolss_Time(ndr, NDR_SCALARS, &r->submitted));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->time));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pages_printed));
        }
        if (ndr_flags & NDR_BUFFERS) {
-               int level = ndr_push_get_switch_value(ndr, r);
-               NDR_CHECK(ndr_push_setup_relative_base_offset2(ndr, r));
-               switch (level) {
-                       case 1:
-                               NDR_CHECK(ndr_push_spoolss_JobInfo1(ndr, NDR_BUFFERS, &r->info1));
-                       break;
-
-                       case 2:
-                       break;
-
-                       case 3:
-                       break;
-
-                       default:
-                       break;
-
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->printer_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->printer_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printer_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->server_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->server_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->server_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->user_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->user_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->document_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->document_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->document_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->notify_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->notify_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->notify_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->data_type) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->data_type));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->data_type));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->print_processor) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->print_processor));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->print_processor));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->parameters) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->parameters));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->parameters));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->driver_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->driver_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driver_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->devmode) {
+                       NDR_CHECK(ndr_push_relative_ptr2(ndr, r->devmode));
+                       NDR_CHECK(ndr_push_spoolss_DeviceMode(ndr, NDR_SCALARS, r->devmode));
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->text_status) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->text_status));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->text_status));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->secdesc) {
+                       NDR_CHECK(ndr_push_relative_ptr2(ndr, r->secdesc));
+                       NDR_CHECK(ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->secdesc));
                }
        }
-       ndr_push_restore_relative_base_offset(ndr, _save_relative_base_offset);
        return NDR_ERR_SUCCESS;
 }
 
-_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_JobInfo(struct ndr_pull *ndr, int ndr_flags, union spoolss_JobInfo *r)
+static enum ndr_err_code ndr_pull_spoolss_JobInfo2(struct ndr_pull *ndr, int ndr_flags, struct spoolss_JobInfo2 *r)
 {
-       uint32_t _save_relative_base_offset = ndr_pull_get_relative_base_offset(ndr);
-       int level;
-       level = ndr_pull_get_switch_value(ndr, r);
+       uint32_t _ptr_printer_name;
+       TALLOC_CTX *_mem_save_printer_name_0;
+       uint32_t _ptr_server_name;
+       TALLOC_CTX *_mem_save_server_name_0;
+       uint32_t _ptr_user_name;
+       TALLOC_CTX *_mem_save_user_name_0;
+       uint32_t _ptr_document_name;
+       TALLOC_CTX *_mem_save_document_name_0;
+       uint32_t _ptr_notify_name;
+       TALLOC_CTX *_mem_save_notify_name_0;
+       uint32_t _ptr_data_type;
+       TALLOC_CTX *_mem_save_data_type_0;
+       uint32_t _ptr_print_processor;
+       TALLOC_CTX *_mem_save_print_processor_0;
+       uint32_t _ptr_parameters;
+       TALLOC_CTX *_mem_save_parameters_0;
+       uint32_t _ptr_driver_name;
+       TALLOC_CTX *_mem_save_driver_name_0;
+       uint32_t _ptr_devmode;
+       TALLOC_CTX *_mem_save_devmode_0;
+       uint32_t _ptr_text_status;
+       TALLOC_CTX *_mem_save_text_status_0;
+       uint32_t _ptr_secdesc;
+       TALLOC_CTX *_mem_save_secdesc_0;
        if (ndr_flags & NDR_SCALARS) {
-               switch (level) {
-                       case 1: {
-                               NDR_CHECK(ndr_pull_align(ndr, 4));
-                               NDR_CHECK(ndr_pull_setup_relative_base_offset1(ndr, r, ndr->offset));
-                               NDR_CHECK(ndr_pull_spoolss_JobInfo1(ndr, NDR_SCALARS, &r->info1));
-                       break; }
-
-                       case 2: {
-                       break; }
-
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->job_id));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_printer_name));
+                       if (_ptr_printer_name) {
+                               NDR_PULL_ALLOC(ndr, r->printer_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->printer_name, _ptr_printer_name));
+                       } else {
+                               r->printer_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+                       if (_ptr_server_name) {
+                               NDR_PULL_ALLOC(ndr, r->server_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->server_name, _ptr_server_name));
+                       } else {
+                               r->server_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_user_name));
+                       if (_ptr_user_name) {
+                               NDR_PULL_ALLOC(ndr, r->user_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->user_name, _ptr_user_name));
+                       } else {
+                               r->user_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_document_name));
+                       if (_ptr_document_name) {
+                               NDR_PULL_ALLOC(ndr, r->document_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->document_name, _ptr_document_name));
+                       } else {
+                               r->document_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_notify_name));
+                       if (_ptr_notify_name) {
+                               NDR_PULL_ALLOC(ndr, r->notify_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->notify_name, _ptr_notify_name));
+                       } else {
+                               r->notify_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data_type));
+                       if (_ptr_data_type) {
+                               NDR_PULL_ALLOC(ndr, r->data_type);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->data_type, _ptr_data_type));
+                       } else {
+                               r->data_type = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_print_processor));
+                       if (_ptr_print_processor) {
+                               NDR_PULL_ALLOC(ndr, r->print_processor);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->print_processor, _ptr_print_processor));
+                       } else {
+                               r->print_processor = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_parameters));
+                       if (_ptr_parameters) {
+                               NDR_PULL_ALLOC(ndr, r->parameters);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->parameters, _ptr_parameters));
+                       } else {
+                               r->parameters = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_driver_name));
+                       if (_ptr_driver_name) {
+                               NDR_PULL_ALLOC(ndr, r->driver_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->driver_name, _ptr_driver_name));
+                       } else {
+                               r->driver_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_devmode));
+               if (_ptr_devmode) {
+                       NDR_PULL_ALLOC(ndr, r->devmode);
+                       NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->devmode, _ptr_devmode));
+               } else {
+                       r->devmode = NULL;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_text_status));
+                       if (_ptr_text_status) {
+                               NDR_PULL_ALLOC(ndr, r->text_status);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->text_status, _ptr_text_status));
+                       } else {
+                               r->text_status = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_secdesc));
+               if (_ptr_secdesc) {
+                       NDR_PULL_ALLOC(ndr, r->secdesc);
+                       NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->secdesc, _ptr_secdesc));
+               } else {
+                       r->secdesc = NULL;
+               }
+               NDR_CHECK(ndr_pull_spoolss_JobStatus(ndr, NDR_SCALARS, &r->status));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->position));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->start_time));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->until_time));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->total_pages));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
+               NDR_CHECK(ndr_pull_spoolss_Time(ndr, NDR_SCALARS, &r->submitted));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->time));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pages_printed));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->printer_name) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->printer_name));
+                               _mem_save_printer_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->printer_name, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->printer_name));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_printer_name_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->server_name) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->server_name));
+                               _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->server_name, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->server_name));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->user_name) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->user_name));
+                               _mem_save_user_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->user_name, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_name_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->document_name) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->document_name));
+                               _mem_save_document_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->document_name, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->document_name));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_document_name_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->notify_name) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->notify_name));
+                               _mem_save_notify_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->notify_name, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->notify_name));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_notify_name_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->data_type) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->data_type));
+                               _mem_save_data_type_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->data_type, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->data_type));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_type_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->print_processor) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->print_processor));
+                               _mem_save_print_processor_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->print_processor, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->print_processor));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_print_processor_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->parameters) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->parameters));
+                               _mem_save_parameters_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->parameters, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->parameters));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_parameters_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->driver_name) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->driver_name));
+                               _mem_save_driver_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->driver_name, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driver_name));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_driver_name_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->devmode) {
+                       uint32_t _relative_save_offset;
+                       _relative_save_offset = ndr->offset;
+                       NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->devmode));
+                       _mem_save_devmode_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->devmode, 0);
+                       NDR_CHECK(ndr_pull_spoolss_DeviceMode(ndr, NDR_SCALARS, r->devmode));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_devmode_0, 0);
+                       ndr->offset = _relative_save_offset;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->text_status) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->text_status));
+                               _mem_save_text_status_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->text_status, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->text_status));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_text_status_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->secdesc) {
+                       uint32_t _relative_save_offset;
+                       _relative_save_offset = ndr->offset;
+                       NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->secdesc));
+                       _mem_save_secdesc_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->secdesc, 0);
+                       NDR_CHECK(ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->secdesc));
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_secdesc_0, 0);
+                       ndr->offset = _relative_save_offset;
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_spoolss_JobInfo2(struct ndr_print *ndr, const char *name, const struct spoolss_JobInfo2 *r)
+{
+       ndr_print_struct(ndr, name, "spoolss_JobInfo2");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "job_id", r->job_id);
+       ndr_print_ptr(ndr, "printer_name", r->printer_name);
+       ndr->depth++;
+       if (r->printer_name) {
+               ndr_print_string(ndr, "printer_name", r->printer_name);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "server_name", r->server_name);
+       ndr->depth++;
+       if (r->server_name) {
+               ndr_print_string(ndr, "server_name", r->server_name);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "user_name", r->user_name);
+       ndr->depth++;
+       if (r->user_name) {
+               ndr_print_string(ndr, "user_name", r->user_name);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "document_name", r->document_name);
+       ndr->depth++;
+       if (r->document_name) {
+               ndr_print_string(ndr, "document_name", r->document_name);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "notify_name", r->notify_name);
+       ndr->depth++;
+       if (r->notify_name) {
+               ndr_print_string(ndr, "notify_name", r->notify_name);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "data_type", r->data_type);
+       ndr->depth++;
+       if (r->data_type) {
+               ndr_print_string(ndr, "data_type", r->data_type);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "print_processor", r->print_processor);
+       ndr->depth++;
+       if (r->print_processor) {
+               ndr_print_string(ndr, "print_processor", r->print_processor);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "parameters", r->parameters);
+       ndr->depth++;
+       if (r->parameters) {
+               ndr_print_string(ndr, "parameters", r->parameters);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "driver_name", r->driver_name);
+       ndr->depth++;
+       if (r->driver_name) {
+               ndr_print_string(ndr, "driver_name", r->driver_name);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "devmode", r->devmode);
+       ndr->depth++;
+       if (r->devmode) {
+               ndr_print_spoolss_DeviceMode(ndr, "devmode", r->devmode);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "text_status", r->text_status);
+       ndr->depth++;
+       if (r->text_status) {
+               ndr_print_string(ndr, "text_status", r->text_status);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "secdesc", r->secdesc);
+       ndr->depth++;
+       if (r->secdesc) {
+               ndr_print_security_descriptor(ndr, "secdesc", r->secdesc);
+       }
+       ndr->depth--;
+       ndr_print_spoolss_JobStatus(ndr, "status", r->status);
+       ndr_print_uint32(ndr, "priority", r->priority);
+       ndr_print_uint32(ndr, "position", r->position);
+       ndr_print_uint32(ndr, "start_time", r->start_time);
+       ndr_print_uint32(ndr, "until_time", r->until_time);
+       ndr_print_uint32(ndr, "total_pages", r->total_pages);
+       ndr_print_uint32(ndr, "size", r->size);
+       ndr_print_spoolss_Time(ndr, "submitted", &r->submitted);
+       ndr_print_uint32(ndr, "time", r->time);
+       ndr_print_uint32(ndr, "pages_printed", r->pages_printed);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_spoolss_JobInfo3(struct ndr_push *ndr, int ndr_flags, const struct spoolss_JobInfo3 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->job_id));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->next_job_id));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->reserved));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_spoolss_JobInfo3(struct ndr_pull *ndr, int ndr_flags, struct spoolss_JobInfo3 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->job_id));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->next_job_id));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->reserved));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_spoolss_JobInfo3(struct ndr_print *ndr, const char *name, const struct spoolss_JobInfo3 *r)
+{
+       ndr_print_struct(ndr, name, "spoolss_JobInfo3");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "job_id", r->job_id);
+       ndr_print_uint32(ndr, "next_job_id", r->next_job_id);
+       ndr_print_uint32(ndr, "reserved", r->reserved);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_spoolss_JobInfo4(struct ndr_push *ndr, int ndr_flags, const struct spoolss_JobInfo4 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->job_id));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printer_name));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->server_name));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->user_name));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->document_name));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->notify_name));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->data_type));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->print_processor));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->parameters));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->driver_name));
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_push_relative_ptr1(ndr, r->devmode));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->text_status));
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_push_relative_ptr1(ndr, r->secdesc));
+               NDR_CHECK(ndr_push_spoolss_JobStatus(ndr, NDR_SCALARS, r->status));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->priority));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->position));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->start_time));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->until_time));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->total_pages));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
+               NDR_CHECK(ndr_push_spoolss_Time(ndr, NDR_SCALARS, &r->submitted));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->time));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pages_printed));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size_high));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->printer_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->printer_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printer_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->server_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->server_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->server_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->user_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->user_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->document_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->document_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->document_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->notify_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->notify_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->notify_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->data_type) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->data_type));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->data_type));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->print_processor) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->print_processor));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->print_processor));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->parameters) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->parameters));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->parameters));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->driver_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->driver_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driver_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->devmode) {
+                       NDR_CHECK(ndr_push_relative_ptr2(ndr, r->devmode));
+                       NDR_CHECK(ndr_push_spoolss_DeviceMode(ndr, NDR_SCALARS, r->devmode));
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->text_status) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->text_status));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->text_status));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->secdesc) {
+                       NDR_CHECK(ndr_push_relative_ptr2(ndr, r->secdesc));
+                       NDR_CHECK(ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->secdesc));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_spoolss_JobInfo4(struct ndr_pull *ndr, int ndr_flags, struct spoolss_JobInfo4 *r)
+{
+       uint32_t _ptr_printer_name;
+       TALLOC_CTX *_mem_save_printer_name_0;
+       uint32_t _ptr_server_name;
+       TALLOC_CTX *_mem_save_server_name_0;
+       uint32_t _ptr_user_name;
+       TALLOC_CTX *_mem_save_user_name_0;
+       uint32_t _ptr_document_name;
+       TALLOC_CTX *_mem_save_document_name_0;
+       uint32_t _ptr_notify_name;
+       TALLOC_CTX *_mem_save_notify_name_0;
+       uint32_t _ptr_data_type;
+       TALLOC_CTX *_mem_save_data_type_0;
+       uint32_t _ptr_print_processor;
+       TALLOC_CTX *_mem_save_print_processor_0;
+       uint32_t _ptr_parameters;
+       TALLOC_CTX *_mem_save_parameters_0;
+       uint32_t _ptr_driver_name;
+       TALLOC_CTX *_mem_save_driver_name_0;
+       uint32_t _ptr_devmode;
+       TALLOC_CTX *_mem_save_devmode_0;
+       uint32_t _ptr_text_status;
+       TALLOC_CTX *_mem_save_text_status_0;
+       uint32_t _ptr_secdesc;
+       TALLOC_CTX *_mem_save_secdesc_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->job_id));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_printer_name));
+                       if (_ptr_printer_name) {
+                               NDR_PULL_ALLOC(ndr, r->printer_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->printer_name, _ptr_printer_name));
+                       } else {
+                               r->printer_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name));
+                       if (_ptr_server_name) {
+                               NDR_PULL_ALLOC(ndr, r->server_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->server_name, _ptr_server_name));
+                       } else {
+                               r->server_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_user_name));
+                       if (_ptr_user_name) {
+                               NDR_PULL_ALLOC(ndr, r->user_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->user_name, _ptr_user_name));
+                       } else {
+                               r->user_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_document_name));
+                       if (_ptr_document_name) {
+                               NDR_PULL_ALLOC(ndr, r->document_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->document_name, _ptr_document_name));
+                       } else {
+                               r->document_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_notify_name));
+                       if (_ptr_notify_name) {
+                               NDR_PULL_ALLOC(ndr, r->notify_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->notify_name, _ptr_notify_name));
+                       } else {
+                               r->notify_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data_type));
+                       if (_ptr_data_type) {
+                               NDR_PULL_ALLOC(ndr, r->data_type);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->data_type, _ptr_data_type));
+                       } else {
+                               r->data_type = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_print_processor));
+                       if (_ptr_print_processor) {
+                               NDR_PULL_ALLOC(ndr, r->print_processor);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->print_processor, _ptr_print_processor));
+                       } else {
+                               r->print_processor = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_parameters));
+                       if (_ptr_parameters) {
+                               NDR_PULL_ALLOC(ndr, r->parameters);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->parameters, _ptr_parameters));
+                       } else {
+                               r->parameters = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_driver_name));
+                       if (_ptr_driver_name) {
+                               NDR_PULL_ALLOC(ndr, r->driver_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->driver_name, _ptr_driver_name));
+                       } else {
+                               r->driver_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_devmode));
+               if (_ptr_devmode) {
+                       NDR_PULL_ALLOC(ndr, r->devmode);
+                       NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->devmode, _ptr_devmode));
+               } else {
+                       r->devmode = NULL;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_text_status));
+                       if (_ptr_text_status) {
+                               NDR_PULL_ALLOC(ndr, r->text_status);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->text_status, _ptr_text_status));
+                       } else {
+                               r->text_status = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_secdesc));
+               if (_ptr_secdesc) {
+                       NDR_PULL_ALLOC(ndr, r->secdesc);
+                       NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->secdesc, _ptr_secdesc));
+               } else {
+                       r->secdesc = NULL;
+               }
+               NDR_CHECK(ndr_pull_spoolss_JobStatus(ndr, NDR_SCALARS, &r->status));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->priority));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->position));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->start_time));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->until_time));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->total_pages));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
+  &