This page is READ-ONLY. It is generated from the old site.
All timestamps are relative to 2013 (when this page is generated).
If you are looking for TeX support, please go to VietTUG.org

suhosin: perdir support

undocumented cool stuff
Added by icy 8 months ago  »  Votes: 3/3

Default value of suhosin.perdir is 0. It can accept one or more values l, e, g, ... For example, suhosin.perdir = "lge" (FIXME?). When perdir is turned on, you may put local configuration in application's directory. (However, php-fpm doesn't use those *.ini files.)

The feautre isn't documented, but you can find it in the source code of the main library suhosin.c:

 1 static ZEND_INI_MH(OnUpdateSuhosin_perdir)
 2 {
 3     char *tmp;
 4 
 5     if (SUHOSIN_G(perdir)) {
 6           pefree(SUHOSIN_G(perdir), 1);
 7     }
 8     SUHOSIN_G(perdir) = NULL;
 9 
10     /* Initialize the perdir flags */
11     SUHOSIN_G(log_perdir) = 0;
12     SUHOSIN_G(exec_perdir) = 0;
13     SUHOSIN_G(get_perdir) = 0;
14     SUHOSIN_G(cookie_perdir) = 0;
15     SUHOSIN_G(post_perdir) = 0;
16     SUHOSIN_G(request_perdir) = 0;
17     SUHOSIN_G(sql_perdir) = 0;
18     SUHOSIN_G(upload_perdir) = 0;
19     SUHOSIN_G(misc_perdir) = 0;
20 
21     if (new_value == NULL) {
22       return SUCCESS;
23     }
24 
25     tmp = SUHOSIN_G(perdir) = pestrdup(new_value,1);
26 
27     /* trim the whitespace */
28     while (isspace(*tmp)) tmp++;
29 
30     /* should we deactivate perdir completely? */
31     if (*tmp == 0 || *tmp == '0') {
32         return SUCCESS;
33     }
34 
35     /* no deactivation so check the flags */
36     while (*tmp) {
37         switch (*tmp) {
38             case 'l':
39             case 'L':
40                 SUHOSIN_G(log_perdir) = 1;
41                 break;
42             case 'e':
43             case 'E':
44                 SUHOSIN_G(exec_perdir) = 1;
45                 break;
46             case 'g':
47             case 'G':
48                 SUHOSIN_G(get_perdir) = 1;
49                 break;
50             case 'c':
51             case 'C':
52                 SUHOSIN_G(cookie_perdir) = 1;
53                 break;
54             case 'p':
55             case 'P':
56                 SUHOSIN_G(post_perdir) = 1;
57                 break;
58             case 'r':
59             case 'R':
60                 SUHOSIN_G(request_perdir) = 1;
61                 break;
62             case 's':
63             case 'S':
64                 SUHOSIN_G(sql_perdir) = 1;
65                 break;
66             case 'u':
67             case 'U':
68                 SUHOSIN_G(upload_perdir) = 1;
69                 break;
70             case 'm':
71             case 'M':
72                 SUHOSIN_G(misc_perdir) = 1;
73                 break;
74         }
75         tmp++;
76     }        
77     return SUCCESS;
78 }

Comments