Lines Matching refs:ses

333 	struct cifs_ses *ses;  in cifs_reconnect()  local
359 ses = list_entry(tmp, struct cifs_ses, smb_ses_list); in cifs_reconnect()
360 ses->need_reconnect = true; in cifs_reconnect()
361 list_for_each(tmp2, &ses->tcon_list) { in cifs_reconnect()
365 if (ses->tcon_ipc) in cifs_reconnect()
366 ses->tcon_ipc->need_reconnect = true; in cifs_reconnect()
2490 static int match_session(struct cifs_ses *ses, struct smb_vol *vol) in match_session() argument
2493 vol->sectype != ses->sectype) in match_session()
2496 switch (ses->sectype) { in match_session()
2498 if (!uid_eq(vol->cred_uid, ses->cred_uid)) in match_session()
2503 if (ses->user_name == NULL) { in match_session()
2510 if (strncmp(ses->user_name, in match_session()
2515 ses->password != NULL && in match_session()
2516 strncmp(ses->password, in match_session()
2531 cifs_setup_ipc(struct cifs_ses *ses, struct smb_vol *volume_info) in cifs_setup_ipc() argument
2544 if (ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION) in cifs_setup_ipc()
2557 snprintf(unc, sizeof(unc), "\\\\%s\\IPC$", ses->server->hostname); in cifs_setup_ipc()
2563 tcon->ses = ses; in cifs_setup_ipc()
2566 rc = ses->server->ops->tree_connect(xid, ses, unc, tcon, nls_codepage); in cifs_setup_ipc()
2577 ses->tcon_ipc = tcon; in cifs_setup_ipc()
2589 cifs_free_ipc(struct cifs_ses *ses) in cifs_free_ipc() argument
2592 struct cifs_tcon *tcon = ses->tcon_ipc; in cifs_free_ipc()
2597 if (ses->server->ops->tree_disconnect) { in cifs_free_ipc()
2599 rc = ses->server->ops->tree_disconnect(xid, tcon); in cifs_free_ipc()
2607 ses->tcon_ipc = NULL; in cifs_free_ipc()
2614 struct cifs_ses *ses; in cifs_find_smb_ses() local
2617 list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { in cifs_find_smb_ses()
2618 if (ses->status == CifsExiting) in cifs_find_smb_ses()
2620 if (!match_session(ses, vol)) in cifs_find_smb_ses()
2622 ++ses->ses_count; in cifs_find_smb_ses()
2624 return ses; in cifs_find_smb_ses()
2631 cifs_put_smb_ses(struct cifs_ses *ses) in cifs_put_smb_ses() argument
2634 struct TCP_Server_Info *server = ses->server; in cifs_put_smb_ses()
2636 cifs_dbg(FYI, "%s: ses_count=%d\n", __func__, ses->ses_count); in cifs_put_smb_ses()
2639 if (ses->status == CifsExiting) { in cifs_put_smb_ses()
2643 if (--ses->ses_count > 0) { in cifs_put_smb_ses()
2647 if (ses->status == CifsGood) in cifs_put_smb_ses()
2648 ses->status = CifsExiting; in cifs_put_smb_ses()
2651 cifs_free_ipc(ses); in cifs_put_smb_ses()
2653 if (ses->status == CifsExiting && server->ops->logoff) { in cifs_put_smb_ses()
2655 rc = server->ops->logoff(xid, ses); in cifs_put_smb_ses()
2663 list_del_init(&ses->smb_ses_list); in cifs_put_smb_ses()
2666 sesInfoFree(ses); in cifs_put_smb_ses()
2677 cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) in cifs_set_cifscreds() argument
2684 struct TCP_Server_Info *server = ses->server; in cifs_set_cifscreds()
2713 if (!ses->domainName) { in cifs_set_cifscreds()
2720 sprintf(desc, "cifs:d:%s", ses->domainName); in cifs_set_cifscreds()
2795 struct cifs_ses *ses __attribute__((unused))) in cifs_set_cifscreds() argument
2813 struct cifs_ses *ses; in cifs_get_smb_ses() local
2819 ses = cifs_find_smb_ses(server, volume_info); in cifs_get_smb_ses()
2820 if (ses) { in cifs_get_smb_ses()
2822 ses->status); in cifs_get_smb_ses()
2824 mutex_lock(&ses->session_mutex); in cifs_get_smb_ses()
2825 rc = cifs_negotiate_protocol(xid, ses); in cifs_get_smb_ses()
2827 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2829 cifs_put_smb_ses(ses); in cifs_get_smb_ses()
2833 if (ses->need_reconnect) { in cifs_get_smb_ses()
2835 rc = cifs_setup_session(xid, ses, in cifs_get_smb_ses()
2838 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2840 cifs_put_smb_ses(ses); in cifs_get_smb_ses()
2845 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2850 return ses; in cifs_get_smb_ses()
2854 ses = sesInfoAlloc(); in cifs_get_smb_ses()
2855 if (ses == NULL) in cifs_get_smb_ses()
2859 ses->server = server; in cifs_get_smb_ses()
2861 sprintf(ses->serverName, "%pI6", &addr6->sin6_addr); in cifs_get_smb_ses()
2863 sprintf(ses->serverName, "%pI4", &addr->sin_addr); in cifs_get_smb_ses()
2866 ses->user_name = kstrdup(volume_info->username, GFP_KERNEL); in cifs_get_smb_ses()
2867 if (!ses->user_name) in cifs_get_smb_ses()
2873 ses->password = kstrdup(volume_info->password, GFP_KERNEL); in cifs_get_smb_ses()
2874 if (!ses->password) in cifs_get_smb_ses()
2878 ses->domainName = kstrdup(volume_info->domainname, GFP_KERNEL); in cifs_get_smb_ses()
2879 if (!ses->domainName) in cifs_get_smb_ses()
2883 ses->domainAuto = volume_info->domainauto; in cifs_get_smb_ses()
2884 ses->cred_uid = volume_info->cred_uid; in cifs_get_smb_ses()
2885 ses->linux_uid = volume_info->linux_uid; in cifs_get_smb_ses()
2887 ses->sectype = volume_info->sectype; in cifs_get_smb_ses()
2888 ses->sign = volume_info->sign; in cifs_get_smb_ses()
2890 mutex_lock(&ses->session_mutex); in cifs_get_smb_ses()
2891 rc = cifs_negotiate_protocol(xid, ses); in cifs_get_smb_ses()
2893 rc = cifs_setup_session(xid, ses, volume_info->local_nls); in cifs_get_smb_ses()
2894 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2900 list_add(&ses->smb_ses_list, &server->smb_ses_list); in cifs_get_smb_ses()
2905 cifs_setup_ipc(ses, volume_info); in cifs_get_smb_ses()
2907 return ses; in cifs_get_smb_ses()
2910 sesInfoFree(ses); in cifs_get_smb_ses()
2929 cifs_find_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) in cifs_find_tcon() argument
2935 list_for_each(tmp, &ses->tcon_list) { in cifs_find_tcon()
2951 struct cifs_ses *ses; in cifs_put_tcon() local
2960 ses = tcon->ses; in cifs_put_tcon()
2972 if (ses->server->ops->tree_disconnect) in cifs_put_tcon()
2973 ses->server->ops->tree_disconnect(xid, tcon); in cifs_put_tcon()
2978 cifs_put_smb_ses(ses); in cifs_put_tcon()
3002 cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) in cifs_get_tcon() argument
3007 tcon = cifs_find_tcon(ses, volume_info); in cifs_get_tcon()
3014 cifs_put_smb_ses(ses); in cifs_get_tcon()
3018 if (!ses->server->ops->tree_connect) { in cifs_get_tcon()
3030 if (ses->server->vals->protocol_id == 0) { in cifs_get_tcon()
3039 tcon->ses = ses; in cifs_get_tcon()
3049 if (ses->server->vals->protocol_id == 0) { in cifs_get_tcon()
3054 } else if (tcon->ses->server->capabilities & in cifs_get_tcon()
3065 if (ses->server->posix_ext_supported) { in cifs_get_tcon()
3081 rc = ses->server->ops->tree_connect(xid, ses, volume_info->UNC, tcon, in cifs_get_tcon()
3095 if (ses->server->vals->protocol_id == 0) { in cifs_get_tcon()
3100 } else if (ses->server->capabilities & in cifs_get_tcon()
3110 && (ses->server->capabilities & SMB2_GLOBAL_CAP_PERSISTENT_HANDLES) in cifs_get_tcon()
3115 if (ses->server->vals->protocol_id == 0) { in cifs_get_tcon()
3136 list_add(&tcon->tcon_list, &ses->tcon_list); in cifs_get_tcon()
3228 struct cifs_ses *ses; in cifs_match_super() local
3241 ses = tcon->ses; in cifs_match_super()
3242 tcp_srv = ses->server; in cifs_match_super()
3247 !match_session(ses, volume_info) || in cifs_match_super()
3262 get_dfs_path(const unsigned int xid, struct cifs_ses *ses, const char *old_path, in get_dfs_path() argument
3268 if (!ses->server->ops->get_dfs_refer) in get_dfs_path()
3274 rc = ses->server->ops->get_dfs_refer(xid, ses, old_path, in get_dfs_path()
3813 expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses, in expand_dfs_referral() argument
3829 rc = get_dfs_path(xid, ses, ref_path, cifs_sb->local_nls, in expand_dfs_referral()
3959 struct cifs_ses *ses; in cifs_mount() local
3974 else if (ses) in cifs_mount()
3975 cifs_put_smb_ses(ses); in cifs_mount()
3984 ses = NULL; in cifs_mount()
4003 ses = cifs_get_smb_ses(server, volume_info); in cifs_mount()
4004 if (IS_ERR(ses)) { in cifs_mount()
4005 rc = PTR_ERR(ses); in cifs_mount()
4006 ses = NULL; in cifs_mount()
4010 if ((volume_info->persistent == true) && ((ses->server->capabilities & in cifs_mount()
4018 tcon = cifs_get_tcon(ses, volume_info); in cifs_mount()
4033 if (cap_unix(tcon->ses)) { in cifs_mount()
4037 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) && in cifs_mount()
4063 int refrc = expand_dfs_referral(xid, ses, volume_info, cifs_sb, in cifs_mount()
4122 rc = expand_dfs_referral(xid, ses, volume_info, cifs_sb, true); in cifs_mount()
4144 tlink->tl_uid = ses->linux_uid; in cifs_mount()
4165 else if (ses) in cifs_mount()
4166 cifs_put_smb_ses(ses); in cifs_mount()
4180 CIFSTCon(const unsigned int xid, struct cifs_ses *ses, in CIFSTCon() argument
4193 if (ses == NULL) in CIFSTCon()
4205 smb_buffer->Mid = get_next_mid(ses->server); in CIFSTCon()
4206 smb_buffer->Uid = ses->Suid; in CIFSTCon()
4213 if (tcon->pipe || (ses->server->sec_mode & SECMODE_USER)) { in CIFSTCon()
4228 (ses->sectype == LANMAN)) in CIFSTCon()
4229 calc_lanman_hash(tcon->password, ses->server->cryptkey, in CIFSTCon()
4230 ses->server->sec_mode & in CIFSTCon()
4235 rc = SMBNTencrypt(tcon->password, ses->server->cryptkey, in CIFSTCon()
4245 if (ses->capabilities & CAP_UNICODE) { in CIFSTCon()
4252 if (ses->server->sign) in CIFSTCon()
4255 if (ses->capabilities & CAP_STATUS32) { in CIFSTCon()
4258 if (ses->capabilities & CAP_DFS) { in CIFSTCon()
4261 if (ses->capabilities & CAP_UNICODE) { in CIFSTCon()
4281 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, in CIFSTCon()
4374 cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses) in cifs_negotiate_protocol() argument
4377 struct TCP_Server_Info *server = ses->server; in cifs_negotiate_protocol()
4388 rc = server->ops->negotiate(xid, ses); in cifs_negotiate_protocol()
4402 cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, in cifs_setup_session() argument
4406 struct TCP_Server_Info *server = ses->server; in cifs_setup_session()
4408 ses->capabilities = server->capabilities; in cifs_setup_session()
4410 ses->capabilities &= (~server->vals->cap_unix); in cifs_setup_session()
4415 if (ses->auth_key.response) { in cifs_setup_session()
4417 ses->auth_key.response); in cifs_setup_session()
4418 kfree(ses->auth_key.response); in cifs_setup_session()
4419 ses->auth_key.response = NULL; in cifs_setup_session()
4420 ses->auth_key.len = 0; in cifs_setup_session()
4424 rc = server->ops->sess_setup(xid, ses, nls_info); in cifs_setup_session()
4433 cifs_set_vol_auth(struct smb_vol *vol, struct cifs_ses *ses) in cifs_set_vol_auth() argument
4435 vol->sectype = ses->sectype; in cifs_set_vol_auth()
4441 return cifs_set_cifscreds(vol, ses); in cifs_set_vol_auth()
4449 struct cifs_ses *ses; in cifs_construct_tcon() local
4466 vol_info->sectype = master_tcon->ses->sectype; in cifs_construct_tcon()
4467 vol_info->sign = master_tcon->ses->sign; in cifs_construct_tcon()
4469 rc = cifs_set_vol_auth(vol_info, master_tcon->ses); in cifs_construct_tcon()
4477 ++master_tcon->ses->server->srv_count; in cifs_construct_tcon()
4480 ses = cifs_get_smb_ses(master_tcon->ses->server, vol_info); in cifs_construct_tcon()
4481 if (IS_ERR(ses)) { in cifs_construct_tcon()
4482 tcon = (struct cifs_tcon *)ses; in cifs_construct_tcon()
4483 cifs_put_tcp_session(master_tcon->ses->server, 0); in cifs_construct_tcon()
4487 tcon = cifs_get_tcon(ses, vol_info); in cifs_construct_tcon()
4489 cifs_put_smb_ses(ses); in cifs_construct_tcon()
4497 if (cap_unix(ses)) in cifs_construct_tcon()