Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/pidl/tests/samba3-cli.pl

    r414 r745  
    55use warnings;
    66
    7 use Test::More tests => 9;
     7use Test::More tests => 8;
    88use FindBin qw($RealBin);
    99use lib "$RealBin";
    1010use Util;
    1111use Parse::Pidl::Util qw(MyDumper);
    12 use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction ParseOutputArgument);
     12use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction);
    1313use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv);
    1414
     
    3232is($x->{res},
    3333"struct rpccli_bar_state {
    34         struct bar orig;
    35         struct bar tmp;
    3634        TALLOC_CTX *out_mem_ctx;
    37         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
    3835};
    3936
     
    5451        }
    5552        state->out_mem_ctx = NULL;
    56         state->dispatch_recv = cli->dispatch_recv;
    57 
    58         /* In parameters */
    59 
    60         /* Out parameters */
    61 
    62         if (DEBUGLEVEL >= 10) {
    63                 NDR_PRINT_IN_DEBUG(bar, &state->orig);
    64         }
    65 
    66         /* make a temporary copy, that we pass to the dispatch function */
    67         state->tmp = state->orig;
    68 
    69         subreq = cli->dispatch_send(state, ev, cli,
    70                                     &ndr_table_foo,
    71                                     NDR_BAR,
    72                                     &state->tmp);
     53
     54        subreq = dcerpc_bar_send(state,
     55                                 ev,
     56                                 cli->binding_handle);
    7357        if (tevent_req_nomem(subreq, req)) {
    7458                return tevent_req_post(req, ev);
     
    9377        }
    9478
    95         status = state->dispatch_recv(subreq, mem_ctx);
     79        status = dcerpc_bar_recv(subreq,
     80                                 mem_ctx);
    9681        TALLOC_FREE(subreq);
    9782        if (!NT_STATUS_IS_OK(status)) {
     
    10085        }
    10186
    102         /* Copy out parameters */
    103 
    104         /* Reset temporary structure */
    105         ZERO_STRUCT(state->tmp);
    106 
    107         if (DEBUGLEVEL >= 10) {
    108                 NDR_PRINT_OUT_DEBUG(bar, &state->orig);
    109         }
    110 
    11187        tevent_req_done(req);
    11288}
     
    124100        }
    125101
    126         /* Steal possbile out parameters to the callers context */
     102        /* Steal possible out parameters to the callers context */
    127103        talloc_steal(mem_ctx, state->out_mem_ctx);
    128104
     
    134110                    TALLOC_CTX *mem_ctx)
    135111{
    136 \tstruct bar r;
    137 \tNTSTATUS status;
    138 
    139 \t/* In parameters */
    140 
    141 \tif (DEBUGLEVEL >= 10) {
    142 \t\tNDR_PRINT_IN_DEBUG(bar, &r);
    143 \t}
    144 
    145         status = cli->dispatch(cli,
    146                                 mem_ctx,
    147                                 &ndr_table_foo,
    148                                 NDR_BAR,
    149                                 &r);
    150 
    151 \tif (!NT_STATUS_IS_OK(status)) {
    152 \t\treturn status;
    153 \t}
    154 
    155 \tif (DEBUGLEVEL >= 10) {
    156 \t\tNDR_PRINT_OUT_DEBUG(bar, &r);
    157 \t}
    158 
    159 \tif (NT_STATUS_IS_ERR(status)) {
    160 \t\treturn status;
    161 \t}
    162 
    163 \t/* Return variables */
    164 
    165 \t/* Return result */
    166 \treturn NT_STATUS_OK;
     112        NTSTATUS status;
     113
     114        status = dcerpc_bar(cli->binding_handle,
     115                            mem_ctx);
     116        if (!NT_STATUS_IS_OK(status)) {
     117                return status;
     118        }
     119
     120        /* Return result */
     121        return NT_STATUS_OK;
    167122}
    168123
     
    175130is($x->{res},
    176131"struct rpccli_bar_state {
    177         struct bar orig;
    178         struct bar tmp;
    179132        TALLOC_CTX *out_mem_ctx;
    180         NTSTATUS (*dispatch_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx);
     133        WERROR result;
    181134};
    182135
     
    197150        }
    198151        state->out_mem_ctx = NULL;
    199         state->dispatch_recv = cli->dispatch_recv;
    200 
    201         /* In parameters */
    202 
    203         /* Out parameters */
    204 
    205         /* Result */
    206         ZERO_STRUCT(state->orig.out.result);
    207 
    208         if (DEBUGLEVEL >= 10) {
    209                 NDR_PRINT_IN_DEBUG(bar, &state->orig);
    210         }
    211 
    212         /* make a temporary copy, that we pass to the dispatch function */
    213         state->tmp = state->orig;
    214 
    215         subreq = cli->dispatch_send(state, ev, cli,
    216                                     &ndr_table_foo,
    217                                     NDR_BAR,
    218                                     &state->tmp);
     152
     153        subreq = dcerpc_bar_send(state,
     154                                 ev,
     155                                 cli->binding_handle);
    219156        if (tevent_req_nomem(subreq, req)) {
    220157                return tevent_req_post(req, ev);
     
    239176        }
    240177
    241         status = state->dispatch_recv(subreq, mem_ctx);
     178        status = dcerpc_bar_recv(subreq,
     179                                 mem_ctx,
     180                                 &state->result);
    242181        TALLOC_FREE(subreq);
    243182        if (!NT_STATUS_IS_OK(status)) {
    244183                tevent_req_nterror(req, status);
    245184                return;
    246         }
    247 
    248         /* Copy out parameters */
    249 
    250         /* Copy result */
    251         state->orig.out.result = state->tmp.out.result;
    252 
    253         /* Reset temporary structure */
    254         ZERO_STRUCT(state->tmp);
    255 
    256         if (DEBUGLEVEL >= 10) {
    257                 NDR_PRINT_OUT_DEBUG(bar, &state->orig);
    258185        }
    259186
     
    274201        }
    275202
    276         /* Steal possbile out parameters to the callers context */
     203        /* Steal possible out parameters to the callers context */
    277204        talloc_steal(mem_ctx, state->out_mem_ctx);
    278205
    279206        /* Return result */
    280         *result = state->orig.out.result;
     207        *result = state->result;
    281208
    282209        tevent_req_received(req);
     
    288215                    WERROR *werror)
    289216{
    290 \tstruct bar r;
    291 \tNTSTATUS status;
    292 
    293 \t/* In parameters */
    294 
    295 \tif (DEBUGLEVEL >= 10) {
    296 \t\tNDR_PRINT_IN_DEBUG(bar, &r);
    297 \t}
    298 
    299         status = cli->dispatch(cli,
    300                                 mem_ctx,
    301                                 &ndr_table_foo,
    302                                 NDR_BAR,
    303                                 &r);
    304 
    305 \tif (!NT_STATUS_IS_OK(status)) {
    306 \t\treturn status;
    307 \t}
    308 
    309 \tif (DEBUGLEVEL >= 10) {
    310 \t\tNDR_PRINT_OUT_DEBUG(bar, &r);
    311 \t}
    312 
    313 \tif (NT_STATUS_IS_ERR(status)) {
    314 \t\treturn status;
    315 \t}
    316 
    317 \t/* Return variables */
    318 
    319 \t/* Return result */
    320 \tif (werror) {
    321 \t\t*werror = r.out.result;
    322 \t}
    323 
    324 \treturn werror_to_ntstatus(r.out.result);
     217        WERROR result;
     218        NTSTATUS status;
     219
     220        status = dcerpc_bar(cli->binding_handle,
     221                            mem_ctx,
     222                            &result);
     223        if (!NT_STATUS_IS_OK(status)) {
     224                return status;
     225        }
     226
     227        /* Return result */
     228        if (werror) {
     229                *werror = result;
     230        }
     231
     232        return werror_to_ntstatus(result);
    325233}
    326234
    327235");
    328236
    329 $x = new Parse::Pidl::Samba3::ClientNDR();
    330 
    331 $fn = { NAME => "bar", ELEMENTS => [ ], RETURN_TYPE => "WERROR" };
    332 my $e = { NAME => "foo", ORIGINAL => { FILE => "f", LINE => -1 },
    333           LEVELS => [ { TYPE => "ARRAY", SIZE_IS => "mysize" }, { TYPE => "DATA", DATA_TYPE => "int" } ]};
    334 
    335 $x->ParseOutputArgument($fn, $e);
    336 is($x->{res}, "memcpy(foo, r.out.foo, (mysize) * sizeof(*foo));\n");
Note: See TracChangeset for help on using the changeset viewer.