Lines Matching refs:ses
316 struct cifs_ses *ses; in cifs_reconnect() local
343 ses = list_entry(tmp, struct cifs_ses, smb_ses_list); in cifs_reconnect()
344 ses->need_reconnect = true; in cifs_reconnect()
345 ses->ipc_tid = 0; in cifs_reconnect()
346 list_for_each(tmp2, &ses->tcon_list) { in cifs_reconnect()
2260 static int match_session(struct cifs_ses *ses, struct smb_vol *vol) in match_session() argument
2263 vol->sectype != ses->sectype) in match_session()
2266 switch (ses->sectype) { in match_session()
2268 if (!uid_eq(vol->cred_uid, ses->cred_uid)) in match_session()
2273 if (ses->user_name == NULL) { in match_session()
2280 if (strncmp(ses->user_name, in match_session()
2285 ses->password != NULL && in match_session()
2286 strncmp(ses->password, in match_session()
2297 struct cifs_ses *ses; in cifs_find_smb_ses() local
2300 list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { in cifs_find_smb_ses()
2301 if (ses->status == CifsExiting) in cifs_find_smb_ses()
2303 if (!match_session(ses, vol)) in cifs_find_smb_ses()
2305 ++ses->ses_count; in cifs_find_smb_ses()
2307 return ses; in cifs_find_smb_ses()
2314 cifs_put_smb_ses(struct cifs_ses *ses) in cifs_put_smb_ses() argument
2317 struct TCP_Server_Info *server = ses->server; in cifs_put_smb_ses()
2319 cifs_dbg(FYI, "%s: ses_count=%d\n", __func__, ses->ses_count); in cifs_put_smb_ses()
2322 if (ses->status == CifsExiting) { in cifs_put_smb_ses()
2326 if (--ses->ses_count > 0) { in cifs_put_smb_ses()
2330 if (ses->status == CifsGood) in cifs_put_smb_ses()
2331 ses->status = CifsExiting; in cifs_put_smb_ses()
2334 if (ses->status == CifsExiting && server->ops->logoff) { in cifs_put_smb_ses()
2336 rc = server->ops->logoff(xid, ses); in cifs_put_smb_ses()
2344 list_del_init(&ses->smb_ses_list); in cifs_put_smb_ses()
2347 sesInfoFree(ses); in cifs_put_smb_ses()
2358 cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) in cifs_set_cifscreds() argument
2365 struct TCP_Server_Info *server = ses->server; in cifs_set_cifscreds()
2394 if (!ses->domainName) { in cifs_set_cifscreds()
2401 sprintf(desc, "cifs:d:%s", ses->domainName); in cifs_set_cifscreds()
2476 struct cifs_ses *ses __attribute__((unused))) in cifs_set_cifscreds() argument
2487 struct cifs_ses *ses; in cifs_get_smb_ses() local
2493 ses = cifs_find_smb_ses(server, volume_info); in cifs_get_smb_ses()
2494 if (ses) { in cifs_get_smb_ses()
2496 ses->status); in cifs_get_smb_ses()
2498 mutex_lock(&ses->session_mutex); in cifs_get_smb_ses()
2499 rc = cifs_negotiate_protocol(xid, ses); in cifs_get_smb_ses()
2501 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2503 cifs_put_smb_ses(ses); in cifs_get_smb_ses()
2507 if (ses->need_reconnect) { in cifs_get_smb_ses()
2509 rc = cifs_setup_session(xid, ses, in cifs_get_smb_ses()
2512 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2514 cifs_put_smb_ses(ses); in cifs_get_smb_ses()
2519 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2524 return ses; in cifs_get_smb_ses()
2528 ses = sesInfoAlloc(); in cifs_get_smb_ses()
2529 if (ses == NULL) in cifs_get_smb_ses()
2533 ses->server = server; in cifs_get_smb_ses()
2535 sprintf(ses->serverName, "%pI6", &addr6->sin6_addr); in cifs_get_smb_ses()
2537 sprintf(ses->serverName, "%pI4", &addr->sin_addr); in cifs_get_smb_ses()
2540 ses->user_name = kstrdup(volume_info->username, GFP_KERNEL); in cifs_get_smb_ses()
2541 if (!ses->user_name) in cifs_get_smb_ses()
2547 ses->password = kstrdup(volume_info->password, GFP_KERNEL); in cifs_get_smb_ses()
2548 if (!ses->password) in cifs_get_smb_ses()
2552 ses->domainName = kstrdup(volume_info->domainname, GFP_KERNEL); in cifs_get_smb_ses()
2553 if (!ses->domainName) in cifs_get_smb_ses()
2556 ses->cred_uid = volume_info->cred_uid; in cifs_get_smb_ses()
2557 ses->linux_uid = volume_info->linux_uid; in cifs_get_smb_ses()
2559 ses->sectype = volume_info->sectype; in cifs_get_smb_ses()
2560 ses->sign = volume_info->sign; in cifs_get_smb_ses()
2562 mutex_lock(&ses->session_mutex); in cifs_get_smb_ses()
2563 rc = cifs_negotiate_protocol(xid, ses); in cifs_get_smb_ses()
2565 rc = cifs_setup_session(xid, ses, volume_info->local_nls); in cifs_get_smb_ses()
2566 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2572 list_add(&ses->smb_ses_list, &server->smb_ses_list); in cifs_get_smb_ses()
2576 return ses; in cifs_get_smb_ses()
2579 sesInfoFree(ses); in cifs_get_smb_ses()
2594 cifs_find_tcon(struct cifs_ses *ses, const char *unc) in cifs_find_tcon() argument
2600 list_for_each(tmp, &ses->tcon_list) { in cifs_find_tcon()
2616 struct cifs_ses *ses = tcon->ses; in cifs_put_tcon() local
2629 if (ses->server->ops->tree_disconnect) in cifs_put_tcon()
2630 ses->server->ops->tree_disconnect(xid, tcon); in cifs_put_tcon()
2635 cifs_put_smb_ses(ses); in cifs_put_tcon()
2639 cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) in cifs_get_tcon() argument
2644 tcon = cifs_find_tcon(ses, volume_info->UNC); in cifs_get_tcon()
2648 cifs_put_smb_ses(ses); in cifs_get_tcon()
2654 if (!ses->server->ops->tree_connect) { in cifs_get_tcon()
2665 tcon->ses = ses; in cifs_get_tcon()
2679 rc = ses->server->ops->tree_connect(xid, ses, volume_info->UNC, tcon, in cifs_get_tcon()
2694 if (ses->server->vals->protocol_id == 0) { in cifs_get_tcon()
2700 } else if (ses->server->capabilities & in cifs_get_tcon()
2712 && (ses->server->capabilities & SMB2_GLOBAL_CAP_PERSISTENT_HANDLES) in cifs_get_tcon()
2718 if (ses->server->vals->protocol_id == 0) { in cifs_get_tcon()
2738 list_add(&tcon->tcon_list, &ses->tcon_list); in cifs_get_tcon()
2820 struct cifs_ses *ses; in cifs_match_super() local
2833 ses = tcon->ses; in cifs_match_super()
2834 tcp_srv = ses->server; in cifs_match_super()
2839 !match_session(ses, volume_info) || in cifs_match_super()
2853 get_dfs_path(const unsigned int xid, struct cifs_ses *ses, const char *old_path, in get_dfs_path() argument
2860 if (!ses->server->ops->tree_connect || !ses->server->ops->get_dfs_refer) in get_dfs_path()
2866 if (ses->ipc_tid == 0) { in get_dfs_path()
2868 strnlen(ses->serverName, SERVER_NAME_LEN_WITH_NULL * 2) in get_dfs_path()
2874 strcpy(temp_unc + 2, ses->serverName); in get_dfs_path()
2875 strcpy(temp_unc + 2 + strlen(ses->serverName), "\\IPC$"); in get_dfs_path()
2876 rc = ses->server->ops->tree_connect(xid, ses, temp_unc, NULL, in get_dfs_path()
2878 cifs_dbg(FYI, "Tcon rc = %d ipc_tid = %d\n", rc, ses->ipc_tid); in get_dfs_path()
2882 rc = ses->server->ops->get_dfs_refer(xid, ses, old_path, in get_dfs_path()
3415 expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses, in expand_dfs_referral() argument
3431 rc = get_dfs_path(xid, ses, ref_path, cifs_sb->local_nls, in expand_dfs_referral()
3523 struct cifs_ses *ses; in cifs_mount() local
3542 else if (ses) in cifs_mount()
3543 cifs_put_smb_ses(ses); in cifs_mount()
3552 ses = NULL; in cifs_mount()
3568 ses = cifs_get_smb_ses(server, volume_info); in cifs_mount()
3569 if (IS_ERR(ses)) { in cifs_mount()
3570 rc = PTR_ERR(ses); in cifs_mount()
3571 ses = NULL; in cifs_mount()
3576 if ((volume_info->persistent == true) && ((ses->server->capabilities & in cifs_mount()
3585 tcon = cifs_get_tcon(ses, volume_info); in cifs_mount()
3593 if (cap_unix(tcon->ses)) { in cifs_mount()
3597 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) && in cifs_mount()
3626 int refrc = expand_dfs_referral(xid, ses, volume_info, cifs_sb, in cifs_mount()
3672 rc = expand_dfs_referral(xid, ses, volume_info, cifs_sb, true); in cifs_mount()
3694 tlink->tl_uid = ses->linux_uid; in cifs_mount()
3715 else if (ses) in cifs_mount()
3716 cifs_put_smb_ses(ses); in cifs_mount()
3732 CIFSTCon(const unsigned int xid, struct cifs_ses *ses, in CIFSTCon() argument
3745 if (ses == NULL) in CIFSTCon()
3757 smb_buffer->Mid = get_next_mid(ses->server); in CIFSTCon()
3758 smb_buffer->Uid = ses->Suid; in CIFSTCon()
3765 if (!tcon || (ses->server->sec_mode & SECMODE_USER)) { in CIFSTCon()
3780 (ses->sectype == LANMAN)) in CIFSTCon()
3781 calc_lanman_hash(tcon->password, ses->server->cryptkey, in CIFSTCon()
3782 ses->server->sec_mode & in CIFSTCon()
3787 rc = SMBNTencrypt(tcon->password, ses->server->cryptkey, in CIFSTCon()
3797 if (ses->capabilities & CAP_UNICODE) { in CIFSTCon()
3804 if (ses->server->sign) in CIFSTCon()
3807 if (ses->capabilities & CAP_STATUS32) { in CIFSTCon()
3810 if (ses->capabilities & CAP_DFS) { in CIFSTCon()
3813 if (ses->capabilities & CAP_UNICODE) { in CIFSTCon()
3833 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, in CIFSTCon()
3886 ses->ipc_tid = smb_buffer_response->Tid; in CIFSTCon()
3928 cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses) in cifs_negotiate_protocol() argument
3931 struct TCP_Server_Info *server = ses->server; in cifs_negotiate_protocol()
3942 rc = server->ops->negotiate(xid, ses); in cifs_negotiate_protocol()
3956 cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, in cifs_setup_session() argument
3960 struct TCP_Server_Info *server = ses->server; in cifs_setup_session()
3962 ses->capabilities = server->capabilities; in cifs_setup_session()
3964 ses->capabilities &= (~server->vals->cap_unix); in cifs_setup_session()
3970 rc = server->ops->sess_setup(xid, ses, nls_info); in cifs_setup_session()
3979 cifs_set_vol_auth(struct smb_vol *vol, struct cifs_ses *ses) in cifs_set_vol_auth() argument
3981 vol->sectype = ses->sectype; in cifs_set_vol_auth()
3987 return cifs_set_cifscreds(vol, ses); in cifs_set_vol_auth()
3995 struct cifs_ses *ses; in cifs_construct_tcon() local
4011 vol_info->sectype = master_tcon->ses->sectype; in cifs_construct_tcon()
4012 vol_info->sign = master_tcon->ses->sign; in cifs_construct_tcon()
4014 rc = cifs_set_vol_auth(vol_info, master_tcon->ses); in cifs_construct_tcon()
4022 ++master_tcon->ses->server->srv_count; in cifs_construct_tcon()
4025 ses = cifs_get_smb_ses(master_tcon->ses->server, vol_info); in cifs_construct_tcon()
4026 if (IS_ERR(ses)) { in cifs_construct_tcon()
4027 tcon = (struct cifs_tcon *)ses; in cifs_construct_tcon()
4028 cifs_put_tcp_session(master_tcon->ses->server); in cifs_construct_tcon()
4032 tcon = cifs_get_tcon(ses, vol_info); in cifs_construct_tcon()
4034 cifs_put_smb_ses(ses); in cifs_construct_tcon()
4038 if (cap_unix(ses)) in cifs_construct_tcon()