LCOV - code coverage report
Current view: top level - source4/libcli/raw - rawsetfileinfo.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 224 244 91.8 %
Date: 2024-04-21 15:09:00 Functions: 10 10 100.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             :    RAW_SFILEINFO_* calls
       4             :    Copyright (C) James Myers 2003
       5             :    Copyright (C) Andrew Tridgell 2003
       6             :    Copyright (C) James Peach 2007
       7             : 
       8             :    This program is free software; you can redistribute it and/or modify
       9             :    it under the terms of the GNU General Public License as published by
      10             :    the Free Software Foundation; either version 3 of the License, or
      11             :    (at your option) any later version.
      12             : 
      13             :    This program is distributed in the hope that it will be useful,
      14             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16             :    GNU General Public License for more details.
      17             : 
      18             :    You should have received a copy of the GNU General Public License
      19             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      20             : */
      21             : 
      22             : #include "includes.h"
      23             : #include "libcli/raw/libcliraw.h"
      24             : #include "libcli/raw/raw_proto.h"
      25             : #include "librpc/gen_ndr/ndr_security.h"
      26             : 
      27             : 
      28             : /*
      29             :   Handle setfileinfo/setpathinfo passthu constructions
      30             : */
      31        9097 : bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
      32             :                                   enum smb_setfileinfo_level level,
      33             :                                   union smb_setfileinfo *parms,
      34             :                                   DATA_BLOB *blob)
      35             : {
      36          62 :         unsigned int len;
      37             : 
      38             : #define NEED_BLOB(n) do { \
      39             :           *blob = data_blob_talloc(mem_ctx, NULL, n); \
      40             :           if (blob->data == NULL && n != 0) return false; \
      41             :         } while (0)
      42             : 
      43        9097 :         switch (level) {
      44        2243 :         case RAW_SFILEINFO_BASIC_INFORMATION:
      45        2243 :                 NEED_BLOB(40);
      46        2243 :                 smbcli_push_nttime(blob->data,  0, parms->basic_info.in.create_time);
      47        2243 :                 smbcli_push_nttime(blob->data,  8, parms->basic_info.in.access_time);
      48        2243 :                 smbcli_push_nttime(blob->data, 16, parms->basic_info.in.write_time);
      49        2243 :                 smbcli_push_nttime(blob->data, 24, parms->basic_info.in.change_time);
      50        2243 :                 SIVAL(blob->data,           32, parms->basic_info.in.attrib);
      51        2243 :                 SIVAL(blob->data,           36, 0); /* padding */
      52        2243 :                 return true;
      53             : 
      54         315 :         case RAW_SFILEINFO_DISPOSITION_INFORMATION:
      55         315 :                 NEED_BLOB(4);
      56         315 :                 SIVAL(blob->data, 0, parms->disposition_info.in.delete_on_close);
      57         315 :                 return true;
      58             : 
      59          20 :         case RAW_SFILEINFO_ALLOCATION_INFORMATION:
      60          20 :                 NEED_BLOB(8);
      61          20 :                 SBVAL(blob->data, 0, parms->allocation_info.in.alloc_size);
      62          20 :                 return true;
      63             : 
      64         832 :         case RAW_SFILEINFO_END_OF_FILE_INFORMATION:
      65         832 :                 NEED_BLOB(8);
      66         832 :                 SBVAL(blob->data, 0, parms->end_of_file_info.in.size);
      67         832 :                 return true;
      68             : 
      69         166 :         case RAW_SFILEINFO_RENAME_INFORMATION:
      70         166 :                 NEED_BLOB(12);
      71         166 :                 SIVAL(blob->data, 0, parms->rename_information.in.overwrite);
      72         166 :                 SIVAL(blob->data, 4, parms->rename_information.in.root_fid);
      73         166 :                 len = smbcli_blob_append_string(NULL, mem_ctx, blob,
      74             :                                                 parms->rename_information.in.new_name,
      75             :                                                 STR_UNICODE|STR_TERMINATE);
      76         166 :                 SIVAL(blob->data, 8, len - 2);
      77         166 :                 return true;
      78             : 
      79         699 :         case RAW_SFILEINFO_RENAME_INFORMATION_SMB2:
      80         699 :                 NEED_BLOB(20);
      81         699 :                 SIVAL(blob->data, 0, parms->rename_information.in.overwrite);
      82         699 :                 SIVAL(blob->data, 4, 0);
      83         699 :                 SBVAL(blob->data, 8, parms->rename_information.in.root_fid);
      84         699 :                 len = smbcli_blob_append_string(NULL, mem_ctx, blob,
      85             :                                                 parms->rename_information.in.new_name,
      86             :                                                 STR_UNICODE|STR_TERMINATE);
      87         699 :                 SIVAL(blob->data, 16, len - 2);
      88         699 :                 return true;
      89             : 
      90         173 :         case RAW_SFILEINFO_POSITION_INFORMATION:
      91         173 :                 NEED_BLOB(8);
      92         173 :                 SBVAL(blob->data, 0, parms->position_information.in.position);
      93         173 :                 return true;
      94             : 
      95          11 :         case RAW_SFILEINFO_MODE_INFORMATION:
      96          11 :                 NEED_BLOB(4);
      97          11 :                 SIVAL(blob->data, 0, parms->mode_information.in.mode);
      98          11 :                 return true;
      99             : 
     100        4624 :         case RAW_FILEINFO_SEC_DESC: {
     101           2 :                 enum ndr_err_code ndr_err;
     102             : 
     103        4624 :                 ndr_err = ndr_push_struct_blob(blob, mem_ctx, parms->set_secdesc.in.sd,
     104             :                                                (ndr_push_flags_fn_t)ndr_push_security_descriptor);
     105        4624 :                 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     106           0 :                         return false;
     107             :                 }
     108             : 
     109        4622 :                 return true;
     110             :         }
     111             : 
     112           9 :         case RAW_SFILEINFO_FULL_EA_INFORMATION:
     113           9 :                 printf("num_eas=%d\n", parms->full_ea_information.in.eas.num_eas);
     114           9 :                 NEED_BLOB(ea_list_size_chained(
     115             :                                   parms->full_ea_information.in.eas.num_eas,
     116             :                                   parms->full_ea_information.in.eas.eas, 4));
     117           9 :                 ea_put_list_chained(blob->data,
     118             :                                     parms->full_ea_information.in.eas.num_eas,
     119             :                                     parms->full_ea_information.in.eas.eas, 4);
     120           9 :                 return true;
     121             : 
     122           1 :         case RAW_SFILEINFO_LINK_INFORMATION:
     123           1 :                 NEED_BLOB(20);
     124           1 :                 memset(blob->data, 0, blob->length);
     125             : 
     126           1 :                 PUSH_LE_U8(blob->data, 0, parms->link_information.in.overwrite);
     127           1 :                 PUSH_LE_U64(blob->data, 8, parms->link_information.in.root_fid);
     128             : 
     129           1 :                 len = smbcli_blob_append_string(
     130             :                         NULL, mem_ctx, blob,
     131             :                         parms->link_information.in.new_name,
     132             :                         STR_UNICODE | STR_TERMINATE);
     133           1 :                 PUSH_LE_U32(blob->data, 16, len - 2);
     134           1 :                 return true;
     135             : 
     136             :                 /* Unhandled levels */
     137           4 :         case RAW_SFILEINFO_PIPE_INFORMATION:
     138             :         case RAW_SFILEINFO_VALID_DATA_INFORMATION:
     139             :         case RAW_SFILEINFO_SHORT_NAME_INFORMATION:
     140             :         case RAW_SFILEINFO_1025:
     141             :         case RAW_SFILEINFO_1027:
     142             :         case RAW_SFILEINFO_1029:
     143             :         case RAW_SFILEINFO_1030:
     144             :         case RAW_SFILEINFO_1031:
     145             :         case RAW_SFILEINFO_1032:
     146             :         case RAW_SFILEINFO_1036:
     147             :         case RAW_SFILEINFO_1041:
     148             :         case RAW_SFILEINFO_1042:
     149             :         case RAW_SFILEINFO_1043:
     150             :         case RAW_SFILEINFO_1044:
     151           4 :                 break;
     152             : 
     153           0 :         default:
     154           0 :                 DEBUG(0,("Unhandled setfileinfo passthru level %d\n", level));
     155           0 :                 return false;
     156             :         }
     157             : 
     158           4 :         return false;
     159             : }
     160             : 
     161             : /*
     162             :   Handle setfileinfo/setpathinfo trans2 backend.
     163             : */
     164        5909 : static bool smb_raw_setinfo_backend(struct smbcli_tree *tree,
     165             :                                     TALLOC_CTX *mem_ctx,
     166             :                                     union smb_setfileinfo *parms,
     167             :                                     DATA_BLOB *blob)
     168             : {
     169        5909 :         switch (parms->generic.level) {
     170           0 :         case RAW_SFILEINFO_GENERIC:
     171             :         case RAW_SFILEINFO_SETATTR:
     172             :         case RAW_SFILEINFO_SETATTRE:
     173             :         case RAW_SFILEINFO_SEC_DESC:
     174             :                 /* not handled here */
     175           0 :                 return false;
     176             : 
     177           3 :         case RAW_SFILEINFO_STANDARD:
     178           3 :                 NEED_BLOB(12);
     179           3 :                 raw_push_dos_date2(tree->session->transport,
     180             :                                   blob->data, 0, parms->standard.in.create_time);
     181           3 :                 raw_push_dos_date2(tree->session->transport,
     182             :                                   blob->data, 4, parms->standard.in.access_time);
     183           3 :                 raw_push_dos_date2(tree->session->transport,
     184             :                                   blob->data, 8, parms->standard.in.write_time);
     185           3 :                 return true;
     186             : 
     187        3215 :         case RAW_SFILEINFO_EA_SET:
     188        3215 :                 NEED_BLOB(ea_list_size(parms->ea_set.in.num_eas, parms->ea_set.in.eas));
     189        3215 :                 ea_put_list(blob->data, parms->ea_set.in.num_eas, parms->ea_set.in.eas);
     190        3215 :                 return true;
     191             : 
     192        1406 :         case RAW_SFILEINFO_BASIC_INFO:
     193             :         case RAW_SFILEINFO_BASIC_INFORMATION:
     194        1406 :                 return smb_raw_setfileinfo_passthru(mem_ctx, RAW_SFILEINFO_BASIC_INFORMATION,
     195             :                                                     parms, blob);
     196             : 
     197          14 :         case RAW_SFILEINFO_UNIX_BASIC:
     198          14 :                 NEED_BLOB(100);
     199          14 :                 SBVAL(blob->data, 0, parms->unix_basic.in.end_of_file);
     200          14 :                 SBVAL(blob->data, 8, parms->unix_basic.in.num_bytes);
     201          14 :                 smbcli_push_nttime(blob->data, 16, parms->unix_basic.in.status_change_time);
     202          14 :                 smbcli_push_nttime(blob->data, 24, parms->unix_basic.in.access_time);
     203          14 :                 smbcli_push_nttime(blob->data, 32, parms->unix_basic.in.change_time);
     204          14 :                 SBVAL(blob->data, 40, parms->unix_basic.in.uid);
     205          14 :                 SBVAL(blob->data, 48, parms->unix_basic.in.gid);
     206          14 :                 SIVAL(blob->data, 56, parms->unix_basic.in.file_type);
     207          14 :                 SBVAL(blob->data, 60, parms->unix_basic.in.dev_major);
     208          14 :                 SBVAL(blob->data, 68, parms->unix_basic.in.dev_minor);
     209          14 :                 SBVAL(blob->data, 76, parms->unix_basic.in.unique_id);
     210          14 :                 SBVAL(blob->data, 84, parms->unix_basic.in.permissions);
     211          14 :                 SBVAL(blob->data, 92, parms->unix_basic.in.nlink);
     212          14 :                 return true;
     213             : 
     214         132 :         case RAW_SFILEINFO_UNIX_INFO2:
     215         132 :                 NEED_BLOB(116);
     216         132 :                 SBVAL(blob->data,   0, parms->unix_info2.in.end_of_file);
     217         132 :                 SBVAL(blob->data,   8, parms->unix_info2.in.num_bytes);
     218         132 :                 smbcli_push_nttime(blob->data, 16, parms->unix_info2.in.status_change_time);
     219         132 :                 smbcli_push_nttime(blob->data, 24, parms->unix_info2.in.access_time);
     220         132 :                 smbcli_push_nttime(blob->data, 32, parms->unix_info2.in.change_time);
     221         132 :                 SBVAL(blob->data,  40,parms->unix_info2.in.uid);
     222         132 :                 SBVAL(blob->data,  48,parms->unix_info2.in.gid);
     223         132 :                 SIVAL(blob->data,  56,parms->unix_info2.in.file_type);
     224         132 :                 SBVAL(blob->data,  60,parms->unix_info2.in.dev_major);
     225         132 :                 SBVAL(blob->data,  68,parms->unix_info2.in.dev_minor);
     226         132 :                 SBVAL(blob->data,  76,parms->unix_info2.in.unique_id);
     227         132 :                 SBVAL(blob->data,  84,parms->unix_info2.in.permissions);
     228         132 :                 SBVAL(blob->data,  92,parms->unix_info2.in.nlink);
     229         132 :                 smbcli_push_nttime(blob->data, 100, parms->unix_info2.in.create_time);
     230         132 :                 SIVAL(blob->data, 108, parms->unix_info2.in.file_flags);
     231         132 :                 SIVAL(blob->data, 112, parms->unix_info2.in.flags_mask);
     232         132 :                 return true;
     233             : 
     234         238 :         case RAW_SFILEINFO_DISPOSITION_INFO:
     235             :         case RAW_SFILEINFO_DISPOSITION_INFORMATION:
     236         238 :                 return smb_raw_setfileinfo_passthru(mem_ctx, RAW_SFILEINFO_DISPOSITION_INFORMATION,
     237             :                                                     parms, blob);
     238             : 
     239          15 :         case RAW_SFILEINFO_ALLOCATION_INFO:
     240             :         case RAW_SFILEINFO_ALLOCATION_INFORMATION:
     241          15 :                 return smb_raw_setfileinfo_passthru(mem_ctx, RAW_SFILEINFO_ALLOCATION_INFORMATION,
     242             :                                                     parms, blob);
     243             : 
     244         674 :         case RAW_SFILEINFO_END_OF_FILE_INFO:
     245             :         case RAW_SFILEINFO_END_OF_FILE_INFORMATION:
     246         674 :                 return smb_raw_setfileinfo_passthru(mem_ctx, RAW_SFILEINFO_END_OF_FILE_INFORMATION,
     247             :                                                     parms, blob);
     248             : 
     249         166 :         case RAW_SFILEINFO_RENAME_INFORMATION:
     250         166 :                 return smb_raw_setfileinfo_passthru(mem_ctx, RAW_SFILEINFO_RENAME_INFORMATION,
     251             :                                                     parms, blob);
     252             : 
     253          32 :         case RAW_SFILEINFO_POSITION_INFORMATION:
     254          32 :                 return smb_raw_setfileinfo_passthru(mem_ctx, RAW_SFILEINFO_POSITION_INFORMATION,
     255             :                                                     parms, blob);
     256             : 
     257           8 :         case RAW_SFILEINFO_MODE_INFORMATION:
     258           8 :                 return smb_raw_setfileinfo_passthru(mem_ctx, RAW_SFILEINFO_MODE_INFORMATION,
     259             :                                                     parms, blob);
     260             : 
     261             :                 /* Unhandled passthru levels */
     262           6 :         case RAW_SFILEINFO_PIPE_INFORMATION:
     263             :         case RAW_SFILEINFO_VALID_DATA_INFORMATION:
     264             :         case RAW_SFILEINFO_SHORT_NAME_INFORMATION:
     265             :         case RAW_SFILEINFO_FULL_EA_INFORMATION:
     266             :         case RAW_SFILEINFO_1025:
     267             :         case RAW_SFILEINFO_1027:
     268             :         case RAW_SFILEINFO_1029:
     269             :         case RAW_SFILEINFO_1030:
     270             :         case RAW_SFILEINFO_1031:
     271             :         case RAW_SFILEINFO_1032:
     272             :         case RAW_SFILEINFO_1036:
     273             :         case RAW_SFILEINFO_1041:
     274             :         case RAW_SFILEINFO_1042:
     275             :         case RAW_SFILEINFO_1043:
     276             :         case RAW_SFILEINFO_1044:
     277           6 :                 return smb_raw_setfileinfo_passthru(mem_ctx, parms->generic.level,
     278             :                                                     parms, blob);
     279             : 
     280             :         /* Unhandled levels */
     281           0 :         case RAW_SFILEINFO_UNIX_LINK:
     282             :         case RAW_SFILEINFO_UNIX_HLINK:
     283             :         case RAW_SFILEINFO_RENAME_INFORMATION_SMB2:
     284             :         case RAW_SFILEINFO_LINK_INFORMATION:
     285           0 :                 break;
     286             :         }
     287             : 
     288           0 :         return false;
     289             : }
     290             : 
     291             : /****************************************************************************
     292             :  Very raw set file info - takes data blob (async send)
     293             : ****************************************************************************/
     294        5547 : static struct smbcli_request *smb_raw_setfileinfo_blob_send(struct smbcli_tree *tree,
     295             :                                                          TALLOC_CTX *mem_ctx,
     296             :                                                          uint16_t fnum,
     297             :                                                          uint16_t info_level,
     298             :                                                          DATA_BLOB *blob)
     299             : {
     300         537 :         struct smb_trans2 tp;
     301        5547 :         uint16_t setup = TRANSACT2_SETFILEINFO;
     302             : 
     303        5547 :         tp.in.max_setup = 0;
     304        5547 :         tp.in.flags = 0;
     305        5547 :         tp.in.timeout = 0;
     306        5547 :         tp.in.setup_count = 1;
     307        5547 :         tp.in.max_param = 2;
     308        5547 :         tp.in.max_data = 0;
     309        5547 :         tp.in.setup = &setup;
     310             : 
     311        5547 :         tp.in.params = data_blob_talloc(mem_ctx, NULL, 6);
     312        5547 :         if (!tp.in.params.data) {
     313           0 :                 return NULL;
     314             :         }
     315        5547 :         SSVAL(tp.in.params.data, 0, fnum);
     316        5547 :         SSVAL(tp.in.params.data, 2, info_level);
     317        5547 :         SSVAL(tp.in.params.data, 4, 0); /* reserved */
     318             : 
     319        5547 :         tp.in.data = *blob;
     320             : 
     321        5547 :         return smb_raw_trans2_send(tree, &tp);
     322             : }
     323             : 
     324             : /****************************************************************************
     325             :  Very raw set path info - takes data blob
     326             : ****************************************************************************/
     327         358 : static struct smbcli_request *smb_raw_setpathinfo_blob_send(struct smbcli_tree *tree,
     328             :                                                             TALLOC_CTX *mem_ctx,
     329             :                                                             const char *fname,
     330             :                                                             uint16_t info_level,
     331             :                                                             DATA_BLOB *blob)
     332             : {
     333          12 :         struct smb_trans2 tp;
     334         358 :         uint16_t setup = TRANSACT2_SETPATHINFO;
     335             : 
     336         358 :         tp.in.max_setup = 0;
     337         358 :         tp.in.flags = 0;
     338         358 :         tp.in.timeout = 0;
     339         358 :         tp.in.setup_count = 1;
     340         358 :         tp.in.max_param = 2;
     341         358 :         tp.in.max_data = 0;
     342         358 :         tp.in.setup = &setup;
     343             : 
     344         358 :         tp.in.params = data_blob_talloc(mem_ctx, NULL, 6);
     345         358 :         if (!tp.in.params.data) {
     346           0 :                 return NULL;
     347             :         }
     348         358 :         SSVAL(tp.in.params.data, 0, info_level);
     349         358 :         SIVAL(tp.in.params.data, 2, 0);
     350         358 :         smbcli_blob_append_string(tree->session, mem_ctx,
     351             :                                   &tp.in.params,
     352             :                                   fname, STR_TERMINATE);
     353             : 
     354         358 :         tp.in.data = *blob;
     355             : 
     356         358 :         return smb_raw_trans2_send(tree, &tp);
     357             : }
     358             : 
     359             : /****************************************************************************
     360             :  Handle setattr (async send)
     361             : ****************************************************************************/
     362        1352 : static struct smbcli_request *smb_raw_setattr_send(struct smbcli_tree *tree,
     363             :                                                 union smb_setfileinfo *parms)
     364             : {
     365         141 :         struct smbcli_request *req;
     366             : 
     367        1352 :         req = smbcli_request_setup(tree, SMBsetatr, 8, 0);
     368        1352 :         if (!req) return NULL;
     369             : 
     370        1352 :         SSVAL(req->out.vwv,         VWV(0), parms->setattr.in.attrib);
     371        1352 :         raw_push_dos_date3(tree->session->transport,
     372             :                           req->out.vwv, VWV(1), parms->setattr.in.write_time);
     373        1352 :         memset(req->out.vwv + VWV(3), 0, 10); /* reserved */
     374        1352 :         smbcli_req_append_ascii4(req, parms->setattr.in.file.path, STR_TERMINATE);
     375        1352 :         smbcli_req_append_ascii4(req, "", STR_TERMINATE);
     376             : 
     377        1352 :         if (!smbcli_request_send(req)) {
     378           0 :                 smbcli_request_destroy(req);
     379           0 :                 return NULL;
     380             :         }
     381             : 
     382        1211 :         return req;
     383             : }
     384             : 
     385             : /****************************************************************************
     386             :  Handle setattrE. (async send)
     387             : ****************************************************************************/
     388           2 : static struct smbcli_request *smb_raw_setattrE_send(struct smbcli_tree *tree,
     389             :                                                  union smb_setfileinfo *parms)
     390             : {
     391           0 :         struct smbcli_request *req;
     392             : 
     393           2 :         req = smbcli_request_setup(tree, SMBsetattrE, 7, 0);
     394           2 :         if (!req) return NULL;
     395             : 
     396           2 :         SSVAL(req->out.vwv,         VWV(0), parms->setattre.in.file.fnum);
     397           2 :         raw_push_dos_date2(tree->session->transport,
     398             :                           req->out.vwv, VWV(1), parms->setattre.in.create_time);
     399           2 :         raw_push_dos_date2(tree->session->transport,
     400             :                           req->out.vwv, VWV(3), parms->setattre.in.access_time);
     401           2 :         raw_push_dos_date2(tree->session->transport,
     402             :                           req->out.vwv, VWV(5), parms->setattre.in.write_time);
     403             : 
     404           2 :         if (!smbcli_request_send(req)) {
     405           0 :                 smbcli_request_destroy(req);
     406           0 :                 return NULL;
     407             :         }
     408             : 
     409           2 :         return req;
     410             : }
     411             : 
     412             : /****************************************************************************
     413             :  Set file info (async send)
     414             : ****************************************************************************/
     415       12622 : struct smbcli_request *smb_raw_setfileinfo_send(struct smbcli_tree *tree,
     416             :                                              union smb_setfileinfo *parms)
     417             : {
     418         537 :         DATA_BLOB blob;
     419         537 :         TALLOC_CTX *mem_ctx;
     420         537 :         struct smbcli_request *req;
     421             : 
     422       12622 :         if (parms->generic.level == RAW_SFILEINFO_SETATTRE) {
     423           2 :                 return smb_raw_setattrE_send(tree, parms);
     424             :         }
     425       12620 :         if (parms->generic.level == RAW_SFILEINFO_SEC_DESC) {
     426        7073 :                 return smb_raw_set_secdesc_send(tree, parms);
     427             :         }
     428        5547 :         if (parms->generic.level >= RAW_SFILEINFO_GENERIC) {
     429           0 :                 return NULL;
     430             :         }
     431             : 
     432        5547 :         mem_ctx = talloc_init("setpathinfo");
     433        5547 :         if (!mem_ctx) return NULL;
     434             : 
     435        5547 :         if (!smb_raw_setinfo_backend(tree, mem_ctx, parms, &blob)) {
     436           0 :                 talloc_free(mem_ctx);
     437           0 :                 return NULL;
     438             :         }
     439             : 
     440             :         /* send request and process the output */
     441        6084 :         req = smb_raw_setfileinfo_blob_send(tree,
     442             :                                             mem_ctx,
     443        5547 :                                             parms->generic.in.file.fnum,
     444        5547 :                                             parms->generic.level,
     445             :                                             &blob);
     446             : 
     447        5547 :         talloc_free(mem_ctx);
     448        5547 :         return req;
     449             : }
     450             : 
     451             : /****************************************************************************
     452             :  Set file info (async send)
     453             : ****************************************************************************/
     454       12079 : _PUBLIC_ NTSTATUS smb_raw_setfileinfo(struct smbcli_tree *tree,
     455             :                              union smb_setfileinfo *parms)
     456             : {
     457       12079 :         struct smbcli_request *req = smb_raw_setfileinfo_send(tree, parms);
     458       12079 :         return smbcli_request_simple_recv(req);
     459             : }
     460             : 
     461             : 
     462             : /****************************************************************************
     463             :  Set path info (async send)
     464             : ****************************************************************************/
     465        1714 : _PUBLIC_ struct smbcli_request *smb_raw_setpathinfo_send(struct smbcli_tree *tree,
     466             :                                              union smb_setfileinfo *parms)
     467             : {
     468         153 :         DATA_BLOB blob;
     469         153 :         TALLOC_CTX *mem_ctx;
     470         153 :         struct smbcli_request *req;
     471             : 
     472        1714 :         if (parms->generic.level == RAW_SFILEINFO_SETATTR) {
     473        1352 :                 return smb_raw_setattr_send(tree, parms);
     474             :         }
     475         362 :         if (parms->generic.level >= RAW_SFILEINFO_GENERIC) {
     476           0 :                 return NULL;
     477             :         }
     478             : 
     479         362 :         mem_ctx = talloc_init("setpathinfo");
     480         362 :         if (!mem_ctx) return NULL;
     481             : 
     482         362 :         if (!smb_raw_setinfo_backend(tree, mem_ctx, parms, &blob)) {
     483           4 :                 talloc_free(mem_ctx);
     484           4 :                 return NULL;
     485             :         }
     486             : 
     487             :         /* send request and process the output */
     488         370 :         req = smb_raw_setpathinfo_blob_send(tree,
     489             :                                             mem_ctx,
     490             :                                             parms->generic.in.file.path,
     491         358 :                                             parms->generic.level,
     492             :                                             &blob);
     493             : 
     494         358 :         talloc_free(mem_ctx);
     495         358 :         return req;
     496             : }
     497             : 
     498             : /****************************************************************************
     499             :  Set path info (sync interface)
     500             : ****************************************************************************/
     501        1568 : _PUBLIC_ NTSTATUS smb_raw_setpathinfo(struct smbcli_tree *tree,
     502             :                              union smb_setfileinfo *parms)
     503             : {
     504        1568 :         struct smbcli_request *req = smb_raw_setpathinfo_send(tree, parms);
     505        1568 :         return smbcli_request_simple_recv(req);
     506             : }

Generated by: LCOV version 1.14