The branch, master has been updated
       via  5adb169 s4-torture: Add LZX compressed cabinet test
       via  6361559 s4-torture: Add MSZIP compressed cabinet test
       via  9ddf9bf s4-torture: Add a validation test for uncompressed Cabinet 
files
       via  d5dd99a s4-torture: Introduce Cabinet ndr testsuite
       via  e91895f librpc: Add ndr_cab_get_compression() for Cabinet 
compression evaluation
       via  983dac4 librpc: Add autogenerated file offset calculation for 
Cabinet files
       via  59ae0e5 librpc: Add autogenerated total cabinet size for Cabinet 
files
       via  4cc4fca librpc: Add autogenerated checksum calculation for Cabinet 
files
       via  88e1c4d librpc: Introduce cab.idl
       via  20eadb5 s3-rpcclient: Add AsyncCorePrinterDriverInstalled command
       via  53be405 s3-rpcclient: Add rpcclient IRemoteWinspool commands
       via  bc0aa24 s3-rpc_cli: Support the use of the object_uuid in rpc_cli 
interfaces
      from  60fd6a3 WHATSNEW: document new inherit owner option

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5adb1693bd4e796320ed0fc215aaff82e614a6ad
Author: Günther Deschner <g...@samba.org>
Date:   Fri Sep 23 17:19:59 2016 +0200

    s4-torture: Add LZX compressed cabinet test
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    
    Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org>
    Autobuild-Date(master): Fri Nov 25 00:17:02 CET 2016 on sn-devel-144

commit 6361559f41e7dc2bb5251683b3bb7debab080799
Author: Günther Deschner <g...@samba.org>
Date:   Fri Sep 23 17:19:25 2016 +0200

    s4-torture: Add MSZIP compressed cabinet test
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 9ddf9bfb41b6e1b569126892f6acb8e18e14ed23
Author: Günther Deschner <g...@samba.org>
Date:   Fri Sep 23 17:20:30 2016 +0200

    s4-torture: Add a validation test for uncompressed Cabinet files
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit d5dd99a95f5fc199eb0caf849177c93e613e590d
Author: Günther Deschner <g...@samba.org>
Date:   Fri Sep 23 17:18:12 2016 +0200

    s4-torture: Introduce Cabinet ndr testsuite
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit e91895f41158a40c09bf145234b0cf45df0ea8c5
Author: Günther Deschner <g...@samba.org>
Date:   Tue Sep 20 00:20:18 2016 +0200

    librpc: Add ndr_cab_get_compression() for Cabinet compression evaluation
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 983dac44f282cc570fb4a576416bd851c18eddd0
Author: Günther Deschner <g...@samba.org>
Date:   Sat Sep 24 02:51:20 2016 +0200

    librpc: Add autogenerated file offset calculation for Cabinet files
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 59ae0e5f3423d08c30af990199bb23411949e82a
Author: Günther Deschner <g...@samba.org>
Date:   Wed Sep 21 01:46:54 2016 +0200

    librpc: Add autogenerated total cabinet size for Cabinet files
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 4cc4fca23e892250f44a8b6240ab2a488919f6a3
Author: Günther Deschner <g...@samba.org>
Date:   Fri Sep 16 00:15:30 2016 +0200

    librpc: Add autogenerated checksum calculation for Cabinet files
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 88e1c4dc44388f554dd3cf09ec932009586a227f
Author: Günther Deschner <g...@samba.org>
Date:   Thu Sep 15 13:36:35 2016 +0200

    librpc: Introduce cab.idl
    
    This allows processing of Windows Cabinet files (required for the MS-PAR
    print protocol implementation)
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 20eadb5f9a8f68e90c6d33ac78b65255a7631797
Author: Günther Deschner <g...@samba.org>
Date:   Tue Nov 22 12:07:23 2016 +0100

    s3-rpcclient: Add AsyncCorePrinterDriverInstalled command
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 53be405e8e958bb4ef9012753634572d89aee23d
Author: Günther Deschner <g...@samba.org>
Date:   Tue Jan 15 15:22:43 2013 +0100

    s3-rpcclient: Add rpcclient IRemoteWinspool commands
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit bc0aa242c5c1aafab2ba9eff953ace2c34bceee4
Author: Günther Deschner <g...@samba.org>
Date:   Wed Jan 23 10:34:12 2013 +0100

    s3-rpc_cli: Support the use of the object_uuid in rpc_cli interfaces
    
    Guenther
    
    Signed-off-by: Guenther Deschner <g...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 librpc/idl/cab.idl                                |  135 +
 librpc/idl/wscript_build                          |   11 +-
 librpc/ndr/ndr_cab.c                              |  246 ++
 lib/dbwrap/dbwrap_cache.h => librpc/ndr/ndr_cab.h |   18 +-
 librpc/wscript_build                              |    7 +
 source3/rpc_client/cli_pipe.c                     |   11 +-
 source3/rpcclient/cmd_iremotewinspool.c           |  177 +
 source3/rpcclient/rpcclient.c                     |    2 +
 source3/rpcclient/wscript_build                   |    2 +
 source4/librpc/wscript_build                      |   72 +-
 source4/torture/ndr/cabinet.c                     | 4323 +++++++++++++++++++++
 source4/torture/ndr/ndr.c                         |    1 +
 source4/torture/wscript_build                     |    1 +
 13 files changed, 4980 insertions(+), 26 deletions(-)
 create mode 100644 librpc/idl/cab.idl
 create mode 100644 librpc/ndr/ndr_cab.c
 copy lib/dbwrap/dbwrap_cache.h => librpc/ndr/ndr_cab.h (70%)
 create mode 100644 source3/rpcclient/cmd_iremotewinspool.c
 create mode 100644 source4/torture/ndr/cabinet.c


Changeset truncated at 500 lines:

diff --git a/librpc/idl/cab.idl b/librpc/idl/cab.idl
new file mode 100644
index 0000000..2174bce
--- /dev/null
+++ b/librpc/idl/cab.idl
@@ -0,0 +1,135 @@
+#include "idl_types.h"
+
+import "misc.idl";
+
+/*
+   IDL structures defining Cabinet files
+
+   more info can be found at:
+   https://msdn.microsoft.com/en-us/library/bb267310.aspx#cabinet_format
+*/
+
+[
+       pointer_default(unique),
+       helper("../librpc/ndr/ndr_cab.h"),
+       helpstring("Cabinet structure"),
+       uuid("12345678-0000-0000-0000-00000000")
+]
+       interface cab
+{
+
+       /*
+        * flags.cfhdrPREV_CABINET is set if this cabinet file is not the first 
in
+        * a set of cabinet files. When this bit is set, the szCabinetPrev and
+        * szDiskPrev fields are present in this CFHEADER.
+        *
+        * flags.cfhdrNEXT_CABINET is set if this cabinet file is not the last 
in a
+        * set of cabinet files. When this bit is set, the szCabinetNext and
+        * szDiskNext fields are present in this CFHEADER.
+        *
+        * flags.cfhdrRESERVE_PRESENT is set if this cabinet file contains any
+        * reserved fields. When this bit is set, the cbCFHeader, cbCFFolder, 
and
+        * cbCFData fields are present in this CFHEADER.
+        */
+
+       typedef [bitmap16bit] bitmap {
+               cfhdrPREV_CABINET       = 0x0001,
+               cfhdrNEXT_CABINET       = 0x0002,
+               cfhdrRESERVE_PRESENT    = 0x0004
+       } cf_flags;
+
+       typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct {
+               [charset(DOS),value("MSCF")] uint8 signature[4];
+               [value(0)] uint32 reserved1;    /* reserved */
+               uint32 cbCabinet;               /* size of this cabinet file in 
bytes */
+               [value(0)] uint32 reserved2;    /* reserved */
+               [value(cFolders*8+36)] uint32 coffFiles;                /* 
offset of the first CFFILE entry */
+               [value(0)] uint32 reserved3;    /* reserved */
+               [value(3)] uint8 versionMinor;  /* cabinet file format version, 
minor */
+               [value(1)] uint8 versionMajor;  /* cabinet file format version, 
major */
+               uint16 cFolders;                /* number of CFFOLDER entries 
in this cabinet */
+               uint16 cFiles;                  /* number of CFFILE entries in 
this cabinet */
+               cf_flags flags;                 /* cabinet file option 
indicators */
+               uint16 setID;                   /* must be the same for all 
cabinets in a set */
+               uint16 iCabinet;                /* number of this cabinet file 
in a set */
+#if 0
+               [range(0,60000)] uint16 cbCFHeader;     /* (optional) size of 
per-cabinet reserved area */
+               [range(0,255)] uint8 cbCFFolder;        /* (optional) size of 
per-folder reserved area */
+               [range(0,255)] uint8 cbCFData;          /* (optional) size of 
per-datablock reserved area */
+               uint8 abReserve[];              /* (optional) per-cabinet 
reserved area */
+               uint8 szCabinetPrev[];          /* (optional) name of previous 
cabinet file */
+               uint8 szDiskPrev[];             /* (optional) name of previous 
disk */
+               uint8 szCabinetNext[];          /* (optional) name of next 
cabinet file */
+               uint8 szDiskNext[];             /* (optional) name of next disk 
*/
+#endif
+       } CFHEADER;
+
+       typedef enum {
+               CF_COMPRESS_NONE = 0,
+               CF_COMPRESS_MSZIP = 1,
+               CF_COMPRESS_LZX = 4611
+       } cf_compress_type;
+
+       typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct {
+               uint32 coffCabStart;    /* offset of the first CFDATA block in 
this folder */
+               uint16 cCFData;         /* number of CFDATA blocks in this 
folder */
+               cf_compress_type typeCompress;  /* compression type indicator */
+#if 0
+               uint8 abReserve[];      /* (optional) per-folder reserved area 
*/
+#endif
+       } CFFOLDER;
+
+       const int ifoldCONTINUED_FROM_PREV      = 0xFFFD;
+       const int ifoldCONTINUED_TO_NEXT        = 0xFFFE;
+       const int ifoldCONTINUED_PREV_AND_NEXT  = 0xFFFF;
+
+       typedef [bitmap16bit] bitmap {
+               _A_RDONLY       = 0x01,  /* file is read-only */
+               _A_HIDDEN       = 0x02,  /* file is hidden */
+               _A_SYSTEM       = 0x04,  /* file is a system file */
+               _A_ARCH         = 0x20,  /* file modified since last backup */
+               _A_EXEC         = 0x40,  /* run after extraction */
+               _A_NAME_IS_UTF  = 0x80  /* szName[] contains UTF */
+       } cf_attributes;
+
+       typedef [noprint,flag(NDR_NOALIGN)] struct {
+               uint16 date;
+       } cf_date;
+
+       typedef [noprint,flag(NDR_NOALIGN)] struct {
+               uint16 time;
+       } cf_time;
+
+       typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN),gensize] 
struct {
+               uint32 cbFile;          /* uncompressed size of this file in 
bytes */
+               uint32 uoffFolderStart; /* uncompressed offset of this file in 
the folder */
+               uint16 iFolder;         /* index into the CFFOLDER area */
+               cf_date date;           /* date stamp for this file */
+               cf_time time;           /* time stamp for this file */
+               cf_attributes attribs;  /* attribute flags for this file */
+               [flag(r->attribs & _A_NAME_IS_UTF ? STR_UTF8|STR_NULLTERM : 
STR_ASCII|STR_NULLTERM)] string szName;
+       } CFFILE;
+
+       typedef [public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct {
+               [value(ndr_cab_generate_checksum(r))] uint32 csum;              
/* checksum of this CFDATA entry */
+               uint16 cbData;          /* number of compressed bytes in this 
block */
+               uint16 cbUncomp;        /* number of uncompressed bytes in this 
block */
+#if 0
+               uint8 abReserve[];      /* (optional) per-datablock reserved 
area */
+#endif
+               uint8 ab[cbData];       /* compressed data bytes */
+       } CFDATA;
+
+       typedef 
[nopush,nopull,public,flag(NDR_PAHEX|NDR_LITTLE_ENDIAN|NDR_NOALIGN)] struct {
+               CFHEADER cfheader;
+               CFFOLDER cffolders[cfheader.cFolders];
+               CFFILE cffiles[cfheader.cFiles];
+               [noprint,value(ndr_count_cfdata(r))] uint32 cfdata_count;
+               CFDATA cfdata[cfdata_count];
+       } cab_file;
+
+       void decode_cab_file(
+               [in] cab_file file
+               );
+
+}
diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build
index 13b29b2..1f09ae0 100644
--- a/librpc/idl/wscript_build
+++ b/librpc/idl/wscript_build
@@ -34,8 +34,15 @@ bld.SAMBA_PIDL_LIST('PIDL',
                     output_dir='../gen_ndr')
 
 bld.SAMBA_PIDL_LIST('PIDL',
-                    '''rap.idl ntprinting.idl preg.idl ioctl.idl printcap.idl
-                       fsrvp_state.idl''',
+                    '''
+                    rap.idl
+                    ntprinting.idl
+                    preg.idl
+                    ioctl.idl
+                    printcap.idl
+                    fsrvp_state.idl
+                    cab.idl
+                    ''',
                     options='--header --ndr-parser',
                     output_dir='../gen_ndr')
 
diff --git a/librpc/ndr/ndr_cab.c b/librpc/ndr/ndr_cab.c
new file mode 100644
index 0000000..0d2b36b
--- /dev/null
+++ b/librpc/ndr/ndr_cab.c
@@ -0,0 +1,246 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   routines for marshalling/unmarshalling cab structures
+
+   Copyright (C) Guenther Deschner 2016
+
+   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 "librpc/gen_ndr/ndr_cab.h"
+
+_PUBLIC_ void ndr_print_cf_time(struct ndr_print *ndr, const char *name, const 
struct cf_time *r)
+{
+       uint8_t hour = 0, minute = 0, seconds = 0;
+       char *s;
+       if (r == NULL) { ndr_print_null(ndr); return; }
+       hour = r->time >> 11;
+       minute = (r->time >> 5) & 0x3f;
+       seconds = (r->time << 1) & 0x3e;
+       s = talloc_asprintf(ndr, "%02d:%02d:%02d", hour, minute, seconds);
+       if (s == NULL) { return; }
+       ndr_print_string(ndr, "time", s);
+       talloc_free(s);
+}
+
+_PUBLIC_ void ndr_print_cf_date(struct ndr_print *ndr, const char *name, const 
struct cf_date *r)
+{
+       uint16_t year = 0;
+       uint8_t month = 0, day = 0;
+       char *s;
+       if (r == NULL) { ndr_print_null(ndr); return; }
+       year = (r->date >> 9);
+       year += 1980;
+       month = (r->date >> 5 & 0xf);
+       day = (r->date & 0x1f);
+       s = talloc_asprintf(ndr, "%02d/%02d/%04d", day, month, year);
+       if (s == NULL) { return; }
+       ndr_print_string(ndr, "date", s);
+       talloc_free(s);
+}
+
+uint32_t ndr_count_cfdata(const struct cab_file *r)
+{
+       uint32_t count = 0, i;
+
+       for (i = 0; i < r->cfheader.cFolders; i++) {
+               count += r->cffolders[i].cCFData;
+       }
+
+       return count;
+}
+
+static uint32_t ndr_cab_compute_checksum(uint8_t *data, uint32_t length, 
uint32_t seed)
+{
+       int num_ulong;
+       uint32_t checksum;
+       uint8_t *pb;
+       uint32_t ul;
+
+       num_ulong = length / 4;
+       checksum = seed;
+       pb = data;
+
+       while (num_ulong-- > 0) {
+               ul = *pb++;
+               ul |= (((uint32_t)(*pb++)) <<  8);
+               ul |= (((uint32_t)(*pb++)) << 16);
+               ul |= (((uint32_t)(*pb++)) << 24);
+
+               checksum ^= ul;
+       }
+
+       ul = 0;
+
+       switch (length % 4) {
+       case 3:
+               ul |= (((uint32_t)(*pb++)) << 16);
+       case 2:
+               ul |= (((uint32_t)(*pb++)) <<  8);
+       case 1:
+               ul |= *pb++;
+       default:
+               break;
+       }
+
+       checksum ^= ul;
+
+       return checksum;
+}
+
+uint32_t ndr_cab_generate_checksum(const struct CFDATA *r)
+{
+       uint32_t csumPartial;
+
+       csumPartial = ndr_cab_compute_checksum(&r->ab[0], r->cbData, 0);
+
+       return ndr_cab_compute_checksum((uint8_t *)discard_const(&r->cbData),
+                                       sizeof(r->cbData) + sizeof(r->cbUncomp),
+                                       csumPartial);
+}
+
+static uint32_t ndr_size_cab_file(const struct cab_file *r)
+{
+       uint32_t size = 0;
+       int i;
+
+       /* header */
+       size += 36;
+
+       /* folder */
+       for (i = 0; i < r->cfheader.cFolders; i++) {
+               size += 8;
+       }
+
+       /* files */
+       for (i = 0; i < r->cfheader.cFiles; i++) {
+               size += ndr_size_CFFILE(&r->cffiles[i], 0);
+       }
+
+       /* data */
+       for (i = 0; i < ndr_count_cfdata(r); i++) {
+               size += 8 + r->cfdata[i].cbData;
+       }
+
+       return size;
+}
+
+enum cf_compress_type ndr_cab_get_compression(const struct cab_file *r)
+{
+       if (r->cfheader.cFolders == 0) {
+               return CF_COMPRESS_NONE;
+       }
+
+       return r->cffolders[0].typeCompress;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_cab_file(struct ndr_push *ndr, int 
ndr_flags, const struct cab_file *r)
+{
+       uint32_t cntr_cffolders_0;
+       uint32_t cntr_cffiles_0;
+       uint32_t cntr_cfdata_0;
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, 
LIBNDR_PRINT_ARRAY_HEX|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NOALIGN);
+               NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
+               if (ndr_flags & NDR_SCALARS) {
+                       uint32_t next_offset = 0;
+                       NDR_CHECK(ndr_push_align(ndr, 4));
+                       NDR_CHECK(ndr_push_CFHEADER(ndr, NDR_SCALARS, 
&r->cfheader));
+                       for (cntr_cffolders_0 = 0; cntr_cffolders_0 < 
(r->cfheader.cFolders); cntr_cffolders_0++) {
+                               NDR_CHECK(ndr_push_CFFOLDER(ndr, NDR_SCALARS, 
&r->cffolders[cntr_cffolders_0]));
+                       }
+                       for (cntr_cffiles_0 = 0; cntr_cffiles_0 < 
(r->cfheader.cFiles); cntr_cffiles_0++) {
+                               uint32_t offset = ndr->offset + 4;
+                               NDR_CHECK(ndr_push_CFFILE(ndr, NDR_SCALARS, 
&r->cffiles[cntr_cffiles_0]));
+                               if (cntr_cffiles_0 > 0) {
+                                       next_offset += 
r->cffiles[cntr_cffiles_0 - 1].cbFile;
+                               }
+                               SIVAL(ndr->data, offset, next_offset);
+                       }
+#if 0
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 
ndr_count_cfdata(r)));
+#endif
+                       for (cntr_cfdata_0 = 0; cntr_cfdata_0 < 
(ndr_count_cfdata(r)); cntr_cfdata_0++) {
+                               NDR_CHECK(ndr_push_CFDATA(ndr, NDR_SCALARS, 
&r->cfdata[cntr_cfdata_0]));
+                       }
+                       NDR_CHECK(ndr_push_trailer_align(ndr, 4));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+
+       SIVAL(ndr->data, 8, ndr_size_cab_file(r));
+
+       return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_cab_file(struct ndr_pull *ndr, int 
ndr_flags, struct cab_file *r)
+{
+       uint32_t size_cffolders_0 = 0;
+       uint32_t cntr_cffolders_0;
+       TALLOC_CTX *_mem_save_cffolders_0 = NULL;
+       uint32_t size_cffiles_0 = 0;
+       uint32_t cntr_cffiles_0;
+       TALLOC_CTX *_mem_save_cffiles_0 = NULL;
+       uint32_t size_cfdata_0 = 0;
+       uint32_t cntr_cfdata_0;
+       TALLOC_CTX *_mem_save_cfdata_0 = NULL;
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, 
LIBNDR_PRINT_ARRAY_HEX|LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NOALIGN);
+               NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_pull_align(ndr, 4));
+                       NDR_CHECK(ndr_pull_CFHEADER(ndr, NDR_SCALARS, 
&r->cfheader));
+                       size_cffolders_0 = r->cfheader.cFolders;
+                       NDR_PULL_ALLOC_N(ndr, r->cffolders, size_cffolders_0);
+                       _mem_save_cffolders_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->cffolders, 0);
+                       for (cntr_cffolders_0 = 0; cntr_cffolders_0 < 
(size_cffolders_0); cntr_cffolders_0++) {
+                               NDR_CHECK(ndr_pull_CFFOLDER(ndr, NDR_SCALARS, 
&r->cffolders[cntr_cffolders_0]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_cffolders_0, 0);
+                       size_cffiles_0 = r->cfheader.cFiles;
+                       NDR_PULL_ALLOC_N(ndr, r->cffiles, size_cffiles_0);
+                       _mem_save_cffiles_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->cffiles, 0);
+                       for (cntr_cffiles_0 = 0; cntr_cffiles_0 < 
(size_cffiles_0); cntr_cffiles_0++) {
+                               NDR_CHECK(ndr_pull_CFFILE(ndr, NDR_SCALARS, 
&r->cffiles[cntr_cffiles_0]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_cffiles_0, 0);
+#if 0
+                       NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, 
&r->cfdata_count));
+#else
+                       r->cfdata_count = ndr_count_cfdata(r);
+#endif
+                       size_cfdata_0 = r->cfdata_count;
+                       NDR_PULL_ALLOC_N(ndr, r->cfdata, size_cfdata_0);
+                       _mem_save_cfdata_0 = NDR_PULL_GET_MEM_CTX(ndr);
+                       NDR_PULL_SET_MEM_CTX(ndr, r->cfdata, 0);
+                       for (cntr_cfdata_0 = 0; cntr_cfdata_0 < 
(size_cfdata_0); cntr_cfdata_0++) {
+                               NDR_CHECK(ndr_pull_CFDATA(ndr, NDR_SCALARS, 
&r->cfdata[cntr_cfdata_0]));
+                       }
+                       NDR_PULL_SET_MEM_CTX(ndr, _mem_save_cfdata_0, 0);
+                       NDR_CHECK(ndr_pull_trailer_align(ndr, 4));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
diff --git a/lib/dbwrap/dbwrap_cache.h b/librpc/ndr/ndr_cab.h
similarity index 70%
copy from lib/dbwrap/dbwrap_cache.h
copy to librpc/ndr/ndr_cab.h
index e69d58e..7987153 100644
--- a/lib/dbwrap/dbwrap_cache.h
+++ b/librpc/ndr/ndr_cab.h
@@ -1,7 +1,9 @@
 /*
    Unix SMB/CIFS implementation.
-   Database interface wrapper around ctdbd
-   Copyright (C) Volker Lendecke 2012
+
+   routines for marshalling/unmarshalling cab structures
+
+   Copyright (C) Guenther Deschner 2016
 
    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
@@ -17,12 +19,6 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef __DBWRAP_CACHE_H__
-#define __DBWRAP_CACHE_H__
-
-#include "dbwrap.h"
-
-struct db_context *db_open_cache(TALLOC_CTX *mem_ctx,
-                                struct db_context *backing);
-
-#endif /* __DBWRAP_CACHE_H__ */
+uint32_t ndr_count_cfdata(const struct cab_file *r);
+uint32_t ndr_cab_generate_checksum(const struct CFDATA *r);
+enum cf_compress_type ndr_cab_get_compression(const struct cab_file *r);
diff --git a/librpc/wscript_build b/librpc/wscript_build
index 1c7cc0a..2b4cc05 100644
--- a/librpc/wscript_build
+++ b/librpc/wscript_build
@@ -423,6 +423,13 @@ bld.SAMBA_SUBSYSTEM('NDR_PREG',
     public_deps='ndr'
     )
 
+bld.SAMBA_SUBSYSTEM('NDR_CAB',
+    source='''
+           gen_ndr/ndr_cab.c
+           ndr/ndr_cab.c
+           ''',
+    public_deps='ndr')
+
 bld.SAMBA_SUBSYSTEM('NDR_FILE_ID',
     source='gen_ndr/ndr_file_id.c',
     public_deps='ndr'
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index f288156..5418fbe 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -1286,6 +1286,7 @@ struct rpc_api_pipe_req_state {
        uint8_t op_num;
        uint32_t call_id;
        const DATA_BLOB *req_data;
+       const struct GUID *object_uuid;
        uint32_t req_data_sent;
        DATA_BLOB req_trailer;
        uint32_t req_trailer_sent;
@@ -1305,6 +1306,7 @@ static struct tevent_req 
*rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
                                         struct tevent_context *ev,
                                         struct rpc_pipe_client *cli,
                                         uint8_t op_num,
+                                        const struct GUID *object_uuid,
                                         const DATA_BLOB *req_data)
 {
        struct tevent_req *req, *subreq;
@@ -1320,6 +1322,7 @@ static struct tevent_req 
*rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
        state->ev = ev;
        state->cli = cli;
        state->op_num = op_num;
+       state->object_uuid = object_uuid;
        state->req_data = req_data;
        state->req_data_sent = 0;
        state->call_id = get_rpc_call_id();
@@ -1555,6 +1558,12 @@ static NTSTATUS prepare_next_frag(struct 
rpc_api_pipe_req_state *state,
        u.request.context_id    = 0;
        u.request.opnum         = state->op_num;
 


-- 
Samba Shared Repository

Reply via email to