~ubuntu-branches/ubuntu/utopic/haproxy/utopic-proposed

« back to all changes in this revision

Viewing changes to debian/patches/acl-in-default.patch

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Cornet
  • Date: 2009-02-17 08:55:12 UTC
  • mfrom: (1.1.5 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090217085512-qmij51nun3rbxorz
Fix build without debian/patches directory (Closes: #515682) using
/usr/share/quilt/quilt.make.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
commit 1c90a6ec20946a713e9c93995a8e91ed3eeb9da4
2
 
Author: Willy Tarreau <w@1wt.eu>
3
 
Date:   Sun Oct 12 17:26:37 2008 +0200
4
 
 
5
 
    [BUG] acl-related keywords are not allowed in defaults sections
6
 
    
7
 
    Using an ACL-related keyword in the defaults section causes a
8
 
    segfault during parsing because the list headers are not initialized.
9
 
    We must initialize list headers for default instance and reject
10
 
    keywords relying on ACLs.
11
 
 
12
 
diff --git a/src/cfgparse.c b/src/cfgparse.c
13
 
index b33800c..038915a 100644
14
 
--- a/src/cfgparse.c
15
 
+++ b/src/cfgparse.c
16
 
@@ -516,6 +516,13 @@ static void init_default_instance()
17
 
        defproxy.maxconn = cfg_maxpconn;
18
 
        defproxy.conn_retries = CONN_RETRIES;
19
 
        defproxy.logfac1 = defproxy.logfac2 = -1; /* log disabled */
20
 
+
21
 
+       LIST_INIT(&defproxy.pendconns);
22
 
+       LIST_INIT(&defproxy.acl);
23
 
+       LIST_INIT(&defproxy.block_cond);
24
 
+       LIST_INIT(&defproxy.mon_fail_cond);
25
 
+       LIST_INIT(&defproxy.switching_rules);
26
 
+
27
 
        proxy_reset_timeouts(&defproxy);
28
 
 }
29
 
 
30
 
@@ -837,6 +844,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
31
 
                curproxy->state = PR_STNEW;
32
 
        }
33
 
        else if (!strcmp(args[0], "acl")) {  /* add an ACL */
34
 
+               if (curproxy == &defproxy) {
35
 
+                       Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
36
 
+                       return -1;
37
 
+               }
38
 
+
39
 
                err = invalid_char(args[1]);
40
 
                if (err) {
41
 
                        Alert("parsing [%s:%d] : character '%c' is not permitted in acl name '%s'.\n",
42
 
@@ -1076,6 +1088,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
43
 
                int pol = ACL_COND_NONE;
44
 
                struct acl_cond *cond;
45
 
 
46
 
+               if (curproxy == &defproxy) {
47
 
+                       Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
48
 
+                       return -1;
49
 
+               }
50
 
+
51
 
                if (!strcmp(args[1], "if"))
52
 
                        pol = ACL_COND_IF;
53
 
                else if (!strcmp(args[1], "unless"))
54
 
@@ -1099,6 +1116,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
55
 
                struct acl_cond *cond;
56
 
                struct switching_rule *rule;
57
 
 
58
 
+               if (curproxy == &defproxy) {
59
 
+                       Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
60
 
+                       return -1;
61
 
+               }
62
 
+
63
 
                if (warnifnotcap(curproxy, PR_CAP_FE, file, linenum, args[0], NULL))
64
 
                        return 0;
65
 
 
66
 
@@ -1376,6 +1398,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int inv)
67
 
                }
68
 
        }
69
 
        else if (!strcmp(args[0], "monitor")) {
70
 
+               if (curproxy == &defproxy) {
71
 
+                       Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
72
 
+                       return -1;
73
 
+               }
74
 
+
75
 
                if (warnifnotcap(curproxy, PR_CAP_FE, file, linenum, args[0], NULL))
76
 
                        return 0;
77