Author: jelmer
Date: 2007-11-20 11:40:41 +0000 (Tue, 20 Nov 2007)
New Revision: 26059

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26059

Log:
Merge upstream.
Modified:
   branches/4.0-python/
   branches/4.0-python/source/librpc/ndr/libndr.h
   branches/4.0-python/source/librpc/ndr/ndr.c
   branches/4.0-python/source/librpc/ndr/ndr_basic.c
   branches/4.0-python/source/librpc/ndr/ndr_krb5pac.c
   branches/4.0-python/source/librpc/ndr/ndr_string.c
   branches/4.0-python/source/ntvfs/ipc/ipc_rap.c
   branches/4.0-python/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
   branches/4.0-python/source/torture/rpc/spoolss.c


Changeset:

Property changes on: branches/4.0-python
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:ancestry:v3-trunk0
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...
Name: svk:merge
...skipped...

Modified: branches/4.0-python/source/librpc/ndr/libndr.h
===================================================================
--- branches/4.0-python/source/librpc/ndr/libndr.h      2007-11-20 11:40:37 UTC 
(rev 26058)
+++ branches/4.0-python/source/librpc/ndr/libndr.h      2007-11-20 11:40:41 UTC 
(rev 26059)
@@ -67,12 +67,6 @@
        uint32_t ptr_count;
 };
 
-struct ndr_pull_save {
-       uint32_t data_size;
-       uint32_t offset;
-       struct ndr_pull_save *next;
-};
-
 /* structure passed to functions that generate NDR formatted data */
 struct ndr_push {
        uint32_t flags; /* LIBNDR_FLAG_* */
@@ -92,12 +86,6 @@
        uint32_t ptr_count;
 };
 
-struct ndr_push_save {
-       uint32_t offset;
-       struct ndr_push_save *next;
-};
-
-
 /* structure passed to functions that print IDL structures */
 struct ndr_print {
        uint32_t flags; /* LIBNDR_FLAG_* */

Modified: branches/4.0-python/source/librpc/ndr/ndr.c
===================================================================
--- branches/4.0-python/source/librpc/ndr/ndr.c 2007-11-20 11:40:37 UTC (rev 
26058)
+++ branches/4.0-python/source/librpc/ndr/ndr.c 2007-11-20 11:40:41 UTC (rev 
26059)
@@ -98,21 +98,6 @@
        return NDR_ERR_SUCCESS;
 }
 
-/* save the offset/size of the current ndr state */
-_PUBLIC_ void ndr_pull_save(struct ndr_pull *ndr, struct ndr_pull_save *save)
-{
-       save->offset = ndr->offset;
-       save->data_size = ndr->data_size;
-}
-
-/* restore the size/offset of a ndr structure */
-_PUBLIC_ void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save 
*save)
-{
-       ndr->offset = save->offset;
-       ndr->data_size = save->data_size;
-}
-
-
 /* create a ndr_push structure, ready for some marshalling */
 _PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx)
 {
@@ -914,12 +899,12 @@
 */
 _PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2(struct ndr_push *ndr, const 
void *p)
 {
-       struct ndr_push_save save;
+       uint32_t save_offset;
        uint32_t ptr_offset = 0xFFFFFFFF;
        if (p == NULL) {
                return NDR_ERR_SUCCESS;
        }
-       ndr_push_save(ndr, &save);
+       save_offset = ndr->offset;
        NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &ptr_offset));
        if (ptr_offset > ndr->offset) {
                return ndr_push_error(ndr, NDR_ERR_BUFSIZE, 
@@ -927,13 +912,13 @@
                                      ptr_offset, ndr->offset);
        }
        ndr->offset = ptr_offset;
-       if (save.offset < ndr->relative_base_offset) {
+       if (save_offset < ndr->relative_base_offset) {
                return ndr_push_error(ndr, NDR_ERR_BUFSIZE, 
-                                     "ndr_push_relative_ptr2 save.offset(%u) < 
ndr->relative_base_offset(%u)",
-                                     save.offset, ndr->relative_base_offset);
+                                     "ndr_push_relative_ptr2 save_offset(%u) < 
ndr->relative_base_offset(%u)",
+                                     save_offset, ndr->relative_base_offset);
        }       
-       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, save.offset - 
ndr->relative_base_offset));
-       ndr_push_restore(ndr, &save);
+       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, save_offset - 
ndr->relative_base_offset));
+       ndr->offset = save_offset;
        return NDR_ERR_SUCCESS;
 }
 

Modified: branches/4.0-python/source/librpc/ndr/ndr_basic.c
===================================================================
--- branches/4.0-python/source/librpc/ndr/ndr_basic.c   2007-11-20 11:40:37 UTC 
(rev 26058)
+++ branches/4.0-python/source/librpc/ndr/ndr_basic.c   2007-11-20 11:40:41 UTC 
(rev 26059)
@@ -447,22 +447,6 @@
 }
 
 /*
-  save the current position
- */
-_PUBLIC_ void ndr_push_save(struct ndr_push *ndr, struct ndr_push_save *save)
-{
-       save->offset = ndr->offset;
-}
-
-/*
-  restore the position
- */
-_PUBLIC_ void ndr_push_restore(struct ndr_push *ndr, struct ndr_push_save 
*save)
-{
-       ndr->offset = save->offset;
-}
-
-/*
   push a unique non-zero value if a pointer is non-NULL, otherwise 0
 */
 _PUBLIC_ enum ndr_err_code ndr_push_unique_ptr(struct ndr_push *ndr, const 
void *p)

Modified: branches/4.0-python/source/librpc/ndr/ndr_krb5pac.c
===================================================================
--- branches/4.0-python/source/librpc/ndr/ndr_krb5pac.c 2007-11-20 11:40:37 UTC 
(rev 26058)
+++ branches/4.0-python/source/librpc/ndr/ndr_krb5pac.c 2007-11-20 11:40:41 UTC 
(rev 26059)
@@ -101,8 +101,8 @@
                        uint32_t _flags_save_PAC_INFO = ndr->flags;
                        ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
                        if (r->info) {
-                               struct ndr_pull_save _relative_save;
-                               ndr_pull_save(ndr, &_relative_save);
+                               uint32_t _relative_save_offset;
+                               _relative_save_offset = ndr->offset;
                                NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->info));
                                _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
                                NDR_PULL_SET_MEM_CTX(ndr, r->info, 0);
@@ -114,7 +114,7 @@
                                        NDR_CHECK(ndr_pull_subcontext_end(ndr, 
_ndr_info, 0, r->_ndr_size));
                                }
                                NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
-                               ndr_pull_restore(ndr, &_relative_save);
+                               ndr->offset = _relative_save_offset;
                        }
                        ndr->flags = _flags_save_PAC_INFO;
                }

Modified: branches/4.0-python/source/librpc/ndr/ndr_string.c
===================================================================
--- branches/4.0-python/source/librpc/ndr/ndr_string.c  2007-11-20 11:40:37 UTC 
(rev 26058)
+++ branches/4.0-python/source/librpc/ndr/ndr_string.c  2007-11-20 11:40:41 UTC 
(rev 26059)
@@ -650,21 +650,21 @@
 _PUBLIC_ enum ndr_err_code ndr_check_string_terminator(struct ndr_pull *ndr, 
uint32_t count, uint32_t element_size)
 {
        uint32_t i;
-       struct ndr_pull_save save_offset;
+       uint32_t save_offset;
 
-       ndr_pull_save(ndr, &save_offset);
+       save_offset = ndr->offset;
        ndr_pull_advance(ndr, (count - 1) * element_size);
        NDR_PULL_NEED_BYTES(ndr, element_size);
 
        for (i = 0; i < element_size; i++) {
                 if (ndr->data[ndr->offset+i] != 0) {
-                       ndr_pull_restore(ndr, &save_offset);
+                       ndr->offset = save_offset;
 
                        return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "String 
terminator not present or outside string boundaries");
                 }
        }
 
-       ndr_pull_restore(ndr, &save_offset);
+       ndr->offset = save_offset;
 
        return NDR_ERR_SUCCESS;
 }

Modified: branches/4.0-python/source/ntvfs/ipc/ipc_rap.c
===================================================================
--- branches/4.0-python/source/ntvfs/ipc/ipc_rap.c      2007-11-20 11:40:37 UTC 
(rev 26058)
+++ branches/4.0-python/source/ntvfs/ipc/ipc_rap.c      2007-11-20 11:40:41 UTC 
(rev 26059)
@@ -273,10 +273,10 @@
        for (r.out.count = 0; r.out.count < r.out.available; r.out.count++) {
 
                int i = r.out.count;
-               struct ndr_push_save data_save;
+               uint32_t offset_save;
                struct rap_heap_save heap_save;
 
-               ndr_push_save(call->ndr_push_data, &data_save);
+               offset_save = call->ndr_push_data->offset;
                rap_heap_save(call->heap, &heap_save);
 
                switch(r.in.level) {
@@ -305,7 +305,7 @@
 
        buffer_overflow:
 
-                       ndr_push_restore(call->ndr_push_data, &data_save);
+                       call->ndr_push_data->offset = offset_save;
                        rap_heap_restore(call->heap, &heap_save);
                        break;
                }
@@ -355,10 +355,10 @@
        for (r.out.count = 0; r.out.count < r.out.available; r.out.count++) {
 
                int i = r.out.count;
-               struct ndr_push_save data_save;
+               uint32_t offset_save;
                struct rap_heap_save heap_save;
 
-               ndr_push_save(call->ndr_push_data, &data_save);
+               offset_save = call->ndr_push_data->offset;
                rap_heap_save(call->heap, &heap_save);
 
                switch(r.in.level) {
@@ -389,7 +389,7 @@
 
        buffer_overflow:
 
-                       ndr_push_restore(call->ndr_push_data, &data_save);
+                       call->ndr_push_data->offset = offset_save;
                        rap_heap_restore(call->heap, &heap_save);
                        break;
                }

Modified: branches/4.0-python/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
===================================================================
--- branches/4.0-python/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm 
2007-11-20 11:40:37 UTC (rev 26058)
+++ branches/4.0-python/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm 
2007-11-20 11:40:41 UTC (rev 26059)
@@ -1095,8 +1095,8 @@
                        $self->indent;
 
                        if ($l->{POINTER_TYPE} eq "relative") {
-                               $self->pidl("struct ndr_pull_save 
_relative_save;");
-                               $self->pidl("ndr_pull_save(ndr, 
&_relative_save);");
+                               $self->pidl("uint32_t _relative_save_offset;");
+                               $self->pidl("_relative_save_offset = 
ndr->offset;");
                                
$self->pidl("NDR_CHECK(ndr_pull_relative_ptr2(ndr, $var_name));");
                        }
                }
@@ -1110,7 +1110,7 @@
 
                if ($l->{POINTER_TYPE} ne "ref") {
                        if ($l->{POINTER_TYPE} eq "relative") {
-                               $self->pidl("ndr_pull_restore(ndr, 
&_relative_save);");
+                               $self->pidl("ndr->offset = 
_relative_save_offset;");
                        }
                        $self->deindent;
                        $self->pidl("}");

Modified: branches/4.0-python/source/torture/rpc/spoolss.c
===================================================================
--- branches/4.0-python/source/torture/rpc/spoolss.c    2007-11-20 11:40:37 UTC 
(rev 26058)
+++ branches/4.0-python/source/torture/rpc/spoolss.c    2007-11-20 11:40:41 UTC 
(rev 26059)
@@ -1297,7 +1297,7 @@
        NTSTATUS status;
        struct dcerpc_binding *b;
        struct dcerpc_pipe *p2;
-       bool ret = true;
+       struct spoolss_ClosePrinter cp;
 
        /* only makes sense on SMB */
        if (p->conn->transport.transport != NCACN_NP) {
@@ -1315,11 +1315,13 @@
        status = dcerpc_bind_auth_none(p2, &ndr_table_spoolss);
        torture_assert_ntstatus_ok(tctx, status, "Failed to create bind on 
secondary connection");
 
-       if (test_ClosePrinter(tctx, p2, handle)) {
-               torture_comment(tctx, "ERROR: Allowed close on secondary 
connection!\n");
-               ret = false;
-       }
+       cp.in.handle = handle;
+       cp.out.handle = handle;
 
+       status = dcerpc_spoolss_ClosePrinter(p2, tctx, &cp);
+       torture_assert_ntstatus_equal(tctx, status, NT_STATUS_NET_WRITE_FAULT,
+                       "ERROR: Allowed close on secondary connection");
+
        torture_assert_int_equal(tctx, p2->last_fault_code, 
DCERPC_FAULT_CONTEXT_MISMATCH, 
                                 "Unexpected fault code");
 
@@ -1368,8 +1370,8 @@
 
        status = dcerpc_spoolss_OpenPrinterEx(p, tctx, &opEx);
        torture_assert_ntstatus_ok(tctx, status, "OpenPrinterEx failed");
-       if (!W_ERROR_EQUAL(WERR_INVALID_PRINTER_NAME,opEx.out.result)) {
-               torture_comment(tctx, "OpenPrinterEx(%s) unexpected result[%s] 
should be WERR_INVALID_PRINTER_NAME\n",
+       if (!W_ERROR_EQUAL(WERR_INVALID_PARAM,opEx.out.result)) {
+               torture_comment(tctx, "OpenPrinterEx(%s) unexpected result[%s] 
should be WERR_INVALID_PARAM\n",
                        name, win_errstr(opEx.out.result));
        }
 

Reply via email to