LCOV - code coverage report
Current view: top level - source3/smbd - smb2_ioctl.c (source / functions) Hit Total Coverage
Test: coverage report for master 6248eab5 Lines: 147 190 77.4 %
Date: 2021-08-25 13:27:56 Functions: 6 6 100.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             :    Core SMB2 server
       4             : 
       5             :    Copyright (C) Stefan Metzmacher 2009
       6             : 
       7             :    This program is free software; you can redistribute it and/or modify
       8             :    it under the terms of the GNU General Public License as published by
       9             :    the Free Software Foundation; either version 3 of the License, or
      10             :    (at your option) any later version.
      11             : 
      12             :    This program is distributed in the hope that it will be useful,
      13             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :    GNU General Public License for more details.
      16             : 
      17             :    You should have received a copy of the GNU General Public License
      18             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      19             : */
      20             : 
      21             : #include "includes.h"
      22             : #include "smbd/smbd.h"
      23             : #include "smbd/globals.h"
      24             : #include "../libcli/smb/smb_common.h"
      25             : #include "../lib/util/tevent_ntstatus.h"
      26             : #include "include/ntioctl.h"
      27             : #include "smb2_ioctl_private.h"
      28             : #include "librpc/gen_ndr/ioctl.h"
      29             : 
      30             : #undef DBGC_CLASS
      31             : #define DBGC_CLASS DBGC_SMB2
      32             : 
      33             : static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx,
      34             :                                                struct tevent_context *ev,
      35             :                                                struct smbd_smb2_request *smb2req,
      36             :                                                struct files_struct *in_fsp,
      37             :                                                uint32_t in_ctl_code,
      38             :                                                DATA_BLOB in_input,
      39             :                                                uint32_t in_max_output,
      40             :                                                uint32_t in_flags);
      41             : static NTSTATUS smbd_smb2_ioctl_recv(struct tevent_req *req,
      42             :                                      TALLOC_CTX *mem_ctx,
      43             :                                      DATA_BLOB *out_output,
      44             :                                      uint8_t *body_padding,
      45             :                                      bool *disconnect);
      46             : 
      47             : static void smbd_smb2_request_ioctl_done(struct tevent_req *subreq);
      48      310591 : NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req)
      49             : {
      50             :         NTSTATUS status;
      51             :         const uint8_t *inbody;
      52             :         uint32_t min_buffer_offset;
      53             :         uint32_t max_buffer_offset;
      54             :         uint32_t min_output_offset;
      55             :         uint32_t allowed_length_in;
      56             :         uint32_t allowed_length_out;
      57             :         uint32_t in_ctl_code;
      58             :         uint64_t in_file_id_persistent;
      59             :         uint64_t in_file_id_volatile;
      60      310591 :         struct files_struct *in_fsp = NULL;
      61             :         uint32_t in_input_offset;
      62             :         uint32_t in_input_length;
      63      310591 :         DATA_BLOB in_input_buffer = data_blob_null;
      64             :         uint32_t in_max_input_length;
      65             :         uint32_t in_output_offset;
      66             :         uint32_t in_output_length;
      67      310591 :         DATA_BLOB in_output_buffer = data_blob_null;
      68             :         uint32_t in_max_output_length;
      69             :         uint32_t in_flags;
      70             :         uint32_t data_length_in;
      71             :         uint32_t data_length_out;
      72             :         uint32_t data_length_tmp;
      73             :         uint32_t data_length_max;
      74             :         struct tevent_req *subreq;
      75             : 
      76      310591 :         status = smbd_smb2_request_verify_sizes(req, 0x39);
      77      310591 :         if (!NT_STATUS_IS_OK(status)) {
      78           0 :                 return smbd_smb2_request_error(req, status);
      79             :         }
      80      310591 :         inbody = SMBD_SMB2_IN_BODY_PTR(req);
      81             : 
      82      310591 :         in_ctl_code             = IVAL(inbody, 0x04);
      83      310591 :         in_file_id_persistent   = BVAL(inbody, 0x08);
      84      310591 :         in_file_id_volatile     = BVAL(inbody, 0x10);
      85      310591 :         in_input_offset         = IVAL(inbody, 0x18);
      86      310591 :         in_input_length         = IVAL(inbody, 0x1C);
      87      310591 :         in_max_input_length     = IVAL(inbody, 0x20);
      88      310591 :         in_output_offset        = IVAL(inbody, 0x24);
      89      310591 :         in_output_length        = IVAL(inbody, 0x28);
      90      310591 :         in_max_output_length    = IVAL(inbody, 0x2C);
      91      310591 :         in_flags                = IVAL(inbody, 0x30);
      92             : 
      93      310591 :         min_buffer_offset = SMB2_HDR_BODY + SMBD_SMB2_IN_BODY_LEN(req);
      94      310591 :         max_buffer_offset = min_buffer_offset + SMBD_SMB2_IN_DYN_LEN(req);
      95      310591 :         min_output_offset = min_buffer_offset;
      96             : 
      97             :         /*
      98             :          * InputOffset (4 bytes): The offset, in bytes, from the beginning of
      99             :          * the SMB2 header to the input data buffer. If no input data is
     100             :          * required for the FSCTL/IOCTL command being issued, the client SHOULD
     101             :          * set this value to 0.<49>
     102             :          * <49> If no input data is required for the FSCTL/IOCTL command being
     103             :          * issued, Windows-based clients set this field to any value.
     104             :          */
     105      310591 :         allowed_length_in = 0;
     106      310591 :         if ((in_input_offset > 0) && (in_input_length > 0)) {
     107             :                 uint32_t tmp_ofs;
     108             : 
     109      308475 :                 if (in_input_offset < min_buffer_offset) {
     110           0 :                         return smbd_smb2_request_error(req,
     111             :                                         NT_STATUS_INVALID_PARAMETER);
     112             :                 }
     113      308475 :                 if (in_input_offset > max_buffer_offset) {
     114           0 :                         return smbd_smb2_request_error(req,
     115             :                                         NT_STATUS_INVALID_PARAMETER);
     116             :                 }
     117      308475 :                 allowed_length_in = max_buffer_offset - in_input_offset;
     118             : 
     119      308475 :                 tmp_ofs = in_input_offset - min_buffer_offset;
     120      308475 :                 in_input_buffer.data = SMBD_SMB2_IN_DYN_PTR(req);
     121      308475 :                 in_input_buffer.data += tmp_ofs;
     122      308475 :                 in_input_buffer.length = in_input_length;
     123      308475 :                 min_output_offset += tmp_ofs;
     124      308475 :                 min_output_offset += in_input_length;
     125             :         }
     126             : 
     127      310591 :         if (in_input_length > allowed_length_in) {
     128           0 :                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
     129             :         }
     130             : 
     131      310591 :         allowed_length_out = 0;
     132      310591 :         if (in_output_offset > 0) {
     133      307953 :                 if (in_output_offset < min_buffer_offset) {
     134           0 :                         return smbd_smb2_request_error(req,
     135             :                                         NT_STATUS_INVALID_PARAMETER);
     136             :                 }
     137      307953 :                 if (in_output_offset > max_buffer_offset) {
     138           0 :                         return smbd_smb2_request_error(req,
     139             :                                         NT_STATUS_INVALID_PARAMETER);
     140             :                 }
     141      307953 :                 allowed_length_out = max_buffer_offset - in_output_offset;
     142             :         }
     143             : 
     144      310591 :         if (in_output_length > allowed_length_out) {
     145           0 :                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
     146             :         }
     147             : 
     148      310591 :         if (in_output_length > 0) {
     149             :                 uint32_t tmp_ofs;
     150             : 
     151           0 :                 if (in_output_offset < min_output_offset) {
     152           0 :                         return smbd_smb2_request_error(req,
     153             :                                         NT_STATUS_INVALID_PARAMETER);
     154             :                 }
     155             : 
     156           0 :                 tmp_ofs = in_output_offset - min_buffer_offset;
     157           0 :                 in_output_buffer.data = SMBD_SMB2_IN_DYN_PTR(req);
     158           0 :                 in_output_buffer.data += tmp_ofs;
     159           0 :                 in_output_buffer.length = in_output_length;
     160             :         }
     161             : 
     162             :         /*
     163             :          * verify the credits and avoid overflows
     164             :          * in_input_buffer.length and in_output_buffer.length
     165             :          * are already verified.
     166             :          */
     167      310591 :         data_length_in = in_input_buffer.length + in_output_buffer.length;
     168             : 
     169      310591 :         data_length_out = in_max_input_length;
     170      310591 :         data_length_tmp = UINT32_MAX - data_length_out;
     171      310591 :         if (data_length_tmp < in_max_output_length) {
     172           0 :                 return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
     173             :         }
     174      310591 :         data_length_out += in_max_output_length;
     175             : 
     176      310591 :         data_length_max = MAX(data_length_in, data_length_out);
     177             : 
     178      310591 :         status = smbd_smb2_request_verify_creditcharge(req, data_length_max);
     179      310591 :         if (!NT_STATUS_IS_OK(status)) {
     180           0 :                 return smbd_smb2_request_error(req, status);
     181             :         }
     182             : 
     183             :         /*
     184             :          * If the Flags field of the request is not SMB2_0_IOCTL_IS_FSCTL the
     185             :          * server MUST fail the request with STATUS_NOT_SUPPORTED.
     186             :          */
     187      310591 :         if (in_flags != SMB2_IOCTL_FLAG_IS_FSCTL) {
     188           0 :                 return smbd_smb2_request_error(req, NT_STATUS_NOT_SUPPORTED);
     189             :         }
     190             : 
     191      310591 :         switch (in_ctl_code) {
     192        9872 :         case FSCTL_DFS_GET_REFERRALS:
     193             :         case FSCTL_DFS_GET_REFERRALS_EX:
     194             :         case FSCTL_PIPE_WAIT:
     195             :         case FSCTL_VALIDATE_NEGOTIATE_INFO_224:
     196             :         case FSCTL_VALIDATE_NEGOTIATE_INFO:
     197             :         case FSCTL_QUERY_NETWORK_INTERFACE_INFO:
     198             :         case FSCTL_SMBTORTURE_FORCE_UNACKED_TIMEOUT:
     199             :         case FSCTL_SMBTORTURE_IOCTL_RESPONSE_BODY_PADDING8:
     200             :         case FSCTL_SMBTORTURE_GLOBAL_READ_RESPONSE_BODY_PADDING8:
     201             :                 /*
     202             :                  * Some SMB2 specific CtlCodes like FSCTL_DFS_GET_REFERRALS or
     203             :                  * FSCTL_PIPE_WAIT does not take a file handle.
     204             :                  *
     205             :                  * If FileId in the SMB2 Header of the request is not
     206             :                  * 0xFFFFFFFFFFFFFFFF, then the server MUST fail the request
     207             :                  * with STATUS_INVALID_PARAMETER.
     208             :                  */
     209        9872 :                 if (in_file_id_persistent != UINT64_MAX ||
     210           0 :                     in_file_id_volatile != UINT64_MAX) {
     211           0 :                         return smbd_smb2_request_error(req,
     212             :                                 NT_STATUS_INVALID_PARAMETER);
     213             :                 }
     214        9872 :                 break;
     215      300719 :         default:
     216      300719 :                 in_fsp = file_fsp_smb2(req, in_file_id_persistent,
     217             :                                        in_file_id_volatile);
     218      300719 :                 if (in_fsp == NULL) {
     219           6 :                         return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
     220             :                 }
     221      294190 :                 break;
     222             :         }
     223             : 
     224      310585 :         subreq = smbd_smb2_ioctl_send(req, req->sconn->ev_ctx,
     225             :                                       req, in_fsp,
     226             :                                       in_ctl_code,
     227             :                                       in_input_buffer,
     228             :                                       in_max_output_length,
     229             :                                       in_flags);
     230      310585 :         if (subreq == NULL) {
     231           0 :                 return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
     232             :         }
     233             : 
     234             :         /*
     235             :          * If the FSCTL has gone async on a file handle, remember
     236             :          * to add it to the list of async requests we need to wait
     237             :          * for on file handle close.
     238             :          */
     239      310585 :         if (in_fsp != NULL && tevent_req_is_in_progress(subreq)) {
     240             :                 bool ok;
     241             : 
     242      298585 :                 ok = aio_add_req_to_fsp(in_fsp, subreq);
     243      298585 :                 if (!ok) {
     244           0 :                         return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
     245             :                 }
     246             :         }
     247             : 
     248      310585 :         tevent_req_set_callback(subreq, smbd_smb2_request_ioctl_done, req);
     249             : 
     250      310585 :         return smbd_smb2_request_pending_queue(req, subreq, 1000);
     251             : }
     252             : 
     253             : /*
     254             :  * 3.3.4.4 Sending an Error Response
     255             :  * An error code other than one of the following indicates a failure:
     256             :  */
     257      304062 : static bool smbd_smb2_ioctl_is_failure(uint32_t ctl_code, NTSTATUS status,
     258             :                                        size_t data_size)
     259             : {
     260      310585 :         if (NT_STATUS_IS_OK(status)) {
     261      298660 :                 return false;
     262             :         }
     263             : 
     264             :         /*
     265             :          * STATUS_BUFFER_OVERFLOW in a FSCTL_PIPE_TRANSCEIVE, FSCTL_PIPE_PEEK or
     266             :          * FSCTL_DFS_GET_REFERRALS Response specified in section 2.2.32.<153>
     267             :          */
     268        5405 :         if (NT_STATUS_EQUAL(status, STATUS_BUFFER_OVERFLOW)
     269           0 :          && ((ctl_code == FSCTL_PIPE_TRANSCEIVE)
     270           0 :           || (ctl_code == FSCTL_PIPE_PEEK)
     271           0 :           || (ctl_code == FSCTL_DFS_GET_REFERRALS))) {
     272           0 :                 return false;
     273             :         }
     274             : 
     275             :         /*
     276             :          * Any status other than STATUS_SUCCESS in a FSCTL_SRV_COPYCHUNK or
     277             :          * FSCTL_SRV_COPYCHUNK_WRITE Response, when returning an
     278             :          * SRV_COPYCHUNK_RESPONSE as described in section 2.2.32.1.
     279             :          */
     280        5408 :         if (((ctl_code == FSCTL_SRV_COPYCHUNK)
     281        5333 :                                 || (ctl_code == FSCTL_SRV_COPYCHUNK_WRITE))
     282          72 :          && (data_size == sizeof(struct srv_copychunk_rsp))) {
     283          66 :                 return false;
     284             :         }
     285             : 
     286        5336 :         return true;
     287             : }
     288             : 
     289      310585 : static void smbd_smb2_request_ioctl_done(struct tevent_req *subreq)
     290             : {
     291      310585 :         struct smbd_smb2_request *req = tevent_req_callback_data(subreq,
     292             :                                         struct smbd_smb2_request);
     293             :         const uint8_t *inbody;
     294             :         DATA_BLOB outbody;
     295             :         DATA_BLOB outdyn;
     296             :         uint32_t in_ctl_code;
     297             :         uint64_t in_file_id_persistent;
     298             :         uint64_t in_file_id_volatile;
     299             :         uint32_t out_input_offset;
     300             :         uint32_t out_output_offset;
     301      310585 :         DATA_BLOB out_output_buffer = data_blob_null;
     302             :         NTSTATUS status;
     303             :         NTSTATUS error; /* transport error */
     304      310585 :         bool disconnect = false;
     305             :         uint16_t body_size;
     306      310585 :         uint8_t body_padding = 0;
     307             : 
     308      310585 :         status = smbd_smb2_ioctl_recv(subreq, req,
     309             :                                       &out_output_buffer,
     310             :                                       &body_padding,
     311             :                                       &disconnect);
     312             : 
     313      310585 :         DEBUG(10,("smbd_smb2_request_ioctl_done: smbd_smb2_ioctl_recv returned "
     314             :                 "%u status %s\n",
     315             :                 (unsigned int)out_output_buffer.length,
     316             :                 nt_errstr(status) ));
     317             : 
     318      310585 :         TALLOC_FREE(subreq);
     319      310585 :         if (disconnect) {
     320           0 :                 error = status;
     321           0 :                 smbd_server_connection_terminate(req->xconn,
     322             :                                                  nt_errstr(error));
     323           0 :                 return;
     324             :         }
     325             : 
     326      310585 :         inbody = SMBD_SMB2_IN_BODY_PTR(req);
     327             : 
     328      310585 :         in_ctl_code             = IVAL(inbody, 0x04);
     329      310585 :         in_file_id_persistent   = BVAL(inbody, 0x08);
     330      310585 :         in_file_id_volatile     = BVAL(inbody, 0x10);
     331             : 
     332      310588 :         if (smbd_smb2_ioctl_is_failure(in_ctl_code, status,
     333             :                                        out_output_buffer.length)) {
     334        5339 :                 error = smbd_smb2_request_error(req, status);
     335        5339 :                 if (!NT_STATUS_IS_OK(error)) {
     336           0 :                         smbd_server_connection_terminate(req->xconn,
     337             :                                                          nt_errstr(error));
     338           0 :                         return;
     339             :                 }
     340        5336 :                 return;
     341             :         }
     342             : 
     343             :         /*
     344             :          * Only FSCTL_SMBTORTURE_IOCTL_RESPONSE_BODY_PADDING8
     345             :          * sets body_padding to a value different from 0.
     346             :          */
     347      305246 :         body_size = 0x30 + body_padding;
     348      305246 :         out_input_offset = SMB2_HDR_BODY + body_size;
     349      305246 :         out_output_offset = SMB2_HDR_BODY + body_size;
     350             : 
     351      305246 :         outbody = smbd_smb2_generate_outbody(req, body_size);
     352      305246 :         if (outbody.data == NULL) {
     353           0 :                 error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
     354           0 :                 if (!NT_STATUS_IS_OK(error)) {
     355           0 :                         smbd_server_connection_terminate(req->xconn,
     356             :                                                          nt_errstr(error));
     357           0 :                         return;
     358             :                 }
     359           0 :                 return;
     360             :         }
     361             : 
     362      305246 :         SSVAL(outbody.data, 0x00, 0x30 + 1);    /* struct size */
     363      305246 :         SSVAL(outbody.data, 0x02, 0);           /* reserved */
     364      305246 :         SIVAL(outbody.data, 0x04,
     365             :               in_ctl_code);                     /* ctl code */
     366      305246 :         SBVAL(outbody.data, 0x08,
     367             :               in_file_id_persistent);           /* file id (persistent) */
     368      305246 :         SBVAL(outbody.data, 0x10,
     369             :               in_file_id_volatile);             /* file id (volatile) */
     370      305246 :         SIVAL(outbody.data, 0x18,
     371             :               out_input_offset);                /* input offset */
     372      305246 :         SIVAL(outbody.data, 0x1C, 0);           /* input count */
     373      305246 :         SIVAL(outbody.data, 0x20,
     374             :               out_output_offset);               /* output offset */
     375      305246 :         SIVAL(outbody.data, 0x24,
     376             :               out_output_buffer.length);        /* output count */
     377      305246 :         SIVAL(outbody.data, 0x28, 0);           /* flags */
     378      305246 :         SIVAL(outbody.data, 0x2C, 0);           /* reserved */
     379      305246 :         if (body_padding != 0) {
     380           6 :                 memset(outbody.data + 0x30, 0, body_padding);
     381             :         }
     382             : 
     383             :         /*
     384             :          * Note: Windows Vista and 2008 send back also the
     385             :          *       input from the request. But it was fixed in
     386             :          *       Windows 7.
     387             :          */
     388      305246 :         outdyn = out_output_buffer;
     389             : 
     390      305246 :         error = smbd_smb2_request_done_ex(req, status, outbody, &outdyn,
     391             :                                           __location__);
     392      305246 :         if (!NT_STATUS_IS_OK(error)) {
     393           0 :                 smbd_server_connection_terminate(req->xconn,
     394             :                                                  nt_errstr(error));
     395           0 :                 return;
     396             :         }
     397             : }
     398             : 
     399      310585 : static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx,
     400             :                                                struct tevent_context *ev,
     401             :                                                struct smbd_smb2_request *smb2req,
     402             :                                                struct files_struct *fsp,
     403             :                                                uint32_t in_ctl_code,
     404             :                                                DATA_BLOB in_input,
     405             :                                                uint32_t in_max_output,
     406             :                                                uint32_t in_flags)
     407             : {
     408             :         struct tevent_req *req;
     409             :         struct smbd_smb2_ioctl_state *state;
     410             :         struct smb_request *smbreq;
     411             : 
     412      310585 :         req = tevent_req_create(mem_ctx, &state,
     413             :                                 struct smbd_smb2_ioctl_state);
     414      310585 :         if (req == NULL) {
     415           0 :                 return NULL;
     416             :         }
     417      310585 :         state->smb2req = smb2req;
     418      310585 :         state->smbreq = NULL;
     419      310585 :         state->fsp = fsp;
     420      310585 :         state->in_input = in_input;
     421      310585 :         state->in_max_output = in_max_output;
     422      310585 :         state->out_output = data_blob_null;
     423             : 
     424      310585 :         DEBUG(10, ("smbd_smb2_ioctl: ctl_code[0x%08x] %s, %s\n",
     425             :                    (unsigned)in_ctl_code,
     426             :                    fsp ? fsp_str_dbg(fsp) : "<no handle>",
     427             :                    fsp_fnum_dbg(fsp)));
     428             : 
     429      310585 :         smbreq = smbd_smb2_fake_smb_request(smb2req);
     430      310585 :         if (tevent_req_nomem(smbreq, req)) {
     431           0 :                 return tevent_req_post(req, ev);
     432             :         }
     433      310585 :         state->smbreq = smbreq;
     434             : 
     435      310585 :         switch (in_ctl_code & IOCTL_DEV_TYPE_MASK) {
     436        6709 :         case FSCTL_DFS:
     437        6709 :                 return smb2_ioctl_dfs(in_ctl_code, ev, req, state);
     438             :                 break;
     439         708 :         case FSCTL_FILESYSTEM:
     440         708 :                 return smb2_ioctl_filesys(in_ctl_code, ev, req, state);
     441             :                 break;
     442      298133 :         case FSCTL_NAMED_PIPE:
     443      298133 :                 return smb2_ioctl_named_pipe(in_ctl_code, ev, req, state);
     444             :                 break;
     445        4691 :         case FSCTL_NETWORK_FILESYSTEM:
     446        4691 :                 return smb2_ioctl_network_fs(in_ctl_code, ev, req, state);
     447             :                 break;
     448         344 :         case FSCTL_SMBTORTURE:
     449         344 :                 return smb2_ioctl_smbtorture(in_ctl_code, ev, req, state);
     450             :                 break;
     451           0 :         default:
     452           0 :                 if (IS_IPC(smbreq->conn)) {
     453           0 :                         tevent_req_nterror(req, NT_STATUS_FS_DRIVER_REQUIRED);
     454             :                 } else {
     455           0 :                         tevent_req_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST);
     456             :                 }
     457             : 
     458           0 :                 return tevent_req_post(req, ev);
     459             :                 break;
     460             :         }
     461             : 
     462             :         tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
     463             :         return tevent_req_post(req, ev);
     464             : }
     465             : 
     466      310585 : static NTSTATUS smbd_smb2_ioctl_recv(struct tevent_req *req,
     467             :                                      TALLOC_CTX *mem_ctx,
     468             :                                      DATA_BLOB *out_output,
     469             :                                      uint8_t *body_padding,
     470             :                                      bool *disconnect)
     471             : {
     472      310585 :         NTSTATUS status = NT_STATUS_OK;
     473      310585 :         struct smbd_smb2_ioctl_state *state = tevent_req_data(req,
     474             :                                               struct smbd_smb2_ioctl_state);
     475             :         enum tevent_req_state req_state;
     476             :         uint64_t err;
     477             : 
     478      310585 :         *body_padding = state->body_padding;
     479      310585 :         *disconnect = state->disconnect;
     480             : 
     481      310585 :         if ((tevent_req_is_error(req, &req_state, &err) == false)
     482        5405 :          || (req_state == TEVENT_REQ_USER_ERROR)) {
     483             :                 /*
     484             :                  * Return output buffer to caller if the ioctl was successfully
     485             :                  * processed, even if a user error occurred. Some ioctls return
     486             :                  * data on failure.
     487             :                  */
     488      310585 :                 *out_output = state->out_output;
     489      310585 :                 talloc_steal(mem_ctx, out_output->data);
     490             :         }
     491             : 
     492      310585 :         tevent_req_is_nterror(req, &status);
     493      310585 :         tevent_req_received(req);
     494      310585 :         return status;
     495             : }

Generated by: LCOV version 1.13