| .. | .. |
|---|
| 97 | 97 | if (rc != 1) |
|---|
| 98 | 98 | return -EINVAL; |
|---|
| 99 | 99 | |
|---|
| 100 | + if (link_len > CIFS_MF_SYMLINK_LINK_MAXLEN) |
|---|
| 101 | + return -EINVAL; |
|---|
| 102 | + |
|---|
| 100 | 103 | rc = symlink_hash(link_len, link_str, md5_hash); |
|---|
| 101 | 104 | if (rc) { |
|---|
| 102 | 105 | cifs_dbg(FYI, "%s: MD5 hash failure: %d\n", __func__, rc); |
|---|
| 103 | 106 | return rc; |
|---|
| 104 | 107 | } |
|---|
| 105 | 108 | |
|---|
| 106 | | - snprintf(md5_str2, sizeof(md5_str2), |
|---|
| 107 | | - CIFS_MF_SYMLINK_MD5_FORMAT, |
|---|
| 108 | | - CIFS_MF_SYMLINK_MD5_ARGS(md5_hash)); |
|---|
| 109 | + scnprintf(md5_str2, sizeof(md5_str2), |
|---|
| 110 | + CIFS_MF_SYMLINK_MD5_FORMAT, |
|---|
| 111 | + CIFS_MF_SYMLINK_MD5_ARGS(md5_hash)); |
|---|
| 109 | 112 | |
|---|
| 110 | 113 | if (strncmp(md5_str1, md5_str2, 17) != 0) |
|---|
| 111 | 114 | return -EINVAL; |
|---|
| .. | .. |
|---|
| 142 | 145 | return rc; |
|---|
| 143 | 146 | } |
|---|
| 144 | 147 | |
|---|
| 145 | | - snprintf(buf, buf_len, |
|---|
| 146 | | - CIFS_MF_SYMLINK_LEN_FORMAT CIFS_MF_SYMLINK_MD5_FORMAT, |
|---|
| 147 | | - link_len, |
|---|
| 148 | | - CIFS_MF_SYMLINK_MD5_ARGS(md5_hash)); |
|---|
| 148 | + scnprintf(buf, buf_len, |
|---|
| 149 | + CIFS_MF_SYMLINK_LEN_FORMAT CIFS_MF_SYMLINK_MD5_FORMAT, |
|---|
| 150 | + link_len, |
|---|
| 151 | + CIFS_MF_SYMLINK_MD5_ARGS(md5_hash)); |
|---|
| 149 | 152 | |
|---|
| 150 | 153 | ofs = CIFS_MF_SYMLINK_LINK_OFFSET; |
|---|
| 151 | 154 | memcpy(buf + ofs, link_str, link_len); |
|---|
| .. | .. |
|---|
| 308 | 311 | int oplock = 0; |
|---|
| 309 | 312 | struct cifs_fid fid; |
|---|
| 310 | 313 | struct cifs_open_parms oparms; |
|---|
| 311 | | - struct cifs_io_parms io_parms; |
|---|
| 314 | + struct cifs_io_parms io_parms = {0}; |
|---|
| 312 | 315 | int buf_type = CIFS_NO_BUFFER; |
|---|
| 313 | 316 | FILE_ALL_INFO file_info; |
|---|
| 314 | 317 | |
|---|
| 315 | 318 | oparms.tcon = tcon; |
|---|
| 316 | 319 | oparms.cifs_sb = cifs_sb; |
|---|
| 317 | 320 | oparms.desired_access = GENERIC_READ; |
|---|
| 318 | | - oparms.create_options = CREATE_NOT_DIR; |
|---|
| 321 | + oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); |
|---|
| 319 | 322 | oparms.disposition = FILE_OPEN; |
|---|
| 320 | 323 | oparms.path = path; |
|---|
| 321 | 324 | oparms.fid = &fid; |
|---|
| .. | .. |
|---|
| 352 | 355 | int oplock = 0; |
|---|
| 353 | 356 | struct cifs_fid fid; |
|---|
| 354 | 357 | struct cifs_open_parms oparms; |
|---|
| 355 | | - struct cifs_io_parms io_parms; |
|---|
| 356 | | - int create_options = CREATE_NOT_DIR; |
|---|
| 357 | | - |
|---|
| 358 | | - if (backup_cred(cifs_sb)) |
|---|
| 359 | | - create_options |= CREATE_OPEN_BACKUP_INTENT; |
|---|
| 358 | + struct cifs_io_parms io_parms = {0}; |
|---|
| 360 | 359 | |
|---|
| 361 | 360 | oparms.tcon = tcon; |
|---|
| 362 | 361 | oparms.cifs_sb = cifs_sb; |
|---|
| 363 | 362 | oparms.desired_access = GENERIC_WRITE; |
|---|
| 364 | | - oparms.create_options = create_options; |
|---|
| 363 | + oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); |
|---|
| 365 | 364 | oparms.disposition = FILE_CREATE; |
|---|
| 366 | 365 | oparms.path = path; |
|---|
| 367 | 366 | oparms.fid = &fid; |
|---|
| .. | .. |
|---|
| 393 | 392 | int rc; |
|---|
| 394 | 393 | struct cifs_fid fid; |
|---|
| 395 | 394 | struct cifs_open_parms oparms; |
|---|
| 396 | | - struct cifs_io_parms io_parms; |
|---|
| 395 | + struct cifs_io_parms io_parms = {0}; |
|---|
| 397 | 396 | int buf_type = CIFS_NO_BUFFER; |
|---|
| 398 | 397 | __le16 *utf16_path; |
|---|
| 399 | 398 | __u8 oplock = SMB2_OPLOCK_LEVEL_NONE; |
|---|
| .. | .. |
|---|
| 402 | 401 | oparms.tcon = tcon; |
|---|
| 403 | 402 | oparms.cifs_sb = cifs_sb; |
|---|
| 404 | 403 | oparms.desired_access = GENERIC_READ; |
|---|
| 405 | | - oparms.create_options = CREATE_NOT_DIR; |
|---|
| 406 | | - if (backup_cred(cifs_sb)) |
|---|
| 407 | | - oparms.create_options |= CREATE_OPEN_BACKUP_INTENT; |
|---|
| 404 | + oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); |
|---|
| 408 | 405 | oparms.disposition = FILE_OPEN; |
|---|
| 409 | 406 | oparms.fid = &fid; |
|---|
| 410 | 407 | oparms.reconnect = false; |
|---|
| .. | .. |
|---|
| 422 | 419 | } |
|---|
| 423 | 420 | |
|---|
| 424 | 421 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, pfile_info, NULL, |
|---|
| 425 | | - NULL); |
|---|
| 422 | + NULL, NULL); |
|---|
| 426 | 423 | if (rc) |
|---|
| 427 | 424 | goto qmf_out_open_fail; |
|---|
| 428 | 425 | |
|---|
| .. | .. |
|---|
| 456 | 453 | int rc; |
|---|
| 457 | 454 | struct cifs_fid fid; |
|---|
| 458 | 455 | struct cifs_open_parms oparms; |
|---|
| 459 | | - struct cifs_io_parms io_parms; |
|---|
| 460 | | - int create_options = CREATE_NOT_DIR; |
|---|
| 456 | + struct cifs_io_parms io_parms = {0}; |
|---|
| 461 | 457 | __le16 *utf16_path; |
|---|
| 462 | 458 | __u8 oplock = SMB2_OPLOCK_LEVEL_NONE; |
|---|
| 463 | 459 | struct kvec iov[2]; |
|---|
| 464 | | - |
|---|
| 465 | | - if (backup_cred(cifs_sb)) |
|---|
| 466 | | - create_options |= CREATE_OPEN_BACKUP_INTENT; |
|---|
| 467 | 460 | |
|---|
| 468 | 461 | cifs_dbg(FYI, "%s: path: %s\n", __func__, path); |
|---|
| 469 | 462 | |
|---|
| .. | .. |
|---|
| 474 | 467 | oparms.tcon = tcon; |
|---|
| 475 | 468 | oparms.cifs_sb = cifs_sb; |
|---|
| 476 | 469 | oparms.desired_access = GENERIC_WRITE; |
|---|
| 477 | | - oparms.create_options = create_options; |
|---|
| 470 | + oparms.create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR); |
|---|
| 478 | 471 | oparms.disposition = FILE_CREATE; |
|---|
| 479 | 472 | oparms.fid = &fid; |
|---|
| 480 | 473 | oparms.reconnect = false; |
|---|
| 474 | + oparms.mode = 0644; |
|---|
| 481 | 475 | |
|---|
| 482 | 476 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, |
|---|
| 483 | | - NULL); |
|---|
| 477 | + NULL, NULL); |
|---|
| 484 | 478 | if (rc) { |
|---|
| 485 | 479 | kfree(utf16_path); |
|---|
| 486 | 480 | return rc; |
|---|
| .. | .. |
|---|
| 648 | 642 | rc = query_mf_symlink(xid, tcon, cifs_sb, full_path, |
|---|
| 649 | 643 | &target_path); |
|---|
| 650 | 644 | |
|---|
| 651 | | - if (rc != 0 && server->ops->query_symlink) |
|---|
| 652 | | - rc = server->ops->query_symlink(xid, tcon, full_path, |
|---|
| 653 | | - &target_path, cifs_sb); |
|---|
| 645 | + if (rc != 0 && server->ops->query_symlink) { |
|---|
| 646 | + struct cifsInodeInfo *cifsi = CIFS_I(inode); |
|---|
| 647 | + bool reparse_point = false; |
|---|
| 648 | + |
|---|
| 649 | + if (cifsi->cifsAttrs & ATTR_REPARSE) |
|---|
| 650 | + reparse_point = true; |
|---|
| 651 | + |
|---|
| 652 | + rc = server->ops->query_symlink(xid, tcon, cifs_sb, full_path, |
|---|
| 653 | + &target_path, reparse_point); |
|---|
| 654 | + } |
|---|
| 654 | 655 | |
|---|
| 655 | 656 | kfree(full_path); |
|---|
| 656 | 657 | free_xid(xid); |
|---|
| .. | .. |
|---|
| 704 | 705 | cifs_sb_target->local_nls); */ |
|---|
| 705 | 706 | |
|---|
| 706 | 707 | if (rc == 0) { |
|---|
| 707 | | - if (pTcon->unix_ext) |
|---|
| 708 | + if (pTcon->posix_extensions) |
|---|
| 709 | + rc = smb311_posix_get_inode_info(&newinode, full_path, inode->i_sb, xid); |
|---|
| 710 | + else if (pTcon->unix_ext) |
|---|
| 708 | 711 | rc = cifs_get_inode_info_unix(&newinode, full_path, |
|---|
| 709 | 712 | inode->i_sb, xid); |
|---|
| 710 | 713 | else |
|---|