Merge branch 'master' of ssh://git.samba.org/data/git/samba
authorJelmer Vernooij <jelmer@samba.org>
Wed, 25 Feb 2009 11:49:37 +0000 (12:49 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 25 Feb 2009 11:49:37 +0000 (12:49 +0100)
Conflicts:
source4/scripting/python/samba/provision.py

115 files changed:
WHATSNEW4.txt
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/tevent/tevent.h
lib/util/become_daemon.c
lib/util/system.c
lib/util/tevent_unix.c [new file with mode: 0644]
lib/util/tevent_unix.h [new file with mode: 0644]
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
librpc/gen_ndr/cli_spoolss.c
librpc/gen_ndr/cli_spoolss.h
librpc/gen_ndr/ndr_spoolss.c
librpc/gen_ndr/ndr_spoolss.h
librpc/gen_ndr/spoolss.h
librpc/gen_ndr/srv_spoolss.c
librpc/idl/spoolss.idl
librpc/ndr/ndr_spoolss_buf.c
librpc/ndr/ndr_spoolss_buf.h
pidl/lib/Parse/Pidl/Samba4/Python.pm
selftest/target/Samba4.pm
source3/Makefile.in
source3/auth/auth_wbc.c [moved from source3/auth/auth_onefs_wb.c with 74% similarity]
source3/client/client.c
source3/client/mount.cifs.c
source3/configure.in
source3/include/includes.h
source3/include/proto.h
source3/include/rpc_spoolss.h
source3/include/smbprofile.h
source3/lib/fault.c
source3/lib/ldap_debug_handler.c
source3/lib/secdesc.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/wb_reqtrans.c
source3/lib/wbclient.c
source3/libsmb/cliconnect.c
source3/libsmb/libsmb_dir.c
source3/libsmb/nmblib.c
source3/modules/onefs.h
source3/modules/onefs_acl.c
source3/modules/onefs_cbrl.c
source3/modules/onefs_streams.c
source3/modules/onefs_system.c
source3/modules/vfs_extd_audit.c
source3/nmbd/nmbd.c
source3/passdb/pdb_wbc_sam.c [moved from source3/passdb/pdb_onefs_sam.c with 65% similarity]
source3/printing/notify.c
source3/printing/nt_printing.c
source3/profile/profile.c
source3/rpc_client/cli_spoolss.c
source3/rpc_parse/parse_spoolss.c
source3/rpc_server/srv_pipe_hnd.c
source3/rpc_server/srv_spoolss_nt.c
source3/rpcclient/cmd_spoolss.c
source3/smbd/open.c
source3/smbd/oplock_onefs.c
source3/smbd/posix_acls.c
source3/smbd/server.c
source3/smbd/sesssetup.c
source3/smbd/trans2.c
source3/utils/net_rpc_printer.c
source3/utils/smbfilter.c
source3/utils/smbget.c
source3/winbindd/winbindd.c
source3/winbindd/winbindd_cache.c
source3/winbindd/winbindd_dual.c
source4/build/m4/public.m4
source4/client/mount.cifs.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/ldap_server/ldap_server.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/rpc_server/netlogon/dcerpc_netlogon.c
source4/scripting/python/samba/provision.py
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/torture/raw/streams.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 5845f62e341762edee987ca3a805a705012a0cce..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)
index 7036c730dd6673974f32f50b4a337eb4c5e5e7c7..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)
index 02ae88068380406366af07c4f6f665f668e31a73..3563421e0e56c62363ab752e55db3ea788db2136 100644 (file)
@@ -22,6 +22,7 @@
 #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
  */
 enum async_syscall_type {
        ASYNC_SYSCALL_SEND,
-       ASYNC_SYSCALL_SENDALL,
        ASYNC_SYSCALL_RECV,
-       ASYNC_SYSCALL_RECVALL,
-       ASYNC_SYSCALL_CONNECT
 };
 
 /**
@@ -54,36 +52,12 @@ struct async_syscall_state {
                        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 {
@@ -336,109 +310,6 @@ struct async_req *async_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        return result;
 }
 
-/**
- * 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;
-       }
-
-       if (p->sent == p->length) {
-               TALLOC_FREE(state->fde);
-               async_req_done(req);
-       }
-}
-
-/**
- * @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 async_req *result;
-       struct async_syscall_state *state;
-
-       result = async_fde_syscall_new(
-               mem_ctx, ev, ASYNC_SYSCALL_SENDALL,
-               fd, TEVENT_FD_WRITE, async_sendall_callback,
-               &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
@@ -507,106 +378,138 @@ struct async_req *async_recv(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
        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
- */
+struct async_send_state {
+       int fd;
+       const void *buf;
+       size_t len;
+       int flags;
+       ssize_t sent;
+};
 
-static void async_recvall_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 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 *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;
+       struct tevent_req *result;
+       struct async_send_state *state;
+       struct tevent_fd *fde;
 
-       if (state->syscall_type != ASYNC_SYSCALL_RECVALL) {
-               async_req_error(req, EIO);
-               return;
+       result = tevent_req_create(mem_ctx, &state, struct async_send_state);
+       if (result == NULL) {
+               return result;
        }
+       state->fd = fd;
+       state->buf = buf;
+       state->len = len;
+       state->flags = flags;
 
-       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);
-               return;
+       fde = tevent_add_fd(ev, state, fd, TEVENT_FD_WRITE, async_send_handler,
+                           result);
+       if (fde == NULL) {
+               TALLOC_FREE(result);
+               return NULL;
        }
+       return result;
+}
 
-       if (state->result.result_ssize_t == 0) {
-               async_req_error(req, EIO);
+static void async_send_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 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;
        }
+       tevent_req_done(req);
+}
 
-       p->received += state->result.result_ssize_t;
-       if (p->received > p->length) {
-               async_req_error(req, EIO);
-               return;
-       }
+ssize_t async_send_recv(struct tevent_req *req, int *perrno)
+{
+       struct async_send_state *state = talloc_get_type_abort(
+               req->private_state, struct async_send_state);
 
-       if (p->received == p->length) {
-               TALLOC_FREE(state->fde);
-               async_req_done(req);
+       if (tevent_req_is_unix_error(req, perrno)) {
+               return -1;
        }
+       return state->sent;
 }
 
-/**
- * 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_recv_state {
+       int fd;
+       void *buf;
+       size_t len;
+       int flags;
+       ssize_t received;
+};
 
-struct async_req *recvall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-                              int fd, void *buffer, size_t length,
-                              int flags)
+static void async_recv_handler(struct tevent_context *ev,
+                              struct tevent_fd *fde,
+                              uint16_t flags, void *private_data);
+
+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_RECVALL,
-               fd, TEVENT_FD_READ, async_recvall_callback,
-               &state);
+       result = tevent_req_create(mem_ctx, &state, struct async_recv_state);
        if (result == NULL) {
-               return NULL;
+               return result;
        }
+       state->fd = fd;
+       state->buf = buf;
+       state->len = len;
+       state->flags = flags;
 
-       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;
-
+       fde = tevent_add_fd(ev, state, fd, TEVENT_FD_READ, async_recv_handler,
+                           result);
+       if (fde == NULL) {
+               TALLOC_FREE(result);
+               return NULL;
+       }
        return result;
 }
 
-ssize_t recvall_recv(struct async_req *req, int *perr)
+static void async_recv_handler(struct tevent_context *ev,
+                              struct tevent_fd *fde,
+                              uint16_t flags, void *private_data)
 {
-       struct async_syscall_state *state = talloc_get_type_abort(
-               req->private_data, struct async_syscall_state);
-       int err;
+       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;
+       }
+       tevent_req_done(req);
+}
 
-       err = async_req_simple_recv_errno(req);
+ssize_t async_recv_recv(struct tevent_req *req, int *perrno)
+{
+       struct async_recv_state *state = talloc_get_type_abort(
+               req->private_state, struct async_recv_state);
 
-       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 +536,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 +568,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;
+               errno = 0;
+               goto post_errno;
        }
 
        /**
@@ -686,22 +590,20 @@ struct async_req *async_connect_send(TALLOC_CTX *mem_ctx,
        fde = tevent_add_fd(ev, state, fd, TEVENT_FD_READ | TEVENT_FD_WRITE,
                           async_connect_connected, result);
        if (fde == NULL) {
-               state->sys_errno = ENOMEM;
-               goto post_status;
+               errno = ENOMEM;
+               goto post_errno;
        }
        return result;
 
  post_errno:
        state->sys_errno = errno;
- post_status:
        fcntl(fd, F_SETFL, state->old_sockflags);
-       if (!async_post_error(result, ev, state->sys_errno)) {
-               goto fail;
+       if (state->sys_errno == 0) {
+               tevent_req_done(result);
+       } else {
+               tevent_req_error(result, state->sys_errno);
        }
-       return result;
- fail:
-       TALLOC_FREE(result);
-       return NULL;
+       return tevent_req_post(result, ev);
 }
 
 /**
@@ -716,10 +618,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 +645,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 +673,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..bfc4346d39a03b52753efdcb52429c167da596eb 100644 (file)
@@ -35,20 +35,36 @@ struct async_req *async_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 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 16fac7327f05b73db3e587b69e924456457b16d3..b3d1c6d59a52d8903cab44ea48c6c9690e6ba185 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;
index 5a97b65407c62b506ea29e81881363dcbdda99a7..3d06a4363df9b9097ac8dabe04e78de196ee0b95 100644 (file)
@@ -66,10 +66,10 @@ _PUBLIC_ void close_low_fds(bool stderr_too)
  Become a daemon, discarding the controlling terminal.
 ****************************************************************************/
 
-_PUBLIC_ void become_daemon(bool Fork, bool no_process_group)
+_PUBLIC_ void become_daemon(bool do_fork, bool no_process_group)
 {
-       if (Fork) {
-               if (fork()) {
+       if (do_fork) {
+               if (sys_fork()) {
                        _exit(0);
                }
        }
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_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 d3e446f488c1923ffc51b062a2be7d3546c1da91..27f94cd68583c4bcdc1f03b01dcdee1dd2f88bfe 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  */
 
 /**
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 226c2f950d50b9e595a4f633d563d532fae1eaf3..1044ab351a125f55bc2dba637a3da552eff46fb2 100644 (file)
@@ -169,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 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 242041fb8d2bb7757c45cc182f40828763756237..fdafa2582b5bde60de8fb65cd45fb8ae405e5a96 100644 (file)
@@ -3867,36 +3867,20 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo3(struct ndr_push *ndr,
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
-               NDR_CHECK(ndr_push_unique_ptr(ndr, r->secdesc));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sec_desc_ptr));
        }
        if (ndr_flags & NDR_BUFFERS) {
-               if (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_SetPrinterInfo3(struct ndr_pull *ndr, int ndr_flags, struct spoolss_SetPrinterInfo3 *r)
 {
-       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_generic_ptr(ndr, &_ptr_secdesc));
-               if (_ptr_secdesc) {
-                       NDR_PULL_ALLOC(ndr, r->secdesc);
-               } else {
-                       r->secdesc = NULL;
-               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sec_desc_ptr));
        }
        if (ndr_flags & NDR_BUFFERS) {
-               if (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);
-               }
        }
        return NDR_ERR_SUCCESS;
 }
@@ -3905,12 +3889,7 @@ _PUBLIC_ void ndr_print_spoolss_SetPrinterInfo3(struct ndr_print *ndr, const cha
 {
        ndr_print_struct(ndr, name, "spoolss_SetPrinterInfo3");
        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_uint32(ndr, "sec_desc_ptr", r->sec_desc_ptr);
        ndr->depth--;
 }
 
@@ -4279,7 +4258,7 @@ static enum ndr_err_code ndr_push_spoolss_SetPrinterInfo(struct ndr_push *ndr, i
 
                        case 3:
                                if (r->info3) {
-                                       NDR_CHECK(ndr_push_spoolss_SetPrinterInfo3(ndr, NDR_SCALARS|NDR_BUFFERS, r->info3));
+                                       NDR_CHECK(ndr_push_spoolss_SetPrinterInfo3(ndr, NDR_SCALARS, r->info3));
                                }
                        break;
 
@@ -4486,7 +4465,7 @@ static enum ndr_err_code ndr_pull_spoolss_SetPrinterInfo(struct ndr_pull *ndr, i
                                if (r->info3) {
                                        _mem_save_info3_0 = NDR_PULL_GET_MEM_CTX(ndr);
                                        NDR_PULL_SET_MEM_CTX(ndr, r->info3, 0);
-                                       NDR_CHECK(ndr_pull_spoolss_SetPrinterInfo3(ndr, NDR_SCALARS|NDR_BUFFERS, r->info3));
+                                       NDR_CHECK(ndr_pull_spoolss_SetPrinterInfo3(ndr, NDR_SCALARS, r->info3));
                                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info3_0, 0);
                                }
                        break;
@@ -4796,13 +4775,13 @@ _PUBLIC_ void ndr_print_spoolss_AddDriverInfo1(struct ndr_print *ndr, const char
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_spoolss_DriverOSVersion(struct ndr_push *ndr, int ndr_flags, enum spoolss_DriverOSVersion r)
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverOSVersion(struct ndr_push *ndr, int ndr_flags, enum spoolss_DriverOSVersion r)
 {
        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_spoolss_DriverOSVersion(struct ndr_pull *ndr, int ndr_flags, enum spoolss_DriverOSVersion *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverOSVersion(struct ndr_pull *ndr, int ndr_flags, enum spoolss_DriverOSVersion *r)
 {
        uint32_t v;
        NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
@@ -5704,7 +5683,7 @@ static enum ndr_err_code ndr_push_spoolss_AddDriverInfo6(struct ndr_push *ndr, i
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->dependent_files));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ((ndr_size_spoolss_StringArray(r->previous_names, ndr->iconv_convenience, ndr->flags) - 4) / 2)));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->previous_names));
-               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_data));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
                NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->manufacturer_name));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->manufacturer_url));
@@ -5889,7 +5868,7 @@ static enum ndr_err_code ndr_pull_spoolss_AddDriverInfo6(struct ndr_pull *ndr, i
                } else {
                        r->previous_names = NULL;
                }
-               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_data));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
                NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
                if (_ptr_manufacturer_name) {
@@ -6144,7 +6123,7 @@ _PUBLIC_ void ndr_print_spoolss_AddDriverInfo6(struct ndr_print *ndr, const char
                ndr_print_spoolss_StringArray(ndr, "previous_names", r->previous_names);
        }
        ndr->depth--;
-       ndr_print_NTTIME(ndr, "driver_data", r->driver_data);
+       ndr_print_NTTIME(ndr, "driver_date", r->driver_date);
        ndr_print_hyper(ndr, "driver_version", r->driver_version);
        ndr_print_ptr(ndr, "manufacturer_name", r->manufacturer_name);
        ndr->depth++;
@@ -6190,7 +6169,7 @@ static enum ndr_err_code ndr_push_spoolss_AddDriverInfo8(struct ndr_push *ndr, i
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->dependent_files));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ((ndr_size_spoolss_StringArray(r->previous_names, ndr->iconv_convenience, ndr->flags) - 4) / 2)));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->previous_names));
-               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_data));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
                NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->manufacturer_name));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->manufacturer_url));
@@ -6419,7 +6398,7 @@ static enum ndr_err_code ndr_pull_spoolss_AddDriverInfo8(struct ndr_pull *ndr, i
                } else {
                        r->previous_names = NULL;
                }
-               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_data));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
                NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
                if (_ptr_manufacturer_name) {
@@ -6757,7 +6736,7 @@ _PUBLIC_ void ndr_print_spoolss_AddDriverInfo8(struct ndr_print *ndr, const char
                ndr_print_spoolss_StringArray(ndr, "previous_names", r->previous_names);
        }
        ndr->depth--;
-       ndr_print_NTTIME(ndr, "driver_data", r->driver_data);
+       ndr_print_NTTIME(ndr, "driver_date", r->driver_date);
        ndr_print_hyper(ndr, "driver_version", r->driver_version);
        ndr_print_ptr(ndr, "manufacturer_name", r->manufacturer_name);
        ndr->depth++;
@@ -7148,7 +7127,7 @@ _PUBLIC_ void ndr_print_spoolss_AddDriverInfoCtr(struct ndr_print *ndr, const ch
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_spoolss_DriverInfo1(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo1 *r)
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo1(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo1 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
@@ -7173,7 +7152,7 @@ static enum ndr_err_code ndr_push_spoolss_DriverInfo1(struct ndr_push *ndr, int
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_spoolss_DriverInfo1(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo1 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo1(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo1 *r)
 {
        uint32_t _ptr_driver_name;
        TALLOC_CTX *_mem_save_driver_name_0;
@@ -7225,7 +7204,12 @@ _PUBLIC_ void ndr_print_spoolss_DriverInfo1(struct ndr_print *ndr, const char *n
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_spoolss_DriverInfo2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo2 *r)
+_PUBLIC_ size_t ndr_size_spoolss_DriverInfo1(const struct spoolss_DriverInfo1 *r, struct smb_iconv_convenience *ic, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_DriverInfo1, ic);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo2 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
@@ -7311,7 +7295,7 @@ static enum ndr_err_code ndr_push_spoolss_DriverInfo2(struct ndr_push *ndr, int
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_spoolss_DriverInfo2(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo2 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo2(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo2 *r)
 {
        uint32_t _ptr_driver_name;
        TALLOC_CTX *_mem_save_driver_name_0;
@@ -7505,7 +7489,12 @@ _PUBLIC_ void ndr_print_spoolss_DriverInfo2(struct ndr_print *ndr, const char *n
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_spoolss_DriverInfo3(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo3 *r)
+_PUBLIC_ size_t ndr_size_spoolss_DriverInfo2(const struct spoolss_DriverInfo2 *r, struct smb_iconv_convenience *ic, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_DriverInfo2, ic);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo3(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo3 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
@@ -7651,7 +7640,7 @@ static enum ndr_err_code ndr_push_spoolss_DriverInfo3(struct ndr_push *ndr, int
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_spoolss_DriverInfo3(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo3 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo3(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo3 *r)
 {
        uint32_t _ptr_driver_name;
        TALLOC_CTX *_mem_save_driver_name_0;
@@ -7985,7 +7974,12 @@ _PUBLIC_ void ndr_print_spoolss_DriverInfo3(struct ndr_print *ndr, const char *n
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_spoolss_DriverInfo4(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo4 *r)
+_PUBLIC_ size_t ndr_size_spoolss_DriverInfo3(const struct spoolss_DriverInfo3 *r, struct smb_iconv_convenience *ic, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_DriverInfo3, ic);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo4(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo4 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
@@ -8146,7 +8140,7 @@ static enum ndr_err_code ndr_push_spoolss_DriverInfo4(struct ndr_push *ndr, int
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_spoolss_DriverInfo4(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo4 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo4(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo4 *r)
 {
        uint32_t _ptr_driver_name;
        TALLOC_CTX *_mem_save_driver_name_0;
@@ -8515,7 +8509,12 @@ _PUBLIC_ void ndr_print_spoolss_DriverInfo4(struct ndr_print *ndr, const char *n
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_spoolss_DriverInfo5(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo5 *r)
+_PUBLIC_ size_t ndr_size_spoolss_DriverInfo4(const struct spoolss_DriverInfo4 *r, struct smb_iconv_convenience *ic, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_DriverInfo4, ic);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo5(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo5 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
@@ -8604,7 +8603,7 @@ static enum ndr_err_code ndr_push_spoolss_DriverInfo5(struct ndr_push *ndr, int
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_spoolss_DriverInfo5(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo5 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo5(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo5 *r)
 {
        uint32_t _ptr_driver_name;
        TALLOC_CTX *_mem_save_driver_name_0;
@@ -8804,7 +8803,12 @@ _PUBLIC_ void ndr_print_spoolss_DriverInfo5(struct ndr_print *ndr, const char *n
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_spoolss_DriverInfo6(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo6 *r)
+_PUBLIC_ size_t ndr_size_spoolss_DriverInfo5(const struct spoolss_DriverInfo5 *r, struct smb_iconv_convenience *ic, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_DriverInfo5, ic);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo6(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo6 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 8));
@@ -8869,7 +8873,7 @@ static enum ndr_err_code ndr_push_spoolss_DriverInfo6(struct ndr_push *ndr, int
                        NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous_names));
                        ndr->flags = _flags_save_string_array;
                }
-               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_data));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
                NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
                {
                        uint32_t _flags_save_string = ndr->flags;
@@ -9027,7 +9031,7 @@ static enum ndr_err_code ndr_push_spoolss_DriverInfo6(struct ndr_push *ndr, int
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_spoolss_DriverInfo6(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo6 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo6(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo6 *r)
 {
        uint32_t _ptr_driver_name;
        TALLOC_CTX *_mem_save_driver_name_0;
@@ -9180,7 +9184,7 @@ static enum ndr_err_code ndr_pull_spoolss_DriverInfo6(struct ndr_pull *ndr, int
                        }
                        ndr->flags = _flags_save_string_array;
                }
-               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_data));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
                NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
                {
                        uint32_t _flags_save_string = ndr->flags;
@@ -9511,7 +9515,7 @@ _PUBLIC_ void ndr_print_spoolss_DriverInfo6(struct ndr_print *ndr, const char *n
                ndr_print_string_array(ndr, "previous_names", r->previous_names);
        }
        ndr->depth--;
-       ndr_print_NTTIME(ndr, "driver_data", r->driver_data);
+       ndr_print_NTTIME(ndr, "driver_date", r->driver_date);
        ndr_print_hyper(ndr, "driver_version", r->driver_version);
        ndr_print_ptr(ndr, "manufacturer_name", r->manufacturer_name);
        ndr->depth++;
@@ -9540,7 +9544,12 @@ _PUBLIC_ void ndr_print_spoolss_DriverInfo6(struct ndr_print *ndr, const char *n
        ndr->depth--;
 }
 
-static enum ndr_err_code ndr_push_spoolss_DriverInfo8(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo8 *r)
+_PUBLIC_ size_t ndr_size_spoolss_DriverInfo6(const struct spoolss_DriverInfo6 *r, struct smb_iconv_convenience *ic, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_DriverInfo6, ic);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo8(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo8 *r)
 {
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 8));
@@ -9605,7 +9614,7 @@ static enum ndr_err_code ndr_push_spoolss_DriverInfo8(struct ndr_push *ndr, int
                        NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous_names));
                        ndr->flags = _flags_save_string_array;
                }
-               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_data));
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
                NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
                {
                        uint32_t _flags_save_string = ndr->flags;
@@ -9841,7 +9850,7 @@ static enum ndr_err_code ndr_push_spoolss_DriverInfo8(struct ndr_push *ndr, int
        return NDR_ERR_SUCCESS;
 }
 
-static enum ndr_err_code ndr_pull_spoolss_DriverInfo8(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo8 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo8(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo8 *r)
 {
        uint32_t _ptr_driver_name;
        TALLOC_CTX *_mem_save_driver_name_0;
@@ -10004,7 +10013,7 @@ static enum ndr_err_code ndr_pull_spoolss_DriverInfo8(struct ndr_pull *ndr, int
                        }
                        ndr->flags = _flags_save_string_array;
                }
-               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_data));
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
                NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
                {
                        uint32_t _flags_save_string = ndr->flags;
@@ -10473,7 +10482,7 @@ _PUBLIC_ void ndr_print_spoolss_DriverInfo8(struct ndr_print *ndr, const char *n
                ndr_print_string_array(ndr, "previous_names", r->previous_names);
        }
        ndr->depth--;
-       ndr_print_NTTIME(ndr, "driver_data", r->driver_data);
+       ndr_print_NTTIME(ndr, "driver_date", r->driver_date);
        ndr_print_hyper(ndr, "driver_version", r->driver_version);
        ndr_print_ptr(ndr, "manufacturer_name", r->manufacturer_name);
        ndr->depth++;
@@ -10535,6 +10544,208 @@ _PUBLIC_ void ndr_print_spoolss_DriverInfo8(struct ndr_print *ndr, const char *n
        ndr->depth--;
 }
 
+_PUBLIC_ size_t ndr_size_spoolss_DriverInfo8(const struct spoolss_DriverInfo8 *r, struct smb_iconv_convenience *ic, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_DriverInfo8, ic);
+}
+
+static enum ndr_err_code ndr_push_spoolss_DriverFileType(struct ndr_push *ndr, int ndr_flags, enum spoolss_DriverFileType r)
+{
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_spoolss_DriverFileType(struct ndr_pull *ndr, int ndr_flags, enum spoolss_DriverFileType *r)
+{
+       uint32_t v;
+       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_spoolss_DriverFileType(struct ndr_print *ndr, const char *name, enum spoolss_DriverFileType r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case SPOOLSS_DRIVER_FILE_TYPE_RENDERING: val = "SPOOLSS_DRIVER_FILE_TYPE_RENDERING"; break;
+               case SPOOLSS_DRIVER_FILE_TYPE_CONFIGURATION: val = "SPOOLSS_DRIVER_FILE_TYPE_CONFIGURATION"; break;
+               case SPOOLSS_DRIVER_FILE_TYPE_DATA: val = "SPOOLSS_DRIVER_FILE_TYPE_DATA"; break;
+               case SPOOLSS_DRIVER_FILE_TYPE_HELP: val = "SPOOLSS_DRIVER_FILE_TYPE_HELP"; break;
+               case SPOOLSS_DRIVER_FILE_TYPE_OTHER: val = "SPOOLSS_DRIVER_FILE_TYPE_OTHER"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverFileInfo(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverFileInfo *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->file_name));
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_push_spoolss_DriverFileType(ndr, NDR_SCALARS, r->file_type));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_version));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->file_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->file_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->file_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverFileInfo(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverFileInfo *r)
+{
+       uint32_t _ptr_file_name;
+       TALLOC_CTX *_mem_save_file_name_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_file_name));
+                       if (_ptr_file_name) {
+                               NDR_PULL_ALLOC(ndr, r->file_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->file_name, _ptr_file_name));
+                       } else {
+                               r->file_name = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_pull_spoolss_DriverFileType(ndr, NDR_SCALARS, &r->file_type));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->file_version));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->file_name) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->file_name));
+                               _mem_save_file_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->file_name, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->file_name));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_name_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_spoolss_DriverFileInfo(struct ndr_print *ndr, const char *name, const struct spoolss_DriverFileInfo *r)
+{
+       ndr_print_struct(ndr, name, "spoolss_DriverFileInfo");
+       ndr->depth++;
+       ndr_print_ptr(ndr, "file_name", r->file_name);
+       ndr->depth++;
+       if (r->file_name) {
+               ndr_print_string(ndr, "file_name", r->file_name);
+       }
+       ndr->depth--;
+       ndr_print_spoolss_DriverFileType(ndr, "file_type", r->file_type);
+       ndr_print_uint32(ndr, "file_version", r->file_version);
+       ndr->depth--;
+}
+
+_PUBLIC_ void ndr_print_spoolss_DriverInfo101(struct ndr_print *ndr, const char *name, const struct spoolss_DriverInfo101 *r)
+{
+       uint32_t cntr_file_info_1;
+       ndr_print_struct(ndr, name, "spoolss_DriverInfo101");
+       ndr->depth++;
+       ndr_print_spoolss_DriverOSVersion(ndr, "version", r->version);
+       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, "architecture", r->architecture);
+       ndr->depth++;
+       if (r->architecture) {
+               ndr_print_string(ndr, "architecture", r->architecture);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "file_info", r->file_info);
+       ndr->depth++;
+       if (r->file_info) {
+               ndr->print(ndr, "%s: ARRAY(%d)", "file_info", (int)r->file_count);
+               ndr->depth++;
+               for (cntr_file_info_1=0;cntr_file_info_1<r->file_count;cntr_file_info_1++) {
+                       char *idx_1=NULL;
+                       if (asprintf(&idx_1, "[%d]", cntr_file_info_1) != -1) {
+                               ndr_print_spoolss_DriverFileInfo(ndr, "file_info", &r->file_info[cntr_file_info_1]);
+                               free(idx_1);
+                       }
+               }
+               ndr->depth--;
+       }
+       ndr->depth--;
+       ndr_print_uint32(ndr, "file_count", r->file_count);
+       ndr_print_ptr(ndr, "monitor_name", r->monitor_name);
+       ndr->depth++;
+       if (r->monitor_name) {
+               ndr_print_string(ndr, "monitor_name", r->monitor_name);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "default_datatype", r->default_datatype);
+       ndr->depth++;
+       if (r->default_datatype) {
+               ndr_print_string(ndr, "default_datatype", r->default_datatype);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "previous_names", r->previous_names);
+       ndr->depth++;
+       if (r->previous_names) {
+               ndr_print_string_array(ndr, "previous_names", r->previous_names);
+       }
+       ndr->depth--;
+       ndr_print_NTTIME(ndr, "driver_date", r->driver_date);
+       ndr_print_hyper(ndr, "driver_version", r->driver_version);
+       ndr_print_ptr(ndr, "manufacturer_name", r->manufacturer_name);
+       ndr->depth++;
+       if (r->manufacturer_name) {
+               ndr_print_string(ndr, "manufacturer_name", r->manufacturer_name);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "manufacturer_url", r->manufacturer_url);
+       ndr->depth++;
+       if (r->manufacturer_url) {
+               ndr_print_string(ndr, "manufacturer_url", r->manufacturer_url);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "hardware_id", r->hardware_id);
+       ndr->depth++;
+       if (r->hardware_id) {
+               ndr_print_string(ndr, "hardware_id", r->hardware_id);
+       }
+       ndr->depth--;
+       ndr_print_ptr(ndr, "provider", r->provider);
+       ndr->depth++;
+       if (r->provider) {
+               ndr_print_string(ndr, "provider", r->provider);
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+_PUBLIC_ size_t ndr_size_spoolss_DriverInfo101(const struct spoolss_DriverInfo101 *r, struct smb_iconv_convenience *ic, int flags)
+{
+       return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_DriverInfo101, ic);
+}
+
 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo(struct ndr_push *ndr, int ndr_flags, const union spoolss_DriverInfo *r)
 {
        uint32_t _save_relative_base_offset = ndr_push_get_relative_base_offset(ndr);
@@ -10583,6 +10794,12 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo(struct ndr_push *ndr, int
                                NDR_CHECK(ndr_push_spoolss_DriverInfo8(ndr, NDR_SCALARS, &r->info8));
                        break; }
 
+                       case 101: {
+                               NDR_CHECK(ndr_push_align(ndr, 8));
+                               NDR_CHECK(ndr_push_setup_relative_base_offset1(ndr, r, ndr->offset));
+                               NDR_CHECK(ndr_push_spoolss_DriverInfo101(ndr, NDR_SCALARS, &r->info101));
+                       break; }
+
                        default: {
                        break; }
 
@@ -10620,6 +10837,10 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo(struct ndr_push *ndr, int
                                NDR_CHECK(ndr_push_spoolss_DriverInfo8(ndr, NDR_BUFFERS, &r->info8));
                        break;
 
+                       case 101:
+                               NDR_CHECK(ndr_push_spoolss_DriverInfo101(ndr, NDR_BUFFERS, &r->info101));
+                       break;
+
                        default:
                        break;
 
@@ -10678,6 +10899,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo(struct ndr_pull *ndr, int
                                NDR_CHECK(ndr_pull_spoolss_DriverInfo8(ndr, NDR_SCALARS, &r->info8));
                        break; }
 
+                       case 101: {
+                               NDR_CHECK(ndr_pull_align(ndr, 8));
+                               NDR_CHECK(ndr_pull_setup_relative_base_offset1(ndr, r, ndr->offset));
+                               NDR_CHECK(ndr_pull_spoolss_DriverInfo101(ndr, NDR_SCALARS, &r->info101));
+                       break; }
+
                        default: {
                        break; }
 
@@ -10714,6 +10941,10 @@ _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo(struct ndr_pull *ndr, int
                                NDR_CHECK(ndr_pull_spoolss_DriverInfo8(ndr, NDR_BUFFERS, &r->info8));
                        break;
 
+                       case 101:
+                               NDR_CHECK(ndr_pull_spoolss_DriverInfo101(ndr, NDR_BUFFERS, &r->info101));
+                       break;
+
                        default:
                        break;
 
@@ -10757,6 +10988,10 @@ _PUBLIC_ void ndr_print_spoolss_DriverInfo(struct ndr_print *ndr, const char *na
                        ndr_print_spoolss_DriverInfo8(ndr, "info8", &r->info8);
                break;
 
+               case 101:
+                       ndr_print_spoolss_DriverInfo101(ndr, "info101", &r->info101);
+               break;
+
                default:
                break;
 
@@ -19840,7 +20075,13 @@ static enum ndr_err_code ndr_push_spoolss_GetPrinterDriver2(struct ndr_push *ndr
        if (flags & NDR_OUT) {
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info));
                if (r->out.info) {
-                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, *r->out.info));
+                       {
+                               struct ndr_push *_ndr_info;
+                               NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 4, r->in.offered));
+                               NDR_CHECK(ndr_push_set_switch_value(_ndr_info, r->out.info, r->in.level));
+                               NDR_CHECK(ndr_push_spoolss_DriverInfo(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+                               NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 4, r->in.offered));
+                       }
                }
                if (r->out.needed == NULL) {
                        return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
@@ -19932,7 +20173,13 @@ static enum ndr_err_code ndr_pull_spoolss_GetPrinterDriver2(struct ndr_pull *ndr
                if (r->out.info) {
                        _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
                        NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0);
-                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, r->out.info));
+                       {
+                               struct ndr_pull *_ndr_info;
+                               NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info, 4, r->in.offered));
+                               NDR_CHECK(ndr_pull_set_switch_value(_ndr_info, r->out.info, r->in.level));
+                               NDR_CHECK(ndr_pull_spoolss_DriverInfo(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+                               NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info, 4, r->in.offered));
+                       }
                        NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
                }
                if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -19999,7 +20246,8 @@ _PUBLIC_ void ndr_print_spoolss_GetPrinterDriver2(struct ndr_print *ndr, const c
                ndr_print_ptr(ndr, "info", r->out.info);
                ndr->depth++;
                if (r->out.info) {
-                       ndr_print_DATA_BLOB(ndr, "info", *r->out.info);
+                       ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+                       ndr_print_spoolss_DriverInfo(ndr, "info", r->out.info);
                }
                ndr->depth--;
                ndr_print_ptr(ndr, "needed", r->out.needed);
index b9a533ab382b26cc404f2e8cad3387b6dcd2dec1..5b32d510c089a9b8166ad5895e44d47ff3b750ed 100644 (file)
@@ -256,6 +256,8 @@ enum ndr_err_code ndr_push_spoolss_StringArray(struct ndr_push *ndr, int ndr_fla
 enum ndr_err_code ndr_pull_spoolss_StringArray(struct ndr_pull *ndr, int ndr_flags, struct spoolss_StringArray *r);
 void ndr_print_spoolss_StringArray(struct ndr_print *ndr, const char *name, const struct spoolss_StringArray *r);
 void ndr_print_spoolss_AddDriverInfo1(struct ndr_print *ndr, const char *name, const struct spoolss_AddDriverInfo1 *r);
+enum ndr_err_code ndr_push_spoolss_DriverOSVersion(struct ndr_push *ndr, int ndr_flags, enum spoolss_DriverOSVersion r);
+enum ndr_err_code ndr_pull_spoolss_DriverOSVersion(struct ndr_pull *ndr, int ndr_flags, enum spoolss_DriverOSVersion *r);
 void ndr_print_spoolss_DriverOSVersion(struct ndr_print *ndr, const char *name, enum spoolss_DriverOSVersion r);
 void ndr_print_spoolss_AddDriverInfo2(struct ndr_print *ndr, const char *name, const struct spoolss_AddDriverInfo2 *r);
 void ndr_print_spoolss_AddDriverInfo3(struct ndr_print *ndr, const char *name, const struct spoolss_AddDriverInfo3 *r);
@@ -264,13 +266,42 @@ void ndr_print_spoolss_AddDriverInfo6(struct ndr_print *ndr, const char *name, c
 void ndr_print_spoolss_AddDriverInfo8(struct ndr_print *ndr, const char *name, const struct spoolss_AddDriverInfo8 *r);
 void ndr_print_spoolss_AddDriverInfo(struct ndr_print *ndr, const char *name, const union spoolss_AddDriverInfo *r);
 void ndr_print_spoolss_AddDriverInfoCtr(struct ndr_print *ndr, const char *name, const struct spoolss_AddDriverInfoCtr *r);
+enum ndr_err_code ndr_push_spoolss_DriverInfo1(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo1 *r);
+enum ndr_err_code ndr_pull_spoolss_DriverInfo1(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo1 *r);
 void ndr_print_spoolss_DriverInfo1(struct ndr_print *ndr, const char *name, const struct spoolss_DriverInfo1 *r);
+size_t ndr_size_spoolss_DriverInfo1(const struct spoolss_DriverInfo1 *r, struct smb_iconv_convenience *ic, int flags);
+enum ndr_err_code ndr_push_spoolss_DriverInfo2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo2 *r);
+enum ndr_err_code ndr_pull_spoolss_DriverInfo2(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo2 *r);
 void ndr_print_spoolss_DriverInfo2(struct ndr_print *ndr, const char *name, const struct spoolss_DriverInfo2 *r);
+size_t ndr_size_spoolss_DriverInfo2(const struct spoolss_DriverInfo2 *r, struct smb_iconv_convenience *ic, int flags);
+enum ndr_err_code ndr_push_spoolss_DriverInfo3(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo3 *r);
+enum ndr_err_code ndr_pull_spoolss_DriverInfo3(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo3 *r);
 void ndr_print_spoolss_DriverInfo3(struct ndr_print *ndr, const char *name, const struct spoolss_DriverInfo3 *r);
+size_t ndr_size_spoolss_DriverInfo3(const struct spoolss_DriverInfo3 *r, struct smb_iconv_convenience *ic, int flags);
+enum ndr_err_code ndr_push_spoolss_DriverInfo4(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo4 *r);
+enum ndr_err_code ndr_pull_spoolss_DriverInfo4(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo4 *r);
 void ndr_print_spoolss_DriverInfo4(struct ndr_print *ndr, const char *name, const struct spoolss_DriverInfo4 *r);
+size_t ndr_size_spoolss_DriverInfo4(const struct spoolss_DriverInfo4 *r, struct smb_iconv_convenience *ic, int flags);
+enum ndr_err_code ndr_push_spoolss_DriverInfo5(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo5 *r);
+enum ndr_err_code ndr_pull_spoolss_DriverInfo5(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo5 *r);
 void ndr_print_spoolss_DriverInfo5(struct ndr_print *ndr, const char *name, const struct spoolss_DriverInfo5 *r);
+size_t ndr_size_spoolss_DriverInfo5(const struct spoolss_DriverInfo5 *r, struct smb_iconv_convenience *ic, int flags);
+enum ndr_err_code ndr_push_spoolss_DriverInfo6(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo6 *r);
+enum ndr_err_code ndr_pull_spoolss_DriverInfo6(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo6 *r);
 void ndr_print_spoolss_DriverInfo6(struct ndr_print *ndr, const char *name, const struct spoolss_DriverInfo6 *r);
+size_t ndr_size_spoolss_DriverInfo6(const struct spoolss_DriverInfo6 *r, struct smb_iconv_convenience *ic, int flags);
+enum ndr_err_code ndr_push_spoolss_DriverInfo8(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo8 *r);
+enum ndr_err_code ndr_pull_spoolss_DriverInfo8(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo8 *r);
 void ndr_print_spoolss_DriverInfo8(struct ndr_print *ndr, const char *name, const struct spoolss_DriverInfo8 *r);
+size_t ndr_size_spoolss_DriverInfo8(const struct spoolss_DriverInfo8 *r, struct smb_iconv_convenience *ic, int flags);
+void ndr_print_spoolss_DriverFileType(struct ndr_print *ndr, const char *name, enum spoolss_DriverFileType r);
+enum ndr_err_code ndr_push_spoolss_DriverFileInfo(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverFileInfo *r);
+enum ndr_err_code ndr_pull_spoolss_DriverFileInfo(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverFileInfo *r);
+void ndr_print_spoolss_DriverFileInfo(struct ndr_print *ndr, const char *name, const struct spoolss_DriverFileInfo *r);
+enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r);
+enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r);
+void ndr_print_spoolss_DriverInfo101(struct ndr_print *ndr, const char *name, const struct spoolss_DriverInfo101 *r);
+size_t ndr_size_spoolss_DriverInfo101(const struct spoolss_DriverInfo101 *r, struct smb_iconv_convenience *ic, int flags);
 enum ndr_err_code ndr_push_spoolss_DriverInfo(struct ndr_push *ndr, int ndr_flags, const union spoolss_DriverInfo *r);
 enum ndr_err_code ndr_pull_spoolss_DriverInfo(struct ndr_pull *ndr, int ndr_flags, union spoolss_DriverInfo *r);
 void ndr_print_spoolss_DriverInfo(struct ndr_print *ndr, const char *name, const union spoolss_DriverInfo *r);
index 150bf04d6fb49d897014f9f187ec2edad61f771a..ad4554dbe5334cb5ff2a63e2077367229b5fab80 100644 (file)
@@ -10,6 +10,7 @@
 
 #define PRINTER_ENUM_ICONMASK  ( (PRINTER_ENUM_ICON1|PRINTER_ENUM_ICON2|PRINTER_ENUM_ICON3|PRINTER_ENUM_ICON4|PRINTER_ENUM_ICON5|PRINTER_ENUM_ICON6|PRINTER_ENUM_ICON7|PRINTER_ENUM_ICON8) )
 #define SPOOLSS_ARCHITECTURE_NT_X86    ( "Windows NT x86" )
+#define SPOOLSS_DEFAULT_SERVER_PATH    ( "C:\\WINDOWS\\system32\\spool" )
 #define PRINTER_CHANGE_PRINTER ( 0x000000FF )
 #define PRINTER_CHANGE_JOB     ( 0x0000FF00 )
 #define PRINTER_CHANGE_FORM    ( (PRINTER_CHANGE_ADD_FORM|PRINTER_CHANGE_SET_FORM|PRINTER_CHANGE_DELETE_FORM) )
@@ -500,7 +501,7 @@ struct spoolss_SetPrinterInfo2 {
 };
 
 struct spoolss_SetPrinterInfo3 {
-       struct security_descriptor *secdesc;/* [unique] */
+       uint32_t sec_desc_ptr;
 };
 
 struct spoolss_SetPrinterInfo4 {
@@ -635,7 +636,7 @@ struct spoolss_AddDriverInfo6 {
        struct spoolss_StringArray *dependent_files;/* [unique] */
        uint32_t _ndr_size_previous_names;/* [value(((ndr_size_spoolss_StringArray(previous_names,ndr->iconv_convenience,ndr->flags)-4)/2))] */
        struct spoolss_StringArray *previous_names;/* [unique] */
-       NTTIME driver_data;
+       NTTIME driver_date;
        uint64_t driver_version;
        const char *manufacturer_name;/* [unique,charset(UTF16)] */
        const char *manufacturer_url;/* [unique,charset(UTF16)] */
@@ -657,7 +658,7 @@ struct spoolss_AddDriverInfo8 {
        struct spoolss_StringArray *dependent_files;/* [unique] */
        uint32_t _ndr_size_previous_names;/* [value(((ndr_size_spoolss_StringArray(previous_names,ndr->iconv_convenience,ndr->flags)-4)/2))] */
        struct spoolss_StringArray *previous_names;/* [unique] */
-       NTTIME driver_data;
+       NTTIME driver_date;
        uint64_t driver_version;
        const char *manufacturer_name;/* [unique,charset(UTF16)] */
        const char *manufacturer_url;/* [unique,charset(UTF16)] */
@@ -691,7 +692,7 @@ struct spoolss_AddDriverInfoCtr {
 
 struct spoolss_DriverInfo1 {
        const char * driver_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
-};
+}/* [gensize,public] */;
 
 struct spoolss_DriverInfo2 {
        enum spoolss_DriverOSVersion version;
@@ -700,7 +701,7 @@ struct spoolss_DriverInfo2 {
        const char * driver_path;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char * data_file;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char * config_file;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
-};
+}/* [gensize,public] */;
 
 struct spoolss_DriverInfo3 {
        enum spoolss_DriverOSVersion version;
@@ -713,7 +714,7 @@ struct spoolss_DriverInfo3 {
        const char ** dependent_files;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char * monitor_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char * default_datatype;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
-};
+}/* [gensize,public] */;
 
 struct spoolss_DriverInfo4 {
        enum spoolss_DriverOSVersion version;
@@ -727,7 +728,7 @@ struct spoolss_DriverInfo4 {
        const char * monitor_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char * default_datatype;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char ** previous_names;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
-};
+}/* [gensize,public] */;
 
 struct spoolss_DriverInfo5 {
        enum spoolss_DriverOSVersion version;
@@ -739,7 +740,7 @@ struct spoolss_DriverInfo5 {
        uint32_t driver_attributes;
        uint32_t config_version;
        uint32_t driver_version;
-};
+}/* [gensize,public] */;
 
 struct spoolss_DriverInfo6 {
        enum spoolss_DriverOSVersion version;
@@ -753,13 +754,13 @@ struct spoolss_DriverInfo6 {
        const char * monitor_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char * default_datatype;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char ** previous_names;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
-       NTTIME driver_data;
+       NTTIME driver_date;
        uint64_t driver_version;
        const char * manufacturer_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char * manufacturer_url;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char * hardware_id;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char * provider;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
-};
+}/* [gensize,public] */;
 
 struct spoolss_DriverInfo8 {
        enum spoolss_DriverOSVersion version;
@@ -773,7 +774,7 @@ struct spoolss_DriverInfo8 {
        const char * default_datatype;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char ** dependent_files;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char ** previous_names;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
-       NTTIME driver_data;
+       NTTIME driver_date;
        uint64_t driver_version;
        const char * manufacturer_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        const char * manufacturer_url;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
@@ -787,7 +788,49 @@ struct spoolss_DriverInfo8 {
        const char ** core_driver_dependencies;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
        NTTIME min_inbox_driver_ver_date;
        uint64_t min_inbox_driver_ver_version;
-};
+}/* [gensize,public] */;
+
+enum spoolss_DriverFileType
+#ifndef USE_UINT_ENUMS
+ {
+       SPOOLSS_DRIVER_FILE_TYPE_RENDERING=0x00000000,
+       SPOOLSS_DRIVER_FILE_TYPE_CONFIGURATION=0x00000001,
+       SPOOLSS_DRIVER_FILE_TYPE_DATA=0x00000002,
+       SPOOLSS_DRIVER_FILE_TYPE_HELP=0x00000003,
+       SPOOLSS_DRIVER_FILE_TYPE_OTHER=0x00000004
+}
+#else
+ { __donnot_use_enum_spoolss_DriverFileType=0x7FFFFFFF}
+#define SPOOLSS_DRIVER_FILE_TYPE_RENDERING ( 0x00000000 )
+#define SPOOLSS_DRIVER_FILE_TYPE_CONFIGURATION ( 0x00000001 )
+#define SPOOLSS_DRIVER_FILE_TYPE_DATA ( 0x00000002 )
+#define SPOOLSS_DRIVER_FILE_TYPE_HELP ( 0x00000003 )
+#define SPOOLSS_DRIVER_FILE_TYPE_OTHER ( 0x00000004 )
+#endif
+;
+
+struct spoolss_DriverFileInfo {
+       const char * file_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       enum spoolss_DriverFileType file_type;
+       uint32_t file_version;
+}/* [public] */;
+
+struct spoolss_DriverInfo101 {
+       enum spoolss_DriverOSVersion version;
+       const char * driver_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       const char * architecture;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       struct spoolss_DriverFileInfo *file_info;/* [relative,size_is(file_count)] */
+       uint32_t file_count;
+       const char * monitor_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       const char * default_datatype;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       const char ** previous_names;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       NTTIME driver_date;
+       uint64_t driver_version;
+       const char * manufacturer_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       const char * manufacturer_url;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       const char * hardware_id;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+       const char * provider;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */
+}/* [gensize,nopush,public,nopull] */;
 
 union spoolss_DriverInfo {
        struct spoolss_DriverInfo1 info1;/* [case] */
@@ -797,6 +840,7 @@ union spoolss_DriverInfo {
        struct spoolss_DriverInfo5 info5;/* [case(5)] */
        struct spoolss_DriverInfo6 info6;/* [case(6)] */
        struct spoolss_DriverInfo8 info8;/* [case(8)] */
+       struct spoolss_DriverInfo101 info101;/* [case(101)] */
 }/* [relative_base,nodiscriminant,public] */;
 
 struct spoolss_DriverDirectoryInfo1 {
@@ -2239,7 +2283,7 @@ struct spoolss_GetPrinterDriver2 {
        } in;
 
        struct {
-               DATA_BLOB *info;/* [unique] */
+               union spoolss_DriverInfo *info;/* [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */
                uint32_t *needed;/* [ref] */
                uint32_t *server_major_version;/* [ref] */
                uint32_t *server_minor_version;/* [ref] */
index f6c17cb1faa84871b81f30390f2de778782e84bb..891be8537670b266405a799525f0e7c8386e1797 100644 (file)
@@ -4169,7 +4169,7 @@ static bool api_spoolss_GetPrinterDriver2(pipes_struct *p)
        }
 
        ZERO_STRUCT(r->out);
-       r->out.info = talloc_zero(r, DATA_BLOB);
+       r->out.info = talloc_zero(r, union spoolss_DriverInfo);
        if (r->out.info == NULL) {
                talloc_free(r);
                return false;
@@ -8080,7 +8080,7 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
                case NDR_SPOOLSS_GETPRINTERDRIVER2: {
                        struct spoolss_GetPrinterDriver2 *r = (struct spoolss_GetPrinterDriver2 *)_r;
                        ZERO_STRUCT(r->out);
-                       r->out.info = talloc_zero(mem_ctx, DATA_BLOB);
+                       r->out.info = talloc_zero(mem_ctx, union spoolss_DriverInfo);
                        if (r->out.info == NULL) {
                        return NT_STATUS_NO_MEMORY;
                        }
index 17d480261a9e1b47ebcb5ec50919a4273012f3b4..3e35399f8d9cd614945c6f8894bb4466ea51e5c3 100644 (file)
@@ -552,7 +552,7 @@ import "misc.idl", "security.idl", "winreg.idl";
        } spoolss_SetPrinterInfo2;
 
        typedef struct {
-               security_descriptor *secdesc;
+               uint32 sec_desc_ptr;
        } spoolss_SetPrinterInfo3;
 
        typedef struct {
@@ -628,7 +628,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                [string,charset(UTF16)] uint16 *driver_name;
        } spoolss_AddDriverInfo1;
 
-       typedef [v1_enum] enum {
+       typedef [v1_enum,public] enum {
                SPOOLSS_DRIVER_VERSION_9X       = 0,
                SPOOLSS_DRIVER_VERSION_NT35     = 1,
                SPOOLSS_DRIVER_VERSION_NT4      = 2,
@@ -700,7 +700,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                spoolss_StringArray *dependent_files;
                [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
                spoolss_StringArray *previous_names;
-               NTTIME driver_data;
+               NTTIME driver_date;
                hyper driver_version;
                [string,charset(UTF16)] uint16 *manufacturer_name;
                [string,charset(UTF16)] uint16 *manufacturer_url;
@@ -722,7 +722,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                spoolss_StringArray *dependent_files;
                [value(((ndr_size_spoolss_StringArray(previous_names, ndr->iconv_convenience, ndr->flags)-4)/2))] uint32 _ndr_size_previous_names;
                spoolss_StringArray *previous_names;
-               NTTIME driver_data;
+               NTTIME driver_date;
                hyper driver_version;
                [string,charset(UTF16)] uint16 *manufacturer_name;
                [string,charset(UTF16)] uint16 *manufacturer_url;
@@ -759,11 +759,11 @@ import "misc.idl", "security.idl", "winreg.idl";
                [in,ref] spoolss_AddDriverInfoCtr *info_ctr
        );
 
-       typedef struct {
+       typedef [public,gensize] struct {
                [relative] nstring *driver_name;
        } spoolss_DriverInfo1;
 
-       typedef struct {
+       typedef [public,gensize] struct {
                spoolss_DriverOSVersion version;
                [relative] nstring *driver_name;
                [relative] nstring *architecture;
@@ -772,7 +772,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                [relative] nstring *config_file;
        } spoolss_DriverInfo2;
 
-       typedef struct {
+       typedef [public,gensize] struct {
                spoolss_DriverOSVersion version;
                [relative] nstring *driver_name;
                [relative] nstring *architecture;
@@ -785,7 +785,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                [relative] nstring *default_datatype;
        } spoolss_DriverInfo3;
 
-       typedef struct {
+       typedef [public,gensize] struct {
                spoolss_DriverOSVersion version;
                [relative] nstring *driver_name;
                [relative] nstring *architecture;
@@ -799,7 +799,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                [relative] nstring_array *previous_names;
        } spoolss_DriverInfo4;
 
-       typedef struct {
+       typedef [public,gensize] struct {
                spoolss_DriverOSVersion version;
                [relative] nstring *driver_name;
                [relative] nstring *architecture;
@@ -811,7 +811,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                uint32 driver_version;
        } spoolss_DriverInfo5;
 
-       typedef struct {
+       typedef [public,gensize] struct {
                spoolss_DriverOSVersion version;
                [relative] nstring *driver_name;
                [relative] nstring *architecture;
@@ -823,7 +823,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                [relative] nstring *monitor_name;
                [relative] nstring *default_datatype;
                [relative] nstring_array *previous_names;
-               NTTIME driver_data;
+               NTTIME driver_date;
                hyper driver_version;
                [relative] nstring *manufacturer_name;
                [relative] nstring *manufacturer_url;
@@ -831,7 +831,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                [relative] nstring *provider;
        } spoolss_DriverInfo6;
 
-       typedef struct {
+       typedef [public,gensize] struct {
                spoolss_DriverOSVersion version;
                [relative] nstring *driver_name;
                [relative] nstring *architecture;
@@ -843,7 +843,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                [relative] nstring *default_datatype;
                [relative] nstring_array *dependent_files;
                [relative] nstring_array *previous_names;
-               NTTIME driver_data;
+               NTTIME driver_date;
                hyper driver_version;
                [relative] nstring *manufacturer_name;
                [relative] nstring *manufacturer_url;
@@ -859,6 +859,37 @@ import "misc.idl", "security.idl", "winreg.idl";
                hyper min_inbox_driver_ver_version;
        } spoolss_DriverInfo8;
 
+       typedef [v1_enum] enum {
+               SPOOLSS_DRIVER_FILE_TYPE_RENDERING      = 0x00000000,
+               SPOOLSS_DRIVER_FILE_TYPE_CONFIGURATION  = 0x00000001,
+               SPOOLSS_DRIVER_FILE_TYPE_DATA           = 0x00000002,
+               SPOOLSS_DRIVER_FILE_TYPE_HELP           = 0x00000003,
+               SPOOLSS_DRIVER_FILE_TYPE_OTHER          = 0x00000004
+       } spoolss_DriverFileType;
+
+       typedef [public] struct {
+               [relative] nstring *file_name;
+               spoolss_DriverFileType file_type;
+               uint32 file_version;
+       } spoolss_DriverFileInfo;
+
+       typedef [public,gensize,nopush,nopull] struct {
+               spoolss_DriverOSVersion version;
+               [relative] nstring *driver_name;
+               [relative] nstring *architecture;
+               [relative] [size_is(file_count)] spoolss_DriverFileInfo *file_info;
+               uint32 file_count;
+               [relative] nstring *monitor_name;
+               [relative] nstring *default_datatype;
+               [relative] nstring_array *previous_names;
+               NTTIME driver_date;
+               hyper driver_version;
+               [relative] nstring *manufacturer_name;
+               [relative] nstring *manufacturer_url;
+               [relative] nstring *hardware_id;
+               [relative] nstring *provider;
+       } spoolss_DriverInfo101;
+
        typedef [nodiscriminant,relative_base,public] union {
                [case(1)] spoolss_DriverInfo1 info1;
                [case(2)] spoolss_DriverInfo2 info2;
@@ -867,6 +898,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                [case(5)] spoolss_DriverInfo5 info5;
                [case(6)] spoolss_DriverInfo6 info6;
                [case(8)] spoolss_DriverInfo8 info8;
+               [case(101)] spoolss_DriverInfo101 info101;
                [default];
        } spoolss_DriverInfo;
 
@@ -1086,6 +1118,7 @@ import "misc.idl", "security.idl", "winreg.idl";
        /******************/
        /* Function: 0x1a */
        const string SPOOLSS_ARCHITECTURE_NT_X86                = "Windows NT x86";
+       const string SPOOLSS_DEFAULT_SERVER_PATH                = "C:\\WINDOWS\\system32\\spool";
 
        typedef [public,gensize] struct {
                [value(ndr_size_spoolss_OSVersion(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
@@ -1472,7 +1505,7 @@ import "misc.idl", "security.idl", "winreg.idl";
                [in]     uint32 offered,
                [in]     uint32 client_major_version,
                [in]     uint32 client_minor_version,
-               [out,unique] DATA_BLOB *info,
+               [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverInfo *info,
                [out,ref] uint32 *needed,
                [out,ref] uint32 *server_major_version,
                [out,ref] uint32 *server_minor_version
index d7e28ccf0e7f5aa31fd2a4e95bfbef38398617d2..afc06be4e0d70a67a195632c8fd944b71abecf69 100644 (file)
@@ -544,3 +544,481 @@ _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r
        return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
 }
 
+/* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
+ * structs */
+
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r)
+{
+       uint32_t cntr_file_info_1;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 8));
+               NDR_CHECK(ndr_push_spoolss_DriverOSVersion(ndr, NDR_SCALARS, r->version));
+               {
+                       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;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->architecture));
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_push_relative_ptr1(ndr, r->file_info));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->monitor_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->default_datatype));
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string_array = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous_names));
+                       ndr->flags = _flags_save_string_array;
+               }
+               NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
+               NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_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->manufacturer_url));
+                       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->hardware_id));
+                       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->provider));
+                       ndr->flags = _flags_save_string;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               {
+                       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;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->architecture) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->architecture));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->architecture));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->file_info) {
+                       NDR_CHECK(ndr_push_relative_ptr2(ndr, r->file_info));
+#if 0
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
+#endif
+                       for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
+                               NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
+                       }
+                       for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
+                               NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
+                       }
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->monitor_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->monitor_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->monitor_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->default_datatype) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->default_datatype));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->default_datatype));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string_array = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->previous_names) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->previous_names));
+                               NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->previous_names));
+                       }
+                       ndr->flags = _flags_save_string_array;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->manufacturer_name) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->manufacturer_name));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_name));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->manufacturer_url) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->manufacturer_url));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_url));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->hardware_id) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->hardware_id));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->hardware_id));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->provider) {
+                               NDR_CHECK(ndr_push_relative_ptr2(ndr, r->provider));
+                               NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->provider));
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r)
+{
+       uint32_t _ptr_driver_name;
+       TALLOC_CTX *_mem_save_driver_name_0;
+       uint32_t _ptr_architecture;
+       TALLOC_CTX *_mem_save_architecture_0;
+       uint32_t _ptr_file_info;
+       uint32_t cntr_file_info_1;
+       TALLOC_CTX *_mem_save_file_info_0;
+       TALLOC_CTX *_mem_save_file_info_1;
+       uint32_t _ptr_monitor_name;
+       TALLOC_CTX *_mem_save_monitor_name_0;
+       uint32_t _ptr_default_datatype;
+       TALLOC_CTX *_mem_save_default_datatype_0;
+       uint32_t _ptr_previous_names;
+       TALLOC_CTX *_mem_save_previous_names_0;
+       uint32_t _ptr_manufacturer_name;
+       TALLOC_CTX *_mem_save_manufacturer_name_0;
+       uint32_t _ptr_manufacturer_url;
+       TALLOC_CTX *_mem_save_manufacturer_url_0;
+       uint32_t _ptr_hardware_id;
+       TALLOC_CTX *_mem_save_hardware_id_0;
+       uint32_t _ptr_provider;
+       TALLOC_CTX *_mem_save_provider_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 8));
+               NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr, NDR_SCALARS, &r->version));
+               {
+                       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;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_architecture));
+                       if (_ptr_architecture) {
+                               NDR_PULL_ALLOC(ndr, r->architecture);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->architecture, _ptr_architecture));
+                       } else {
+                               r->architecture = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_file_info));
+               if (_ptr_file_info) {
+                       NDR_PULL_ALLOC(ndr, r->file_info);
+                       NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->file_info, _ptr_file_info));
+               } else {
+                       r->file_info = NULL;
+               }
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->file_count));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_monitor_name));
+                       if (_ptr_monitor_name) {
+                               NDR_PULL_ALLOC(ndr, r->monitor_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->monitor_name, _ptr_monitor_name));
+                       } else {
+                               r->monitor_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_default_datatype));
+                       if (_ptr_default_datatype) {
+                               NDR_PULL_ALLOC(ndr, r->default_datatype);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_datatype, _ptr_default_datatype));
+                       } else {
+                               r->default_datatype = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string_array = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous_names));
+                       if (_ptr_previous_names) {
+                               NDR_PULL_ALLOC(ndr, r->previous_names);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous_names, _ptr_previous_names));
+                       } else {
+                               r->previous_names = NULL;
+                       }
+                       ndr->flags = _flags_save_string_array;
+               }
+               NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
+               NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
+                       if (_ptr_manufacturer_name) {
+                               NDR_PULL_ALLOC(ndr, r->manufacturer_name);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_name, _ptr_manufacturer_name));
+                       } else {
+                               r->manufacturer_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_manufacturer_url));
+                       if (_ptr_manufacturer_url) {
+                               NDR_PULL_ALLOC(ndr, r->manufacturer_url);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_url, _ptr_manufacturer_url));
+                       } else {
+                               r->manufacturer_url = 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_hardware_id));
+                       if (_ptr_hardware_id) {
+                               NDR_PULL_ALLOC(ndr, r->hardware_id);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->hardware_id, _ptr_hardware_id));
+                       } else {
+                               r->hardware_id = 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_provider));
+                       if (_ptr_provider) {
+                               NDR_PULL_ALLOC(ndr, r->provider);
+                               NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->provider, _ptr_provider));
+                       } else {
+                               r->provider = NULL;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               {
+                       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;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->architecture) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->architecture));
+                               _mem_save_architecture_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->architecture, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->architecture));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_architecture_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->file_info) {
+                       uint32_t _relative_save_offset;
+                       _relative_save_offset = ndr->offset;
+                       NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->file_info));
+                       _mem_save_file_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
+#if 0
+                       NDR_CHECK(ndr_pull_array_size(ndr, &r->file_info));
+#else
+                       NDR_CHECK(ndr_token_store(ndr, &ndr->array_size_list, &r->file_info, r->file_count));
+#endif
+                       NDR_PULL_ALLOC_N(ndr, r->file_info, ndr_get_array_size(ndr, &r->file_info));
+                       _mem_save_file_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
+                       for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
+                               NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
+                       }
+                       for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
+                               NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_1, 0);
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_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->monitor_name) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->monitor_name));
+                               _mem_save_monitor_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->monitor_name, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitor_name));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_monitor_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->default_datatype) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->default_datatype));
+                               _mem_save_default_datatype_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->default_datatype, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->default_datatype));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_datatype_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               {
+                       uint32_t _flags_save_string_array = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->previous_names) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous_names));
+                               _mem_save_previous_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->previous_names, 0);
+                               NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->previous_names));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_names_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string_array;
+               }
+               {
+                       uint32_t _flags_save_string = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+                       if (r->manufacturer_name) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_name));
+                               _mem_save_manufacturer_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_name, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_name));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_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->manufacturer_url) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_url));
+                               _mem_save_manufacturer_url_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_url, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_url));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_url_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->hardware_id) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->hardware_id));
+                               _mem_save_hardware_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->hardware_id, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->hardware_id));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hardware_id_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->provider) {
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
+                               NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->provider));
+                               _mem_save_provider_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                               NDR_PULL_SET_MEM_CTX(ndr, r->provider, 0);
+                               NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->provider));
+                               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_provider_0, 0);
+                               ndr->offset = _relative_save_offset;
+                       }
+                       ndr->flags = _flags_save_string;
+               }
+               if (r->file_info) {
+                       NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->file_info, r->file_count));
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
index 801737610fc23c1bfb6c04206a63b130bf1aefe0..5ed848d7e0786195402cf8e5a10a4ca7a61bf4a1 100644 (file)
@@ -39,6 +39,9 @@ enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flag
 enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r);
 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags);
 size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags);
+_PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r);
+_PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r);
+
 #undef _PRINTF_ATTRIBUTE
 #define _PRINTF_ATTRIBUTE(a1, a2)
 
index 48785f5b0ac517951c6c7b509b8d4066a8d9dcea..6099fe5caefeb9ebff05a77fccd82261f41bee71 100644 (file)
@@ -275,7 +275,24 @@ sub PythonStruct($$$$$$)
                $self->pidl("if (!PyArg_ParseTuple(args, \"s#:__ndr_unpack__\", &blob.data, &blob.length))");
                $self->pidl("\treturn NULL;");
                $self->pidl("");
-               $self->pidl("err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), NULL, object, (ndr_pull_flags_fn_t)ndr_pull_$name);");
+
+               # This disgusting hack works around the fact that ndr_pull_struct_blob_all will always fail on structures with relative pointers.  
+                # So, map ndr_unpack to ndr_pull_struct_blob_all only if we don't have any relative pointers in this
+               my $got_relative = 0;
+               if ($#{$d->{ELEMENTS}} > -1) {
+                       foreach my $e (@{$d->{ELEMENTS}}) {
+                               my $l = $e->{LEVELS}[0];
+                               if ($l->{TYPE} eq "POINTER" and ($l->{POINTER_TYPE} eq "relative")) {
+                                       $got_relative = 1;
+                                       last;
+                               }
+                       }
+               }
+               if ($got_relative == 0) {
+                       $self->pidl("err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), NULL, object, (ndr_pull_flags_fn_t)ndr_pull_$name);");
+               } else {
+                       $self->pidl("err = ndr_pull_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), NULL, object, (ndr_pull_flags_fn_t)ndr_pull_$name);");
+               }
                $self->pidl("if (err != NDR_ERR_SUCCESS) {");
                $self->indent;
                $self->pidl("PyErr_SetNdrError(err);");
index 09138cf0aa7541e52cd7943439febe8fec33f7c2..71dddf69392d99a85aa9f8eb10ec1373b94bcb9d 100644 (file)
@@ -242,77 +242,32 @@ sub mk_openldap($$$)
        $ENV{PATH} = "$olpath/usr/local/sbin:/usr/sbin:/sbin:$ENV{PATH}";
 
        unlink($modconf);
-       open(CONF, ">$modconf"); close(CONF);
 
-       if (system("slaptest -u -f $slapd_conf >&2") != 0) {
-               open(CONF, ">$modconf"); 
-               # enable slapd modules
-               print CONF "
-modulepath      $olroot/libexec/openldap
-moduleload     syncprov
-moduleload      memberof
-moduleload      refint
-";
-               close(CONF);
-       }
-       if (system("slaptest -u -f $slapd_conf >&2") != 0) {
-               open(CONF, ">$modconf"); 
-               # enable slapd modules
-               print CONF "
-modulepath      $olroot/libexec/openldap
-moduleload     back_hdb
-moduleload     syncprov
-moduleload      memberof
-moduleload      refint
-";
-               close(CONF);
-       }
+       #This code tries to guess what modules we need to load (if any) by trying different combinations in the modules.conf
 
-       if (system("slaptest -u -f $slapd_conf >&2") != 0) {
-               open(CONF, ">$modconf"); 
-               # enable slapd modules
-               print CONF "
-moduleload     back_hdb
-moduleload     syncprov
-moduleload      memberof
-moduleload      refint
-";
-               close(CONF);
-       }
+       # Try without any slapd modules
+       open(CONF, ">$modconf"); close(CONF);
 
        if (system("slaptest -u -f $slapd_conf >&2") != 0) {
                open(CONF, ">$modconf"); 
                # enable slapd modules
                print CONF "
-modulepath     /usr/lib/ldap
-moduleload     back_hdb
 moduleload     syncprov
 moduleload      memberof
 moduleload      refint
+moduleload      deref
 ";
                close(CONF);
        }
-
        if (system("slaptest -u -f $slapd_conf >&2") != 0) {
                open(CONF, ">$modconf"); 
-               # enable slapd modules (Fedora layout)
+               # enable slapd modules, and the module for back_hdb
                print CONF "
-modulepath     /usr/lib/openldap
-moduleload     syncprov
-moduleload      memberof
-moduleload      refint
-";
-               close(CONF);
-       }
-
-       if (system("slaptest -u -f $slapd_conf >&2") != 0) {
-               open(CONF, ">$modconf"); 
-               # enable slapd modules (Fedora x86_64 layout)
-               print CONF "
-modulepath     /usr/lib64/openldap
+moduleload     back_hdb
 moduleload     syncprov
 moduleload      memberof
 moduleload      refint
+moduleload      deref
 ";
                close(CONF);
        }
index 7564659dd3f277f1e3774b92dc1447b187d7ac04..8f1d1a5b77da7bf85557fc172ee3c713fd8e8910 100644 (file)
@@ -339,7 +339,8 @@ UTIL_OBJ = ../lib/util/rbtree.o ../lib/util/signal.o ../lib/util/time.o \
                   ../lib/util/util.o ../lib/util/fsusage.o \
                   ../lib/util/params.o ../lib/util/talloc_stack.o \
                   ../lib/util/genrand.o ../lib/util/util_net.o \
-                  ../lib/util/become_daemon.o
+                  ../lib/util/become_daemon.o ../lib/util/system.o \
+                  ../lib/util/tevent_unix.o
 
 CRYPTO_OBJ = ../lib/crypto/crc32.o ../lib/crypto/md5.o \
                         ../lib/crypto/hmacmd5.o ../lib/crypto/arcfour.o \
@@ -444,7 +445,10 @@ LIBSMB_OBJ0 = \
 LIBSAMBA_OBJ = $(LIBSMB_OBJ0) \
               $(LIBSMB_ERR_OBJ)
 
-CLDAP_OBJ = libads/cldap.o
+LIBCLI_LDAP_MESSAGE_OBJ = ../libcli/ldap/ldap_message.o
+LIBCLI_LDAP_NDR_OBJ = ../libcli/ldap/ldap_ndr.o
+
+CLDAP_OBJ = libads/cldap.o $(LIBCLI_LDAP_MESSAGE_OBJ) $(LIBCLI_LDAP_NDR_OBJ)
 
 LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
             libsmb/clikrb5.o libsmb/clispnego.o ../lib/util/asn1.o \
@@ -685,7 +689,7 @@ AUTH_SAM_OBJ = auth/auth_sam.o
 AUTH_SERVER_OBJ = auth/auth_server.o
 AUTH_UNIX_OBJ = auth/auth_unix.o
 AUTH_WINBIND_OBJ = auth/auth_winbind.o
-AUTH_ONEFS_WB_OBJ = auth/auth_onefs_wb.o
+AUTH_WBC_OBJ = auth/auth_wbc.o
 AUTH_SCRIPT_OBJ = auth/auth_script.o
 AUTH_NETLOGOND_OBJ = auth/auth_netlogond.o
 
@@ -756,7 +760,7 @@ NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \
             nmbd/nmbd_subnetdb.o nmbd/nmbd_winsproxy.o nmbd/nmbd_winsserver.o \
             nmbd/nmbd_workgroupdb.o nmbd/nmbd_synclists.o smbd/connection.o
 
-NMBD_OBJ = $(NMBD_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
+NMBD_OBJ = $(NMBD_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(LDB_OBJ) $(KRBCLIENT_OBJ) \
            $(PROFILE_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \
           $(LIBNDR_GEN_OBJ0)
 
@@ -935,7 +939,7 @@ NET_OBJ = $(NET_OBJ1) \
          $(PRIVILEGES_BASIC_OBJ) @LIBLUA_STATIC@ \
          $(LIB_EVENTLOG_OBJ)
 
-CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
+CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(LDB_OBJ) \
          $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
          $(LIBNDR_GEN_OBJ0)
 
@@ -952,24 +956,24 @@ SMBTORTURE_OBJ1 = torture/torture.o torture/nbio.o torture/scanner.o torture/uta
                torture/denytest.o torture/mangle_test.o
 
 SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) \
-       $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) \
+       $(LIBSMB_OBJ) $(LDB_OBJ) $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) \
        lib/wb_reqtrans.o lib/wbclient.o \
        @LIBWBCLIENT_STATIC@ \
        $(LIBNDR_GEN_OBJ0)
 
-MASKTEST_OBJ = torture/masktest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
+MASKTEST_OBJ = torture/masktest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(LDB_OBJ) $(KRBCLIENT_OBJ) \
                  $(LIB_NONSMBD_OBJ) \
                 $(LIBNDR_GEN_OBJ0)
 
-MSGTEST_OBJ = torture/msgtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
+MSGTEST_OBJ = torture/msgtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(LDB_OBJ) $(KRBCLIENT_OBJ) \
                  $(LIB_NONSMBD_OBJ) \
                 $(LIBNDR_GEN_OBJ0)
 
 LOCKTEST_OBJ = torture/locktest.o $(PARAM_OBJ) $(LOCKING_OBJ) $(KRBCLIENT_OBJ) \
-               $(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) \
+               $(LIBSMB_OBJ) $(LDB_OBJ) $(LIB_NONSMBD_OBJ) \
                $(LIBNDR_GEN_OBJ0)
 
-NSSTEST_OBJ = torture/nsstest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
+NSSTEST_OBJ = torture/nsstest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(LDB_OBJ) $(KRBCLIENT_OBJ) \
                  $(LIB_NONSMBD_OBJ) \
                 $(LIBNDR_GEN_OBJ0)
 
@@ -984,7 +988,7 @@ SMBICONV_OBJ = $(PARAM_OBJ) torture/smbiconv.o $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ
 
 LOG2PCAP_OBJ = utils/log2pcaphex.o
 
-LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \
+LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) $(LDB_OBJ) \
                $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) \
                $(LIBNDR_GEN_OBJ0)
 
@@ -1024,7 +1028,7 @@ REPLACETORT_OBJ = @libreplacedir@/test/testsuite.o \
 
 DEBUG2HTML_OBJ = utils/debug2html.o utils/debugparse.o
 
-SMBFILTER_OBJ = utils/smbfilter.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
+SMBFILTER_OBJ = utils/smbfilter.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(LDB_OBJ) \
                  $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \
                 $(LIBNDR_GEN_OBJ0)
 
@@ -2351,9 +2355,9 @@ bin/winbind.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_WINBIND_OBJ)
        @echo "Building plugin $@"
        @$(SHLD_MODULE) $(AUTH_WINBIND_OBJ)
 
-bin/onefs_wb.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_ONEFS_WB_OBJ)
+bin/wbc.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_WBC_OBJ)
        @echo "Building plugin $@"
-       @$(SHLD_MODULE) $(AUTH_ONEFS_WB_OBJ)
+       @$(SHLD_MODULE) $(AUTH_WBC_OBJ)
 
 bin/unix.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_UNIX_OBJ)
        @echo "Building plugin $@"
@@ -2371,9 +2375,9 @@ bin/tdbsam.@SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_tdb.o
        @echo "Building plugin $@"
        @$(SHLD_MODULE) passdb/pdb_tdb.o
 
-bin/onefs_sam.@SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_onefs_sam.o
+bin/wbc_sam.@SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_wbc_sam.o
        @echo "Building plugin $@"
-       @$(SHLD_MODULE) passdb/pdb_onefs_sam.o
+       @$(SHLD_MODULE) passdb/pdb_wbc_sam.o
 
 bin/smbpasswd.@SHLIBEXT@: $(BINARY_PREREQS) passdb/pdb_smbpasswd.o
        @echo "Building plugin $@"
similarity index 74%
rename from source3/auth/auth_onefs_wb.c
rename to source3/auth/auth_wbc.c
index 49de6966b0f990991d0af49d9ce05b3ba2ba2512..580c8b550d94a6a944bdeaefa62c484fce477d65 100644 (file)
@@ -1,7 +1,8 @@
 /*
    Unix SMB/CIFS implementation.
 
-   Winbind authentication mechnism, customized for onefs
+   Winbind client authentication mechanism designed to defer all
+   authentication to the winbind daemon.
 
    Copyright (C) Tim Potter 2000
    Copyright (C) Andrew Bartlett 2001 - 2002
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* This auth module is very similar to auth_winbind with 3 distinct
+ * differences.
+ *
+ *      1) Does not fallback to another auth module if winbindd is unavailable
+ *      2) Does not validate the domain of the user
+ *      3) Handles unencrypted passwords
+ *
+ * The purpose of this module is to defer all authentication decisions (ie:
+ * local user vs NIS vs LDAP vs AD; encrypted vs plaintext) to the wbc
+ * compatible daemon.  This centeralizes all authentication decisions to a
+ * single provider.
+ *
+ * This auth backend is most useful when used in conjunction with pdb_wbc_sam.
+ */
+
 #include "includes.h"
 
 #undef DBGC_CLASS
@@ -28,7 +44,7 @@
 
 /* Authenticate a user with a challenge/response */
 
-static NTSTATUS check_onefs_wb_security(const struct auth_context *auth_context,
+static NTSTATUS check_wbc_security(const struct auth_context *auth_context,
                                       void *my_private_data,
                                       TALLOC_CTX *mem_ctx,
                                       const auth_usersupplied_info *user_info,
@@ -58,7 +74,7 @@ static NTSTATUS check_onefs_wb_security(const struct auth_context *auth_context,
                         user_info->internal_username));
                params.level = WBC_AUTH_USER_LEVEL_PLAIN;
 
-               params.password.plaintext = user_info->plaintext_password.data;
+               params.password.plaintext = (char *)user_info->plaintext_password.data;
        } else {
                DEBUG(3,("Checking encrypted password for %s.\n",
                         user_info->internal_username));
@@ -116,19 +132,19 @@ static NTSTATUS check_onefs_wb_security(const struct auth_context *auth_context,
 }
 
 /* module initialisation */
-static NTSTATUS auth_init_onefs_wb(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
+static NTSTATUS auth_init_wbc(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
 {
        if (!make_auth_methods(auth_context, auth_method)) {
                return NT_STATUS_NO_MEMORY;
        }
 
-       (*auth_method)->name = "onefs_wb";
-       (*auth_method)->auth = check_onefs_wb_security;
+       (*auth_method)->name = "wbc";
+       (*auth_method)->auth = check_wbc_security;
 
        return NT_STATUS_OK;
 }
 
-NTSTATUS auth_onefs_wb_init(void)
+NTSTATUS auth_wbc_init(void)
 {
-       return smb_register_auth(AUTH_INTERFACE_VERSION, "onefs_wb", auth_init_onefs_wb);
+       return smb_register_auth(AUTH_INTERFACE_VERSION, "wbc", auth_init_wbc);
 }
index 2f9e3c0d49716299ea5b5f46c5339601309d188d..aaa9e35d9689bdc8768db5b99f81aa90cb4cce78 100644 (file)
@@ -1784,13 +1784,13 @@ static struct file_list {
  Free a file_list structure.
 ****************************************************************************/
 
-static void free_file_list (struct file_list *list_head)
+static void free_file_list (struct file_list *l_head)
 {
        struct file_list *list, *next;
 
-       for (list = list_head; list; list = next) {
+       for (list = l_head; list; list = next) {
                next = list->next;
-               DLIST_REMOVE(list_head, list);
+               DLIST_REMOVE(l_head, list);
                SAFE_FREE(list->file_path);
                SAFE_FREE(list);
        }
index a73660958055f72559c2edcb32a8ff44cd0ca95c..8623d3c04b537d3022f23b62e2da3aaca40f29ef 100644 (file)
@@ -179,7 +179,6 @@ static void mount_cifs_usage(void)
        printf("\n\t%s -V\n",thisprogram);
 
        SAFE_FREE(mountpassword);
-       exit(EX_USAGE);
 }
 
 /* caller frees username if necessary */
@@ -650,7 +649,9 @@ static int parse_options(char ** optionsp, int * filesys_flags)
                } else if (strncmp(data, "exec", 4) == 0) {
                        *filesys_flags &= ~MS_NOEXEC;
                } else if (strncmp(data, "guest", 5) == 0) {
-                       got_password=1;
+                       user_name = (char *)calloc(1, 1);
+                       got_user = 1;
+                       got_password = 1;
                } else if (strncmp(data, "ro", 2) == 0) {
                        *filesys_flags |= MS_RDONLY;
                } else if (strncmp(data, "rw", 2) == 0) {
@@ -1017,6 +1018,14 @@ uppercase_string(char *string)
        return 1;
 }
 
+static void print_cifs_mount_version(void)
+{
+       printf("mount.cifs version: %s.%s%s\n",
+               MOUNT_CIFS_VERSION_MAJOR,
+               MOUNT_CIFS_VERSION_MINOR,
+               MOUNT_CIFS_VENDOR_SUFFIX);
+}
+
 int main(int argc, char ** argv)
 {
        int c;
@@ -1078,6 +1087,24 @@ int main(int argc, char ** argv)
                        exit(EX_SYSERR);
                }
                mountpoint = argv[2];
+       } else if (argc == 2) {
+               if ((strcmp(argv[1], "-V") == 0) ||
+                   (strcmp(argv[1], "--version") == 0))
+               {
+                       print_cifs_mount_version();
+                       exit(0);
+               }
+
+               if ((strcmp(argv[1], "-h") == 0) ||
+                   (strcmp(argv[1], "-?") == 0) ||
+                   (strcmp(argv[1], "--help") == 0))
+               {
+                       mount_cifs_usage();
+                       exit(0);
+               }
+
+               mount_cifs_usage();
+               exit(EX_USAGE);
        } else {
                mount_cifs_usage();
                exit(EX_USAGE);
@@ -1102,7 +1129,7 @@ int main(int argc, char ** argv)
                case '?':
                case 'h':        /* help */
                        mount_cifs_usage ();
-                       exit(EX_USAGE);
+                       exit(0);
                case 'n':
                        ++nomtab;
                        break;
@@ -1134,11 +1161,8 @@ int main(int argc, char ** argv)
                case 'v':
                        ++verboseflag;
                        break;
-               case 'V':          
-                       printf ("mount.cifs version: %s.%s%s\n",
-                       MOUNT_CIFS_VERSION_MAJOR,
-                       MOUNT_CIFS_VERSION_MINOR,
-                       MOUNT_CIFS_VENDOR_SUFFIX);
+               case 'V':
+                       print_cifs_mount_version();
                        exit (0);
                case 'w':
                        flags &= ~MS_RDONLY;
index bd3d4af40b6290baf776730741a9ee8b84c13805..d67feccb9b518a56a4c621991dc82b10195e7e0c 100644 (file)
@@ -414,7 +414,7 @@ AC_SUBST(DYNEXP)
 
 dnl Add modules that have to be built by default here
 dnl These have to be built static:
-default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl rpc_ntsvcs rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss2 rpc_eventlog auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin auth_netlogond vfs_default nss_info_template"
+default_static_modules="pdb_smbpasswd pdb_tdbsam pdb_wbc_sam rpc_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl rpc_ntsvcs rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss2 rpc_eventlog auth_sam auth_unix auth_winbind auth_wbc auth_server auth_domain auth_builtin auth_netlogond vfs_default nss_info_template"
 
 dnl These are preferably build shared, and static if dlopen() is not available
 default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb vfs_smb_traffic_analyzer"
@@ -1088,7 +1088,7 @@ echo $samba_cv_HAVE_ONEFS
 if test x"$samba_cv_HAVE_ONEFS" = x"yes"; then
     AC_DEFINE(HAVE_ONEFS,1,[Whether building on Isilon OneFS])
     default_shared_modules="$default_shared_modules vfs_onefs vfs_onefs_shadow_copy perfcount_onefs"
-    default_static_modules="$default_static_modules auth_onefs_wb pdb_onefs_sam"
+    default_static_modules="$default_static_modules"
     ONEFS_LIBS="-lisi_acl -lisi_ecs -lisi_event -lisi_util"
     # Need to also add general libs for oplocks support
     save_LIBS="$save_LIBS -lisi_ecs -lisi_event -lisi_util -ldevstat"
@@ -6130,7 +6130,7 @@ SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o, "bin/ldapsam.$SHLIBEXT"
                   [ PASSDB_LIBS="$PASSDB_LIBS $LDAP_LIBS" ] )
 SMB_MODULE(pdb_smbpasswd, passdb/pdb_smbpasswd.o, "bin/smbpasswd.$SHLIBEXT", PDB)
 SMB_MODULE(pdb_tdbsam, passdb/pdb_tdb.o, "bin/tdbsam.$SHLIBEXT", PDB)
-SMB_MODULE(pdb_onefs_sam, passdb/pdb_onefs_sam.o, "bin/onefs_sam.$SHLIBEXT", PDB)
+SMB_MODULE(pdb_wbc_sam, passdb/pdb_wbc_sam.o, "bin/wbc_sam.$SHLIBEXT", PDB)
 SMB_SUBSYSTEM(PDB,passdb/pdb_interface.o)
 
 
@@ -6173,7 +6173,7 @@ SMB_SUBSYSTEM(CHARSET,lib/iconv.o)
 SMB_MODULE(auth_sam, \$(AUTH_SAM_OBJ), "bin/sam.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_unix, \$(AUTH_UNIX_OBJ), "bin/unix.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_winbind, \$(AUTH_WINBIND_OBJ), "bin/winbind.$SHLIBEXT", AUTH)
-SMB_MODULE(auth_onefs_wb, \$(AUTH_ONEFS_WB_OBJ), "bin/onefs_wb.$SHLIBEXT", AUTH)
+SMB_MODULE(auth_wbc, \$(AUTH_WBC_OBJ), "bin/wbc.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_server, \$(AUTH_SERVER_OBJ), "bin/smbserver.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_domain, \$(AUTH_DOMAIN_OBJ), "bin/domain.$SHLIBEXT", AUTH)
 SMB_MODULE(auth_builtin, \$(AUTH_BUILTIN_OBJ), "bin/builtin.$SHLIBEXT", AUTH)
index 5ab5564e4726c5836c7cdc020f9a1dd13ef5ece1..80d7bfc6cfa577a75e3e7dbd4d9260ce40165abd 100644 (file)
@@ -677,8 +677,6 @@ struct printjob;
 
 #include "smbldap.h"
 
-#include "smb_ldap.h"
-
 /*
  * Reasons for cache flush.
  */
index faf47d38441ef1ee95de8905f8d8d9cf2ddd6d99..808411114513c945db9a74a80a8c4c4234ed44c4 100644 (file)
@@ -695,8 +695,13 @@ SEC_DESC *dup_sec_desc(TALLOC_CTX *ctx, const SEC_DESC *src);
 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
                           struct security_descriptor *secdesc,
                           uint8 **data, size_t *len);
+NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
+                              struct sec_desc_buf *secdesc_buf,
+                              uint8_t **data, size_t *len);
 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
                             struct security_descriptor **psecdesc);
+NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
+                                struct sec_desc_buf **psecdesc_buf);
 SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, const DOM_SID *owner_sid, const DOM_SID *grp_sid,
                                 SEC_ACL *dacl, size_t *sd_size);
 SEC_DESC_BUF *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, SEC_DESC *sec_desc);
@@ -972,8 +977,6 @@ struct passwd *sys_getpwnam(const char *name);
 struct passwd *sys_getpwuid(uid_t uid);
 struct group *sys_getgrnam(const char *name);
 struct group *sys_getgrgid(gid_t gid);
-pid_t sys_fork(void);
-pid_t sys_getpid(void);
 int sys_popen(const char *command);
 int sys_pclose(int fd);
 ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
@@ -1240,15 +1243,6 @@ bool is_valid_policy_hnd(const POLICY_HND *hnd);
 bool policy_hnd_equal(const struct policy_handle *hnd1,
                      const struct policy_handle *hnd2);
 const char *strip_hostname(const char *s);
-struct async_req *read_pkt_send(TALLOC_CTX *mem_ctx,
-                               struct event_context *ev,
-                               int fd, size_t initial,
-                               ssize_t (*more)(uint8_t *buf, size_t buflen,
-                                               void *priv),
-                               void *priv);
-ssize_t read_pkt_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
-                     uint8_t **pbuf, int *perr);
-
 
 /* The following definitions come from lib/util_file.c  */
 
@@ -3114,7 +3108,7 @@ struct packet_struct *receive_dgram_packet(int fd, int t,
 bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
 int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
 void sort_query_replies(char *data, int n, struct in_addr ip);
-int name_mangle( char *In, char *Out, char name_type );
+char *name_mangle(TALLOC_CTX *mem_ctx, char *In, char name_type);
 int name_extract(char *buf,int ofs, fstring name);
 int name_len(char *s1);
 
@@ -5471,31 +5465,36 @@ WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli,
                                     const char *printername,
                                     uint32_t access_desired,
                                     struct policy_handle *handle);
+WERROR rpccli_spoolss_getprinterdriver2(struct rpc_pipe_client *cli,
+                                       TALLOC_CTX *mem_ctx,
+                                       struct policy_handle *handle,
+                                       const char *architecture,
+                                       uint32_t level,
+                                       uint32_t offered,
+                                       uint32_t client_major_version,
+                                       uint32_t client_minor_version,
+                                       union spoolss_DriverInfo *info,
+                                       uint32_t *server_major_version,
+                                       uint32_t *server_minor_version);
+WERROR rpccli_spoolss_addprinterex(struct rpc_pipe_client *cli,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct spoolss_SetPrinterInfoCtr *info_ctr);
+WERROR rpccli_spoolss_getprinter(struct rpc_pipe_client *cli,
+                                TALLOC_CTX *mem_ctx,
+                                struct policy_handle *handle,
+                                uint32_t level,
+                                uint32_t offered,
+                                union spoolss_PrinterInfo *info);
 WERROR rpccli_spoolss_enum_printers(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
                                 char *name, uint32 flags, uint32 level,
                                 uint32 *num_printers, PRINTER_INFO_CTR *ctr);
 WERROR rpccli_spoolss_enum_ports(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
                              uint32 level, uint32 *num_ports, PORT_INFO_CTR *ctr);
-WERROR rpccli_spoolss_getprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                             POLICY_HND *pol, uint32 level, 
-                             PRINTER_INFO_CTR *ctr);
-WERROR rpccli_spoolss_setprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                             POLICY_HND *pol, uint32 level, 
-                             PRINTER_INFO_CTR *ctr, uint32 command);
-WERROR rpccli_spoolss_getprinterdriver(struct rpc_pipe_client *cli, 
-                                   TALLOC_CTX *mem_ctx, 
-                                   POLICY_HND *pol, uint32 level, 
-                                   const char *env, int version, PRINTER_DRIVER_CTR *ctr);
 WERROR rpccli_spoolss_enumprinterdrivers (struct rpc_pipe_client *cli, 
                                       TALLOC_CTX *mem_ctx,
                                       uint32 level, const char *env,
                                       uint32 *num_drivers,
                                       PRINTER_DRIVER_CTR *ctr);
-WERROR rpccli_spoolss_addprinterdriver (struct rpc_pipe_client *cli, 
-                                    TALLOC_CTX *mem_ctx, uint32 level,
-                                    PRINTER_DRIVER_CTR *ctr);
-WERROR rpccli_spoolss_addprinterex (struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
-                                uint32 level, PRINTER_INFO_CTR*ctr);
 WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
                             POLICY_HND *handle, int level, uint32 *num_forms,
                             FORM_1 **forms);
@@ -5806,17 +5805,7 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int
 
 bool spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime);
 bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime);
-bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u );
 bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode);
-bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, 
-       const char *srv_name, const char* clientname, const char* user_name,
-       uint32 level, PRINTER_INFO_CTR *ctr);
-bool make_spoolss_printer_info_2(TALLOC_CTX *ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, 
-                               PRINTER_INFO_2 *info);
-bool make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 **spool_info3, 
-                               PRINTER_INFO_3 *info);
-bool make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 **spool_info7, 
-                               PRINTER_INFO_7 *info);
 bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
                                   const POLICY_HND *handle,
                                   const char *valuename, uint32 size);
@@ -5869,11 +5858,6 @@ uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info);
 uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p);
 uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info);
 uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info);
-bool make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, 
-                              const POLICY_HND *hnd,
-                              const fstring architecture,
-                              uint32 level, uint32 clientmajor, uint32 clientminor,
-                              RPC_BUFFER *buffer, uint32 offered);
 bool spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth);
 bool spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth);
 bool make_spoolss_q_enumprinters(
@@ -5891,19 +5875,6 @@ bool spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_
 bool spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth);
 bool spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth);
 bool spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth);
-bool make_spoolss_q_getprinter(
-       TALLOC_CTX *mem_ctx,
-       SPOOL_Q_GETPRINTER *q_u, 
-       const POLICY_HND *hnd, 
-       uint32 level, 
-       RPC_BUFFER *buffer, 
-       uint32 offered
-);
-bool make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, 
-                               const POLICY_HND *hnd, uint32 level, PRINTER_INFO_CTR *info, 
-                               uint32 command);
-bool spoolss_io_r_setprinter(const char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth);
-bool spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth);
 bool spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth);
 bool make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd,
                                uint32 firstjob,
@@ -5923,31 +5894,7 @@ bool spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct
 bool spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth);
 bool spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth);
 bool spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth);
-bool spool_io_printer_info_level_1(const char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth);
-bool spool_io_printer_info_level_3(const char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth);
-bool spool_io_printer_info_level_2(const char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth);
-bool spool_io_printer_info_level_7(const char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth);
-bool spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth);
-bool spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth);
-bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u, 
-                              prs_struct *ps, int depth);
-bool spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, 
-                                          prs_struct *ps, int depth);
-bool spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, 
-                                          prs_struct *ps, int depth);
-bool smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth);
-bool spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth);
-bool make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx,
-                               SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name, 
-                               uint32 level, PRINTER_DRIVER_CTR *info);
-bool make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx,
-       SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info,
-                               DRIVER_INFO_3 *info3);
 bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src);
-bool spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth);
-bool spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth);
-bool uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
-                              NT_PRINTER_INFO_LEVEL_2  *d);
 bool spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth);
 bool spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth);
 bool spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth);
@@ -6238,7 +6185,6 @@ bool init_service_op_table( void );
 
 /* The following definitions come from rpcclient/cmd_spoolss.c  */
 
-void set_drv_info_3_env (DRIVER_INFO_3 *info, const char *arch);
 
 /* The following definitions come from rpcclient/cmd_srvsvc.c  */
 
index 504cfea70b17ebbf3b40a0a52569913a00911d43..c494fdd6bfc2cffe44274bcf5c09bc68b90af5ad 100644 (file)
@@ -261,25 +261,6 @@ PRINTER_MESSAGE_INFO;
 #define DRIVER_MAX_VERSION             4
 
 
-/* this struct is undocumented */
-/* thanks to the ddk ... */
-typedef struct {
-       uint32 size;            /* length of user_name & client_name + 2? */
-       UNISTR2 *client_name;
-       UNISTR2 *user_name;
-       uint32 build;
-       uint32 major;
-       uint32 minor;
-       uint32 processor;
-} SPOOL_USER_1;
-
-typedef struct {
-       uint32 level;
-       union {
-               SPOOL_USER_1 *user1;
-       } user;
-} SPOOL_USER_CTR;
-
 /* 
  * Devicemode structure
  */
@@ -872,208 +853,8 @@ typedef struct spool_r_enumforms
 }
 SPOOL_R_ENUMFORMS;
 
-typedef struct spool_printer_info_level_1
-{
-       uint32 flags;
-       uint32 description_ptr;
-       uint32 name_ptr;
-       uint32 comment_ptr;
-       UNISTR2 description;
-       UNISTR2 name;
-       UNISTR2 comment;        
-} SPOOL_PRINTER_INFO_LEVEL_1;
-
-typedef struct spool_printer_info_level_2
-{
-       uint32 servername_ptr;
-       uint32 printername_ptr;
-       uint32 sharename_ptr;
-       uint32 portname_ptr;
-       uint32 drivername_ptr;
-       uint32 comment_ptr;
-       uint32 location_ptr;
-       uint32 devmode_ptr;
-       uint32 sepfile_ptr;
-       uint32 printprocessor_ptr;
-       uint32 datatype_ptr;
-       uint32 parameters_ptr;
-       uint32 secdesc_ptr;
-       uint32 attributes;
-       uint32 priority;
-       uint32 default_priority;
-       uint32 starttime;
-       uint32 untiltime;
-       uint32 status;
-       uint32 cjobs;
-       uint32 averageppm;
-       UNISTR2 servername;
-       UNISTR2 printername;
-       UNISTR2 sharename;
-       UNISTR2 portname;
-       UNISTR2 drivername;
-       UNISTR2 comment;
-       UNISTR2 location;
-       UNISTR2 sepfile;
-       UNISTR2 printprocessor;
-       UNISTR2 datatype;
-       UNISTR2 parameters;
-}
-SPOOL_PRINTER_INFO_LEVEL_2;
-
-typedef struct spool_printer_info_level_3
-{
-       uint32 secdesc_ptr;
-}
-SPOOL_PRINTER_INFO_LEVEL_3;
-
-typedef struct spool_printer_info_level_7
-{
-       uint32 guid_ptr;
-       uint32 action;
-       UNISTR2 guid;
-}
-SPOOL_PRINTER_INFO_LEVEL_7;
-
-typedef struct spool_printer_info_level
-{
-       uint32 level;
-       uint32 info_ptr;
-       SPOOL_PRINTER_INFO_LEVEL_1 *info_1;
-       SPOOL_PRINTER_INFO_LEVEL_2 *info_2;
-       SPOOL_PRINTER_INFO_LEVEL_3 *info_3;
-       SPOOL_PRINTER_INFO_LEVEL_7 *info_7;
-}
-SPOOL_PRINTER_INFO_LEVEL;
-
-typedef struct spool_printer_driver_info_level_3
-{
-       uint32 cversion;
-       uint32 name_ptr;
-       uint32 environment_ptr;
-       uint32 driverpath_ptr;
-       uint32 datafile_ptr;
-       uint32 configfile_ptr;
-       uint32 helpfile_ptr;
-       uint32 monitorname_ptr;
-       uint32 defaultdatatype_ptr;
-       uint32 dependentfilessize;
-       uint32 dependentfiles_ptr;
-
-       UNISTR2 name;
-       UNISTR2 environment;
-       UNISTR2 driverpath;
-       UNISTR2 datafile;
-       UNISTR2 configfile;
-       UNISTR2 helpfile;
-       UNISTR2 monitorname;
-       UNISTR2 defaultdatatype;
-       BUFFER5 dependentfiles;
-
-}
-SPOOL_PRINTER_DRIVER_INFO_LEVEL_3;
-
-/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */
-typedef struct {
-       uint32 version;
-       uint32 name_ptr;
-       uint32 environment_ptr;
-       uint32 driverpath_ptr;
-       uint32 datafile_ptr;
-       uint32 configfile_ptr;
-       uint32 helpfile_ptr;
-       uint32 monitorname_ptr;
-       uint32 defaultdatatype_ptr;
-       uint32 dependentfiles_len;
-       uint32 dependentfiles_ptr;
-       uint32 previousnames_len;
-       uint32 previousnames_ptr;
-       NTTIME  driverdate;
-       uint64  driverversion;
-       uint32  dummy4;
-       uint32 mfgname_ptr;
-       uint32 oemurl_ptr;
-       uint32 hardwareid_ptr;
-       uint32 provider_ptr;
-       UNISTR2 name;
-       UNISTR2 environment;
-       UNISTR2 driverpath;
-       UNISTR2 datafile;
-       UNISTR2 configfile;
-       UNISTR2 helpfile;
-       UNISTR2 monitorname;
-       UNISTR2 defaultdatatype;
-       BUFFER5 dependentfiles;
-       BUFFER5 previousnames;
-       UNISTR2 mfgname;
-       UNISTR2 oemurl;
-       UNISTR2 hardwareid;
-       UNISTR2 provider;
-} SPOOL_PRINTER_DRIVER_INFO_LEVEL_6;
-
-
-typedef struct spool_printer_driver_info_level
-{
-       uint32 level;
-       uint32 ptr;
-       SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *info_3;
-       SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *info_6;
-}
-SPOOL_PRINTER_DRIVER_INFO_LEVEL;
-
-
-typedef struct spool_q_setprinter
-{
-       POLICY_HND handle;
-       uint32 level;
-       SPOOL_PRINTER_INFO_LEVEL info;
-       SEC_DESC_BUF *secdesc_ctr;
-       DEVMODE_CTR devmode_ctr;
-
-       uint32 command;
-
-}
-SPOOL_Q_SETPRINTER;
-
-typedef struct spool_r_setprinter
-{
-       WERROR status;
-}
-SPOOL_R_SETPRINTER;
-
-/********************************************/
-
-typedef struct {
-       UNISTR2 *server_name;
-       uint32 level;
-       SPOOL_PRINTER_INFO_LEVEL info;
-       DEVMODE_CTR devmode_ctr;
-       SEC_DESC_BUF *secdesc_ctr;
-       uint32 user_switch;
-       SPOOL_USER_CTR user_ctr;
-} SPOOL_Q_ADDPRINTEREX;
-
-typedef struct {
-       POLICY_HND handle;
-       WERROR status;
-} SPOOL_R_ADDPRINTEREX;
-
 /********************************************/
 
-typedef struct spool_q_addprinterdriver
-{
-       uint32 server_name_ptr;
-       UNISTR2 server_name;
-       uint32 level;
-       SPOOL_PRINTER_DRIVER_INFO_LEVEL info;
-}
-SPOOL_Q_ADDPRINTERDRIVER;
-
-typedef struct spool_r_addprinterdriver
-{
-       WERROR status;
-}
-SPOOL_R_ADDPRINTERDRIVER;
-
 typedef struct spool_q_enumprintprocessors
 {
        uint32 name_ptr;
index 131416b68520258e0525bffe5e8252f3aaae2d56..f9a0436546fa52355b43b427d529cec215114750 100644 (file)
@@ -75,6 +75,10 @@ enum profile_stats_values
 #define syscall_open_count __profile_stats_value(PR_VALUE_SYSCALL_OPEN, count)
 #define syscall_open_time __profile_stats_value(PR_VALUE_SYSCALL_OPEN, time)
 
+       PR_VALUE_SYSCALL_CREATEFILE,
+#define syscall_createfile_count __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, count)
+#define syscall_createfile_time __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, time)
+
        PR_VALUE_SYSCALL_CLOSE,
 #define syscall_close_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, count)
 #define syscall_close_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, time)
@@ -111,6 +115,10 @@ enum profile_stats_values
 #define syscall_rename_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME, count)
 #define syscall_rename_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME, time)
 
+       PR_VALUE_SYSCALL_RENAME_AT,
+#define syscall_rename_at_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, count)
+#define syscall_rename_at_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, time)
+
        PR_VALUE_SYSCALL_FSYNC,
 #define syscall_fsync_count __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, count)
 #define syscall_fsync_time __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, time)
@@ -215,6 +223,26 @@ enum profile_stats_values
 #define syscall_set_quota_count __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, count)
 #define syscall_set_quota_time __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, time)
 
+       PR_VALUE_SYSCALL_GET_SD,
+#define syscall_get_sd_count __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, count)
+#define syscall_get_sd_time __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, time)
+
+       PR_VALUE_SYSCALL_SET_SD,
+#define syscall_set_sd_count __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, count)
+#define syscall_set_sd_time __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, time)
+
+       PR_VALUE_SYSCALL_BRL_LOCK,
+#define syscall_brl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, count)
+#define syscall_brl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, time)
+
+       PR_VALUE_SYSCALL_BRL_UNLOCK,
+#define syscall_brl_unlock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, count)
+#define syscall_brl_unlock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, time)
+
+       PR_VALUE_SYSCALL_BRL_CANCEL,
+#define syscall_brl_cancel_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, count)
+#define syscall_brl_cancel_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, time)
+
 /* counters for individual SMB types */
        PR_VALUE_SMBMKDIR,
 #define SMBmkdir_count __profile_stats_value(PR_VALUE_SMBMKDIR, count)
index a1530987f3b1ea4c4309d6a347a0a27f4c51a0a0..8c4a45bbc94c454578ef688d018101ec0258809e 100644 (file)
@@ -157,7 +157,6 @@ void dump_core_setup(const char *progname)
                return;
        }
 
-       SAFE_FREE(corepath);
        SAFE_FREE(logbase);
 
 #ifdef HAVE_GETRLIMIT
index 2181ff014d26777d26a01e8ddb2b7f29e5cc91c0..98623d1985c8b70e69cdf235f9ae4854c27473ac 100644 (file)
 
 #include "includes.h"
 
-#if HAVE_LDAP
-
+#if defined(HAVE_LDAP) && defined(HAVE_LBER_LOG_PRINT_FN)
 static void samba_ldap_log_print_fn(LDAP_CONST char *data)
 {
        DEBUG(lp_ldap_debug_threshold(), ("[LDAP] %s", data));
 }
-
 #endif
 
 void init_ldap_debugging(void)
index 232bbca43c876d4b62766de73beef013bfb3fc64..a81c4ae82a2e3ba8150527af896ffa8e382d4ac9 100644 (file)
@@ -290,6 +290,32 @@ NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
        return NT_STATUS_OK;
 }
 
+/*******************************************************************
+ Convert a secdesc_buf into a byte stream
+********************************************************************/
+
+NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
+                              struct sec_desc_buf *secdesc_buf,
+                              uint8_t **data, size_t *len)
+{
+       DATA_BLOB blob;
+       enum ndr_err_code ndr_err;
+
+       ndr_err = ndr_push_struct_blob(
+               &blob, mem_ctx, NULL, secdesc_buf,
+               (ndr_push_flags_fn_t)ndr_push_sec_desc_buf);
+
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               DEBUG(0, ("ndr_push_sec_desc_buf failed: %s\n",
+                         ndr_errstr(ndr_err)));
+               return ndr_map_error2ntstatus(ndr_err);;
+       }
+
+       *data = blob.data;
+       *len = blob.length;
+       return NT_STATUS_OK;
+}
+
 /*******************************************************************
  Parse a byte stream into a secdesc
 ********************************************************************/
@@ -326,6 +352,43 @@ NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
        return NT_STATUS_OK;
 }
 
+/*******************************************************************
+ Parse a byte stream into a sec_desc_buf
+********************************************************************/
+
+NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
+                                struct sec_desc_buf **psecdesc_buf)
+{
+       DATA_BLOB blob;
+       enum ndr_err_code ndr_err;
+       struct sec_desc_buf *result;
+
+       if ((data == NULL) || (len == 0)) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       result = TALLOC_ZERO_P(mem_ctx, struct sec_desc_buf);
+       if (result == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       blob = data_blob_const(data, len);
+
+       ndr_err = ndr_pull_struct_blob(
+               &blob, result, NULL, result,
+               (ndr_pull_flags_fn_t)ndr_pull_sec_desc_buf);
+
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               DEBUG(0, ("ndr_pull_sec_desc_buf failed: %s\n",
+                         ndr_errstr(ndr_err)));
+               TALLOC_FREE(result);
+               return ndr_map_error2ntstatus(ndr_err);;
+       }
+
+       *psecdesc_buf = result;
+       return NT_STATUS_OK;
+}
+
 /*******************************************************************
  Creates a SEC_DESC structure with typical defaults.
 ********************************************************************/
index f0561a5081ef8d8812f315cf9d4faec764c84a8e..e24d35818c78944cd6f754f685868a037323ac37 100644 (file)
@@ -581,7 +581,9 @@ static void smbldap_store_state(LDAP *ld, struct smbldap_state *smbldap_state)
 
 int smb_ldap_start_tls(LDAP *ldap_struct, int version)
 { 
+#ifdef LDAP_OPT_X_TLS
        int rc;
+#endif
        
        if (lp_ldap_ssl() != LDAP_SSL_START_TLS) {
                return LDAP_SUCCESS;
index ed66666ddb018d2ca84ce3d2f8de84a7f3ca176f..10b55f662d274f905f7105072c2a48bd28201bee 100644 (file)
@@ -1042,35 +1042,6 @@ static char **extract_args(TALLOC_CTX *mem_ctx, const char *command)
        return NULL;
 }
 
-/**************************************************************************
- Wrapper for fork. Ensures that mypid is reset. Used so we can write
- a sys_getpid() that only does a system call *once*.
-****************************************************************************/
-
-static pid_t mypid = (pid_t)-1;
-
-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*.
-****************************************************************************/
-
-pid_t sys_getpid(void)
-{
-       if (mypid == (pid_t)-1)
-               mypid = getpid();
-
-       return mypid;
-}
-
 /**************************************************************************
  Wrapper for popen. Safer as it doesn't search a path.
  Modified from the glibc sources.
@@ -2008,7 +1979,6 @@ static ssize_t solaris_read_xattr(int attrfd, void *value, size_t size)
 static ssize_t solaris_list_xattr(int attrdirfd, char *list, size_t size)
 {
        ssize_t len = 0;
-       int stop = 0;
        DIR *dirp;
        struct dirent *de;
        int newfd = dup(attrdirfd);
@@ -2080,7 +2050,7 @@ static int solaris_openat(int fildes, const char *path, int oflag, mode_t mode)
 {
        int filedes = openat(fildes, path, oflag, mode);
        if (filedes == -1) {
-               DEBUG(10,("openat FAILED: fd: %s, path: %s, errno: %s\n",filedes,path,strerror(errno)));
+               DEBUG(10,("openat FAILED: fd: %d, path: %s, errno: %s\n",filedes,path,strerror(errno)));
                if (errno == EINVAL) {
                        errno = ENOTSUP;
                } else {
index 1f5dfe4d258b4928e55442fba286ec75c5e08450..092546e3eb53b6df077f8286c7f3e962bc0f72b4 100644 (file)
@@ -118,7 +118,8 @@ int tdb_validate(struct tdb_context *tdb, tdb_validate_data_func validate_fn)
 
        /* parent */
 
-       DEBUG(10, ("tdb_validate: fork succeeded, child PID = %d\n",child_pid));
+       DEBUG(10, ("tdb_validate: fork succeeded, child PID = %u\n",
+               (unsigned int)child_pid));
 
        DEBUG(10, ("tdb_validate: waiting for child to finish...\n"));
        while  ((wait_pid = sys_waitpid(child_pid, &child_status, 0)) < 0) {
@@ -134,7 +135,7 @@ int tdb_validate(struct tdb_context *tdb, tdb_validate_data_func validate_fn)
        }
        if (wait_pid != child_pid) {
                DEBUG(1, ("tdb_validate: waitpid returned pid %d, "
-                         "but %d was expected\n", wait_pid, child_pid));
+                         "but %u was expected\n", wait_pid, (unsigned int)child_pid));
                goto done;
        }
 
index cda1fb474de72ef14ab1af9ff5c0143481da29bb..89f7be8e6ce3e48b463b9b3fecd90f4d948b1c1b 100644 (file)
@@ -3145,102 +3145,3 @@ const char *strip_hostname(const char *s)
 
        return s;
 }
-
-struct read_pkt_state {
-       struct event_context *ev;
-       int fd;
-       uint8_t *buf;
-       ssize_t (*more)(uint8_t *buf, size_t buflen, void *priv);
-       void *priv;
-};
-
-static void read_pkt_done(struct async_req *subreq);
-
-struct async_req *read_pkt_send(TALLOC_CTX *mem_ctx,
-                               struct event_context *ev,
-                               int fd, size_t initial,
-                               ssize_t (*more)(uint8_t *buf, size_t buflen,
-                                               void *priv),
-                               void *priv)
-{
-       struct async_req *result, *subreq;
-       struct read_pkt_state *state;
-
-       if (!async_req_setup(mem_ctx, &result, &state,
-                            struct read_pkt_state)) {
-               return NULL;
-       }
-       state->ev = ev;
-       state->fd = fd;
-       state->more = more;
-
-       state->buf = talloc_array(state, uint8_t, initial);
-       if (state->buf == NULL) {
-               goto fail;
-       }
-       subreq = recvall_send(state, ev, fd, state->buf, initial, 0);
-       if (subreq == NULL) {
-               goto fail;
-       }
-       subreq->async.fn = read_pkt_done;
-       subreq->async.priv = result;
-       return result;
- fail:
-       TALLOC_FREE(result);
-       return NULL;
-}
-
-static void read_pkt_done(struct async_req *subreq)
-{
-       struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
-       struct read_pkt_state *state = talloc_get_type_abort(
-               req->private_data, struct read_pkt_state);
-       size_t current_size;
-       ssize_t received;
-       ssize_t more;
-       int err;
-
-       received = recvall_recv(subreq, &err);
-       TALLOC_FREE(subreq);
-       if (received == -1) {
-               async_req_error(req, err);
-               return;
-       }
-       current_size = talloc_get_size(state->buf);
-
-       more = state->more(state->buf, current_size, state->priv);
-       if (more < 0) {
-               async_req_error(req, EIO);
-               return;
-       }
-       if (more == 0) {
-               async_req_done(req);
-               return;
-       }
-       state->buf = TALLOC_REALLOC_ARRAY(state, state->buf, uint8_t,
-                                         current_size + more);
-       if (async_req_nomem(state->buf, req)) {
-               return;
-       }
-       subreq = recvall_send(state, state->ev, state->fd,
-                             state->buf + current_size, more, 0);
-       if (async_req_nomem(subreq, req)) {
-               return;
-       }
-       subreq->async.fn = read_pkt_done;
-       subreq->async.priv = req;
-}
-
-ssize_t read_pkt_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
-                     uint8_t **pbuf, int *perr)
-{
-       struct read_pkt_state *state = talloc_get_type_abort(
-               req->private_data, struct read_pkt_state);
-
-       if (async_req_is_errno(req, perr)) {
-               return -1;
-       }
-       *pbuf = talloc_move(mem_ctx, &state->buf);
-       return talloc_get_size(*pbuf);
-}
index c46aa2ac49b75c7b43f5fd66416473a894b2853f..83e8a9d3553b7de2e8837e83feeb0393229a637c 100644 (file)
@@ -953,7 +953,7 @@ struct open_socket_out_state {
        int wait_nsec;
 };
 
-static void open_socket_out_connected(struct async_req *subreq);
+static void open_socket_out_connected(struct tevent_req *subreq);
 
 static int open_socket_out_state_destructor(struct open_socket_out_state *s)
 {
@@ -974,7 +974,8 @@ struct async_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
                                       int timeout)
 {
        char addr[INET6_ADDRSTRLEN];
-       struct async_req *result, *subreq;
+       struct async_req *result;
+       struct tevent_req *subreq;
        struct open_socket_out_state *state;
        NTSTATUS status;
 
@@ -1026,13 +1027,14 @@ struct async_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
                                    (struct sockaddr *)&state->ss,
                                    state->salen);
        if ((subreq == NULL)
-           || !async_req_set_timeout(subreq, state->ev,
-                                     timeval_set(0, state->wait_nsec))) {
+           || !tevent_req_set_endtime(
+                   subreq, state->ev,
+                   timeval_current_ofs(0, state->wait_nsec))) {
                status = NT_STATUS_NO_MEMORY;
                goto post_status;
        }
        subreq->async.fn = open_socket_out_connected;
-       subreq->async.priv = result;
+       subreq->async.private_data = result;
        return result;
 
  post_status:
@@ -1045,18 +1047,18 @@ struct async_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
        return NULL;
 }
 
-static void open_socket_out_connected(struct async_req *subreq)
+static void open_socket_out_connected(struct tevent_req *subreq)
 {
        struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
+               subreq->async.private_data, struct async_req);
        struct open_socket_out_state *state = talloc_get_type_abort(
                req->private_data, struct open_socket_out_state);
-       int err;
+       int ret;
        int sys_errno;
 
-       err = async_connect_recv(subreq, &sys_errno);
+       ret = async_connect_recv(subreq, &sys_errno);
        TALLOC_FREE(subreq);
-       if (err == 0) {
+       if (ret == 0) {
                async_req_done(req);
                return;
        }
@@ -1083,13 +1085,14 @@ static void open_socket_out_connected(struct async_req *subreq)
                if (async_req_nomem(subreq, req)) {
                        return;
                }
-               if (!async_req_set_timeout(subreq, state->ev,
-                                          timeval_set(0, state->wait_nsec))) {
+               if (!tevent_req_set_endtime(
+                           subreq, state->ev,
+                           timeval_current_ofs(0, state->wait_nsec))) {
                        async_req_error(req, ENOMEM);
                        return;
                }
                subreq->async.fn = open_socket_out_connected;
-               subreq->async.priv = req;
+               subreq->async.private_data = req;
                return;
        }
 
index 9bf6f29105f006a745b6c099cfc2e30610068a30..a5adf8f10841c6e3129da3701d06c1ecd1f58561 100644 (file)
@@ -27,9 +27,7 @@
 
 struct req_read_state {
        struct winbindd_request *wb_req;
-       struct tevent_context *ev;
        size_t max_extra_data;
-       int fd;
 };
 
 bool async_req_is_wbcerr(struct async_req *req, wbcErr *pwbc_err)
@@ -83,145 +81,91 @@ wbcErr async_req_simple_recv_wbcerr(struct async_req *req)
        return WBC_ERR_SUCCESS;
 }
 
-static void wb_req_read_len(struct async_req *subreq);
-static void wb_req_read_main(struct async_req *subreq);
-static void wb_req_read_extra(struct async_req *subreq);
+static ssize_t wb_req_more(uint8_t *buf, size_t buflen, void *private_data);
+static void wb_req_read_done(struct tevent_req *subreq);
 
 struct async_req *wb_req_read_send(TALLOC_CTX *mem_ctx,
                                   struct tevent_context *ev,
                                   int fd, size_t max_extra_data)
 {
-       struct async_req *result, *subreq;
+       struct async_req *result;
+       struct tevent_req *subreq;
        struct req_read_state *state;
 
        if (!async_req_setup(mem_ctx, &result, &state,
                             struct req_read_state)) {
                return NULL;
        }
-       state->fd = fd;
-       state->ev = ev;
        state->max_extra_data = max_extra_data;
-       state->wb_req = talloc(state, struct winbindd_request);
-       if (state->wb_req == NULL) {
-               goto nomem;
-       }
 
-       subreq = recvall_send(state, ev, state->fd, &(state->wb_req->length),
-                             sizeof(state->wb_req->length), 0);
+       subreq = read_packet_send(state, ev, fd, 4, wb_req_more, state);
        if (subreq == NULL) {
                goto nomem;
        }
 
-       subreq->async.fn = wb_req_read_len;
-       subreq->async.priv = result;
+       subreq->async.fn = wb_req_read_done;
+       subreq->async.private_data = result;
        return result;
-
  nomem:
        TALLOC_FREE(result);
        return NULL;
 }
 
-static void wb_req_read_len(struct async_req *subreq)
+static ssize_t wb_req_more(uint8_t *buf, size_t buflen, void *private_data)
 {
-       struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
        struct req_read_state *state = talloc_get_type_abort(
-               req->private_data, struct req_read_state);
-       int err;
-       ssize_t ret;
-
-       ret = recvall_recv(subreq, &err);
-       TALLOC_FREE(subreq);
-       if (ret < 0) {
-               async_req_error(req, map_wbc_err_from_errno(err));
-               return;
-       }
+               private_data, struct req_read_state);
+       struct winbindd_request *req = (struct winbindd_request *)buf;
 
-       if (state->wb_req->length != sizeof(struct winbindd_request)) {
-               DEBUG(0, ("wb_req_read_len: Invalid request size received: "
-                         "%d (expected %d)\n", (int)state->wb_req->length,
-                         (int)sizeof(struct winbindd_request)));
-               async_req_error(req, WBC_ERR_INVALID_RESPONSE);
-               return;
+       if (buflen == 4) {
+               if (req->length != sizeof(struct winbindd_request)) {
+                       DEBUG(0, ("wb_req_read_len: Invalid request size "
+                                 "received: %d (expected %d)\n",
+                                 (int)req->length,
+                                 (int)sizeof(struct winbindd_request)));
+                       return -1;
+               }
+               return sizeof(struct winbindd_request) - 4;
        }
 
-       subreq = recvall_send(
-               req, state->ev, state->fd, (uint32 *)(state->wb_req)+1,
-               sizeof(struct winbindd_request) - sizeof(uint32), 0);
-       if (async_req_nomem(subreq, req)) {
-               return;
+       if ((state->max_extra_data != 0)
+           && (req->extra_len > state->max_extra_data)) {
+               DEBUG(3, ("Got request with %d bytes extra data on "
+                         "unprivileged socket\n", (int)req->extra_len));
+               return -1;
        }
 
-       subreq->async.fn = wb_req_read_main;
-       subreq->async.priv = req;
+       return req->extra_len;
 }
 
-static void wb_req_read_main(struct async_req *subreq)
+static void wb_req_read_done(struct tevent_req *subreq)
 {
        struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
+               subreq->async.private_data, struct async_req);
        struct req_read_state *state = talloc_get_type_abort(
                req->private_data, struct req_read_state);
        int err;
        ssize_t ret;
+       uint8_t *buf;
 
-       ret = recvall_recv(subreq, &err);
+       ret = read_packet_recv(subreq, state, &buf, &err);
        TALLOC_FREE(subreq);
-       if (ret < 0) {
+       if (ret == -1) {
                async_req_error(req, map_wbc_err_from_errno(err));
                return;
        }
 
-       if ((state->max_extra_data != 0)
-           && (state->wb_req->extra_len > state->max_extra_data)) {
-               DEBUG(3, ("Got request with %d bytes extra data on "
-                         "unprivileged socket\n",
-                         (int)state->wb_req->extra_len));
-               async_req_error(req, WBC_ERR_INVALID_RESPONSE);
-               return;
-       }
-
-       if (state->wb_req->extra_len == 0) {
-               async_req_done(req);
-               return;
-       }
-
-       state->wb_req->extra_data.data = TALLOC_ARRAY(
-               state->wb_req, char, state->wb_req->extra_len + 1);
-       if (async_req_nomem(state->wb_req->extra_data.data, req)) {
-               return;
-       }
-
-       state->wb_req->extra_data.data[state->wb_req->extra_len] = 0;
-
-       subreq = recvall_send(
-               req, state->ev, state->fd, state->wb_req->extra_data.data,
-               state->wb_req->extra_len, 0);
-       if (async_req_nomem(subreq, req)) {
-               return;
-       }
-
-       subreq->async.fn = wb_req_read_extra;
-       subreq->async.priv = req;
-}
-
-static void wb_req_read_extra(struct async_req *subreq)
-{
-       struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
-       int err;
-       ssize_t ret;
+       state->wb_req = (struct winbindd_request *)buf;
 
-       ret = recvall_recv(subreq, &err);
-       TALLOC_FREE(subreq);
-       if (ret < 0) {
-               async_req_error(req, map_wbc_err_from_errno(err));
-               return;
+       if (state->wb_req->extra_len != 0) {
+               state->wb_req->extra_data.data =
+                       (char *)buf + sizeof(struct winbindd_request);
+       } else {
+               state->wb_req->extra_data.data = NULL;
        }
        async_req_done(req);
 }
 
-
 wbcErr wb_req_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
                        struct winbindd_request **preq)
 {
@@ -237,90 +181,60 @@ wbcErr wb_req_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
 }
 
 struct req_write_state {
-       struct winbindd_request *wb_req;
-       struct tevent_context *ev;
-       int fd;
+       struct iovec iov[2];
 };
 
-static void wb_req_write_main(struct async_req *subreq);
-static void wb_req_write_extra(struct async_req *subreq);
+static void wb_req_write_done(struct tevent_req *subreq);
 
 struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev, int fd,
                                    struct winbindd_request *wb_req)
 {
-       struct async_req *result, *subreq;
+       struct async_req *result;
+       struct tevent_req *subreq;
        struct req_write_state *state;
+       int count = 1;
 
        if (!async_req_setup(mem_ctx, &result, &state,
                             struct req_write_state)) {
                return NULL;
        }
-       state->fd = fd;
-       state->ev = ev;
-       state->wb_req = wb_req;
 
-       subreq = sendall_send(state, state->ev, state->fd, state->wb_req,
-                             sizeof(struct winbindd_request), 0);
-       if (subreq == NULL) {
-               goto nomem;
+       state->iov[0].iov_base = wb_req;
+       state->iov[0].iov_len = sizeof(struct winbindd_request);
+
+       if (wb_req->extra_len != 0) {
+               state->iov[1].iov_base = wb_req->extra_data.data;
+               state->iov[1].iov_len = wb_req->extra_len;
+               count = 2;
        }
 
-       subreq->async.fn = wb_req_write_main;
-       subreq->async.priv = result;
+       subreq = writev_send(state, ev, fd, state->iov, count);
+       if (subreq == NULL) {
+               goto fail;
+       }
+       subreq->async.fn = wb_req_write_done;
+       subreq->async.private_data = result;
        return result;
 
nomem:
fail:
        TALLOC_FREE(result);
        return NULL;
 }
 
-static void wb_req_write_main(struct async_req *subreq)
-{
-       struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
-       struct req_write_state *state = talloc_get_type_abort(
-               req->private_data, struct req_write_state);
-       int err;
-       ssize_t ret;
-
-       ret = sendall_recv(subreq, &err);
-       TALLOC_FREE(subreq);
-       if (ret < 0) {
-               async_req_error(req, map_wbc_err_from_errno(err));
-               return;
-       }
-
-       if (state->wb_req->extra_len == 0) {
-               async_req_done(req);
-               return;
-       }
-
-       subreq = sendall_send(state, state->ev, state->fd,
-                             state->wb_req->extra_data.data,
-                             state->wb_req->extra_len, 0);
-       if (async_req_nomem(subreq, req)) {
-               return;
-       }
-
-       subreq->async.fn = wb_req_write_extra;
-       subreq->async.priv = req;
-}
-
-static void wb_req_write_extra(struct async_req *subreq)
+static void wb_req_write_done(struct tevent_req *subreq)
 {
        struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
+               subreq->async.private_data, struct async_req);
        int err;
        ssize_t ret;
 
-       ret = sendall_recv(subreq, &err);
+       ret = writev_recv(subreq, &err);
        TALLOC_FREE(subreq);
        if (ret < 0) {
                async_req_error(req, map_wbc_err_from_errno(err));
                return;
        }
-
        async_req_done(req);
 }
 
@@ -331,40 +245,29 @@ wbcErr wb_req_write_recv(struct async_req *req)
 
 struct resp_read_state {
        struct winbindd_response *wb_resp;
-       struct tevent_context *ev;
-       size_t max_extra_data;
-       int fd;
 };
 
-static void wb_resp_read_len(struct async_req *subreq);
-static void wb_resp_read_main(struct async_req *subreq);
-static void wb_resp_read_extra(struct async_req *subreq);
+static ssize_t wb_resp_more(uint8_t *buf, size_t buflen, void *private_data);
+static void wb_resp_read_done(struct tevent_req *subreq);
 
 struct async_req *wb_resp_read_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev, int fd)
 {
-       struct async_req *result, *subreq;
+       struct async_req *result;
+       struct tevent_req *subreq;
        struct resp_read_state *state;
 
        if (!async_req_setup(mem_ctx, &result, &state,
                             struct resp_read_state)) {
                return NULL;
        }
-       state->fd = fd;
-       state->ev = ev;
-       state->wb_resp = talloc(state, struct winbindd_response);
-       if (state->wb_resp == NULL) {
-               goto nomem;
-       }
 
-       subreq = recvall_send(state, ev, state->fd, &(state->wb_resp->length),
-                             sizeof(state->wb_resp->length), 0);
+       subreq = read_packet_send(state, ev, fd, 4, wb_resp_more, state);
        if (subreq == NULL) {
                goto nomem;
        }
-
-       subreq->async.fn = wb_resp_read_len;
-       subreq->async.priv = result;
+       subreq->async.fn = wb_resp_read_done;
+       subreq->async.private_data = result;
        return result;
 
  nomem:
@@ -372,100 +275,50 @@ struct async_req *wb_resp_read_send(TALLOC_CTX *mem_ctx,
        return NULL;
 }
 
-static void wb_resp_read_len(struct async_req *subreq)
+static ssize_t wb_resp_more(uint8_t *buf, size_t buflen, void *private_data)
 {
-       struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
-       struct resp_read_state *state = talloc_get_type_abort(
-               req->private_data, struct resp_read_state);
-       int err;
-       ssize_t ret;
-
-       ret = recvall_recv(subreq, &err);
-       TALLOC_FREE(subreq);
-       if (ret < 0) {
-               async_req_error(req, map_wbc_err_from_errno(err));
-               return;
-       }
-
-       if (state->wb_resp->length < sizeof(struct winbindd_response)) {
-               DEBUG(0, ("wb_resp_read_len: Invalid response size received: "
-                         "%d (expected at least%d)\n",
-                         (int)state->wb_resp->length,
-                         (int)sizeof(struct winbindd_response)));
-               async_req_error(req, WBC_ERR_INVALID_RESPONSE);
-               return;
-       }
-
-       subreq = recvall_send(
-               req, state->ev, state->fd, (uint32 *)(state->wb_resp)+1,
-               sizeof(struct winbindd_response) - sizeof(uint32), 0);
-       if (async_req_nomem(subreq, req)) {
-               return;
-       }
-
-       subreq->async.fn = wb_resp_read_main;
-       subreq->async.priv = req;
+       struct winbindd_response *resp = (struct winbindd_response *)buf;
+
+       if (buflen == 4) {
+               if (resp->length < sizeof(struct winbindd_response)) {
+                       DEBUG(0, ("wb_resp_read_len: Invalid response size "
+                                 "received: %d (expected at least%d)\n",
+                                 (int)resp->length,
+                                 (int)sizeof(struct winbindd_response)));
+                       return -1;
+               }
+       }
+       return resp->length - 4;
 }
 
-static void wb_resp_read_main(struct async_req *subreq)
+static void wb_resp_read_done(struct tevent_req *subreq)
 {
        struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
+               subreq->async.private_data, struct async_req);
        struct resp_read_state *state = talloc_get_type_abort(
                req->private_data, struct resp_read_state);
+       uint8_t *buf;
        int err;
        ssize_t ret;
-       size_t extra_len;
 
-       ret = recvall_recv(subreq, &err);
+       ret = read_packet_recv(subreq, state, &buf, &err);
        TALLOC_FREE(subreq);
-       if (ret < 0) {
+       if (ret == -1) {
                async_req_error(req, map_wbc_err_from_errno(err));
                return;
        }
 
-       extra_len = state->wb_resp->length - sizeof(struct winbindd_response);
-       if (extra_len == 0) {
-               async_req_done(req);
-               return;
-       }
-
-       state->wb_resp->extra_data.data = TALLOC_ARRAY(
-               state->wb_resp, char, extra_len+1);
-       if (async_req_nomem(state->wb_resp->extra_data.data, req)) {
-               return;
-       }
-       ((char *)state->wb_resp->extra_data.data)[extra_len] = 0;
-
-       subreq = recvall_send(
-               req, state->ev, state->fd, state->wb_resp->extra_data.data,
-               extra_len, 0);
-       if (async_req_nomem(subreq, req)) {
-               return;
-       }
-
-       subreq->async.fn = wb_resp_read_extra;
-       subreq->async.priv = req;
-}
-
-static void wb_resp_read_extra(struct async_req *subreq)
-{
-       struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
-       int err;
-       ssize_t ret;
+       state->wb_resp = (struct winbindd_response *)buf;
 
-       ret = recvall_recv(subreq, &err);
-       TALLOC_FREE(subreq);
-       if (ret < 0) {
-               async_req_error(req, map_wbc_err_from_errno(err));
-               return;
+       if (state->wb_resp->length > sizeof(struct winbindd_response)) {
+               state->wb_resp->extra_data.data =
+                       (char *)buf + sizeof(struct winbindd_response);
+       } else {
+               state->wb_resp->extra_data.data = NULL;
        }
        async_req_done(req);
 }
 
-
 wbcErr wb_resp_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
                         struct winbindd_response **presp)
 {
@@ -481,91 +334,61 @@ wbcErr wb_resp_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
 }
 
 struct resp_write_state {
-       struct winbindd_response *wb_resp;
-       struct tevent_context *ev;
-       int fd;
+       struct iovec iov[2];
 };
 
-static void wb_resp_write_main(struct async_req *subreq);
-static void wb_resp_write_extra(struct async_req *subreq);
+static void wb_resp_write_done(struct tevent_req *subreq);
 
 struct async_req *wb_resp_write_send(TALLOC_CTX *mem_ctx,
                                    struct tevent_context *ev, int fd,
                                    struct winbindd_response *wb_resp)
 {
-       struct async_req *result, *subreq;
+       struct async_req *result;
+       struct tevent_req *subreq;
        struct resp_write_state *state;
+       int count = 1;
 
        if (!async_req_setup(mem_ctx, &result, &state,
                             struct resp_write_state)) {
                return NULL;
        }
-       state->fd = fd;
-       state->ev = ev;
-       state->wb_resp = wb_resp;
 
-       subreq = sendall_send(state, state->ev, state->fd, state->wb_resp,
-                             sizeof(struct winbindd_response), 0);
-       if (subreq == NULL) {
-               goto nomem;
+       state->iov[0].iov_base = wb_resp;
+       state->iov[0].iov_len = sizeof(struct winbindd_response);
+
+       if (wb_resp->length > sizeof(struct winbindd_response)) {
+               state->iov[1].iov_base = wb_resp->extra_data.data;
+               state->iov[1].iov_len =
+                       wb_resp->length - sizeof(struct winbindd_response);
+               count = 2;
        }
 
-       subreq->async.fn = wb_resp_write_main;
-       subreq->async.priv = result;
+       subreq = writev_send(state, ev, fd, state->iov, count);
+       if (subreq == NULL) {
+               goto fail;
+       }
+       subreq->async.fn = wb_resp_write_done;
+       subreq->async.private_data = result;
        return result;
 
nomem:
fail:
        TALLOC_FREE(result);
        return NULL;
 }
 
-static void wb_resp_write_main(struct async_req *subreq)
+static void wb_resp_write_done(struct tevent_req *subreq)
 {
        struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
-       struct resp_write_state *state = talloc_get_type_abort(
-               req->private_data, struct resp_write_state);
+               subreq->async.private_data, struct async_req);
        int err;
        ssize_t ret;
 
-       ret = sendall_recv(subreq, &err);
+       ret = writev_recv(subreq, &err);
        TALLOC_FREE(subreq);
        if (ret < 0) {
                async_req_error(req, map_wbc_err_from_errno(err));
                return;
        }
-
-       if (state->wb_resp->length == sizeof(struct winbindd_response)) {
-               async_req_done(req);
-               return;
-       }
-
-       subreq = sendall_send(
-               state, state->ev, state->fd,
-               state->wb_resp->extra_data.data,
-               state->wb_resp->length - sizeof(struct winbindd_response), 0);
-       if (async_req_nomem(subreq, req)) {
-               return;
-       }
-
-       subreq->async.fn = wb_resp_write_extra;
-       subreq->async.priv = req;
-}
-
-static void wb_resp_write_extra(struct async_req *subreq)
-{
-       struct async_req *req = talloc_get_type_abort(
-               subreq->async.priv, struct async_req);
-       int err;
-       ssize_t ret;
-
-       ret = sendall_recv(subreq, &err);
-       TALLOC_FREE(subreq);
-       if (err < 0) {
-               async_req_error(req, map_wbc_err_from_errno(err));
-               return;
-       }
-
        async_req_done(req);
 }
 
index 4d3a6095301dba783ef07c25d9c9091346337c08..b8d55a944a479edf92aaf295c8c02fff2a892be5 100644 (file)
@@ -147,17 +147,30 @@ struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx)
        return result;
 }
 
+struct wb_connect_state {
+       int dummy;
+};
+
+static void wbc_connect_connected(struct tevent_req *subreq);
+
 static struct async_req *wb_connect_send(TALLOC_CTX *mem_ctx,
-                                        struct tevent_context *ev,
-                                        struct wb_context *wb_ctx,
-                                        const char *dir)
+                                         struct tevent_context *ev,
+                                         struct wb_context *wb_ctx,
+                                         const char *dir)
 {
-       struct async_req *req;
+       struct async_req *result;
+       struct tevent_req *subreq;
+       struct wb_connect_state *state;
        struct sockaddr_un sunaddr;
        struct stat st;
        char *path = NULL;
        wbcErr wbc_err;
 
+       if (!async_req_setup(mem_ctx, &result, &state,
+                            struct wb_connect_state)) {
+               return NULL;
+       }
+
        if (wb_ctx->fd != -1) {
                close(wb_ctx->fd);
                wb_ctx->fd = -1;
@@ -205,33 +218,46 @@ static struct async_req *wb_connect_send(TALLOC_CTX *mem_ctx,
                goto post_status;
        }
 
-       req = async_connect_send(mem_ctx, ev, wb_ctx->fd,
-                                (struct sockaddr *)&sunaddr,
-                                sizeof(sunaddr));
-       if (req == NULL) {
+       subreq = async_connect_send(mem_ctx, ev, wb_ctx->fd,
+                                   (struct sockaddr *)&sunaddr,
+                                   sizeof(sunaddr));
+       if (subreq == NULL) {
                goto nomem;
        }
-       if (!async_req_set_timeout(req, ev, timeval_set(30, 0))) {
-               TALLOC_FREE(req);
+       subreq->async.fn = wbc_connect_connected;
+       subreq->async.private_data = result;
+
+       if (!tevent_req_set_endtime(subreq, ev, timeval_current_ofs(30, 0))) {
                goto nomem;
        }
 
-       return req;
+       return result;
 
  nomem:
        wbc_err = WBC_ERR_NO_MEMORY;
  post_status:
-       req = async_req_new(mem_ctx);
-       if (req == NULL) {
-               return NULL;
-       }
-       if (async_post_error(req, ev, wbc_err)) {
-               return req;
+       if (async_post_error(result, ev, wbc_err)) {
+               return result;
        }
-       TALLOC_FREE(req);
+       TALLOC_FREE(result);
        return NULL;
 }
 
+static void wbc_connect_connected(struct tevent_req *subreq)
+{
+       struct async_req *req = talloc_get_type_abort(
+               subreq->async.private_data, struct async_req);
+       int res, err;
+
+       res = async_connect_recv(subreq, &err);
+       TALLOC_FREE(subreq);
+       if (res == -1) {
+               async_req_error(req, map_wbc_err_from_errno(err));
+               return;
+       }
+       async_req_done(req);
+}
+
 static wbcErr wb_connect_recv(struct async_req *req)
 {
        return async_req_simple_recv_wbcerr(req);
index dabfc398ced293703dff0bc0f4fd9d85a616b4cd..ad11ee0ed411fe6dabfe57e4df4b514679f845c4 100644 (file)
@@ -1642,6 +1642,7 @@ bool cli_session_request(struct cli_state *cli,
 {
        char *p;
        int len = 4;
+       char *tmp;
 
        /* 445 doesn't have session request */
        if (cli->port == 445)
@@ -1651,14 +1652,30 @@ bool cli_session_request(struct cli_state *cli,
        memcpy(&(cli->called ), called , sizeof(*called ));
 
        /* put in the destination name */
+
+       tmp = name_mangle(talloc_tos(), cli->called.name,
+                         cli->called.name_type);
+       if (tmp == NULL) {
+               return false;
+       }
+
        p = cli->outbuf+len;
-       name_mangle(cli->called .name, p, cli->called .name_type);
-       len += name_len(p);
+       memcpy(p, tmp, name_len(tmp));
+       len += name_len(tmp);
+       TALLOC_FREE(tmp);
 
        /* and my name */
+
+       tmp = name_mangle(talloc_tos(), cli->calling.name,
+                         cli->calling.name_type);
+       if (tmp == NULL) {
+               return false;
+       }
+
        p = cli->outbuf+len;
-       name_mangle(cli->calling.name, p, cli->calling.name_type);
-       len += name_len(p);
+       memcpy(p, tmp, name_len(tmp));
+       len += name_len(tmp);
+       TALLOC_FREE(tmp);
 
        /* send a session request (RFC 1002) */
        /* setup the packet length
index 1843fe262f04d4198200bb416d5325efb12d9000..56661af70b02b37493b3f3c96077829c43106218 100644 (file)
@@ -1519,7 +1519,7 @@ SMBC_chmod_ctx(SMBCCTX *context,
                return -1;
        }
 
-       DEBUG(4, ("smbc_chmod(%s, 0%3o)\n", fname, newmode));
+       DEBUG(4, ("smbc_chmod(%s, 0%3o)\n", fname, (unsigned int)newmode));
 
        if (SMBC_parse_path(frame,
                             context,
index 02b13ae63e9718b968a82634174e192521edef40..5f3eda44fe2960300e2e2e79fc42016b550c3c57 100644 (file)
@@ -1279,12 +1279,19 @@ static int name_interpret(char *in, fstring name)
  Note:  <Out> must be (33 + strlen(scope) + 2) bytes long, at minimum.
 ****************************************************************************/
 
-int name_mangle( char *In, char *Out, char name_type )
+char *name_mangle(TALLOC_CTX *mem_ctx, char *In, char name_type)
 {
        int   i;
        int   len;
        nstring buf;
-       char *p = Out;
+       char *result;
+       char *p;
+
+       result = talloc_array(mem_ctx, char, 33 + strlen(global_scope()) + 2);
+       if (result == NULL) {
+               return NULL;
+       }
+       p = result;
 
        /* Safely copy the input string, In, into buf[]. */
        if (strcmp(In,"*") == 0)
@@ -1321,7 +1328,7 @@ int name_mangle( char *In, char *Out, char name_type )
                                p[0] = len;
                                if( len > 0 )
                                        p[len+1] = 0;
-                               return( name_len(Out) );
+                               return result;
                        case '.':
                                p[0] = len;
                                p   += (len + 1);
@@ -1333,7 +1340,7 @@ int name_mangle( char *In, char *Out, char name_type )
                }
        }
 
-       return( name_len(Out) );
+       return result;
 }
 
 /****************************************************************************
index a70664bbf38e7c4f9e6613d9b1ec733f669b327d..418e13d9d2b8c8121118386417d38214fe3ed3a8 100644 (file)
@@ -41,6 +41,8 @@ enum onefs_acl_wire_format
 #define PARM_ONEFS_TYPE "onefs"
 #define PARM_ACL_WIRE_FORMAT "acl wire format"
 #define PARM_ACL_WIRE_FORMAT_DEFAULT ACL_FORMAT_WINDOWS_SD
+#define PARM_ALLOW_EXECUTE_ALWAYS "allow execute always"
+#define PARM_ALLOW_EXECUTE_ALWAYS_DEFAULT false
 #define PARM_ATIME_NOW         "atime now files"
 #define PARM_ATIME_NOW_DEFAULT  NULL
 #define PARM_ATIME_STATIC      "atime static files"
index 7bc4a1728f1d6e8282e26356e1fc0f43d2bfb71e..a1bfa6e121e19659605d2a53fbf1d696374ac478 100644 (file)
@@ -273,9 +273,6 @@ onefs_samba_acl_to_acl(SEC_ACL *samba_acl, struct ifs_security_acl **acl,
                if (aclu_initialize_acl(acl, aces, num_aces))
                        goto err_free;
 
-       if (aclu_initialize_acl(acl, aces, num_aces))
-               goto err_free;
-
        /* Currently aclu_initialize_acl should copy the aces over, allowing
         * us to immediately free */
        free(aces);
@@ -614,6 +611,8 @@ onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
        bool fopened = false;
        NTSTATUS status = NT_STATUS_OK;
 
+       START_PROFILE(syscall_get_sd);
+
        *ppdesc = NULL;
 
        DEBUG(5, ("Getting sd for file %s. security_info=%u\n",
@@ -753,6 +752,9 @@ onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
        DEBUG(5, ("Finished retrieving/canonicalizing SD!\n"));
        /* FALLTHROUGH */
 out:
+
+       END_PROFILE(syscall_get_sd);
+
        if (alloced && sd) {
                if (new_aces_alloced && sd->dacl->aces)
                        SAFE_FREE(sd->dacl->aces);
@@ -888,18 +890,20 @@ onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                  uint32 security_info_sent, SEC_DESC *psd)
 {
        struct ifs_security_descriptor sd = {};
-       int fd;
+       int fd = -1;
        bool fopened = false;
        NTSTATUS status;
 
+       START_PROFILE(syscall_set_sd);
+
        DEBUG(5,("Setting SD on file %s.\n", fsp->fsp_name ));
 
        status = onefs_samba_sd_to_sd(security_info_sent, psd, &sd,
                                      SNUM(handle->conn));
 
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(3, ("SD initialization failure: %s", nt_errstr(status)));
-               return status;
+               DEBUG(3, ("SD initialization failure: %s\n", nt_errstr(status)));
+               goto out;
        }
 
        fd = fsp->fh->fd;
@@ -938,6 +942,8 @@ onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 
        /* FALLTHROUGH */
 out:
+       END_PROFILE(syscall_set_sd);
+
        if (fopened)
                close(fd);
 
index a860023764257686fbd78c5ad6eb5380c1e011d1..2c5e39c3596192ce63411c4ef9427fa92cded60a 100644 (file)
@@ -255,6 +255,8 @@ NTSTATUS onefs_brl_lock_windows(vfs_handle_struct *handle,
        struct onefs_cbrl_blr_state *bs;
        NTSTATUS status;
 
+       START_PROFILE(syscall_brl_lock);
+
        SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
        SMB_ASSERT(plock->lock_type != UNLOCK_LOCK);
 
@@ -301,10 +303,13 @@ NTSTATUS onefs_brl_lock_windows(vfs_handle_struct *handle,
                /* ASYNC still in progress: The process_* calls will keep
                 * calling even if we haven't gotten the lock. Keep erroring
                 * without calling ifs_cbrl, or getting/setting an id. */
-               if (bs->state == ONEFS_CBRL_ASYNC)
+               if (bs->state == ONEFS_CBRL_ASYNC) {
                        goto failure;
-               else if (bs->state == ONEFS_CBRL_ERROR)
+               }
+               else if (bs->state == ONEFS_CBRL_ERROR) {
+                       END_PROFILE(syscall_brl_lock);
                        return NT_STATUS_NO_MEMORY;
+               }
 
                SMB_ASSERT(bs->state == ONEFS_CBRL_NONE);
                async = true;
@@ -343,6 +348,9 @@ NTSTATUS onefs_brl_lock_windows(vfs_handle_struct *handle,
        }
 
 failure:
+
+       END_PROFILE(syscall_brl_lock);
+
        /* Failure - error or async. */
        plock->context.smbpid = (uint32) ONEFS_BLOCKING_PID;
 
@@ -355,6 +363,9 @@ failure:
        return status;
 
 success:
+
+       END_PROFILE(syscall_brl_lock);
+
        /* Success. */
        onefs_cbrl_enumerate_blq("onefs_brl_unlock_windows");
        DEBUG(10, ("returning NT_STATUS_OK.\n"));
@@ -371,6 +382,8 @@ bool onefs_brl_unlock_windows(vfs_handle_struct *handle,
        int error;
        int fd = br_lck->fsp->fh->fd;
 
+       START_PROFILE(syscall_brl_unlock);
+
        SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
        SMB_ASSERT(plock->lock_type == UNLOCK_LOCK);
 
@@ -378,6 +391,9 @@ bool onefs_brl_unlock_windows(vfs_handle_struct *handle,
        error = ifs_cbrl(fd, CBRL_OP_UNLOCK, CBRL_NOTYPE,
            plock->start, plock->size, CBRL_NOTYPE, 0, plock->context.smbpid,
            plock->context.tid, plock->fnum);
+
+       END_PROFILE(syscall_brl_unlock);
+
        if (error) {
                DEBUG(10, ("returning false.\n"));
                return false;
@@ -404,6 +420,8 @@ bool onefs_brl_cancel_windows(vfs_handle_struct *handle,
        int fd = br_lck->fsp->fh->fd;
        struct onefs_cbrl_blr_state *bs;
 
+       START_PROFILE(syscall_brl_cancel);
+
        SMB_ASSERT(plock);
        SMB_ASSERT(plock->lock_flav == WINDOWS_LOCK);
        SMB_ASSERT(blr);
@@ -416,6 +434,7 @@ bool onefs_brl_cancel_windows(vfs_handle_struct *handle,
        if (bs->state == ONEFS_CBRL_DONE) {
                /* No-op. */
                DEBUG(10, ("State=DONE, returning true\n"));
+               END_PROFILE(syscall_brl_cancel);
                return true;
        }
 
@@ -427,6 +446,9 @@ bool onefs_brl_cancel_windows(vfs_handle_struct *handle,
        error = ifs_cbrl(fd, CBRL_OP_CANCEL, CBRL_NOTYPE, plock->start,
            plock->size, CBRL_NOTYPE, bs->id, plock->context.smbpid,
            plock->context.tid, plock->fnum);
+
+       END_PROFILE(syscall_brl_cancel);
+
        if (error) {
                DEBUG(10, ("returning false\n"));
                bs->state = ONEFS_CBRL_ERROR;
index 9616ca48d568395855612015b5c074840335d45e..2dcd8891eb082a00aea275fa71273d369afe3bdb 100644 (file)
@@ -160,18 +160,26 @@ int onefs_rename(vfs_handle_struct *handle, const char *oldname,
        char *nbase = NULL;
        char *nsname = NULL;
 
+       START_PROFILE(syscall_rename_at);
+
        frame = talloc_stackframe();
 
        ret = onefs_is_stream(oldname, &obase, &osname, &old_is_stream);
-       if (ret)
+       if (ret) {
+               END_PROFILE(syscall_rename_at);
                return ret;
+       }
 
        ret = onefs_is_stream(newname, &nbase, &nsname, &new_is_stream);
-       if (ret)
+       if (ret) {
+               END_PROFILE(syscall_rename_at);
                return ret;
+       }
 
        if (!old_is_stream && !new_is_stream) {
-               return SMB_VFS_NEXT_RENAME(handle, oldname, newname);
+               ret = SMB_VFS_NEXT_RENAME(handle, oldname, newname);
+               END_PROFILE(syscall_rename_at);
+               return ret;
        }
 
        dir_fd = get_stream_dir_fd(handle->conn, obase, NULL);
@@ -192,6 +200,8 @@ int onefs_rename(vfs_handle_struct *handle, const char *oldname,
        }
 
  done:
+       END_PROFILE(syscall_rename_at);
+
        saved_errno = errno;
        if (dir_fd >= 0) {
                close(dir_fd);
index 10802895cd5ddac82871a1101c5e52cceea2a8e8..518a3981545212de2d4bd6823a17ab9f7f468f12 100644 (file)
@@ -95,6 +95,8 @@ int onefs_sys_create_file(connection_struct *conn,
        uint32_t onefs_dos_attributes;
        struct ifs_createfile_flags cf_flags = CF_FLAGS_NONE;
 
+       START_PROFILE(syscall_createfile);
+
        /* Setup security descriptor and get secinfo. */
        if (sd != NULL) {
                NTSTATUS status;
@@ -132,6 +134,30 @@ int onefs_sys_create_file(connection_struct *conn,
        if (lp_nt_acl_support(SNUM(conn)) && !lp_inherit_perms(SNUM(conn)))
                cf_flags = cf_flags_or(cf_flags, CF_FLAGS_DEFAULT_ACL);
 
+       /*
+        * Some customer workflows require the execute bit to be ignored.
+        */
+       if (lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
+                        PARM_ALLOW_EXECUTE_ALWAYS,
+                        PARM_ALLOW_EXECUTE_ALWAYS_DEFAULT) &&
+           (open_access_mask & FILE_EXECUTE)) {
+
+               DEBUG(3, ("Stripping execute bit from %s: (0x%x)\n", path,
+                         open_access_mask));
+
+               /* Strip execute. */
+               open_access_mask &= ~FILE_EXECUTE;
+
+               /*
+                * Add READ_DATA, so we're not left with desired_access=0. An
+                * execute call should imply the client will read the data.
+                */
+               open_access_mask |= FILE_READ_DATA;
+
+               DEBUGADD(3, ("New stripped access mask: 0x%x\n",
+                            open_access_mask));
+       }
+
        DEBUG(10,("onefs_sys_create_file: base_fd = %d, "
                  "open_access_mask = 0x%x, flags = 0x%x, mode = 0%o, "
                  "desired_oplock = %s, id = 0x%x, secinfo = 0x%x, sd = %p, "
@@ -172,6 +198,7 @@ int onefs_sys_create_file(connection_struct *conn,
        }
 
  out:
+       END_PROFILE(syscall_createfile);
        aclu_free_sd(pifs_sd, false);
 
        return ret_fd;
@@ -283,6 +310,8 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
        bool atomic = false;
        ssize_t ret = 0;
 
+       START_PROFILE_BYTES(syscall_sendfile, count);
+
        if (lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
                         PARM_ATOMIC_SENDFILE,
                         PARM_ATOMIC_SENDFILE_DEFAULT)) {
@@ -296,6 +325,7 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
        /* If the sendfile wasn't atomic, we're done. */
        if (!atomic) {
                DEBUG(10, ("non-atomic sendfile read %ul bytes", ret));
+               END_PROFILE(syscall_sendfile);
                return ret;
        }
 
@@ -367,6 +397,7 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
 
        /* Handle case 1: short read -> truncated file. */
        if (ret == 0) {
+               END_PROFILE(syscall_sendfile);
                return ret;
        }
 
@@ -378,6 +409,7 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
                                 PARM_SENDFILE_LARGE_READS_DEFAULT)) {
                        DEBUG(3, ("Not attempting non-atomic large sendfile: "
                                  "%lu bytes\n", count));
+                       END_PROFILE(syscall_sendfile);
                        return 0;
                }
 
@@ -397,6 +429,7 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
                        DEBUG(1, ("error on non-atomic large sendfile "
                                  "(%lu bytes): %s\n", count,
                                  strerror(errno)));
+                       END_PROFILE(syscall_sendfile);
                        return ret;
                }
 
@@ -415,9 +448,11 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
                        if (lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
                                PARM_SENDFILE_SAFE,
                                PARM_SENDFILE_SAFE_DEFAULT)) {
+                               END_PROFILE(syscall_sendfile);
                                return -1;
                        }
 
+                       END_PROFILE(syscall_sendfile);
                        return ret;
                }
 
@@ -431,6 +466,7 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
                          count, strerror(errno)));
        }
 
+       END_PROFILE(syscall_sendfile);
        return ret;
 }
 
@@ -485,10 +521,13 @@ ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset,
        off_t rbytes;
        off_t wbytes;
 
+       START_PROFILE_BYTES(syscall_recvfile, count);
+
        DEBUG(10,("onefs_recvfile: from = %d, to = %d, offset=%llu, count = "
                  "%lu\n", fromfd, tofd, offset, count));
 
        if (count == 0) {
+               END_PROFILE(syscall_recvfile);
                return 0;
        }
 
@@ -600,6 +639,9 @@ ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset,
        ret = total_wbytes;
 
 out:
+
+       END_PROFILE(syscall_recvfile);
+
        /* Make sure we always try to drain the socket. */
        if (!socket_drained && count - total_rbytes) {
                int saved_errno = errno;
index d7c9d39c5e96afea88c87b6f0b100528d74d45fd..b59a780f52ebf0225443610381069cadd8265450 100644 (file)
@@ -310,7 +310,7 @@ static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
                       (result < 0) ? strerror(errno) : "");
        }
        DEBUG(1, ("vfs_extd_audit: chmod %s mode 0x%x %s %s\n",
-              path, mode,
+              path, (unsigned int)mode,
               (result < 0) ? "failed: " : "",
               (result < 0) ? strerror(errno) : ""));
 
@@ -330,7 +330,7 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m
                       (result < 0) ? strerror(errno) : "");
        }
        DEBUG(1, ("vfs_extd_audit: chmod_acl %s mode 0x%x %s %s\n",
-               path, mode,
+               path, (unsigned int)mode,
               (result < 0) ? "failed: " : "",
               (result < 0) ? strerror(errno) : ""));
 
@@ -350,7 +350,7 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod
                       (result < 0) ? strerror(errno) : "");
        }
        DEBUG(1, ("vfs_extd_audit: fchmod %s mode 0x%x %s %s",
-              fsp->fsp_name,  mode,
+              fsp->fsp_name,  (unsigned int)mode,
               (result < 0) ? "failed: " : "",
               (result < 0) ? strerror(errno) : ""));
 
@@ -370,7 +370,7 @@ static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t
                       (result < 0) ? strerror(errno) : "");
        }
        DEBUG(1, ("vfs_extd_audit: fchmod_acl %s mode 0x%x %s %s",
-              fsp->fsp_name,  mode,
+              fsp->fsp_name,  (unsigned int)mode,
               (result < 0) ? "failed: " : "",
               (result < 0) ? strerror(errno) : ""));
 
index adefb7d94f244c4149cfbaf5626e7280be98fda0..3279466602aa3756e716de901d996a617aad1de5 100644 (file)
@@ -412,18 +412,18 @@ static void msg_nmbd_send_packet(struct messaging_context *msg,
        const struct sockaddr_storage *pss;
        const struct in_addr *local_ip;
 
-       DEBUG(10, ("Received send_packet from %d\n", procid_to_pid(&src)));
+       DEBUG(10, ("Received send_packet from %u\n", (unsigned int)procid_to_pid(&src)));
 
        if (data->length != sizeof(struct packet_struct)) {
-               DEBUG(2, ("Discarding invalid packet length from %d\n",
-                         procid_to_pid(&src)));
+               DEBUG(2, ("Discarding invalid packet length from %u\n",
+                         (unsigned int)procid_to_pid(&src)));
                return;
        }
 
        if ((p->packet_type != NMB_PACKET) &&
            (p->packet_type != DGRAM_PACKET)) {
-               DEBUG(2, ("Discarding invalid packet type from %d: %d\n",
-                         procid_to_pid(&src), p->packet_type));
+               DEBUG(2, ("Discarding invalid packet type from %u: %d\n",
+                         (unsigned int)procid_to_pid(&src), p->packet_type));
                return;
        }
 
@@ -431,8 +431,8 @@ static void msg_nmbd_send_packet(struct messaging_context *msg,
        pss = iface_ip((struct sockaddr *)&ss);
 
        if (pss == NULL) {
-               DEBUG(2, ("Could not find ip for packet from %d\n",
-                         procid_to_pid(&src)));
+               DEBUG(2, ("Could not find ip for packet from %u\n",
+                         (unsigned int)procid_to_pid(&src)));
                return;
        }
 
similarity index 65%
rename from source3/passdb/pdb_onefs_sam.c
rename to source3/passdb/pdb_wbc_sam.c
index 51b8618aad891acb269716b24f15cea691b58d67..33dc03fe4cd787a2620abce7cd2970f849a984de 100644 (file)
@@ -1,6 +1,8 @@
 /*
    Unix SMB/CIFS implementation.
-   Password and authentication handling for wbclient
+
+   Password and authentication handling by wbclient
+
    Copyright (C) Andrew Bartlett                       2002
    Copyright (C) Jelmer Vernooij                       2002
    Copyright (C) Simo Sorce                            2003
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* This passdb module retrieves full passdb information for local users and
+ * groups from a wbclient compatible daemon.
+ *
+ * The purpose of this module is to defer all SAM authorization information
+ * storage and retrieval to a wbc compatible daemon.
+ *
+ * This passdb backend is most useful when used in conjunction with auth_wbc.
+ *
+ * A few current limitations of this module are:
+ *   - read only interface
+ *   - no privileges
+ */
+
 #include "includes.h"
 
 /***************************************************************************
   Default implementations of some functions.
  ****************************************************************************/
-static NTSTATUS _pdb_onefs_sam_getsampw(struct pdb_methods *methods,
+static NTSTATUS _pdb_wbc_sam_getsampw(struct pdb_methods *methods,
                                       struct samu *user,
                                       const struct passwd *pwd)
 {
@@ -44,29 +59,29 @@ static NTSTATUS _pdb_onefs_sam_getsampw(struct pdb_methods *methods,
        return result;
 }
 
-static NTSTATUS pdb_onefs_sam_getsampwnam(struct pdb_methods *methods, struct samu *user, const char *sname)
+static NTSTATUS pdb_wbc_sam_getsampwnam(struct pdb_methods *methods, struct samu *user, const char *sname)
 {
-       return _pdb_onefs_sam_getsampw(methods, user, winbind_getpwnam(sname));
+       return _pdb_wbc_sam_getsampw(methods, user, winbind_getpwnam(sname));
 }
 
-static NTSTATUS pdb_onefs_sam_getsampwsid(struct pdb_methods *methods, struct samu *user, const DOM_SID *sid)
+static NTSTATUS pdb_wbc_sam_getsampwsid(struct pdb_methods *methods, struct samu *user, const DOM_SID *sid)
 {
-       return _pdb_onefs_sam_getsampw(methods, user, winbind_getpwsid(sid));
+       return _pdb_wbc_sam_getsampw(methods, user, winbind_getpwsid(sid));
 }
 
-static bool pdb_onefs_sam_uid_to_sid(struct pdb_methods *methods, uid_t uid,
+static bool pdb_wbc_sam_uid_to_sid(struct pdb_methods *methods, uid_t uid,
                                   DOM_SID *sid)
 {
        return winbind_uid_to_sid(sid, uid);
 }
 
-static bool pdb_onefs_sam_gid_to_sid(struct pdb_methods *methods, gid_t gid,
+static bool pdb_wbc_sam_gid_to_sid(struct pdb_methods *methods, gid_t gid,
                                   DOM_SID *sid)
 {
        return winbind_gid_to_sid(sid, gid);
 }
 
-static bool pdb_onefs_sam_sid_to_id(struct pdb_methods *methods,
+static bool pdb_wbc_sam_sid_to_id(struct pdb_methods *methods,
                                  const DOM_SID *sid,
                                  union unid_t *id, enum lsa_SidType *type)
 {
@@ -82,7 +97,7 @@ static bool pdb_onefs_sam_sid_to_id(struct pdb_methods *methods,
        return true;
 }
 
-static NTSTATUS pdb_onefs_sam_enum_group_members(struct pdb_methods *methods,
+static NTSTATUS pdb_wbc_sam_enum_group_members(struct pdb_methods *methods,
                                               TALLOC_CTX *mem_ctx,
                                               const DOM_SID *group,
                                               uint32 **pp_member_rids,
@@ -91,7 +106,7 @@ static NTSTATUS pdb_onefs_sam_enum_group_members(struct pdb_methods *methods,
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-static NTSTATUS pdb_onefs_sam_enum_group_memberships(struct pdb_methods *methods,
+static NTSTATUS pdb_wbc_sam_enum_group_memberships(struct pdb_methods *methods,
                                                   TALLOC_CTX *mem_ctx,
                                                   struct samu *user,
                                                   DOM_SID **pp_sids,
@@ -123,7 +138,7 @@ static NTSTATUS pdb_onefs_sam_enum_group_memberships(struct pdb_methods *methods
        return NT_STATUS_OK;
 }
 
-static NTSTATUS pdb_onefs_sam_lookup_rids(struct pdb_methods *methods,
+static NTSTATUS pdb_wbc_sam_lookup_rids(struct pdb_methods *methods,
                                        const DOM_SID *domain_sid,
                                        int num_rids,
                                        uint32 *rids,
@@ -164,23 +179,23 @@ done:
        return result;
 }
 
-static NTSTATUS pdb_onefs_sam_get_account_policy(struct pdb_methods *methods, int policy_index, uint32 *value)
+static NTSTATUS pdb_wbc_sam_get_account_policy(struct pdb_methods *methods, int policy_index, uint32 *value)
 {
        return NT_STATUS_UNSUCCESSFUL;
 }
 
-static NTSTATUS pdb_onefs_sam_set_account_policy(struct pdb_methods *methods, int policy_index, uint32 value)
+static NTSTATUS pdb_wbc_sam_set_account_policy(struct pdb_methods *methods, int policy_index, uint32 value)
 {
        return NT_STATUS_UNSUCCESSFUL;
 }
 
-static bool pdb_onefs_sam_search_groups(struct pdb_methods *methods,
+static bool pdb_wbc_sam_search_groups(struct pdb_methods *methods,
                                      struct pdb_search *search)
 {
        return false;
 }
 
-static bool pdb_onefs_sam_search_aliases(struct pdb_methods *methods,
+static bool pdb_wbc_sam_search_aliases(struct pdb_methods *methods,
                                       struct pdb_search *search,
                                       const DOM_SID *sid)
 {
@@ -188,7 +203,7 @@ static bool pdb_onefs_sam_search_aliases(struct pdb_methods *methods,
        return false;
 }
 
-static bool pdb_onefs_sam_get_trusteddom_pw(struct pdb_methods *methods,
+static bool pdb_wbc_sam_get_trusteddom_pw(struct pdb_methods *methods,
                                          const char *domain,
                                          char **pwd,
                                          DOM_SID *sid,
@@ -198,7 +213,7 @@ static bool pdb_onefs_sam_get_trusteddom_pw(struct pdb_methods *methods,
 
 }
 
-static bool pdb_onefs_sam_set_trusteddom_pw(struct pdb_methods *methods,
+static bool pdb_wbc_sam_set_trusteddom_pw(struct pdb_methods *methods,
                                          const char *domain,
                                          const char *pwd,
                                          const DOM_SID *sid)
@@ -206,13 +221,13 @@ static bool pdb_onefs_sam_set_trusteddom_pw(struct pdb_methods *methods,
        return false;
 }
 
-static bool pdb_onefs_sam_del_trusteddom_pw(struct pdb_methods *methods,
+static bool pdb_wbc_sam_del_trusteddom_pw(struct pdb_methods *methods,
                                          const char *domain)
 {
        return false;
 }
 
-static NTSTATUS pdb_onefs_sam_enum_trusteddoms(struct pdb_methods *methods,
+static NTSTATUS pdb_wbc_sam_enum_trusteddoms(struct pdb_methods *methods,
                                             TALLOC_CTX *mem_ctx,
                                             uint32 *num_domains,
                                             struct trustdom_info ***domains)
@@ -230,7 +245,7 @@ static bool _make_group_map(struct pdb_methods *methods, const char *domain, con
        return true;
 }
 
-static NTSTATUS pdb_onefs_sam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
+static NTSTATUS pdb_wbc_sam_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
                                 DOM_SID sid)
 {
        NTSTATUS result = NT_STATUS_OK;
@@ -269,7 +284,7 @@ done:
        return result;
 }
 
-static NTSTATUS pdb_onefs_sam_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
+static NTSTATUS pdb_wbc_sam_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
                                 gid_t gid)
 {
        NTSTATUS result = NT_STATUS_OK;
@@ -309,7 +324,7 @@ done:
        return result;
 }
 
-static NTSTATUS pdb_onefs_sam_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
+static NTSTATUS pdb_wbc_sam_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
                                 const char *name)
 {
        NTSTATUS result = NT_STATUS_OK;
@@ -347,7 +362,7 @@ done:
        return result;
 }
 
-static NTSTATUS pdb_onefs_sam_enum_group_mapping(struct pdb_methods *methods,
+static NTSTATUS pdb_wbc_sam_enum_group_mapping(struct pdb_methods *methods,
                                           const DOM_SID *sid, enum lsa_SidType sid_name_use,
                                           GROUP_MAP **pp_rmap, size_t *p_num_entries,
      &nb