Merge branch 'master' into wspp-schema
authorAndrew Tridgell <tridge@samba.org>
Tue, 31 Mar 2009 00:58:37 +0000 (11:58 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 31 Mar 2009 00:58:37 +0000 (11:58 +1100)
149 files changed:
docs-xml/manpages-3/vfs_dirsort.8.xml [new file with mode: 0644]
examples/libsmbclient/testbrowse.c
examples/libsmbclient/testfstatvfs.c
examples/libsmbclient/testsmbc.c
examples/libsmbclient/teststatvfs.c
lib/replace/libreplace_network.m4
lib/socket_wrapper/socket_wrapper.c
lib/talloc/talloc.h
lib/tsocket/tsocket_bsd.c
lib/util/fault.m4
lib/util/tevent_ntstatus.c
lib/util/tevent_ntstatus.h
libcli/security/config.mk
libcli/security/display_sec.c [moved from source3/lib/display_sec.c with 80% similarity]
libcli/util/doserr.c
libcli/util/werror.h
librpc/gen_ndr/dcerpc.h [new file with mode: 0644]
librpc/gen_ndr/ndr_dcerpc.c [new file with mode: 0644]
librpc/gen_ndr/ndr_dcerpc.h [new file with mode: 0644]
librpc/idl/dcerpc.idl [moved from source4/librpc/idl/dcerpc.idl with 99% similarity]
selftest/SocketWrapper.pm
selftest/Subunit.pm
selftest/output/buildfarm.pm
selftest/output/html.pm
selftest/output/plain.pm
selftest/selftest.pl
selftest/target/Samba3.pm
selftest/target/Samba4.pm
source3/Makefile.in
source3/configure.in
source3/include/async_smb.h
source3/include/client.h
source3/include/dbwrap.h
source3/include/includes.h
source3/include/proto.h
source3/include/rpc_dce.h
source3/include/smb.h
source3/include/smb_perfcount.h
source3/include/smb_signing.h [new file with mode: 0644]
source3/lib/avahi.c [new file with mode: 0644]
source3/lib/dbwrap.c
source3/lib/netapi/cm.c
source3/lib/netapi/group.c
source3/lib/netapi/user.c
source3/lib/util_file.c
source3/lib/wbclient.c
source3/libads/kerberos.c
source3/libnet/libnet_samsync.c
source3/libsmb/async_smb.c
source3/libsmb/cliconnect.c
source3/libsmb/clientgen.c
source3/libsmb/clikrb5.c
source3/libsmb/clisigning.c [new file with mode: 0644]
source3/libsmb/clitrans.c
source3/libsmb/dsgetdcname.c
source3/libsmb/libsmb_dir.c
source3/libsmb/libsmb_file.c
source3/libsmb/libsmb_stat.c
source3/libsmb/smb_seal.c
source3/libsmb/smb_signing.c
source3/libsmb/unexpected.c
source3/locking/locking.c
source3/modules/nfs4_acls.c
source3/modules/onefs_acl.c
source3/modules/onefs_open.c
source3/modules/perfcount_onefs.c
source3/modules/perfcount_test.c
source3/modules/vfs_dirsort.c [new file with mode: 0644]
source3/modules/vfs_streams_depot.c
source3/nmbd/nmbd.c
source3/nmbd/nmbd_elections.c
source3/nmbd/nmbd_processlogon.c
source3/param/loadparm.c
source3/passdb/lookup_sid.c
source3/passdb/pdb_tdb.c
source3/printing/nt_printing.c
source3/registry/regfio.c
source3/rpc_client/cli_pipe.c
source3/rpc_client/rpc_transport_np.c
source3/rpc_client/rpc_transport_smbd.c
source3/rpc_client/rpc_transport_sock.c
source3/rpc_parse/parse_misc.c
source3/rpc_parse/parse_sec.c [deleted file]
source3/rpc_server/srv_lsa_nt.c
source3/rpc_server/srv_pipe_hnd.c
source3/rpc_server/srv_samr_nt.c
source3/rpc_server/srv_samr_util.c
source3/rpc_server/srv_spoolss_nt.c
source3/rpcclient/cmd_spoolss.c
source3/samba4.m4
source3/samba4.mk
source3/selftest/tests.sh
source3/smbd/aio.c
source3/smbd/avahi_register.c [new file with mode: 0644]
source3/smbd/blocking.c
source3/smbd/globals.h
source3/smbd/ipc.c
source3/smbd/negprot.c
source3/smbd/notify.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/oplock.c
source3/smbd/password.c
source3/smbd/pipes.c
source3/smbd/process.c
source3/smbd/reply.c
source3/smbd/server.c
source3/smbd/service.c
source3/smbd/sesssetup.c
source3/smbd/signing.c [new file with mode: 0644]
source3/smbd/trans2.c
source3/torture/torture.c
source3/utils/net_rpc.c
source3/utils/net_rpc_printer.c
source3/winbindd/winbindd_pam.c
source4/auth/config.m4
source4/auth/credentials/credentials_krb5.h
source4/auth/kerberos/clikrb5.c
source4/build/m4/public.m4
source4/build/make/rules.mk
source4/configure.ac
source4/dsdb/samdb/ldb_modules/tests/possibleinferiors.py [new file with mode: 0755]
source4/headermap.txt
source4/heimdal_build/replace.c
source4/heimdal_build/roken.h
source4/kdc/kdc.c
source4/lib/ldb/modules/paged_searches.c
source4/lib/ldb/pyldb.c
source4/lib/ldb/tests/python/api.py
source4/lib/smbreadline/smbreadline.c
source4/libcli/raw/interfaces.h
source4/libcli/security/config.mk
source4/libcli/smb2/create.c
source4/libcli/smb2/smb2.h
source4/librpc/config.mk
source4/main.mk
source4/min_versions.m4
source4/script/uninstallman.sh
source4/scripting/bin/fullschema [new file with mode: 0644]
source4/scripting/bin/minschema
source4/scripting/python/samba/__init__.py
source4/scripting/python/samba/provision.py
source4/selftest/config.mk
source4/smbd/server.c
source4/torture/ldap/cldap.c
source4/torture/smb2/config.mk
source4/torture/smb2/durable_open.c [moved from source4/torture/smb2/persistent_handles.c with 59% similarity]
source4/torture/smb2/lease.c [new file with mode: 0644]
source4/torture/smb2/smb2.c

diff --git a/docs-xml/manpages-3/vfs_dirsort.8.xml b/docs-xml/manpages-3/vfs_dirsort.8.xml
new file mode 100644 (file)
index 0000000..cec5f27
--- /dev/null
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+<refentry id="vfs_dirsort.8">
+
+<refmeta>
+       <refentrytitle>vfs_dirsort</refentrytitle>
+       <manvolnum>8</manvolnum>
+       <refmiscinfo class="source">Samba</refmiscinfo>
+       <refmiscinfo class="manual">System Administration tools</refmiscinfo>
+       <refmiscinfo class="version">3.3</refmiscinfo>
+</refmeta>
+
+
+<refnamediv>
+       <refname>vfs_dirsort</refname>
+       <refpurpose>Sort directory contents</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+       <cmdsynopsis>
+               <command>vfs objects = dirsort</command>
+       </cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1>
+       <title>DESCRIPTION</title>
+
+       <para>This VFS module is part of the
+       <citerefentry><refentrytitle>samba</refentrytitle>
+       <manvolnum>7</manvolnum></citerefentry> suite.</para>
+
+       <para>The <command>vfs_dirsort</command> module sorts directory
+       entries alphabetically before sending them to the client.</para>
+
+       <para>Please be aware that adding this module might have negative
+       performance implications for large directories.</para>
+
+</refsect1>
+
+<refsect1>
+       <title>EXAMPLES</title>
+
+       <para>Sort directories for all shares:</para>
+
+<programlisting>
+        <smbconfsection name="[global]"/>
+       <smbconfoption name="vfs objects">dirsort</smbconfoption>
+</programlisting>
+
+</refsect1>
+
+<refsect1>
+       <title>VERSION</title>
+
+       <para>This man page is correct for version 3.3 of the Samba suite.
+       </para>
+</refsect1>
+
+<refsect1>
+       <title>AUTHOR</title>
+
+       <para>The original Samba software and related utilities
+       were created by Andrew Tridgell. Samba is now developed
+       by the Samba Team as an Open Source project similar
+       to the way the Linux kernel is developed.</para>
+
+</refsect1>
+
+</refentry>
index a6e6395078f0b98124e75d14d33227600bd7cd30..c3fb3946dab92ec8b41b9a9ee63d6dd8015d35a2 100644 (file)
@@ -197,7 +197,7 @@ get_auth_data_with_context_fn(SMBCCTX * context,
                               char * pPassword,
                               int maxLenPassword)
 {
-    printf("Authenticating with context 0x%lx", context);
+    printf("Authenticating with context %p", context);
     if (context != NULL) {
         char *user_data = smbc_getOptionUserData(context);
         printf(" with user data %s", user_data);
index b4dafefff60a4dc2991c9cf9b2659004b832a08e..73f42d446ab00955c0638ed835ab81199e3a51aa 100644 (file)
@@ -75,13 +75,20 @@ int main(int argc, char * argv[])
             printf("\n");
             printf("Block Size: %lu\n", statvfsbuf.f_bsize);
             printf("Fragment Size: %lu\n", statvfsbuf.f_frsize);
-            printf("Blocks: %llu\n", statvfsbuf.f_blocks);
-            printf("Free Blocks: %llu\n", statvfsbuf.f_bfree);
-            printf("Available Blocks: %llu\n", statvfsbuf.f_bavail);
-            printf("Files : %llu\n", statvfsbuf.f_files);
-            printf("Free Files: %llu\n", statvfsbuf.f_ffree);
-            printf("Available Files: %llu\n", statvfsbuf.f_favail);
-            printf("File System ID: %lu\n", statvfsbuf.f_fsid);
+            printf("Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_blocks);
+            printf("Free Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_bfree);
+            printf("Available Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_bavail);
+            printf("Files : %llu\n",
+                   (unsigned long long) statvfsbuf.f_files);
+            printf("Free Files: %llu\n",
+                   (unsigned long long) statvfsbuf.f_ffree);
+            printf("Available Files: %llu\n",
+                   (unsigned long long) statvfsbuf.f_favail);
+            printf("File System ID: %lu\n",
+                   (unsigned long) statvfsbuf.f_fsid);
             printf("\n");
 
             printf("Flags: 0x%lx\n", statvfsbuf.f_flag);
index 1f06437293a749331f743820bbf553e8c4d21c3b..de42428c2b0096376683a704900d8c0131c1e682 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <time.h>
 #include <sys/time.h>
 #include <string.h>
 #include <unistd.h>
@@ -33,8 +34,12 @@ int global_id = 0;
 void print_list_fn(struct print_job_info *pji)
 {
 
-  fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n",
-         pji->id, pji->priority, pji->size, pji->user, pji->name);
+  fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %lu, User: %s, Name: %s\n",
+         pji->id,
+          pji->priority,
+          (unsigned long) pji->size,
+          pji->user,
+          pji->name);
 
   global_id = pji->id;
 
@@ -137,7 +142,8 @@ int main(int argc, char *argv[])
 
   }
 
-  fprintf(stdout, "Wrote %d bytes to file: %s\n", sizeof(buff), buff);
+  fprintf(stdout, "Wrote %lu bytes to file: %s\n",
+          (unsigned long) sizeof(buff), buff);
 
   /* Now, seek the file back to offset 0 */
 
index 8812002d5ce25742cf0066d871a3678f5f50ec18..b7e6b5159e1ddaeb5f20d929723f13c4d69f353d 100644 (file)
@@ -49,13 +49,20 @@ int main(int argc, char * argv[])
             printf("\n");
             printf("Block Size: %lu\n", statvfsbuf.f_bsize);
             printf("Fragment Size: %lu\n", statvfsbuf.f_frsize);
-            printf("Blocks: %llu\n", statvfsbuf.f_blocks);
-            printf("Free Blocks: %llu\n", statvfsbuf.f_bfree);
-            printf("Available Blocks: %llu\n", statvfsbuf.f_bavail);
-            printf("Files : %llu\n", statvfsbuf.f_files);
-            printf("Free Files: %llu\n", statvfsbuf.f_ffree);
-            printf("Available Files: %llu\n", statvfsbuf.f_favail);
-            printf("File System ID: %lu\n", statvfsbuf.f_fsid);
+            printf("Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_blocks);
+            printf("Free Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_bfree);
+            printf("Available Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_bavail);
+            printf("Files : %llu\n",
+                   (unsigned long long) statvfsbuf.f_files);
+            printf("Free Files: %llu\n",
+                   (unsigned long long) statvfsbuf.f_ffree);
+            printf("Available Files: %llu\n",
+                   (unsigned long long) statvfsbuf.f_favail);
+            printf("File System ID: %lu\n",
+                   (unsigned long) statvfsbuf.f_fsid);
             printf("\n");
 
             printf("Flags: 0x%lx\n", statvfsbuf.f_flag);
index 3bac72d136a3be4f6c96db7874e746c1794d8997..2af02312abbde7c7d044c1900b7f0200eff4df23 100644 (file)
@@ -170,7 +170,7 @@ fi
 # The following tests need LIBS="${LIBREPLACE_NETWORK_LIBS}"
 old_LIBS=$LIBS
 LIBS="${LIBREPLACE_NETWORK_LIBS}"
-SAVE_CPPFLAGS="$CPPFLAGS"
+libreplace_SAVE_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS -I$libreplacedir"
 
 AC_CHECK_FUNCS(socketpair,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} socketpair.o"])
@@ -381,7 +381,7 @@ if test x"$libreplace_cv_HAVE_IPV6" = x"yes"; then
 fi
 
 LIBS=$old_LIBS
-CPPFLAGS="$SAVE_CPPFLAGS"
+CPPFLAGS="$libreplace_SAVE_CPPFLAGS"
 
 LIBREPLACEOBJ="${LIBREPLACEOBJ} ${LIBREPLACE_NETWORK_OBJS}"
 
index 44082e78a1e97ca86ac9b1f6cdefe061c66cd8f1..553827b1922103dba6851ab24506f6d8d092f274 100644 (file)
@@ -218,6 +218,7 @@ struct socket_info
        int bcast;
        int is_server;
        int connected;
+       int defer_connect;
 
        char *path;
        char *tmp_path;
@@ -1686,10 +1687,15 @@ _PUBLIC_ int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t ad
        ret = sockaddr_convert_to_un(si, (const struct sockaddr *)serv_addr, addrlen, &un_addr, 0, NULL);
        if (ret == -1) return -1;
 
-       swrap_dump_packet(si, serv_addr, SWRAP_CONNECT_SEND, NULL, 0);
+       if (si->type == SOCK_DGRAM) {
+               si->defer_connect = 1;
+               ret = 0;
+       } else {
+               swrap_dump_packet(si, serv_addr, SWRAP_CONNECT_SEND, NULL, 0);
 
-       ret = real_connect(s, (struct sockaddr *)&un_addr, 
-                          sizeof(struct sockaddr_un));
+               ret = real_connect(s, (struct sockaddr *)&un_addr,
+                                  sizeof(struct sockaddr_un));
+       }
 
        /* to give better errors */
        if (ret == -1 && errno == ENOENT) {
@@ -1917,7 +1923,22 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, con
                        
                        return len;
                }
-               
+
+               if (si->defer_connect) {
+                       ret = real_connect(s, (struct sockaddr *)&un_addr,
+                                          sizeof(un_addr));
+
+                       /* to give better errors */
+                       if (ret == -1 && errno == ENOENT) {
+                               errno = EHOSTUNREACH;
+                       }
+
+                       if (ret == -1) {
+                               return ret;
+                       }
+                       si->defer_connect = 0;
+               }
+
                ret = real_sendto(s, buf, len, flags, (struct sockaddr *)&un_addr, sizeof(un_addr));
                break;
        default:
@@ -2002,6 +2023,33 @@ _PUBLIC_ ssize_t swrap_send(int s, const void *buf, size_t len, int flags)
 
        len = MIN(len, 1500);
 
+       if (si->defer_connect) {
+               struct sockaddr_un un_addr;
+               int bcast = 0;
+
+               if (si->bound == 0) {
+                       ret = swrap_auto_bind(si, si->family);
+                       if (ret == -1) return -1;
+               }
+
+               ret = sockaddr_convert_to_un(si, si->peername, si->peername_len,
+                                            &un_addr, 0, &bcast);
+               if (ret == -1) return -1;
+
+               ret = real_connect(s, (struct sockaddr *)&un_addr,
+                                  sizeof(un_addr));
+
+               /* to give better errors */
+               if (ret == -1 && errno == ENOENT) {
+                       errno = EHOSTUNREACH;
+               }
+
+               if (ret == -1) {
+                       return ret;
+               }
+               si->defer_connect = 0;
+       }
+
        ret = real_send(s, buf, len, flags);
 
        if (ret == -1) {
index 5c8d5c5fe2c05ae19543d889df66dd61685a4080..f87564a13bf23e450b8e7bf49eb125e2bd4a4788 100644 (file)
@@ -94,7 +94,7 @@ typedef void TALLOC_CTX;
 #define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type)
 #define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__)
 #define talloc_array_ptrtype(ctx, ptr, count) (_TALLOC_TYPEOF(ptr))talloc_array_size(ctx, sizeof(*(ptr)), count)
-#define talloc_array_length(ctx) ((ctx) ? talloc_get_size(ctx)/sizeof(*ctx) : 0)
+#define talloc_array_length(ctx) (talloc_get_size(ctx)/sizeof(*ctx))
 
 #define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, #type)
 #define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__)
index 2811882fed320f400535d14eb3bcccbb591d924d..3d13dfd47dbee149fafa8e1ce6baf2b6dcde0b55 100644 (file)
@@ -44,11 +44,11 @@ struct tsocket_address_bsd {
        bool broadcast;
        union {
                struct sockaddr sa;
-               struct sockaddr_in sin;
+               struct sockaddr_in in;
 #ifdef HAVE_IPV6
-               struct sockaddr_in6 sin6;
+               struct sockaddr_in6 in6;
 #endif
-               struct sockaddr_un sun;
+               struct sockaddr_un un;
                struct sockaddr_storage ss;
        } u;
 };
@@ -204,14 +204,14 @@ char *tsocket_address_inet_addr_string(const struct tsocket_address *addr,
 
        switch (bsda->u.sa.sa_family) {
        case AF_INET:
-               str = inet_ntop(bsda->u.sin.sin_family,
-                               &bsda->u.sin.sin_addr,
+               str = inet_ntop(bsda->u.in.sin_family,
+                               &bsda->u.in.sin_addr,
                                addr_str, sizeof(addr_str));
                break;
 #ifdef HAVE_IPV6
        case AF_INET6:
-               str = inet_ntop(bsda->u.sin6.sin6_family,
-                               &bsda->u.sin6.sin6_addr,
+               str = inet_ntop(bsda->u.in6.sin6_family,
+                               &bsda->u.in6.sin6_addr,
                                addr_str, sizeof(addr_str));
                break;
 #endif
@@ -240,11 +240,11 @@ uint16_t tsocket_address_inet_port(const struct tsocket_address *addr)
 
        switch (bsda->u.sa.sa_family) {
        case AF_INET:
-               port = ntohs(bsda->u.sin.sin_port);
+               port = ntohs(bsda->u.in.sin_port);
                break;
 #ifdef HAVE_IPV6
        case AF_INET6:
-               port = ntohs(bsda->u.sin6.sin6_port);
+               port = ntohs(bsda->u.in6.sin6_port);
                break;
 #endif
        default:
@@ -268,11 +268,11 @@ int tsocket_address_inet_set_port(struct tsocket_address *addr,
 
        switch (bsda->u.sa.sa_family) {
        case AF_INET:
-               bsda->u.sin.sin_port = htons(port);
+               bsda->u.in.sin_port = htons(port);
                break;
 #ifdef HAVE_IPV6
        case AF_INET6:
-               bsda->u.sin6.sin6_port = htons(port);
+               bsda->u.in6.sin6_port = htons(port);
                break;
 #endif
        default:
@@ -301,21 +301,21 @@ int _tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx,
                                    struct tsocket_address **_addr,
                                    const char *location)
 {
-       struct sockaddr_un sun;
-       void *p = &sun;
+       struct sockaddr_un un;
+       void *p = &un;
        int ret;
 
        if (!path) {
                path = "";
        }
 
-       ZERO_STRUCT(sun);
-       sun.sun_family = AF_UNIX;
-       strncpy(sun.sun_path, path, sizeof(sun.sun_path));
+       ZERO_STRUCT(un);
+       un.sun_family = AF_UNIX;
+       strncpy(un.sun_path, path, sizeof(un.sun_path));
 
        ret = _tsocket_address_bsd_from_sockaddr(mem_ctx,
                                                 (struct sockaddr *)p,
-                                                sizeof(sun),
+                                                sizeof(un),
                                                 _addr,
                                                 location);
 
@@ -336,7 +336,7 @@ char *tsocket_address_unix_path(const struct tsocket_address *addr,
 
        switch (bsda->u.sa.sa_family) {
        case AF_UNIX:
-               str = bsda->u.sun.sun_path;
+               str = bsda->u.un.sun_path;
                break;
        default:
                errno = EINVAL;
@@ -359,7 +359,7 @@ static char *tsocket_address_bsd_string(const struct tsocket_address *addr,
        switch (bsda->u.sa.sa_family) {
        case AF_UNIX:
                return talloc_asprintf(mem_ctx, "unix:%s",
-                                      bsda->u.sun.sun_path);
+                                      bsda->u.un.sun_path);
        case AF_INET:
                prefix = "ipv4";
                break;
@@ -469,27 +469,27 @@ static int tsocket_address_bsd_create_socket(const struct tsocket_address *addr,
                        errno = EINVAL;
                        return -1;
                }
-               if (bsda->u.sun.sun_path[0] != 0) {
+               if (bsda->u.un.sun_path[0] != 0) {
                        do_bind = true;
                }
                break;
        case AF_INET:
-               if (bsda->u.sin.sin_port != 0) {
+               if (bsda->u.in.sin_port != 0) {
                        do_reuseaddr = true;
                        do_bind = true;
                }
-               if (bsda->u.sin.sin_addr.s_addr == INADDR_ANY) {
+               if (bsda->u.in.sin_addr.s_addr == INADDR_ANY) {
                        do_bind = true;
                }
                break;
 #ifdef HAVE_IPV6
        case AF_INET6:
-               if (bsda->u.sin6.sin6_port != 0) {
+               if (bsda->u.in6.sin6_port != 0) {
                        do_reuseaddr = true;
                        do_bind = true;
                }
                if (memcmp(&in6addr_any,
-                          &bsda->u.sin6.sin6_addr,
+                          &bsda->u.in6.sin6_addr,
                           sizeof(in6addr_any)) != 0) {
                        do_bind = true;
                }
index bac553a1583c3dd63522ee2a7658766073f61240..c22976998ed55b3a893c8c40ed3c34d786cfcea9 100644 (file)
@@ -9,6 +9,8 @@ if test x"$ac_cv_header_execinfo_h" = x"yes" -a x"$ac_cv_func_ext_backtrace" = x
        EXECINFO_CPPFLAGS="$CPPFLAGS"
        EXECINFO_LDFLAGS="$LDFLAGS"
        LIB_REMOVE_USR_LIB(EXECINFO_LDFLAGS)
+       CFLAGS_REMOVE_USR_INCLUDE(EXECINFO_CFLAGS)
+       CFLAGS_REMOVE_USR_INCLUDE(EXECINFO_CPPFLAGS)
 else
        SMB_ENABLE(EXECINFO,NO)
 fi
index 1a34e9c749d4448b0af56cabe79f468ad81c002e..4e4339989a1de7242a0ac958f8ef683c59710a0b 100644 (file)
@@ -49,3 +49,13 @@ bool tevent_req_is_nterror(struct tevent_req *req, NTSTATUS *status)
        }
        return true;
 }
+
+NTSTATUS tevent_req_simple_recv_ntstatus(struct tevent_req *req)
+{
+       NTSTATUS status;
+
+       if (tevent_req_is_nterror(req, &status)) {
+               return status;
+       }
+       return NT_STATUS_OK;
+}
index 84c275fb130df11779f53d22ac4f9f745a225afb..d7194a9b730accb6434db86f8135631b7a1ad04d 100644 (file)
@@ -28,5 +28,6 @@
 
 bool tevent_req_nterror(struct tevent_req *req, NTSTATUS status);
 bool tevent_req_is_nterror(struct tevent_req *req, NTSTATUS *pstatus);
+NTSTATUS tevent_req_simple_recv_ntstatus(struct tevent_req *req);
 
 #endif
index 56d8e138ff1c15a4fb8bfc3150c01b2ba563d66e..7ade01510c4061e321cdd68bde15d6ca83a01e33 100644 (file)
@@ -2,4 +2,4 @@
 PRIVATE_DEPENDENCIES = TALLOC
 
 LIBSECURITY_COMMON_OBJ_FILES = $(addprefix $(libclicommonsrcdir)/security/, \
-                                       dom_sid.o)
+                                       dom_sid.o display_sec.o secace.o secacl.o)
similarity index 80%
rename from source3/lib/display_sec.c
rename to libcli/security/display_sec.c
index fe1ae77eddfe111a1638c37cafa0cd4e66a44369..bec657da868756d393aaedeeb73b09d5070d0edb 100644 (file)
 */
 
 #include "includes.h"
+#include "librpc/gen_ndr/security.h"
+#include "libcli/security/secace.h"
+#include "libcli/security/dom_sid.h"
+#include "librpc/ndr/libndr.h"
 
 /****************************************************************************
 convert a security permissions into a string
 ****************************************************************************/
 
-char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type)
+char *get_sec_mask_str(TALLOC_CTX *ctx, uint32_t type)
 {
        char *typestr = talloc_strdup(ctx, "");
 
@@ -32,77 +36,77 @@ char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type)
                return NULL;
        }
 
-       if (type & GENERIC_ALL_ACCESS) {
+       if (type & SEC_GENERIC_ALL) {
                typestr = talloc_asprintf_append(typestr,
                                "Generic all access ");
                if (!typestr) {
                        return NULL;
                }
        }
-       if (type & GENERIC_EXECUTE_ACCESS) {
+       if (type & SEC_GENERIC_EXECUTE) {
                typestr = talloc_asprintf_append(typestr,
                                "Generic execute access");
                if (!typestr) {
                        return NULL;
                }
        }
-       if (type & GENERIC_WRITE_ACCESS) {
+       if (type & SEC_GENERIC_WRITE) {
                typestr = talloc_asprintf_append(typestr,
                                "Generic write access ");
                if (!typestr) {
                        return NULL;
                }
        }
-       if (type & GENERIC_READ_ACCESS) {
+       if (type & SEC_GENERIC_READ) {
                typestr = talloc_asprintf_append(typestr,
                                "Generic read access ");
                if (!typestr) {
                        return NULL;
                }
        }
-       if (type & MAXIMUM_ALLOWED_ACCESS) {
+       if (type & SEC_FLAG_MAXIMUM_ALLOWED) {
                typestr = talloc_asprintf_append(typestr,
                                "MAXIMUM_ALLOWED_ACCESS ");
                if (!typestr) {
                        return NULL;
                }
        }
-       if (type & SYSTEM_SECURITY_ACCESS) {
+       if (type & SEC_FLAG_SYSTEM_SECURITY) {
                typestr = talloc_asprintf_append(typestr,
                                "SYSTEM_SECURITY_ACCESS ");
                if (!typestr) {
                        return NULL;
                }
        }
-       if (type & SYNCHRONIZE_ACCESS) {
+       if (type & SEC_STD_SYNCHRONIZE) {
                typestr = talloc_asprintf_append(typestr,
                                "SYNCHRONIZE_ACCESS ");
                if (!typestr) {
                        return NULL;
                }
        }
-       if (type & WRITE_OWNER_ACCESS) {
+       if (type & SEC_STD_WRITE_OWNER) {
                typestr = talloc_asprintf_append(typestr,
                                "WRITE_OWNER_ACCESS ");
                if (!typestr) {
                        return NULL;
                }
        }
-       if (type & WRITE_DAC_ACCESS) {
+       if (type & SEC_STD_WRITE_DAC) {
                typestr = talloc_asprintf_append(typestr,
                                "WRITE_DAC_ACCESS ");
                if (!typestr) {
                        return NULL;
                }
        }
-       if (type & READ_CONTROL_ACCESS) {
+       if (type & SEC_STD_READ_CONTROL) {
                typestr = talloc_asprintf_append(typestr,
                                "READ_CONTROL_ACCESS ");
                if (!typestr) {
                        return NULL;
                }
        }
-       if (type & DELETE_ACCESS) {
+       if (type & SEC_STD_DELETE) {
                typestr = talloc_asprintf_append(typestr,
                                "DELETE_ACCESS ");
                if (!typestr) {
@@ -110,7 +114,7 @@ char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type)
                }
        }
 
-       printf("\t\tSpecific bits: 0x%lx\n", (unsigned long)type&SPECIFIC_RIGHTS_MASK);
+       printf("\t\tSpecific bits: 0x%lx\n", (unsigned long)type&SEC_MASK_SPECIFIC);
 
        return typestr;
 }
@@ -122,7 +126,7 @@ void display_sec_access(uint32_t *info)
 {
        char *mask_str = get_sec_mask_str(NULL, *info);
        printf("\t\tPermissions: 0x%x: %s\n", *info, mask_str ? mask_str : "");
-       TALLOC_FREE(mask_str);
+       talloc_free(mask_str);
 }
 
 /****************************************************************************
@@ -170,9 +174,9 @@ static void disp_sec_ace_object(struct security_ace_object *object)
 /****************************************************************************
  display sec_ace structure
  ****************************************************************************/
-void display_sec_ace(SEC_ACE *ace)
+void display_sec_ace(struct security_ace *ace)
 {
-       fstring sid_str;
+       char *sid_str;
 
        printf("\tACE\n\t\ttype: ");
        switch (ace->type) {
@@ -211,8 +215,9 @@ void display_sec_ace(SEC_ACE *ace)
        printf(" (%d) flags: 0x%02x ", ace->type, ace->flags);
        display_sec_ace_flags(ace->flags);
        display_sec_access(&ace->access_mask);
-       sid_to_fstring(sid_str, &ace->trustee);
+       sid_str = dom_sid_string(NULL, &ace->trustee);
        printf("\t\tSID: %s\n\n", sid_str);
+       talloc_free(sid_str);
 
        if (sec_ace_object(ace->type)) {
                disp_sec_ace_object(&ace->object.object);
@@ -223,7 +228,7 @@ void display_sec_ace(SEC_ACE *ace)
 /****************************************************************************
  display sec_acl structure
  ****************************************************************************/
-void display_sec_acl(SEC_ACL *sec_acl)
+void display_sec_acl(struct security_acl *sec_acl)
 {
        int i;
 
@@ -238,54 +243,52 @@ void display_sec_acl(SEC_ACL *sec_acl)
        }
 }
 
-void display_acl_type(uint16 type)
+void display_acl_type(uint16_t type)
 {
-       fstring typestr="";
-
-       typestr[0] = 0;
+       printf("type: 0x%04x: ", type);
 
        if (type & SEC_DESC_OWNER_DEFAULTED)    /* 0x0001 */
-               fstrcat(typestr, "SEC_DESC_OWNER_DEFAULTED ");
+               printf("SEC_DESC_OWNER_DEFAULTED ");
        if (type & SEC_DESC_GROUP_DEFAULTED)    /* 0x0002 */
-               fstrcat(typestr, "SEC_DESC_GROUP_DEFAULTED ");
+               printf("SEC_DESC_GROUP_DEFAULTED ");
        if (type & SEC_DESC_DACL_PRESENT)       /* 0x0004 */
-               fstrcat(typestr, "SEC_DESC_DACL_PRESENT ");
+               printf("SEC_DESC_DACL_PRESENT ");
        if (type & SEC_DESC_DACL_DEFAULTED)     /* 0x0008 */
-               fstrcat(typestr, "SEC_DESC_DACL_DEFAULTED ");
+               printf("SEC_DESC_DACL_DEFAULTED ");
        if (type & SEC_DESC_SACL_PRESENT)       /* 0x0010 */
-               fstrcat(typestr, "SEC_DESC_SACL_PRESENT ");
+               printf("SEC_DESC_SACL_PRESENT ");
        if (type & SEC_DESC_SACL_DEFAULTED)     /* 0x0020 */
-               fstrcat(typestr, "SEC_DESC_SACL_DEFAULTED ");
+               printf("SEC_DESC_SACL_DEFAULTED ");
        if (type & SEC_DESC_DACL_TRUSTED)       /* 0x0040 */
-               fstrcat(typestr, "SEC_DESC_DACL_TRUSTED ");
+               printf("SEC_DESC_DACL_TRUSTED ");
        if (type & SEC_DESC_SERVER_SECURITY)    /* 0x0080 */
-               fstrcat(typestr, "SEC_DESC_SERVER_SECURITY ");
+               printf("SEC_DESC_SERVER_SECURITY ");
        if (type & SEC_DESC_DACL_AUTO_INHERIT_REQ) /* 0x0100 */
-               fstrcat(typestr, "SEC_DESC_DACL_AUTO_INHERIT_REQ ");
+               printf("SEC_DESC_DACL_AUTO_INHERIT_REQ ");
        if (type & SEC_DESC_SACL_AUTO_INHERIT_REQ) /* 0x0200 */
-               fstrcat(typestr, "SEC_DESC_SACL_AUTO_INHERIT_REQ ");
+               printf("SEC_DESC_SACL_AUTO_INHERIT_REQ ");
        if (type & SEC_DESC_DACL_AUTO_INHERITED) /* 0x0400 */
-               fstrcat(typestr, "SEC_DESC_DACL_AUTO_INHERITED ");
+               printf("SEC_DESC_DACL_AUTO_INHERITED ");
        if (type & SEC_DESC_SACL_AUTO_INHERITED) /* 0x0800 */
-               fstrcat(typestr, "SEC_DESC_SACL_AUTO_INHERITED ");
+               printf("SEC_DESC_SACL_AUTO_INHERITED ");
        if (type & SEC_DESC_DACL_PROTECTED)     /* 0x1000 */
-               fstrcat(typestr, "SEC_DESC_DACL_PROTECTED ");
+               printf("SEC_DESC_DACL_PROTECTED ");
        if (type & SEC_DESC_SACL_PROTECTED)     /* 0x2000 */
-               fstrcat(typestr, "SEC_DESC_SACL_PROTECTED ");
+               printf("SEC_DESC_SACL_PROTECTED ");
        if (type & SEC_DESC_RM_CONTROL_VALID)   /* 0x4000 */
-               fstrcat(typestr, "SEC_DESC_RM_CONTROL_VALID ");
+               printf("SEC_DESC_RM_CONTROL_VALID ");
        if (type & SEC_DESC_SELF_RELATIVE)      /* 0x8000 */
-               fstrcat(typestr, "SEC_DESC_SELF_RELATIVE ");
+               printf("SEC_DESC_SELF_RELATIVE ");
        
-       printf("type: 0x%04x: %s\n", type, typestr);
+       printf("\n");
 }
 
 /****************************************************************************
  display sec_desc structure
  ****************************************************************************/
-void display_sec_desc(SEC_DESC *sec)
+void display_sec_desc(struct security_descriptor *sec)
 {
-       fstring sid_str;
+       char *sid_str;
 
        if (!sec) {
                printf("NULL\n");
@@ -306,12 +309,14 @@ void display_sec_desc(SEC_DESC *sec)
        }
 
        if (sec->owner_sid) {
-               sid_to_fstring(sid_str, sec->owner_sid);
+               sid_str = dom_sid_string(NULL, sec->owner_sid);
                printf("\tOwner SID:\t%s\n", sid_str);
+               talloc_free(sid_str);
        }
 
        if (sec->group_sid) {
-               sid_to_fstring(sid_str, sec->group_sid);
+               sid_str = dom_sid_string(NULL, sec->group_sid);
                printf("\tGroup SID:\t%s\n", sid_str);
+               talloc_free(sid_str);
        }
 }
index 5104c3ee02968880e72879a84115a55f6d3a572d..1a7422e3f6ee05d2120b43d2dc5d58696ddf4dc9 100644 (file)
@@ -124,6 +124,7 @@ static const struct werror_code_struct dos_errs[] =
        { "WERR_DS_DRA_DB_ERROR", WERR_DS_DRA_DB_ERROR },
        { "WERR_DS_DRA_NO_REPLICA", WERR_DS_DRA_NO_REPLICA },
        { "WERR_DS_DRA_ACCESS_DENIED", WERR_DS_DRA_ACCESS_DENIED },
+       { "WERR_DS_DRA_SOURCE_DISABLED", WERR_DS_DRA_SOURCE_DISABLED },
        { "WERR_DS_DNS_LOOKUP_FAILURE", WERR_DS_DNS_LOOKUP_FAILURE },
        { "WERR_DS_WRONG_LINKED_ATTRIBUTE_SYNTAX", WERR_DS_WRONG_LINKED_ATTRIBUTE_SYNTAX },
        { "WERR_DS_NO_MSDS_INTID", WERR_DS_NO_MSDS_INTID },
index d92232706a61c9916309f84ad5668173bab6cda9..a69587f36177aac8d0bb0e87d01a06c091735185 100644 (file)
@@ -248,6 +248,7 @@ typedef uint32_t WERROR;
 #define WERR_DS_DRA_DB_ERROR W_ERROR(0x00002103)
 #define WERR_DS_DRA_NO_REPLICA W_ERROR(0x00002104)
 #define WERR_DS_DRA_ACCESS_DENIED W_ERROR(0x00002105)
+#define WERR_DS_DRA_SOURCE_DISABLED W_ERROR(0x00002108)
 #define WERR_DS_DNS_LOOKUP_FAILURE W_ERROR(0x0000214c)
 #define WERR_DS_WRONG_LINKED_ATTRIBUTE_SYNTAX W_ERROR(0x00002150)
 #define WERR_DS_NO_MSDS_INTID W_ERROR(0x00002194)
diff --git a/librpc/gen_ndr/dcerpc.h b/librpc/gen_ndr/dcerpc.h
new file mode 100644 (file)
index 0000000..78834f6
--- /dev/null
@@ -0,0 +1,343 @@
+/* header auto-generated by pidl */
+
+#include <stdint.h>
+
+#include "libcli/util/ntstatus.h"
+
+#include "librpc/gen_ndr/misc.h"
+#ifndef _HEADER_dcerpc
+#define _HEADER_dcerpc
+
+#define DCERPC_REQUEST_LENGTH  ( 24 )
+#define DCERPC_BIND_REASON_ASYNTAX     ( 1 )
+#define DCERPC_BIND_PROVIDER_REJECT    ( 2 )
+#define DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED     ( 4 )
+#define DCERPC_BIND_REASON_INVALID_AUTH_TYPE   ( 8 )
+#define DCERPC_RESPONSE_LENGTH ( 24 )
+#define DCERPC_FAULT_OP_RNG_ERROR      ( 0x1c010002 )
+#define DCERPC_FAULT_UNK_IF    ( 0x1c010003 )
+#define DCERPC_FAULT_NDR       ( 0x000006f7 )
+#define DCERPC_FAULT_INVALID_TAG       ( 0x1c000006 )
+#define DCERPC_FAULT_CONTEXT_MISMATCH  ( 0x1c00001a )
+#define DCERPC_FAULT_OTHER     ( 0x00000001 )
+#define DCERPC_FAULT_ACCESS_DENIED     ( 0x00000005 )
+#define DCERPC_FAULT_CANT_PERFORM      ( 0x000006d8 )
+#define DCERPC_FAULT_TODO      ( 0x00000042 )
+#define DCERPC_AUTH_LEVEL_DEFAULT      ( DCERPC_AUTH_LEVEL_CONNECT )
+#define DCERPC_AUTH_TRAILER_LENGTH     ( 8 )
+#define DCERPC_PFC_FLAG_FIRST  ( 0x01 )
+#define DCERPC_PFC_FLAG_LAST   ( 0x02 )
+#define DCERPC_PFC_FLAG_PENDING_CANCEL ( 0x04 )
+#define DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN    ( DCERPC_PFC_FLAG_PENDING_CANCEL )
+#define DCERPC_PFC_FLAG_CONC_MPX       ( 0x10 )
+#define DCERPC_PFC_FLAG_DID_NOT_EXECUTE        ( 0x20 )
+#define DCERPC_PFC_FLAG_MAYBE  ( 0x40 )
+#define DCERPC_PFC_FLAG_OBJECT_UUID    ( 0x80 )
+#define DCERPC_PFC_OFFSET      ( 3 )
+#define DCERPC_DREP_OFFSET     ( 4 )
+#define DCERPC_FRAG_LEN_OFFSET ( 8 )
+#define DCERPC_AUTH_LEN_OFFSET ( 10 )
+#define DCERPC_DREP_LE ( 0x10 )
+struct dcerpc_ctx_list {
+       uint16_t context_id;
+       uint8_t num_transfer_syntaxes;
+       struct ndr_syntax_id abstract_syntax;
+       struct ndr_syntax_id *transfer_syntaxes;
+};
+
+struct dcerpc_bind {
+       uint16_t max_xmit_frag;
+       uint16_t max_recv_frag;
+       uint32_t assoc_group_id;
+       uint8_t num_contexts;
+       struct dcerpc_ctx_list *ctx_list;
+       DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */
+       DATA_BLOB auth_info;/* [flag(LIBNDR_FLAG_REMAINING)] */
+};
+
+struct dcerpc_empty {
+       char _empty_;
+};
+
+union dcerpc_object {
+       struct dcerpc_empty empty;/* [default] */
+       struct GUID object;/* [case(LIBNDR_FLAG_OBJECT_PRESENT)] */
+}/* [nodiscriminant] */;
+
+struct dcerpc_request {
+       uint32_t alloc_hint;
+       uint16_t context_id;
+       uint16_t opnum;
+       union dcerpc_object object;/* [switch_is(ndr->flags&LIBNDR_FLAG_OBJECT_PRESENT)] */
+       DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN8)] */
+       DATA_BLOB stub_and_verifier;/* [flag(LIBNDR_FLAG_REMAINING)] */
+};
+
+struct dcerpc_ack_ctx {
+       uint16_t result;
+       uint16_t reason;
+       struct ndr_syntax_id syntax;
+};
+
+struct dcerpc_bind_ack {
+       uint16_t max_xmit_frag;
+       uint16_t max_recv_frag;
+       uint32_t assoc_group_id;
+       uint16_t secondary_address_size;/* [value(strlen(secondary_address)+1)] */
+       const char *secondary_address;/* [charset(DOS)] */
+       DATA_BLOB _pad1;/* [flag(LIBNDR_FLAG_ALIGN4)] */
+       uint8_t num_results;
+       struct dcerpc_ack_ctx *ctx_list;
+       DATA_BLOB auth_info;/* [flag(LIBNDR_FLAG_REMAINING)] */
+};
+
+struct dcerpc_bind_nak_versions {
+       uint32_t num_versions;
+       uint32_t *versions;
+};
+
+union dcerpc_bind_nak_versions_ctr {
+       struct dcerpc_bind_nak_versions v;/* [case(DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED)] */
+}/* [nodiscriminant] */;
+
+struct dcerpc_bind_nak {
+       uint16_t reject_reason;
+       union dcerpc_bind_nak_versions_ctr versions;/* [switch_is(reject_reason)] */
+};
+
+struct dcerpc_response {
+       uint32_t alloc_hint;
+       uint16_t context_id;
+       uint8_t cancel_count;
+       DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN8)] */
+       DATA_BLOB stub_and_verifier;/* [flag(LIBNDR_FLAG_REMAINING)] */
+};
+
+struct dcerpc_fault {
+       uint32_t alloc_hint;
+       uint16_t context_id;
+       uint8_t cancel_count;
+       uint32_t status;
+       DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_REMAINING)] */
+};
+
+enum dcerpc_AuthType
+#ifndef USE_UINT_ENUMS
+ {
+       DCERPC_AUTH_TYPE_NONE=0,
+       DCERPC_AUTH_TYPE_KRB5_1=1,
+       DCERPC_AUTH_TYPE_SPNEGO=9,
+       DCERPC_AUTH_TYPE_NTLMSSP=10,
+       DCERPC_AUTH_TYPE_KRB5=16,
+       DCERPC_AUTH_TYPE_DPA=17,
+       DCERPC_AUTH_TYPE_MSN=18,
+       DCERPC_AUTH_TYPE_DIGEST=21,
+       DCERPC_AUTH_TYPE_SCHANNEL=68,
+       DCERPC_AUTH_TYPE_MSMQ=100
+}
+#else
+ { __donnot_use_enum_dcerpc_AuthType=0x7FFFFFFF}
+#define DCERPC_AUTH_TYPE_NONE ( 0 )
+#define DCERPC_AUTH_TYPE_KRB5_1 ( 1 )
+#define DCERPC_AUTH_TYPE_SPNEGO ( 9 )
+#define DCERPC_AUTH_TYPE_NTLMSSP ( 10 )
+#define DCERPC_AUTH_TYPE_KRB5 ( 16 )
+#define DCERPC_AUTH_TYPE_DPA ( 17 )
+#define DCERPC_AUTH_TYPE_MSN ( 18 )
+#define DCERPC_AUTH_TYPE_DIGEST ( 21 )
+#define DCERPC_AUTH_TYPE_SCHANNEL ( 68 )
+#define DCERPC_AUTH_TYPE_MSMQ ( 100 )
+#endif
+;
+
+enum dcerpc_AuthLevel
+#ifndef USE_UINT_ENUMS
+ {
+       DCERPC_AUTH_LEVEL_NONE=1,
+       DCERPC_AUTH_LEVEL_CONNECT=2,
+       DCERPC_AUTH_LEVEL_CALL=3,
+       DCERPC_AUTH_LEVEL_PACKET=4,
+       DCERPC_AUTH_LEVEL_INTEGRITY=5,
+       DCERPC_AUTH_LEVEL_PRIVACY=6
+}
+#else
+ { __donnot_use_enum_dcerpc_AuthLevel=0x7FFFFFFF}
+#define DCERPC_AUTH_LEVEL_NONE ( 1 )
+#define DCERPC_AUTH_LEVEL_CONNECT ( 2 )
+#define DCERPC_AUTH_LEVEL_CALL ( 3 )
+#define DCERPC_AUTH_LEVEL_PACKET ( 4 )
+#define DCERPC_AUTH_LEVEL_INTEGRITY ( 5 )
+#define DCERPC_AUTH_LEVEL_PRIVACY ( 6 )
+#endif
+;
+
+struct dcerpc_auth {
+       enum dcerpc_AuthType auth_type;
+       enum dcerpc_AuthLevel auth_level;
+       uint8_t auth_pad_length;
+       uint8_t auth_reserved;
+       uint32_t auth_context_id;
+       DATA_BLOB credentials;/* [flag(LIBNDR_FLAG_REMAINING)] */
+}/* [public] */;
+
+struct dcerpc_auth3 {
+       uint32_t _pad;
+       DATA_BLOB auth_info;/* [flag(LIBNDR_FLAG_REMAINING)] */
+}/* [public] */;
+
+struct dcerpc_orphaned {
+       uint32_t _pad;
+       DATA_BLOB auth_info;/* [flag(LIBNDR_FLAG_REMAINING)] */
+}/* [public] */;
+
+struct dcerpc_co_cancel {
+       uint32_t _pad;
+       DATA_BLOB auth_info;/* [flag(LIBNDR_FLAG_REMAINING)] */
+}/* [public] */;
+
+struct dcerpc_cl_cancel {
+       uint32_t version;
+       uint32_t id;
+}/* [public] */;
+
+struct dcerpc_cancel_ack {
+       uint32_t version;
+       uint32_t id;
+       uint32_t server_is_accepting;
+}/* [public] */;
+
+struct dcerpc_fack {
+       uint32_t version;
+       uint8_t _pad1;
+       uint16_t window_size;
+       uint32_t max_tdsu;
+       uint32_t max_frag_size;
+       uint16_t serial_no;
+       uint16_t selack_size;
+       uint32_t *selack;
+}/* [public] */;
+
+struct dcerpc_ack {
+       char _empty_;
+}/* [public] */;
+
+struct dcerpc_ping {
+       char _empty_;
+}/* [public] */;
+
+struct dcerpc_shutdown {
+       char _empty_;
+}/* [public] */;
+
+struct dcerpc_working {
+       char _empty_;
+}/* [public] */;
+
+enum dcerpc_pkt_type
+#ifndef USE_UINT_ENUMS
+ {
+       DCERPC_PKT_REQUEST=0,
+       DCERPC_PKT_PING=1,
+       DCERPC_PKT_RESPONSE=2,
+       DCERPC_PKT_FAULT=3,
+       DCERPC_PKT_WORKING=4,
+       DCERPC_PKT_NOCALL=5,
+       DCERPC_PKT_REJECT=6,
+       DCERPC_PKT_ACK=7,
+       DCERPC_PKT_CL_CANCEL=8,
+       DCERPC_PKT_FACK=9,
+       DCERPC_PKT_CANCEL_ACK=10,
+       DCERPC_PKT_BIND=11,
+       DCERPC_PKT_BIND_ACK=12,
+       DCERPC_PKT_BIND_NAK=13,
+       DCERPC_PKT_ALTER=14,
+       DCERPC_PKT_ALTER_RESP=15,
+       DCERPC_PKT_AUTH3=16,
+       DCERPC_PKT_SHUTDOWN=17,
+       DCERPC_PKT_CO_CANCEL=18,
+       DCERPC_PKT_ORPHANED=19
+}
+#else
+ { __donnot_use_enum_dcerpc_pkt_type=0x7FFFFFFF}
+#define DCERPC_PKT_REQUEST ( 0 )
+#define DCERPC_PKT_PING ( 1 )
+#define DCERPC_PKT_RESPONSE ( 2 )
+#define DCERPC_PKT_FAULT ( 3 )
+#define DCERPC_PKT_WORKING ( 4 )
+#define DCERPC_PKT_NOCALL ( 5 )
+#define DCERPC_PKT_REJECT ( 6 )
+#define DCERPC_PKT_ACK ( 7 )
+#define DCERPC_PKT_CL_CANCEL ( 8 )
+#define DCERPC_PKT_FACK ( 9 )
+#define DCERPC_PKT_CANCEL_ACK ( 10 )
+#define DCERPC_PKT_BIND ( 11 )
+#define DCERPC_PKT_BIND_ACK ( 12 )
+#define DCERPC_PKT_BIND_NAK ( 13 )
+#define DCERPC_PKT_ALTER ( 14 )
+#define DCERPC_PKT_ALTER_RESP ( 15 )
+#define DCERPC_PKT_AUTH3 ( 16 )
+#define DCERPC_PKT_SHUTDOWN ( 17 )
+#define DCERPC_PKT_CO_CANCEL ( 18 )
+#define DCERPC_PKT_ORPHANED ( 19 )
+#endif
+;
+
+union dcerpc_payload {
+       struct dcerpc_request request;/* [case(DCERPC_PKT_REQUEST)] */
+       struct dcerpc_ping ping;/* [case(DCERPC_PKT_PING)] */
+       struct dcerpc_response response;/* [case(DCERPC_PKT_RESPONSE)] */
+       struct dcerpc_fault fault;/* [case(DCERPC_PKT_FAULT)] */
+       struct dcerpc_working working;/* [case(DCERPC_PKT_WORKING)] */
+       struct dcerpc_fack nocall;/* [case(DCERPC_PKT_NOCALL)] */
+       struct dcerpc_fault reject;/* [case(DCERPC_PKT_REJECT)] */
+       struct dcerpc_ack ack;/* [case(DCERPC_PKT_ACK)] */
+       struct dcerpc_cl_cancel cl_cancel;/* [case(DCERPC_PKT_CL_CANCEL)] */
+       struct dcerpc_fack fack;/* [case(DCERPC_PKT_FACK)] */
+       struct dcerpc_cancel_ack cancel_ack;/* [case(DCERPC_PKT_CANCEL_ACK)] */
+       struct dcerpc_bind bind;/* [case(DCERPC_PKT_BIND)] */
+       struct dcerpc_bind_ack bind_ack;/* [case(DCERPC_PKT_BIND_ACK)] */
+       struct dcerpc_bind_nak bind_nak;/* [case(DCERPC_PKT_BIND_NAK)] */
+       struct dcerpc_bind alter;/* [case(DCERPC_PKT_ALTER)] */
+       struct dcerpc_bind_ack alter_resp;/* [case(DCERPC_PKT_ALTER_RESP)] */
+       struct dcerpc_shutdown shutdown;/* [case(DCERPC_PKT_SHUTDOWN)] */
+       struct dcerpc_co_cancel co_cancel;/* [case(DCERPC_PKT_CO_CANCEL)] */
+       struct dcerpc_orphaned orphaned;/* [case(DCERPC_PKT_ORPHANED)] */
+       struct dcerpc_auth3 auth3;/* [case(DCERPC_PKT_AUTH3)] */
+}/* [nodiscriminant] */;
+
+struct ncacn_packet {
+       uint8_t rpc_vers;
+       uint8_t rpc_vers_minor;
+       enum dcerpc_pkt_type ptype;
+       uint8_t pfc_flags;
+       uint8_t drep[4];
+       uint16_t frag_length;
+       uint16_t auth_length;
+       uint32_t call_id;
+       union dcerpc_payload u;/* [switch_is(ptype)] */
+}/* [public] */;
+
+struct ncadg_packet {
+       uint8_t rpc_vers;
+       uint8_t ptype;
+       uint8_t pfc_flags;
+       uint8_t ncadg_flags;
+       uint8_t drep[3];
+       uint8_t serial_high;
+       struct GUID object;
+       struct GUID iface;
+       struct GUID activity;
+       uint32_t server_boot;
+       uint32_t iface_version;
+       uint32_t seq_num;
+       uint16_t opnum;
+       uint16_t ihint;
+       uint16_t ahint;
+       uint16_t len;
+       uint16_t fragnum;
+       uint8_t auth_proto;
+       uint8_t serial_low;
+       union dcerpc_payload u;/* [switch_is(ptype)] */
+}/* [public] */;
+
+#endif /* _HEADER_dcerpc */
diff --git a/librpc/gen_ndr/ndr_dcerpc.c b/librpc/gen_ndr/ndr_dcerpc.c
new file mode 100644 (file)
index 0000000..c510967
--- /dev/null
@@ -0,0 +1,1834 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "../librpc/gen_ndr/ndr_dcerpc.h"
+
+#include "librpc/gen_ndr/ndr_misc.h"
+static enum ndr_err_code ndr_push_dcerpc_ctx_list(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_ctx_list *r)
+{
+       uint32_t cntr_transfer_syntaxes_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->context_id));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->num_transfer_syntaxes));
+               NDR_CHECK(ndr_push_ndr_syntax_id(ndr, NDR_SCALARS, &r->abstract_syntax));
+               for (cntr_transfer_syntaxes_0 = 0; cntr_transfer_syntaxes_0 < r->num_transfer_syntaxes; cntr_transfer_syntaxes_0++) {
+                       NDR_CHECK(ndr_push_ndr_syntax_id(ndr, NDR_SCALARS, &r->transfer_syntaxes[cntr_transfer_syntaxes_0]));
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_ctx_list(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_ctx_list *r)
+{
+       uint32_t cntr_transfer_syntaxes_0;
+       TALLOC_CTX *_mem_save_transfer_syntaxes_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->context_id));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->num_transfer_syntaxes));
+               NDR_CHECK(ndr_pull_ndr_syntax_id(ndr, NDR_SCALARS, &r->abstract_syntax));
+               NDR_PULL_ALLOC_N(ndr, r->transfer_syntaxes, r->num_transfer_syntaxes);
+               _mem_save_transfer_syntaxes_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->transfer_syntaxes, 0);
+               for (cntr_transfer_syntaxes_0 = 0; cntr_transfer_syntaxes_0 < r->num_transfer_syntaxes; cntr_transfer_syntaxes_0++) {
+                       NDR_CHECK(ndr_pull_ndr_syntax_id(ndr, NDR_SCALARS, &r->transfer_syntaxes[cntr_transfer_syntaxes_0]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_transfer_syntaxes_0, 0);
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_ctx_list(struct ndr_print *ndr, const char *name, const struct dcerpc_ctx_list *r)
+{
+       uint32_t cntr_transfer_syntaxes_0;
+       ndr_print_struct(ndr, name, "dcerpc_ctx_list");
+       ndr->depth++;
+       ndr_print_uint16(ndr, "context_id", r->context_id);
+       ndr_print_uint8(ndr, "num_transfer_syntaxes", r->num_transfer_syntaxes);
+       ndr_print_ndr_syntax_id(ndr, "abstract_syntax", &r->abstract_syntax);
+       ndr->print(ndr, "%s: ARRAY(%d)", "transfer_syntaxes", (int)r->num_transfer_syntaxes);
+       ndr->depth++;
+       for (cntr_transfer_syntaxes_0=0;cntr_transfer_syntaxes_0<r->num_transfer_syntaxes;cntr_transfer_syntaxes_0++) {
+               char *idx_0=NULL;
+               if (asprintf(&idx_0, "[%d]", cntr_transfer_syntaxes_0) != -1) {
+                       ndr_print_ndr_syntax_id(ndr, "transfer_syntaxes", &r->transfer_syntaxes[cntr_transfer_syntaxes_0]);
+                       free(idx_0);
+               }
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_bind(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_bind *r)
+{
+       uint32_t cntr_ctx_list_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_xmit_frag));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_recv_frag));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->assoc_group_id));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->num_contexts));
+               for (cntr_ctx_list_0 = 0; cntr_ctx_list_0 < r->num_contexts; cntr_ctx_list_0++) {
+                       NDR_CHECK(ndr_push_dcerpc_ctx_list(ndr, NDR_SCALARS, &r->ctx_list[cntr_ctx_list_0]));
+               }
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->auth_info));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_bind(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_bind *r)
+{
+       uint32_t cntr_ctx_list_0;
+       TALLOC_CTX *_mem_save_ctx_list_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_xmit_frag));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_recv_frag));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->assoc_group_id));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->num_contexts));
+               NDR_PULL_ALLOC_N(ndr, r->ctx_list, r->num_contexts);
+               _mem_save_ctx_list_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->ctx_list, 0);
+               for (cntr_ctx_list_0 = 0; cntr_ctx_list_0 < r->num_contexts; cntr_ctx_list_0++) {
+                       NDR_CHECK(ndr_pull_dcerpc_ctx_list(ndr, NDR_SCALARS, &r->ctx_list[cntr_ctx_list_0]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctx_list_0, 0);
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->auth_info));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_bind(struct ndr_print *ndr, const char *name, const struct dcerpc_bind *r)
+{
+       uint32_t cntr_ctx_list_0;
+       ndr_print_struct(ndr, name, "dcerpc_bind");
+       ndr->depth++;
+       ndr_print_uint16(ndr, "max_xmit_frag", r->max_xmit_frag);
+       ndr_print_uint16(ndr, "max_recv_frag", r->max_recv_frag);
+       ndr_print_uint32(ndr, "assoc_group_id", r->assoc_group_id);
+       ndr_print_uint8(ndr, "num_contexts", r->num_contexts);
+       ndr->print(ndr, "%s: ARRAY(%d)", "ctx_list", (int)r->num_contexts);
+       ndr->depth++;
+       for (cntr_ctx_list_0=0;cntr_ctx_list_0<r->num_contexts;cntr_ctx_list_0++) {
+               char *idx_0=NULL;
+               if (asprintf(&idx_0, "[%d]", cntr_ctx_list_0) != -1) {
+                       ndr_print_dcerpc_ctx_list(ndr, "ctx_list", &r->ctx_list[cntr_ctx_list_0]);
+                       free(idx_0);
+               }
+       }
+       ndr->depth--;
+       ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+       ndr_print_DATA_BLOB(ndr, "auth_info", r->auth_info);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_empty(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_empty *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 1));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_empty(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_empty *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 1));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_empty(struct ndr_print *ndr, const char *name, const struct dcerpc_empty *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_empty");
+       ndr->depth++;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_object(struct ndr_push *ndr, int ndr_flags, const union dcerpc_object *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       default: {
+                               NDR_CHECK(ndr_push_dcerpc_empty(ndr, NDR_SCALARS, &r->empty));
+                       break; }
+
+                       case LIBNDR_FLAG_OBJECT_PRESENT: {
+                               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->object));
+                       break; }
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       default:
+                       break;
+
+                       case LIBNDR_FLAG_OBJECT_PRESENT:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_object(struct ndr_pull *ndr, int ndr_flags, union dcerpc_object *r)
+{
+       int level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               switch (level) {
+                       default: {
+                               NDR_CHECK(ndr_pull_dcerpc_empty(ndr, NDR_SCALARS, &r->empty));
+                       break; }
+
+                       case LIBNDR_FLAG_OBJECT_PRESENT: {
+                               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->object));
+                       break; }
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       default:
+                       break;
+
+                       case LIBNDR_FLAG_OBJECT_PRESENT:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_object(struct ndr_print *ndr, const char *name, const union dcerpc_object *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "dcerpc_object");
+       switch (level) {
+               default:
+                       ndr_print_dcerpc_empty(ndr, "empty", &r->empty);
+               break;
+
+               case LIBNDR_FLAG_OBJECT_PRESENT:
+                       ndr_print_GUID(ndr, "object", &r->object);
+               break;
+
+       }
+}
+
+static enum ndr_err_code ndr_push_dcerpc_request(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_request *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->alloc_hint));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->context_id));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->opnum));
+               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, ndr->flags & LIBNDR_FLAG_OBJECT_PRESENT));
+               NDR_CHECK(ndr_push_dcerpc_object(ndr, NDR_SCALARS, &r->object));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->stub_and_verifier));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_request(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_request *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->alloc_hint));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->context_id));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->opnum));
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, ndr->flags & LIBNDR_FLAG_OBJECT_PRESENT));
+               NDR_CHECK(ndr_pull_dcerpc_object(ndr, NDR_SCALARS, &r->object));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->stub_and_verifier));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_request(struct ndr_print *ndr, const char *name, const struct dcerpc_request *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_request");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "alloc_hint", r->alloc_hint);
+       ndr_print_uint16(ndr, "context_id", r->context_id);
+       ndr_print_uint16(ndr, "opnum", r->opnum);
+       ndr_print_set_switch_value(ndr, &r->object, ndr->flags & LIBNDR_FLAG_OBJECT_PRESENT);
+       ndr_print_dcerpc_object(ndr, "object", &r->object);
+       ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+       ndr_print_DATA_BLOB(ndr, "stub_and_verifier", r->stub_and_verifier);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_ack_ctx(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_ack_ctx *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->result));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->reason));
+               NDR_CHECK(ndr_push_ndr_syntax_id(ndr, NDR_SCALARS, &r->syntax));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_ack_ctx(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_ack_ctx *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->result));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->reason));
+               NDR_CHECK(ndr_pull_ndr_syntax_id(ndr, NDR_SCALARS, &r->syntax));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_ack_ctx(struct ndr_print *ndr, const char *name, const struct dcerpc_ack_ctx *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_ack_ctx");
+       ndr->depth++;
+       ndr_print_uint16(ndr, "result", r->result);
+       ndr_print_uint16(ndr, "reason", r->reason);
+       ndr_print_ndr_syntax_id(ndr, "syntax", &r->syntax);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_bind_ack(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_bind_ack *r)
+{
+       uint32_t cntr_ctx_list_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_xmit_frag));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->max_recv_frag));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->assoc_group_id));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen(r->secondary_address) + 1));
+               NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->secondary_address, strlen(r->secondary_address) + 1, sizeof(uint8_t), CH_DOS));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad1));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->num_results));
+               for (cntr_ctx_list_0 = 0; cntr_ctx_list_0 < r->num_results; cntr_ctx_list_0++) {
+                       NDR_CHECK(ndr_push_dcerpc_ack_ctx(ndr, NDR_SCALARS, &r->ctx_list[cntr_ctx_list_0]));
+               }
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->auth_info));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_bind_ack(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_bind_ack *r)
+{
+       uint32_t cntr_ctx_list_0;
+       TALLOC_CTX *_mem_save_ctx_list_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_xmit_frag));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->max_recv_frag));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->assoc_group_id));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->secondary_address_size));
+               NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->secondary_address, r->secondary_address_size, sizeof(uint8_t), CH_DOS));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad1));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->num_results));
+               NDR_PULL_ALLOC_N(ndr, r->ctx_list, r->num_results);
+               _mem_save_ctx_list_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->ctx_list, 0);
+               for (cntr_ctx_list_0 = 0; cntr_ctx_list_0 < r->num_results; cntr_ctx_list_0++) {
+                       NDR_CHECK(ndr_pull_dcerpc_ack_ctx(ndr, NDR_SCALARS, &r->ctx_list[cntr_ctx_list_0]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctx_list_0, 0);
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->auth_info));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_bind_ack(struct ndr_print *ndr, const char *name, const struct dcerpc_bind_ack *r)
+{
+       uint32_t cntr_ctx_list_0;
+       ndr_print_struct(ndr, name, "dcerpc_bind_ack");
+       ndr->depth++;
+       ndr_print_uint16(ndr, "max_xmit_frag", r->max_xmit_frag);
+       ndr_print_uint16(ndr, "max_recv_frag", r->max_recv_frag);
+       ndr_print_uint32(ndr, "assoc_group_id", r->assoc_group_id);
+       ndr_print_uint16(ndr, "secondary_address_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen(r->secondary_address) + 1:r->secondary_address_size);
+       ndr_print_string(ndr, "secondary_address", r->secondary_address);
+       ndr_print_DATA_BLOB(ndr, "_pad1", r->_pad1);
+       ndr_print_uint8(ndr, "num_results", r->num_results);
+       ndr->print(ndr, "%s: ARRAY(%d)", "ctx_list", (int)r->num_results);
+       ndr->depth++;
+       for (cntr_ctx_list_0=0;cntr_ctx_list_0<r->num_results;cntr_ctx_list_0++) {
+               char *idx_0=NULL;
+               if (asprintf(&idx_0, "[%d]", cntr_ctx_list_0) != -1) {
+                       ndr_print_dcerpc_ack_ctx(ndr, "ctx_list", &r->ctx_list[cntr_ctx_list_0]);
+                       free(idx_0);
+               }
+       }
+       ndr->depth--;
+       ndr_print_DATA_BLOB(ndr, "auth_info", r->auth_info);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_bind_nak_versions(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_bind_nak_versions *r)
+{
+       uint32_t cntr_versions_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_versions));
+               for (cntr_versions_0 = 0; cntr_versions_0 < r->num_versions; cntr_versions_0++) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->versions[cntr_versions_0]));
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_bind_nak_versions(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_bind_nak_versions *r)
+{
+       uint32_t cntr_versions_0;
+       TALLOC_CTX *_mem_save_versions_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_versions));
+               NDR_PULL_ALLOC_N(ndr, r->versions, r->num_versions);
+               _mem_save_versions_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->versions, 0);
+               for (cntr_versions_0 = 0; cntr_versions_0 < r->num_versions; cntr_versions_0++) {
+                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->versions[cntr_versions_0]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_versions_0, 0);
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_bind_nak_versions(struct ndr_print *ndr, const char *name, const struct dcerpc_bind_nak_versions *r)
+{
+       uint32_t cntr_versions_0;
+       ndr_print_struct(ndr, name, "dcerpc_bind_nak_versions");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "num_versions", r->num_versions);
+       ndr->print(ndr, "%s: ARRAY(%d)", "versions", (int)r->num_versions);
+       ndr->depth++;
+       for (cntr_versions_0=0;cntr_versions_0<r->num_versions;cntr_versions_0++) {
+               char *idx_0=NULL;
+               if (asprintf(&idx_0, "[%d]", cntr_versions_0) != -1) {
+                       ndr_print_uint32(ndr, "versions", r->versions[cntr_versions_0]);
+                       free(idx_0);
+               }
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_bind_nak_versions_ctr(struct ndr_push *ndr, int ndr_flags, const union dcerpc_bind_nak_versions_ctr *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED: {
+                               NDR_CHECK(ndr_push_dcerpc_bind_nak_versions(ndr, NDR_SCALARS, &r->v));
+                       break; }
+
+                       default: {
+                       break; }
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED:
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_bind_nak_versions_ctr(struct ndr_pull *ndr, int ndr_flags, union dcerpc_bind_nak_versions_ctr *r)
+{
+       int level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               switch (level) {
+                       case DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED: {
+                               NDR_CHECK(ndr_pull_dcerpc_bind_nak_versions(ndr, NDR_SCALARS, &r->v));
+                       break; }
+
+                       default: {
+                       break; }
+
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED:
+                       break;
+
+                       default:
+                       break;
+
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_bind_nak_versions_ctr(struct ndr_print *ndr, const char *name, const union dcerpc_bind_nak_versions_ctr *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "dcerpc_bind_nak_versions_ctr");
+       switch (level) {
+               case DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED:
+                       ndr_print_dcerpc_bind_nak_versions(ndr, "v", &r->v);
+               break;
+
+               default:
+               break;
+
+       }
+}
+
+static enum ndr_err_code ndr_push_dcerpc_bind_nak(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_bind_nak *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->reject_reason));
+               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->versions, r->reject_reason));
+               NDR_CHECK(ndr_push_dcerpc_bind_nak_versions_ctr(ndr, NDR_SCALARS, &r->versions));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_dcerpc_bind_nak_versions_ctr(ndr, NDR_BUFFERS, &r->versions));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_bind_nak(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_bind_nak *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->reject_reason));
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->versions, r->reject_reason));
+               NDR_CHECK(ndr_pull_dcerpc_bind_nak_versions_ctr(ndr, NDR_SCALARS, &r->versions));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_dcerpc_bind_nak_versions_ctr(ndr, NDR_BUFFERS, &r->versions));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_bind_nak(struct ndr_print *ndr, const char *name, const struct dcerpc_bind_nak *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_bind_nak");
+       ndr->depth++;
+       ndr_print_uint16(ndr, "reject_reason", r->reject_reason);
+       ndr_print_set_switch_value(ndr, &r->versions, r->reject_reason);
+       ndr_print_dcerpc_bind_nak_versions_ctr(ndr, "versions", &r->versions);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_response(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_response *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->alloc_hint));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->context_id));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->cancel_count));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->stub_and_verifier));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_response(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_response *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->alloc_hint));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->context_id));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->cancel_count));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->stub_and_verifier));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_response(struct ndr_print *ndr, const char *name, const struct dcerpc_response *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_response");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "alloc_hint", r->alloc_hint);
+       ndr_print_uint16(ndr, "context_id", r->context_id);
+       ndr_print_uint8(ndr, "cancel_count", r->cancel_count);
+       ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+       ndr_print_DATA_BLOB(ndr, "stub_and_verifier", r->stub_and_verifier);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_fault(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_fault *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->alloc_hint));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->context_id));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->cancel_count));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->status));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_fault(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_fault *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->alloc_hint));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->context_id));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->cancel_count));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->status));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_fault(struct ndr_print *ndr, const char *name, const struct dcerpc_fault *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_fault");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "alloc_hint", r->alloc_hint);
+       ndr_print_uint16(ndr, "context_id", r->context_id);
+       ndr_print_uint8(ndr, "cancel_count", r->cancel_count);
+       ndr_print_uint32(ndr, "status", r->status);
+       ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_AuthType(struct ndr_push *ndr, int ndr_flags, enum dcerpc_AuthType r)
+{
+       NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_AuthType(struct ndr_pull *ndr, int ndr_flags, enum dcerpc_AuthType *r)
+{
+       uint8_t v;
+       NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_AuthType(struct ndr_print *ndr, const char *name, enum dcerpc_AuthType r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case DCERPC_AUTH_TYPE_NONE: val = "DCERPC_AUTH_TYPE_NONE"; break;
+               case DCERPC_AUTH_TYPE_KRB5_1: val = "DCERPC_AUTH_TYPE_KRB5_1"; break;
+               case DCERPC_AUTH_TYPE_SPNEGO: val = "DCERPC_AUTH_TYPE_SPNEGO"; break;
+               case DCERPC_AUTH_TYPE_NTLMSSP: val = "DCERPC_AUTH_TYPE_NTLMSSP"; break;
+               case DCERPC_AUTH_TYPE_KRB5: val = "DCERPC_AUTH_TYPE_KRB5"; break;
+               case DCERPC_AUTH_TYPE_DPA: val = "DCERPC_AUTH_TYPE_DPA"; break;
+               case DCERPC_AUTH_TYPE_MSN: val = "DCERPC_AUTH_TYPE_MSN"; break;
+               case DCERPC_AUTH_TYPE_DIGEST: val = "DCERPC_AUTH_TYPE_DIGEST"; break;
+               case DCERPC_AUTH_TYPE_SCHANNEL: val = "DCERPC_AUTH_TYPE_SCHANNEL"; break;
+               case DCERPC_AUTH_TYPE_MSMQ: val = "DCERPC_AUTH_TYPE_MSMQ"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_dcerpc_AuthLevel(struct ndr_push *ndr, int ndr_flags, enum dcerpc_AuthLevel r)
+{
+       NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_AuthLevel(struct ndr_pull *ndr, int ndr_flags, enum dcerpc_AuthLevel *r)
+{
+       uint8_t v;
+       NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_AuthLevel(struct ndr_print *ndr, const char *name, enum dcerpc_AuthLevel r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case DCERPC_AUTH_LEVEL_NONE: val = "DCERPC_AUTH_LEVEL_NONE"; break;
+               case DCERPC_AUTH_LEVEL_CONNECT: val = "DCERPC_AUTH_LEVEL_CONNECT"; break;
+               case DCERPC_AUTH_LEVEL_CALL: val = "DCERPC_AUTH_LEVEL_CALL"; break;
+               case DCERPC_AUTH_LEVEL_PACKET: val = "DCERPC_AUTH_LEVEL_PACKET"; break;
+               case DCERPC_AUTH_LEVEL_INTEGRITY: val = "DCERPC_AUTH_LEVEL_INTEGRITY"; break;
+               case DCERPC_AUTH_LEVEL_PRIVACY: val = "DCERPC_AUTH_LEVEL_PRIVACY"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_auth(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_auth *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_dcerpc_AuthType(ndr, NDR_SCALARS, r->auth_type));
+               NDR_CHECK(ndr_push_dcerpc_AuthLevel(ndr, NDR_SCALARS, r->auth_level));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->auth_pad_length));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->auth_reserved));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->auth_context_id));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->credentials));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_auth(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_auth *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_dcerpc_AuthType(ndr, NDR_SCALARS, &r->auth_type));
+               NDR_CHECK(ndr_pull_dcerpc_AuthLevel(ndr, NDR_SCALARS, &r->auth_level));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->auth_pad_length));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->auth_reserved));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->auth_context_id));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->credentials));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_auth(struct ndr_print *ndr, const char *name, const struct dcerpc_auth *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_auth");
+       ndr->depth++;
+       ndr_print_dcerpc_AuthType(ndr, "auth_type", r->auth_type);
+       ndr_print_dcerpc_AuthLevel(ndr, "auth_level", r->auth_level);
+       ndr_print_uint8(ndr, "auth_pad_length", r->auth_pad_length);
+       ndr_print_uint8(ndr, "auth_reserved", r->auth_reserved);
+       ndr_print_uint32(ndr, "auth_context_id", r->auth_context_id);
+       ndr_print_DATA_BLOB(ndr, "credentials", r->credentials);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_auth3(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_auth3 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->_pad));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->auth_info));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_auth3(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_auth3 *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_pad));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->auth_info));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_auth3(struct ndr_print *ndr, const char *name, const struct dcerpc_auth3 *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_auth3");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "_pad", r->_pad);
+       ndr_print_DATA_BLOB(ndr, "auth_info", r->auth_info);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_orphaned(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_orphaned *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->_pad));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->auth_info));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_orphaned(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_orphaned *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_pad));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->auth_info));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_orphaned(struct ndr_print *ndr, const char *name, const struct dcerpc_orphaned *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_orphaned");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "_pad", r->_pad);
+       ndr_print_DATA_BLOB(ndr, "auth_info", r->auth_info);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_co_cancel(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_co_cancel *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->_pad));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->auth_info));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_co_cancel(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_co_cancel *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_pad));
+               {
+                       uint32_t _flags_save_DATA_BLOB = ndr->flags;
+                       ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+                       NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->auth_info));
+                       ndr->flags = _flags_save_DATA_BLOB;
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_co_cancel(struct ndr_print *ndr, const char *name, const struct dcerpc_co_cancel *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_co_cancel");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "_pad", r->_pad);
+       ndr_print_DATA_BLOB(ndr, "auth_info", r->auth_info);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_cl_cancel(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_cl_cancel *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->id));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_cl_cancel(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_cl_cancel *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->version));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->id));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_cl_cancel(struct ndr_print *ndr, const char *name, const struct dcerpc_cl_cancel *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_cl_cancel");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "version", r->version);
+       ndr_print_uint32(ndr, "id", r->id);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_cancel_ack(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_cancel_ack *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->id));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->server_is_accepting));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_cancel_ack(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_cancel_ack *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->version));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->id));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->server_is_accepting));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_cancel_ack(struct ndr_print *ndr, const char *name, const struct dcerpc_cancel_ack *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_cancel_ack");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "version", r->version);
+       ndr_print_uint32(ndr, "id", r->id);
+       ndr_print_uint32(ndr, "server_is_accepting", r->server_is_accepting);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_fack(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_fack *r)
+{
+       uint32_t cntr_selack_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->_pad1));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->window_size));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->max_tdsu));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->max_frag_size));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->serial_no));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->selack_size));
+               for (cntr_selack_0 = 0; cntr_selack_0 < r->selack_size; cntr_selack_0++) {
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->selack[cntr_selack_0]));
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_fack(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_fack *r)
+{
+       uint32_t cntr_selack_0;
+       TALLOC_CTX *_mem_save_selack_0;
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->version));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->_pad1));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->window_size));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->max_tdsu));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->max_frag_size));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->serial_no));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->selack_size));
+               NDR_PULL_ALLOC_N(ndr, r->selack, r->selack_size);
+               _mem_save_selack_0 = NDR_PULL_GET_MEM_CTX(ndr);
+               NDR_PULL_SET_MEM_CTX(ndr, r->selack, 0);
+               for (cntr_selack_0 = 0; cntr_selack_0 < r->selack_size; cntr_selack_0++) {
+                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->selack[cntr_selack_0]));
+               }
+               NDR_PULL_SET_MEM_CTX(ndr, _mem_save_selack_0, 0);
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_fack(struct ndr_print *ndr, const char *name, const struct dcerpc_fack *r)
+{
+       uint32_t cntr_selack_0;
+       ndr_print_struct(ndr, name, "dcerpc_fack");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "version", r->version);
+       ndr_print_uint8(ndr, "_pad1", r->_pad1);
+       ndr_print_uint16(ndr, "window_size", r->window_size);
+       ndr_print_uint32(ndr, "max_tdsu", r->max_tdsu);
+       ndr_print_uint32(ndr, "max_frag_size", r->max_frag_size);
+       ndr_print_uint16(ndr, "serial_no", r->serial_no);
+       ndr_print_uint16(ndr, "selack_size", r->selack_size);
+       ndr->print(ndr, "%s: ARRAY(%d)", "selack", (int)r->selack_size);
+       ndr->depth++;
+       for (cntr_selack_0=0;cntr_selack_0<r->selack_size;cntr_selack_0++) {
+               char *idx_0=NULL;
+               if (asprintf(&idx_0, "[%d]", cntr_selack_0) != -1) {
+                       ndr_print_uint32(ndr, "selack", r->selack[cntr_selack_0]);
+                       free(idx_0);
+               }
+       }
+       ndr->depth--;
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_ack(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_ack *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 1));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_ack(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_ack *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 1));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_ack(struct ndr_print *ndr, const char *name, const struct dcerpc_ack *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_ack");
+       ndr->depth++;
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_ping(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_ping *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 1));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_ping(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_ping *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 1));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_ping(struct ndr_print *ndr, const char *name, const struct dcerpc_ping *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_ping");
+       ndr->depth++;
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_shutdown(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_shutdown *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 1));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_shutdown(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_shutdown *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 1));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_shutdown(struct ndr_print *ndr, const char *name, const struct dcerpc_shutdown *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_shutdown");
+       ndr->depth++;
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dcerpc_working(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_working *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 1));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dcerpc_working(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_working *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 1));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_working(struct ndr_print *ndr, const char *name, const struct dcerpc_working *r)
+{
+       ndr_print_struct(ndr, name, "dcerpc_working");
+       ndr->depth++;
+       ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_dcerpc_pkt_type(struct ndr_push *ndr, int ndr_flags, enum dcerpc_pkt_type r)
+{
+       NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_pkt_type(struct ndr_pull *ndr, int ndr_flags, enum dcerpc_pkt_type *r)
+{
+       uint8_t v;
+       NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
+       *r = v;
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_pkt_type(struct ndr_print *ndr, const char *name, enum dcerpc_pkt_type r)
+{
+       const char *val = NULL;
+
+       switch (r) {
+               case DCERPC_PKT_REQUEST: val = "DCERPC_PKT_REQUEST"; break;
+               case DCERPC_PKT_PING: val = "DCERPC_PKT_PING"; break;
+               case DCERPC_PKT_RESPONSE: val = "DCERPC_PKT_RESPONSE"; break;
+               case DCERPC_PKT_FAULT: val = "DCERPC_PKT_FAULT"; break;
+               case DCERPC_PKT_WORKING: val = "DCERPC_PKT_WORKING"; break;
+               case DCERPC_PKT_NOCALL: val = "DCERPC_PKT_NOCALL"; break;
+               case DCERPC_PKT_REJECT: val = "DCERPC_PKT_REJECT"; break;
+               case DCERPC_PKT_ACK: val = "DCERPC_PKT_ACK"; break;
+               case DCERPC_PKT_CL_CANCEL: val = "DCERPC_PKT_CL_CANCEL"; break;
+               case DCERPC_PKT_FACK: val = "DCERPC_PKT_FACK"; break;
+               case DCERPC_PKT_CANCEL_ACK: val = "DCERPC_PKT_CANCEL_ACK"; break;
+               case DCERPC_PKT_BIND: val = "DCERPC_PKT_BIND"; break;
+               case DCERPC_PKT_BIND_ACK: val = "DCERPC_PKT_BIND_ACK"; break;
+               case DCERPC_PKT_BIND_NAK: val = "DCERPC_PKT_BIND_NAK"; break;
+               case DCERPC_PKT_ALTER: val = "DCERPC_PKT_ALTER"; break;
+               case DCERPC_PKT_ALTER_RESP: val = "DCERPC_PKT_ALTER_RESP"; break;
+               case DCERPC_PKT_AUTH3: val = "DCERPC_PKT_AUTH3"; break;
+               case DCERPC_PKT_SHUTDOWN: val = "DCERPC_PKT_SHUTDOWN"; break;
+               case DCERPC_PKT_CO_CANCEL: val = "DCERPC_PKT_CO_CANCEL"; break;
+               case DCERPC_PKT_ORPHANED: val = "DCERPC_PKT_ORPHANED"; break;
+       }
+       ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_dcerpc_payload(struct ndr_push *ndr, int ndr_flags, const union dcerpc_payload *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case DCERPC_PKT_REQUEST: {
+                               NDR_CHECK(ndr_push_dcerpc_request(ndr, NDR_SCALARS, &r->request));
+                       break; }
+
+                       case DCERPC_PKT_PING: {
+                               NDR_CHECK(ndr_push_dcerpc_ping(ndr, NDR_SCALARS, &r->ping));
+                       break; }
+
+                       case DCERPC_PKT_RESPONSE: {
+                               NDR_CHECK(ndr_push_dcerpc_response(ndr, NDR_SCALARS, &r->response));
+                       break; }
+
+                       case DCERPC_PKT_FAULT: {
+                               NDR_CHECK(ndr_push_dcerpc_fault(ndr, NDR_SCALARS, &r->fault));
+                       break; }
+
+                       case DCERPC_PKT_WORKING: {
+                               NDR_CHECK(ndr_push_dcerpc_working(ndr, NDR_SCALARS, &r->working));
+                       break; }
+
+                       case DCERPC_PKT_NOCALL: {
+                               NDR_CHECK(ndr_push_dcerpc_fack(ndr, NDR_SCALARS, &r->nocall));
+                       break; }
+
+                       case DCERPC_PKT_REJECT: {
+                               NDR_CHECK(ndr_push_dcerpc_fault(ndr, NDR_SCALARS, &r->reject));
+                       break; }
+
+                       case DCERPC_PKT_ACK: {
+                               NDR_CHECK(ndr_push_dcerpc_ack(ndr, NDR_SCALARS, &r->ack));
+                       break; }
+
+                       case DCERPC_PKT_CL_CANCEL: {
+                               NDR_CHECK(ndr_push_dcerpc_cl_cancel(ndr, NDR_SCALARS, &r->cl_cancel));
+                       break; }
+
+                       case DCERPC_PKT_FACK: {
+                               NDR_CHECK(ndr_push_dcerpc_fack(ndr, NDR_SCALARS, &r->fack));
+                       break; }
+
+                       case DCERPC_PKT_CANCEL_ACK: {
+                               NDR_CHECK(ndr_push_dcerpc_cancel_ack(ndr, NDR_SCALARS, &r->cancel_ack));
+                       break; }
+
+                       case DCERPC_PKT_BIND: {
+                               NDR_CHECK(ndr_push_dcerpc_bind(ndr, NDR_SCALARS, &r->bind));
+                       break; }
+
+                       case DCERPC_PKT_BIND_ACK: {
+                               NDR_CHECK(ndr_push_dcerpc_bind_ack(ndr, NDR_SCALARS, &r->bind_ack));
+                       break; }
+
+                       case DCERPC_PKT_BIND_NAK: {
+                               NDR_CHECK(ndr_push_dcerpc_bind_nak(ndr, NDR_SCALARS, &r->bind_nak));
+                       break; }
+
+                       case DCERPC_PKT_ALTER: {
+                               NDR_CHECK(ndr_push_dcerpc_bind(ndr, NDR_SCALARS, &r->alter));
+                       break; }
+
+                       case DCERPC_PKT_ALTER_RESP: {
+                               NDR_CHECK(ndr_push_dcerpc_bind_ack(ndr, NDR_SCALARS, &r->alter_resp));
+                       break; }
+
+                       case DCERPC_PKT_SHUTDOWN: {
+                               NDR_CHECK(ndr_push_dcerpc_shutdown(ndr, NDR_SCALARS, &r->shutdown));
+                       break; }
+
+                       case DCERPC_PKT_CO_CANCEL: {
+                               NDR_CHECK(ndr_push_dcerpc_co_cancel(ndr, NDR_SCALARS, &r->co_cancel));
+                       break; }
+
+                       case DCERPC_PKT_ORPHANED: {
+                               NDR_CHECK(ndr_push_dcerpc_orphaned(ndr, NDR_SCALARS, &r->orphaned));
+                       break; }
+
+                       case DCERPC_PKT_AUTH3: {
+                               NDR_CHECK(ndr_push_dcerpc_auth3(ndr, NDR_SCALARS, &r->auth3));
+                       break; }
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               int level = ndr_push_get_switch_value(ndr, r);
+               switch (level) {
+                       case DCERPC_PKT_REQUEST:
+                       break;
+
+                       case DCERPC_PKT_PING:
+                       break;
+
+                       case DCERPC_PKT_RESPONSE:
+                       break;
+
+                       case DCERPC_PKT_FAULT:
+                       break;
+
+                       case DCERPC_PKT_WORKING:
+                       break;
+
+                       case DCERPC_PKT_NOCALL:
+                       break;
+
+                       case DCERPC_PKT_REJECT:
+                       break;
+
+                       case DCERPC_PKT_ACK:
+                       break;
+
+                       case DCERPC_PKT_CL_CANCEL:
+                       break;
+
+                       case DCERPC_PKT_FACK:
+                       break;
+
+                       case DCERPC_PKT_CANCEL_ACK:
+                       break;
+
+                       case DCERPC_PKT_BIND:
+                       break;
+
+                       case DCERPC_PKT_BIND_ACK:
+                       break;
+
+                       case DCERPC_PKT_BIND_NAK:
+                               NDR_CHECK(ndr_push_dcerpc_bind_nak(ndr, NDR_BUFFERS, &r->bind_nak));
+                       break;
+
+                       case DCERPC_PKT_ALTER:
+                       break;
+
+                       case DCERPC_PKT_ALTER_RESP:
+                       break;
+
+                       case DCERPC_PKT_SHUTDOWN:
+                       break;
+
+                       case DCERPC_PKT_CO_CANCEL:
+                       break;
+
+                       case DCERPC_PKT_ORPHANED:
+                       break;
+
+                       case DCERPC_PKT_AUTH3:
+                       break;
+
+                       default:
+                               return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_dcerpc_payload(struct ndr_pull *ndr, int ndr_flags, union dcerpc_payload *r)
+{
+       int level;
+       level = ndr_pull_get_switch_value(ndr, r);
+       if (ndr_flags & NDR_SCALARS) {
+               switch (level) {
+                       case DCERPC_PKT_REQUEST: {
+                               NDR_CHECK(ndr_pull_dcerpc_request(ndr, NDR_SCALARS, &r->request));
+                       break; }
+
+                       case DCERPC_PKT_PING: {
+                               NDR_CHECK(ndr_pull_dcerpc_ping(ndr, NDR_SCALARS, &r->ping));
+                       break; }
+
+                       case DCERPC_PKT_RESPONSE: {
+                               NDR_CHECK(ndr_pull_dcerpc_response(ndr, NDR_SCALARS, &r->response));
+                       break; }
+
+                       case DCERPC_PKT_FAULT: {
+                               NDR_CHECK(ndr_pull_dcerpc_fault(ndr, NDR_SCALARS, &r->fault));
+                       break; }
+
+                       case DCERPC_PKT_WORKING: {
+                               NDR_CHECK(ndr_pull_dcerpc_working(ndr, NDR_SCALARS, &r->working));
+                       break; }
+
+                       case DCERPC_PKT_NOCALL: {
+                               NDR_CHECK(ndr_pull_dcerpc_fack(ndr, NDR_SCALARS, &r->nocall));
+                       break; }
+
+                       case DCERPC_PKT_REJECT: {
+                               NDR_CHECK(ndr_pull_dcerpc_fault(ndr, NDR_SCALARS, &r->reject));
+                       break; }
+
+                       case DCERPC_PKT_ACK: {
+                               NDR_CHECK(ndr_pull_dcerpc_ack(ndr, NDR_SCALARS, &r->ack));
+                       break; }
+
+                       case DCERPC_PKT_CL_CANCEL: {
+                               NDR_CHECK(ndr_pull_dcerpc_cl_cancel(ndr, NDR_SCALARS, &r->cl_cancel));
+                       break; }
+
+                       case DCERPC_PKT_FACK: {
+                               NDR_CHECK(ndr_pull_dcerpc_fack(ndr, NDR_SCALARS, &r->fack));
+                       break; }
+
+                       case DCERPC_PKT_CANCEL_ACK: {
+                               NDR_CHECK(ndr_pull_dcerpc_cancel_ack(ndr, NDR_SCALARS, &r->cancel_ack));
+                       break; }
+
+                       case DCERPC_PKT_BIND: {
+                               NDR_CHECK(ndr_pull_dcerpc_bind(ndr, NDR_SCALARS, &r->bind));
+                       break; }
+
+                       case DCERPC_PKT_BIND_ACK: {
+                               NDR_CHECK(ndr_pull_dcerpc_bind_ack(ndr, NDR_SCALARS, &r->bind_ack));
+                       break; }
+
+                       case DCERPC_PKT_BIND_NAK: {
+                               NDR_CHECK(ndr_pull_dcerpc_bind_nak(ndr, NDR_SCALARS, &r->bind_nak));
+                       break; }
+
+                       case DCERPC_PKT_ALTER: {
+                               NDR_CHECK(ndr_pull_dcerpc_bind(ndr, NDR_SCALARS, &r->alter));
+                       break; }
+
+                       case DCERPC_PKT_ALTER_RESP: {
+                               NDR_CHECK(ndr_pull_dcerpc_bind_ack(ndr, NDR_SCALARS, &r->alter_resp));
+                       break; }
+
+                       case DCERPC_PKT_SHUTDOWN: {
+                               NDR_CHECK(ndr_pull_dcerpc_shutdown(ndr, NDR_SCALARS, &r->shutdown));
+                       break; }
+
+                       case DCERPC_PKT_CO_CANCEL: {
+                               NDR_CHECK(ndr_pull_dcerpc_co_cancel(ndr, NDR_SCALARS, &r->co_cancel));
+                       break; }
+
+                       case DCERPC_PKT_ORPHANED: {
+                               NDR_CHECK(ndr_pull_dcerpc_orphaned(ndr, NDR_SCALARS, &r->orphaned));
+                       break; }
+
+                       case DCERPC_PKT_AUTH3: {
+                               NDR_CHECK(ndr_pull_dcerpc_auth3(ndr, NDR_SCALARS, &r->auth3));
+                       break; }
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               switch (level) {
+                       case DCERPC_PKT_REQUEST:
+                       break;
+
+                       case DCERPC_PKT_PING:
+                       break;
+
+                       case DCERPC_PKT_RESPONSE:
+                       break;
+
+                       case DCERPC_PKT_FAULT:
+                       break;
+
+                       case DCERPC_PKT_WORKING:
+                       break;
+
+                       case DCERPC_PKT_NOCALL:
+                       break;
+
+                       case DCERPC_PKT_REJECT:
+                       break;
+
+                       case DCERPC_PKT_ACK:
+                       break;
+
+                       case DCERPC_PKT_CL_CANCEL:
+                       break;
+
+                       case DCERPC_PKT_FACK:
+                       break;
+
+                       case DCERPC_PKT_CANCEL_ACK:
+                       break;
+
+                       case DCERPC_PKT_BIND:
+                       break;
+
+                       case DCERPC_PKT_BIND_ACK:
+                       break;
+
+                       case DCERPC_PKT_BIND_NAK:
+                               NDR_CHECK(ndr_pull_dcerpc_bind_nak(ndr, NDR_BUFFERS, &r->bind_nak));
+                       break;
+
+                       case DCERPC_PKT_ALTER:
+                       break;
+
+                       case DCERPC_PKT_ALTER_RESP:
+                       break;
+
+                       case DCERPC_PKT_SHUTDOWN:
+                       break;
+
+                       case DCERPC_PKT_CO_CANCEL:
+                       break;
+
+                       case DCERPC_PKT_ORPHANED:
+                       break;
+
+                       case DCERPC_PKT_AUTH3:
+                       break;
+
+                       default:
+                               return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+               }
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_dcerpc_payload(struct ndr_print *ndr, const char *name, const union dcerpc_payload *r)
+{
+       int level;
+       level = ndr_print_get_switch_value(ndr, r);
+       ndr_print_union(ndr, name, level, "dcerpc_payload");
+       switch (level) {
+               case DCERPC_PKT_REQUEST:
+                       ndr_print_dcerpc_request(ndr, "request", &r->request);
+               break;
+
+               case DCERPC_PKT_PING:
+                       ndr_print_dcerpc_ping(ndr, "ping", &r->ping);
+               break;
+
+               case DCERPC_PKT_RESPONSE:
+                       ndr_print_dcerpc_response(ndr, "response", &r->response);
+               break;
+
+               case DCERPC_PKT_FAULT:
+                       ndr_print_dcerpc_fault(ndr, "fault", &r->fault);
+               break;
+
+               case DCERPC_PKT_WORKING:
+                       ndr_print_dcerpc_working(ndr, "working", &r->working);
+               break;
+
+               case DCERPC_PKT_NOCALL:
+                       ndr_print_dcerpc_fack(ndr, "nocall", &r->nocall);
+               break;
+
+               case DCERPC_PKT_REJECT:
+                       ndr_print_dcerpc_fault(ndr, "reject", &r->reject);
+               break;
+
+               case DCERPC_PKT_ACK:
+                       ndr_print_dcerpc_ack(ndr, "ack", &r->ack);
+               break;
+
+               case DCERPC_PKT_CL_CANCEL:
+                       ndr_print_dcerpc_cl_cancel(ndr, "cl_cancel", &r->cl_cancel);
+               break;
+
+               case DCERPC_PKT_FACK:
+                       ndr_print_dcerpc_fack(ndr, "fack", &r->fack);
+               break;
+
+               case DCERPC_PKT_CANCEL_ACK:
+                       ndr_print_dcerpc_cancel_ack(ndr, "cancel_ack", &r->cancel_ack);
+               break;
+
+               case DCERPC_PKT_BIND:
+                       ndr_print_dcerpc_bind(ndr, "bind", &r->bind);
+               break;
+
+               case DCERPC_PKT_BIND_ACK:
+                       ndr_print_dcerpc_bind_ack(ndr, "bind_ack", &r->bind_ack);
+               break;
+
+               case DCERPC_PKT_BIND_NAK:
+                       ndr_print_dcerpc_bind_nak(ndr, "bind_nak", &r->bind_nak);
+               break;
+
+               case DCERPC_PKT_ALTER:
+                       ndr_print_dcerpc_bind(ndr, "alter", &r->alter);
+               break;
+
+               case DCERPC_PKT_ALTER_RESP:
+                       ndr_print_dcerpc_bind_ack(ndr, "alter_resp", &r->alter_resp);
+               break;
+
+               case DCERPC_PKT_SHUTDOWN:
+                       ndr_print_dcerpc_shutdown(ndr, "shutdown", &r->shutdown);
+               break;
+
+               case DCERPC_PKT_CO_CANCEL:
+                       ndr_print_dcerpc_co_cancel(ndr, "co_cancel", &r->co_cancel);
+               break;
+
+               case DCERPC_PKT_ORPHANED:
+                       ndr_print_dcerpc_orphaned(ndr, "orphaned", &r->orphaned);
+               break;
+
+               case DCERPC_PKT_AUTH3:
+                       ndr_print_dcerpc_auth3(ndr, "auth3", &r->auth3);
+               break;
+
+               default:
+                       ndr_print_bad_level(ndr, name, level);
+       }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_ncacn_packet(struct ndr_push *ndr, int ndr_flags, const struct ncacn_packet *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->rpc_vers));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->rpc_vers_minor));
+               NDR_CHECK(ndr_push_dcerpc_pkt_type(ndr, NDR_SCALARS, r->ptype));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pfc_flags));
+               NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->drep, 4));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->frag_length));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->auth_length));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->call_id));
+               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->u, r->ptype));
+               NDR_CHECK(ndr_push_dcerpc_payload(ndr, NDR_SCALARS, &r->u));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_dcerpc_payload(ndr, NDR_BUFFERS, &r->u));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_ncacn_packet(struct ndr_pull *ndr, int ndr_flags, struct ncacn_packet *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->rpc_vers));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->rpc_vers_minor));
+               NDR_CHECK(ndr_pull_dcerpc_pkt_type(ndr, NDR_SCALARS, &r->ptype));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pfc_flags));
+               NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->drep, 4));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->frag_length));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->auth_length));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->call_id));
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->u, r->ptype));
+               NDR_CHECK(ndr_pull_dcerpc_payload(ndr, NDR_SCALARS, &r->u));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_dcerpc_payload(ndr, NDR_BUFFERS, &r->u));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ncacn_packet(struct ndr_print *ndr, const char *name, const struct ncacn_packet *r)
+{
+       ndr_print_struct(ndr, name, "ncacn_packet");
+       ndr->depth++;
+       ndr_print_uint8(ndr, "rpc_vers", r->rpc_vers);
+       ndr_print_uint8(ndr, "rpc_vers_minor", r->rpc_vers_minor);
+       ndr_print_dcerpc_pkt_type(ndr, "ptype", r->ptype);
+       ndr_print_uint8(ndr, "pfc_flags", r->pfc_flags);
+       ndr_print_array_uint8(ndr, "drep", r->drep, 4);
+       ndr_print_uint16(ndr, "frag_length", r->frag_length);
+       ndr_print_uint16(ndr, "auth_length", r->auth_length);
+       ndr_print_uint32(ndr, "call_id", r->call_id);
+       ndr_print_set_switch_value(ndr, &r->u, r->ptype);
+       ndr_print_dcerpc_payload(ndr, "u", &r->u);
+       ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_ncadg_packet(struct ndr_push *ndr, int ndr_flags, const struct ncadg_packet *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_push_align(ndr, 4));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->rpc_vers));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->ptype));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pfc_flags));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->ncadg_flags));
+               NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->drep, 3));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->serial_high));
+               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->object));
+               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->iface));
+               NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->activity));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->server_boot));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->iface_version));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->seq_num));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->opnum));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->ihint));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->ahint));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->len));
+               NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->fragnum));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->auth_proto));
+               NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->serial_low));
+               NDR_CHECK(ndr_push_set_switch_value(ndr, &r->u, r->ptype));
+               NDR_CHECK(ndr_push_dcerpc_payload(ndr, NDR_SCALARS, &r->u));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_push_dcerpc_payload(ndr, NDR_BUFFERS, &r->u));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_ncadg_packet(struct ndr_pull *ndr, int ndr_flags, struct ncadg_packet *r)
+{
+       if (ndr_flags & NDR_SCALARS) {
+               NDR_CHECK(ndr_pull_align(ndr, 4));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->rpc_vers));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->ptype));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pfc_flags));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->ncadg_flags));
+               NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->drep, 3));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->serial_high));
+               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->object));
+               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->iface));
+               NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->activity));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->server_boot));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->iface_version));
+               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->seq_num));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->opnum));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->ihint));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->ahint));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->len));
+               NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->fragnum));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->auth_proto));
+               NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->serial_low));
+               NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->u, r->ptype));
+               NDR_CHECK(ndr_pull_dcerpc_payload(ndr, NDR_SCALARS, &r->u));
+       }
+       if (ndr_flags & NDR_BUFFERS) {
+               NDR_CHECK(ndr_pull_dcerpc_payload(ndr, NDR_BUFFERS, &r->u));
+       }
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ncadg_packet(struct ndr_print *ndr, const char *name, const struct ncadg_packet *r)
+{
+       ndr_print_struct(ndr, name, "ncadg_packet");
+       ndr->depth++;
+       ndr_print_uint8(ndr, "rpc_vers", r->rpc_vers);
+       ndr_print_uint8(ndr, "ptype", r->ptype);
+       ndr_print_uint8(ndr, "pfc_flags", r->pfc_flags);
+       ndr_print_uint8(ndr, "ncadg_flags", r->ncadg_flags);
+       ndr_print_array_uint8(ndr, "drep", r->drep, 3);
+       ndr_print_uint8(ndr, "serial_high", r->serial_high);
+       ndr_print_GUID(ndr, "object", &r->object);
+       ndr_print_GUID(ndr, "iface", &r->iface);
+       ndr_print_GUID(ndr, "activity", &r->activity);
+       ndr_print_uint32(ndr, "server_boot", r->server_boot);
+       ndr_print_uint32(ndr, "iface_version", r->iface_version);
+       ndr_print_uint32(ndr, "seq_num", r->seq_num);
+       ndr_print_uint16(ndr, "opnum", r->opnum);
+       ndr_print_uint16(ndr, "ihint", r->ihint);
+       ndr_print_uint16(ndr, "ahint", r->ahint);
+       ndr_print_uint16(ndr, "len", r->len);
+       ndr_print_uint16(ndr, "fragnum", r->fragnum);
+       ndr_print_uint8(ndr, "auth_proto", r->auth_proto);
+       ndr_print_uint8(ndr, "serial_low", r->serial_low);
+       ndr_print_set_switch_value(ndr, &r->u, r->ptype);
+       ndr_print_dcerpc_payload(ndr, "u", &r->u);
+       ndr->depth--;
+}
+
diff --git a/librpc/gen_ndr/ndr_dcerpc.h b/librpc/gen_ndr/ndr_dcerpc.h
new file mode 100644 (file)
index 0000000..9baa089
--- /dev/null
@@ -0,0 +1,65 @@
+/* header auto-generated by pidl */
+
+#include "librpc/ndr/libndr.h"
+#include "../librpc/gen_ndr/dcerpc.h"
+
+#ifndef _HEADER_NDR_dcerpc
+#define _HEADER_NDR_dcerpc
+
+#define NDR_DCERPC_CALL_COUNT (0)
+void ndr_print_dcerpc_ctx_list(struct ndr_print *ndr, const char *name, const struct dcerpc_ctx_list *r);
+void ndr_print_dcerpc_bind(struct ndr_print *ndr, const char *name, const struct dcerpc_bind *r);
+void ndr_print_dcerpc_empty(struct ndr_print *ndr, const char *name, const struct dcerpc_empty *r);
+void ndr_print_dcerpc_object(struct ndr_print *ndr, const char *name, const union dcerpc_object *r);
+void ndr_print_dcerpc_request(struct ndr_print *ndr, const char *name, const struct dcerpc_request *r);
+void ndr_print_dcerpc_ack_ctx(struct ndr_print *ndr, const char *name, const struct dcerpc_ack_ctx *r);
+void ndr_print_dcerpc_bind_ack(struct ndr_print *ndr, const char *name, const struct dcerpc_bind_ack *r);
+void ndr_print_dcerpc_bind_nak_versions(struct ndr_print *ndr, const char *name, const struct dcerpc_bind_nak_versions *r);
+void ndr_print_dcerpc_bind_nak_versions_ctr(struct ndr_print *ndr, const char *name, const union dcerpc_bind_nak_versions_ctr *r);
+void ndr_print_dcerpc_bind_nak(struct ndr_print *ndr, const char *name, const struct dcerpc_bind_nak *r);
+void ndr_print_dcerpc_response(struct ndr_print *ndr, const char *name, const struct dcerpc_response *r);
+void ndr_print_dcerpc_fault(struct ndr_print *ndr, const char *name, const struct dcerpc_fault *r);
+void ndr_print_dcerpc_AuthType(struct ndr_print *ndr, const char *name, enum dcerpc_AuthType r);
+void ndr_print_dcerpc_AuthLevel(struct ndr_print *ndr, const char *name, enum dcerpc_AuthLevel r);
+enum ndr_err_code ndr_push_dcerpc_auth(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_auth *r);
+enum ndr_err_code ndr_pull_dcerpc_auth(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_auth *r);
+void ndr_print_dcerpc_auth(struct ndr_print *ndr, const char *name, const struct dcerpc_auth *r);
+enum ndr_err_code ndr_push_dcerpc_auth3(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_auth3 *r);
+enum ndr_err_code ndr_pull_dcerpc_auth3(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_auth3 *r);
+void ndr_print_dcerpc_auth3(struct ndr_print *ndr, const char *name, const struct dcerpc_auth3 *r);
+enum ndr_err_code ndr_push_dcerpc_orphaned(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_orphaned *r);
+enum ndr_err_code ndr_pull_dcerpc_orphaned(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_orphaned *r);
+void ndr_print_dcerpc_orphaned(struct ndr_print *ndr, const char *name, const struct dcerpc_orphaned *r);
+enum ndr_err_code ndr_push_dcerpc_co_cancel(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_co_cancel *r);
+enum ndr_err_code ndr_pull_dcerpc_co_cancel(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_co_cancel *r);
+void ndr_print_dcerpc_co_cancel(struct ndr_print *ndr, const char *name, const struct dcerpc_co_cancel *r);
+enum ndr_err_code ndr_push_dcerpc_cl_cancel(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_cl_cancel *r);
+enum ndr_err_code ndr_pull_dcerpc_cl_cancel(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_cl_cancel *r);
+void ndr_print_dcerpc_cl_cancel(struct ndr_print *ndr, const char *name, const struct dcerpc_cl_cancel *r);
+enum ndr_err_code ndr_push_dcerpc_cancel_ack(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_cancel_ack *r);
+enum ndr_err_code ndr_pull_dcerpc_cancel_ack(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_cancel_ack *r);
+void ndr_print_dcerpc_cancel_ack(struct ndr_print *ndr, const char *name, const struct dcerpc_cancel_ack *r);
+enum ndr_err_code ndr_push_dcerpc_fack(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_fack *r);
+enum ndr_err_code ndr_pull_dcerpc_fack(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_fack *r);
+void ndr_print_dcerpc_fack(struct ndr_print *ndr, const char *name, const struct dcerpc_fack *r);
+enum ndr_err_code ndr_push_dcerpc_ack(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_ack *r);
+enum ndr_err_code ndr_pull_dcerpc_ack(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_ack *r);
+void ndr_print_dcerpc_ack(struct ndr_print *ndr, const char *name, const struct dcerpc_ack *r);
+enum ndr_err_code ndr_push_dcerpc_ping(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_ping *r);
+enum ndr_err_code ndr_pull_dcerpc_ping(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_ping *r);
+void ndr_print_dcerpc_ping(struct ndr_print *ndr, const char *name, const struct dcerpc_ping *r);
+enum ndr_err_code ndr_push_dcerpc_shutdown(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_shutdown *r);
+enum ndr_err_code ndr_pull_dcerpc_shutdown(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_shutdown *r);
+void ndr_print_dcerpc_shutdown(struct ndr_print *ndr, const char *name, const struct dcerpc_shutdown *r);
+enum ndr_err_code ndr_push_dcerpc_working(struct ndr_push *ndr, int ndr_flags, const struct dcerpc_working *r);
+enum ndr_err_code ndr_pull_dcerpc_working(struct ndr_pull *ndr, int ndr_flags, struct dcerpc_working *r);
+void ndr_print_dcerpc_working(struct ndr_print *ndr, const char *name, const struct dcerpc_working *r);
+void ndr_print_dcerpc_pkt_type(struct ndr_print *ndr, const char *name, enum dcerpc_pkt_type r);
+void ndr_print_dcerpc_payload(struct ndr_print *ndr, const char *name, const union dcerpc_payload *r);
+enum ndr_err_code ndr_push_ncacn_packet(struct ndr_push *ndr, int ndr_flags, const struct ncacn_packet *r);
+enum ndr_err_code ndr_pull_ncacn_packet(struct ndr_pull *ndr, int ndr_flags, struct ncacn_packet *r);
+void ndr_print_ncacn_packet(struct ndr_print *ndr, const char *name, const struct ncacn_packet *r);
+enum ndr_err_code ndr_push_ncadg_packet(struct ndr_push *ndr, int ndr_flags, const struct ncadg_packet *r);
+enum ndr_err_code ndr_pull_ncadg_packet(struct ndr_pull *ndr, int ndr_flags, struct ncadg_packet *r);
+void ndr_print_ncadg_packet(struct ndr_print *ndr, const char *name, const struct ncadg_packet *r);
+#endif /* _HEADER_NDR_dcerpc */
similarity index 99%
rename from source4/librpc/idl/dcerpc.idl
rename to librpc/idl/dcerpc.idl
index 7c0abe6ab85bf459380ebb3a778e04a3972ce383..3ec416d5c6c41b845159449b0faf30eaa8b0471b 100644 (file)
@@ -33,7 +33,7 @@ interface dcerpc
 
        typedef struct {
        } dcerpc_empty;
-       
+
        typedef [nodiscriminant] union {
                [default] dcerpc_empty empty;
                [case(LIBNDR_FLAG_OBJECT_PRESENT)] GUID object;
@@ -75,7 +75,7 @@ interface dcerpc
                uint32 num_versions;
                uint32 versions[num_versions];
        } dcerpc_bind_nak_versions;
-       
+
        typedef [nodiscriminant] union {
                [case(DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED)] dcerpc_bind_nak_versions v;
                [default] ;
@@ -145,7 +145,7 @@ interface dcerpc
        const uint8 DCERPC_AUTH_LEVEL_DEFAULT   = DCERPC_AUTH_LEVEL_CONNECT;
 
        typedef [public] struct {
-               dcerpc_AuthType auth_type; 
+               dcerpc_AuthType auth_type;
                dcerpc_AuthLevel auth_level;
                uint8  auth_pad_length;
                uint8  auth_reserved;
@@ -176,7 +176,7 @@ interface dcerpc
        } dcerpc_cl_cancel;
 
        typedef [public] struct {
-               uint32 version; 
+               uint32 version;
                uint32 id;
                boolean32 server_is_accepting;
        } dcerpc_cancel_ack;
@@ -200,7 +200,7 @@ interface dcerpc
 
        typedef [public] struct {
        } dcerpc_shutdown;
-       
+
        typedef [public] struct {
        } dcerpc_working;
 
index e63605b8dfdbbf165303daf5434de121a7e78ccc..ef8058da79481de205a60db10c3b8edc651291cb 100644 (file)
@@ -1,7 +1,21 @@
 #!/usr/bin/perl
 # Bootstrap Samba and run a number of tests against it.
 # Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
-# Published under the GNU GPL, v3 or later.
+
+# 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/>.
+
+
 
 package SocketWrapper;
 
index 05e51da541206ad2c475de4be255fb9c8cc2dc65..19af636d0bacbaf71e21d4528c3f6024cf1857ba 100644 (file)
@@ -1,3 +1,19 @@
+# Simple Perl module for parsing the Subunit protocol
+# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
+#
+# 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/>.
+
 package Subunit;
 
 require Exporter;
index cee6c1e63a8f4609eaabd36b19923eb8420f5289..77ea26621b27b491111b1f8f42fad2b91b7f3327 100644 (file)
@@ -1,4 +1,19 @@
 #!/usr/bin/perl
+# Buildfarm output for selftest
+# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
+#
+# 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/>.
 
 package output::buildfarm;
 
index 1049527129c50f3296f9daa2be4bc5c3f218d574..e490765d06adee5ef53cf54ac0f3e43644a300fa 100644 (file)
@@ -1,5 +1,19 @@
 #!/usr/bin/perl
-
+# HTML output for selftest
+# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
+#
+# 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/>.
 package output::html;
 use Exporter;
 @ISA = qw(Exporter);
index 82a73ab932426c0b9ce194ddfd7037b2eee3869c..5312a9e27b3416463b47d7f9f057dd737293592f 100644 (file)
@@ -1,5 +1,19 @@
 #!/usr/bin/perl
-
+# Plain text output for selftest
+# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
+#
+# 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/>.
 package output::plain;
 use Exporter;
 @ISA = qw(Exporter);
index ef4c385d33fd0a53713af5af48fb7073830367e7..36535235413fbb627f5f71d4eb2e2d2cffea8926 100755 (executable)
@@ -2,7 +2,19 @@
 # Bootstrap Samba and run a number of tests against it.
 # Copyright (C) 2005-2008 Jelmer Vernooij <jelmer@samba.org>
 # Copyright (C) 2007-2009 Stefan Metzmacher <metze@samba.org>
-# Published under the GNU GPL, v3 or later.
+
+# 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/>.
 
 =pod
 
index e1bea16523b9031072176cd46820c011cb1ca838..0b176d601c1bc4b6f094a5c9c7b2a55e3fc93c26 100644 (file)
@@ -41,6 +41,9 @@ sub teardown_env($$)
        $self->stop_sig_term($smbdpid);
        $self->stop_sig_term($nmbdpid);
        $self->stop_sig_term($winbinddpid);
+
+       sleep(2);
+
        $self->stop_sig_kill($smbdpid);
        $self->stop_sig_kill($nmbdpid);
        $self->stop_sig_kill($winbinddpid);
@@ -123,9 +126,8 @@ sub setup_dc($$)
                                    $dc_options);
 
        $self->check_or_start($vars,
-                             ($ENV{NMBD_MAXTIME} or 2700),
-                             ($ENV{WINBINDD_MAXTIME} or 2700),
-                             ($ENV{SMBD_MAXTIME} or 2700));
+                             ($ENV{SMBD_MAXTIME} or 2700),
+                              "yes", "yes", "yes");
 
        $self->wait_for_start($vars);
 
@@ -142,6 +144,7 @@ sub setup_member($$$)
 
        my $member_options = "
        security = domain
+       server signing = on
 ";
        my $ret = $self->provision($prefix,
                                   "LOCALMEMBER3",
@@ -160,9 +163,8 @@ sub setup_member($$$)
        system($cmd) == 0 or die("Join failed\n$cmd");
 
        $self->check_or_start($ret,
-                             ($ENV{NMBD_MAXTIME} or 2700),
-                             ($ENV{WINBINDD_MAXTIME} or 2700),
-                             ($ENV{SMBD_MAXTIME} or 2700));
+                             ($ENV{SMBD_MAXTIME} or 2700),
+                              "yes", "yes", "yes");
 
        $self->wait_for_start($ret);
 
@@ -187,7 +189,7 @@ sub stop_sig_term($$) {
 
 sub stop_sig_kill($$) {
        my ($self, $pid) = @_;
-       kill("KILL", $pid) or warn("Unable to kill $pid: $!");
+       kill("ALRM", $pid) or warn("Unable to kill $pid: $!");
 }
 
 sub write_pid($$$)
@@ -209,8 +211,8 @@ sub read_pid($$)
        return $pid;
 }
 
-sub check_or_start($$$$) {
-       my ($self, $env_vars, $nmbd_maxtime, $winbindd_maxtime, $smbd_maxtime) = @_;
+sub check_or_start($$$$$) {
+       my ($self, $env_vars, $maxtime, $nmbd, $winbindd, $smbd) = @_;
 
        unlink($env_vars->{NMBD_TEST_LOG});
        print "STARTING NMBD...";
@@ -226,13 +228,13 @@ sub check_or_start($$$$) {
                $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
                $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
 
-               if ($nmbd_maxtime eq "skip") {
+               if ($nmbd ne "yes") {
                        $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
                                my $signame = shift;
                                print("Skip nmbd received signal $signame");
                                exit 0;
                        };
-                       sleep(999999);
+                       sleep($maxtime);
                        exit 0;
                }
 
@@ -243,7 +245,7 @@ sub check_or_start($$$$) {
 
                $ENV{MAKE_TEST_BINARY} = $self->binpath("nmbd");
 
-               my @preargs = ($self->binpath("timelimit"), $nmbd_maxtime);
+               my @preargs = ($self->binpath("timelimit"), $maxtime);
                if(defined($ENV{NMBD_VALGRIND})) { 
                        @preargs = split(/ /, $ENV{NMBD_VALGRIND});
                }
@@ -267,13 +269,13 @@ sub check_or_start($$$$) {
                $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
                $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
 
-               if ($winbindd_maxtime eq "skip") {
+               if ($winbindd ne "yes") {
                        $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
                                my $signame = shift;
                                print("Skip winbindd received signal $signame");
                                exit 0;
                        };
-                       sleep(999999);
+                       sleep($maxtime);
                        exit 0;
                }
 
@@ -284,7 +286,7 @@ sub check_or_start($$$$) {
 
                $ENV{MAKE_TEST_BINARY} = $self->binpath("winbindd");
 
-               my @preargs = ($self->binpath("timelimit"), $winbindd_maxtime);
+               my @preargs = ($self->binpath("timelimit"), $maxtime);
                if(defined($ENV{WINBINDD_VALGRIND})) {
                        @preargs = split(/ /, $ENV{WINBINDD_VALGRIND});
                }
@@ -308,13 +310,13 @@ sub check_or_start($$$$) {
                $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
                $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
 
-               if ($smbd_maxtime eq "skip") {
+               if ($smbd ne "yes") {
                        $SIG{USR1} = $SIG{ALRM} = $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
                                my $signame = shift;
                                print("Skip smbd received signal $signame");
                                exit 0;
                        };
-                       sleep(999999);
+                       sleep($maxtime);
                        exit 0;
                }
 
@@ -323,7 +325,7 @@ sub check_or_start($$$$) {
                if (defined($ENV{SMBD_OPTIONS})) {
                        @optargs = split(/ /, $ENV{SMBD_OPTIONS});
                }
-               my @preargs = ($self->binpath("timelimit"), $smbd_maxtime);
+               my @preargs = ($self->binpath("timelimit"), $maxtime);
                if(defined($ENV{SMBD_VALGRIND})) {
                        @preargs = split(/ /,$ENV{SMBD_VALGRIND});
                }
index 71dddf69392d99a85aa9f8eb10ec1373b94bcb9d..1058ac66e0f81842e57a6317ffef28ccf722552a 100644 (file)
@@ -103,8 +103,8 @@ sub check_or_start($$$)
                SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
 
                my $valgrind = "";
-               if (defined($ENV{SMBD_VALGRIND})) {
-                   $valgrind = $ENV{SMBD_VALGRIND};
+               if (defined($ENV{SAMBA_VALGRIND})) {
+                   $valgrind = $ENV{SAMBA_VALGRIND};
                } 
 
                $ENV{KRB5_CONFIG} = $env_vars->{KRB5_CONFIG}; 
@@ -122,8 +122,8 @@ sub check_or_start($$$)
                if (defined($max_time)) {
                        $optarg = "--maximum-runtime=$max_time ";
                }
-               if (defined($ENV{SMBD_OPTIONS})) {
-                       $optarg.= " $ENV{SMBD_OPTIONS}";
+               if (defined($ENV{SAMBA_OPTIONS})) {
+                       $optarg.= " $ENV{SAMBA_OPTIONS}";
                }
                my $samba = $self->bindir_path("samba");
                my $ret = system("$valgrind $samba $optarg $env_vars->{CONFIGURATION} -M single -i --leak-report-full");
index cf74182f27886cbabb3d584dffbbb5be66d6de0f..18ee7fec1cac1d37c8757b6c4f1adf1411d02140 100644 (file)
@@ -73,6 +73,7 @@ WINBIND_NSS_EXTRA_LIBS=@WINBIND_NSS_EXTRA_LIBS@
 WINBIND_NSS_PTHREAD=@WINBIND_NSS_PTHREAD@
 PAM_WINBIND_EXTRA_LIBS=@PAM_WINBIND_EXTRA_LIBS@
 DNSSD_LIBS=@DNSSD_LIBS@
+AVAHI_LIBS=@AVAHI_LIBS@
 POPT_LIBS=@POPTLIBS@
 LIBTALLOC_LIBS=@LIBTALLOC_LIBS@
 LIBTDB_LIBS=@LIBTDB_LIBS@
@@ -158,7 +159,7 @@ CODEPAGEDIR = @codepagedir@
 # the directory where pid files go
 PIDDIR = @piddir@
 
-FLAGS = -I. -I$(srcdir) @FLAGS1@ @SAMBA_CPPFLAGS@ $(CPPFLAGS) -I$(CTDBDIR)/include $(ISA) -I$(srcdir)/lib -I.. -D_SAMBA_BUILD_=3 -I../source4
+FLAGS = -I. -I$(srcdir) @FLAGS1@ @SAMBA_CPPFLAGS@ $(CPPFLAGS) $(ISA) -I$(srcdir)/lib -I.. -D_SAMBA_BUILD_=3 -I../source4
 
 PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
        -DPRIVATE_DIR=\"$(PRIVATE_DIR)\" \
@@ -173,7 +174,6 @@ PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
        -DMODULESDIR=\"$(MODULESDIR)\" \
        -DLOGFILEBASE=\"$(LOGFILEBASE)\" \
        -DSHLIBEXT=\"@SHLIBEXT@\" \
-       -DCTDBDIR=\"$(CTDBDIR)\" \
        -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
        -DCONFIGDIR=\"$(CONFIGDIR)\" \
        -DCODEPAGEDIR=\"$(CODEPAGEDIR)\" \
@@ -255,6 +255,8 @@ AFS_OBJ = lib/afs.o
 
 AFS_SETTOKEN_OBJ = lib/afs_settoken.o
 
+AVAHI_OBJ = @AVAHI_OBJ@
+
 SERVER_MUTEX_OBJ = lib/server_mutex.o
 
 PASSCHANGE_OBJ = libsmb/passchange.o
@@ -282,7 +284,8 @@ LIBNDR_OBJ = ../librpc/ndr/ndr_basic.o \
             ../librpc/ndr/ndr_sec_helper.o \
             librpc/ndr/ndr_string.o \
             ../librpc/ndr/uuid.o \
-                librpc/ndr/util.o
+            librpc/ndr/util.o \
+            ../librpc/gen_ndr/ndr_dcerpc.o
 
 RPCCLIENT_NDR_OBJ = rpc_client/ndr.o
 
@@ -316,7 +319,7 @@ RPC_PARSE_OBJ0 = rpc_parse/parse_prs.o rpc_parse/parse_misc.o
 
 # this includes only the low level parse code, not stuff
 # that requires knowledge of security contexts
-RPC_PARSE_OBJ1 = $(RPC_PARSE_OBJ0) rpc_parse/parse_sec.o
+RPC_PARSE_OBJ1 = $(RPC_PARSE_OBJ0)
 
 RPC_PARSE_OBJ2 = rpc_parse/parse_rpc.o \
                 rpc_client/init_netlogon.o \
@@ -364,7 +367,8 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) \
          lib/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o \
          lib/substitute.o lib/dbwrap_util.o \
          lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \
-         lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \
+         lib/tallocmsg.o lib/dmallocmsg.o \
+         libsmb/clisigning.o libsmb/smb_signing.o \
          lib/iconv.o lib/pam_errors.o intl/lang_tdb.o \
          lib/conn_tdb.o lib/adt_tree.o lib/gencache.o \
          lib/module.o lib/events.o @LIBTEVENT_OBJ0@ \
@@ -687,6 +691,7 @@ VFS_ONEFS_OBJ = modules/vfs_onefs.o modules/onefs_acl.o modules/onefs_system.o \
 VFS_ONEFS_SHADOW_COPY_OBJ = modules/vfs_onefs_shadow_copy.o modules/onefs_shadow_copy.o
 PERFCOUNT_ONEFS_OBJ = modules/perfcount_onefs.o
 PERFCOUNT_TEST_OBJ = modules/perfcount_test.o
+VFS_DIRSORT_OBJ = modules/vfs_dirsort.o
 
 PLAINTEXT_AUTH_OBJ = auth/pampass.o auth/pass_check.o
 
@@ -731,7 +736,7 @@ SMBD_OBJ_SRV = smbd/files.o smbd/chgpasswd.o smbd/connection.o \
               smbd/change_trust_pw.o smbd/fake_file.o \
               smbd/quotas.o smbd/ntquotas.o $(AFS_OBJ) smbd/msdfs.o \
               $(AFS_SETTOKEN_OBJ) smbd/aio.o smbd/statvfs.o \
-              smbd/dmapi.o \
+              smbd/dmapi.o smbd/signing.o \
               smbd/file_access.o \
               smbd/dnsregister.o smbd/globals.o \
               $(MANGLE_OBJ) @VFS_STATIC@
@@ -741,7 +746,7 @@ SMBD_OBJ_BASE = $(PARAM_WITHOUT_REG_OBJ) $(SMBD_OBJ_SRV) $(LIBSMB_OBJ) \
                $(LOCKING_OBJ) $(PASSDB_OBJ) $(PRINTING_OBJ) $(PROFILE_OBJ) \
                $(LIB_OBJ) $(PRINTBACKEND_OBJ) $(OPLOCK_OBJ) \
                $(NOTIFY_OBJ) $(GROUPDB_OBJ) $(AUTH_OBJ) \
-               $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \
+               $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(AVAHI_OBJ) \
                $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(LIBADS_SERVER_OBJ) \
                $(REG_FULL_OBJ) $(POPT_LIB_OBJ) $(BUILDOPT_OBJ) \
                $(SMBLDAP_OBJ) $(LDB_OBJ) $(LIBNET_OBJ) @LIBWBCLIENT_STATIC@ \
@@ -826,7 +831,7 @@ PDBEDIT_OBJ = utils/pdbedit.o $(PASSWD_UTIL_OBJ) $(PARAM_OBJ) $(PASSDB_OBJ) @LIB
 
 SMBGET_OBJ = utils/smbget.o $(POPT_LIB_OBJ) $(LIBSMBCLIENT_OBJ1) @LIBWBCLIENT_STATIC@
 
-DISPLAY_SEC_OBJ= lib/display_sec.o
+DISPLAY_SEC_OBJ= ../libcli/security/display_sec.o
 
 RPCCLIENT_OBJ1 = rpcclient/rpcclient.o rpcclient/cmd_lsarpc.o \
                 rpcclient/cmd_samr.o rpcclient/cmd_spoolss.o \
@@ -1277,6 +1282,10 @@ everything:: all libtalloc libsmbclient libnetapi debug2html smbfilter talloctor
 .SUFFIXES:
 .SUFFIXES: .c .o .lo
 
+.PHONY: showflags SHOWFLAGS
+
+showflags: SHOWFLAGS
+
 SHOWFLAGS::
        @echo "Using CFLAGS     = $(CFLAGS)"
        @echo "      PICFLAG    = $(PICFLAG)"
@@ -1385,7 +1394,7 @@ bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARE
        @echo Linking $@
        @$(CC) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) \
                $(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \
-               $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) \
+               $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) $(AVAHI_LIBS) \
                $(POPT_LIBS) @SMBD_LIBS@ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
                $(WINBIND_LIBS) $(ZLIB_LIBS)
 
@@ -1433,19 +1442,19 @@ bin/smbspool@EXEEXT@: $(BINARY_PREREQS) $(CUPS_OBJ) @BUILD_POPT@ @LIBTALLOC_SHAR
        @$(CC) -o $@ $(CUPS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
                $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
 
-bin/mount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_MOUNT_OBJ) @BUILD_POPT@
+bin/mount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_MOUNT_OBJ)
        @echo Linking $@
-       @$(CC) -o $@ $(CIFS_MOUNT_OBJ) $(DYNEXP) $(LDFLAGS) $(POPT_LIBS)
+       @$(CC) -o $@ $(CIFS_MOUNT_OBJ) $(DYNEXP) $(LDFLAGS)
 
-bin/umount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_UMOUNT_OBJ) @BUILD_POPT@
+bin/umount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_UMOUNT_OBJ)
        @echo Linking $@
-       @$(CC) -o $@ $(CIFS_UMOUNT_OBJ) $(DYNEXP) $(LDFLAGS) $(POPT_LIBS)
+       @$(CC) -o $@ $(CIFS_UMOUNT_OBJ) $(DYNEXP) $(LDFLAGS)
 
-bin/cifs.upcall@EXEEXT@: $(BINARY_PREREQS) $(CIFS_UPCALL_OBJ) $(LIBSMBCLIENT_OBJ1) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
+bin/cifs.upcall@EXEEXT@: $(BINARY_PREREQS) $(CIFS_UPCALL_OBJ) $(LIBSMBCLIENT_OBJ1) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) -o $@ $(CIFS_UPCALL_OBJ) $(DYNEXP) $(LDFLAGS) \
                -lkeyutils $(LIBS) $(LIBSMBCLIENT_OBJ1) $(KRB5LIBS) \
-               $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) $(WINBIND_LIBS) \
+               $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(WINBIND_LIBS) \
                $(LIBTDB_LIBS) $(NSCD_LIBS)
 
 bin/testparm@EXEEXT@: $(BINARY_PREREQS) $(TESTPARM_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@@ -1571,7 +1580,7 @@ bin/pdbtest@EXEEXT@: $(BINARY_PREREQS) $(PDBTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SH
 
 bin/vfstest@EXEEXT@: $(BINARY_PREREQS) $(VFSTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
-       @$(CC) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) \
+       @$(CC) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(AVAHI_LIBS) \
                $(TERMLIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) $(DNSSD_LIBS) \
                $(ACL_LIBS) $(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) \
                @SMBD_LIBS@ $(NSCD_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
@@ -1609,37 +1618,37 @@ bin/ldbedit: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @L
        @echo Linking $@
        @$(CC) -o $@ $(LDBEDIT_OBJ) $(DYNEXP) $(LDFLAGS) \
                $(LIBS) $(POPT_LIBS) $(LDAP_LIBS) \
-               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
 
 bin/ldbsearch: $(BINARY_PREREQS) $(LDBSEARCH_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) -o $@ $(LDBSEARCH_OBJ) $(DYNEXP) $(LDFLAGS) \
                $(LIBS) $(POPT_LIBS) $(LDAP_LIBS) \
-               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
 
 bin/ldbadd: $(BINARY_PREREQS) $(LDBADD_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) -o $@ $(LDBADD_OBJ) $(DYNEXP) $(LDFLAGS) \
                $(LIBS) $(POPT_LIBS) $(LDAP_LIBS) \
-               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
 
 bin/ldbmodify: $(BINARY_PREREQS) $(LDBMODIFY_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) -o $@ $(LDBMODIFY_OBJ) $(DYNEXP) $(LDFLAGS) \
                $(LIBS) $(POPT_LIBS) $(LDAP_LIBS) \
-               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
 
 bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) -o $@ $(LDBDEL_OBJ) $(DYNEXP) $(LDFLAGS) \
                $(LIBS) $(POPT_LIBS) $(LDAP_LIBS) \
-               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
 
 bin/ldbrename: $(BINARY_PREREQS) $(LDBRENAME_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(LDBRENAME_OBJ) $(DYNEXP) $(LDFLAGS) \
                $(LIBS) $(POPT_LIBS) $(LDAP_LIBS) \
-               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+               $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
 
 bin/versiontest: $(BINARY_PREREQS) lib/version_test.o $(VERSION_OBJ)
        @echo Linking $@
@@ -2625,6 +2634,10 @@ bin/security.@SHLIBEXT@: $(BINARY_PREREQS) libgpo/gpext/security.o
        @echo "Building plugin $@"
        @$(SHLD_MODULE) libgpo/gpext/security.o
 
+bin/dirsort.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_DIRSORT_OBJ)
+       @echo "Building plugin $@"
+       @$(SHLD_MODULE) $(VFS_DIRSORT_OBJ)
+
 #########################################################
 ## IdMap NSS plugins
 
@@ -2648,7 +2661,7 @@ bin/ntlm_auth@EXEEXT@: $(BINARY_PREREQS) $(NTLM_AUTH_OBJ) $(PARAM_OBJ) \
 bin/pam_smbpass.@SHLIBEXT@: $(BINARY_PREREQS) $(PAM_SMBPASS_OBJ) @LIBTALLOC_SHARED@ @LIBWBCLIENT_SHARED@ @LIBTDB_SHARED@
        @echo "Linking shared library $@"
        @$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_SMBPASS_OBJ) -lpam $(DYNEXP) \
-               $(LIBS) $(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS) \
+               $(LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \
                $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
 
 bin/tdbbackup@EXEEXT@: $(BINARY_PREREQS) $(TDBBACKUP_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@@ -2893,10 +2906,10 @@ include/build_env.h: script/build_env.sh
 proto::
 
 etags::
-       find $(srcdir)/.. -name "*.[ch]" | xargs -n 100 etags --append
+       find $(srcdir)/.. -name "*.[ch]" | xargs -n 100 etags --append $(ETAGS_OPTIONS)
 
 ctags::
-       ctags `find $(srcdir)/.. -name "*.[ch]" | grep -v include/proto\.h`
+       ctags $(CTAGS_OPTIONS) `find $(srcdir)/.. -name "*.[ch]" | grep -v include/proto\.h`
 
 realclean:: clean
        -rm -f config.log bin/.dummy script/findsmb script/gen-8bit-gap.sh
index dc5850aba1d25e6a5938657fe131ecf97b441b46..1cf8d9ca4a45d1b73fe750e053b872e977fb7748 100644 (file)
@@ -152,13 +152,11 @@ AC_SUBST(NSCD_LIBS)
 # do this here since AC_CACHE_CHECK apparently sets the CFLAGS to "-g -O2"
 # if it has no value.  This prevent *very* large debug binaries from occurring
 # by default.
-if test "x$CFLAGS" = x; then
-  CFLAGS="-O"
-fi
 if test "x$debug" = "xyes" ; then
        CFLAGS="${CFLAGS} -g"
-else
-       CFLAGS="${CFLAGS} -O"
+fi
+if test "x$CFLAGS" = x; then
+  CFLAGS="-O"
 fi
 
 m4_include(../lib/socket_wrapper/config.m4)
@@ -879,7 +877,7 @@ fi
 
 AC_CHECK_FUNCS(dirfd)
 if test x"$ac_cv_func_dirfd" = x"yes"; then
-       default_shared_modules="$default_shared_modules vfs_syncops"
+       default_shared_modules="$default_shared_modules vfs_syncops vfs_dirsort"
 fi
 
 AC_CACHE_CHECK([for struct sigevent type],samba_cv_struct_sigevent, [
@@ -5975,10 +5973,10 @@ AC_SUBST(FLAGS1)
 # Check if user wants DNS service discovery support
 
 AC_ARG_ENABLE(dnssd,
-[AS_HELP_STRING([--enable-dnssd], [Enable DNS service discovery support (default=auto)])])
+[AS_HELP_STRING([--enable-dnssd], [Enable DNS service discovery support (default=no)])])
 
 AC_SUBST(DNSSD_LIBS)
-if test x"$enable_dnssd" != x"no"; then
+if test x"$enable_dnssd" == x"yes"; then
     have_dnssd_support=yes
 
     AC_CHECK_HEADERS(dns_sd.h)
@@ -6006,6 +6004,42 @@ if test x"$enable_dnssd" != x"no"; then
 
 fi
 
+#################################################
+# Check if user wants avahi support
+
+AC_ARG_ENABLE(avahi,
+[AS_HELP_STRING([--enable-avahi], [Enable Avahi support (default=auto)])])
+
+AC_SUBST(AVAHI_LIBS)
+if test x"$enable_avahi" != x"no"; then
+    have_avahi_support=yes
+
+    AC_CHECK_HEADERS(avahi-common/watch.h)
+    if test x"$ac_cv_header_avahi_common_watch_h" != x"yes"; then
+       have_avahi_support=no
+    fi
+
+    AC_CHECK_HEADERS(avahi-client/client.h)
+    if test x"$ac_cv_header_avahi_common_watch_h" != x"yes"; then
+       have_avahi_support=no
+    fi
+
+    AC_CHECK_LIB_EXT(avahi-client, AVAHI_LIBS, avahi_client_new)
+    if test x"$ac_cv_lib_ext_avahi_client_avahi_client_new" != x"yes"; then
+       have_avahi_support=no
+    fi
+
+    if test x"$have_avahi_support" = x"yes"; then
+       AC_DEFINE(WITH_AVAHI_SUPPORT, 1,
+               [Whether to enable avahi support])
+       AC_SUBST(AVAHI_OBJ, "lib/avahi.o smbd/avahi_register.o")
+    else
+       if test x"$enable_avahi" = x"yes"; then
+           AC_MSG_ERROR(avahi support not available)
+       fi
+    fi
+fi
+
 #################################################
 # Check to see if we should use the included iniparser
 
@@ -6213,6 +6247,7 @@ SMB_MODULE(vfs_acl_tdb, \$(VFS_ACL_TDB_OBJ), "bin/acl_tdb.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_smb_traffic_analyzer, \$(VFS_SMB_TRAFFIC_ANALYZER_OBJ), "bin/smb_traffic_analyzer.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_onefs, \$(VFS_ONEFS), "bin/onefs.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_onefs_shadow_copy, \$(VFS_ONEFS_SHADOW_COPY), "bin/onefs_shadow_copy.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_dirsort, \$(VFS_DIRSORT_OBJ), "bin/dirsort.$SHLIBEXT", VFS)
 
 SMB_SUBSYSTEM(VFS,smbd/vfs.o)
 
index 7fc4ff7d27976ae90160ff8806e1a5951bb4ac8e..2ac1101a1e23f44b52ab3369c9561b95ee49d1eb 100644 (file)
@@ -63,6 +63,8 @@ struct cli_request {
         */
        uint16_t mid;
 
+       uint32_t seqnum;
+
        /**
         * The bytes we have to ship to the server
         */
index 320a90e66bf2c44861e095cdb4e17f7ba6d642fe..73a1d7b554879eafba85da85479307313d3512f2 100644 (file)
@@ -71,26 +71,26 @@ struct rpc_cli_transport {
        /**
         * Trigger an async read from the server. May return a short read.
         */
-       struct async_req *(*read_send)(TALLOC_CTX *mem_ctx,
-                                      struct event_context *ev,
-                                       uint8_t *data, size_t size,
-                                      void *priv);
+       struct tevent_req *(*read_send)(TALLOC_CTX *mem_ctx,
+                                       struct event_context *ev,
+                                       uint8_t *data, size_t size,
+                                       void *priv);
        /**
         * Get the result from the read_send operation.
         */
-       NTSTATUS (*read_recv)(struct async_req *req, ssize_t *preceived);
+       NTSTATUS (*read_recv)(struct tevent_req *req, ssize_t *preceived);
 
        /**
         * Trigger an async write to the server. May return a short write.
         */
-       struct async_req *(*write_send)(TALLOC_CTX *mem_ctx,
-                                       struct event_context *ev,
-                                       const uint8_t *data, size_t size,
-                                       void *priv);
+       struct tevent_req *(*write_send)(TALLOC_CTX *mem_ctx,
+                                        struct event_context *ev,
+                                        const uint8_t *data, size_t size,
+                                        void *priv);
        /**
         * Get the result from the read_send operation.
         */
-       NTSTATUS (*write_recv)(struct async_req *req, ssize_t *psent);
+       NTSTATUS (*write_recv)(struct tevent_req *req, ssize_t *psent);
 
        /**
         * This is an optimization for the SMB transport. It models the
@@ -98,15 +98,15 @@ struct rpc_cli_transport {
         * trip. The transport implementation is free to set this to NULL,
         * cli_pipe.c will fall back to the explicit write/read routines.
         */
-       struct async_req *(*trans_send)(TALLOC_CTX *mem_ctx,
-                                       struct event_context *ev,
-                                       uint8_t *data, size_t data_len,
-                                       uint32_t max_rdata_len,
-                                       void *priv);
+       struct tevent_req *(*trans_send)(TALLOC_CTX *mem_ctx,
+                                        struct event_context *ev,
+                                        uint8_t *data, size_t data_len,
+                                        uint32_t max_rdata_len,
+                                        void *priv);
        /**
         * Get the result from the trans_send operation.
         */
-       NTSTATUS (*trans_recv)(struct async_req *req, TALLOC_CTX *mem_ctx,
+       NTSTATUS (*trans_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx,
                               uint8_t **prdata, uint32_t *prdata_len);
        void *priv;
 };
@@ -166,6 +166,13 @@ struct smb_trans_enc_state {
         } s;
 };
 
+struct cli_state_seqnum {
+       struct cli_state_seqnum *prev, *next;
+       uint16_t mid;
+       uint32_t seqnum;
+       bool persistent;
+};
+
 struct cli_state {
        /**
         * A list of subsidiary connections for DFS.
@@ -217,6 +224,7 @@ struct cli_state {
        size_t max_xmit;
        size_t max_mux;
        char *outbuf;
+       struct cli_state_seqnum *seqnum;
        char *inbuf;
        unsigned int bufsize;
        int initialised;
@@ -231,7 +239,7 @@ struct cli_state {
        TALLOC_CTX *call_mem_ctx;
 #endif
 
-       smb_sign_info sign_info;
+       struct smb_signing_state *signing_state;
 
        struct smb_trans_enc_state *trans_enc_state; /* Setup if we're encrypting SMB's. */
 
index 16f10cc1252d3a9ab2a4d2bb7b0a2cff1242ea77..1803587c4aca12ac7ea4f8041614f0d28605e6f9 100644 (file)
@@ -54,6 +54,8 @@ struct db_context {
        bool persistent;
 };
 
+bool db_is_local(const char *name);
+
 struct db_context *db_open(TALLOC_CTX *mem_ctx,
                           const char *name,
                           int hash_size, int tdb_flags,
index 4bf4b5c7357037e125e097c8239c2167da24aad2..c883e177132cceeb8ae70ab4cec25171d283f4a6 100644 (file)
@@ -598,6 +598,7 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
 #include "messages.h"
 #include "locking.h"
 #include "smb_perfcount.h"
+#include "smb_signing.h"
 #include "smb.h"
 #include "nameserv.h"
 #include "secrets.h"
index 3d87f75c7b2a4bef70f82bdee36ebc9eadaadacf..77be0aba09008d892033e01b21431d2f91c4df52 100644 (file)
@@ -150,6 +150,10 @@ bool is_trusted_domain(const char* dom_name);
 
 NTSTATUS auth_winbind_init(void);
 
+/* The following definitions come from auth/auth_wbc.c  */
+
+NTSTATUS auth_wbc_init(void);
+
 /* The following definitions come from auth/pampass.c  */
 
 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
@@ -2410,6 +2414,10 @@ bool receive_getdc_response(TALLOC_CTX *mem_ctx,
 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
 void cli_set_port(struct cli_state *cli, int port);
+bool cli_state_seqnum_persistent(struct cli_state *cli,
+                                uint16_t mid);
+bool cli_state_seqnum_remove(struct cli_state *cli,
+                            uint16_t mid);
 bool cli_receive_smb(struct cli_state *cli);
 ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len);
 bool cli_receive_smb_readX_header(struct cli_state *cli);
@@ -3181,29 +3189,34 @@ void cli_free_enc_buffer(struct cli_state *cli, char *buf);
 NTSTATUS cli_decrypt_message(struct cli_state *cli);
 NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
 
-/* The following definitions come from libsmb/smb_signing.c  */
+/* The following definitions come from libsmb/clisigning.c  */
 
 bool cli_simple_set_signing(struct cli_state *cli,
                            const DATA_BLOB user_session_key,
                            const DATA_BLOB response);
-bool cli_null_set_signing(struct cli_state *cli);
 bool cli_temp_set_signing(struct cli_state *cli);
-void cli_free_signing_context(struct cli_state *cli);
-void cli_calculate_sign_mac(struct cli_state *cli, char *buf);
-bool cli_check_sign_mac(struct cli_state *cli, char *buf);
-bool client_set_trans_sign_state_on(struct cli_state *cli, uint16 mid);
-bool client_set_trans_sign_state_off(struct cli_state *cli, uint16 mid);
+void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
+bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
 bool client_is_signing_on(struct cli_state *cli);
-bool srv_oplock_set_signing(bool onoff);
-bool srv_check_sign_mac(const char *inbuf, bool must_be_ok);
-void srv_calculate_sign_mac(char *outbuf);
-void srv_defer_sign_response(uint16 mid);
-void srv_cancel_sign_response(uint16 mid, bool cancel);
-void srv_set_signing_negotiated(void);
-bool srv_is_signing_active(void);
-bool srv_is_signing_negotiated(void);
-bool srv_signing_started(void);
-void srv_set_signing(const DATA_BLOB user_session_key, const DATA_BLOB response);
+bool client_is_signing_allowed(struct cli_state *cli);
+bool client_is_signing_mandatory(struct cli_state *cli);
+void cli_set_signing_negotiated(struct cli_state *cli);
+
+/* The following definitions come from smbd/signing.c  */
+
+struct smbd_server_connection;
+bool srv_check_sign_mac(struct smbd_server_connection *conn,
+                       const char *inbuf, uint32_t *seqnum);
+void srv_calculate_sign_mac(struct smbd_server_connection *conn,
+                           char *outbuf, uint32_t seqnum);
+void srv_cancel_sign_response(struct smbd_server_connection *conn);
+bool srv_init_signing(struct smbd_server_connection *conn);
+void srv_set_signing_negotiated(struct smbd_server_connection *conn);
+bool srv_is_signing_active(struct smbd_server_connection *conn);
+bool srv_is_signing_negotiated(struct smbd_server_connection *conn);
+void srv_set_signing(struct smbd_server_connection *conn,
+                    const DATA_BLOB user_session_key,
+                    const DATA_BLOB response);
 
 /* The following definitions come from libsmb/smbdes.c  */
 
@@ -3779,6 +3792,8 @@ bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len,
 
 /* The following definitions come from nmbd/nmbd_processlogon.c  */
 
+bool initialize_nmbd_proxy_logon(void);
+
 void process_logon_packet(struct packet_struct *p, char *buf,int len, 
                           const char *mailslot);
 
@@ -4345,7 +4360,7 @@ const char *lp_printcapname(void);
 bool lp_disable_spoolss( void );
 void lp_set_spoolss_state( uint32 state );
 uint32 lp_get_spoolss_state( void );
-bool lp_use_sendfile(int snum);
+bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state);
 void set_use_sendfile(int snum, bool val);
 void set_store_dos_attributes(int snum, bool val);
 void lp_set_mangling_method(const char *new_method);
@@ -4828,7 +4843,7 @@ WERROR add_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const cha
 REGISTRY_VALUE* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value );
 WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL *printer, uint32 level);
 bool set_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level);
-bool del_driver_init(char *drivername);
+bool del_driver_init(const char *drivername);
 WERROR save_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level, uint8 *data, uint32 data_len);
 WERROR get_a_printer( Printer_entry *print_hnd,
                        NT_PRINTER_INFO_LEVEL **pp_printer,
@@ -4840,8 +4855,8 @@ WERROR get_a_printer_search( Printer_entry *print_hnd,
                        const char *sharename);
 uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level);
 uint32 add_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level);
-WERROR get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level,
-                            fstring drivername, const char *architecture, uint32 version);
+WERROR get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32_t level,
+                           const char *drivername, const char *architecture, uint32_t version);
 uint32 free_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level);
 bool printer_driver_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3 );
 bool printer_driver_files_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info );
@@ -5241,22 +5256,22 @@ NTSTATUS rpccli_netlogon_set_trust_password(struct rpc_pipe_client *cli,
 
 /* The following definitions come from rpc_client/cli_pipe.c  */
 
-struct async_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
-                                       struct event_context *ev,
-                                       struct rpc_pipe_client *cli,
-                                       uint8_t op_num,
-                                       prs_struct *req_data);
-NTSTATUS rpc_api_pipe_req_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
+struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
+                                        struct event_context *ev,
+                                        struct rpc_pipe_client *cli,
+                                        uint8_t op_num,
+                                        prs_struct *req_data);
+NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
                               prs_struct *reply_pdu);
 NTSTATUS rpc_api_pipe_req(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli,
                        uint8 op_num,
                        prs_struct *in_data,
                        prs_struct *out_data);
-struct async_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
-                                    struct event_context *ev,
-                                    struct rpc_pipe_client *cli,
-                                    struct cli_pipe_auth_data *auth);
-NTSTATUS rpc_pipe_bind_recv(struct async_req *req);
+struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
+                                     struct event_context *ev,
+                                     struct rpc_pipe_client *cli,
+                                     struct cli_pipe_auth_data *auth);
+NTSTATUS rpc_pipe_bind_recv(struct tevent_req *req);
 NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
                       struct cli_pipe_auth_data *auth);
 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
@@ -5678,10 +5693,8 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
 bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth);
 bool smb_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime);
 bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime);
-bool smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth);
 bool smb_io_uuid(const char *desc, struct GUID *uuid, 
                 prs_struct *ps, int depth);
-void init_unistr(UNISTR *str, const char *buf);
 void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags);
 
 /* The following definitions come from rpc_parse/parse_prs.c  */
@@ -5803,11 +5816,6 @@ bool smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len,
                                 RPC_AUTH_SCHANNEL_CHK * chk,
                                prs_struct *ps, int depth);
 
-/* The following definitions come from rpc_parse/parse_sec.c  */
-
-bool sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth);
-bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth);
-
 /* The following definitions come from rpc_server/srv_eventlog_lib.c  */
 
 TDB_CONTEXT *elog_init_tdb( char *tdbfilename );
@@ -5898,6 +5906,8 @@ NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread,
 
 /* The following definitions come from rpc_server/srv_samr_util.c  */
 
+void copy_id18_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo18 *from);
 void copy_id20_to_sam_passwd(struct samu *to,
                             struct samr_UserInfo20 *from);
 void copy_id21_to_sam_passwd(const char *log_prefix,
@@ -5905,8 +5915,12 @@ void copy_id21_to_sam_passwd(const char *log_prefix,
                             struct samr_UserInfo21 *from);
 void copy_id23_to_sam_passwd(struct samu *to,
                             struct samr_UserInfo23 *from);
+void copy_id24_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo24 *from);
 void copy_id25_to_sam_passwd(struct samu *to,
                             struct samr_UserInfo25 *from);
+void copy_id26_to_sam_passwd(struct samu *to,
+                            struct samr_UserInfo26 *from);
 
 /* The following definitions come from rpc_server/srv_spoolss_nt.c  */
 
@@ -5925,8 +5939,9 @@ void reset_all_printerdata(struct messaging_context *msg,
 bool convert_devicemode(const char *printername,
                        const struct spoolss_DeviceMode *devmode,
                        NT_DEVICEMODE **pp_nt_devmode);
-WERROR set_printer_dataex( NT_PRINTER_INFO_LEVEL *printer, const char *key, const char *value,
-                                  uint32 type, uint8 *data, int real_len  );
+WERROR set_printer_dataex(NT_PRINTER_INFO_LEVEL *printer,
+                         const char *key, const char *value,
+                         uint32_t type, uint8_t *data, int real_len);
 void spoolss_notify_server_name(int snum,
                                       struct spoolss_Notify *data,
                                       print_queue_struct *queue,
@@ -6713,7 +6728,9 @@ SEC_DESC *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname);
 
 void smbd_setup_sig_term_handler(void);
 void smbd_setup_sig_hup_handler(void);
-bool srv_send_smb(int fd, char *buffer, bool do_encrypt,
+bool srv_send_smb(int fd, char *buffer,
+                 bool no_signing, uint32_t seqnum,
+                 bool do_encrypt,
                  struct smb_perfcount_data *pcd);
 int srv_set_message(char *buf,
                         int num_words,
@@ -7210,6 +7227,16 @@ NTSTATUS idmap_sid_to_gid(const char *domname, DOM_SID *sid, gid_t *gid);
 
 NTSTATUS nss_info_template_init( void );
 
+/* The following definitions come from lib/avahi.c */
+
+struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
+                                   struct tevent_context *ev);
+
+/* The following definitions come from smbd/avahi_register.c */
+
+void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+                          uint16_t port);
+
 /* Misc protos */
 
 #endif /*  _PROTO_H_  */
index 580b14f1d810ad9a50e21b658d7b119b1474a15e..ca58040757bc5e8d60357c5a6c5b6ad5d60094d2 100644 (file)
@@ -81,16 +81,6 @@ enum RPC_PKT_TYPE {
 #define RPC_PIPE_AUTH_SEAL_LEVEL 0x6
 #endif
 
-#define DCERPC_FAULT_OP_RNG_ERROR      0x1c010002
-#define DCERPC_FAULT_UNK_IF            0x1c010003
-#define DCERPC_FAULT_INVALID_TAG       0x1c000006
-#define DCERPC_FAULT_CONTEXT_MISMATCH  0x1c00001a
-#define DCERPC_FAULT_OTHER             0x00000001
-#define DCERPC_FAULT_ACCESS_DENIED     0x00000005
-#define DCERPC_FAULT_CANT_PERFORM      0x000006d8
-#define DCERPC_FAULT_NDR               0x000006f7
-
-
 /* Netlogon schannel auth type and level */
 #define SCHANNEL_SIGN_SIGNATURE { 0x77, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 }
 #define SCHANNEL_SEAL_SIGNATURE { 0x77, 0x00, 0x7a, 0x00, 0xff, 0xff, 0x00, 0x00 }
index 281a218256f5d83fa1089cff2a0297e4b7dddd99..01e6ddf64cee4e3743ea60213a1fa47ebc2acb10 100644 (file)
@@ -252,6 +252,8 @@ struct id_map {
 #include "librpc/gen_ndr/drsuapi.h"
 #include "librpc/gen_ndr/drsblobs.h"
 #include "librpc/gen_ndr/spoolss.h"
+#include "librpc/gen_ndr/dcerpc.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
 
 struct lsa_dom_info {
        bool valid;
@@ -621,6 +623,7 @@ struct smb_request {
        uint16 flags2;
        uint16 smbpid;
        uint16 mid;
+       uint32_t seqnum;
        uint16 vuid;
        uint16 tid;
        uint8  wct;
@@ -722,6 +725,7 @@ struct pending_message_list {
        struct timeval request_time; /* When was this first issued? */
        struct timed_event *te;
        struct smb_perfcount_data pcd;
+       uint32_t seqnum;
        bool encrypted;
        DATA_BLOB buf;
        DATA_BLOB private_data;
@@ -1847,21 +1851,6 @@ struct ip_service {
 /* Special name type used to cause a _kerberos DNS lookup. */
 #define KDC_NAME_TYPE 0xDCDC
 
-/* Used by the SMB signing functions. */
-
-typedef struct smb_sign_info {
-       void (*sign_outgoing_message)(char *outbuf, struct smb_sign_info *si);
-       bool (*check_incoming_message)(const char *inbuf, struct smb_sign_info *si, bool must_be_ok);
-       void (*free_signing_context)(struct smb_sign_info *si);
-       void *signing_context;
-
-       bool negotiated_smb_signing;
-       bool allow_smb_signing;
-       bool doing_signing;
-       bool mandatory_signing;
-       bool seen_valid; /* Have I ever seen a validly signed packet? */
-} smb_sign_info;
-
 struct ea_struct {
        uint8 flags;
        char *name;
index 01a539d508c2db84286041818251965c143ad955..9c83147d04204e081e5e3454890c98c5be4fade7 100644 (file)
@@ -37,8 +37,6 @@ struct smb_perfcount_handlers {
                                         uint64_t in_bytes);
        void (*perfcount_set_msglen_out) (struct smb_perfcount_data *pcd,
                                          uint64_t out_bytes);
-       void (*perfcount_set_client) (struct smb_perfcount_data *pcd, uid_t uid,
-                                     const char *user, const char *domain);
        void (*perfcount_copy_context) (struct smb_perfcount_data *pcd,
                                        struct smb_perfcount_data *new_pcd);
        void (*perfcount_defer_op) (struct smb_perfcount_data *pcd,
@@ -88,12 +86,6 @@ void smb_init_perfcount_data(struct smb_perfcount_data *pcd);
            (_pcd_)->handlers->perfcount_set_msglen_out((_pcd_), (_out_));\
     } while (0)
 
-#define SMB_PERFCOUNT_SET_CLIENT(_pcd_,_uid_, _user_, _domain_) \
-    do {if((_pcd_) && (_pcd_)->handlers) \
-           (_pcd_)->handlers->perfcount_set_client((_pcd_), (_uid_), \
-              (_user_), (_domain_)); \
-    } while (0)
-
 #define SMB_PERFCOUNT_COPY_CONTEXT(_pcd_, _new_pcd_) \
     do {if((_pcd_) && (_pcd_)->handlers) \
            (_pcd_)->handlers->perfcount_copy_context((_pcd_), (_new_pcd_)); \
diff --git a/source3/include/smb_signing.h b/source3/include/smb_signing.h
new file mode 100644 (file)
index 0000000..770c40c
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+   Unix SMB/CIFS implementation.
+   SMB Signing Code
+   Copyright (C) Jeremy Allison 2003.
+   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2002-2003
+   Copyright (C) Stefan Metzmacher 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 _SMB_SIGNING_H_
+#define _SMB_SIGNING_H_
+
+struct smb_signing_state;
+
+struct smb_signing_state *smb_signing_init(TALLOC_CTX *mem_ctx,
+                                          bool allowed,
+                                          bool mandatory);
+uint32_t smb_signing_next_seqnum(struct smb_signing_state *si, bool oneway);
+void smb_signing_cancel_reply(struct smb_signing_state *si, bool oneway);
+void smb_signing_sign_pdu(struct smb_signing_state *si,
+                         uint8_t *outbuf, uint32_t seqnum);
+bool smb_signing_check_pdu(struct smb_signing_state *si,
+                          const uint8_t *inbuf, uint32_t seqnum);
+bool smb_signing_set_bsrspyl(struct smb_signing_state *si);
+bool smb_signing_activate(struct smb_signing_state *si,
+                         const DATA_BLOB user_session_key,
+                         const DATA_BLOB response);
+bool smb_signing_is_active(struct smb_signing_state *si);
+bool smb_signing_is_allowed(struct smb_signing_state *si);
+bool smb_signing_is_mandatory(struct smb_signing_state *si);
+bool smb_signing_set_negotiated(struct smb_signing_state *si);
+bool smb_signing_is_negotiated(struct smb_signing_state *si);
+
+#endif /* _SMB_SIGNING_H_ */
diff --git a/source3/lib/avahi.c b/source3/lib/avahi.c
new file mode 100644 (file)
index 0000000..269b329
--- /dev/null
@@ -0,0 +1,275 @@
+/*
+   Unix SMB/CIFS implementation.
+   Connect avahi to lib/tevents
+   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 "includes.h"
+
+#include <avahi-common/watch.h>
+
+struct avahi_poll_context {
+       struct tevent_context *ev;
+       AvahiWatch **watches;
+       AvahiTimeout **timeouts;
+};
+
+struct AvahiWatch {
+       struct avahi_poll_context *ctx;
+       struct tevent_fd *fde;
+       int fd;
+       AvahiWatchEvent latest_event;
+       AvahiWatchCallback callback;
+       void *userdata;
+};
+
+struct AvahiTimeout {
+       struct avahi_poll_context *ctx;
+       struct tevent_timer *te;
+       AvahiTimeoutCallback callback;
+       void *userdata;
+};
+
+static uint16_t avahi_flags_map_to_tevent(AvahiWatchEvent event)
+{
+       return ((event & AVAHI_WATCH_IN) ? TEVENT_FD_READ : 0)
+               | ((event & AVAHI_WATCH_OUT) ? TEVENT_FD_WRITE : 0);
+}
+
+static void avahi_fd_handler(struct tevent_context *ev,
+                            struct tevent_fd *fde, uint16_t flags,
+                            void *private_data);
+
+static AvahiWatch *avahi_watch_new(const AvahiPoll *api, int fd,
+                                  AvahiWatchEvent event,
+                                  AvahiWatchCallback callback,
+                                  void *userdata)
+{
+       struct avahi_poll_context *ctx = talloc_get_type_abort(
+               api->userdata, struct avahi_poll_context);
+       int num_watches = talloc_array_length(ctx->watches);
+       AvahiWatch **tmp, *watch_ctx;
+
+       tmp = talloc_realloc(ctx, ctx->watches, AvahiWatch *, num_watches + 1);
+       if (tmp == NULL) {
+               return NULL;
+       }
+       ctx->watches = tmp;
+
+       watch_ctx = talloc(tmp, AvahiWatch);
+       if (watch_ctx == NULL) {
+               goto fail;
+       }
+       ctx->watches[num_watches] = watch_ctx;
+
+       watch_ctx->ctx = ctx;
+       watch_ctx->fde = tevent_add_fd(ctx->ev, watch_ctx, fd,
+                                      avahi_flags_map_to_tevent(event),
+                                      avahi_fd_handler, watch_ctx);
+       if (watch_ctx->fde == NULL) {
+               goto fail;
+       }
+       watch_ctx->callback = callback;
+       watch_ctx->userdata = userdata;
+       return watch_ctx;
+
+ fail:
+       TALLOC_FREE(watch_ctx);
+       ctx->watches = talloc_realloc(ctx, ctx->watches, AvahiWatch *,
+                                     num_watches);
+       return NULL;
+}
+
+static void avahi_fd_handler(struct tevent_context *ev,
+                            struct tevent_fd *fde, uint16_t flags,
+                            void *private_data)
+{
+       AvahiWatch *watch_ctx = talloc_get_type_abort(private_data, AvahiWatch);
+
+       watch_ctx->latest_event =
+               ((flags & TEVENT_FD_READ) ? AVAHI_WATCH_IN : 0)
+               | ((flags & TEVENT_FD_WRITE) ? AVAHI_WATCH_OUT : 0);
+
+       watch_ctx->callback(watch_ctx, watch_ctx->fd, watch_ctx->latest_event,
+                           watch_ctx->userdata);
+}
+
+static void avahi_watch_update(AvahiWatch *w, AvahiWatchEvent event)
+{
+       tevent_fd_set_flags(w->fde, avahi_flags_map_to_tevent(event));
+}
+
+static AvahiWatchEvent avahi_watch_get_events(AvahiWatch *w)
+{
+       return w->latest_event;
+}
+
+static void avahi_watch_free(AvahiWatch *w)
+{
+       int i, num_watches;
+       AvahiWatch **watches = w->ctx->watches;
+       struct avahi_poll_context *ctx;
+
+       num_watches = talloc_array_length(watches);
+
+       for (i=0; i<num_watches; i++) {
+               if (w == watches[i]) {
+                       break;
+               }
+       }
+       if (i == num_watches) {
+               return;
+       }
+       ctx = w->ctx;
+       TALLOC_FREE(w);
+       memmove(&watches[i], &watches[i+1],
+               sizeof(*watches) * (num_watches - i - 1));
+       ctx->watches = talloc_realloc(ctx, watches, AvahiWatch *,
+                                     num_watches - 1);
+}
+
+static void avahi_timeout_handler(struct tevent_context *ev,
+                                 struct tevent_timer *te,
+                                 struct timeval current_time,
+                                 void *private_data);
+
+static AvahiTimeout *avahi_timeout_new(const AvahiPoll *api,
+                                      const struct timeval *tv,
+                                      AvahiTimeoutCallback callback,
+                                      void *userdata)
+{
+       struct avahi_poll_context *ctx = talloc_get_type_abort(
+               api->userdata, struct avahi_poll_context);
+       int num_timeouts = talloc_array_length(ctx->timeouts);
+       AvahiTimeout **tmp, *timeout_ctx;
+
+       tmp = talloc_realloc(ctx, ctx->timeouts, AvahiTimeout *,
+                            num_timeouts + 1);
+       if (tmp == NULL) {
+               return NULL;
+       }
+       ctx->timeouts = tmp;
+
+       timeout_ctx = talloc(tmp, AvahiTimeout);
+       if (timeout_ctx == NULL) {
+               goto fail;
+       }
+       ctx->timeouts[num_timeouts] = timeout_ctx;
+
+       timeout_ctx->ctx = ctx;
+       if (tv == NULL) {
+               timeout_ctx->te = NULL;
+       } else {
+               timeout_ctx->te = tevent_add_timer(ctx->ev, timeout_ctx,
+                                                  *tv, avahi_timeout_handler,
+                                                  timeout_ctx);
+               if (timeout_ctx->te == NULL) {
+                       goto fail;
+               }
+       }
+       timeout_ctx->callback = callback;
+       timeout_ctx->userdata = userdata;
+       return timeout_ctx;
+
+ fail:
+       TALLOC_FREE(timeout_ctx);
+       ctx->timeouts = talloc_realloc(ctx, ctx->timeouts, AvahiTimeout *,
+                                      num_timeouts);
+       return NULL;
+}
+
+static void avahi_timeout_handler(struct tevent_context *ev,
+                                 struct tevent_timer *te,
+                                 struct timeval current_time,
+                                 void *private_data)
+{
+       AvahiTimeout *timeout_ctx = talloc_get_type_abort(
+               private_data, AvahiTimeout);
+
+       TALLOC_FREE(timeout_ctx->te);
+       timeout_ctx->callback(timeout_ctx, timeout_ctx->userdata);
+}
+
+static void avahi_timeout_update(AvahiTimeout *t, const struct timeval *tv)
+{
+       TALLOC_FREE(t->te);
+
+       if (tv == NULL) {
+               /*
+                * Disable this timer
+                */
+               return;
+       }
+
+       t->te = tevent_add_timer(t->ctx->ev, t, *tv, avahi_timeout_handler, t);
+       /*
+        * No failure mode defined here
+        */
+       SMB_ASSERT(t->te != NULL);
+}
+
+static void avahi_timeout_free(AvahiTimeout *t)
+{
+       int i, num_timeouts;
+       AvahiTimeout **timeouts = t->ctx->timeouts;
+       struct avahi_poll_context *ctx;
+
+       num_timeouts = talloc_array_length(timeouts);
+
+       for (i=0; i<num_timeouts; i++) {
+               if (t == timeouts[i]) {
+                       break;
+               }
+       }
+       if (i == num_timeouts) {
+               return;
+       }
+       ctx = t->ctx;
+       TALLOC_FREE(t);
+       memmove(&timeouts[i], &timeouts[i+1],
+               sizeof(*timeouts) * (num_timeouts - i - 1));
+       ctx->timeouts = talloc_realloc(ctx, timeouts, AvahiTimeout *,
+                                      num_timeouts - 1);
+}
+
+struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
+                                   struct tevent_context *ev)
+{
+       struct AvahiPoll *result;
+       struct avahi_poll_context *ctx;
+
+       result = talloc(mem_ctx, struct AvahiPoll);
+       if (result == NULL) {
+               return result;
+       }
+       ctx = talloc_zero(result, struct avahi_poll_context);
+       if (ctx == NULL) {
+               TALLOC_FREE(result);
+               return NULL;
+       }
+       ctx->ev = ev;
+
+       result->watch_new               = avahi_watch_new;
+       result->watch_update            = avahi_watch_update;
+       result->watch_get_events        = avahi_watch_get_events;
+       result->watch_free              = avahi_watch_free;
+       result->timeout_new             = avahi_timeout_new;
+       result->timeout_update          = avahi_timeout_update;
+       result->timeout_free            = avahi_timeout_free;
+       result->userdata                = ctx;
+
+       return result;
+}
index 5e7ce6099fc486004d737304f01e784639379675..67c08a6085f659f49de367383add8e8065c26765 100644 (file)
@@ -65,6 +65,33 @@ static int dbwrap_fallback_parse_record(struct db_context *db, TDB_DATA key,
        return res;
 }
 
+bool db_is_local(const char *name)
+{
+#ifdef CLUSTER_SUPPORT
+       const char *sockname = lp_ctdbd_socket();
+
+       if(!sockname || !*sockname) {
+               sockname = CTDB_PATH;
+       }
+
+       if (lp_clustering() && socket_exist(sockname)) {
+               const char *partname;
+               /* ctdb only wants the file part of the name */
+               partname = strrchr(name, '/');
+               if (partname) {
+                       partname++;
+               } else {
+                       partname = name;
+               }
+               /* allow ctdb for individual databases to be disabled */
+               if (lp_parm_bool(-1, "ctdb", partname, True)) {
+                       return false;
+               }
+       }
+#endif
+       return true;
+}
+
 /**
  * open a database
  */
index b676ae63dde08c6296b8b8349142be5886563dd9..d28b2b21263b5e7488c8ed9f6dc28160cbeaff0c 100644 (file)
@@ -57,6 +57,11 @@ static WERROR libnetapi_open_ipc_connection(struct libnetapi_ctx *ctx,
                                false, false,
                                PROTOCOL_NT1,
                                0, 0x20);
+       if (cli_ipc) {
+               cli_set_username(cli_ipc, ctx->username);
+               cli_set_password(cli_ipc, ctx->password);
+               cli_set_domain(cli_ipc, ctx->workgroup);
+       }
        TALLOC_FREE(auth_info);
 
        if (!cli_ipc) {
index 189902a78eda535a6629e4272f2f7e3ab3a26788..c09632a8570b08c925e5e506d0e850ecd3b7b82d 100644 (file)
@@ -1276,6 +1276,7 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
 
        *r->out.buffer = NULL;
        *r->out.entries_read = 0;
+       *r->out.total_entries = 0;
 
        switch (r->in.level) {
                case 0:
@@ -1364,13 +1365,8 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
                }
        }
 
-       if (r->out.entries_read) {
-               *r->out.entries_read = entries_read;
-       }
-
-       if (r->out.total_entries) {
-               *r->out.total_entries = entries_read;
-       }
+       *r->out.entries_read = entries_read;
+       *r->out.total_entries = entries_read;
 
        werr = WERR_OK;
 
index 8cc65a6e9eb0a1e622995ac3f1a8da16441c4887..1cbb883169673c8af9858315084b99caea3a9330 100644 (file)
@@ -1497,6 +1497,9 @@ WERROR NetQueryDisplayInformation_r(struct libnetapi_ctx *ctx,
 
        NTSTATUS status = NT_STATUS_OK;
        WERROR werr;
+       WERROR werr_tmp;
+
+       *r->out.entries_read = 0;
 
        ZERO_STRUCT(connect_handle);
        ZERO_STRUCT(domain_handle);
@@ -1540,15 +1543,18 @@ WERROR NetQueryDisplayInformation_r(struct libnetapi_ctx *ctx,
                                               &total_size,
                                               &returned_size,
                                               &info);
-       if (!NT_STATUS_IS_OK(status)) {
-               werr = ntstatus_to_werror(status);
+       werr = ntstatus_to_werror(status);
+       if (NT_STATUS_IS_ERR(status)) {
                goto done;
        }
 
-       werr = convert_samr_dispinfo_to_NET_DISPLAY(ctx, &info,
-                                                   r->in.level,
-                                                   r->out.entries_read,
-                                                   r->out.buffer);
+       werr_tmp = convert_samr_dispinfo_to_NET_DISPLAY(ctx, &info,
+                                                       r->in.level,
+                                                       r->out.entries_read,
+                                                       r->out.buffer);
+       if (!W_ERROR_IS_OK(werr_tmp)) {
+               werr = werr_tmp;
+       }
  done:
        /* if last query */
        if (NT_STATUS_IS_OK(status) ||
@@ -2806,6 +2812,7 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx,
 
        *r->out.buffer = NULL;
        *r->out.entries_read = 0;
+       *r->out.total_entries = 0;
 
        switch (r->in.level) {
                case 0:
@@ -2899,12 +2906,8 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx,
                }
        }
 
-       if (r->out.entries_read) {
-               *r->out.entries_read = entries_read;
-       }
-       if (r->out.total_entries) {
-               *r->out.total_entries = entries_read;
-       }
+       *r->out.entries_read = entries_read;
+       *r->out.total_entries = entries_read;
 
  done:
        if (ctx->disable_policy_handle_cache) {
@@ -3242,6 +3245,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
 
        *r->out.buffer = NULL;
        *r->out.entries_read = 0;
+       *r->out.total_entries = 0;
 
        switch (r->in.level) {
                case 0:
@@ -3402,12 +3406,8 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
                }
        }
 
-       if (r->out.entries_read) {
-               *r->out.entries_read = entries_read;
-       }
-       if (r->out.total_entries) {
-               *r->out.total_entries = entries_read;
-       }
+       *r->out.entries_read = entries_read;
+       *r->out.total_entries = entries_read;
 
  done:
        if (ctx->disable_policy_handle_cache) {
index c5a9b7c29afdf59a52ddb711f5ee5f676ee79e99..50ff844762446e462452d23df56bc5b94d4a05a8 100644 (file)
@@ -39,7 +39,7 @@ static char *file_pload(const char *syscmd, size_t *size)
        total = 0;
 
        while ((n = read(fd, buf, sizeof(buf))) > 0) {
-               p = (char *)SMB_REALLOC(p, total + n + 1);
+               p = talloc_realloc(NULL, p, char, total + n + 1);
                if (!p) {
                        DEBUG(0,("file_pload: failed to expand buffer!\n"));
                        close(fd);
index 3cf992c7de9a8ec95208bcbbf5b84086c679b359..c22e1684541a410fe51f313b91a25a5549b42e05 100644 (file)
@@ -449,8 +449,8 @@ static void wb_open_pipe_connect_nonpriv_done(struct tevent_req *subreq)
        ZERO_STRUCT(state->wb_req);
        state->wb_req.cmd = WINBINDD_INTERFACE_VERSION;
 
-       subreq = wb_int_trans_send(state, state->ev, NULL, state->wb_ctx->fd,
-                                  &state->wb_req);
+       subreq = wb_int_trans_send(state, state->ev, state->wb_ctx->queue,
+                                  state->wb_ctx->fd, &state->wb_req);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -480,8 +480,8 @@ static void wb_open_pipe_ping_done(struct tevent_req *subreq)
 
        state->wb_req.cmd = WINBINDD_PRIV_PIPE_DIR;
 
-       subreq = wb_int_trans_send(state, state->ev, NULL, state->wb_ctx->fd,
-                                  &state->wb_req);
+       subreq = wb_int_trans_send(state, state->ev, state->wb_ctx->queue,
+                                  state->wb_ctx->fd, &state->wb_req);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
@@ -673,8 +673,8 @@ static void wb_trans_connect_done(struct tevent_req *subreq)
                return;
        }
 
-       subreq = wb_int_trans_send(state, state->ev, NULL, state->wb_ctx->fd,
-                                  state->wb_req);
+       subreq = wb_int_trans_send(state, state->ev, state->wb_ctx->queue,
+                                  state->wb_ctx->fd, state->wb_req);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }
index 56d7b061a1b5e5674aaaafe52f467d65fb8ad63a..52cb975a6c5b389d039f914704064c414ed72eb8 100644 (file)
@@ -511,13 +511,13 @@ char *kerberos_get_default_realm_from_ccache( void )
 
   out:
 
-       if (princ) {
-               krb5_free_principal(ctx, princ);
-       }
-       if (cc) {
-               krb5_cc_close(ctx, cc);
-       }
        if (ctx) {
+               if (princ) {
+                       krb5_free_principal(ctx, princ);
+               }
+               if (cc) {
+                       krb5_cc_close(ctx, cc);
+               }
                krb5_free_context(ctx);
        }
 
index 73d443974397952939eced9444cd5fa6b003b9b9..0c00b8518aef668cb7f89297805c1de4a912e9a6 100644 (file)
@@ -422,9 +422,6 @@ static NTSTATUS libnet_samsync_delta(TALLOC_CTX *mem_ctx,
 
                TALLOC_FREE(delta_enum_array);
 
-               /* Increment sync_context */
-               sync_context += 1;
-
        } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES));
 
  out:
index e579d1c9f0bcc32b7cdfda27ae2fbe6390f721ea..86fd5c8bef0220f5b2b2c8f847e856d0905219fc 100644 (file)
@@ -550,7 +550,7 @@ void cli_chain_uncork(struct cli_state *cli)
                _smb_setlen_large(((char *)req->outbuf), smblen);
        }
 
-       cli_calculate_sign_mac(cli, (char *)req->outbuf);
+       cli_calculate_sign_mac(cli, (char *)req->outbuf, &req->seqnum);
 
        if (cli_encryption_on(cli)) {
                NTSTATUS status;
@@ -811,9 +811,16 @@ NTSTATUS cli_pull_reply(struct async_req *req,
  */
 
 
-static NTSTATUS validate_smb_crypto(struct cli_state *cli, char *pdu)
+static NTSTATUS validate_smb_crypto(struct cli_state *cli, char *pdu,
+                                   struct cli_request **_req,
+                                   uint16_t *_mid)
 {
        NTSTATUS status;
+       struct cli_request *req = NULL;
+       uint16_t mid;
+
+       *_req = NULL;
+       *_mid = 0;
 
        if ((IVAL(pdu, 4) != 0x424d53ff) /* 0xFF"SMB" */
            && (SVAL(pdu, 4) != 0x45ff)) /* 0xFF"E" */ {
@@ -846,11 +853,27 @@ static NTSTATUS validate_smb_crypto(struct cli_state *cli, char *pdu)
                }
        }
 
-       if (!cli_check_sign_mac(cli, pdu)) {
+       mid = SVAL(pdu, smb_mid);
+
+       for (req = cli->outstanding_requests; req; req = req->next) {
+               if (req->mid == mid) {
+                       break;
+               }
+       }
+
+       if (!req) {
+               /* oplock breaks are not signed */
+               goto done;
+       }
+
+       if (!cli_check_sign_mac(cli, pdu, req->seqnum+1)) {
                DEBUG(10, ("cli_check_sign_mac failed\n"));
                return NT_STATUS_ACCESS_DENIED;
        }
 
+done:
+       *_req = req;
+       *_mid = mid;
        return NT_STATUS_OK;
 }
 
@@ -861,9 +884,9 @@ static NTSTATUS validate_smb_crypto(struct cli_state *cli, char *pdu)
 
 static void handle_incoming_pdu(struct cli_state *cli)
 {
-       struct cli_request *req;
+       struct cli_request *req, *next;
        uint16_t mid;
-       size_t raw_pdu_len, buf_len, pdu_len, rest_len;
+       size_t raw_pdu_len, buf_len, rest_len;
        char *pdu;
        int i;
        NTSTATUS status;
@@ -923,23 +946,13 @@ static void handle_incoming_pdu(struct cli_state *cli)
                }
        }
 
-       status = validate_smb_crypto(cli, pdu);
+       status = validate_smb_crypto(cli, pdu, &req, &mid);
        if (!NT_STATUS_IS_OK(status)) {
                goto invalidate_requests;
        }
 
-       mid = SVAL(pdu, smb_mid);
-
        DEBUG(10, ("handle_incoming_pdu: got mid %d\n", mid));
 
-       for (req = cli->outstanding_requests; req; req = req->next) {
-               if (req->mid == mid) {
-                       break;
-               }
-       }
-
-       pdu_len = smb_len(pdu) + 4;
-
        if (req == NULL) {
                DEBUG(3, ("Request for mid %d not found, dumping PDU\n", mid));
 
@@ -978,8 +991,11 @@ static void handle_incoming_pdu(struct cli_state *cli)
        DEBUG(10, ("handle_incoming_pdu: Aborting with %s\n",
                   nt_errstr(status)));
 
-       for (req = cli->outstanding_requests; req; req = req->next) {
-               async_req_nterror(req->async[0], status);
+       for (req = cli->outstanding_requests; req; req = next) {
+               next = req->next;
+               if (req->num_async) {
+                       async_req_nterror(req->async[0], status);
+               }
        }
        return;
 }
index ebb01c44a6aefd812c89e8648df2a542c456735c..aa1ca595a7e13342aff754925ae68fd56ecf4e9a 100644 (file)
@@ -505,11 +505,7 @@ static NTSTATUS cli_session_setup_nt1(struct cli_state *cli, const char *user,
        ok = cli_simple_set_signing(cli, session_key, nt_response);
 #endif
        if (ok) {
-               /* 'resign' the last message, so we get the right sequence numbers
-                  for checking the first reply from the server */
-               cli_calculate_sign_mac(cli, cli->outbuf);
-
-               if (!cli_check_sign_mac(cli, cli->inbuf)) {
+               if (!cli_check_sign_mac(cli, cli->inbuf, 1)) {
                        result = NT_STATUS_ACCESS_DENIED;
                        goto end;
                }
@@ -747,11 +743,7 @@ static ADS_STATUS cli_session_setup_kerberos(struct cli_state *cli, const char *
        if (cli_simple_set_signing(
                    cli, session_key_krb5, data_blob_null)) {
 
-               /* 'resign' the last message, so we get the right sequence numbers
-                  for checking the first reply from the server */
-               cli_calculate_sign_mac(cli, cli->outbuf);
-
-               if (!cli_check_sign_mac(cli, cli->inbuf)) {
+               if (!cli_check_sign_mac(cli, cli->inbuf, 1)) {
                        nt_status = NT_STATUS_ACCESS_DENIED;
                        goto nt_error;
                }
@@ -873,11 +865,7 @@ static NTSTATUS cli_session_setup_ntlmssp(struct cli_state *cli, const char *use
                if (cli_simple_set_signing(
                            cli, ntlmssp_state->session_key, data_blob_null)) {
 
-                       /* 'resign' the last message, so we get the right sequence numbers
-                          for checking the first reply from the server */
-                       cli_calculate_sign_mac(cli, cli->outbuf);
-
-                       if (!cli_check_sign_mac(cli, cli->inbuf)) {
+                       if (!cli_check_sign_mac(cli, cli->inbuf, 1)) {
                                nt_status = NT_STATUS_ACCESS_DENIED;
                        }
                }
@@ -1540,13 +1528,16 @@ NTSTATUS cli_negprot_recv(struct async_req *req)
 
        cli->protocol = prots[protnum].prot;
 
-       if ((cli->protocol < PROTOCOL_NT1) && cli->sign_info.mandatory_signing) {
+       if ((cli->protocol < PROTOCOL_NT1) &&
+           client_is_signing_mandatory(cli)) {
                DEBUG(0,("cli_negprot: SMB signing is mandatory and the selected protocol level doesn't support it.\n"));
                return NT_STATUS_ACCESS_DENIED;
        }
 
        if (cli->protocol >= PROTOCOL_NT1) {    
                struct timespec ts;
+               bool negotiated_smb_signing = false;
+
                /* NT protocol */
                cli->sec_mode = CVAL(vwv + 1, 0);
                cli->max_mux = SVAL(vwv + 1, 1);
@@ -1579,22 +1570,24 @@ NTSTATUS cli_negprot_recv(struct async_req *req)
 
                if (cli->sec_mode & NEGOTIATE_SECURITY_SIGNATURES_REQUIRED) {
                        /* Fail if server says signing is mandatory and we don't want to support it. */
-                       if (!cli->sign_info.allow_smb_signing) {
+                       if (!client_is_signing_allowed(cli)) {
                                DEBUG(0,("cli_negprot: SMB signing is mandatory and we have disabled it.\n"));
                                return NT_STATUS_ACCESS_DENIED;
                        }
-                       cli->sign_info.negotiated_smb_signing = True;
-                       cli->sign_info.mandatory_signing = True;
-               } else if (cli->sign_info.mandatory_signing && cli->sign_info.allow_smb_signing) {
+                       negotiated_smb_signing = true;
+               } else if (client_is_signing_mandatory(cli) && client_is_signing_allowed(cli)) {
                        /* Fail if client says signing is mandatory and the server doesn't support it. */
                        if (!(cli->sec_mode & NEGOTIATE_SECURITY_SIGNATURES_ENABLED)) {
                                DEBUG(1,("cli_negprot: SMB signing is mandatory and the server doesn't support it.\n"));
                                return NT_STATUS_ACCESS_DENIED;
                        }
-                       cli->sign_info.negotiated_smb_signing = True;
-                       cli->sign_info.mandatory_signing = True;
+                       negotiated_smb_signing = true;
                } else if (cli->sec_mode & NEGOTIATE_SECURITY_SIGNATURES_ENABLED) {
-                       cli->sign_info.negotiated_smb_signing = True;
+                       negotiated_smb_signing = true;
+               }
+
+               if (negotiated_smb_signing) {
+                       cli_set_signing_negotiated(cli);
                }
 
                if (cli->capabilities & (CAP_LARGE_READX|CAP_LARGE_WRITEX)) {
@@ -1841,10 +1834,9 @@ static NTSTATUS open_smb_socket(const struct sockaddr_storage *pss,
        tevent_req_set_callback(r445, smb_sock_connected, fd445);
        tevent_req_set_callback(r139, smb_sock_connected, fd139);
 
-       while ((fd139->fd == -1)
-              && tevent_req_is_in_progress(r139)
-              && (fd445->fd == -1)
-              && tevent_req_is_in_progress(r445)) {
+       while ((fd445->fd == -1) && (fd139->fd == -1)
+              && (tevent_req_is_in_progress(r139)
+                  || tevent_req_is_in_progress(r445))) {
                event_loop_once(ev);
        }
 
index c1ba4e5c4f6909f325a10d73048573a3c06877c0..6186387076e9996c3452d959ee72f5d399f87c32 100644 (file)
@@ -135,6 +135,79 @@ static ssize_t client_receive_smb(struct cli_state *cli, size_t maxlen)
        return len;
 }
 
+static bool cli_state_set_seqnum(struct cli_state *cli, uint16_t mid, uint32_t seqnum)
+{
+       struct cli_state_seqnum *c;
+
+       for (c = cli->seqnum; c; c = c->next) {
+               if (c->mid == mid) {
+                       c->seqnum = seqnum;
+                       return true;
+               }
+       }
+
+       c = talloc_zero(cli, struct cli_state_seqnum);
+       if (!c) {
+               return false;
+       }
+
+       c->mid = mid;
+       c->seqnum = seqnum;
+       c->persistent = false;
+       DLIST_ADD_END(cli->seqnum, c, struct cli_state_seqnum *);
+
+       return true;
+}
+
+bool cli_state_seqnum_persistent(struct cli_state *cli,
+                                uint16_t mid)
+{
+       struct cli_state_seqnum *c;
+
+       for (c = cli->seqnum; c; c = c->next) {
+               if (c->mid == mid) {
+                       c->persistent = true;
+                       return true;
+               }
+       }
+
+       return false;
+}
+
+bool cli_state_seqnum_remove(struct cli_state *cli,
+                            uint16_t mid)
+{
+       struct cli_state_seqnum *c;
+
+       for (c = cli->seqnum; c; c = c->next) {
+               if (c->mid == mid) {
+                       DLIST_REMOVE(cli->seqnum, c);
+                       TALLOC_FREE(c);
+                       return true;
+               }
+       }
+
+       return false;
+}
+
+static uint32_t cli_state_get_seqnum(struct cli_state *cli, uint16_t mid)
+{
+       struct cli_state_seqnum *c;
+
+       for (c = cli->seqnum; c; c = c->next) {
+               if (c->mid == mid) {
+                       uint32_t seqnum = c->seqnum;
+                       if (!c->persistent) {
+                               DLIST_REMOVE(cli->seqnum, c);
+                               TALLOC_FREE(c);
+                       }
+                       return seqnum;
+               }
+       }
+
+       return 0;
+}
+
 /****************************************************************************
  Recv an smb.
 ****************************************************************************/
@@ -142,6 +215,8 @@ static ssize_t client_receive_smb(struct cli_state *cli, size_t maxlen)
 bool cli_receive_smb(struct cli_state *cli)
 {
        ssize_t len;
+       uint16_t mid;
+       uint32_t seqnum;
 
        /* fd == -1 causes segfaults -- Tom (tom@ninja.nl) */
        if (cli->fd == -1)
@@ -177,7 +252,10 @@ bool cli_receive_smb(struct cli_state *cli)
                return false;
        }
 
-       if (!cli_check_sign_mac(cli, cli->inbuf)) {
+       mid = SVAL(cli->inbuf,smb_mid);
+       seqnum = cli_state_get_seqnum(cli, mid);
+
+       if (!cli_check_sign_mac(cli, cli->inbuf, seqnum+1)) {
                /*
                 * If we get a signature failure in sessionsetup, then
                 * the server sometimes just reflects the sent signature
@@ -264,12 +342,20 @@ bool cli_send_smb(struct cli_state *cli)
        ssize_t ret;
        char *buf_out = cli->outbuf;
        bool enc_on = cli_encryption_on(cli);
+       uint32_t seqnum;
 
        /* fd == -1 causes segfaults -- Tom (tom@ninja.nl) */
        if (cli->fd == -1)
                return false;
 
-       cli_calculate_sign_mac(cli, cli->outbuf);
+       cli_calculate_sign_mac(cli, cli->outbuf, &seqnum);
+
+       if (!cli_state_set_seqnum(cli, cli->mid, seqnum)) {
+               DEBUG(0,("Failed to store mid[%u]/seqnum[%u]\n",
+                       (unsigned int)cli->mid,
+                       (unsigned int)seqnum));
+               return false;
+       }
 
        if (enc_on) {
                NTSTATUS status = cli_encrypt_message(cli, cli->outbuf,
@@ -506,6 +592,7 @@ struct cli_state *cli_initialise_ex(int signing_state)
        cli->bufsize = CLI_BUFFER_SIZE+4;
        cli->max_xmit = cli->bufsize;
        cli->outbuf = (char *)SMB_MALLOC(cli->bufsize+SAFETY_MARGIN);
+       cli->seqnum = 0;
        cli->inbuf = (char *)SMB_MALLOC(cli->bufsize+SAFETY_MARGIN);
        cli->oplock_handler = cli_oplock_ack;
        cli->case_sensitive = false;
@@ -556,9 +643,12 @@ struct cli_state *cli_initialise_ex(int signing_state)
 #endif
 
        /* initialise signing */
-       cli->sign_info.allow_smb_signing = allow_smb_signing;
-       cli->sign_info.mandatory_signing = mandatory_signing;
-       cli_null_set_signing(cli);
+       cli->signing_state = smb_signing_init(cli,
+                                             allow_smb_signing,
+                                             mandatory_signing);
+       if (!cli->signing_state) {
+               goto error;
+       }
 
        cli->initialised = 1;
 
@@ -641,7 +731,6 @@ void cli_shutdown(struct cli_state *cli)
        SAFE_FREE(cli->outbuf);
        SAFE_FREE(cli->inbuf);
 
-       cli_free_signing_context(cli);
        data_blob_free(&cli->secblob);
        data_blob_free(&cli->user_session_key);
 
@@ -740,7 +829,6 @@ static void cli_echo_recv_helper(struct async_req *req)
        cli_req->data.echo.num_echos -= 1;
 
        if (cli_req->data.echo.num_echos == 0) {
-               client_set_trans_sign_state_off(cli_req->cli, cli_req->mid);
                async_req_done(req);
                return;
        }
@@ -782,8 +870,6 @@ struct async_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
        }
        req = talloc_get_type_abort(result->private_data, struct cli_request);
 
-       client_set_trans_sign_state_on(cli, req->mid);
-
        req->data.echo.num_echos = num_echos;
        req->data.echo.data.data = talloc_move(req, &data_copy);
        req->data.echo.data.length = data.length;
index 168ca6330332f39f18a909e892442f7390852045..4ab31374e2c712627f521b5015ffeb390dc6628a 100644 (file)
@@ -878,24 +878,30 @@ failed:
 
  bool get_krb5_smb_session_key(krb5_context context, krb5_auth_context auth_context, DATA_BLOB *session_key, bool remote)
  {
-       krb5_keyblock *skey;
-       krb5_error_code err;
-       bool ret = False;
+       krb5_keyblock *skey = NULL;
+       krb5_error_code err = 0;
+       bool ret = false;
 
-       if (remote)
+       if (remote) {
                err = krb5_auth_con_getremotesubkey(context, auth_context, &skey);
-       else
+       } else {
                err = krb5_auth_con_getlocalsubkey(context, auth_context, &skey);
-       if (err == 0 && skey != NULL) {
-               DEBUG(10, ("Got KRB5 session key of length %d\n",  (int)KRB5_KEY_LENGTH(skey)));
-               *session_key = data_blob(KRB5_KEY_DATA(skey), KRB5_KEY_LENGTH(skey));
-               dump_data_pw("KRB5 Session Key:\n", session_key->data, session_key->length);
+       }
 
-               ret = True;
+       if (err || skey == NULL) {
+               DEBUG(10, ("KRB5 error getting session key %d\n", err));
+               goto done;
+       }
 
+       DEBUG(10, ("Got KRB5 session key of length %d\n",  (int)KRB5_KEY_LENGTH(skey)));
+       *session_key = data_blob(KRB5_KEY_DATA(skey), KRB5_KEY_LENGTH(skey));
+       dump_data_pw("KRB5 Session Key:\n", session_key->data, session_key->length);
+
+       ret = true;
+
+ done:
+       if (skey) {
                krb5_free_keyblock(context, skey);
-       } else {
-               DEBUG(10, ("KRB5 error getting session key %d\n", err));
        }
 
        return ret;
diff --git a/source3/libsmb/clisigning.c b/source3/libsmb/clisigning.c
new file mode 100644 (file)
index 0000000..0d0e926
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+   Unix SMB/CIFS implementation.
+   SMB Signing Code
+   Copyright (C) Jeremy Allison 2003.
+   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2002-2003
+   Copyright (C) Stefan Metzmacher 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 "includes.h"
+
+bool cli_simple_set_signing(struct cli_state *cli,
+                           const DATA_BLOB user_session_key,
+                           const DATA_BLOB response)
+{
+       bool ok;
+
+       ok = smb_signing_activate(cli->signing_state,
+                                 user_session_key,
+                                 response);
+       if (!ok) {
+               return false;
+       }
+
+       cli->readbraw_supported = false;
+       cli->writebraw_supported = false;
+
+       return true;
+}
+
+bool cli_temp_set_signing(struct cli_state *cli)
+{
+       return smb_signing_set_bsrspyl(cli->signing_state);
+}
+
+void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum)
+{
+       *seqnum = smb_signing_next_seqnum(cli->signing_state, false);
+       smb_signing_sign_pdu(cli->signing_state, (uint8_t *)buf, *seqnum);
+}
+
+bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum)
+{
+       bool ok;
+
+       ok = smb_signing_check_pdu(cli->signing_state,
+                                  (const uint8_t *)buf,
+                                  seqnum);
+
+       if (!ok) {
+               return false;
+       }
+
+       return true;
+}
+
+void cli_set_signing_negotiated(struct cli_state *cli)
+{
+       smb_signing_set_negotiated(cli->signing_state);
+}
+
+bool client_is_signing_on(struct cli_state *cli)
+{
+       return smb_signing_is_active(cli->signing_state);
+}
+
+bool client_is_signing_allowed(struct cli_state *cli)
+{
+       return smb_signing_is_allowed(cli->signing_state);
+}
+
+bool client_is_signing_mandatory(struct cli_state *cli)
+{
+       return smb_signing_is_mandatory(cli->signing_state);
+}
index 0266c0307e5a296139cd58b5fcb1f7007a11f0b0..c566972b211102e98efb84da0ae6f248eac2d8fa 100644 (file)
@@ -94,14 +94,12 @@ bool cli_send_trans(struct cli_state *cli, int trans,
                return False;
        }
 
-       /* Note we're in a trans state. Save the sequence
-        * numbers for replies. */
-       client_set_trans_sign_state_on(cli, mid);
+       cli_state_seqnum_persistent(cli, mid);
 
        if (this_ldata < ldata || this_lparam < lparam) {
                /* receive interim response */
                if (!cli_receive_smb(cli) || cli_is_error(cli)) {
-                       client_set_trans_sign_state_off(cli, mid);
+                       cli_state_seqnum_remove(cli, mid);
                        return(False);
                }
 
@@ -137,12 +135,11 @@ bool cli_send_trans(struct cli_state *cli, int trans,
 
                        show_msg(cli->outbuf);
 
-                       client_set_trans_sign_state_off(cli, mid);
                        cli->mid = mid;
                        if (!cli_send_smb(cli)) {
+                               cli_state_seqnum_remove(cli, mid);
                                return False;
                        }
-                       client_set_trans_sign_state_on(cli, mid);
 
                        tot_data += this_ldata;
                        tot_param += this_lparam;
@@ -165,10 +162,14 @@ bool cli_receive_trans(struct cli_state *cli,int trans,
        unsigned int this_data,this_param;
        NTSTATUS status;
        bool ret = False;
+       uint16_t mid;
 
        *data_len = *param_len = 0;
 
+       mid = SVAL(cli->inbuf,smb_mid);
+
        if (!cli_receive_smb(cli)) {
+               cli_state_seqnum_remove(cli, mid);
                return False;
        }
 
@@ -179,6 +180,7 @@ bool cli_receive_trans(struct cli_state *cli,int trans,
                DEBUG(0,("Expected %s response, got command 0x%02x\n",
                         trans==SMBtrans?"SMBtrans":"SMBtrans2",
                         CVAL(cli->inbuf,smb_com)));
+               cli_state_seqnum_remove(cli, mid);
                return False;
        }
 
@@ -331,6 +333,8 @@ bool cli_receive_trans(struct cli_state *cli,int trans,
 
   out:
 
+       cli_state_seqnum_remove(cli, mid);
+
        if (ret) {
                /* Ensure the last 2 bytes of param and data are 2 null
                 * bytes. These are malloc'ed, but not included in any
@@ -344,7 +348,6 @@ bool cli_receive_trans(struct cli_state *cli,int trans,
                }
        }
 
-       client_set_trans_sign_state_off(cli, SVAL(cli->inbuf,smb_mid));
        return ret;
 }
 
@@ -412,14 +415,12 @@ bool cli_send_nt_trans(struct cli_state *cli,
                return False;
        }
 
-       /* Note we're in a trans state. Save the sequence
-        * numbers for replies. */
-       client_set_trans_sign_state_on(cli, mid);
+       cli_state_seqnum_persistent(cli, mid);
 
        if (this_ldata < ldata || this_lparam < lparam) {
                /* receive interim response */
                if (!cli_receive_smb(cli) || cli_is_error(cli)) {
-                       client_set_trans_sign_state_off(cli, mid);
+                       cli_state_seqnum_remove(cli, mid);
                        return(False);
                }
 
@@ -454,12 +455,11 @@ bool cli_send_nt_trans(struct cli_state *cli,
 
                        show_msg(cli->outbuf);
 
-                       client_set_trans_sign_state_off(cli, mid);
                        cli->mid = mid;
                        if (!cli_send_smb(cli)) {
+                               cli_state_seqnum_remove(cli, mid);
                                return False;
                        }
-                       client_set_trans_sign_state_on(cli, mid);
 
                        tot_data += this_ldata;
                        tot_param += this_lparam;
@@ -483,10 +483,14 @@ bool cli_receive_nt_trans(struct cli_state *cli,
        uint8 eclass;
        uint32 ecode;
        bool ret = False;
+       uint16_t mid;
 
        *data_len = *param_len = 0;
 
+       mid = SVAL(cli->inbuf,smb_mid);
+
        if (!cli_receive_smb(cli)) {
+               cli_state_seqnum_remove(cli, mid);
                return False;
        }
 
@@ -496,6 +500,7 @@ bool cli_receive_nt_trans(struct cli_state *cli,
        if (CVAL(cli->inbuf,smb_com) != SMBnttrans) {
                DEBUG(0,("Expected SMBnttrans response, got command 0x%02x\n",
                         CVAL(cli->inbuf,smb_com)));
+               cli_state_seqnum_remove(cli, mid);
                return(False);
        }
 
@@ -669,6 +674,8 @@ bool cli_receive_nt_trans(struct cli_state *cli,
 
   out:
 
+       cli_state_seqnum_remove(cli, mid);
+
        if (ret) {
                /* Ensure the last 2 bytes of param and data are 2 null
                 * bytes. These are malloc'ed, but not included in any
@@ -682,7 +689,6 @@ bool cli_receive_nt_trans(struct cli_state *cli,
                }
        }
 
-       client_set_trans_sign_state_off(cli, SVAL(cli->inbuf,smb_mid));
        return ret;
 }
 
@@ -696,6 +702,7 @@ struct cli_trans_state {
        struct event_context *ev;
        uint8_t cmd;
        uint16_t mid;
+       uint32_t seqnum;
        const char *pipe_name;
        uint16_t fid;
        uint16_t function;
@@ -919,6 +926,7 @@ static struct async_req *cli_ship_trans(TALLOC_CTX *mem_ctx,
                cli_req = talloc_get_type_abort(result->private_data,
                                                struct cli_request);
                state->mid = cli_req->mid;
+               state->seqnum = cli_req->seqnum;
        } else {
                uint16_t num_bytes = talloc_get_size(bytes);
                /*
@@ -939,12 +947,10 @@ static struct async_req *cli_ship_trans(TALLOC_CTX *mem_ctx,
                cli_req->recv_helper.fn = cli_trans_recv_helper;
                cli_req->recv_helper.priv = state;
                cli_req->mid = state->mid;
-               client_set_trans_sign_state_off(state->cli, state->mid);
                cli_chain_uncork(state->cli);
+               state->seqnum = cli_req->seqnum;
        }
 
-       client_set_trans_sign_state_on(state->cli, state->mid);
-
  fail:
        TALLOC_FREE(frame);
        return result;
@@ -953,6 +959,8 @@ static struct async_req *cli_ship_trans(TALLOC_CTX *mem_ctx,
 static void cli_trans_ship_rest(struct async_req *req,
                                struct cli_trans_state *state)
 {
+       struct cli_request *cli_req;
+
        state->secondary_request_ctx = talloc_new(state);
        if (state->secondary_request_ctx == NULL) {
                async_req_nterror(req, NT_STATUS_NO_MEMORY);
@@ -961,14 +969,19 @@ static void cli_trans_ship_rest(struct async_req *req,
 
        while ((state->param_sent < state->num_param)
               || (state->data_sent < state->num_data)) {
-               struct async_req *cli_req;
+               struct async_req *subreq;
 
-               cli_req = cli_ship_trans(state->secondary_request_ctx, state);
-               if (cli_req == NULL) {
+               subreq = cli_ship_trans(state->secondary_request_ctx, state);
+               if (subreq == NULL) {
                        async_req_nterror(req, NT_STATUS_NO_MEMORY);
                        return;
                }
        }
+
+       cli_req = talloc_get_type_abort(req->private_data,
+                                       struct cli_request);
+
+       cli_req->seqnum = state->seqnum;
 }
 
 static NTSTATUS cli_pull_trans(struct async_req *req,
@@ -1174,7 +1187,6 @@ static void cli_trans_recv_helper(struct async_req *req)
 
        if ((state->rparam.total == state->rparam.received)
            && (state->rdata.total == state->rdata.received)) {
-               client_set_trans_sign_state_off(state->cli, state->mid);
                async_req_done(req);
        }
 }
index 3491544175a5bedb1891b89936aa3c0a1ffa34b8..1064a63d97f1d465416aaac2ac3e07f935a14074 100644 (file)
@@ -311,7 +311,7 @@ static uint32_t get_cldap_reply_server_flags(struct netlogon_samlogon_response *
 /****************************************************************
 ****************************************************************/
 
-#define RETURN_ON_FALSE(x) if (!x) return false;
+#define RETURN_ON_FALSE(x) if (!(x)) return false;
 
 static bool check_cldap_reply_required_flags(uint32_t ret_flags,
                                             uint32_t req_flags)
index 2255db66170fe872886d0ec9e57658fc4ef74fe2..219bbe64e120bf369174fcfe75ef6e170157de7f 100644 (file)
@@ -1171,7 +1171,8 @@ SMBC_mkdir_ctx(SMBCCTX *context,
                                srv->cli, path,
                                &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
-               TALLOC_FREE(frame);
+                errno = ENOENT;
+                TALLOC_FREE(frame);
                return -1;
        }
        /*d_printf(">>>mkdir: resolved path as %s\n", targetpath);*/
@@ -1278,6 +1279,7 @@ SMBC_rmdir_ctx(SMBCCTX *context,
                                srv->cli, path,
                                &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1561,6 +1563,7 @@ SMBC_chmod_ctx(SMBCCTX *context,
                                srv->cli, path,
                                &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1753,6 +1756,7 @@ SMBC_unlink_ctx(SMBCCTX *context,
                                srv->cli, path,
                                &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1927,6 +1931,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
                                path1,
                                &targetcli1, &targetpath1)) {
                d_printf("Could not resolve %s\n", path1);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1944,6 +1949,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
                                path2,
                                &targetcli2, &targetpath2)) {
                d_printf("Could not resolve %s\n", path2);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
index 06e41ad21eda75b8cd6f2a2b96e35b3cfad65c2b..aa02807092fedcae9e943bf931c2e34b18632617 100644 (file)
@@ -119,6 +119,7 @@ SMBC_open_ctx(SMBCCTX *context,
                                srv->cli, path,
                                &targetcli, &targetpath)) {
                        d_printf("Could not resolve %s\n", path);
+                        errno = ENOENT;
                        SAFE_FREE(file);
                        TALLOC_FREE(frame);
                        return NULL;
@@ -300,6 +301,7 @@ SMBC_read_ctx(SMBCCTX *context,
                        file->srv->cli, path,
                        &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -390,6 +392,7 @@ SMBC_write_ctx(SMBCCTX *context,
                        file->srv->cli, path,
                        &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -466,6 +469,7 @@ SMBC_close_ctx(SMBCCTX *context,
                        file->srv->cli, path,
                        &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -549,6 +553,7 @@ SMBC_getatr(SMBCCTX * context,
                        srv->cli, fixedpath,
                        &targetcli, &targetpath)) {
                d_printf("Couldn't resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return False;
        }
@@ -762,6 +767,7 @@ SMBC_lseek_ctx(SMBCCTX *context,
                                file->srv->cli, path,
                                &targetcli, &targetpath)) {
                        d_printf("Could not resolve %s\n", path);
+                        errno = ENOENT;
                        TALLOC_FREE(frame);
                        return -1;
                }
@@ -854,6 +860,7 @@ SMBC_ftruncate_ctx(SMBCCTX *context,
                        file->srv->cli, path,
                        &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
index dc904d2753892a15e52d5a7a83fe1cc4e374cf16..c2806daddb9294d6f8fdc653abbbd8248cdcebdc 100644 (file)
@@ -261,6 +261,7 @@ SMBC_fstat_ctx(SMBCCTX *context,
                        file->srv->cli, path,
                        &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
index 795c8bc14ca7984ec50bef5f97ad9aab8ac9bb16..2f7305c5b65466c95439391b227fda70e12d18c8 100644 (file)
@@ -136,7 +136,7 @@ NTSTATUS common_ntlm_encrypt_buffer(NTLMSSP_STATE *ntlmssp_state,
 
        smb_set_enclen(buf_out, smb_len(buf) + NTLMSSP_SIG_SIZE, enc_ctx_num);
 
-       sig = data_blob(NULL, NTLMSSP_SIG_SIZE);
+       ZERO_STRUCT(sig);
 
        status = ntlmssp_seal_packet(ntlmssp_state,
                (unsigned char *)buf_out + 8 + NTLMSSP_SIG_SIZE, /* 4 byte len + 0xFF 'S' <enc> <ctx> */
@@ -153,6 +153,7 @@ NTSTATUS common_ntlm_encrypt_buffer(NTLMSSP_STATE *ntlmssp_state,
 
        /* First 16 data bytes are signature for SSPI compatibility. */
        memcpy(buf_out + 8, sig.data, NTLMSSP_SIG_SIZE);
+       data_blob_free(&sig);
        *ppbuf_out = buf_out;
        return NT_STATUS_OK;
 }
index a3ed0e75729523619d259c6990b3545a37433b0b..32d2883965707d612d506017818896f9db48fa6c 100644 (file)
@@ -1,8 +1,9 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    SMB Signing Code
    Copyright (C) Jeremy Allison 2003.
    Copyright (C) Andrew Bartlett <abartlet@samba.org> 2002-2003
+   Copyright (C) Stefan Metzmacher 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
 
 #include "includes.h"
 
-/* Lookup a packet's MID (multiplex id) and figure out it's sequence number */
-struct outstanding_packet_lookup {
-       struct outstanding_packet_lookup *prev, *next;
-       uint16 mid;
-       uint32 reply_seq_num;
-       bool can_delete; /* Set to False in trans state. */
-};
+/* Used by the SMB signing functions. */
 
-struct smb_basic_signing_context {
-       DATA_BLOB mac_key;
-       uint32 send_seq_num;
-       struct outstanding_packet_lookup *outstanding_packet_list;
-};
-
-static bool store_sequence_for_reply(struct outstanding_packet_lookup **list, 
-                                    uint16 mid, uint32 reply_seq_num)
-{
-       struct outstanding_packet_lookup *t;
+struct smb_signing_state {
+       /* is signing localy allowed */
+       bool allowed;
 
-       /* Ensure we only add a mid once. */
-       for (t = *list; t; t = t->next) {
-               if (t->mid == mid) {
-                       return False;
-               }
-       }
+       /* is signing localy mandatory */
+       bool mandatory;
 
-       t = SMB_XMALLOC_P(struct outstanding_packet_lookup);
-       ZERO_STRUCTP(t);
+       /* is signing negotiated by the peer */
+       bool negotiated;
 
-       t->mid = mid;
-       t->reply_seq_num = reply_seq_num;
-       t->can_delete = True;
+       /* send BSRSPYL signatures */
+       bool bsrspyl;
 
-       /*
-        * Add to the *start* of the list not the end of the list.
-        * This ensures that the *last* send sequence with this mid
-        * is returned by preference.
-        * This can happen if the mid wraps and one of the early
-        * mid numbers didn't get a reply and is still lurking on
-        * the list. JRA. Found by Fran Fabrizio <fran@cis.uab.edu>.
-        */
+       bool active; /* Have I ever seen a validly signed packet? */
 
-       DLIST_ADD(*list, t);
-       DEBUG(10,("store_sequence_for_reply: stored seq = %u mid = %u\n",
-                       (unsigned int)reply_seq_num, (unsigned int)mid ));
-       return True;
-}
+       /* mac_key.length > 0 means signing is started */
+       DATA_BLOB mac_key;
 
-static bool get_sequence_for_reply(struct outstanding_packet_lookup **list,
-                                  uint16 mid, uint32 *reply_seq_num)
-{
-       struct outstanding_packet_lookup *t;
-
-       for (t = *list; t; t = t->next) {
-               if (t->mid == mid) {
-                       *reply_seq_num = t->reply_seq_num;
-                       DEBUG(10,("get_sequence_for_reply: found seq = %u mid = %u\n",
-                               (unsigned int)t->reply_seq_num, (unsigned int)t->mid ));
-                       if (t->can_delete) {
-                               DLIST_REMOVE(*list, t);
-                               SAFE_FREE(t);
-                       }
-                       return True;
-               }
-       }
-       return False;
-}
+       /* the next expected seqnum */
+       uint32_t seqnum;
+};
 
-static bool set_sequence_can_delete_flag(struct outstanding_packet_lookup **list, uint16 mid, bool can_delete_entry)
+static void smb_signing_reset_info(struct smb_signing_state *si)
 {
-       struct outstanding_packet_lookup *t;
-
-       for (t = *list; t; t = t->next) {
-               if (t->mid == mid) {
-                       t->can_delete = can_delete_entry;
-                       return True;
-               }
-       }
-       return False;
+       si->active = false;
+       si->bsrspyl = false;
+       data_blob_free(&si->mac_key);
+       si->seqnum = 0;
 }
 
-/***********************************************************
- SMB signing - Common code before we set a new signing implementation
-************************************************************/
-
-static bool cli_set_smb_signing_common(struct cli_state *cli) 
+struct smb_signing_state *smb_signing_init(TALLOC_CTX *mem_ctx,
+                                          bool allowed,
+                                          bool mandatory)
 {
-       if (!cli->sign_info.allow_smb_signing) {
-               return False;
-       }
+       struct smb_signing_state *si;
 
-       if (!cli->sign_info.negotiated_smb_signing 
-           && !cli->sign_info.mandatory_signing) {
-               return False;
+       si = talloc_zero(mem_ctx, struct smb_signing_state);
+       if (si == NULL) {
+               return NULL;
        }
 
-       if (cli->sign_info.doing_signing) {
-               return False;
+       if (mandatory) {
+               allowed = true;
        }
 
-       if (cli->sign_info.free_signing_context)
-               cli->sign_info.free_signing_context(&cli->sign_info);
-
-       /* These calls are INCOMPATIBLE with SMB signing */
-       cli->readbraw_supported = False;
-       cli->writebraw_supported = False;
-
-       return True;
-}
-
-/***********************************************************
- SMB signing - Common code for 'real' implementations
-************************************************************/
-
-static bool set_smb_signing_real_common(struct smb_sign_info *si)
-{
-       if (si->mandatory_signing) {
-               DEBUG(5, ("Mandatory SMB signing enabled!\n"));
-       }
-
-       si->doing_signing = True;
-       DEBUG(5, ("SMB signing enabled!\n"));
-
-       return True;
-}
-
-static void mark_packet_signed(char *outbuf)
-{
-       uint16 flags2;
-       flags2 = SVAL(outbuf,smb_flg2);
-       flags2 |= FLAGS2_SMB_SECURITY_SIGNATURES;
-       SSVAL(outbuf,smb_flg2, flags2);
-}
-
-/***********************************************************
- SMB signing - NULL implementation - calculate a MAC to send.
-************************************************************/
-
-static void null_sign_outgoing_message(char *outbuf, struct smb_sign_info *si)
-{
-       /* we can't zero out the sig, as we might be trying to send a
-          session request - which is NBT-level, not SMB level and doesn't
-          have the field */
-       return;
-}
-
-/***********************************************************
- SMB signing - NULL implementation - check a MAC sent by server.
-************************************************************/
-
-static bool null_check_incoming_message(const char *inbuf,
-                                       struct smb_sign_info *si,
-                                       bool must_be_ok)
-{
-       return True;
-}
-
-/***********************************************************
- SMB signing - NULL implementation - free signing context
-************************************************************/
-
-static void null_free_signing_context(struct smb_sign_info *si)
-{
-       return;
-}
-
-/**
- SMB signing - NULL implementation - setup the MAC key.
-
- @note Used as an initialisation only - it will not correctly
-       shut down a real signing mechanism
-*/
-
-static bool null_set_signing(struct smb_sign_info *si)
-{
-       si->signing_context = NULL;
-
-       si->sign_outgoing_message = null_sign_outgoing_message;
-       si->check_incoming_message = null_check_incoming_message;
-       si->free_signing_context = null_free_signing_context;
-
-       return True;
-}
-
-/**
- * Free the signing context
- */
-
-static void free_signing_context(struct smb_sign_info *si)
-{
-       if (si->free_signing_context) {
-               si->free_signing_context(si);
-               si->signing_context = NULL;
-       }
+       si->allowed = allowed;
+       si->mandatory = mandatory;
 
-       null_set_signing(si);
+       return si;
 }
 
-
-static bool signing_good(const char *inbuf, struct smb_sign_info *si,
-                        bool good, uint32 seq, bool must_be_ok)
+static bool smb_signing_good(struct smb_signing_state *si,
+                            bool good, uint32_t seq)
 {
        if (good) {
-
-               if (!si->doing_signing) {
-                       si->doing_signing = True;
+               if (!si->active) {
+                       si->active = true;
                }
+               return true;
+       }
 
-               if (!si->seen_valid) {
-                       si->seen_valid = True;
-               }
-
-       } else {
-               if (!si->mandatory_signing && !si->seen_valid) {
-
-                       if (!must_be_ok) {
-                               return True;
-                       }
-                       /* Non-mandatory signing - just turn off if this is the first bad packet.. */
-                       DEBUG(5, ("srv_check_incoming_message: signing negotiated but not required and peer\n"
-                                 "isn't sending correct signatures. Turning off.\n"));
-                       si->negotiated_smb_signing = False;
-                       si->allow_smb_signing = False;
-                       si->doing_signing = False;
-                       free_signing_context(si);
-                       return True;
-               } else if (!must_be_ok) {
-                       /* This packet is known to be unsigned */
-                       return True;
-               } else {
-                       /* Mandatory signing or bad packet after signing started - fail and disconnect. */
-                       if (seq)
-                               DEBUG(0, ("signing_good: BAD SIG: seq %u\n", (unsigned int)seq));
-                       return False;
-               }
+       if (!si->mandatory && !si->active) {
+               /* Non-mandatory signing - just turn off if this is the first bad packet.. */
+               DEBUG(5, ("smb_signing_good: signing negotiated but not required and peer\n"
+                         "isn't sending correct signatures. Turning off.\n"));
+               smb_signing_reset_info(si);
+               return true;
        }
-       return True;
-}      
 
-/***********************************************************
- SMB signing - Simple implementation - calculate a MAC on the packet
-************************************************************/
+       /* Mandatory signing or bad packet after signing started - fail and disconnect. */
+       DEBUG(0, ("smb_signing_good: BAD SIG: seq %u\n", (unsigned int)seq));
+       return false;
+}
 
-static void simple_packet_signature(struct smb_basic_signing_context *data, 
-                                   const uchar *buf, uint32 seq_number, 
-                                   unsigned char calc_md5_mac[16])
+static void smb_signing_md5(const DATA_BLOB *mac_key,
+                           const uint8_t *buf, uint32_t seq_number,
+                           uint8_t calc_md5_mac[16])
 {
        const size_t offset_end_of_sig = (smb_ss_field + 8);
-       unsigned char sequence_buf[8];
+       uint8_t sequence_buf[8];
        struct MD5Context md5_ctx;
-#if 0
-        /* JRA - apparently this is incorrect. */
-       unsigned char key_buf[16];
-#endif
 
        /*
         * Firstly put the sequence number into the first 4 bytes.
@@ -282,7 +112,7 @@ static void simple_packet_signature(struct smb_basic_signing_context *data,
         * We do this here, to avoid modifying the packet.
         */
 
-       DEBUG(10,("simple_packet_signature: sequence number %u\n", seq_number ));
+       DEBUG(10,("smb_signing_md5: sequence number %u\n", seq_number ));
 
        SIVAL(sequence_buf, 0, seq_number);
        SIVAL(sequence_buf, 4, 0);
@@ -295,17 +125,7 @@ static void simple_packet_signature(struct smb_basic_signing_context *data,
        MD5Init(&md5_ctx);
 
        /* intialise with the key */
-       MD5Update(&md5_ctx, data->mac_key.data, data->mac_key.length); 
-#if 0
-       /* JRA - apparently this is incorrect. */
-       /* NB. When making and verifying SMB signatures, Windows apparently
-               zero-pads the key to 128 bits if it isn't long enough.
-               From Nalin Dahyabhai <nalin@redhat.com> */
-       if (data->mac_key.length < sizeof(key_buf)) {
-               memset(key_buf, 0, sizeof(key_buf));
-               MD5Update(&md5_ctx, key_buf, sizeof(key_buf) - data->mac_key.length);
-       }
-#endif
+       MD5Update(&md5_ctx, mac_key->data, mac_key->length);
 
        /* copy in the first bit of the SMB header */
        MD5Update(&md5_ctx, buf + 4, smb_ss_field - 4);
@@ -317,690 +137,234 @@ static void simple_packet_signature(struct smb_basic_signing_context *data,
        MD5Update(&md5_ctx, buf + offset_end_of_sig, 
                  smb_len(buf) - (offset_end_of_sig - 4));
 
-       /* calculate the MD5 sig */ 
+       /* calculate the MD5 sig */
        MD5Final(calc_md5_mac, &md5_ctx);
 }
 
-
-/***********************************************************
- SMB signing - Client implementation - send the MAC.
-************************************************************/
-
-static void client_sign_outgoing_message(char *outbuf, struct smb_sign_info *si)
-{
-       unsigned char calc_md5_mac[16];
-       struct smb_basic_signing_context *data =
-               (struct smb_basic_signing_context *)si->signing_context;
-
-       if (!si->doing_signing)
-               return;
-
-       /* JRA Paranioa test - we should be able to get rid of this... */
-       if (smb_len(outbuf) < (smb_ss_field + 8 - 4)) {
-               DEBUG(1, ("client_sign_outgoing_message: Logic error. Can't check signature on short packet! smb_len = %u\n",
-                                       smb_len(outbuf) ));
-               abort();
-       }
-
-       /* mark the packet as signed - BEFORE we sign it...*/
-       mark_packet_signed(outbuf);
-
-       simple_packet_signature(data, (const unsigned char *)outbuf,
-                               data->send_seq_num, calc_md5_mac);
-
-       DEBUG(10, ("client_sign_outgoing_message: sent SMB signature of\n"));
-       dump_data(10, calc_md5_mac, 8);
-
-       memcpy(&outbuf[smb_ss_field], calc_md5_mac, 8);
-
-/*     cli->outbuf[smb_ss_field+2]=0; 
-       Uncomment this to test if the remote server actually verifies signatures...*/
-
-       /* Instead of re-introducing the trans_info_conect we
-          used to have here, we use the fact that during a
-          SMBtrans/SMBtrans2/SMBnttrans send that the mid stays
-          constant. This means that calling store_sequence_for_reply()
-          will return False for all trans secondaries, as the mid is already
-          on the stored sequence list. As the send_seqence_number must
-          remain constant for all primary+secondary trans sends, we
-          only increment the send sequence number when we successfully
-          add a new entry to the outstanding sequence list. This means
-          I can isolate the fix here rather than re-adding the trans
-          signing on/off calls in libsmb/clitrans2.c JRA.
-        */
-
-       if (store_sequence_for_reply(&data->outstanding_packet_list, SVAL(outbuf,smb_mid), data->send_seq_num + 1)) {
-               data->send_seq_num += 2;
-       }
-}
-
-/***********************************************************
- SMB signing - Client implementation - check a MAC sent by server.
-************************************************************/
-
-static bool client_check_incoming_message(const char *inbuf,
-                                         struct smb_sign_info *si,
-                                         bool must_be_ok)
+uint32_t smb_signing_next_seqnum(struct smb_signing_state *si, bool oneway)
 {
-       bool good;
-       uint32 reply_seq_number;
-       unsigned char calc_md5_mac[16];
-       unsigned char *server_sent_mac;
-
-       struct smb_basic_signing_context *data =
-               (struct smb_basic_signing_context *)si->signing_context;
+       uint32_t seqnum;
 
-       if (!si->doing_signing)
-               return True;
-
-       if (smb_len(inbuf) < (smb_ss_field + 8 - 4)) {
-               DEBUG(1, ("client_check_incoming_message: Can't check signature on short packet! smb_len = %u\n", smb_len(inbuf)));
-               return False;
+       if (si->mac_key.length == 0) {
+               return 0;
        }
 
-       if (!get_sequence_for_reply(&data->outstanding_packet_list, SVAL(inbuf, smb_mid), &reply_seq_number)) {
-               DEBUG(1, ("client_check_incoming_message: received message "
-                       "with mid %u with no matching send record.\n", (unsigned int)SVAL(inbuf, smb_mid) ));
-               return False;
-       }
-
-       simple_packet_signature(data, (const unsigned char *)inbuf,
-                               reply_seq_number, calc_md5_mac);
-
-       server_sent_mac = (unsigned char *)&inbuf[smb_ss_field];
-       good = (memcmp(server_sent_mac, calc_md5_mac, 8) == 0);
-
-       if (!good) {
-               DEBUG(5, ("client_check_incoming_message: BAD SIG: wanted SMB signature of\n"));
-               dump_data(5, calc_md5_mac, 8);
-
-               DEBUG(5, ("client_check_incoming_message: BAD SIG: got SMB signature of\n"));
-               dump_data(5, server_sent_mac, 8);
-#if 1 /* JRATEST */
-               {
-                       int i;
-                       for (i = -5; i < 5; i++) {
-                               simple_packet_signature(data, (const unsigned char *)inbuf, reply_seq_number+i, calc_md5_mac);
-                               if (memcmp(server_sent_mac, calc_md5_mac, 8) == 0) {
-                                       DEBUG(0,("client_check_incoming_message: out of seq. seq num %u matches. \
-We were expecting seq %u\n", reply_seq_number+i, reply_seq_number ));
-                                       break;
-                               }
-                       }
-               }
-#endif /* JRATEST */
-
+       seqnum = si->seqnum;
+       if (oneway) {
+               si->seqnum += 1;
        } else {
-               DEBUG(10, ("client_check_incoming_message: seq %u: got good SMB signature of\n", (unsigned int)reply_seq_number));
-               dump_data(10, server_sent_mac, 8);
-       }
-       return signing_good(inbuf, si, good, reply_seq_number, must_be_ok);
-}
-
-/***********************************************************
- SMB signing - Simple implementation - free signing context
-************************************************************/
-
-static void simple_free_signing_context(struct smb_sign_info *si)
-{
-       struct smb_basic_signing_context *data =
-               (struct smb_basic_signing_context *)si->signing_context;
-       struct outstanding_packet_lookup *list;
-       struct outstanding_packet_lookup *next;
-
-       for (list = data->outstanding_packet_list; list; list = next) {
-               next = list->next;
-               DLIST_REMOVE(data->outstanding_packet_list, list);
-               SAFE_FREE(list);
+               si->seqnum += 2;
        }
 
-       data_blob_free(&data->mac_key);
-
-       SAFE_FREE(si->signing_context);
-
-       return;
+       return seqnum;
 }
 
-/***********************************************************
- SMB signing - Simple implementation - setup the MAC key.
-************************************************************/
-
-bool cli_simple_set_signing(struct cli_state *cli,
-                           const DATA_BLOB user_session_key,
-                           const DATA_BLOB response)
+void smb_signing_cancel_reply(struct smb_signing_state *si, bool oneway)
 {
-       struct smb_basic_signing_context *data;
-
-       if