Changeset 988 for vendor/current/source3/smbd/nttrans.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/smbd/nttrans.c
r914 r988 28 28 #include "passdb/lookup_sid.h" 29 29 #include "auth.h" 30 #include "ntioctl.h"31 30 #include "smbprofile.h" 32 31 #include "libsmb/libsmb.h" 32 #include "lib/util_ea.h" 33 33 34 34 extern const struct generic_mapping file_generic_mapping; … … 55 55 ****************************************************************************/ 56 56 57 void send_nt_replies(connection_struct *conn,58 struct smb_request *req, NTSTATUS nt_error,59 60 57 static void send_nt_replies(connection_struct *conn, 58 struct smb_request *req, NTSTATUS nt_error, 59 char *params, int paramsize, 60 char *pdata, int datasize) 61 61 { 62 62 int data_to_send = datasize; … … 68 68 int alignment_offset = 1; 69 69 int data_alignment_offset = 0; 70 struct smb d_server_connection *sconn = req->sconn;71 int max_send = sconn->smb1.sessions.max_send;70 struct smbXsrv_connection *xconn = req->xconn; 71 int max_send = xconn->smb1.sessions.max_send; 72 72 73 73 /* … … 84 84 } 85 85 show_msg((char *)req->outbuf); 86 if (!srv_send_smb( sconn,86 if (!srv_send_smb(xconn, 87 87 (char *)req->outbuf, 88 88 true, req->seqnum+1, … … 248 248 /* Send the packet */ 249 249 show_msg((char *)req->outbuf); 250 if (!srv_send_smb( sconn,250 if (!srv_send_smb(xconn, 251 251 (char *)req->outbuf, 252 252 true, req->seqnum+1, … … 281 281 282 282 static void nt_open_pipe(char *fname, connection_struct *conn, 283 struct smb_request *req, int *ppnum)283 struct smb_request *req, uint16_t *ppnum) 284 284 { 285 285 files_struct *fsp; … … 288 288 DEBUG(4,("nt_open_pipe: Opening pipe %s.\n", fname)); 289 289 290 /* Strip \\ off the name. */ 291 fname++; 290 /* Strip \\ off the name if present. */ 291 while (fname[0] == '\\') { 292 fname++; 293 } 292 294 293 295 status = open_np_file(req, fname, &fsp); … … 314 316 { 315 317 char *fname = NULL; 316 int pnum = -1;318 uint16_t pnum = FNUM_FIELD_INVALID; 317 319 char *p = NULL; 318 uint32 flags = IVAL(req->vwv+3, 1);320 uint32_t flags = IVAL(req->vwv+3, 1); 319 321 TALLOC_CTX *ctx = talloc_tos(); 320 322 … … 340 342 /* This is very strange. We 341 343 * return 50 words, but only set 342 * the wcnt to 42 ? It's definately344 * the wcnt to 42 ? It's definitely 343 345 * what happens on the wire.... 344 346 */ … … 348 350 reply_outbuf(req, 34, 0); 349 351 } 352 353 SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ 354 SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ 350 355 351 356 p = (char *)req->outbuf + smb_vwv2; … … 376 381 377 382 DEBUG(5,("do_ntcreate_pipe_open: open pipe = %s\n", fname)); 378 379 chain_reply(req);380 383 } 381 384 … … 436 439 struct smb_filename *smb_fname = NULL; 437 440 char *fname = NULL; 438 uint32 flags;439 uint32 access_mask;440 uint32 file_attributes;441 uint32 share_access;442 uint32 create_disposition;443 uint32 create_options;444 uint16 root_dir_fid;441 uint32_t flags; 442 uint32_t access_mask; 443 uint32_t file_attributes; 444 uint32_t share_access; 445 uint32_t create_disposition; 446 uint32_t create_options; 447 uint16_t root_dir_fid; 445 448 uint64_t allocation_size; 446 449 /* Breakout the oplock request bits so we can set the 447 450 reply bits separately. */ 448 uint32 fattr=0;449 SMB_OFF_Tfile_len = 0;451 uint32_t fattr=0; 452 off_t file_len = 0; 450 453 int info = 0; 451 454 files_struct *fsp = NULL; … … 455 458 struct timespec a_timespec; 456 459 struct timespec m_timespec; 457 struct timespec write_time_ts;458 460 NTSTATUS status; 459 461 int oplock_request; 460 462 uint8_t oplock_granted = NO_OPLOCK_RETURN; 461 463 struct case_semantics_state *case_state = NULL; 464 uint32_t ucf_flags = UCF_PREP_CREATEFILE | 465 (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0); 462 466 TALLOC_CTX *ctx = talloc_tos(); 463 467 … … 475 479 create_disposition = IVAL(req->vwv+17, 1); 476 480 create_options = IVAL(req->vwv+19, 1); 477 root_dir_fid = (uint16 )IVAL(req->vwv+5, 1);481 root_dir_fid = (uint16_t)IVAL(req->vwv+5, 1); 478 482 479 483 allocation_size = BVAL(req->vwv+9, 1); … … 537 541 req->flags2 & FLAGS2_DFS_PATHNAMES, 538 542 fname, 539 (create_disposition == FILE_CREATE) 540 ? UCF_CREATING_FILE : 0, 543 ucf_flags, 541 544 NULL, 542 545 &smb_fname); … … 573 576 file_attributes, /* file_attributes */ 574 577 oplock_request, /* oplock_request */ 578 NULL, /* lease */ 575 579 allocation_size, /* allocation_size */ 576 580 0, /* private_flags */ … … 578 582 NULL, /* ea_list */ 579 583 &fsp, /* result */ 580 &info); /* pinfo */ 584 &info, /* pinfo */ 585 NULL, NULL); /* create context */ 581 586 582 587 if (!NT_STATUS_IS_OK(status)) { 583 if (open_was_deferred(req-> mid)) {588 if (open_was_deferred(req->xconn, req->mid)) { 584 589 /* We have re-scheduled this call, no error. */ 585 590 goto out; … … 623 628 /* This is very strange. We 624 629 * return 50 words, but only set 625 * the wcnt to 42 ? It's definately630 * the wcnt to 42 ? It's definitely 626 631 * what happens on the wire.... 627 632 */ … … 631 636 reply_outbuf(req, 34, 0); 632 637 } 638 639 SSVAL(req->outbuf, smb_vwv0, 0xff); /* andx chain ends */ 640 SSVAL(req->outbuf, smb_vwv1, 0); /* no andx offset */ 633 641 634 642 p = (char *)req->outbuf + smb_vwv2; … … 650 658 if (fattr == 0) { 651 659 fattr = FILE_ATTRIBUTE_NORMAL; 652 }653 654 /* Deal with other possible opens having a modified655 write time. JRA. */656 ZERO_STRUCT(write_time_ts);657 get_file_infos(fsp->file_id, 0, NULL, &write_time_ts);658 if (!null_timespec(write_time_ts)) {659 update_stat_ex_mtime(&smb_fname->st, write_time_ts);660 660 } 661 661 … … 712 712 713 713 if (flags & EXTENDED_RESPONSE_REQUIRED) { 714 uint32 perms = 0;714 uint32_t perms = 0; 715 715 p += 25; 716 716 if (fsp->is_directory || 717 fsp->can_write || 717 718 can_write_to_file(conn, smb_fname)) { 718 719 perms = FILE_GENERIC_ALL; … … 723 724 } 724 725 725 DEBUG(5,("reply_ntcreate_and_X: fnum = %d, open name = %s\n", 726 fsp->fnum, smb_fname_str_dbg(smb_fname))); 727 728 chain_reply(req); 726 DEBUG(5,("reply_ntcreate_and_X: %s, open name = %s\n", 727 fsp_fnum_dbg(fsp), smb_fname_str_dbg(smb_fname))); 728 729 729 out: 730 730 END_PROFILE(SMBntcreateX); … … 738 738 static void do_nt_transact_create_pipe(connection_struct *conn, 739 739 struct smb_request *req, 740 uint16 **ppsetup, uint32setup_count,741 char **ppparams, uint32 parameter_count,742 char **ppdata, uint32 data_count)740 uint16_t **ppsetup, uint32_t setup_count, 741 char **ppparams, uint32_t parameter_count, 742 char **ppdata, uint32_t data_count) 743 743 { 744 744 char *fname = NULL; 745 745 char *params = *ppparams; 746 int pnum = -1;746 uint16_t pnum = FNUM_FIELD_INVALID; 747 747 char *p = NULL; 748 748 NTSTATUS status; 749 749 size_t param_len; 750 uint32 flags;750 uint32_t flags; 751 751 TALLOC_CTX *ctx = talloc_tos(); 752 752 … … 763 763 flags = IVAL(params,0); 764 764 765 srvstr_get_path(ctx, params, req->flags2, &fname, params+53, 766 parameter_count-53, STR_TERMINATE, 765 if (req->posix_pathnames) { 766 srvstr_get_path_posix(ctx, 767 params, 768 req->flags2, 769 &fname, 770 params+53, 771 parameter_count-53, 772 STR_TERMINATE, 767 773 &status); 774 } else { 775 srvstr_get_path(ctx, 776 params, 777 req->flags2, 778 &fname, 779 params+53, 780 parameter_count-53, 781 STR_TERMINATE, 782 &status); 783 } 768 784 if (!NT_STATUS_IS_OK(status)) { 769 785 reply_nterror(req, status); … … 878 894 } 879 895 896 if (S_ISLNK(fsp->fsp_name->st.st_ex_mode)) { 897 DEBUG(10, ("ACL set on symlink %s denied.\n", 898 fsp_str_dbg(fsp))); 899 return NT_STATUS_ACCESS_DENIED; 900 } 901 880 902 if (psd->owner_sid == NULL) { 881 903 security_info_sent &= ~SECINFO_OWNER; … … 962 984 963 985 /**************************************************************************** 964 Read a list of EA names and data from an incoming data buffer. Create an ea_list with them.965 ****************************************************************************/966 967 struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size)968 {969 struct ea_list *ea_list_head = NULL;970 size_t offset = 0;971 972 if (data_size < 4) {973 return NULL;974 }975 976 while (offset + 4 <= data_size) {977 size_t next_offset = IVAL(pdata,offset);978 struct ea_list *eal = read_ea_list_entry(ctx, pdata + offset + 4, data_size - offset - 4, NULL);979 980 if (!eal) {981 return NULL;982 }983 984 DLIST_ADD_END(ea_list_head, eal, struct ea_list *);985 if (next_offset == 0) {986 break;987 }988 989 /* Integer wrap protection for the increment. */990 if (offset + next_offset < offset) {991 break;992 }993 994 offset += next_offset;995 996 /* Integer wrap protection for while loop. */997 if (offset + 4 < offset) {998 break;999 }1000 1001 }1002 1003 return ea_list_head;1004 }1005 1006 /****************************************************************************1007 986 Reply to a NT_TRANSACT_CREATE call (needs to process SD's). 1008 987 ****************************************************************************/ … … 1010 989 static void call_nt_transact_create(connection_struct *conn, 1011 990 struct smb_request *req, 1012 uint16 **ppsetup, uint32setup_count,1013 char **ppparams, uint32 parameter_count,1014 char **ppdata, uint32 data_count,1015 uint32 max_data_count)991 uint16_t **ppsetup, uint32_t setup_count, 992 char **ppparams, uint32_t parameter_count, 993 char **ppdata, uint32_t data_count, 994 uint32_t max_data_count) 1016 995 { 1017 996 struct smb_filename *smb_fname = NULL; … … 1020 999 char *data = *ppdata; 1021 1000 /* Breakout the oplock request bits so we can set the reply bits separately. */ 1022 uint32 fattr=0;1023 SMB_OFF_Tfile_len = 0;1001 uint32_t fattr=0; 1002 off_t file_len = 0; 1024 1003 int info = 0; 1025 1004 files_struct *fsp = NULL; 1026 1005 char *p = NULL; 1027 uint32 flags;1028 uint32 access_mask;1029 uint32 file_attributes;1030 uint32 share_access;1031 uint32 create_disposition;1032 uint32 create_options;1033 uint32 sd_len;1006 uint32_t flags; 1007 uint32_t access_mask; 1008 uint32_t file_attributes; 1009 uint32_t share_access; 1010 uint32_t create_disposition; 1011 uint32_t create_options; 1012 uint32_t sd_len; 1034 1013 struct security_descriptor *sd = NULL; 1035 uint32 ea_len;1036 uint16 root_dir_fid;1014 uint32_t ea_len; 1015 uint16_t root_dir_fid; 1037 1016 struct timespec create_timespec; 1038 1017 struct timespec c_timespec; 1039 1018 struct timespec a_timespec; 1040 1019 struct timespec m_timespec; 1041 struct timespec write_time_ts;1042 1020 struct ea_list *ea_list = NULL; 1043 1021 NTSTATUS status; … … 1047 1025 uint8_t oplock_granted; 1048 1026 struct case_semantics_state *case_state = NULL; 1027 uint32_t ucf_flags = UCF_PREP_CREATEFILE | 1028 (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0); 1049 1029 TALLOC_CTX *ctx = talloc_tos(); 1050 1030 … … 1086 1066 sd_len = IVAL(params,36); 1087 1067 ea_len = IVAL(params,40); 1088 root_dir_fid = (uint16 )IVAL(params,4);1068 root_dir_fid = (uint16_t)IVAL(params,4); 1089 1069 allocation_size = BVAL(params,12); 1090 1070 … … 1094 1074 */ 1095 1075 create_options &= ~NTCREATEX_OPTIONS_MUST_IGNORE_MASK; 1076 1077 if (req->posix_pathnames) { 1078 srvstr_get_path_posix(ctx, 1079 params, 1080 req->flags2, 1081 &fname, 1082 params+53, 1083 parameter_count-53, 1084 STR_TERMINATE, 1085 &status); 1086 } else { 1087 srvstr_get_path(ctx, 1088 params, 1089 req->flags2, 1090 &fname, 1091 params+53, 1092 parameter_count-53, 1093 STR_TERMINATE, 1094 &status); 1095 } 1096 if (!NT_STATUS_IS_OK(status)) { 1097 reply_nterror(req, status); 1098 goto out; 1099 } 1100 1101 if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) { 1102 case_state = set_posix_case_semantics(ctx, conn); 1103 if (!case_state) { 1104 reply_nterror(req, NT_STATUS_NO_MEMORY); 1105 goto out; 1106 } 1107 } 1108 1109 status = filename_convert(ctx, 1110 conn, 1111 req->flags2 & FLAGS2_DFS_PATHNAMES, 1112 fname, 1113 ucf_flags, 1114 NULL, 1115 &smb_fname); 1116 1117 TALLOC_FREE(case_state); 1118 1119 if (!NT_STATUS_IS_OK(status)) { 1120 if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { 1121 reply_botherror(req, 1122 NT_STATUS_PATH_NOT_COVERED, 1123 ERRSRV, ERRbadpath); 1124 goto out; 1125 } 1126 reply_nterror(req, status); 1127 goto out; 1128 } 1096 1129 1097 1130 /* Ensure the data_len is correct for the sd and ea values given. */ … … 1145 1178 goto out; 1146 1179 } 1147 } 1148 1149 srvstr_get_path(ctx, params, req->flags2, &fname, 1150 params+53, parameter_count-53, 1151 STR_TERMINATE, &status); 1152 if (!NT_STATUS_IS_OK(status)) { 1153 reply_nterror(req, status); 1154 goto out; 1155 } 1156 1157 if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) { 1158 case_state = set_posix_case_semantics(ctx, conn); 1159 if (!case_state) { 1160 reply_nterror(req, NT_STATUS_NO_MEMORY); 1180 1181 if (ea_list_has_invalid_name(ea_list)) { 1182 /* Realloc the size of parameters and data we will return */ 1183 if (flags & EXTENDED_RESPONSE_REQUIRED) { 1184 /* Extended response is 32 more byyes. */ 1185 param_len = 101; 1186 } else { 1187 param_len = 69; 1188 } 1189 params = nttrans_realloc(ppparams, param_len); 1190 if(params == NULL) { 1191 reply_nterror(req, NT_STATUS_NO_MEMORY); 1192 goto out; 1193 } 1194 1195 memset(params, '\0', param_len); 1196 send_nt_replies(conn, req, STATUS_INVALID_EA_NAME, 1197 params, param_len, NULL, 0); 1161 1198 goto out; 1162 1199 } 1163 }1164 1165 status = filename_convert(ctx,1166 conn,1167 req->flags2 & FLAGS2_DFS_PATHNAMES,1168 fname,1169 (create_disposition == FILE_CREATE)1170 ? UCF_CREATING_FILE : 0,1171 NULL,1172 &smb_fname);1173 1174 TALLOC_FREE(case_state);1175 1176 if (!NT_STATUS_IS_OK(status)) {1177 if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {1178 reply_botherror(req,1179 NT_STATUS_PATH_NOT_COVERED,1180 ERRSRV, ERRbadpath);1181 goto out;1182 }1183 reply_nterror(req, status);1184 goto out;1185 1200 } 1186 1201 … … 1209 1224 file_attributes, /* file_attributes */ 1210 1225 oplock_request, /* oplock_request */ 1226 NULL, /* lease */ 1211 1227 allocation_size, /* allocation_size */ 1212 1228 0, /* private_flags */ … … 1214 1230 ea_list, /* ea_list */ 1215 1231 &fsp, /* result */ 1216 &info); /* pinfo */ 1232 &info, /* pinfo */ 1233 NULL, NULL); /* create context */ 1217 1234 1218 1235 if(!NT_STATUS_IS_OK(status)) { 1219 if (open_was_deferred(req-> mid)) {1236 if (open_was_deferred(req->xconn, req->mid)) { 1220 1237 /* We have re-scheduled this call, no error. */ 1221 1238 return; … … 1286 1303 if (fattr == 0) { 1287 1304 fattr = FILE_ATTRIBUTE_NORMAL; 1288 }1289 1290 /* Deal with other possible opens having a modified1291 write time. JRA. */1292 ZERO_STRUCT(write_time_ts);1293 get_file_infos(fsp->file_id, 0, NULL, &write_time_ts);1294 if (!null_timespec(write_time_ts)) {1295 update_stat_ex_mtime(&smb_fname->st, write_time_ts);1296 1305 } 1297 1306 … … 1348 1357 1349 1358 if (flags & EXTENDED_RESPONSE_REQUIRED) { 1350 uint32 perms = 0;1359 uint32_t perms = 0; 1351 1360 p += 25; 1352 1361 if (fsp->is_directory || 1362 fsp->can_write || 1353 1363 can_write_to_file(conn, smb_fname)) { 1354 1364 perms = FILE_GENERIC_ALL; … … 1375 1385 void reply_ntcancel(struct smb_request *req) 1376 1386 { 1387 struct smbXsrv_connection *xconn = req->xconn; 1388 struct smbd_server_connection *sconn = req->sconn; 1389 1377 1390 /* 1378 1391 * Go through and cancel any pending change notifies. … … 1380 1393 1381 1394 START_PROFILE(SMBntcancel); 1382 srv_cancel_sign_response( req->sconn);1383 remove_pending_change_notify_requests_by_mid( req->sconn, req->mid);1384 remove_pending_lock_requests_by_mid_smb1( req->sconn, req->mid);1395 srv_cancel_sign_response(xconn); 1396 remove_pending_change_notify_requests_by_mid(sconn, req->mid); 1397 remove_pending_lock_requests_by_mid_smb1(sconn, req->mid); 1385 1398 1386 1399 DEBUG(3,("reply_ntcancel: cancel called on mid = %llu.\n", … … 1400 1413 struct smb_filename *smb_fname_src, 1401 1414 struct smb_filename *smb_fname_dst, 1402 uint32 attrs)1415 uint32_t attrs) 1403 1416 { 1404 1417 files_struct *fsp1,*fsp2; 1405 uint32 fattr;1418 uint32_t fattr; 1406 1419 int info; 1407 SMB_OFF_Tret=-1;1420 off_t ret=-1; 1408 1421 NTSTATUS status = NT_STATUS_OK; 1409 1422 char *parent; … … 1456 1469 FILE_ATTRIBUTE_NORMAL, /* file_attributes */ 1457 1470 NO_OPLOCK, /* oplock_request */ 1471 NULL, /* lease */ 1458 1472 0, /* allocation_size */ 1459 1473 0, /* private_flags */ … … 1461 1475 NULL, /* ea_list */ 1462 1476 &fsp1, /* result */ 1463 &info); /* pinfo */ 1477 &info, /* pinfo */ 1478 NULL, NULL); /* create context */ 1464 1479 1465 1480 if (!NT_STATUS_IS_OK(status)) { … … 1480 1495 fattr, /* file_attributes */ 1481 1496 NO_OPLOCK, /* oplock_request */ 1497 NULL, /* lease */ 1482 1498 0, /* allocation_size */ 1483 1499 0, /* private_flags */ … … 1485 1501 NULL, /* ea_list */ 1486 1502 &fsp2, /* result */ 1487 &info); /* pinfo */ 1503 &info, /* pinfo */ 1504 NULL, NULL); /* create context */ 1488 1505 1489 1506 if (!NT_STATUS_IS_OK(status)) { … … 1520 1537 TALLOC_FREE(parent); 1521 1538 1522 if (ret < ( SMB_OFF_T)smb_fname_src->st.st_ex_size) {1539 if (ret < (off_t)smb_fname_src->st.st_ex_size) { 1523 1540 status = NT_STATUS_DISK_FULL; 1524 1541 goto out; … … 1549 1566 bool src_has_wcard = False; 1550 1567 bool dest_has_wcard = False; 1551 uint32 attrs;1552 uint32_t ucf_flags_src = 0;1553 uint32_t ucf_flags_dst = 0;1554 uint16 rename_type;1568 uint32_t attrs; 1569 uint32_t ucf_flags_src = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0); 1570 uint32_t ucf_flags_dst = (req->posix_pathnames ? UCF_POSIX_PATHNAMES : 0); 1571 uint16_t rename_type; 1555 1572 TALLOC_CTX *ctx = talloc_tos(); 1556 1573 bool stream_rename = false; … … 1574 1591 } 1575 1592 1576 if ( ms_has_wild(oldname)) {1593 if (!req->posix_pathnames && ms_has_wild(oldname)) { 1577 1594 reply_nterror(req, NT_STATUS_OBJECT_PATH_SYNTAX_BAD); 1578 1595 goto out; … … 1587 1604 } 1588 1605 1589 if (! lp_posix_pathnames()) {1606 if (!req->posix_pathnames) { 1590 1607 /* The newname must begin with a ':' if the 1591 1608 oldname contains a ':'. */ … … 1700 1717 1701 1718 if (!NT_STATUS_IS_OK(status)) { 1702 if (open_was_deferred(req-> mid)) {1719 if (open_was_deferred(req->xconn, req->mid)) { 1703 1720 /* We have re-scheduled this call. */ 1704 1721 goto out; … … 1729 1746 static void call_nt_transact_notify_change(connection_struct *conn, 1730 1747 struct smb_request *req, 1731 uint16 **ppsetup,1732 uint32 setup_count,1748 uint16_t **ppsetup, 1749 uint32_t setup_count, 1733 1750 char **ppparams, 1734 uint32 parameter_count,1735 char **ppdata, uint32 data_count,1736 uint32 max_data_count,1737 uint32 max_param_count)1751 uint32_t parameter_count, 1752 char **ppdata, uint32_t data_count, 1753 uint32_t max_data_count, 1754 uint32_t max_param_count) 1738 1755 { 1739 uint16 *setup = *ppsetup;1756 uint16_t *setup = *ppsetup; 1740 1757 files_struct *fsp; 1741 uint32 filter;1758 uint32_t filter; 1742 1759 NTSTATUS status; 1743 1760 bool recursive; … … 1791 1808 } 1792 1809 1793 if ( fsp->notify->num_changes != 0) {1810 if (change_notify_fsp_has_changes(fsp)) { 1794 1811 1795 1812 /* … … 1836 1853 static void call_nt_transact_rename(connection_struct *conn, 1837 1854 struct smb_request *req, 1838 uint16 **ppsetup, uint32setup_count,1839 char **ppparams, uint32 parameter_count,1840 char **ppdata, uint32 data_count,1841 uint32 max_data_count)1855 uint16_t **ppsetup, uint32_t setup_count, 1856 char **ppparams, uint32_t parameter_count, 1857 char **ppdata, uint32_t data_count, 1858 uint32_t max_data_count) 1842 1859 { 1843 1860 char *params = *ppparams; … … 1857 1874 return; 1858 1875 } 1859 srvstr_get_path_wcard(ctx, params, req->flags2, &new_name, params+4, 1860 parameter_count - 4, 1861 STR_TERMINATE, &status, &dest_has_wcard); 1876 if (req->posix_pathnames) { 1877 srvstr_get_path_wcard_posix(ctx, 1878 params, 1879 req->flags2, 1880 &new_name, 1881 params+4, 1882 parameter_count - 4, 1883 STR_TERMINATE, 1884 &status, 1885 &dest_has_wcard); 1886 } else { 1887 srvstr_get_path_wcard(ctx, 1888 params, 1889 req->flags2, 1890 &new_name, 1891 params+4, 1892 parameter_count - 4, 1893 STR_TERMINATE, 1894 &status, 1895 &dest_has_wcard); 1896 } 1897 1862 1898 if (!NT_STATUS_IS_OK(status)) { 1863 1899 reply_nterror(req, status); … … 1896 1932 /**************************************************************************** 1897 1933 Reply to query a security descriptor. 1898 Callable from SMB 2and SMB2.1934 Callable from SMB1 and SMB2. 1899 1935 If it returns NT_STATUS_BUFFER_TOO_SMALL, pdata_size is initialized with 1900 1936 the required size. … … 1911 1947 NTSTATUS status; 1912 1948 struct security_descriptor *psd = NULL; 1949 TALLOC_CTX *frame = talloc_stackframe(); 1913 1950 1914 1951 /* … … 1918 1955 if ((security_info_wanted & SECINFO_SACL) && 1919 1956 !(fsp->access_mask & SEC_FLAG_SYSTEM_SECURITY)) { 1957 DEBUG(10, ("Access to SACL denied.\n")); 1958 TALLOC_FREE(frame); 1920 1959 return NT_STATUS_ACCESS_DENIED; 1921 1960 } … … 1923 1962 if ((security_info_wanted & (SECINFO_DACL|SECINFO_OWNER|SECINFO_GROUP)) && 1924 1963 !(fsp->access_mask & SEC_STD_READ_CONTROL)) { 1964 DEBUG(10, ("Access to DACL, OWNER, or GROUP denied.\n")); 1965 TALLOC_FREE(frame); 1966 return NT_STATUS_ACCESS_DENIED; 1967 } 1968 1969 if (S_ISLNK(fsp->fsp_name->st.st_ex_mode)) { 1970 DEBUG(10, ("ACL get on symlink %s denied.\n", 1971 fsp_str_dbg(fsp))); 1972 TALLOC_FREE(frame); 1925 1973 return NT_STATUS_ACCESS_DENIED; 1926 1974 } … … 1934 1982 1935 1983 if (!lp_nt_acl_support(SNUM(conn))) { 1936 status = get_null_nt_acl( mem_ctx, &psd);1984 status = get_null_nt_acl(frame, &psd); 1937 1985 } else if (security_info_wanted & SECINFO_LABEL) { 1938 1986 /* Like W2K3 return a null object. */ 1939 status = get_null_nt_acl( mem_ctx, &psd);1987 status = get_null_nt_acl(frame, &psd); 1940 1988 } else { 1941 1989 status = SMB_VFS_FGET_NT_ACL( 1942 fsp, security_info_wanted, &psd);1990 fsp, security_info_wanted, frame, &psd); 1943 1991 } 1944 1992 if (!NT_STATUS_IS_OK(status)) { 1993 TALLOC_FREE(frame); 1945 1994 return status; 1946 1995 } … … 1991 2040 1992 2041 if (max_data_count < *psd_size) { 1993 TALLOC_FREE( psd);2042 TALLOC_FREE(frame); 1994 2043 return NT_STATUS_BUFFER_TOO_SMALL; 1995 2044 } … … 1999 2048 2000 2049 if (!NT_STATUS_IS_OK(status)) { 2001 TALLOC_FREE( psd);2050 TALLOC_FREE(frame); 2002 2051 return status; 2003 2052 } 2004 2053 2005 TALLOC_FREE( psd);2054 TALLOC_FREE(frame); 2006 2055 return NT_STATUS_OK; 2007 2056 } … … 2013 2062 static void call_nt_transact_query_security_desc(connection_struct *conn, 2014 2063 struct smb_request *req, 2015 uint16 **ppsetup,2016 uint32 setup_count,2064 uint16_t **ppsetup, 2065 uint32_t setup_count, 2017 2066 char **ppparams, 2018 uint32 parameter_count,2067 uint32_t parameter_count, 2019 2068 char **ppdata, 2020 uint32 data_count,2021 uint32 max_data_count)2069 uint32_t data_count, 2070 uint32_t max_data_count) 2022 2071 { 2023 2072 char *params = *ppparams; 2024 2073 char *data = *ppdata; 2025 2074 size_t sd_size = 0; 2026 uint32 security_info_wanted;2075 uint32_t security_info_wanted; 2027 2076 files_struct *fsp = NULL; 2028 2077 NTSTATUS status; … … 2059 2108 talloc_tos(), 2060 2109 fsp, 2061 security_info_wanted, 2110 security_info_wanted & 2111 SMB_SUPPORTED_SECINFO_FLAGS, 2062 2112 max_data_count, 2063 2113 &marshalled_sd, … … 2109 2159 static void call_nt_transact_set_security_desc(connection_struct *conn, 2110 2160 struct smb_request *req, 2111 uint16 **ppsetup,2112 uint32 setup_count,2161 uint16_t **ppsetup, 2162 uint32_t setup_count, 2113 2163 char **ppparams, 2114 uint32 parameter_count,2164 uint32_t parameter_count, 2115 2165 char **ppdata, 2116 uint32 data_count,2117 uint32 max_data_count)2166 uint32_t data_count, 2167 uint32_t max_data_count) 2118 2168 { 2119 2169 char *params= *ppparams; 2120 2170 char *data = *ppdata; 2121 2171 files_struct *fsp = NULL; 2122 uint32 security_info_sent = 0;2172 uint32_t security_info_sent = 0; 2123 2173 NTSTATUS status; 2124 2174 … … 2152 2202 } 2153 2203 2154 status = set_sd_blob(fsp, (uint8 *)data, data_count, security_info_sent);2155 2204 status = set_sd_blob(fsp, (uint8_t *)data, data_count, 2205 security_info_sent & SMB_SUPPORTED_SECINFO_FLAGS); 2156 2206 if (!NT_STATUS_IS_OK(status)) { 2157 2207 reply_nterror(req, status); … … 2164 2214 } 2165 2215 2166 /*2167 * Implement the default fsctl operation.2168 */2169 2170 static bool vfswrap_logged_ioctl_message = false;2171 2172 /*2173 * In 3.6 we do not have a SMB_VFS_FSCTL() function2174 * it's just faked to make it more look like2175 * master (4.0)2176 */2177 NTSTATUS smb_fsctl(struct files_struct *fsp,2178 TALLOC_CTX *ctx,2179 uint32_t function,2180 uint16_t req_flags, /* Needed for UNICODE ... */2181 const uint8_t *_in_data,2182 uint32_t in_len,2183 uint8_t **_out_data,2184 uint32_t max_out_len,2185 uint32_t *out_len)2186 {2187 const char *in_data = (const char *)_in_data;2188 char **out_data = (char **)_out_data;2189 2190 switch (function) {2191 case FSCTL_SET_SPARSE:2192 {2193 bool set_sparse = true;2194 NTSTATUS status;2195 2196 if (in_len >= 1 && in_data[0] == 0) {2197 set_sparse = false;2198 }2199 2200 status = file_set_sparse(fsp->conn, fsp, set_sparse);2201 2202 DEBUG(NT_STATUS_IS_OK(status) ? 10 : 9,2203 ("FSCTL_SET_SPARSE: fname[%s] set[%u] - %s\n",2204 smb_fname_str_dbg(fsp->fsp_name), set_sparse,2205 nt_errstr(status)));2206 2207 return status;2208 }2209 2210 case FSCTL_CREATE_OR_GET_OBJECT_ID:2211 {2212 unsigned char objid[16];2213 char *return_data = NULL;2214 2215 /* This should return the object-id on this file.2216 * I think I'll make this be the inode+dev. JRA.2217 */2218 2219 DEBUG(10,("FSCTL_CREATE_OR_GET_OBJECT_ID: called on FID[0x%04X]\n",fsp->fnum));2220 2221 *out_len = (max_out_len >= 64) ? 64 : max_out_len;2222 /* Hmmm, will this cause problems if less data asked for? */2223 return_data = talloc_array(ctx, char, 64);2224 if (return_data == NULL) {2225 return NT_STATUS_NO_MEMORY;2226 }2227 2228 /* For backwards compatibility only store the dev/inode. */2229 push_file_id_16(return_data, &fsp->file_id);2230 memcpy(return_data+16,create_volume_objectid(fsp->conn,objid),16);2231 push_file_id_16(return_data+32, &fsp->file_id);2232 *out_data = return_data;2233 return NT_STATUS_OK;2234 }2235 2236 case FSCTL_GET_REPARSE_POINT:2237 {2238 /* Fail it with STATUS_NOT_A_REPARSE_POINT */2239 DEBUG(10, ("FSCTL_GET_REPARSE_POINT: called on FID[0x%04X] Status: NOT_IMPLEMENTED\n", fsp->fnum));2240 return NT_STATUS_NOT_A_REPARSE_POINT;2241 }2242 2243 case FSCTL_SET_REPARSE_POINT:2244 {2245 /* Fail it with STATUS_NOT_A_REPARSE_POINT */2246 DEBUG(10, ("FSCTL_SET_REPARSE_POINT: called on FID[0x%04X] Status: NOT_IMPLEMENTED\n", fsp->fnum));2247 return NT_STATUS_NOT_A_REPARSE_POINT;2248 }2249 2250 case FSCTL_GET_SHADOW_COPY_DATA:2251 {2252 /*2253 * This is called to retrieve the number of Shadow Copies (a.k.a. snapshots)2254 * and return their volume names. If max_data_count is 16, then it is just2255 * asking for the number of volumes and length of the combined names.2256 *2257 * pdata is the data allocated by our caller, but that uses2258 * total_data_count (which is 0 in our case) rather than max_data_count.2259 * Allocate the correct amount and return the pointer to let2260 * it be deallocated when we return.2261 */2262 struct shadow_copy_data *shadow_data = NULL;2263 bool labels = False;2264 uint32 labels_data_count = 0;2265 uint32 i;2266 char *cur_pdata = NULL;2267 2268 if (max_out_len < 16) {2269 DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: max_data_count(%u) < 16 is invalid!\n",2270 max_out_len));2271 return NT_STATUS_INVALID_PARAMETER;2272 }2273 2274 if (max_out_len > 16) {2275 labels = True;2276 }2277 2278 shadow_data = talloc_zero(ctx, struct shadow_copy_data);2279 if (shadow_data == NULL) {2280 DEBUG(0,("TALLOC_ZERO() failed!\n"));2281 return NT_STATUS_NO_MEMORY;2282 }2283 2284 /*2285 * Call the VFS routine to actually do the work.2286 */2287 if (SMB_VFS_GET_SHADOW_COPY_DATA(fsp, shadow_data, labels)!=0) {2288 TALLOC_FREE(shadow_data);2289 if (errno == ENOSYS) {2290 DEBUG(5,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, not supported.\n",2291 fsp->conn->connectpath));2292 return NT_STATUS_NOT_SUPPORTED;2293 } else {2294 DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, failed.\n",2295 fsp->conn->connectpath));2296 return NT_STATUS_UNSUCCESSFUL;2297 }2298 }2299 2300 labels_data_count = (shadow_data->num_volumes * 2 *2301 sizeof(SHADOW_COPY_LABEL)) + 2;2302 2303 if (!labels) {2304 *out_len = 16;2305 } else {2306 *out_len = 12 + labels_data_count;2307 }2308 2309 if (max_out_len < *out_len) {2310 DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: max_data_count(%u) too small (%u) bytes needed!\n",2311 max_out_len, *out_len));2312 TALLOC_FREE(shadow_data);2313 return NT_STATUS_BUFFER_TOO_SMALL;2314 }2315 2316 cur_pdata = talloc_zero_array(ctx, char, *out_len);2317 if (cur_pdata == NULL) {2318 TALLOC_FREE(shadow_data);2319 return NT_STATUS_NO_MEMORY;2320 }2321 2322 *out_data = cur_pdata;2323 2324 /* num_volumes 4 bytes */2325 SIVAL(cur_pdata, 0, shadow_data->num_volumes);2326 2327 if (labels) {2328 /* num_labels 4 bytes */2329 SIVAL(cur_pdata, 4, shadow_data->num_volumes);2330 }2331 2332 /* needed_data_count 4 bytes */2333 SIVAL(cur_pdata, 8, labels_data_count);2334 2335 cur_pdata += 12;2336 2337 DEBUG(10,("FSCTL_GET_SHADOW_COPY_DATA: %u volumes for path[%s].\n",2338 shadow_data->num_volumes, fsp_str_dbg(fsp)));2339 if (labels && shadow_data->labels) {2340 for (i=0; i<shadow_data->num_volumes; i++) {2341 srvstr_push(cur_pdata, req_flags,2342 cur_pdata, shadow_data->labels[i],2343 2 * sizeof(SHADOW_COPY_LABEL),2344 STR_UNICODE|STR_TERMINATE);2345 cur_pdata += 2 * sizeof(SHADOW_COPY_LABEL);2346 DEBUGADD(10,("Label[%u]: '%s'\n",i,shadow_data->labels[i]));2347 }2348 }2349 2350 TALLOC_FREE(shadow_data);2351 2352 return NT_STATUS_OK;2353 }2354 2355 case FSCTL_FIND_FILES_BY_SID:2356 {2357 /* pretend this succeeded -2358 *2359 * we have to send back a list with all files owned by this SID2360 *2361 * but I have to check that --metze2362 */2363 struct dom_sid sid;2364 uid_t uid;2365 size_t sid_len;2366 2367 DEBUG(10,("FSCTL_FIND_FILES_BY_SID: called on FID[0x%04X]\n", fsp->fnum));2368 2369 if (in_len < 8) {2370 /* NT_STATUS_BUFFER_TOO_SMALL maybe? */2371 return NT_STATUS_INVALID_PARAMETER;2372 }2373 2374 sid_len = MIN(in_len - 4,SID_MAX_SIZE);2375 2376 /* unknown 4 bytes: this is not the length of the sid :-( */2377 /*unknown = IVAL(pdata,0);*/2378 2379 if (!sid_parse(in_data + 4, sid_len, &sid)) {2380 return NT_STATUS_INVALID_PARAMETER;2381 }2382 DEBUGADD(10, ("for SID: %s\n", sid_string_dbg(&sid)));2383 2384 if (!sid_to_uid(&sid, &uid)) {2385 DEBUG(0,("sid_to_uid: failed, sid[%s] sid_len[%lu]\n",2386 sid_string_dbg(&sid),2387 (unsigned long)sid_len));2388 uid = (-1);2389 }2390 2391 /* we can take a look at the find source :-)2392 *2393 * find ./ -uid $uid -name '*' is what we need here2394 *2395 *2396 * and send 4bytes len and then NULL terminated unicode strings2397 * for each file2398 *2399 * but I don't know how to deal with the paged results2400 * (maybe we can hang the result anywhere in the fsp struct)2401 *2402 * but I don't know how to deal with the paged results2403 * (maybe we can hang the result anywhere in the fsp struct)2404 *2405 * we don't send all files at once2406 * and at the next we should *not* start from the beginning,2407 * so we have to cache the result2408 *2409 * --metze2410 */2411 2412 /* this works for now... */2413 return NT_STATUS_OK;2414 }2415 2416 case FSCTL_QUERY_ALLOCATED_RANGES:2417 {2418 /* FIXME: This is just a dummy reply, telling that all of the2419 * file is allocated. MKS cp needs that.2420 * Adding the real allocated ranges via FIEMAP on Linux2421 * and SEEK_DATA/SEEK_HOLE on Solaris is needed to make2422 * this FSCTL correct for sparse files.2423 */2424 NTSTATUS status;2425 uint64_t offset, length;2426 char *out_data_tmp = NULL;2427 2428 if (in_len != 16) {2429 DEBUG(0,("FSCTL_QUERY_ALLOCATED_RANGES: data_count(%u) != 16 is invalid!\n",2430 in_len));2431 return NT_STATUS_INVALID_PARAMETER;2432 }2433 2434 if (max_out_len < 16) {2435 DEBUG(0,("FSCTL_QUERY_ALLOCATED_RANGES: max_out_len (%u) < 16 is invalid!\n",2436 max_out_len));2437 return NT_STATUS_INVALID_PARAMETER;2438 }2439 2440 offset = BVAL(in_data,0);2441 length = BVAL(in_data,8);2442 2443 if (offset + length < offset) {2444 /* No 64-bit integer wrap. */2445 return NT_STATUS_INVALID_PARAMETER;2446 }2447 2448 /* Shouldn't this be SMB_VFS_STAT ... ? */2449 status = vfs_stat_fsp(fsp);2450 if (!NT_STATUS_IS_OK(status)) {2451 return status;2452 }2453 2454 *out_len = 16;2455 out_data_tmp = talloc_array(ctx, char, *out_len);2456 if (out_data_tmp == NULL) {2457 DEBUG(10, ("unable to allocate memory for response\n"));2458 return NT_STATUS_NO_MEMORY;2459 }2460 2461 if (offset > fsp->fsp_name->st.st_ex_size ||2462 fsp->fsp_name->st.st_ex_size == 0 ||2463 length == 0) {2464 memset(out_data_tmp, 0, *out_len);2465 } else {2466 uint64_t end = offset + length;2467 end = MIN(end, fsp->fsp_name->st.st_ex_size);2468 SBVAL(out_data_tmp, 0, 0);2469 SBVAL(out_data_tmp, 8, end);2470 }2471 2472 *out_data = out_data_tmp;2473 2474 return NT_STATUS_OK;2475 }2476 2477 case FSCTL_IS_VOLUME_DIRTY:2478 {2479 DEBUG(10,("FSCTL_IS_VOLUME_DIRTY: called on FID[0x%04X] "2480 "(but not implemented)\n", fsp->fnum));2481 /*2482 * http://msdn.microsoft.com/en-us/library/cc232128%28PROT.10%29.aspx2483 * says we have to respond with NT_STATUS_INVALID_PARAMETER2484 */2485 return NT_STATUS_INVALID_PARAMETER;2486 }2487 2488 default:2489 /*2490 * Only print once ... unfortunately there could be lots of2491 * different FSCTLs that are called.2492 */2493 if (!vfswrap_logged_ioctl_message) {2494 vfswrap_logged_ioctl_message = true;2495 DEBUG(2, ("%s (0x%x): Currently not implemented.\n",2496 __FUNCTION__, function));2497 }2498 }2499 2500 return NT_STATUS_NOT_SUPPORTED;2501 }2502 2503 2216 /**************************************************************************** 2504 2217 Reply to NT IOCTL … … 2507 2220 static void call_nt_transact_ioctl(connection_struct *conn, 2508 2221 struct smb_request *req, 2509 uint16 **ppsetup, uint32setup_count,2510 char **ppparams, uint32 parameter_count,2511 char **ppdata, uint32 data_count,2512 uint32 max_data_count)2222 uint16_t **ppsetup, uint32_t setup_count, 2223 char **ppparams, uint32_t parameter_count, 2224 char **ppdata, uint32_t data_count, 2225 uint32_t max_data_count) 2513 2226 { 2514 2227 NTSTATUS status; 2515 uint32 function;2516 uint16 fidnum;2228 uint32_t function; 2229 uint16_t fidnum; 2517 2230 files_struct *fsp; 2518 uint8 isFSctl;2519 uint8 compfilter;2231 uint8_t isFSctl; 2232 uint8_t compfilter; 2520 2233 char *out_data = NULL; 2521 uint32 out_data_len = 0;2234 uint32_t out_data_len = 0; 2522 2235 char *pdata = *ppdata; 2523 2236 TALLOC_CTX *ctx = talloc_tos(); … … 2534 2247 compfilter = CVAL(*ppsetup, 7); 2535 2248 2536 DEBUG(10, ("call_nt_transact_ioctl: function[0x%08X] FID[0x%04X] isFSctl[0x%02X] compfilter[0x%02X]\n", 2249 DEBUG(10, ("call_nt_transact_ioctl: function[0x%08X] FID[0x%04X] isFSctl[0x%02X] compfilter[0x%02X]\n", 2537 2250 function, fidnum, isFSctl, compfilter)); 2538 2251 … … 2554 2267 } 2555 2268 2269 SMB_PERFCOUNT_SET_IOCTL(&req->pcd, function); 2270 2556 2271 /* 2557 2272 * out_data might be allocated by the VFS module, but talloc should be 2558 2273 * used, and should be cleaned up when the request ends. 2559 2274 */ 2560 status = smb_fsctl(fsp,2275 status = SMB_VFS_FSCTL(fsp, 2561 2276 ctx, 2562 function, 2277 function, 2563 2278 req->flags2, 2564 (uint8_t *)pdata, 2565 data_count, 2279 (uint8_t *)pdata, 2280 data_count, 2566 2281 (uint8_t **)&out_data, 2567 2282 max_data_count, … … 2582 2297 static void call_nt_transact_get_user_quota(connection_struct *conn, 2583 2298 struct smb_request *req, 2584 uint16 **ppsetup,2585 uint32 setup_count,2299 uint16_t **ppsetup, 2300 uint32_t setup_count, 2586 2301 char **ppparams, 2587 uint32 parameter_count,2302 uint32_t parameter_count, 2588 2303 char **ppdata, 2589 uint32 data_count,2590 uint32 max_data_count)2304 uint32_t data_count, 2305 uint32_t max_data_count) 2591 2306 { 2592 2307 NTSTATUS nt_status = NT_STATUS_OK; … … 2598 2313 int entry_len = 0; 2599 2314 files_struct *fsp = NULL; 2600 uint16 level = 0;2315 uint16_t level = 0; 2601 2316 size_t sid_len; 2602 2317 struct dom_sid sid; … … 2609 2324 2610 2325 /* access check */ 2611 if (get_current_uid(conn) != 0) {2326 if (get_current_uid(conn) != sec_initial_uid()) { 2612 2327 DEBUG(1,("get_user_quota: access_denied service [%s] user " 2613 "[%s]\n", lp_servicename( SNUM(conn)),2614 conn->session_info->unix_ name));2328 "[%s]\n", lp_servicename(talloc_tos(), SNUM(conn)), 2329 conn->session_info->unix_info->unix_name)); 2615 2330 reply_nterror(req, NT_STATUS_ACCESS_DENIED); 2616 2331 return; … … 2738 2453 2739 2454 /* and now the SID */ 2740 sid_linearize(entry+40, sid_len, &tmp_list->quotas->sid); 2455 sid_linearize((uint8_t *)(entry+40), sid_len, 2456 &tmp_list->quotas->sid); 2741 2457 } 2742 2458 … … 2787 2503 } 2788 2504 2789 if (!sid_parse(pdata+8,sid_len,&sid)) { 2505 if (!sid_parse((const uint8_t *)(pdata+8), sid_len, 2506 &sid)) { 2790 2507 reply_nterror(req, NT_STATUS_INVALID_PARAMETER); 2791 2508 return; … … 2839 2556 2840 2557 /* and now the SID */ 2841 sid_linearize( entry+40, sid_len, &sid);2558 sid_linearize((uint8_t *)(entry+40), sid_len, &sid); 2842 2559 2843 2560 break; 2844 2561 2845 2562 default: 2846 DEBUG(0,("do_nt_transact_get_user_quota: fnum %d unknown level 0x%04hX\n",fsp->fnum,level)); 2563 DEBUG(0, ("do_nt_transact_get_user_quota: %s: unknown " 2564 "level 0x%04hX\n", 2565 fsp_fnum_dbg(fsp), level)); 2847 2566 reply_nterror(req, NT_STATUS_INVALID_LEVEL); 2848 2567 return; … … 2860 2579 static void call_nt_transact_set_user_quota(connection_struct *conn, 2861 2580 struct smb_request *req, 2862 uint16 **ppsetup,2863 uint32 setup_count,2581 uint16_t **ppsetup, 2582 uint32_t setup_count, 2864 2583 char **ppparams, 2865 uint32 parameter_count,2584 uint32_t parameter_count, 2866 2585 char **ppdata, 2867 uint32 data_count,2868 uint32 max_data_count)2586 uint32_t data_count, 2587 uint32_t max_data_count) 2869 2588 { 2870 2589 char *params = *ppparams; … … 2881 2600 if (get_current_uid(conn) != 0) { 2882 2601 DEBUG(1,("set_user_quota: access_denied service [%s] user " 2883 "[%s]\n", lp_servicename( SNUM(conn)),2884 conn->session_info->unix_ name));2602 "[%s]\n", lp_servicename(talloc_tos(), SNUM(conn)), 2603 conn->session_info->unix_info->unix_name)); 2885 2604 reply_nterror(req, NT_STATUS_ACCESS_DENIED); 2886 2605 return; … … 2938 2657 qt.hardlim = BVAL(pdata,32); 2939 2658 2940 if (!sid_parse( pdata+40,sid_len,&sid)) {2659 if (!sid_parse((const uint8_t *)(pdata+40), sid_len, &sid)) { 2941 2660 reply_nterror(req, NT_STATUS_INVALID_PARAMETER); 2942 2661 return; … … 2963 2682 if (get_Protocol() >= PROTOCOL_NT1) { 2964 2683 req->flags2 |= 0x40; /* IS_LONG_NAME */ 2965 SSVAL( req->inbuf,smb_flg2,req->flags2);2684 SSVAL(discard_const_p(uint8_t, req->inbuf),smb_flg2,req->flags2); 2966 2685 } 2967 2686 … … 3099 2818 uint32_t dscnt; 3100 2819 uint32_t dsoff; 3101 uint16 function_code;2820 uint16_t function_code; 3102 2821 NTSTATUS result; 3103 2822 struct trans_state *state; … … 3131 2850 } 3132 2851 3133 if ((state = TALLOC_P(conn, struct trans_state)) == NULL) {2852 if ((state = talloc(conn, struct trans_state)) == NULL) { 3134 2853 reply_nterror(req, NT_STATUS_NO_MEMORY); 3135 2854 END_PROFILE(SMBnttrans); … … 3248 2967 } 3249 2968 3250 state->setup = (uint16 *)TALLOC(state, state->setup_count);2969 state->setup = (uint16_t *)TALLOC(state, state->setup_count); 3251 2970 if (state->setup == NULL) { 3252 2971 DEBUG(0,("reply_nttrans : Out of memory\n")); … … 3260 2979 3261 2980 memcpy(state->setup, req->vwv+19, state->setup_count); 3262 dump_data(10, (uint8 *)state->setup, state->setup_count);2981 dump_data(10, (uint8_t *)state->setup, state->setup_count); 3263 2982 } 3264 2983 … … 3305 3024 START_PROFILE(SMBnttranss); 3306 3025 3307 show_msg((c har *)req->inbuf);3026 show_msg((const char *)req->inbuf); 3308 3027 3309 3028 /* Windows clients expect all replies to
Note:
See TracChangeset
for help on using the changeset viewer.