Skip to content

Commit d82c693

Browse files
committed
ksmbd: test
Signed-off-by: Namjae Jeon <[email protected]>
1 parent f819d8a commit d82c693

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

smb2pdu.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,18 +3031,19 @@ int smb2_open(struct ksmbd_work *work)
30313031
}
30323032

30333033
ksmbd_debug(SMB, "converted name = %s\n", name);
3034-
if (strchr(name, ':')) {
3035-
if (!test_share_config_flag(work->tcon->share_conf,
3036-
KSMBD_SHARE_FLAG_STREAMS)) {
3037-
rc = -EBADF;
3038-
goto err_out2;
3039-
}
3040-
rc = parse_stream_name(name, &stream_name, &s_type);
3041-
if (rc < 0)
3042-
goto err_out2;
3043-
}
30443034

30453035
if (posix_ctxt == false) {
3036+
if (strchr(name, ':')) {
3037+
if (!test_share_config_flag(work->tcon->share_conf,
3038+
KSMBD_SHARE_FLAG_STREAMS)) {
3039+
rc = -EBADF;
3040+
goto err_out2;
3041+
}
3042+
rc = parse_stream_name(name, &stream_name, &s_type);
3043+
if (rc < 0)
3044+
goto err_out2;
3045+
}
3046+
30463047
rc = ksmbd_validate_filename(name);
30473048
if (rc < 0)
30483049
goto err_out2;
@@ -3595,6 +3596,8 @@ int smb2_open(struct ksmbd_work *work)
35953596
fp->attrib_only = !(req->DesiredAccess & ~(FILE_READ_ATTRIBUTES_LE |
35963597
FILE_WRITE_ATTRIBUTES_LE | FILE_SYNCHRONIZE_LE));
35973598

3599+
fp->is_posix_ctxt = posix_ctxt;
3600+
35983601
/* fp should be searchable through ksmbd_inode.m_fp_list
35993602
* after daccess, saccess, attrib_only, and stream are
36003603
* initialized.
@@ -6280,7 +6283,7 @@ static int smb2_rename(struct ksmbd_work *work,
62806283
if (IS_ERR(new_name))
62816284
return PTR_ERR(new_name);
62826285

6283-
if (strchr(new_name, ':')) {
6286+
if (fp->is_posix_ctxt == false && strchr(new_name, ':')) {
62846287
int s_type;
62856288
char *xattr_stream_name, *stream_name = NULL;
62866289
size_t xattr_stream_size;

vfs_cache.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ struct ksmbd_file {
126126
bool is_durable;
127127
bool is_persistent;
128128
bool is_resilient;
129+
130+
bool is_posix_ctxt;
129131
};
130132

131133
static inline void set_ctx_actor(struct dir_context *ctx,

0 commit comments

Comments
 (0)