| 1240 | } |
| 1241 | |
| 1242 | const char *ssl_cmd_SSLSessionCache(cmd_parms *cmd, |
| 1243 | void *dcfg, |
| 1244 | const char *arg) |
| 1245 | { |
| 1246 | SSLModConfigRec *mc = myModConfig(cmd->server); |
| 1247 | const char *err, *sep, *name; |
| 1248 | long enabled_flags; |
| 1249 | |
| 1250 | if ((err = ap_check_cmd_context(cmd, GLOBAL_ONLY))) { |
| 1251 | return err; |
| 1252 | } |
| 1253 | |
| 1254 | /* The OpenSSL session cache mode must have both the flags |
| 1255 | * SSL_SESS_CACHE_SERVER and SSL_SESS_CACHE_NO_INTERNAL set if a |
| 1256 | * session cache is configured; NO_INTERNAL prevents the |
| 1257 | * OpenSSL-internal session cache being used in addition to the |
| 1258 | * "external" (mod_ssl-provided) cache, which otherwise causes |
| 1259 | * additional memory consumption. */ |
| 1260 | enabled_flags = SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_INTERNAL; |
| 1261 | |
| 1262 | if (strcEQ(arg, "none")) { |
| 1263 | /* Nothing to do; session cache will be off. */ |
| 1264 | } |
| 1265 | else if (strcEQ(arg, "nonenotnull")) { |
| 1266 | /* ### Having a separate mode for this seems logically |
| 1267 | * unnecessary; the stated purpose of sending non-empty |
| 1268 | * session IDs would be better fixed in OpenSSL or simply |
| 1269 | * doing it by default if "none" is used. */ |
| 1270 | mc->sesscache_mode = enabled_flags; |
| 1271 | } |
| 1272 | else { |
| 1273 | /* Argument is of form 'name:args' or just 'name'. */ |
| 1274 | sep = ap_strchr_c(arg, ':'); |
| 1275 | if (sep) { |
| 1276 | name = apr_pstrmemdup(cmd->pool, arg, sep - arg); |
| 1277 | sep++; |
| 1278 | } |
| 1279 | else { |
| 1280 | name = arg; |
| 1281 | } |
| 1282 | |
| 1283 | /* Find the provider of given name. */ |
| 1284 | mc->sesscache = ap_lookup_provider(AP_SOCACHE_PROVIDER_GROUP, |
| 1285 | name, |
| 1286 | AP_SOCACHE_PROVIDER_VERSION); |
| 1287 | if (mc->sesscache) { |
| 1288 | /* Cache found; create it, passing anything beyond the colon. */ |
| 1289 | mc->sesscache_mode = enabled_flags; |
| 1290 | err = mc->sesscache->create(&mc->sesscache_context, sep, |
| 1291 | cmd->temp_pool, cmd->pool); |
| 1292 | } |
| 1293 | else { |
| 1294 | apr_array_header_t *name_list; |
| 1295 | const char *all_names; |
| 1296 | |
| 1297 | /* Build a comma-separated list of all registered provider |
| 1298 | * names: */ |
| 1299 | name_list = ap_list_provider_names(cmd->pool, |
nothing calls this directly
no test coverage detected