LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - ndr_mdssvc_c.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 353 409 86.3 %
Date: 2021-09-23 10:06:22 Functions: 32 32 100.0 %

          Line data    Source code
       1             : /* client functions auto-generated by pidl */
       2             : 
       3             : #include "includes.h"
       4             : #include <tevent.h>
       5             : #include "lib/util/tevent_ntstatus.h"
       6             : #include "bin/default/librpc/gen_ndr/ndr_mdssvc.h"
       7             : #include "bin/default/librpc/gen_ndr/ndr_mdssvc_c.h"
       8             : 
       9             : /* mdssvc - client functions generated by pidl */
      10             : 
      11             : struct dcerpc_mdssvc_open_r_state {
      12             :         TALLOC_CTX *out_mem_ctx;
      13             : };
      14             : 
      15             : static void dcerpc_mdssvc_open_r_done(struct tevent_req *subreq);
      16             : 
      17          12 : struct tevent_req *dcerpc_mdssvc_open_r_send(TALLOC_CTX *mem_ctx,
      18             :         struct tevent_context *ev,
      19             :         struct dcerpc_binding_handle *h,
      20             :         struct mdssvc_open *r)
      21             : {
      22             :         struct tevent_req *req;
      23             :         struct dcerpc_mdssvc_open_r_state *state;
      24             :         struct tevent_req *subreq;
      25             : 
      26          12 :         req = tevent_req_create(mem_ctx, &state,
      27             :                                 struct dcerpc_mdssvc_open_r_state);
      28          12 :         if (req == NULL) {
      29           0 :                 return NULL;
      30             :         }
      31             : 
      32          12 :         state->out_mem_ctx = talloc_new(state);
      33          12 :         if (tevent_req_nomem(state->out_mem_ctx, req)) {
      34           0 :                 return tevent_req_post(req, ev);
      35             :         }
      36             : 
      37          12 :         subreq = dcerpc_binding_handle_call_send(state, ev, h,
      38             :                         NULL, &ndr_table_mdssvc,
      39          12 :                         NDR_MDSSVC_OPEN, state->out_mem_ctx, r);
      40          12 :         if (tevent_req_nomem(subreq, req)) {
      41           0 :                 return tevent_req_post(req, ev);
      42             :         }
      43          12 :         tevent_req_set_callback(subreq, dcerpc_mdssvc_open_r_done, req);
      44             : 
      45          12 :         return req;
      46             : }
      47             : 
      48          12 : static void dcerpc_mdssvc_open_r_done(struct tevent_req *subreq)
      49             : {
      50          12 :         struct tevent_req *req =
      51          12 :                 tevent_req_callback_data(subreq,
      52             :                 struct tevent_req);
      53             :         NTSTATUS status;
      54             : 
      55          12 :         status = dcerpc_binding_handle_call_recv(subreq);
      56          12 :         TALLOC_FREE(subreq);
      57          12 :         if (tevent_req_nterror(req, status)) {
      58           0 :                 return;
      59             :         }
      60             : 
      61          12 :         tevent_req_done(req);
      62             : }
      63             : 
      64          12 : NTSTATUS dcerpc_mdssvc_open_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
      65             : {
      66          12 :         struct dcerpc_mdssvc_open_r_state *state =
      67          12 :                 tevent_req_data(req,
      68             :                 struct dcerpc_mdssvc_open_r_state);
      69             :         NTSTATUS status;
      70             : 
      71          12 :         if (tevent_req_is_nterror(req, &status)) {
      72           0 :                 tevent_req_received(req);
      73           0 :                 return status;
      74             :         }
      75             : 
      76          12 :         talloc_steal(mem_ctx, state->out_mem_ctx);
      77             : 
      78          12 :         tevent_req_received(req);
      79          12 :         return NT_STATUS_OK;
      80             : }
      81             : 
      82          14 : NTSTATUS dcerpc_mdssvc_open_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct mdssvc_open *r)
      83             : {
      84             :         NTSTATUS status;
      85             : 
      86          14 :         status = dcerpc_binding_handle_call(h,
      87             :                         NULL, &ndr_table_mdssvc,
      88             :                         NDR_MDSSVC_OPEN, mem_ctx, r);
      89             : 
      90          14 :         return status;
      91             : }
      92             : 
      93             : struct dcerpc_mdssvc_open_state {
      94             :         struct mdssvc_open orig;
      95             :         struct mdssvc_open tmp;
      96             :         TALLOC_CTX *out_mem_ctx;
      97             : };
      98             : 
      99             : static void dcerpc_mdssvc_open_done(struct tevent_req *subreq);
     100             : 
     101          12 : struct tevent_req *dcerpc_mdssvc_open_send(TALLOC_CTX *mem_ctx,
     102             :                                            struct tevent_context *ev,
     103             :                                            struct dcerpc_binding_handle *h,
     104             :                                            uint32_t *_device_id /* [in,out] [ref] */,
     105             :                                            uint32_t *_unkn2 /* [in,out] [ref] */,
     106             :                                            uint32_t *_unkn3 /* [in,out] [ref] */,
     107             :                                            const char *_share_mount_path /* [in] [charset(UTF8),size_is(1025)] */,
     108             :                                            const char *_share_name /* [in] [charset(UTF8),size_is(1025)] */,
     109             :                                            const char *_share_path /* [out] [charset(UTF8),size_is(1025)] */,
     110             :                                            struct policy_handle *_handle /* [out] [ref] */)
     111             : {
     112             :         struct tevent_req *req;
     113             :         struct dcerpc_mdssvc_open_state *state;
     114             :         struct tevent_req *subreq;
     115             : 
     116          12 :         req = tevent_req_create(mem_ctx, &state,
     117             :                                 struct dcerpc_mdssvc_open_state);
     118          12 :         if (req == NULL) {
     119           0 :                 return NULL;
     120             :         }
     121          12 :         state->out_mem_ctx = NULL;
     122             : 
     123             :         /* In parameters */
     124          12 :         state->orig.in.device_id = _device_id;
     125          12 :         state->orig.in.unkn2 = _unkn2;
     126          12 :         state->orig.in.unkn3 = _unkn3;
     127          12 :         state->orig.in.share_mount_path = _share_mount_path;
     128          12 :         state->orig.in.share_name = _share_name;
     129             : 
     130             :         /* Out parameters */
     131          12 :         state->orig.out.device_id = _device_id;
     132          12 :         state->orig.out.unkn2 = _unkn2;
     133          12 :         state->orig.out.unkn3 = _unkn3;
     134          12 :         state->orig.out.share_path = _share_path;
     135          12 :         state->orig.out.handle = _handle;
     136             : 
     137          12 :         state->out_mem_ctx = talloc_named_const(state, 0,
     138             :                              "dcerpc_mdssvc_open_out_memory");
     139          12 :         if (tevent_req_nomem(state->out_mem_ctx, req)) {
     140           0 :                 return tevent_req_post(req, ev);
     141             :         }
     142             : 
     143             :         /* make a temporary copy, that we pass to the dispatch function */
     144          12 :         state->tmp = state->orig;
     145             : 
     146          12 :         subreq = dcerpc_mdssvc_open_r_send(state, ev, h, &state->tmp);
     147          12 :         if (tevent_req_nomem(subreq, req)) {
     148           0 :                 return tevent_req_post(req, ev);
     149             :         }
     150          12 :         tevent_req_set_callback(subreq, dcerpc_mdssvc_open_done, req);
     151          12 :         return req;
     152             : }
     153             : 
     154          12 : static void dcerpc_mdssvc_open_done(struct tevent_req *subreq)
     155             : {
     156          12 :         struct tevent_req *req = tevent_req_callback_data(
     157             :                 subreq, struct tevent_req);
     158          12 :         struct dcerpc_mdssvc_open_state *state = tevent_req_data(
     159             :                 req, struct dcerpc_mdssvc_open_state);
     160             :         NTSTATUS status;
     161             :         TALLOC_CTX *mem_ctx;
     162             : 
     163          12 :         if (state->out_mem_ctx) {
     164          12 :                 mem_ctx = state->out_mem_ctx;
     165             :         } else {
     166           0 :                 mem_ctx = state;
     167             :         }
     168             : 
     169          12 :         status = dcerpc_mdssvc_open_r_recv(subreq, mem_ctx);
     170          12 :         TALLOC_FREE(subreq);
     171          12 :         if (tevent_req_nterror(req, status)) {
     172           0 :                 return;
     173             :         }
     174             : 
     175             :         /* Copy out parameters */
     176          12 :         *state->orig.out.device_id = *state->tmp.out.device_id;
     177          12 :         *state->orig.out.unkn2 = *state->tmp.out.unkn2;
     178          12 :         *state->orig.out.unkn3 = *state->tmp.out.unkn3;
     179             :         {
     180             :                 size_t _copy_len_share_path;
     181          12 :                 _copy_len_share_path = ndr_charset_length(state->tmp.out.share_path, CH_UNIX);
     182          12 :                 if (_copy_len_share_path > 1025) {
     183           0 :                         tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
     184           0 :                         return;
     185             :                 }
     186          12 :                 if (state->orig.out.share_path != state->tmp.out.share_path) {
     187          12 :                         memcpy(discard_const_p(uint8_t *, state->orig.out.share_path), state->tmp.out.share_path, _copy_len_share_path * sizeof(*state->orig.out.share_path));
     188             :                 }
     189             :         }
     190          12 :         *state->orig.out.handle = *state->tmp.out.handle;
     191             : 
     192             :         /* Reset temporary structure */
     193          12 :         NDR_ZERO_STRUCT(state->tmp);
     194             : 
     195          12 :         tevent_req_done(req);
     196             : }
     197             : 
     198          12 : NTSTATUS dcerpc_mdssvc_open_recv(struct tevent_req *req,
     199             :                                  TALLOC_CTX *mem_ctx)
     200             : {
     201          12 :         struct dcerpc_mdssvc_open_state *state = tevent_req_data(
     202             :                 req, struct dcerpc_mdssvc_open_state);
     203             :         NTSTATUS status;
     204             : 
     205          12 :         if (tevent_req_is_nterror(req, &status)) {
     206           0 :                 tevent_req_received(req);
     207           0 :                 return status;
     208             :         }
     209             : 
     210             :         /* Steal possible out parameters to the callers context */
     211          12 :         talloc_steal(mem_ctx, state->out_mem_ctx);
     212             : 
     213          12 :         tevent_req_received(req);
     214          12 :         return NT_STATUS_OK;
     215             : }
     216             : 
     217          14 : NTSTATUS dcerpc_mdssvc_open(struct dcerpc_binding_handle *h,
     218             :                             TALLOC_CTX *mem_ctx,
     219             :                             uint32_t *_device_id /* [in,out] [ref] */,
     220             :                             uint32_t *_unkn2 /* [in,out] [ref] */,
     221             :                             uint32_t *_unkn3 /* [in,out] [ref] */,
     222             :                             const char *_share_mount_path /* [in] [charset(UTF8),size_is(1025)] */,
     223             :                             const char *_share_name /* [in] [charset(UTF8),size_is(1025)] */,
     224             :                             const char *_share_path /* [out] [charset(UTF8),size_is(1025)] */,
     225             :                             struct policy_handle *_handle /* [out] [ref] */)
     226             : {
     227             :         struct mdssvc_open r;
     228             :         NTSTATUS status;
     229             : 
     230             :         /* In parameters */
     231          14 :         r.in.device_id = _device_id;
     232          14 :         r.in.unkn2 = _unkn2;
     233          14 :         r.in.unkn3 = _unkn3;
     234          14 :         r.in.share_mount_path = _share_mount_path;
     235          14 :         r.in.share_name = _share_name;
     236             : 
     237             :         /* Out parameters */
     238          14 :         r.out.device_id = _device_id;
     239          14 :         r.out.unkn2 = _unkn2;
     240          14 :         r.out.unkn3 = _unkn3;
     241          14 :         r.out.share_path = _share_path;
     242          14 :         r.out.handle = _handle;
     243             : 
     244          14 :         status = dcerpc_mdssvc_open_r(h, mem_ctx, &r);
     245          14 :         if (!NT_STATUS_IS_OK(status)) {
     246           0 :                 return status;
     247             :         }
     248             : 
     249             :         /* Return variables */
     250          14 :         *_device_id = *r.out.device_id;
     251          14 :         *_unkn2 = *r.out.unkn2;
     252          14 :         *_unkn3 = *r.out.unkn3;
     253             :         {
     254             :                 size_t _copy_len_share_path;
     255          14 :                 _copy_len_share_path = ndr_charset_length(r.out.share_path, CH_UNIX);
     256          14 :                 if (_copy_len_share_path > 1025) {
     257           0 :                         return NT_STATUS_INVALID_NETWORK_RESPONSE;
     258             :                 }
     259          14 :                 if (_share_path != r.out.share_path) {
     260          14 :                         memcpy(discard_const_p(uint8_t *, _share_path), r.out.share_path, _copy_len_share_path * sizeof(*_share_path));
     261             :                 }
     262             :         }
     263          14 :         *_handle = *r.out.handle;
     264             : 
     265             :         /* Return result */
     266             : 
     267          14 :         return NT_STATUS_OK;
     268             : }
     269             : 
     270             : struct dcerpc_mdssvc_unknown1_r_state {
     271             :         TALLOC_CTX *out_mem_ctx;
     272             : };
     273             : 
     274             : static void dcerpc_mdssvc_unknown1_r_done(struct tevent_req *subreq);
     275             : 
     276          12 : struct tevent_req *dcerpc_mdssvc_unknown1_r_send(TALLOC_CTX *mem_ctx,
     277             :         struct tevent_context *ev,
     278             :         struct dcerpc_binding_handle *h,
     279             :         struct mdssvc_unknown1 *r)
     280             : {
     281             :         struct tevent_req *req;
     282             :         struct dcerpc_mdssvc_unknown1_r_state *state;
     283             :         struct tevent_req *subreq;
     284             : 
     285          12 :         req = tevent_req_create(mem_ctx, &state,
     286             :                                 struct dcerpc_mdssvc_unknown1_r_state);
     287          12 :         if (req == NULL) {
     288           0 :                 return NULL;
     289             :         }
     290             : 
     291          12 :         state->out_mem_ctx = talloc_new(state);
     292          12 :         if (tevent_req_nomem(state->out_mem_ctx, req)) {
     293           0 :                 return tevent_req_post(req, ev);
     294             :         }
     295             : 
     296          12 :         subreq = dcerpc_binding_handle_call_send(state, ev, h,
     297             :                         NULL, &ndr_table_mdssvc,
     298          12 :                         NDR_MDSSVC_UNKNOWN1, state->out_mem_ctx, r);
     299          12 :         if (tevent_req_nomem(subreq, req)) {
     300           0 :                 return tevent_req_post(req, ev);
     301             :         }
     302          12 :         tevent_req_set_callback(subreq, dcerpc_mdssvc_unknown1_r_done, req);
     303             : 
     304          12 :         return req;
     305             : }
     306             : 
     307          12 : static void dcerpc_mdssvc_unknown1_r_done(struct tevent_req *subreq)
     308             : {
     309          12 :         struct tevent_req *req =
     310          12 :                 tevent_req_callback_data(subreq,
     311             :                 struct tevent_req);
     312             :         NTSTATUS status;
     313             : 
     314          12 :         status = dcerpc_binding_handle_call_recv(subreq);
     315          12 :         TALLOC_FREE(subreq);
     316          12 :         if (tevent_req_nterror(req, status)) {
     317           0 :                 return;
     318             :         }
     319             : 
     320          12 :         tevent_req_done(req);
     321             : }
     322             : 
     323          12 : NTSTATUS dcerpc_mdssvc_unknown1_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
     324             : {
     325          12 :         struct dcerpc_mdssvc_unknown1_r_state *state =
     326          12 :                 tevent_req_data(req,
     327             :                 struct dcerpc_mdssvc_unknown1_r_state);
     328             :         NTSTATUS status;
     329             : 
     330          12 :         if (tevent_req_is_nterror(req, &status)) {
     331           0 :                 tevent_req_received(req);
     332           0 :                 return status;
     333             :         }
     334             : 
     335          12 :         talloc_steal(mem_ctx, state->out_mem_ctx);
     336             : 
     337          12 :         tevent_req_received(req);
     338          12 :         return NT_STATUS_OK;
     339             : }
     340             : 
     341          12 : NTSTATUS dcerpc_mdssvc_unknown1_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct mdssvc_unknown1 *r)
     342             : {
     343             :         NTSTATUS status;
     344             : 
     345          12 :         status = dcerpc_binding_handle_call(h,
     346             :                         NULL, &ndr_table_mdssvc,
     347             :                         NDR_MDSSVC_UNKNOWN1, mem_ctx, r);
     348             : 
     349          12 :         return status;
     350             : }
     351             : 
     352             : struct dcerpc_mdssvc_unknown1_state {
     353             :         struct mdssvc_unknown1 orig;
     354             :         struct mdssvc_unknown1 tmp;
     355             :         TALLOC_CTX *out_mem_ctx;
     356             : };
     357             : 
     358             : static void dcerpc_mdssvc_unknown1_done(struct tevent_req *subreq);
     359             : 
     360          12 : struct tevent_req *dcerpc_mdssvc_unknown1_send(TALLOC_CTX *mem_ctx,
     361             :                                                struct tevent_context *ev,
     362             :                                                struct dcerpc_binding_handle *h,
     363             :                                                struct policy_handle *_handle /* [in] [ref] */,
     364             :                                                uint32_t _unkn1 /* [in]  */,
     365             :                                                uint32_t _device_id /* [in]  */,
     366             :                                                uint32_t _unkn3 /* [in]  */,
     367             :                                                uint32_t _unkn4 /* [in]  */,
     368             :                                                uint32_t _uid /* [in]  */,
     369             :                                                uint32_t _gid /* [in]  */,
     370             :                                                uint32_t *_status /* [out] [ref] */,
     371             :                                                uint32_t *_flags /* [out] [ref] */,
     372             :                                                uint32_t *_unkn7 /* [out] [ref] */)
     373             : {
     374             :         struct tevent_req *req;
     375             :         struct dcerpc_mdssvc_unknown1_state *state;
     376             :         struct tevent_req *subreq;
     377             : 
     378          12 :         req = tevent_req_create(mem_ctx, &state,
     379             :                                 struct dcerpc_mdssvc_unknown1_state);
     380          12 :         if (req == NULL) {
     381           0 :                 return NULL;
     382             :         }
     383          12 :         state->out_mem_ctx = NULL;
     384             : 
     385             :         /* In parameters */
     386          12 :         state->orig.in.handle = _handle;
     387          12 :         state->orig.in.unkn1 = _unkn1;
     388          12 :         state->orig.in.device_id = _device_id;
     389          12 :         state->orig.in.unkn3 = _unkn3;
     390          12 :         state->orig.in.unkn4 = _unkn4;
     391          12 :         state->orig.in.uid = _uid;
     392          12 :         state->orig.in.gid = _gid;
     393             : 
     394             :         /* Out parameters */
     395          12 :         state->orig.out.status = _status;
     396          12 :         state->orig.out.flags = _flags;
     397          12 :         state->orig.out.unkn7 = _unkn7;
     398             : 
     399          12 :         state->out_mem_ctx = talloc_named_const(state, 0,
     400             :                              "dcerpc_mdssvc_unknown1_out_memory");
     401          12 :         if (tevent_req_nomem(state->out_mem_ctx, req)) {
     402           0 :                 return tevent_req_post(req, ev);
     403             :         }
     404             : 
     405             :         /* make a temporary copy, that we pass to the dispatch function */
     406          12 :         state->tmp = state->orig;
     407             : 
     408          12 :         subreq = dcerpc_mdssvc_unknown1_r_send(state, ev, h, &state->tmp);
     409          12 :         if (tevent_req_nomem(subreq, req)) {
     410           0 :                 return tevent_req_post(req, ev);
     411             :         }
     412          12 :         tevent_req_set_callback(subreq, dcerpc_mdssvc_unknown1_done, req);
     413          12 :         return req;
     414             : }
     415             : 
     416          12 : static void dcerpc_mdssvc_unknown1_done(struct tevent_req *subreq)
     417             : {
     418          12 :         struct tevent_req *req = tevent_req_callback_data(
     419             :                 subreq, struct tevent_req);
     420          12 :         struct dcerpc_mdssvc_unknown1_state *state = tevent_req_data(
     421             :                 req, struct dcerpc_mdssvc_unknown1_state);
     422             :         NTSTATUS status;
     423             :         TALLOC_CTX *mem_ctx;
     424             : 
     425          12 :         if (state->out_mem_ctx) {
     426          12 :                 mem_ctx = state->out_mem_ctx;
     427             :         } else {
     428           0 :                 mem_ctx = state;
     429             :         }
     430             : 
     431          12 :         status = dcerpc_mdssvc_unknown1_r_recv(subreq, mem_ctx);
     432          12 :         TALLOC_FREE(subreq);
     433          12 :         if (tevent_req_nterror(req, status)) {
     434           0 :                 return;
     435             :         }
     436             : 
     437             :         /* Copy out parameters */
     438          12 :         *state->orig.out.status = *state->tmp.out.status;
     439          12 :         *state->orig.out.flags = *state->tmp.out.flags;
     440          12 :         *state->orig.out.unkn7 = *state->tmp.out.unkn7;
     441             : 
     442             :         /* Reset temporary structure */
     443          12 :         NDR_ZERO_STRUCT(state->tmp);
     444             : 
     445          12 :         tevent_req_done(req);
     446             : }
     447             : 
     448          12 : NTSTATUS dcerpc_mdssvc_unknown1_recv(struct tevent_req *req,
     449             :                                      TALLOC_CTX *mem_ctx)
     450             : {
     451          12 :         struct dcerpc_mdssvc_unknown1_state *state = tevent_req_data(
     452             :                 req, struct dcerpc_mdssvc_unknown1_state);
     453             :         NTSTATUS status;
     454             : 
     455          12 :         if (tevent_req_is_nterror(req, &status)) {
     456           0 :                 tevent_req_received(req);
     457           0 :                 return status;
     458             :         }
     459             : 
     460             :         /* Steal possible out parameters to the callers context */
     461          12 :         talloc_steal(mem_ctx, state->out_mem_ctx);
     462             : 
     463          12 :         tevent_req_received(req);
     464          12 :         return NT_STATUS_OK;
     465             : }
     466             : 
     467          12 : NTSTATUS dcerpc_mdssvc_unknown1(struct dcerpc_binding_handle *h,
     468             :                                 TALLOC_CTX *mem_ctx,
     469             :                                 struct policy_handle *_handle /* [in] [ref] */,
     470             :                                 uint32_t _unkn1 /* [in]  */,
     471             :                                 uint32_t _device_id /* [in]  */,
     472             :                                 uint32_t _unkn3 /* [in]  */,
     473             :                                 uint32_t _unkn4 /* [in]  */,
     474             :                                 uint32_t _uid /* [in]  */,
     475             :                                 uint32_t _gid /* [in]  */,
     476             :                                 uint32_t *_status /* [out] [ref] */,
     477             :                                 uint32_t *_flags /* [out] [ref] */,
     478             :                                 uint32_t *_unkn7 /* [out] [ref] */)
     479             : {
     480             :         struct mdssvc_unknown1 r;
     481             :         NTSTATUS status;
     482             : 
     483             :         /* In parameters */
     484          12 :         r.in.handle = _handle;
     485          12 :         r.in.unkn1 = _unkn1;
     486          12 :         r.in.device_id = _device_id;
     487          12 :         r.in.unkn3 = _unkn3;
     488          12 :         r.in.unkn4 = _unkn4;
     489          12 :         r.in.uid = _uid;
     490          12 :         r.in.gid = _gid;
     491             : 
     492             :         /* Out parameters */
     493          12 :         r.out.status = _status;
     494          12 :         r.out.flags = _flags;
     495          12 :         r.out.unkn7 = _unkn7;
     496             : 
     497          12 :         status = dcerpc_mdssvc_unknown1_r(h, mem_ctx, &r);
     498          12 :         if (!NT_STATUS_IS_OK(status)) {
     499           2 :                 return status;
     500             :         }
     501             : 
     502             :         /* Return variables */
     503          10 :         *_status = *r.out.status;
     504          10 :         *_flags = *r.out.flags;
     505          10 :         *_unkn7 = *r.out.unkn7;
     506             : 
     507             :         /* Return result */
     508             : 
     509          10 :         return NT_STATUS_OK;
     510             : }
     511             : 
     512             : struct dcerpc_mdssvc_cmd_r_state {
     513             :         TALLOC_CTX *out_mem_ctx;
     514             : };
     515             : 
     516             : static void dcerpc_mdssvc_cmd_r_done(struct tevent_req *subreq);
     517             : 
     518          46 : struct tevent_req *dcerpc_mdssvc_cmd_r_send(TALLOC_CTX *mem_ctx,
     519             :         struct tevent_context *ev,
     520             :         struct dcerpc_binding_handle *h,
     521             :         struct mdssvc_cmd *r)
     522             : {
     523             :         struct tevent_req *req;
     524             :         struct dcerpc_mdssvc_cmd_r_state *state;
     525             :         struct tevent_req *subreq;
     526             : 
     527          46 :         req = tevent_req_create(mem_ctx, &state,
     528             :                                 struct dcerpc_mdssvc_cmd_r_state);
     529          46 :         if (req == NULL) {
     530           0 :                 return NULL;
     531             :         }
     532             : 
     533          46 :         state->out_mem_ctx = talloc_new(state);
     534          46 :         if (tevent_req_nomem(state->out_mem_ctx, req)) {
     535           0 :                 return tevent_req_post(req, ev);
     536             :         }
     537             : 
     538          46 :         subreq = dcerpc_binding_handle_call_send(state, ev, h,
     539             :                         NULL, &ndr_table_mdssvc,
     540          46 :                         NDR_MDSSVC_CMD, state->out_mem_ctx, r);
     541          46 :         if (tevent_req_nomem(subreq, req)) {
     542           0 :                 return tevent_req_post(req, ev);
     543             :         }
     544          46 :         tevent_req_set_callback(subreq, dcerpc_mdssvc_cmd_r_done, req);
     545             : 
     546          46 :         return req;
     547             : }
     548             : 
     549          46 : static void dcerpc_mdssvc_cmd_r_done(struct tevent_req *subreq)
     550             : {
     551          46 :         struct tevent_req *req =
     552          46 :                 tevent_req_callback_data(subreq,
     553             :                 struct tevent_req);
     554             :         NTSTATUS status;
     555             : 
     556          46 :         status = dcerpc_binding_handle_call_recv(subreq);
     557          46 :         TALLOC_FREE(subreq);
     558          46 :         if (tevent_req_nterror(req, status)) {
     559           0 :                 return;
     560             :         }
     561             : 
     562          46 :         tevent_req_done(req);
     563             : }
     564             : 
     565          46 : NTSTATUS dcerpc_mdssvc_cmd_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
     566             : {
     567          46 :         struct dcerpc_mdssvc_cmd_r_state *state =
     568          46 :                 tevent_req_data(req,
     569             :                 struct dcerpc_mdssvc_cmd_r_state);
     570             :         NTSTATUS status;
     571             : 
     572          46 :         if (tevent_req_is_nterror(req, &status)) {
     573           0 :                 tevent_req_received(req);
     574           0 :                 return status;
     575             :         }
     576             : 
     577          46 :         talloc_steal(mem_ctx, state->out_mem_ctx);
     578             : 
     579          46 :         tevent_req_received(req);
     580          46 :         return NT_STATUS_OK;
     581             : }
     582             : 
     583           4 : NTSTATUS dcerpc_mdssvc_cmd_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct mdssvc_cmd *r)
     584             : {
     585             :         NTSTATUS status;
     586             : 
     587           4 :         status = dcerpc_binding_handle_call(h,
     588             :                         NULL, &ndr_table_mdssvc,
     589             :                         NDR_MDSSVC_CMD, mem_ctx, r);
     590             : 
     591           4 :         return status;
     592             : }
     593             : 
     594             : struct dcerpc_mdssvc_cmd_state {
     595             :         struct mdssvc_cmd orig;
     596             :         struct mdssvc_cmd tmp;
     597             :         TALLOC_CTX *out_mem_ctx;
     598             : };
     599             : 
     600             : static void dcerpc_mdssvc_cmd_done(struct tevent_req *subreq);
     601             : 
     602          46 : struct tevent_req *dcerpc_mdssvc_cmd_send(TALLOC_CTX *mem_ctx,
     603             :                                           struct tevent_context *ev,
     604             :                                           struct dcerpc_binding_handle *h,
     605             :                                           struct policy_handle *_handle /* [in] [ref] */,
     606             :                                           uint32_t _unkn1 /* [in]  */,
     607             :                                           uint32_t _device_id /* [in]  */,
     608             :                                           uint32_t _unkn3 /* [in]  */,
     609             :                                           uint32_t _unkn4 /* [in]  */,
     610             :                                           uint32_t _flags /* [in]  */,
     611             :                                           struct mdssvc_blob _request_blob /* [in]  */,
     612             :                                           uint32_t _unkn5 /* [in]  */,
     613             :                                           uint32_t _max_fragment_size1 /* [in]  */,
     614             :                                           uint32_t _unkn6 /* [in]  */,
     615             :                                           uint32_t _max_fragment_size2 /* [in]  */,
     616             :                                           uint32_t _unkn7 /* [in]  */,
     617             :                                           uint32_t _unkn8 /* [in]  */,
     618             :                                           uint32_t *_fragment /* [out] [ref] */,
     619             :                                           struct mdssvc_blob *_response_blob /* [out] [ref] */,
     620             :                                           uint32_t *_unkn9 /* [out] [ref] */)
     621             : {
     622             :         struct tevent_req *req;
     623             :         struct dcerpc_mdssvc_cmd_state *state;
     624             :         struct tevent_req *subreq;
     625             : 
     626          46 :         req = tevent_req_create(mem_ctx, &state,
     627             :                                 struct dcerpc_mdssvc_cmd_state);
     628          46 :         if (req == NULL) {
     629           0 :                 return NULL;
     630             :         }
     631          46 :         state->out_mem_ctx = NULL;
     632             : 
     633             :         /* In parameters */
     634          46 :         state->orig.in.handle = _handle;
     635          46 :         state->orig.in.unkn1 = _unkn1;
     636          46 :         state->orig.in.device_id = _device_id;
     637          46 :         state->orig.in.unkn3 = _unkn3;
     638          46 :         state->orig.in.unkn4 = _unkn4;
     639          46 :         state->orig.in.flags = _flags;
     640          46 :         state->orig.in.request_blob = _request_blob;
     641          46 :         state->orig.in.unkn5 = _unkn5;
     642          46 :         state->orig.in.max_fragment_size1 = _max_fragment_size1;
     643          46 :         state->orig.in.unkn6 = _unkn6;
     644          46 :         state->orig.in.max_fragment_size2 = _max_fragment_size2;
     645          46 :         state->orig.in.unkn7 = _unkn7;
     646          46 :         state->orig.in.unkn8 = _unkn8;
     647             : 
     648             :         /* Out parameters */
     649          46 :         state->orig.out.fragment = _fragment;
     650          46 :         state->orig.out.response_blob = _response_blob;
     651          46 :         state->orig.out.unkn9 = _unkn9;
     652             : 
     653          46 :         state->out_mem_ctx = talloc_named_const(state, 0,
     654             :                              "dcerpc_mdssvc_cmd_out_memory");
     655          46 :         if (tevent_req_nomem(state->out_mem_ctx, req)) {
     656           0 :                 return tevent_req_post(req, ev);
     657             :         }
     658             : 
     659             :         /* make a temporary copy, that we pass to the dispatch function */
     660          46 :         state->tmp = state->orig;
     661             : 
     662          46 :         subreq = dcerpc_mdssvc_cmd_r_send(state, ev, h, &state->tmp);
     663          46 :         if (tevent_req_nomem(subreq, req)) {
     664           0 :                 return tevent_req_post(req, ev);
     665             :         }
     666          46 :         tevent_req_set_callback(subreq, dcerpc_mdssvc_cmd_done, req);
     667          46 :         return req;
     668             : }
     669             : 
     670          46 : static void dcerpc_mdssvc_cmd_done(struct tevent_req *subreq)
     671             : {
     672          46 :         struct tevent_req *req = tevent_req_callback_data(
     673             :                 subreq, struct tevent_req);
     674          46 :         struct dcerpc_mdssvc_cmd_state *state = tevent_req_data(
     675             :                 req, struct dcerpc_mdssvc_cmd_state);
     676             :         NTSTATUS status;
     677             :         TALLOC_CTX *mem_ctx;
     678             : 
     679          46 :         if (state->out_mem_ctx) {
     680          46 :                 mem_ctx = state->out_mem_ctx;
     681             :         } else {
     682           0 :                 mem_ctx = state;
     683             :         }
     684             : 
     685          46 :         status = dcerpc_mdssvc_cmd_r_recv(subreq, mem_ctx);
     686          46 :         TALLOC_FREE(subreq);
     687          46 :         if (tevent_req_nterror(req, status)) {
     688           0 :                 return;
     689             :         }
     690             : 
     691             :         /* Copy out parameters */
     692          46 :         *state->orig.out.fragment = *state->tmp.out.fragment;
     693          46 :         *state->orig.out.response_blob = *state->tmp.out.response_blob;
     694          46 :         *state->orig.out.unkn9 = *state->tmp.out.unkn9;
     695             : 
     696             :         /* Reset temporary structure */
     697          46 :         NDR_ZERO_STRUCT(state->tmp);
     698             : 
     699          46 :         tevent_req_done(req);
     700             : }
     701             : 
     702          46 : NTSTATUS dcerpc_mdssvc_cmd_recv(struct tevent_req *req,
     703             :                                 TALLOC_CTX *mem_ctx)
     704             : {
     705          46 :         struct dcerpc_mdssvc_cmd_state *state = tevent_req_data(
     706             :                 req, struct dcerpc_mdssvc_cmd_state);
     707             :         NTSTATUS status;
     708             : 
     709          46 :         if (tevent_req_is_nterror(req, &status)) {
     710           0 :                 tevent_req_received(req);
     711           0 :                 return status;
     712             :         }
     713             : 
     714             :         /* Steal possible out parameters to the callers context */
     715          46 :         talloc_steal(mem_ctx, state->out_mem_ctx);
     716             : 
     717          46 :         tevent_req_received(req);
     718          46 :         return NT_STATUS_OK;
     719             : }
     720             : 
     721           4 : NTSTATUS dcerpc_mdssvc_cmd(struct dcerpc_binding_handle *h,
     722             :                            TALLOC_CTX *mem_ctx,
     723             :                            struct policy_handle *_handle /* [in] [ref] */,
     724             :                            uint32_t _unkn1 /* [in]  */,
     725             :                            uint32_t _device_id /* [in]  */,
     726             :                            uint32_t _unkn3 /* [in]  */,
     727             :                            uint32_t _unkn4 /* [in]  */,
     728             :                            uint32_t _flags /* [in]  */,
     729             :                            struct mdssvc_blob _request_blob /* [in]  */,
     730             :                            uint32_t _unkn5 /* [in]  */,
     731             :                            uint32_t _max_fragment_size1 /* [in]  */,
     732             :                            uint32_t _unkn6 /* [in]  */,
     733             :                            uint32_t _max_fragment_size2 /* [in]  */,
     734             :                            uint32_t _unkn7 /* [in]  */,
     735             :                            uint32_t _unkn8 /* [in]  */,
     736             :                            uint32_t *_fragment /* [out] [ref] */,
     737             :                            struct mdssvc_blob *_response_blob /* [out] [ref] */,
     738             :                            uint32_t *_unkn9 /* [out] [ref] */)
     739             : {
     740             :         struct mdssvc_cmd r;
     741             :         NTSTATUS status;
     742             : 
     743             :         /* In parameters */
     744           4 :         r.in.handle = _handle;
     745           4 :         r.in.unkn1 = _unkn1;
     746           4 :         r.in.device_id = _device_id;
     747           4 :         r.in.unkn3 = _unkn3;
     748           4 :         r.in.unkn4 = _unkn4;
     749           4 :         r.in.flags = _flags;
     750           4 :         r.in.request_blob = _request_blob;
     751           4 :         r.in.unkn5 = _unkn5;
     752           4 :         r.in.max_fragment_size1 = _max_fragment_size1;
     753           4 :         r.in.unkn6 = _unkn6;
     754           4 :         r.in.max_fragment_size2 = _max_fragment_size2;
     755           4 :         r.in.unkn7 = _unkn7;
     756           4 :         r.in.unkn8 = _unkn8;
     757             : 
     758             :         /* Out parameters */
     759           4 :         r.out.fragment = _fragment;
     760           4 :         r.out.response_blob = _response_blob;
     761           4 :         r.out.unkn9 = _unkn9;
     762             : 
     763           4 :         status = dcerpc_mdssvc_cmd_r(h, mem_ctx, &r);
     764           4 :         if (!NT_STATUS_IS_OK(status)) {
     765           2 :                 return status;
     766             :         }
     767             : 
     768             :         /* Return variables */
     769           2 :         *_fragment = *r.out.fragment;
     770           2 :         *_response_blob = *r.out.response_blob;
     771           2 :         *_unkn9 = *r.out.unkn9;
     772             : 
     773             :         /* Return result */
     774             : 
     775           2 :         return NT_STATUS_OK;
     776             : }
     777             : 
     778             : struct dcerpc_mdssvc_close_r_state {
     779             :         TALLOC_CTX *out_mem_ctx;
     780             : };
     781             : 
     782             : static void dcerpc_mdssvc_close_r_done(struct tevent_req *subreq);
     783             : 
     784          12 : struct tevent_req *dcerpc_mdssvc_close_r_send(TALLOC_CTX *mem_ctx,
     785             :         struct tevent_context *ev,
     786             :         struct dcerpc_binding_handle *h,
     787             :         struct mdssvc_close *r)
     788             : {
     789             :         struct tevent_req *req;
     790             :         struct dcerpc_mdssvc_close_r_state *state;
     791             :         struct tevent_req *subreq;
     792             : 
     793          12 :         req = tevent_req_create(mem_ctx, &state,
     794             :                                 struct dcerpc_mdssvc_close_r_state);
     795          12 :         if (req == NULL) {
     796           0 :                 return NULL;
     797             :         }
     798             : 
     799          12 :         state->out_mem_ctx = talloc_new(state);
     800          12 :         if (tevent_req_nomem(state->out_mem_ctx, req)) {
     801           0 :                 return tevent_req_post(req, ev);
     802             :         }
     803             : 
     804          12 :         subreq = dcerpc_binding_handle_call_send(state, ev, h,
     805             :                         NULL, &ndr_table_mdssvc,
     806          12 :                         NDR_MDSSVC_CLOSE, state->out_mem_ctx, r);
     807          12 :         if (tevent_req_nomem(subreq, req)) {
     808           0 :                 return tevent_req_post(req, ev);
     809             :         }
     810          12 :         tevent_req_set_callback(subreq, dcerpc_mdssvc_close_r_done, req);
     811             : 
     812          12 :         return req;
     813             : }
     814             : 
     815          12 : static void dcerpc_mdssvc_close_r_done(struct tevent_req *subreq)
     816             : {
     817          12 :         struct tevent_req *req =
     818          12 :                 tevent_req_callback_data(subreq,
     819             :                 struct tevent_req);
     820             :         NTSTATUS status;
     821             : 
     822          12 :         status = dcerpc_binding_handle_call_recv(subreq);
     823          12 :         TALLOC_FREE(subreq);
     824          12 :         if (tevent_req_nterror(req, status)) {
     825           0 :                 return;
     826             :         }
     827             : 
     828          12 :         tevent_req_done(req);
     829             : }
     830             : 
     831          12 : NTSTATUS dcerpc_mdssvc_close_r_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx)
     832             : {
     833          12 :         struct dcerpc_mdssvc_close_r_state *state =
     834          12 :                 tevent_req_data(req,
     835             :                 struct dcerpc_mdssvc_close_r_state);
     836             :         NTSTATUS status;
     837             : 
     838          12 :         if (tevent_req_is_nterror(req, &status)) {
     839           0 :                 tevent_req_received(req);
     840           0 :                 return status;
     841             :         }
     842             : 
     843          12 :         talloc_steal(mem_ctx, state->out_mem_ctx);
     844             : 
     845          12 :         tevent_req_received(req);
     846          12 :         return NT_STATUS_OK;
     847             : }
     848             : 
     849          14 : NTSTATUS dcerpc_mdssvc_close_r(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, struct mdssvc_close *r)
     850             : {
     851             :         NTSTATUS status;
     852             : 
     853          14 :         status = dcerpc_binding_handle_call(h,
     854             :                         NULL, &ndr_table_mdssvc,
     855             :                         NDR_MDSSVC_CLOSE, mem_ctx, r);
     856             : 
     857          14 :         return status;
     858             : }
     859             : 
     860             : struct dcerpc_mdssvc_close_state {
     861             :         struct mdssvc_close orig;
     862             :         struct mdssvc_close tmp;
     863             :         TALLOC_CTX *out_mem_ctx;
     864             : };
     865             : 
     866             : static void dcerpc_mdssvc_close_done(struct tevent_req *subreq);
     867             : 
     868          12 : struct tevent_req *dcerpc_mdssvc_close_send(TALLOC_CTX *mem_ctx,
     869             :                                             struct tevent_context *ev,
     870             :                                             struct dcerpc_binding_handle *h,
     871             :                                             struct policy_handle *_in_handle /* [in] [ref] */,
     872             :                                             uint32_t _unkn1 /* [in]  */,
     873             :                                             uint32_t _device_id /* [in]  */,
     874             :                                             uint32_t _unkn2 /* [in]  */,
     875             :                                             uint32_t _unkn3 /* [in]  */,
     876             :                                             struct policy_handle *_out_handle /* [out] [ref] */,
     877             :                                             uint32_t *_status /* [out] [ref] */)
     878             : {
     879             :         struct tevent_req *req;
     880             :         struct dcerpc_mdssvc_close_state *state;
     881             :         struct tevent_req *subreq;
     882             : 
     883          12 :         req = tevent_req_create(mem_ctx, &state,
     884             :                                 struct dcerpc_mdssvc_close_state);
     885          12 :         if (req == NULL) {
     886           0 :                 return NULL;
     887             :         }
     888          12 :         state->out_mem_ctx = NULL;
     889             : 
     890             :         /* In parameters */
     891          12 :         state->orig.in.in_handle = _in_handle;
     892          12 :         state->orig.in.unkn1 = _unkn1;
     893          12 :         state->orig.in.device_id = _device_id;
     894          12 :         state->orig.in.unkn2 = _unkn2;
     895          12 :         state->orig.in.unkn3 = _unkn3;
     896             : 
     897             :         /* Out parameters */
     898          12 :         state->orig.out.out_handle = _out_handle;
     899          12 :         state->orig.out.status = _status;
     900             : 
     901          12 :         state->out_mem_ctx = talloc_named_const(state, 0,
     902             :                              "dcerpc_mdssvc_close_out_memory");
     903          12 :         if (tevent_req_nomem(state->out_mem_ctx, req)) {
     904           0 :                 return tevent_req_post(req, ev);
     905             :         }
     906             : 
     907             :         /* make a temporary copy, that we pass to the dispatch function */
     908          12 :         state->tmp = state->orig;
     909             : 
     910          12 :         subreq = dcerpc_mdssvc_close_r_send(state, ev, h, &state->tmp);
     911          12 :         if (tevent_req_nomem(subreq, req)) {
     912           0 :                 return tevent_req_post(req, ev);
     913             :         }
     914          12 :         tevent_req_set_callback(subreq, dcerpc_mdssvc_close_done, req);
     915          12 :         return req;
     916             : }
     917             : 
     918          12 : static void dcerpc_mdssvc_close_done(struct tevent_req *subreq)
     919             : {
     920          12 :         struct tevent_req *req = tevent_req_callback_data(
     921             :                 subreq, struct tevent_req);
     922          12 :         struct dcerpc_mdssvc_close_state *state = tevent_req_data(
     923             :                 req, struct dcerpc_mdssvc_close_state);
     924             :         NTSTATUS status;
     925             :         TALLOC_CTX *mem_ctx;
     926             : 
     927          12 :         if (state->out_mem_ctx) {
     928          12 :                 mem_ctx = state->out_mem_ctx;
     929             :         } else {
     930           0 :                 mem_ctx = state;
     931             :         }
     932             : 
     933          12 :         status = dcerpc_mdssvc_close_r_recv(subreq, mem_ctx);
     934          12 :         TALLOC_FREE(subreq);
     935          12 :         if (tevent_req_nterror(req, status)) {
     936           0 :                 return;
     937             :         }
     938             : 
     939             :         /* Copy out parameters */
     940          12 :         *state->orig.out.out_handle = *state->tmp.out.out_handle;
     941          12 :         *state->orig.out.status = *state->tmp.out.status;
     942             : 
     943             :         /* Reset temporary structure */
     944          12 :         NDR_ZERO_STRUCT(state->tmp);
     945             : 
     946          12 :         tevent_req_done(req);
     947             : }
     948             : 
     949          12 : NTSTATUS dcerpc_mdssvc_close_recv(struct tevent_req *req,
     950             :                                   TALLOC_CTX *mem_ctx)
     951             : {
     952          12 :         struct dcerpc_mdssvc_close_state *state = tevent_req_data(
     953             :                 req, struct dcerpc_mdssvc_close_state);
     954             :         NTSTATUS status;
     955             : 
     956          12 :         if (tevent_req_is_nterror(req, &status)) {
     957           0 :                 tevent_req_received(req);
     958           0 :                 return status;
     959             :         }
     960             : 
     961             :         /* Steal possible out parameters to the callers context */
     962          12 :         talloc_steal(mem_ctx, state->out_mem_ctx);
     963             : 
     964          12 :         tevent_req_received(req);
     965          12 :         return NT_STATUS_OK;
     966             : }
     967             : 
     968          14 : NTSTATUS dcerpc_mdssvc_close(struct dcerpc_binding_handle *h,
     969             :                              TALLOC_CTX *mem_ctx,
     970             :                              struct policy_handle *_in_handle /* [in] [ref] */,
     971             :                              uint32_t _unkn1 /* [in]  */,
     972             :                              uint32_t _device_id /* [in]  */,
     973             :                              uint32_t _unkn2 /* [in]  */,
     974             :                              uint32_t _unkn3 /* [in]  */,
     975             :                              struct policy_handle *_out_handle /* [out] [ref] */,
     976             :                              uint32_t *_status /* [out] [ref] */)
     977             : {
     978             :         struct mdssvc_close r;
     979             :         NTSTATUS status;
     980             : 
     981             :         /* In parameters */
     982          14 :         r.in.in_handle = _in_handle;
     983          14 :         r.in.unkn1 = _unkn1;
     984          14 :         r.in.device_id = _device_id;
     985          14 :         r.in.unkn2 = _unkn2;
     986          14 :         r.in.unkn3 = _unkn3;
     987             : 
     988             :         /* Out parameters */
     989          14 :         r.out.out_handle = _out_handle;
     990          14 :         r.out.status = _status;
     991             : 
     992          14 :         status = dcerpc_mdssvc_close_r(h, mem_ctx, &r);
     993          14 :         if (!NT_STATUS_IS_OK(status)) {
     994           8 :                 return status;
     995             :         }
     996             : 
     997             :         /* Return variables */
     998           6 :         *_out_handle = *r.out.out_handle;
     999           6 :         *_status = *r.out.status;
    1000             : 
    1001             :         /* Return result */
    1002             : 
    1003           6 :         return NT_STATUS_OK;
    1004             : }
    1005             : 

Generated by: LCOV version 1.13