diff options
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 733119dad493..b8cd335d6f11 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -2531,8 +2531,8 @@ CIFSSMBFlush(const unsigned int xid, struct cifs_tcon *tcon, int smb_file_id) | |||
2531 | 2531 | ||
2532 | int | 2532 | int |
2533 | CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon, | 2533 | CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon, |
2534 | const char *fromName, const char *toName, | 2534 | const char *from_name, const char *to_name, |
2535 | const struct nls_table *nls_codepage, int remap) | 2535 | struct cifs_sb_info *cifs_sb) |
2536 | { | 2536 | { |
2537 | int rc = 0; | 2537 | int rc = 0; |
2538 | RENAME_REQ *pSMB = NULL; | 2538 | RENAME_REQ *pSMB = NULL; |
@@ -2540,6 +2540,7 @@ CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon, | |||
2540 | int bytes_returned; | 2540 | int bytes_returned; |
2541 | int name_len, name_len2; | 2541 | int name_len, name_len2; |
2542 | __u16 count; | 2542 | __u16 count; |
2543 | int remap = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR; | ||
2543 | 2544 | ||
2544 | cFYI(1, "In CIFSSMBRename"); | 2545 | cFYI(1, "In CIFSSMBRename"); |
2545 | renameRetry: | 2546 | renameRetry: |
@@ -2554,9 +2555,9 @@ renameRetry: | |||
2554 | ATTR_DIRECTORY); | 2555 | ATTR_DIRECTORY); |
2555 | 2556 | ||
2556 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | 2557 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { |
2557 | name_len = | 2558 | name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName, |
2558 | cifsConvertToUTF16((__le16 *) pSMB->OldFileName, fromName, | 2559 | from_name, PATH_MAX, |
2559 | PATH_MAX, nls_codepage, remap); | 2560 | cifs_sb->local_nls, remap); |
2560 | name_len++; /* trailing null */ | 2561 | name_len++; /* trailing null */ |
2561 | name_len *= 2; | 2562 | name_len *= 2; |
2562 | pSMB->OldFileName[name_len] = 0x04; /* pad */ | 2563 | pSMB->OldFileName[name_len] = 0x04; /* pad */ |
@@ -2564,17 +2565,18 @@ renameRetry: | |||
2564 | pSMB->OldFileName[name_len + 1] = 0x00; | 2565 | pSMB->OldFileName[name_len + 1] = 0x00; |
2565 | name_len2 = | 2566 | name_len2 = |
2566 | cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2], | 2567 | cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2], |
2567 | toName, PATH_MAX, nls_codepage, remap); | 2568 | to_name, PATH_MAX, cifs_sb->local_nls, |
2569 | remap); | ||
2568 | name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; | 2570 | name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; |
2569 | name_len2 *= 2; /* convert to bytes */ | 2571 | name_len2 *= 2; /* convert to bytes */ |
2570 | } else { /* BB improve the check for buffer overruns BB */ | 2572 | } else { /* BB improve the check for buffer overruns BB */ |
2571 | name_len = strnlen(fromName, PATH_MAX); | 2573 | name_len = strnlen(from_name, PATH_MAX); |
2572 | name_len++; /* trailing null */ | 2574 | name_len++; /* trailing null */ |
2573 | strncpy(pSMB->OldFileName, fromName, name_len); | 2575 | strncpy(pSMB->OldFileName, from_name, name_len); |
2574 | name_len2 = strnlen(toName, PATH_MAX); | 2576 | name_len2 = strnlen(to_name, PATH_MAX); |
2575 | name_len2++; /* trailing null */ | 2577 | name_len2++; /* trailing null */ |
2576 | pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ | 2578 | pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ |
2577 | strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2); | 2579 | strncpy(&pSMB->OldFileName[name_len + 1], to_name, name_len2); |
2578 | name_len2++; /* trailing null */ | 2580 | name_len2++; /* trailing null */ |
2579 | name_len2++; /* signature byte */ | 2581 | name_len2++; /* signature byte */ |
2580 | } | 2582 | } |