Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* mc_api.c
*
* Created on: 15 Mar 2018
* Author: development
*
* This is the implementation of the module API that allows
* other modules to call functions that set the active context
* that will be used for writing data. This is done using the
* Apache Portable Runtime optional functions mechanism as this
* module is optional. Therefore, should another module be written
* that uses these functions, it will safely handle the case that
* they are not loaded.
*
*/
/*for optional functions, use
APR_DECLARE_OPTIONAL_FN
APR_RETRIEVE_OPTIONAL_FN
APR_REGISTER_OPTIONAL_FN
*/
#include "ssl_multicontext.h"
#include "ssl_mc_private.h"
int
MC_SetActiveContextByName(
conn_rec *pt_Conn,
const char *cps_ContextName,
CONTEXT_ID *puc_PreviousContext)
{
int status;
CONTEXT_ID uc_NewContext;
SSLConnRec *pt_SslConn = myConnConfig(pt_Conn);
SSL *pt_Ssl=pt_SslConn->ssl;
if(mctls_IsMultiContext(pt_Ssl)) {
status=mctls_GetContextIdByName(pt_Ssl,cps_ContextName,&uc_NewContext);
if(status==0) {
status=mctls_SetActiveContext(pt_Ssl, uc_NewContext, puc_PreviousContext);
}
} else {
status = MODSSL_MC_NOTMULTICONTEXT;
}
return status;
}
int
MC_SetActiveContextByID(
conn_rec *pt_Conn,
CONTEXT_ID uc_NewContext,
CONTEXT_ID *puc_PreviousContext)
{
int status;
SSLConnRec *pt_SslConn = myConnConfig(pt_Conn);
SSL *pt_Ssl=pt_SslConn->ssl;
if(mctls_IsMultiContext(pt_Ssl)) {
status=mctls_SetActiveContext(pt_Ssl, uc_NewContext, puc_PreviousContext);
} else {
status = MODSSL_MC_NOTMULTICONTEXT;
}
return status;
}