Lines Matching refs:ses

305 	struct cifs_ses *ses;  in cifs_reconnect()  local
332 ses = list_entry(tmp, struct cifs_ses, smb_ses_list); in cifs_reconnect()
333 ses->need_reconnect = true; in cifs_reconnect()
334 ses->ipc_tid = 0; in cifs_reconnect()
335 list_for_each(tmp2, &ses->tcon_list) { in cifs_reconnect()
2216 static int match_session(struct cifs_ses *ses, struct smb_vol *vol) in match_session() argument
2219 vol->sectype != ses->sectype) in match_session()
2222 switch (ses->sectype) { in match_session()
2224 if (!uid_eq(vol->cred_uid, ses->cred_uid)) in match_session()
2229 if (ses->user_name == NULL) { in match_session()
2236 if (strncmp(ses->user_name, in match_session()
2241 ses->password != NULL && in match_session()
2242 strncmp(ses->password, in match_session()
2253 struct cifs_ses *ses; in cifs_find_smb_ses() local
2256 list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { in cifs_find_smb_ses()
2257 if (ses->status == CifsExiting) in cifs_find_smb_ses()
2259 if (!match_session(ses, vol)) in cifs_find_smb_ses()
2261 ++ses->ses_count; in cifs_find_smb_ses()
2263 return ses; in cifs_find_smb_ses()
2270 cifs_put_smb_ses(struct cifs_ses *ses) in cifs_put_smb_ses() argument
2273 struct TCP_Server_Info *server = ses->server; in cifs_put_smb_ses()
2275 cifs_dbg(FYI, "%s: ses_count=%d\n", __func__, ses->ses_count); in cifs_put_smb_ses()
2278 if (ses->status == CifsExiting) { in cifs_put_smb_ses()
2282 if (--ses->ses_count > 0) { in cifs_put_smb_ses()
2286 if (ses->status == CifsGood) in cifs_put_smb_ses()
2287 ses->status = CifsExiting; in cifs_put_smb_ses()
2290 if (ses->status == CifsExiting && server->ops->logoff) { in cifs_put_smb_ses()
2292 rc = server->ops->logoff(xid, ses); in cifs_put_smb_ses()
2300 list_del_init(&ses->smb_ses_list); in cifs_put_smb_ses()
2303 sesInfoFree(ses); in cifs_put_smb_ses()
2314 cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses) in cifs_set_cifscreds() argument
2320 struct TCP_Server_Info *server = ses->server; in cifs_set_cifscreds()
2349 if (!ses->domainName) { in cifs_set_cifscreds()
2356 sprintf(desc, "cifs:d:%s", ses->domainName); in cifs_set_cifscreds()
2431 struct cifs_ses *ses __attribute__((unused))) in cifs_set_cifscreds() argument
2442 struct cifs_ses *ses; in cifs_get_smb_ses() local
2448 ses = cifs_find_smb_ses(server, volume_info); in cifs_get_smb_ses()
2449 if (ses) { in cifs_get_smb_ses()
2451 ses->status); in cifs_get_smb_ses()
2453 mutex_lock(&ses->session_mutex); in cifs_get_smb_ses()
2454 rc = cifs_negotiate_protocol(xid, ses); in cifs_get_smb_ses()
2456 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2458 cifs_put_smb_ses(ses); in cifs_get_smb_ses()
2462 if (ses->need_reconnect) { in cifs_get_smb_ses()
2464 rc = cifs_setup_session(xid, ses, in cifs_get_smb_ses()
2467 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2469 cifs_put_smb_ses(ses); in cifs_get_smb_ses()
2474 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2479 return ses; in cifs_get_smb_ses()
2483 ses = sesInfoAlloc(); in cifs_get_smb_ses()
2484 if (ses == NULL) in cifs_get_smb_ses()
2488 ses->server = server; in cifs_get_smb_ses()
2490 sprintf(ses->serverName, "%pI6", &addr6->sin6_addr); in cifs_get_smb_ses()
2492 sprintf(ses->serverName, "%pI4", &addr->sin_addr); in cifs_get_smb_ses()
2495 ses->user_name = kstrdup(volume_info->username, GFP_KERNEL); in cifs_get_smb_ses()
2496 if (!ses->user_name) in cifs_get_smb_ses()
2502 ses->password = kstrdup(volume_info->password, GFP_KERNEL); in cifs_get_smb_ses()
2503 if (!ses->password) in cifs_get_smb_ses()
2507 ses->domainName = kstrdup(volume_info->domainname, GFP_KERNEL); in cifs_get_smb_ses()
2508 if (!ses->domainName) in cifs_get_smb_ses()
2511 ses->cred_uid = volume_info->cred_uid; in cifs_get_smb_ses()
2512 ses->linux_uid = volume_info->linux_uid; in cifs_get_smb_ses()
2514 ses->sectype = volume_info->sectype; in cifs_get_smb_ses()
2515 ses->sign = volume_info->sign; in cifs_get_smb_ses()
2517 mutex_lock(&ses->session_mutex); in cifs_get_smb_ses()
2518 rc = cifs_negotiate_protocol(xid, ses); in cifs_get_smb_ses()
2520 rc = cifs_setup_session(xid, ses, volume_info->local_nls); in cifs_get_smb_ses()
2521 mutex_unlock(&ses->session_mutex); in cifs_get_smb_ses()
2527 list_add(&ses->smb_ses_list, &server->smb_ses_list); in cifs_get_smb_ses()
2531 return ses; in cifs_get_smb_ses()
2534 sesInfoFree(ses); in cifs_get_smb_ses()
2549 cifs_find_tcon(struct cifs_ses *ses, const char *unc) in cifs_find_tcon() argument
2555 list_for_each(tmp, &ses->tcon_list) { in cifs_find_tcon()
2571 struct cifs_ses *ses = tcon->ses; in cifs_put_tcon() local
2584 if (ses->server->ops->tree_disconnect) in cifs_put_tcon()
2585 ses->server->ops->tree_disconnect(xid, tcon); in cifs_put_tcon()
2590 cifs_put_smb_ses(ses); in cifs_put_tcon()
2594 cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) in cifs_get_tcon() argument
2599 tcon = cifs_find_tcon(ses, volume_info->UNC); in cifs_get_tcon()
2603 cifs_put_smb_ses(ses); in cifs_get_tcon()
2609 if (!ses->server->ops->tree_connect) { in cifs_get_tcon()
2620 tcon->ses = ses; in cifs_get_tcon()
2634 rc = ses->server->ops->tree_connect(xid, ses, volume_info->UNC, tcon, in cifs_get_tcon()
2657 list_add(&tcon->tcon_list, &ses->tcon_list); in cifs_get_tcon()
2739 struct cifs_ses *ses; in cifs_match_super() local
2752 ses = tcon->ses; in cifs_match_super()
2753 tcp_srv = ses->server; in cifs_match_super()
2758 !match_session(ses, volume_info) || in cifs_match_super()
2772 get_dfs_path(const unsigned int xid, struct cifs_ses *ses, const char *old_path, in get_dfs_path() argument
2779 if (!ses->server->ops->tree_connect || !ses->server->ops->get_dfs_refer) in get_dfs_path()
2785 if (ses->ipc_tid == 0) { in get_dfs_path()
2787 strnlen(ses->serverName, SERVER_NAME_LEN_WITH_NULL * 2) in get_dfs_path()
2793 strcpy(temp_unc + 2, ses->serverName); in get_dfs_path()
2794 strcpy(temp_unc + 2 + strlen(ses->serverName), "\\IPC$"); in get_dfs_path()
2795 rc = ses->server->ops->tree_connect(xid, ses, temp_unc, NULL, in get_dfs_path()
2797 cifs_dbg(FYI, "Tcon rc = %d ipc_tid = %d\n", rc, ses->ipc_tid); in get_dfs_path()
2801 rc = ses->server->ops->get_dfs_refer(xid, ses, old_path, in get_dfs_path()
3334 expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses, in expand_dfs_referral() argument
3350 rc = get_dfs_path(xid, ses, ref_path, cifs_sb->local_nls, in expand_dfs_referral()
3442 struct cifs_ses *ses; in cifs_mount() local
3461 else if (ses) in cifs_mount()
3462 cifs_put_smb_ses(ses); in cifs_mount()
3469 ses = NULL; in cifs_mount()
3485 ses = cifs_get_smb_ses(server, volume_info); in cifs_mount()
3486 if (IS_ERR(ses)) { in cifs_mount()
3487 rc = PTR_ERR(ses); in cifs_mount()
3488 ses = NULL; in cifs_mount()
3493 tcon = cifs_get_tcon(ses, volume_info); in cifs_mount()
3501 if (cap_unix(tcon->ses)) { in cifs_mount()
3505 if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) && in cifs_mount()
3534 int refrc = expand_dfs_referral(xid, ses, volume_info, cifs_sb, in cifs_mount()
3580 rc = expand_dfs_referral(xid, ses, volume_info, cifs_sb, true); in cifs_mount()
3602 tlink->tl_uid = ses->linux_uid; in cifs_mount()
3623 else if (ses) in cifs_mount()
3624 cifs_put_smb_ses(ses); in cifs_mount()
3640 CIFSTCon(const unsigned int xid, struct cifs_ses *ses, in CIFSTCon() argument
3653 if (ses == NULL) in CIFSTCon()
3665 smb_buffer->Mid = get_next_mid(ses->server); in CIFSTCon()
3666 smb_buffer->Uid = ses->Suid; in CIFSTCon()
3673 if (!tcon || (ses->server->sec_mode & SECMODE_USER)) { in CIFSTCon()
3688 (ses->sectype == LANMAN)) in CIFSTCon()
3689 calc_lanman_hash(tcon->password, ses->server->cryptkey, in CIFSTCon()
3690 ses->server->sec_mode & in CIFSTCon()
3695 rc = SMBNTencrypt(tcon->password, ses->server->cryptkey, in CIFSTCon()
3705 if (ses->capabilities & CAP_UNICODE) { in CIFSTCon()
3712 if (ses->server->sign) in CIFSTCon()
3715 if (ses->capabilities & CAP_STATUS32) { in CIFSTCon()
3718 if (ses->capabilities & CAP_DFS) { in CIFSTCon()
3721 if (ses->capabilities & CAP_UNICODE) { in CIFSTCon()
3741 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, in CIFSTCon()
3794 ses->ipc_tid = smb_buffer_response->Tid; in CIFSTCon()
3836 cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses) in cifs_negotiate_protocol() argument
3839 struct TCP_Server_Info *server = ses->server; in cifs_negotiate_protocol()
3850 rc = server->ops->negotiate(xid, ses); in cifs_negotiate_protocol()
3864 cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, in cifs_setup_session() argument
3868 struct TCP_Server_Info *server = ses->server; in cifs_setup_session()
3870 ses->capabilities = server->capabilities; in cifs_setup_session()
3872 ses->capabilities &= (~server->vals->cap_unix); in cifs_setup_session()
3878 rc = server->ops->sess_setup(xid, ses, nls_info); in cifs_setup_session()
3887 cifs_set_vol_auth(struct smb_vol *vol, struct cifs_ses *ses) in cifs_set_vol_auth() argument
3889 vol->sectype = ses->sectype; in cifs_set_vol_auth()
3895 return cifs_set_cifscreds(vol, ses); in cifs_set_vol_auth()
3903 struct cifs_ses *ses; in cifs_construct_tcon() local
3919 vol_info->sectype = master_tcon->ses->sectype; in cifs_construct_tcon()
3920 vol_info->sign = master_tcon->ses->sign; in cifs_construct_tcon()
3922 rc = cifs_set_vol_auth(vol_info, master_tcon->ses); in cifs_construct_tcon()
3930 ++master_tcon->ses->server->srv_count; in cifs_construct_tcon()
3933 ses = cifs_get_smb_ses(master_tcon->ses->server, vol_info); in cifs_construct_tcon()
3934 if (IS_ERR(ses)) { in cifs_construct_tcon()
3935 tcon = (struct cifs_tcon *)ses; in cifs_construct_tcon()
3936 cifs_put_tcp_session(master_tcon->ses->server); in cifs_construct_tcon()
3940 tcon = cifs_get_tcon(ses, vol_info); in cifs_construct_tcon()
3942 cifs_put_smb_ses(ses); in cifs_construct_tcon()
3946 if (cap_unix(ses)) in cifs_construct_tcon()