|
17 | 17 | #include"modsecurity.h" |
18 | 18 | #include"msc_logging.h" |
19 | 19 | #include"msc_util.h" |
20 | | -#include"pdf_protect.h" |
21 | 20 | #include"http_log.h" |
22 | 21 | #include"apr_lib.h" |
23 | 22 | #include"acmp.h" |
@@ -113,14 +112,6 @@ void *create_directory_config(apr_pool_t *mp, char *path) |
113 | 112 | dcfg->stream_inbody_inspection=NOT_SET; |
114 | 113 | dcfg->stream_outbody_inspection=NOT_SET; |
115 | 114 |
|
116 | | -/* PDF XSS protection. */ |
117 | | -dcfg->pdfp_enabled=NOT_SET; |
118 | | -dcfg->pdfp_secret=NOT_SET_P; |
119 | | -dcfg->pdfp_timeout=NOT_SET; |
120 | | -dcfg->pdfp_token_name=NOT_SET_P; |
121 | | -dcfg->pdfp_only_get=NOT_SET; |
122 | | -dcfg->pdfp_method=NOT_SET; |
123 | | - |
124 | 115 | /* Geo Lookups */ |
125 | 116 | dcfg->geo=NOT_SET_P; |
126 | 117 |
|
@@ -532,20 +523,6 @@ void *merge_directory_configs(apr_pool_t *mp, void *_parent, void *_child) |
532 | 523 | merged->stream_outbody_inspection= (child->stream_outbody_inspection==NOT_SET |
533 | 524 | ?parent->stream_outbody_inspection :child->stream_outbody_inspection); |
534 | 525 |
|
535 | | -/* PDF XSS protection. */ |
536 | | -merged->pdfp_enabled= (child->pdfp_enabled==NOT_SET |
537 | | - ?parent->pdfp_enabled :child->pdfp_enabled); |
538 | | -merged->pdfp_secret= (child->pdfp_secret==NOT_SET_P |
539 | | - ?parent->pdfp_secret :child->pdfp_secret); |
540 | | -merged->pdfp_timeout= (child->pdfp_timeout==NOT_SET |
541 | | - ?parent->pdfp_timeout :child->pdfp_timeout); |
542 | | -merged->pdfp_token_name= (child->pdfp_token_name==NOT_SET_P |
543 | | - ?parent->pdfp_token_name :child->pdfp_token_name); |
544 | | -merged->pdfp_only_get= (child->pdfp_only_get==NOT_SET |
545 | | - ?parent->pdfp_only_get :child->pdfp_only_get); |
546 | | -merged->pdfp_method= (child->pdfp_method==NOT_SET |
547 | | - ?parent->pdfp_method :child->pdfp_method); |
548 | | - |
549 | 526 | /* Geo Lookup */ |
550 | 527 | merged->geo= (child->geo==NOT_SET_P |
551 | 528 | ?parent->geo :child->geo); |
@@ -701,14 +678,6 @@ void init_directory_config(directory_config *dcfg) |
701 | 678 | if (dcfg->stream_inbody_inspection==NOT_SET)dcfg->stream_inbody_inspection=0; |
702 | 679 | if (dcfg->stream_outbody_inspection==NOT_SET)dcfg->stream_outbody_inspection=0; |
703 | 680 |
|
704 | | -/* PDF XSS protection. */ |
705 | | -if (dcfg->pdfp_enabled==NOT_SET)dcfg->pdfp_enabled=0; |
706 | | -if (dcfg->pdfp_secret==NOT_SET_P)dcfg->pdfp_secret=NULL; |
707 | | -if (dcfg->pdfp_timeout==NOT_SET)dcfg->pdfp_timeout=10; |
708 | | -if (dcfg->pdfp_token_name==NOT_SET_P)dcfg->pdfp_token_name="PDFPTOKEN"; |
709 | | -if (dcfg->pdfp_only_get==NOT_SET)dcfg->pdfp_only_get=1; |
710 | | -if (dcfg->pdfp_method==NOT_SET)dcfg->pdfp_method=PDF_PROTECT_METHOD_TOKEN_REDIRECTION; |
711 | | - |
712 | 681 | /* Geo Lookup */ |
713 | 682 | if (dcfg->geo==NOT_SET_P)dcfg->geo=NULL; |
714 | 683 |
|
@@ -2843,6 +2812,7 @@ static const char *cmd_cache_transformations(cmd_parms *cmd, void *_dcfg, |
2843 | 2812 | if (intval<0) { |
2844 | 2813 | returnapr_psprintf(cmd->pool,"ModSecurity: SecCacheTransformations maxlen must be positive: %s",charval); |
2845 | 2814 | } |
| 2815 | + |
2846 | 2816 | /* The NOT_SET indicator is -1, a signed long, and therfore |
2847 | 2817 | * we cannot be >= the unsigned value of NOT_SET. |
2848 | 2818 | */ |
@@ -2874,26 +2844,6 @@ static const char *cmd_cache_transformations(cmd_parms *cmd, void *_dcfg, |
2874 | 2844 | } |
2875 | 2845 |
|
2876 | 2846 |
|
2877 | | -staticconstchar*cmd_pdf_protect_method(cmd_parms*cmd,void*_dcfg, |
2878 | | -constchar*p1) |
2879 | | -{ |
2880 | | -directory_config*dcfg= (directory_config*)_dcfg; |
2881 | | -if (dcfg==NULL)returnNULL; |
2882 | | - |
2883 | | -if (strcasecmp(p1,"TokenRedirection")==0) { |
2884 | | -dcfg->pdfp_method=PDF_PROTECT_METHOD_TOKEN_REDIRECTION; |
2885 | | - }else |
2886 | | -if (strcasecmp(p1,"ForcedDownload")==0) { |
2887 | | -dcfg->pdfp_method=PDF_PROTECT_METHOD_FORCED_DOWNLOAD; |
2888 | | - }else { |
2889 | | -return (constchar*)apr_psprintf(cmd->pool, |
2890 | | -"ModSecurity: Unrecognised parameter value for SecPdfProtectMethod: %s",p1); |
2891 | | - } |
2892 | | - |
2893 | | -returnNULL; |
2894 | | -} |
2895 | | - |
2896 | | - |
2897 | 2847 | /* -- Configuration directives definitions -- */ |
2898 | 2848 |
|
2899 | 2849 | #defineCMD_SCOPE_MAIN (RSRC_CONF) |
@@ -3570,14 +3520,6 @@ const command_rec module_directives[] = { |
3570 | 3520 | "Set Hash key" |
3571 | 3521 | ), |
3572 | 3522 |
|
3573 | | -AP_INIT_TAKE1 ( |
3574 | | -"SecPdfProtectMethod", |
3575 | | -cmd_pdf_protect_method, |
3576 | | -NULL, |
3577 | | -RSRC_CONF, |
3578 | | -"protection method to use. Can be 'TokenRedirection' (default) or 'ForcedDownload'" |
3579 | | - ), |
3580 | | - |
3581 | 3523 | AP_INIT_TAKE1 ( |
3582 | 3524 | "SecHashParam", |
3583 | 3525 | cmd_hash_param, |
|