use more reasonable names to open and close a session

This commit is contained in:
Nikos Mavrogiannopoulos
2014-09-25 16:39:58 +02:00
parent 4674508188
commit 1cb35b8b09
6 changed files with 21 additions and 7 deletions

View File

@@ -281,7 +281,7 @@ struct cookie_entry_st *old;
memcpy(proc->ipv4_seed, &cmsg->ipv4_seed, sizeof(proc->ipv4_seed));
ret = session_openclose(s, proc, 1);
ret = session_open(s, proc);
if (ret < 0) {
mslog(s, proc, LOG_INFO, "could not open session");
return -1;

View File

@@ -161,7 +161,8 @@ struct proc_st *ctmp;
return ctmp;
}
int session_openclose(main_server_st * s, struct proc_st *proc, unsigned open)
static
int session_cmd(main_server_st * s, struct proc_st *proc, unsigned open)
{
int sd, ret, e;
SecAuthSessionMsg ireq = SEC_AUTH_SESSION_MSG__INIT;
@@ -232,6 +233,16 @@ int session_openclose(main_server_st * s, struct proc_st *proc, unsigned open)
return 0;
}
int session_open(main_server_st * s, struct proc_st *proc)
{
return session_cmd(s, proc, 1);
}
int session_close(main_server_st * s, struct proc_st *proc)
{
return session_cmd(s, proc, 0);
}
/* k: whether to kill the process
*/
void remove_proc(main_server_st * s, struct proc_st *proc, unsigned k)
@@ -250,7 +261,7 @@ void remove_proc(main_server_st * s, struct proc_st *proc, unsigned k)
/* close any pending sessions */
if (s->config->session_control != 0 && proc->active_sid) {
session_openclose(s, proc, 0);
session_close(s, proc);
}
/* close the intercomm fd */

View File

@@ -236,7 +236,8 @@ int handle_resume_fetch_req(main_server_st* s, struct proc_st * proc,
int handle_resume_store_req(main_server_st* s, struct proc_st *proc,
const SessionResumeStoreReqMsg *);
int session_openclose(main_server_st * s, struct proc_st *proc, unsigned open);
int session_open(main_server_st * s, struct proc_st *proc);
int session_close(main_server_st * s, struct proc_st *proc);
void
__attribute__ ((format(printf, 4, 5)))

View File

@@ -312,7 +312,9 @@ int handle_sec_auth_res(sec_mod_st * sec, client_entry_st * e, int result)
return ret;
}
int handle_sec_auth_session_openclose(sec_mod_st * sec, const SecAuthSessionMsg * req, unsigned cmd)
/* opens or closes a session.
*/
int handle_sec_auth_session_cmd(sec_mod_st * sec, const SecAuthSessionMsg * req, unsigned cmd)
{
client_entry_st *e;
int ret;

View File

@@ -296,7 +296,7 @@ int process_packet(void *pool, sec_mod_st * sec, cmd_request_t cmd,
return -1;
}
ret = handle_sec_auth_session_openclose(sec, msg, cmd);
ret = handle_sec_auth_session_cmd(sec, msg, cmd);
sec_auth_session_msg__free_unpacked(msg, &pa);
if (cmd == SM_CMD_AUTH_SESSION_OPEN) {

View File

@@ -81,7 +81,7 @@ void sec_auth_init(struct cfg_st *config);
int handle_sec_auth_init(sec_mod_st *sec, const SecAuthInitMsg * req);
int handle_sec_auth_cont(sec_mod_st *sec, const SecAuthContMsg * req);
int handle_sec_auth_session_openclose(sec_mod_st * sec, const SecAuthSessionMsg * req, unsigned cmd);
int handle_sec_auth_session_cmd(sec_mod_st * sec, const SecAuthSessionMsg * req, unsigned cmd);
void sec_auth_user_deinit(client_entry_st * e);
void sec_mod_server(void *main_pool, struct cfg_st *config, const char *socket_file,