expcov report - Generated Sat Oct 15 21:39:18 2016

 Index  Statistics  Last 
Directory./modules/mappers
Filenamemod_actions.c
ModifiedWed Jul 12 12:38:44 2006

Pass Half Fail Excluded Total
Function
2
33.33%
4
66.67%
0
0.00%
6
100%
Expressions
4
4.82%
79
95.18%
0
0.00%
83
100%
Conditions
0
0.00%
0
0.00%
19
100.00%
0
0.00%
19
100%
MC/DC
0
0.00%
9
100.00%
0
0.00%
9
100%
Branches

if
0
0.00%
0
0.00%
11
100.00%
0
0.00%
11
100%
for
0
0.00%
0
0.00%
2
100.00%
0
0.00%
2
100%
while
0
0.00%
0
0.00%
0
0.00%
0
0.00%
0
100%
case
0
0.00%
0
0.00%
0
0.00%
0
0.00%
0
100%

1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements.  See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License.  You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * mod_actions.c: executes scripts based on MIME type or HTTP method
19 *
20 * by Alexei Kosut; based on mod_cgi.c, mod_mime.c and mod_includes.c,
21 * adapted by rst from original NCSA code by Rob McCool
22 *
23 * Usage instructions:
24 *
25 * Action mime/type /cgi-bin/script
26 *
27 * will activate /cgi-bin/script when a file of content type mime/type is
28 * requested. It sends the URL and file path of the requested document using
29 * the standard CGI PATH_INFO and PATH_TRANSLATED environment variables.
30 *
31 * Script PUT /cgi-bin/script
32 *
33 * will activate /cgi-bin/script when a request is received with the
34 * HTTP method "PUT".  The available method names are defined in httpd.h.
35 * If the method is GET, the script will only be activated if the requested
36 * URI includes query information (stuff after a ?-mark).
37 */
38
39#include "apr_strings.h"
40#define APR_WANT_STRFUNC
41#include "apr_want.h"
42#include "ap_config.h"
43#include "httpd.h"
44#include "http_config.h"
45#include "http_request.h"
46#include "http_core.h"
47#include "http_protocol.h"
48#include "http_main.h"
49#include "http_log.h"
50#include "util_script.h"
51
52typedef struct {
53    apr_table_t *action_types;       /* Added with Action... */
54    const char *scripted[METHODS];   /* Added with Script... */
55    int configured;  /* True if Action or Script has been
56                      * called at least once
57                      */
58} action_dir_config;
59
60module AP_MODULE_DECLARE_DATA actions_module;
61
62static void *create_action_dir_config : call=1
c
reate_action_dir_config(apr_pool_t *p, char *dummy)
63{
64    action_dir_config *new =
65    (action_dir_config *) apr_pcalloc(p : modules/mappers/mod_actions.c line=62 column=51
p
, sizeof(action_dir_config));
66
67    new : modules/mappers/mod_actions.c line=64 column=24
n
ew-> : enter=1, leave=1
-
>action_types : modules/mappers/mod_actions.c line=53 column=18
a
ction_types = : enter=1, leave=1
=
 apr_table_make : enter=1, leave=1

apr_table_make : /usr/include/apr-1/apr_tables.h line=222 column=28
a
pr_table_make(p : modules/mappers/mod_actions.c line=62 column=51
p
, 4);
68
69    return : pass=1
r
eturn new : modules/mappers/mod_actions.c line=64 column=24
n
ew;
70}
71
72static void *merge_action_dir_configs : call=0
m
erge_action_dir_configs(apr_pool_t *p, void *basev, void *addv)
73{
74    action_dir_config *base = (action_dir_config *) basev : modules/mappers/mod_actions.c line=72 column=60
b
asev;
75    action_dir_config *add = (action_dir_config *) addv : modules/mappers/mod_actions.c line=72 column=73
a
ddv;
76    action_dir_config *new = (action_dir_config *) apr_palloc : enter=0, leave=0

apr_palloc : /usr/include/apr-1/apr_pools.h line=419 column=21
a
pr_palloc(p : modules/mappers/mod_actions.c line=72 column=51
p
,
77                                  sizeof(action_dir_config));
78    int i;
79
80    new : modules/mappers/mod_actions.c line=76 column=24
n
ew-> : enter=0, leave=0
-
>action_types : modules/mappers/mod_actions.c line=53 column=18
a
ction_types = : enter=0, leave=0
=
 apr_table_overlay : enter=0, leave=0

apr_table_overlay : /usr/include/apr-1/apr_tables.h line=346 column=28
a
pr_table_overlay(p : modules/mappers/mod_actions.c line=72 column=51
p
add : modules/mappers/mod_actions.c line=75 column=24
a
dd-> : enter=0, leave=0
-
>action_types : modules/mappers/mod_actions.c line=53 column=18
a
ction_types,
81                                       base : modules/mappers/mod_actions.c line=74 column=24
b
ase-> : enter=0, leave=0
-
>action_types : modules/mappers/mod_actions.c line=53 column=18
a
ction_types);
82
83    for : true=0, false=0
f
or (i : modules/mappers/mod_actions.c line=78 column=9
i
 = : pass=0
=
 0; i : modules/mappers/mod_actions.c line=78 column=9
i
 < : true=0, false=0
<
 METHODS; ++ : pass=0
+
+i : modules/mappers/mod_actions.c line=78 column=9
i
) {
84        new : modules/mappers/mod_actions.c line=76 column=24
n
ew-> : enter=0, leave=0
-
>scripted : modules/mappers/mod_actions.c line=54 column=17
s
cripted[i : modules/mappers/mod_actions.c line=78 column=9
i
= : enter=0, leave=0
=
 add : modules/mappers/mod_actions.c line=75 column=24
a
dd-> : enter=0, leave=0
-
>scripted : modules/mappers/mod_actions.c line=54 column=17
s
cripted[] : enter=0, leave=0
[
i : modules/mappers/mod_actions.c line=78 column=9
i
conditional operator : true=0, false=0
?
 add : modules/mappers/mod_actions.c line=75 column=24
a
dd-> : enter=0, leave=0
-
>scripted : modules/mappers/mod_actions.c line=54 column=17
s
cripted[] : enter=0, leave=0
[
i : modules/mappers/mod_actions.c line=78 column=9
i
]
85                                            : base : modules/mappers/mod_actions.c line=74 column=24
b
ase-> : enter=0, leave=0
-
>scripted : modules/mappers/mod_actions.c line=54 column=17
s
cripted[] : enter=0, leave=0
[
i : modules/mappers/mod_actions.c line=78 column=9
i
];
86    }
87
88    new : modules/mappers/mod_actions.c line=76 column=24
n
ew-> : enter=0, leave=0
-
>configured : modules/mappers/mod_actions.c line=55 column=9
c
onfigured = : enter=0, leave=0
=
 (base : modules/mappers/mod_actions.c line=74 column=24
b
aseMC/DC independently affect : true=0, false=0
-> : enter=0, leave=0
-TF
>configured : modules/mappers/mod_actions.c line=55 column=9
c
onfigured || : true=0, false=0
|
add : modules/mappers/mod_actions.c line=75 column=24
a
ddMC/DC independently affect : true=0, false=0
-> : enter=0, leave=0
-TF
>configured : modules/mappers/mod_actions.c line=55 column=9
c
onfigured);
89    return : pass=0
r
eturn new : modules/mappers/mod_actions.c line=76 column=24
n
ew;
90}
91
92static const char *add_action : call=0
a
dd_action(cmd_parms *cmd, void *m_v,
93                              const char *type, const char *script,
94                              const char *option)
95{
96    action_dir_config *m = (action_dir_config *)m_v : modules/mappers/mod_actions.c line=92 column=53
m
_v;
97
98    if : true=0, false=0
i
f (MC/DC independently affect : true=0, false=0

option : modules/mappers/mod_actions.c line=94 column=43
oTF
ption && : true=0, false=0
&
MC/DC independently affect : true=0, false=0
strcasecmp : enter=0, leave=0

strcasecmp : /usr/include/string.h line=536 column=12
sTF
trcasecmp(option : modules/mappers/mod_actions.c line=94 column=43
o
ption, "virtual")) {
99        return : pass=0
r
eturn apr_pstrcat : enter=0, leave=0

apr_pstrcat : /usr/include/apr-1/apr_strings.h line=139 column=28
a
pr_pstrcat(cmd : modules/mappers/mod_actions.c line=92 column=42
c
md-> : enter=0, leave=0
-
>pool : include/http_config.h line=291 column=17
p
ool,
100                           "unrecognized option '", option : modules/mappers/mod_actions.c line=94 column=43
o
ption, "'", NULL);
101    }
102
103    apr_table_setn : enter=0, leave=0

apr_table_setn : /usr/include/apr-1/apr_tables.h line=282 column=19
a
pr_table_setn(m : modules/mappers/mod_actions.c line=96 column=24
m
-> : enter=0, leave=0
-
>action_types : modules/mappers/mod_actions.c line=53 column=18
a
ction_types, type : modules/mappers/mod_actions.c line=93 column=43
t
ype,
104                   apr_pstrcat : enter=0, leave=0

apr_pstrcat : /usr/include/apr-1/apr_strings.h line=139 column=28
a
pr_pstrcat(cmd : modules/mappers/mod_actions.c line=92 column=42
c
md-> : enter=0, leave=0
-
>pool : include/http_config.h line=291 column=17
p
ool, option : modules/mappers/mod_actions.c line=94 column=43
o
ption conditional operator : true=0, false=0
?
 "1" : "0", script : modules/mappers/mod_actions.c line=93 column=61
s
cript, NULL));
105    m : modules/mappers/mod_actions.c line=96 column=24
m
-> : enter=0, leave=0
-
>configured : modules/mappers/mod_actions.c line=55 column=9
c
onfigured = : enter=0, leave=0
=
 1;
106
107    return : pass=0
r
eturn NULL;
108}
109
110static const char *set_script : call=0
s
et_script(cmd_parms *cmd, void *m_v,
111                              const char *method, const char *script)
112{
113    action_dir_config *m = (action_dir_config *)m_v : modules/mappers/mod_actions.c line=110 column=53
m
_v;
114
115    /* ap_method_register recognizes already registered methods,
116     * so don't bother to check its previous existence explicitely.
117     */
118    int methnum = ap_method_register : enter=0, leave=0

ap_method_register : include/http_protocol.h line=228 column=17
a
p_method_register(cmd : modules/mappers/mod_actions.c line=110 column=42
c
md-> : enter=0, leave=0
-
>pool : include/http_config.h line=291 column=17
p
ool, method : modules/mappers/mod_actions.c line=111 column=43
m
ethod);
119
120    if : true=0, false=0
i
f (methnum : modules/mappers/mod_actions.c line=118 column=9
m
ethnum == : true=0, false=0
=
= M_TRACE) {
121        return : pass=0
r
eturn "TRACE not allowed for Script";
122    }
123    else if : true=0, false=0
i
f (methnum : modules/mappers/mod_actions.c line=118 column=9
m
ethnum == : true=0, false=0
=
= M_INVALID) {
124        return : pass=0
r
eturn apr_pstrcat : enter=0, leave=0

apr_pstrcat : /usr/include/apr-1/apr_strings.h line=139 column=28
a
pr_pstrcat(cmd : modules/mappers/mod_actions.c line=110 column=42
c
md-> : enter=0, leave=0
-
>pool : include/http_config.h line=291 column=17
p
ool, "Could not register method '", method : modules/mappers/mod_actions.c line=111 column=43
m
ethod,
125                           "' for Script", NULL);
126    }
127
128    m : modules/mappers/mod_actions.c line=113 column=24
m
-> : enter=0, leave=0
-
>scripted : modules/mappers/mod_actions.c line=54 column=17
s
cripted[methnum : modules/mappers/mod_actions.c line=118 column=9
m
ethnum] = : enter=0, leave=0
=
 script : modules/mappers/mod_actions.c line=111 column=63
s
cript;
129    m : modules/mappers/mod_actions.c line=113 column=24
m
-> : enter=0, leave=0
-
>configured : modules/mappers/mod_actions.c line=55 column=9
c
onfigured = : enter=0, leave=0
=
 1;
130
131    return : pass=0
r
eturn NULL;
132}
133
134static const command_rec action_cmds[] =
135{
136    AP_INIT_TAKE23("Action", add_action : modules/mappers/mod_actions.c line=92 column=20
a
dd_action, NULL, OR_FILEINFO,
137                  "a media type followed by a script name"),
138    AP_INIT_TAKE2("Script", set_script : modules/mappers/mod_actions.c line=110 column=20
s
et_script, NULL, ACCESS_CONF | : pass=0
|
 RSRC_CONF,
139                  "a method followed by a script name"),
140    {NULL}
141};
142
143static int action_handler : call=0
a
ction_handler(request_rec *r)
144{
145    action_dir_config *conf = (action_dir_config *)
146        ap_get_module_config(r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>per_dir_config : include/httpd.h line=977 column=30
p
er_dir_config, &actions_module : modules/mappers/mod_actions.c line=60 column=31
a
ctions_module);
147    const char *t, *action;
148    const char *script;
149    int i;
150
151    if : true=0, false=0
i
f (! : true=0, false=0
!
conf : modules/mappers/mod_actions.c line=145 column=24
c
onf-> : enter=0, leave=0
-
>configured : modules/mappers/mod_actions.c line=55 column=9
c
onfigured) {
152        return : pass=0
r
eturn DECLINED;
153    }
154
155    /* Note that this handler handles _all_ types, so handler is unchecked */
156
157    /* Set allowed stuff */
158    for : true=0, false=0
f
or (i : modules/mappers/mod_actions.c line=149 column=9
i
 = : pass=0
=
 0; i : modules/mappers/mod_actions.c line=149 column=9
i
 < : true=0, false=0
<
 METHODS; ++ : pass=0
+
+i : modules/mappers/mod_actions.c line=149 column=9
i
) {
159        if : true=0, false=0
i
f (conf : modules/mappers/mod_actions.c line=145 column=24
c
onf-> : enter=0, leave=0
-
>scripted : modules/mappers/mod_actions.c line=54 column=17
s
cripted[] : enter=0, leave=0
[
i : modules/mappers/mod_actions.c line=149 column=9
i
])
160            r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>allowed : include/httpd.h line=853 column=17
a
llowed |= : enter=0, leave=0
|
= (AP_METHOD_BIT << : pass=0
<
i : modules/mappers/mod_actions.c line=149 column=9
i
);
161    }
162
163    /* First, check for the method-handling scripts */
164    if : true=0, false=0
i
f (r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>method_number : include/httpd.h line=831 column=9
m
ethod_number == : true=0, false=0
=
= M_GET) {
165        if : true=0, false=0
i
f (r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>args : include/httpd.h line=955 column=11
a
rgs)
166            script : modules/mappers/mod_actions.c line=148 column=17
s
cript = : pass=0
=
 conf : modules/mappers/mod_actions.c line=145 column=24
c
onf-> : enter=0, leave=0
-
>scripted : modules/mappers/mod_actions.c line=54 column=17
s
cripted[] : enter=0, leave=0
[
M_GET];
167        else
168            script : modules/mappers/mod_actions.c line=148 column=17
s
cript = : pass=0
=
 NULL;
169    }
170    else {
171        script : modules/mappers/mod_actions.c line=148 column=17
s
cript = : pass=0
=
 conf : modules/mappers/mod_actions.c line=145 column=24
c
onf-> : enter=0, leave=0
-
>scripted : modules/mappers/mod_actions.c line=54 column=17
s
cripted[] : enter=0, leave=0
[
r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>method_number : include/httpd.h line=831 column=9
m
ethod_number];
172    }
173
174    /* Check for looping, which can happen if the CGI script isn't */
175    if : true=0, false=0
i
f (MC/DC independently affect : true=0, false=0

script : modules/mappers/mod_actions.c line=148 column=17
sTF
cript && : true=0, false=0
&
r : modules/mappers/mod_actions.c line=143 column=40
r
MC/DC independently affect : true=0, false=0
-> : enter=0, leave=0
-TF
>prev : include/httpd.h line=789 column=18
p
rev && : true=0, false=0
&
r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>prev : include/httpd.h line=789 column=18
p
revMC/DC independently affect : true=0, false=0
-> : enter=0, leave=0
-TF
>prev : include/httpd.h line=789 column=18
p
rev)
176        return : pass=0
r
eturn DECLINED;
177
178    /* Second, check for actions (which override the method scripts) */
179    action : modules/mappers/mod_actions.c line=147 column=21
a
ction = : pass=0
=
 r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>handler : include/httpd.h line=919 column=17
h
andler conditional operator : true=0, false=0
?
 r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>handler : include/httpd.h line=919 column=17
h
andler :
180        ap_field_noparam : enter=0, leave=0

ap_field_noparam : include/httpd.h line=1276 column=20
a
p_field_noparam(r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>pool : include/httpd.h line=780 column=17
p
ool, r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>content_type : include/httpd.h line=917 column=17
c
ontent_type);
181    action : modules/mappers/mod_actions.c line=147 column=21
a
ction = : pass=0
=
 action : modules/mappers/mod_actions.c line=147 column=21
a
ction conditional operator : true=0, false=0
?
 action : modules/mappers/mod_actions.c line=147 column=21
a
ction : ap_default_type : enter=0, leave=0

ap_default_type : include/http_core.h line=166 column=26
a
p_default_type(r : modules/mappers/mod_actions.c line=143 column=40
r
);
182
183    if : true=0, false=0
i
f ((t : modules/mappers/mod_actions.c line=147 column=17
t
 = : pass=0
=
 apr_table_get : enter=0, leave=0

apr_table_get : /usr/include/apr-1/apr_tables.h line=258 column=27
a
pr_table_get(conf : modules/mappers/mod_actions.c line=145 column=24
c
onf-> : enter=0, leave=0
-
>action_types : modules/mappers/mod_actions.c line=53 column=18
a
ction_types, action : modules/mappers/mod_actions.c line=147 column=21
a
ction))) {
184        if : true=0, false=0
i
f (* dereference : enter=0, leave=0
*
t : modules/mappers/mod_actions.c line=147 column=17
t
++ : pass=0
+
== : true=0, false=0
MC/DC independently affect : true=0, false=0
=TF
= '0' && : true=0, false=0
&
r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>finfo : include/httpd.h line=957 column=17
f
info.filetype : /usr/include/apr-1/apr_file_info.h line=186 column=20 filetype == : true=0, false=0
MC/DC independently affect : true=0, false=0
=TF
= 0) {
185            ap_log_rerror : enter=0, leave=0

ap_log_rerror : include/http_log.h line=219 column=18
a
p_log_rerror(APLOG_MARK, APLOG_ERR, 0, r : modules/mappers/mod_actions.c line=143 column=40
r
,
186                          "File does not exist: %s", r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>filename : include/httpd.h line=948 column=11
f
ilename);
187            return : pass=0
r
eturn HTTP_NOT_FOUND;
188        }
189
190        script : modules/mappers/mod_actions.c line=148 column=17
s
cript = : pass=0
=
 t : modules/mappers/mod_actions.c line=147 column=17
t
;
191        /* propagate the handler name to the script
192         * (will be REDIRECT_HANDLER there)
193         */
194        apr_table_setn : enter=0, leave=0

apr_table_setn : /usr/include/apr-1/apr_tables.h line=282 column=19
a
pr_table_setn(r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>subprocess_env : include/httpd.h line=908 column=18
s
ubprocess_env, "HANDLER", action : modules/mappers/mod_actions.c line=147 column=21
a
ction);
195    }
196
197    if : true=0, false=0
i
f (script : modules/mappers/mod_actions.c line=148 column=17
s
cript == : true=0, false=0
=
= NULL)
198        return : pass=0
r
eturn DECLINED;
199
200    ap_internal_redirect_handler : enter=0, leave=0

ap_internal_redirect_handler : include/http_request.h line=166 column=18
a
p_internal_redirect_handler(apr_pstrcat : enter=0, leave=0

apr_pstrcat : /usr/include/apr-1/apr_strings.h line=139 column=28
a
pr_pstrcat(r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>pool : include/httpd.h line=780 column=17
p
ool, script : modules/mappers/mod_actions.c line=148 column=17
s
cript,
201                                             ap_escape_uri(r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>pool : include/httpd.h line=780 column=17
p
ool, r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>uri : include/httpd.h line=946 column=11
u
ri),
202                                             r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>args : include/httpd.h line=955 column=11
a
rgs conditional operator : true=0, false=0
?
 "?" : NULL,
203                                             r : modules/mappers/mod_actions.c line=143 column=40
r
-> : enter=0, leave=0
-
>args : include/httpd.h line=955 column=11
a
rgs, NULL), r : modules/mappers/mod_actions.c line=143 column=40
r
);
204    return : pass=0
r
eturn OK;
205}
206
207static void register_hooks : call=1
r
egister_hooks(apr_pool_t *p)
208{
209    ap_hook_handler : enter=1, leave=1

ap_hook_handler : modules/mappers/ line=3 column=1
a
p_hook_handler(action_handler : modules/mappers/mod_actions.c line=143 column=12
a
ction_handler,NULL,NULL,APR_HOOK_LAST);
210}
211
212module AP_MODULE_DECLARE_DATA actions_module =
213{
214    STANDARD20_MODULE_STUFF,
215    create_action_dir_config : modules/mappers/mod_actions.c line=62 column=14
c
reate_action_dir_config,   /* dir config creater */
216    merge_action_dir_configs : modules/mappers/mod_actions.c line=72 column=14
m
erge_action_dir_configs,   /* dir merger --- default is to override */
217    NULL,                       /* server config */
218    NULL,                       /* merge server config */
219    action_cmds : modules/mappers/mod_actions.c line=134 column=26
a
ction_cmds,                /* command apr_table_t */
220    register_hooks : modules/mappers/mod_actions.c line=207 column=13
r
egister_hooks              /* register hooks */
221};
222[EOF]


Generated by expcov