Skip to content

Commit 92325ea

Browse files
committed
Fix most-bogus ap_server_root_relative() cases. These don't include the cases where we are trying to ap_server_root_relative() a pipe cmd! git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90561 13f79535-47bb-0310-9956-ffa450edef68
1 parent 17a8e44 commit 92325ea

2 files changed

Lines changed: 27 additions & 28 deletions

File tree

modules/ssl/ssl_engine_config.c

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ const char *ssl_cmd_SSLPassPhraseDialog(
338338
}
339339
else if (strlen(arg) > 5 && strEQn(arg, "exec:", 5)) {
340340
sc->nPassPhraseDialogType = SSL_PPTYPE_FILTER;
341+
/* XXX This is broken, exec: may contain args! */
341342
sc->szPassPhraseDialogPath = (char *)ap_server_root_relative(cmd->pool, arg+5);
342343
if (!ssl_util_path_check(SSL_PCM_EXISTS, sc->szPassPhraseDialogPath, cmd->pool))
343344
return ((const char *)apr_pstrcat(cmd->pool, "SSLPassPhraseDialog: file '",
@@ -402,16 +403,16 @@ const char *ssl_cmd_SSLRandomSeed(
402403
"invalid context: `", arg1, "'");
403404
if (strlen(arg2) > 5 && strEQn(arg2, "file:", 5)) {
404405
pRS->nSrc = SSL_RSSRC_FILE;
405-
pRS->cpPath = apr_pstrdup(mc->pPool, ap_server_root_relative(cmd->pool, arg2+5));
406+
pRS->cpPath = ap_server_root_relative(mc->pPool, arg2+5);
406407
}
407408
else if (strlen(arg2) > 5 && strEQn(arg2, "exec:", 5)) {
408409
pRS->nSrc = SSL_RSSRC_EXEC;
409-
pRS->cpPath = apr_pstrdup(mc->pPool, ap_server_root_relative(cmd->pool, arg2+5));
410+
pRS->cpPath = ap_server_root_relative(mc->pPool, arg2+5);
410411
}
411412
#if SSL_LIBRARY_VERSION >= 0x00905100
412413
else if (strlen(arg2) > 4 && strEQn(arg2, "egd:", 4)) {
413414
pRS->nSrc = SSL_RSSRC_EGD;
414-
pRS->cpPath = apr_pstrdup(mc->pPool, ap_server_root_relative(cmd->pool, arg2+4));
415+
pRS->cpPath = ap_server_root_relative(mc->pPool, arg2+4);
415416
}
416417
#endif
417418
else if (strcEQ(arg2, "builtin")) {
@@ -420,7 +421,7 @@ const char *ssl_cmd_SSLRandomSeed(
420421
}
421422
else {
422423
pRS->nSrc = SSL_RSSRC_FILE;
423-
pRS->cpPath = apr_pstrdup(mc->pPool, ap_server_root_relative(cmd->pool, arg2));
424+
pRS->cpPath = ap_server_root_relative(mc->pPool, arg2);
424425
}
425426
if (pRS->nSrc != SSL_RSSRC_BUILTIN)
426427
if (!ssl_util_path_check(SSL_PCM_EXISTS, pRS->cpPath, cmd->pool))
@@ -465,10 +466,10 @@ const char *ssl_cmd_SSLCertificateFile(
465466
cmd_parms *cmd, void *ctx, const char *arg)
466467
{
467468
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
468-
char *cpPath;
469+
const char *cpPath;
469470
int i;
470471

471-
cpPath = (char *)ap_server_root_relative(cmd->pool, arg);
472+
cpPath = ap_server_root_relative(cmd->pool, arg);
472473
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath, cmd->pool))
473474
return apr_pstrcat(cmd->pool, "SSLCertificateFile: file '",
474475
cpPath, "' not exists or empty", NULL);
@@ -486,10 +487,10 @@ const char *ssl_cmd_SSLCertificateKeyFile(
486487
cmd_parms *cmd, void *ctx, const char *arg)
487488
{
488489
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
489-
char *cpPath;
490+
const char *cpPath;
490491
int i;
491492

492-
cpPath = (char *)ap_server_root_relative(cmd->pool, arg);
493+
cpPath = ap_server_root_relative(cmd->pool, arg);
493494
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath, cmd->pool))
494495
return apr_pstrcat(cmd->pool, "SSLCertificateKeyFile: file '",
495496
cpPath, "' not exists or empty", NULL);
@@ -508,9 +509,9 @@ const char *ssl_cmd_SSLCertificateChainFile(
508509
cmd_parms *cmd, void *ctx, const char *arg)
509510
{
510511
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
511-
char *cpPath;
512+
const char *cpPath;
512513

513-
cpPath = (char *)ap_server_root_relative(cmd->pool, arg);
514+
cpPath = ap_server_root_relative(cmd->pool, arg);
514515
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath, cmd->pool))
515516
return apr_pstrcat(cmd->pool, "SSLCertificateChainFile: file '",
516517
cpPath, "' not exists or empty", NULL);
@@ -525,9 +526,9 @@ const char *ssl_cmd_SSLCACertificatePath(
525526
SSLDirConfigRec *dc = (SSLDirConfigRec *)ctx;
526527
#endif
527528
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
528-
char *cpPath;
529+
const char *cpPath;
529530

530-
cpPath = (char *)ap_server_root_relative(cmd->pool, arg);
531+
cpPath = ap_server_root_relative(cmd->pool, arg);
531532
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISDIR, cpPath, cmd->pool))
532533
return apr_pstrcat(cmd->pool, "SSLCACertificatePath: directory '",
533534
cpPath, "' not exists", NULL);
@@ -549,9 +550,9 @@ const char *ssl_cmd_SSLCACertificateFile(
549550
SSLDirConfigRec *dc = (SSLDirConfigRec *)ctx;
550551
#endif
551552
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
552-
char *cpPath;
553+
const char *cpPath;
553554

554-
cpPath = (char *)ap_server_root_relative(cmd->pool, arg);
555+
cpPath = ap_server_root_relative(cmd->pool, arg);
555556
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath, cmd->pool))
556557
return apr_pstrcat(cmd->pool, "SSLCACertificateFile: file '",
557558
cpPath, "' not exists or empty", NULL);
@@ -570,9 +571,9 @@ const char *ssl_cmd_SSLCARevocationPath(
570571
cmd_parms *cmd, void *ctx, const char *arg)
571572
{
572573
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
573-
char *cpPath;
574+
const char *cpPath;
574575

575-
cpPath = (char *)ap_server_root_relative(cmd->pool, arg);
576+
cpPath = ap_server_root_relative(cmd->pool, arg);
576577
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISDIR, cpPath, cmd->pool))
577578
return apr_pstrcat(cmd->pool, "SSLCARecocationPath: directory '",
578579
cpPath, "' not exists", NULL);
@@ -584,9 +585,9 @@ const char *ssl_cmd_SSLCARevocationFile(
584585
cmd_parms *cmd, void *ctx, const char *arg)
585586
{
586587
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
587-
char *cpPath;
588+
const char *cpPath;
588589

589-
cpPath = (char *)ap_server_root_relative(cmd->pool, arg);
590+
cpPath = ap_server_root_relative(cmd->pool, arg);
590591
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath, cmd->pool))
591592
return apr_pstrcat(cmd->pool, "SSLCARevocationFile: file '",
592593
cpPath, "' not exists or empty", NULL);
@@ -654,8 +655,7 @@ const char *ssl_cmd_SSLSessionCache(
654655
}
655656
else if (strlen(arg) > 4 && strcEQn(arg, "dbm:", 4)) {
656657
mc->nSessionCacheMode = SSL_SCMODE_DBM;
657-
mc->szSessionCacheDataFile = apr_pstrdup(mc->pPool,
658-
ap_server_root_relative(cmd->pool, arg+4));
658+
mc->szSessionCacheDataFile = ap_server_root_relative(mc->pPool, arg+4);
659659
}
660660
else if ( (strlen(arg) > 4 && strcEQn(arg, "shm:", 4))
661661
|| (strlen(arg) > 6 && strcEQn(arg, "shmht:", 6))) {
@@ -665,8 +665,7 @@ const char *ssl_cmd_SSLSessionCache(
665665
#endif
666666
mc->nSessionCacheMode = SSL_SCMODE_SHMHT;
667667
colon = ap_strchr_c(arg, ':');
668-
mc->szSessionCacheDataFile = (char *)apr_pstrdup(mc->pPool,
669-
ap_server_root_relative(cmd->pool, colon+1));
668+
mc->szSessionCacheDataFile = ap_server_root_relative(mc->pPool, colon+1);
670669
mc->tSessionCacheDataTable = NULL;
671670
mc->nSessionCacheDataSize = 1024*512; /* 512KB */
672671
if ((cp = strchr(mc->szSessionCacheDataFile, '(')) != NULL) {
@@ -693,8 +692,7 @@ const char *ssl_cmd_SSLSessionCache(
693692
return "SSLSessionCache: shared memory cache not useable on this platform";
694693
#endif
695694
mc->nSessionCacheMode = SSL_SCMODE_SHMCB;
696-
mc->szSessionCacheDataFile = apr_pstrdup(mc->pPool,
697-
ap_server_root_relative(cmd->pool, arg+6));
695+
mc->szSessionCacheDataFile = ap_server_root_relative(mc->pPool, arg+6);
698696
mc->tSessionCacheDataTable = NULL;
699697
mc->nSessionCacheDataSize = 1024*512; /* 512KB */
700698
if ((cp = strchr(mc->szSessionCacheDataFile, '(')) != NULL) {
@@ -965,7 +963,7 @@ const char *ssl_cmd_SSLProxyCACertificateFile(
965963
cmd_parms *cmd, char *struct_ptr, char *arg)
966964
{
967965
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
968-
char *cpPath;
966+
const char *cpPath;
969967

970968
cpPath = ap_server_root_relative(cmd->pool, arg);
971969
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath, cmd->pool))
@@ -979,7 +977,7 @@ const char *ssl_cmd_SSLProxyCACertificatePath(
979977
cmd_parms *cmd, char *struct_ptr, char *arg)
980978
{
981979
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
982-
char *cpPath;
980+
const char *cpPath;
983981

984982
cpPath = ap_server_root_relative(cmd->pool, arg);
985983
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISDIR, cpPath, cmd->pool))
@@ -993,7 +991,7 @@ const char *ssl_cmd_SSLProxyMachineCertificateFile(
993991
cmd_parms *cmd, char *struct_ptr, char *arg)
994992
{
995993
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
996-
char *cpPath;
994+
const char *cpPath;
997995

998996
cpPath = ap_server_root_relative(cmd->pool, arg);
999997
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISREG|SSL_PCM_ISNONZERO, cpPath, cmd->pool))
@@ -1007,7 +1005,7 @@ const char *ssl_cmd_SSLProxyMachineCertificatePath(
10071005
cmd_parms *cmd, char *struct_ptr, char *arg)
10081006
{
10091007
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
1010-
char *cpPath;
1008+
const char *cpPath;
10111009

10121010
cpPath = ap_server_root_relative(cmd->pool, arg);
10131011
if (!ssl_util_path_check(SSL_PCM_EXISTS|SSL_PCM_ISDIR, cpPath, cmd->pool))

modules/ssl/ssl_engine_log.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ void ssl_log_open(server_rec *s_main, server_rec *s, apr_pool_t *p)
9595
if (strEQ(sc->szLogFile, "/dev/null"))
9696
return;
9797
else if (sc->szLogFile[0] == '|') {
98+
/* XXX:This is broken, may have arguments! */
9899
szLogFile = ap_server_root_relative(p, sc->szLogFile+1);
99100
if ((pl = ap_open_piped_log(p, szLogFile)) == NULL) {
100101
ssl_log(s, SSL_LOG_ERROR|SSL_ADD_ERRNO,

0 commit comments

Comments
 (0)