* auth/radius.c (_expand_query): Fix typo.
* mailbox/cfg_lexer.c (copy_string0): New function. (copy_string): Rewrite using copy_string0. (copy_to): Parse strings correctly. (default_lexer): Bugfix. Return string if tag is quoted.
Showing
3 changed files
with
77 additions
and
49 deletions
1 | 2008-01-31 Sergey Poznyakoff <gray@gnu.org.ua> | ||
2 | |||
3 | * auth/radius.c (_expand_query): Fix typo. | ||
4 | * mailbox/cfg_lexer.c (copy_string0): New function. | ||
5 | (copy_string): Rewrite using copy_string0. | ||
6 | (copy_to): Parse strings correctly. | ||
7 | (default_lexer): Bugfix. Return string if tag is quoted. | ||
8 | |||
1 | 2008-01-28 Sergey Poznyakoff <gray@gnu.org.ua> | 9 | 2008-01-28 Sergey Poznyakoff <gray@gnu.org.ua> |
2 | 10 | ||
3 | * pop3d/bulletin.c (open_bulletin_mailbox): Bugfix. | 11 | * pop3d/bulletin.c (open_bulletin_mailbox): Bugfix. | ... | ... |
... | @@ -220,7 +220,7 @@ _expand_query (const char *query, const char *ustr, const char *passwd) | ... | @@ -220,7 +220,7 @@ _expand_query (const char *query, const char *ustr, const char *passwd) |
220 | if (passwd) | 220 | if (passwd) |
221 | { | 221 | { |
222 | mu_vartab_define (vtab, "passwd", passwd, 1); | 222 | mu_vartab_define (vtab, "passwd", passwd, 1); |
223 | mu_vartab_define (vtab, "p", ustr, 1); | 223 | mu_vartab_define (vtab, "p", passwd, 1); |
224 | } | 224 | } |
225 | 225 | ||
226 | rc = mu_vartab_expand (vtab, query, &str); | 226 | rc = mu_vartab_expand (vtab, query, &str); | ... | ... |
... | @@ -115,53 +115,14 @@ skipline (struct lexer_data *p) | ... | @@ -115,53 +115,14 @@ skipline (struct lexer_data *p) |
115 | } | 115 | } |
116 | 116 | ||
117 | static int | 117 | static int |
118 | isword (int c) | ||
119 | { | ||
120 | if (mu_cfg_tie_in) | ||
121 | return c && c != ';' && c != '{'; | ||
122 | |||
123 | return isalnum (c) || c == '_' || c == '-' || c == '.'; | ||
124 | } | ||
125 | |||
126 | static char * | ||
127 | copy_alpha (struct lexer_data *p) | ||
128 | { | ||
129 | do | ||
130 | { | ||
131 | if (*p->curp == '\n') | ||
132 | mu_cfg_locus.line++; | ||
133 | cbuf_1grow (p, *p->curp); | ||
134 | p->curp++; | ||
135 | } while (*p->curp && isword (*p->curp)); | ||
136 | cbuf_1grow (p, 0); | ||
137 | return cbuf_finish (p); | ||
138 | } | ||
139 | |||
140 | static char * | ||
141 | copy_to (struct lexer_data *p, const char *delim) | ||
142 | { | ||
143 | while (*p->curp) | ||
144 | { | ||
145 | if (strchr (delim, *p->curp)) | ||
146 | break; | ||
147 | if (*p->curp == '\n') | ||
148 | mu_cfg_locus.line++; | ||
149 | cbuf_1grow (p, *p->curp); | ||
150 | p->curp++; | ||
151 | } | ||
152 | cbuf_1grow (p, 0); | ||
153 | return cbuf_finish (p); | ||
154 | } | ||
155 | |||
156 | static int | ||
157 | continuation_line_p (struct lexer_data *p, int quote) | 118 | continuation_line_p (struct lexer_data *p, int quote) |
158 | { | 119 | { |
159 | skipws (p); | 120 | skipws (p); |
160 | return *p->curp == quote; | 121 | return *p->curp == quote; |
161 | } | 122 | } |
162 | 123 | ||
163 | static char * | 124 | static void |
164 | copy_string (struct lexer_data *p) | 125 | copy_string0 (struct lexer_data *p, int unquote) |
165 | { | 126 | { |
166 | int quote; | 127 | int quote; |
167 | do | 128 | do |
... | @@ -183,13 +144,10 @@ copy_string (struct lexer_data *p) | ... | @@ -183,13 +144,10 @@ copy_string (struct lexer_data *p) |
183 | p->curp++; | 144 | p->curp++; |
184 | continue; | 145 | continue; |
185 | } | 146 | } |
186 | c = mu_argcv_unquote_char (*p->curp); | 147 | if (!unquote) |
187 | if (c == *p->curp) | 148 | c = *p->curp; |
188 | { | ||
189 | cbuf_1grow (p, '\\'); | ||
190 | cbuf_1grow (p, *p->curp); | ||
191 | } | ||
192 | else | 149 | else |
150 | c = mu_argcv_unquote_char (*p->curp); | ||
193 | cbuf_1grow (p, c); | 151 | cbuf_1grow (p, c); |
194 | p->curp++; | 152 | p->curp++; |
195 | } | 153 | } |
... | @@ -206,7 +164,69 @@ copy_string (struct lexer_data *p) | ... | @@ -206,7 +164,69 @@ copy_string (struct lexer_data *p) |
206 | } | 164 | } |
207 | } | 165 | } |
208 | while (continuation_line_p (p, quote)); | 166 | while (continuation_line_p (p, quote)); |
167 | } | ||
168 | |||
169 | static char * | ||
170 | copy_string (struct lexer_data *p) | ||
171 | { | ||
172 | copy_string0 (p, 1); | ||
173 | cbuf_1grow (p, 0); | ||
174 | return cbuf_finish (p); | ||
175 | } | ||
176 | |||
177 | static char * | ||
178 | copy_to (struct lexer_data *p, const char *delim) | ||
179 | { | ||
180 | while (*p->curp) | ||
181 | { | ||
182 | if (*p->curp == '"' || *p->curp == '\'') | ||
183 | { | ||
184 | int quote = *p->curp; | ||
185 | cbuf_1grow (p, quote); | ||
186 | copy_string0 (p, 0); | ||
187 | cbuf_1grow (p, quote); | ||
188 | continue; | ||
189 | } | ||
190 | |||
191 | if (strchr (delim, *p->curp)) | ||
192 | break; | ||
193 | if (*p->curp == '\n') | ||
194 | mu_cfg_locus.line++; | ||
195 | cbuf_1grow (p, *p->curp); | ||
196 | p->curp++; | ||
197 | } | ||
198 | cbuf_1grow (p, 0); | ||
199 | return cbuf_finish (p); | ||
200 | } | ||
209 | 201 | ||
202 | static int | ||
203 | isword (int c) | ||
204 | { | ||
205 | if (mu_cfg_tie_in) | ||
206 | return c && c != ';' && c != '{'; | ||
207 | |||
208 | return isalnum (c) || c == '_' || c == '-' || c == '.'; | ||
209 | } | ||
210 | |||
211 | static char * | ||
212 | copy_alpha (struct lexer_data *p) | ||
213 | { | ||
214 | do | ||
215 | { | ||
216 | if (mu_cfg_tie_in && (*p->curp == '"' || *p->curp == '\'')) | ||
217 | { | ||
218 | int quote = *p->curp; | ||
219 | cbuf_1grow (p, quote); | ||
220 | copy_string0 (p, 0); | ||
221 | cbuf_1grow (p, quote); | ||
222 | continue; | ||
223 | } | ||
224 | |||
225 | if (*p->curp == '\n') | ||
226 | mu_cfg_locus.line++; | ||
227 | cbuf_1grow (p, *p->curp); | ||
228 | p->curp++; | ||
229 | } while (*p->curp && isword (*p->curp)); | ||
210 | cbuf_1grow (p, 0); | 230 | cbuf_1grow (p, 0); |
211 | return cbuf_finish (p); | 231 | return cbuf_finish (p); |
212 | } | 232 | } |
... | @@ -337,7 +357,7 @@ again: | ... | @@ -337,7 +357,7 @@ again: |
337 | tag = copy_alpha (p); | 357 | tag = copy_alpha (p); |
338 | skipws (p); | 358 | skipws (p); |
339 | 359 | ||
340 | if (*p->curp == '"') | 360 | if (*tag == '"') |
341 | { | 361 | { |
342 | mu_cfg_yylval.string = tag; | 362 | mu_cfg_yylval.string = tag; |
343 | LEX_DEBUG ("STRING", mu_cfg_yylval.string, NULL); | 363 | LEX_DEBUG ("STRING", mu_cfg_yylval.string, NULL); | ... | ... |
-
Please register or sign in to post a comment