]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.4.4-reload.patch
ebl fix sql scripts and add new update stats query
[bacula/bacula] / bacula / patches / 2.4.4-reload.patch
1
2  This patch fixes bug #1211 crash during reload with bad dird.conf file.
3
4  Apply it to version 2.4.4 with:
5
6  cd <bacula-source>
7  patch -p0 <2.4.4-reload.patch
8  ./configure <your options>
9  make
10  ...
11  make install
12
13
14 Index: src/lib/parse_conf.c
15 ===================================================================
16 --- src/lib/parse_conf.c        (revision 8393)
17 +++ src/lib/parse_conf.c        (working copy)
18 @@ -284,6 +284,7 @@
19              }
20              if (token != T_EQUALS) {
21                 scan_err1(lc, _("expected an =, got: %s"), lc->str);
22 +               return;
23              }
24              break;
25           }
26 @@ -304,6 +305,7 @@
27           Dmsg1(900, "store_msgs dest=%s:\n", NPRT(dest));
28           if (token != T_EQUALS) {
29              scan_err1(lc, _("expected an =, got: %s"), lc->str);
30 +            return;
31           }
32           scan_types(lc, (MSGS *)(item->value), item->code, dest, NULL);
33           free_pool_memory(dest);
34 @@ -312,7 +314,7 @@
35  
36        default:
37           scan_err1(lc, _("Unknown item code: %d\n"), item->code);
38 -         break;
39 +         return;
40        }
41     }
42     scan_to_eol(lc);
43 @@ -352,7 +354,7 @@
44        }
45        if (!found) {
46           scan_err1(lc, _("message type: %s not found"), str);
47 -         /* NOT REACHED */
48 +         return;
49        }
50  
51        if (msg_type == M_MAX+1) {         /* all? */
52 @@ -384,12 +386,14 @@
53     lex_get_token(lc, T_NAME);
54     if (!is_name_valid(lc->str, &msg)) {
55        scan_err1(lc, "%s\n", msg);
56 +      return;
57     }
58     free_pool_memory(msg);
59     /* Store the name both pass 1 and pass 2 */
60     if (*(item->value)) {
61        scan_err2(lc, _("Attempt to redefine name \"%s\" to \"%s\"."),
62           *(item->value), lc->str);
63 +      return;
64     }
65     *(item->value) = bstrdup(lc->str);
66     scan_to_eol(lc);
67 @@ -481,10 +485,12 @@
68        if (res == NULL) {
69           scan_err3(lc, _("Could not find config Resource %s referenced on line %d : %s\n"),
70              lc->str, lc->line_no, lc->line);
71 +         return;
72        }
73        if (*(item->value)) {
74           scan_err3(lc, _("Attempt to redefine resource \"%s\" referenced on line %d : %s\n"),
75              item->name, lc->line_no, lc->line);
76 +         return;
77        }
78        *(item->value) = (char *)res;
79     }
80 @@ -520,6 +526,7 @@
81           if (i >= count) {
82              scan_err4(lc, _("Too many %s directives. Max. is %d. line %d: %s\n"),
83                 lc->str, count, lc->line_no, lc->line);
84 +            return;
85           }
86           list = New(alist(10, not_owned_by_alist));
87        }
88 @@ -530,6 +537,7 @@
89           if (res == NULL) {
90              scan_err3(lc, _("Could not find config Resource \"%s\" referenced on line %d : %s\n"),
91                 item->name, lc->line_no, lc->line);
92 +            return;
93           }
94           Dmsg5(900, "Append %p to alist %p size=%d i=%d %s\n", 
95                 res, list, list->size(), i, item->name);
96 @@ -592,6 +600,7 @@
97       if (res == NULL) {
98          scan_err3(lc, _("Missing config Resource \"%s\" referenced on line %d : %s\n"),
99             lc->str, lc->line_no, lc->line);
100 +        return;
101       }
102     }
103     scan_to_eol(lc);
104 @@ -655,12 +664,13 @@
105        }
106        if (!size_to_uint64(bsize, strlen(bsize), &uvalue)) {
107           scan_err1(lc, _("expected a size number, got: %s"), lc->str);
108 +         return;
109        }
110        *(uint64_t *)(item->value) = uvalue;
111        break;
112     default:
113        scan_err1(lc, _("expected a size, got: %s"), lc->str);
114 -      break;
115 +      return;
116     }
117     if (token != T_EOL) {
118        scan_to_eol(lc);
119 @@ -697,12 +707,13 @@
120        }
121        if (!duration_to_utime(period, &utime)) {
122           scan_err1(lc, _("expected a time period, got: %s"), period);
123 +         return;
124        }
125        *(utime_t *)(item->value) = utime;
126        break;
127     default:
128        scan_err1(lc, _("expected a time period, got: %s"), lc->str);
129 -      break;
130 +      return;
131     }
132     if (token != T_EOL) {
133        scan_to_eol(lc);
134 @@ -721,6 +732,7 @@
135        *(uint32_t *)(item->value) &= ~(item->code);
136     } else {
137        scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, TRUE, or FALSE", lc->str); /* YES and NO must not be translated */
138 +      return;
139     }
140     scan_to_eol(lc);
141     set_bit(index, res_all.hdr.item_present);
142 @@ -736,6 +748,7 @@
143        *(bool *)(item->value) = false;
144     } else {
145        scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, TRUE, or FALSE", lc->str); /* YES and NO must not be translated */
146 +      return;
147     }
148     scan_to_eol(lc);
149     set_bit(index, res_all.hdr.item_present);
150 @@ -761,6 +774,7 @@
151     }
152     if (i != 0) {
153        scan_err1(lc, _("Expected a Tape Label keyword, got: %s"), lc->str);
154 +      return;
155     }
156     scan_to_eol(lc);
157     set_bit(index, res_all.hdr.item_present);
158 @@ -910,6 +924,7 @@
159                 Dmsg0(900, "T_EOB => define new resource\n");
160                 if (res_all.hdr.name == NULL) {
161                    scan_err0(lc, _("Name not specified for resource"));
162 +                  return 0;
163                 }
164                 save_resource(res_type, items, pass);  /* save resource */
165                 break;