Lines Matching refs:ctx
1508 match_security(struct TCP_Server_Info *server, struct smb3_fs_context *ctx) in match_security() argument
1515 if (server->ops->select_sectype(server, ctx->sectype) in match_security()
1524 if (ctx->sign && !server->sign) in match_security()
1531 static int match_server(struct TCP_Server_Info *server, struct smb3_fs_context *ctx) in match_server() argument
1533 struct sockaddr *addr = (struct sockaddr *)&ctx->dstaddr; in match_server()
1537 if (ctx->nosharesock) in match_server()
1545 if (strcmp(ctx->vals->version_string, SMB3ANY_VERSION_STRING) == 0) { in match_server()
1548 } else if (strcmp(ctx->vals->version_string, in match_server()
1552 } else if ((server->vals != ctx->vals) || (server->ops != ctx->ops)) in match_server()
1558 if (strcasecmp(server->hostname, ctx->server_hostname)) in match_server()
1562 (struct sockaddr *)&ctx->srcaddr)) in match_server()
1568 if (!match_security(server, ctx)) in match_server()
1571 if (server->echo_interval != ctx->echo_interval * HZ) in match_server()
1574 if (server->rdma != ctx->rdma) in match_server()
1577 if (server->ignore_signature != ctx->ignore_signature) in match_server()
1580 if (server->min_offload != ctx->min_offload) in match_server()
1587 cifs_find_tcp_session(struct smb3_fs_context *ctx) in cifs_find_tcp_session() argument
1610 if (CIFS_SERVER_IS_CHAN(server) || !match_server(server, ctx)) { in cifs_find_tcp_session()
1680 cifs_get_tcp_session(struct smb3_fs_context *ctx, in cifs_get_tcp_session() argument
1686 cifs_dbg(FYI, "UNC: %s\n", ctx->UNC); in cifs_get_tcp_session()
1689 tcp_ses = cifs_find_tcp_session(ctx); in cifs_get_tcp_session()
1699 tcp_ses->hostname = kstrdup(ctx->server_hostname, GFP_KERNEL); in cifs_get_tcp_session()
1705 if (ctx->nosharesock) in cifs_get_tcp_session()
1708 tcp_ses->ops = ctx->ops; in cifs_get_tcp_session()
1709 tcp_ses->vals = ctx->vals; in cifs_get_tcp_session()
1713 tcp_ses->noblockcnt = ctx->rootfs; in cifs_get_tcp_session()
1714 tcp_ses->noblocksnd = ctx->noblocksnd || ctx->rootfs; in cifs_get_tcp_session()
1715 tcp_ses->noautotune = ctx->noautotune; in cifs_get_tcp_session()
1716 tcp_ses->tcp_nodelay = ctx->sockopt_tcp_nodelay; in cifs_get_tcp_session()
1717 tcp_ses->rdma = ctx->rdma; in cifs_get_tcp_session()
1732 ctx->source_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL); in cifs_get_tcp_session()
1734 ctx->target_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL); in cifs_get_tcp_session()
1740 tcp_ses->compress_algorithm = cpu_to_le16(ctx->compression); in cifs_get_tcp_session()
1753 memcpy(&tcp_ses->srcaddr, &ctx->srcaddr, in cifs_get_tcp_session()
1755 memcpy(&tcp_ses->dstaddr, &ctx->dstaddr, in cifs_get_tcp_session()
1757 if (ctx->use_client_guid) in cifs_get_tcp_session()
1758 memcpy(tcp_ses->client_guid, ctx->client_guid, in cifs_get_tcp_session()
1770 if (ctx->echo_interval >= SMB_ECHO_INTERVAL_MIN && in cifs_get_tcp_session()
1771 ctx->echo_interval <= SMB_ECHO_INTERVAL_MAX) in cifs_get_tcp_session()
1772 tcp_ses->echo_interval = ctx->echo_interval * HZ; in cifs_get_tcp_session()
1782 tcp_ses, (struct sockaddr *)&ctx->dstaddr); in cifs_get_tcp_session()
1811 tcp_ses->min_offload = ctx->min_offload; in cifs_get_tcp_session()
1821 if ((ctx->max_credits < 20) || (ctx->max_credits > 60000)) in cifs_get_tcp_session()
1824 tcp_ses->max_credits = ctx->max_credits; in cifs_get_tcp_session()
1827 tcp_ses->ignore_signature = ctx->ignore_signature; in cifs_get_tcp_session()
1862 static int match_session(struct cifs_ses *ses, struct smb3_fs_context *ctx) in match_session() argument
1864 if (ctx->sectype != Unspecified && in match_session()
1865 ctx->sectype != ses->sectype) in match_session()
1872 if (ses->chan_max < ctx->max_channels) in match_session()
1877 if (!uid_eq(ctx->cred_uid, ses->cred_uid)) in match_session()
1883 if (!ctx->nullauth) in match_session()
1890 ctx->username ? ctx->username : "", in match_session()
1893 if ((ctx->username && strlen(ctx->username) != 0) && in match_session()
1896 ctx->password ? ctx->password : "", in match_session()
1913 cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx) in cifs_setup_ipc() argument
1925 if (ctx->seal) { in cifs_setup_ipc()
1947 rc = server->ops->tree_connect(xid, ses, unc, tcon, ctx->local_nls); in cifs_setup_ipc()
1992 cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx) in cifs_find_smb_ses() argument
2004 if (!match_session(ses, ctx)) { in cifs_find_smb_ses()
2098 cifs_set_cifscreds(struct smb3_fs_context *ctx, struct cifs_ses *ses) in cifs_set_cifscreds() argument
2178 ctx->username = kstrndup(payload, len, GFP_KERNEL); in cifs_set_cifscreds()
2179 if (!ctx->username) { in cifs_set_cifscreds()
2185 cifs_dbg(FYI, "%s: username=%s\n", __func__, ctx->username); in cifs_set_cifscreds()
2191 kfree(ctx->username); in cifs_set_cifscreds()
2192 ctx->username = NULL; in cifs_set_cifscreds()
2197 ctx->password = kstrndup(delim, len, GFP_KERNEL); in cifs_set_cifscreds()
2198 if (!ctx->password) { in cifs_set_cifscreds()
2202 kfree(ctx->username); in cifs_set_cifscreds()
2203 ctx->username = NULL; in cifs_set_cifscreds()
2212 ctx->domainname = kstrdup(ses->domainName, GFP_KERNEL); in cifs_set_cifscreds()
2213 if (!ctx->domainname) { in cifs_set_cifscreds()
2217 kfree(ctx->username); in cifs_set_cifscreds()
2218 ctx->username = NULL; in cifs_set_cifscreds()
2219 kfree_sensitive(ctx->password); in cifs_set_cifscreds()
2220 ctx->password = NULL; in cifs_set_cifscreds()
2225 strscpy(ctx->workstation_name, ses->workstation_name, sizeof(ctx->workstation_name)); in cifs_set_cifscreds()
2237 cifs_set_cifscreds(struct smb3_fs_context *ctx __attribute__((unused)), in cifs_set_cifscreds() argument
2254 cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx) in cifs_get_smb_ses() argument
2264 ses = cifs_find_smb_ses(server, ctx); in cifs_get_smb_ses()
2285 ctx->local_nls); in cifs_get_smb_ses()
2319 if (ctx->username) { in cifs_get_smb_ses()
2320 ses->user_name = kstrdup(ctx->username, GFP_KERNEL); in cifs_get_smb_ses()
2326 if (ctx->password) { in cifs_get_smb_ses()
2327 ses->password = kstrdup(ctx->password, GFP_KERNEL); in cifs_get_smb_ses()
2331 if (ctx->domainname) { in cifs_get_smb_ses()
2332 ses->domainName = kstrdup(ctx->domainname, GFP_KERNEL); in cifs_get_smb_ses()
2337 strscpy(ses->workstation_name, ctx->workstation_name, sizeof(ses->workstation_name)); in cifs_get_smb_ses()
2339 if (ctx->domainauto) in cifs_get_smb_ses()
2340 ses->domainAuto = ctx->domainauto; in cifs_get_smb_ses()
2341 ses->cred_uid = ctx->cred_uid; in cifs_get_smb_ses()
2342 ses->linux_uid = ctx->linux_uid; in cifs_get_smb_ses()
2344 ses->sectype = ctx->sectype; in cifs_get_smb_ses()
2345 ses->sign = ctx->sign; in cifs_get_smb_ses()
2351 ses->chan_max = ctx->multichannel ? ctx->max_channels:1; in cifs_get_smb_ses()
2358 rc = cifs_setup_session(xid, ses, server, ctx->local_nls); in cifs_get_smb_ses()
2379 cifs_setup_ipc(ses, ctx); in cifs_get_smb_ses()
2392 static int match_tcon(struct cifs_tcon *tcon, struct smb3_fs_context *ctx) in match_tcon() argument
2396 if (strncmp(tcon->tree_name, ctx->UNC, MAX_TREE_SIZE)) in match_tcon()
2398 if (tcon->seal != ctx->seal) in match_tcon()
2400 if (tcon->snapshot_time != ctx->snapshot_time) in match_tcon()
2402 if (tcon->handle_timeout != ctx->handle_timeout) in match_tcon()
2404 if (tcon->no_lease != ctx->no_lease) in match_tcon()
2406 if (tcon->nodelete != ctx->nodelete) in match_tcon()
2412 cifs_find_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) in cifs_find_tcon() argument
2419 if (!match_tcon(tcon, ctx)) { in cifs_find_tcon()
2509 cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) in cifs_get_tcon() argument
2514 tcon = cifs_find_tcon(ses, ctx); in cifs_get_tcon()
2536 if (ctx->snapshot_time) { in cifs_get_tcon()
2543 tcon->snapshot_time = ctx->snapshot_time; in cifs_get_tcon()
2546 if (ctx->handle_timeout) { in cifs_get_tcon()
2553 tcon->handle_timeout = ctx->handle_timeout; in cifs_get_tcon()
2557 if (ctx->password) { in cifs_get_tcon()
2558 tcon->password = kstrdup(ctx->password, GFP_KERNEL); in cifs_get_tcon()
2565 if (ctx->seal) { in cifs_get_tcon()
2581 if (ctx->linux_ext) { in cifs_get_tcon()
2602 rc = ses->server->ops->tree_connect(xid, ses, ctx->UNC, tcon, in cifs_get_tcon()
2603 ctx->local_nls); in cifs_get_tcon()
2611 if (ctx->persistent) { in cifs_get_tcon()
2628 && (ctx->nopersistent == false)) { in cifs_get_tcon()
2631 } else if (ctx->resilient) { in cifs_get_tcon()
2642 if (IS_ENABLED(CONFIG_CIFS_SWN_UPCALL) && ctx->witness) { in cifs_get_tcon()
2671 if (ctx->cache_ro) in cifs_get_tcon()
2673 else if (ctx->cache_rw) in cifs_get_tcon()
2677 if (ctx->no_lease) { in cifs_get_tcon()
2684 tcon->no_lease = ctx->no_lease; in cifs_get_tcon()
2692 tcon->retry = ctx->retry; in cifs_get_tcon()
2693 tcon->nocase = ctx->nocase; in cifs_get_tcon()
2694 tcon->broken_sparse_sup = ctx->no_sparse; in cifs_get_tcon()
2696 tcon->nohandlecache = ctx->nohandlecache; in cifs_get_tcon()
2699 tcon->nodelete = ctx->nodelete; in cifs_get_tcon()
2700 tcon->local_lease = ctx->local_lease; in cifs_get_tcon()
2763 if (new->ctx->wsize && new->ctx->wsize < old->ctx->wsize) in compare_mount_options()
2766 if (new->ctx->rsize && new->ctx->rsize < old->ctx->rsize) in compare_mount_options()
2769 if (!uid_eq(old->ctx->linux_uid, new->ctx->linux_uid) || in compare_mount_options()
2770 !gid_eq(old->ctx->linux_gid, new->ctx->linux_gid)) in compare_mount_options()
2773 if (old->ctx->file_mode != new->ctx->file_mode || in compare_mount_options()
2774 old->ctx->dir_mode != new->ctx->dir_mode) in compare_mount_options()
2780 if (old->ctx->acregmax != new->ctx->acregmax) in compare_mount_options()
2782 if (old->ctx->acdirmax != new->ctx->acdirmax) in compare_mount_options()
2784 if (old->ctx->closetimeo != new->ctx->closetimeo) in compare_mount_options()
2812 struct smb3_fs_context *ctx; in cifs_match_super() local
2839 ctx = mnt_data->ctx; in cifs_match_super()
2845 if (!match_server(tcp_srv, ctx) || in cifs_match_super()
2846 !match_session(ses, ctx) || in cifs_match_super()
2847 !match_tcon(tcon, ctx) || in cifs_match_super()
3122 struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) in reset_cifs_unix_caps() argument
3137 if (ctx && ctx->no_linux_ext) { in reset_cifs_unix_caps()
3142 } else if (ctx) in reset_cifs_unix_caps()
3157 if (ctx == NULL) { in reset_cifs_unix_caps()
3178 if (ctx && ctx->no_psx_acl) in reset_cifs_unix_caps()
3187 if (ctx && ctx->posix_paths == 0) in reset_cifs_unix_caps()
3218 if (ctx == NULL) in reset_cifs_unix_caps()
3230 struct smb3_fs_context *ctx = cifs_sb->ctx; in cifs_setup_cifs_sb() local
3238 ctx->file_mode, ctx->dir_mode); in cifs_setup_cifs_sb()
3241 if (ctx->iocharset == NULL) { in cifs_setup_cifs_sb()
3245 cifs_sb->local_nls = load_nls(ctx->iocharset); in cifs_setup_cifs_sb()
3248 ctx->iocharset); in cifs_setup_cifs_sb()
3252 ctx->local_nls = cifs_sb->local_nls; in cifs_setup_cifs_sb()
3256 if (ctx->direct_io) in cifs_setup_cifs_sb()
3258 if (ctx->cache_ro) { in cifs_setup_cifs_sb()
3261 } else if (ctx->cache_rw) { in cifs_setup_cifs_sb()
3267 if ((ctx->cifs_acl) && (ctx->dynperm)) in cifs_setup_cifs_sb()
3270 if (ctx->prepath) { in cifs_setup_cifs_sb()
3271 cifs_sb->prepath = kstrdup(ctx->prepath, GFP_KERNEL); in cifs_setup_cifs_sb()
3302 struct smb3_fs_context *ctx = mnt_ctx->fs_ctx; in mount_get_conns() local
3309 server = cifs_get_tcp_session(ctx, NULL); in mount_get_conns()
3317 ses = cifs_get_smb_ses(server, ctx); in mount_get_conns()
3324 if ((ctx->persistent == true) && (!(ses->server->capabilities & in mount_get_conns()
3332 tcon = cifs_get_tcon(ses, ctx); in mount_get_conns()
3350 reset_cifs_unix_caps(xid, tcon, cifs_sb, ctx); in mount_get_conns()
3383 if ((cifs_sb->ctx->wsize == 0) || in mount_get_conns()
3384 (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx))) in mount_get_conns()
3385 cifs_sb->ctx->wsize = server->ops->negotiate_wsize(tcon, ctx); in mount_get_conns()
3386 if ((cifs_sb->ctx->rsize == 0) || in mount_get_conns()
3387 (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx))) in mount_get_conns()
3388 cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx); in mount_get_conns()
3455 build_unc_path_to_root(const struct smb3_fs_context *ctx, in build_unc_path_to_root() argument
3459 unsigned int pplen = useppath && ctx->prepath ? in build_unc_path_to_root()
3460 strlen(ctx->prepath) + 1 : 0; in build_unc_path_to_root()
3461 unsigned int unc_len = strnlen(ctx->UNC, MAX_TREE_SIZE + 1); in build_unc_path_to_root()
3470 memcpy(full_path, ctx->UNC, unc_len); in build_unc_path_to_root()
3475 memcpy(pos + 1, ctx->prepath, pplen); in build_unc_path_to_root()
3496 struct smb3_fs_context *ctx = mnt_ctx->fs_ctx; in expand_dfs_referral() local
3499 mdata = cifs_compose_mount_options(cifs_sb->ctx->mount_options, full_path + 1, referral, in expand_dfs_referral()
3510 kfree(ctx->prepath); in expand_dfs_referral()
3511 ctx->prepath = NULL; in expand_dfs_referral()
3512 rc = cifs_setup_volume_info(ctx, mdata, fake_devname); in expand_dfs_referral()
3515 kfree(cifs_sb->ctx->mount_options); in expand_dfs_referral()
3516 cifs_sb->ctx->mount_options = mdata; in expand_dfs_referral()
3526 cifs_setup_volume_info(struct smb3_fs_context *ctx, const char *mntopts, const char *devname) in cifs_setup_volume_info() argument
3532 rc = smb3_parse_devname(devname, ctx); in cifs_setup_volume_info()
3548 rc = cifs_convert_address((struct sockaddr *)&ctx->dstaddr, ip, strlen(ip)); in cifs_setup_volume_info()
3556 if (ctx->nullauth) { in cifs_setup_volume_info()
3558 kfree(ctx->username); in cifs_setup_volume_info()
3559 ctx->username = NULL; in cifs_setup_volume_info()
3560 } else if (ctx->username) { in cifs_setup_volume_info()
3562 cifs_dbg(FYI, "Username: %s\n", ctx->username); in cifs_setup_volume_info()
3632 struct smb3_fs_context *ctx = mnt_ctx->fs_ctx; in is_path_remote() local
3641 full_path = cifs_build_path_to_root(ctx, cifs_sb, tcon, in is_path_remote()
3684 struct smb3_fs_context *ctx = mnt_ctx->fs_ctx; in is_dfs_mount() local
3698 ctx->UNC + 1, NULL, root_tl)) { in is_dfs_mount()
3717 char *oldmnt = cifs_sb->ctx->mount_options; in connect_dfs_target()
3731 if (oldmnt != cifs_sb->ctx->mount_options) { in connect_dfs_target()
3752 struct smb3_fs_context *ctx = mnt_ctx->fs_ctx; in connect_dfs_root() local
3763 full_path = build_unc_path_to_root(ctx, cifs_sb, true); in connect_dfs_root()
3767 mnt_ctx->origin_fullpath = dfs_cache_canonical_path(ctx->UNC, cifs_sb->local_nls, in connect_dfs_root()
3796 struct smb3_fs_context *ctx = mnt_ctx->fs_ctx; in __follow_dfs_link() local
3801 full_path = build_unc_path_to_root(ctx, cifs_sb, true); in __follow_dfs_link()
3845 struct smb3_fs_context *ctx = mnt_ctx->fs_ctx; in follow_dfs_link() local
3849 full_path = build_unc_path_to_root(ctx, cifs_sb, true); in follow_dfs_link()
3886 int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) in cifs_mount() argument
3889 struct mount_ctx mnt_ctx = { .cifs_sb = cifs_sb, .fs_ctx = ctx, }; in cifs_mount()
3925 cifs_sb->prepath = ctx->prepath; in cifs_mount()
3926 ctx->prepath = NULL; in cifs_mount()
3946 int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) in cifs_mount() argument
3949 struct mount_ctx mnt_ctx = { .cifs_sb = cifs_sb, .fs_ctx = ctx, }; in cifs_mount()
4108 smb3_cleanup_fs_context(cifs_sb->ctx); in delayed_free()
4282 cifs_set_vol_auth(struct smb3_fs_context *ctx, struct cifs_ses *ses) in cifs_set_vol_auth() argument
4284 ctx->sectype = ses->sectype; in cifs_set_vol_auth()
4287 if (ctx->sectype == Kerberos) in cifs_set_vol_auth()
4290 return cifs_set_cifscreds(ctx, ses); in cifs_set_vol_auth()
4300 struct smb3_fs_context *ctx; in cifs_construct_tcon() local
4302 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); in cifs_construct_tcon()
4303 if (ctx == NULL) in cifs_construct_tcon()
4306 ctx->local_nls = cifs_sb->local_nls; in cifs_construct_tcon()
4307 ctx->linux_uid = fsuid; in cifs_construct_tcon()
4308 ctx->cred_uid = fsuid; in cifs_construct_tcon()
4309 ctx->UNC = master_tcon->tree_name; in cifs_construct_tcon()
4310 ctx->retry = master_tcon->retry; in cifs_construct_tcon()
4311 ctx->nocase = master_tcon->nocase; in cifs_construct_tcon()
4312 ctx->nohandlecache = master_tcon->nohandlecache; in cifs_construct_tcon()
4313 ctx->local_lease = master_tcon->local_lease; in cifs_construct_tcon()
4314 ctx->no_lease = master_tcon->no_lease; in cifs_construct_tcon()
4315 ctx->resilient = master_tcon->use_resilient; in cifs_construct_tcon()
4316 ctx->persistent = master_tcon->use_persistent; in cifs_construct_tcon()
4317 ctx->handle_timeout = master_tcon->handle_timeout; in cifs_construct_tcon()
4318 ctx->no_linux_ext = !master_tcon->unix_ext; in cifs_construct_tcon()
4319 ctx->linux_ext = master_tcon->posix_extensions; in cifs_construct_tcon()
4320 ctx->sectype = master_tcon->ses->sectype; in cifs_construct_tcon()
4321 ctx->sign = master_tcon->ses->sign; in cifs_construct_tcon()
4322 ctx->seal = master_tcon->seal; in cifs_construct_tcon()
4323 ctx->witness = master_tcon->use_witness; in cifs_construct_tcon()
4325 rc = cifs_set_vol_auth(ctx, master_tcon->ses); in cifs_construct_tcon()
4336 ses = cifs_get_smb_ses(master_tcon->ses->server, ctx); in cifs_construct_tcon()
4343 tcon = cifs_get_tcon(ses, ctx); in cifs_construct_tcon()
4351 reset_cifs_unix_caps(0, tcon, NULL, ctx); in cifs_construct_tcon()
4355 kfree(ctx->username); in cifs_construct_tcon()
4356 kfree_sensitive(ctx->password); in cifs_construct_tcon()
4357 kfree(ctx); in cifs_construct_tcon()