Commit d7e10d9e d7e10d9ea4d1726f5253cad4fe06a9114365255b by Sergey Poznyakoff

* auth/ldap.c (_mu_ldap_search): Provide %u expansion for backward

compatibility with other modules.
* auth/radius.c, auth/sql.c: Use mu_vartab_t for expansion.
* include/mailutils/mailutils.h: Include mailutils/assoc.h
* lib/tcpwrap.c (mu_tcpwrapper_access): Ignore local sockets.
* libargp/muinit.c (mu_app_init): Re-assign mu_program_name after
command line parsing, so that --program-name takes effect.
* libcfg/sql.c (mu_sql_param): Fix typo in statement name.
* libproto/include/amd.h (struct _amd_message.create): New member.
* libproto/maildir/mbox.c (maildir_create): New function.
(_mailbox_maildir_init): Set amd->create.
* mailbox/amd.c (amd_open): Call amd->create after successfully
creating the directory.
* mailbox/cfg_driver.c (_cb_include): Mask out
MU_PARSE_CONFIG_GLOBAL in the flags.
(mu_build_container): Bugfix. Take struct include_data as
argument, instead of using an auto variable. All callers updated.
* mailbox/ipsrv.c (mu_ip_tcp_accept): Bugfix: use client address,
not server, to print diagnostics.
* mailbox/msrv.c (m_srv_conn): Fix prefork condition for
single-process mode.
1 parent 6d1d8ecf
1 2008-01-09 Sergey Poznyakoff <gray@gnu.org.ua> 1 2008-01-09 Sergey Poznyakoff <gray@gnu.org.ua>
2 2
3 * auth/ldap.c (_mu_ldap_search): Provide %u expansion for backward
4 compatibility with other modules.
5 * auth/radius.c, auth/sql.c: Use mu_vartab_t for expansion.
6 * include/mailutils/mailutils.h: Include mailutils/assoc.h
7 * lib/tcpwrap.c (mu_tcpwrapper_access): Ignore local sockets.
8 * libargp/muinit.c (mu_app_init): Re-assign mu_program_name after
9 command line parsing, so that --program-name takes effect.
10 * libcfg/sql.c (mu_sql_param): Fix typo in statement name.
11 * libproto/include/amd.h (struct _amd_message.create): New member.
12 * libproto/maildir/mbox.c (maildir_create): New function.
13 (_mailbox_maildir_init): Set amd->create.
14 * mailbox/amd.c (amd_open): Call amd->create after successfully
15 creating the directory.
16 * mailbox/cfg_driver.c (_cb_include): Mask out
17 MU_PARSE_CONFIG_GLOBAL in the flags.
18 (mu_build_container): Bugfix. Take struct include_data as
19 argument, instead of using an auto variable. All callers updated.
20 * mailbox/ipsrv.c (mu_ip_tcp_accept): Bugfix: use client address,
21 not server, to print diagnostics.
22 * mailbox/msrv.c (m_srv_conn): Fix prefork condition for
23 single-process mode.
24
3 * TODO: Update. 25 * TODO: Update.
4 * include/mailutils/server.h (mu_m_server_set_foreground) 26 * include/mailutils/server.h (mu_m_server_set_foreground)
5 (mu_m_server_foreground,mu_m_server_pidfile) 27 (mu_m_server_foreground,mu_m_server_pidfile)
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2005, 2007 Free Software Foundation, Inc. 2 Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 modify it under the terms of the GNU Lesser General Public
...@@ -516,6 +516,7 @@ _mu_ldap_search (LDAP *ld, const char *filter_pat, const char *key, ...@@ -516,6 +516,7 @@ _mu_ldap_search (LDAP *ld, const char *filter_pat, const char *key,
516 516
517 mu_vartab_create (&vtab); 517 mu_vartab_create (&vtab);
518 mu_vartab_define (vtab, "user", key, 1); 518 mu_vartab_define (vtab, "user", key, 1);
519 mu_vartab_define (vtab, "u", key, 1);
519 rc = mu_vartab_expand (vtab, filter_pat, &filter); 520 rc = mu_vartab_expand (vtab, filter_pat, &filter);
520 mu_vartab_destroy (&vtab); 521 mu_vartab_destroy (&vtab);
521 if (rc) 522 if (rc)
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2005, 2007 Free Software Foundation, Inc. 2 Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 modify it under the terms of the GNU Lesser General Public
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
40 #include <mailutils/error.h> 40 #include <mailutils/error.h>
41 #include <mailutils/errno.h> 41 #include <mailutils/errno.h>
42 #include <mailutils/nls.h> 42 #include <mailutils/nls.h>
43 #include <mailutils/vartab.h>
43 44
44 #ifdef ENABLE_RADIUS 45 #ifdef ENABLE_RADIUS
45 46
...@@ -202,96 +203,38 @@ mu_radius_module_init (void *data) ...@@ -202,96 +203,38 @@ mu_radius_module_init (void *data)
202 static char * 203 static char *
203 _expand_query (const char *query, const char *ustr, const char *passwd) 204 _expand_query (const char *query, const char *ustr, const char *passwd)
204 { 205 {
205 char *p, *q, *res; 206 int rc;
206 int len; 207 mu_vartab_t vtab;
207 208 char *str, *ret;
209
208 if (!query) 210 if (!query)
209 return NULL; 211 return NULL;
212
213 mu_vartab_create (&vtab);
214 if (ustr)
215 {
216 mu_vartab_define (vtab, "user", ustr, 1);
217 mu_vartab_define (vtab, "u", ustr, 1);
218 }
210 219
211 /* Compute resulting query length */ 220 if (passwd)
212 for (len = 0, p = (char *) query; *p; )
213 { 221 {
214 if (*p == '%') 222 mu_vartab_define (vtab, "passwd", passwd, 1);
215 { 223 mu_vartab_define (vtab, "p", ustr, 1);
216 if (p[1] == 'u')
217 {
218 len += ustr ? strlen (ustr) : 2;
219 p += 2;
220 }
221 else if (p[1] == 'p')
222 {
223 len += passwd ? strlen (passwd) : 2;
224 p += 2;
225 }
226 else if (p[1] == '%')
227 {
228 len++;
229 p += 2;
230 }
231 else
232 {
233 len++;
234 p++;
235 }
236 }
237 else
238 {
239 len++;
240 p++;
241 }
242 } 224 }
243 225
244 res = grad_emalloc (len + 1); 226 rc = mu_vartab_expand (vtab, query, &str);
245 if (!res) 227 if (rc == 0)
246 return res;
247
248 for (p = (char *) query, q = res; *p; )
249 { 228 {
250 if (*p == '%') 229 ret = grad_emalloc (strlen (str) + 1);
251 { 230 strcpy (ret, str);
252 switch (*++p) 231 free (str);
253 {
254 case 'u':
255 if (ustr)
256 {
257 strcpy (q, ustr);
258 q += strlen (q);
259 }
260 else
261 {
262 *q++ = '%';
263 *q++ = 'u';
264 }
265 p++;
266 break;
267
268 case 'p':
269 if (passwd)
270 {
271 strcpy (q, passwd);
272 q += strlen (q);
273 }
274 else
275 {
276 *q++ = '%';
277 *q++ = 'p';
278 }
279 p++;
280 break;
281
282 case '%':
283 *q++ = *p++;
284 break;
285
286 default:
287 *q++ = *p++;
288 }
289 }
290 else
291 *q++ = *p++;
292 } 232 }
293 *q = 0; 233 else
294 return res; 234 ret = NULL;
235
236 mu_vartab_destroy (&vtab);
237 return ret;
295 } 238 }
296 239
297 240
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2 Copyright (C) 2002, 2003, 2004, 2005, 2006,
3 2007 Free Software Foundation, Inc. 3 2007, 2008 Free Software Foundation, Inc.
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
51 #include <mailutils/nls.h> 51 #include <mailutils/nls.h>
52 #include <mailutils/mutil.h> 52 #include <mailutils/mutil.h>
53 #include <mailutils/sql.h> 53 #include <mailutils/sql.h>
54 #include <mailutils/vartab.h>
54 #include "sql.h" 55 #include "sql.h"
55 56
56 #ifdef USE_SQL 57 #ifdef USE_SQL
...@@ -88,74 +89,22 @@ sql_escape_string (const char *ustr) ...@@ -88,74 +89,22 @@ sql_escape_string (const char *ustr)
88 char * 89 char *
89 mu_sql_expand_query (const char *query, const char *ustr) 90 mu_sql_expand_query (const char *query, const char *ustr)
90 { 91 {
91 char *p, *q, *res; 92 int rc;
92 int len; 93 char *res;
93 char *esc_ustr; 94 char *esc_ustr;
95 mu_vartab_t vtab;
94 96
95 if (!query) 97 if (!query)
96 return NULL; 98 return NULL;
97 99
98 esc_ustr = sql_escape_string (ustr); 100 esc_ustr = sql_escape_string (ustr);
99 101 mu_vartab_create (&vtab);
100 /* Compute resulting query length */ 102 mu_vartab_define (vtab, "user", ustr, 1);
101 for (len = 0, p = (char *) query; *p; ) 103 mu_vartab_define (vtab, "u", ustr, 1);
102 { 104 rc = mu_vartab_expand (vtab, query, &res);
103 if (*p == '%') 105 if (rc)
104 { 106 res = NULL;
105 if (p[1] == 'u') 107 mu_vartab_destroy (&vtab);
106 {
107 len += strlen (esc_ustr);
108 p += 2;
109 }
110 else if (p[1] == '%')
111 {
112 len++;
113 p += 2;
114 }
115 else
116 {
117 len++;
118 p++;
119 }
120 }
121 else
122 {
123 len++;
124 p++;
125 }
126 }
127
128 res = malloc (len + 1);
129 if (!res)
130 {
131 free (esc_ustr);
132 return res;
133 }
134
135 for (p = (char *) query, q = res; *p; )
136 {
137 if (*p == '%')
138 {
139 switch (*++p)
140 {
141 case 'u':
142 strcpy (q, esc_ustr);
143 q += strlen (q);
144 p++;
145 break;
146
147 case '%':
148 *q++ = *p++;
149 break;
150
151 default:
152 *q++ = *p++;
153 }
154 }
155 else
156 *q++ = *p++;
157 }
158 *q = 0;
159 108
160 free (esc_ustr); 109 free (esc_ustr);
161 return res; 110 return res;
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2 Copyright (C) 1999, 2000, 2001, 2002, 2003,
3 2004, 2007 Free Software Foundation, Inc. 3 2004, 2007, 2008 Free Software Foundation, Inc.
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
19 19
20 #include <mailutils/acl.h> 20 #include <mailutils/acl.h>
21 #include <mailutils/address.h> 21 #include <mailutils/address.h>
22 #include <mailutils/assoc.h>
22 #include <mailutils/argcv.h> 23 #include <mailutils/argcv.h>
23 #include <mailutils/attribute.h> 24 #include <mailutils/attribute.h>
24 #include <mailutils/auth.h> 25 #include <mailutils/auth.h>
......
...@@ -144,7 +144,9 @@ mu_tcpwrapper_access (int fd) ...@@ -144,7 +144,9 @@ mu_tcpwrapper_access (int fd)
144 int 144 int
145 mu_tcp_wrapper_prefork (int fd, void *data, struct sockaddr *sa, int salen) 145 mu_tcp_wrapper_prefork (int fd, void *data, struct sockaddr *sa, int salen)
146 { 146 {
147 if (mu_tcp_wrapper_enable && !mu_tcpwrapper_access (fd)) 147 if (mu_tcp_wrapper_enable
148 && sa->sa_family == AF_INET
149 && !mu_tcpwrapper_access (fd))
148 { 150 {
149 char *p = mu_sockaddr_to_astr (sa, salen); 151 char *p = mu_sockaddr_to_astr (sa, salen);
150 mu_error (_("Access from %s blocked by TCP wrappers."), p); 152 mu_error (_("Access from %s blocked by TCP wrappers."), p);
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2007 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2008 Free Software Foundation, Inc.
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 modify it under the terms of the GNU Lesser General Public
...@@ -77,6 +77,10 @@ mu_app_init (struct argp *myargp, const char **capa, ...@@ -77,6 +77,10 @@ mu_app_init (struct argp *myargp, const char **capa,
77 mu_argp_done (argp); 77 mu_argp_done (argp);
78 if (rc) 78 if (rc)
79 return rc; 79 return rc;
80
81 /* Reset program name, it may have been changed using the `--program-name'
82 option. */
83 mu_set_program_name (program_invocation_name);
80 84
81 mu_libcfg_init (excapa); 85 mu_libcfg_init (excapa);
82 free (excapa); 86 free (excapa);
......
1 /* This file is part of GNU Mailutils 1 /* This file is part of GNU Mailutils
2 Copyright (C) 2007 Free Software Foundation, Inc. 2 Copyright (C) 2007, 2008 Free Software Foundation, Inc.
3 3
4 GNU Mailutils is free software; you can redistribute it and/or 4 GNU Mailutils is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as 5 modify it under the terms of the GNU General Public License as
...@@ -52,7 +52,7 @@ cb_field_map (mu_debug_t debug, void *data, char *arg) ...@@ -52,7 +52,7 @@ cb_field_map (mu_debug_t debug, void *data, char *arg)
52 static struct mu_cfg_param mu_sql_param[] = { 52 static struct mu_cfg_param mu_sql_param[] = {
53 { "interface", mu_cfg_string, &sql_settings.interface, 0, NULL, 53 { "interface", mu_cfg_string, &sql_settings.interface, 0, NULL,
54 N_("Set SQL interface to use (one of: mysql, odbc, or postgres).") }, 54 N_("Set SQL interface to use (one of: mysql, odbc, or postgres).") },
55 { "getwpnam", mu_cfg_string, &sql_settings.getpwnam_query, 0, NULL, 55 { "getpwnam", mu_cfg_string, &sql_settings.getpwnam_query, 0, NULL,
56 N_("SQL query to use for getpwnam requests."), 56 N_("SQL query to use for getpwnam requests."),
57 N_("query") }, 57 N_("query") },
58 { "getpwuid", mu_cfg_string, &sql_settings.getpwuid_query, 0, NULL, 58 { "getpwuid", mu_cfg_string, &sql_settings.getpwuid_query, 0, NULL,
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2 Copyright (C) 1999, 2000, 2001, 2002, 2003,
3 2004, 2005, 2007 Free Software Foundation, Inc. 3 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
...@@ -63,6 +63,7 @@ struct _amd_message ...@@ -63,6 +63,7 @@ struct _amd_message
63 struct _amd_data 63 struct _amd_data
64 { 64 {
65 size_t msg_size; /* Size of struct _amd_message */ 65 size_t msg_size; /* Size of struct _amd_message */
66 int (*create) (struct _amd_data *, int flags);
66 int (*msg_init_delivery) (struct _amd_data *, struct _amd_message *); 67 int (*msg_init_delivery) (struct _amd_data *, struct _amd_message *);
67 int (*msg_finish_delivery) (struct _amd_data *, struct _amd_message *); 68 int (*msg_finish_delivery) (struct _amd_data *, struct _amd_message *);
68 void (*msg_free) (struct _amd_message *); 69 void (*msg_free) (struct _amd_message *);
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2 Copyright (C) 1999, 2000, 2001, 2002, 2003,
3 2004, 2005, 2007 Free Software Foundation, Inc. 3 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
...@@ -404,7 +404,7 @@ maildir_delete_file (char *dirname, char *filename) ...@@ -404,7 +404,7 @@ maildir_delete_file (char *dirname, char *filename)
404 404
405 405
406 406
407 int 407 static int
408 maildir_opendir (DIR **dir, char *name, int permissions) 408 maildir_opendir (DIR **dir, char *name, int permissions)
409 { 409 {
410 *dir = opendir (name); 410 *dir = opendir (name);
...@@ -424,6 +424,25 @@ maildir_opendir (DIR **dir, char *name, int permissions) ...@@ -424,6 +424,25 @@ maildir_opendir (DIR **dir, char *name, int permissions)
424 return 0; 424 return 0;
425 } 425 }
426 426
427 static int
428 maildir_create (struct _amd_data *amd, int flags)
429 {
430 static char *dirs[] = { TMPSUF, NEWSUF, CURSUF };
431 int i;
432
433 for (i = 0; i < 3; i++)
434 {
435 DIR *dir;
436 char *tmpname = maildir_mkfilename (amd->name, dirs[i], NULL);
437 int rc = maildir_opendir (&dir, tmpname, PERMS);
438 if (rc)
439 return rc;
440 closedir (dir);
441 free (tmpname);
442 }
443 return 0;
444 }
445
427 446
428 #define NTRIES 30 447 #define NTRIES 30
429 448
...@@ -738,6 +757,7 @@ _mailbox_maildir_init (mu_mailbox_t mailbox) ...@@ -738,6 +757,7 @@ _mailbox_maildir_init (mu_mailbox_t mailbox)
738 757
739 amd->msg_size = sizeof (struct _maildir_message); 758 amd->msg_size = sizeof (struct _maildir_message);
740 amd->msg_free = maildir_msg_free; 759 amd->msg_free = maildir_msg_free;
760 amd->create = maildir_create;
741 amd->msg_init_delivery = maildir_msg_init; 761 amd->msg_init_delivery = maildir_msg_init;
742 amd->msg_finish_delivery = maildir_msg_finish_delivery; 762 amd->msg_finish_delivery = maildir_msg_finish_delivery;
743 amd->cur_msg_file_name = maildir_cur_message_name; 763 amd->cur_msg_file_name = maildir_cur_message_name;
......
...@@ -335,10 +335,14 @@ amd_open (mu_mailbox_t mailbox, int flags) ...@@ -335,10 +335,14 @@ amd_open (mu_mailbox_t mailbox, int flags)
335 { 335 {
336 if ((flags & MU_STREAM_CREAT) && errno == ENOENT) 336 if ((flags & MU_STREAM_CREAT) && errno == ENOENT)
337 { 337 {
338 int rc;
339
338 if (mkdir (amd->name, S_IRUSR|S_IWUSR|S_IXUSR)) 340 if (mkdir (amd->name, S_IRUSR|S_IWUSR|S_IXUSR))
339 return errno; 341 return errno;
340 if (stat (amd->name, &st) < 0) 342 if (stat (amd->name, &st) < 0)
341 return errno; 343 return errno;
344 if (amd->create && (rc = amd->create (amd, flags)))
345 return rc;
342 } 346 }
343 else 347 else
344 return errno; 348 return errno;
......
...@@ -488,7 +488,8 @@ _cb_include (mu_debug_t debug, void *data, char *arg) ...@@ -488,7 +488,8 @@ _cb_include (mu_debug_t debug, void *data, char *arg)
488 if (S_ISDIR (sb.st_mode)) 488 if (S_ISDIR (sb.st_mode))
489 { 489 {
490 char *file = make_file_name (dirname, idp->progname); 490 char *file = make_file_name (dirname, idp->progname);
491 ret = mu_get_config (file, idp->progname, idp->progparam, 0, 491 ret = mu_get_config (file, idp->progname, idp->progparam,
492 idp->flags & ~MU_PARSE_CONFIG_GLOBAL,
492 idp->target); 493 idp->target);
493 } 494 }
494 else 495 else
...@@ -513,13 +514,11 @@ _cb_include (mu_debug_t debug, void *data, char *arg) ...@@ -513,13 +514,11 @@ _cb_include (mu_debug_t debug, void *data, char *arg)
513 } 514 }
514 515
515 struct mu_cfg_cont * 516 struct mu_cfg_cont *
516 mu_build_container (const char *progname, 517 mu_build_container (const char *progname, struct include_data *idp)
517 struct mu_cfg_param *progparam, int flags, void *target)
518 { 518 {
519 struct mu_cfg_cont *cont = root_container; 519 struct mu_cfg_cont *cont = root_container;
520 struct include_data idata;
521 struct mu_cfg_param mu_include_param[] = { 520 struct mu_cfg_param mu_include_param[] = {
522 { "include", mu_cfg_callback, &idata, 0, _cb_include, 521 { "include", mu_cfg_callback, NULL, 0, _cb_include,
523 N_("Include contents of the given file. If a directory is given, " 522 N_("Include contents of the given file. If a directory is given, "
524 "include contents of the file <file>/<program>, where <program> is " 523 "include contents of the file <file>/<program>, where <program> is "
525 "the name of the program. This latter form is allowed only in " 524 "the name of the program. This latter form is allowed only in "
...@@ -527,25 +526,23 @@ mu_build_container (const char *progname, ...@@ -527,25 +526,23 @@ mu_build_container (const char *progname,
527 N_("file-or-directory") }, 526 N_("file-or-directory") },
528 { NULL } 527 { NULL }
529 }; 528 };
530 529
530 mu_include_param[0].data = idp;
531 mu_config_clone_container (cont); 531 mu_config_clone_container (cont);
532 idata.progname = progname;
533 idata.progparam = progparam;
534 idata.flags = flags & MU_PARSE_CONFIG_GLOBAL;
535 idata.target = target;
536 _mu_config_register_section (&cont, NULL, NULL, NULL, 532 _mu_config_register_section (&cont, NULL, NULL, NULL,
537 (void*) progname, mu_include_param, NULL); 533 (void*) progname, mu_include_param, NULL);
538 if (flags & MU_PARSE_CONFIG_GLOBAL) 534 if (idp->flags & MU_PARSE_CONFIG_GLOBAL)
539 { 535 {
540 mu_iterator_t iter; 536 mu_iterator_t iter;
541 struct mu_cfg_section *prog_sect; 537 struct mu_cfg_section *prog_sect;
542 struct mu_cfg_cont *old_root = root_container; 538 struct mu_cfg_cont *old_root = root_container;
543 static struct mu_cfg_param empty_param = { NULL }; 539 static struct mu_cfg_param empty_param = { NULL };
544 if (!progparam)
545 progparam = &empty_param;
546 540
547 _mu_config_register_section (&cont, NULL, "program", progname, 541 _mu_config_register_section (&cont, NULL, "program", progname,
548 prog_parser, progparam, &prog_sect); 542 prog_parser,
543 idp->progparam ?
544 idp->progparam : &empty_param,
545 &prog_sect);
549 546
550 if (old_root->v.section.children) 547 if (old_root->v.section.children)
551 { 548 {
...@@ -562,9 +559,9 @@ mu_build_container (const char *progname, ...@@ -562,9 +559,9 @@ mu_build_container (const char *progname,
562 mu_iterator_destroy (&iter); 559 mu_iterator_destroy (&iter);
563 } 560 }
564 } 561 }
565 else if (progparam) 562 else if (idp->progparam)
566 _mu_config_register_section (&cont, NULL, NULL, NULL, NULL, 563 _mu_config_register_section (&cont, NULL, NULL, NULL, NULL,
567 progparam, NULL); 564 idp->progparam, NULL);
568 return cont; 565 return cont;
569 } 566 }
570 567
...@@ -577,8 +574,16 @@ mu_cfg_tree_reduce (mu_cfg_tree_t *parse_tree, const char *progname, ...@@ -577,8 +574,16 @@ mu_cfg_tree_reduce (mu_cfg_tree_t *parse_tree, const char *progname,
577 574
578 if (root_container) 575 if (root_container)
579 { 576 {
580 struct mu_cfg_cont *cont = mu_build_container (progname, progparam, 577 struct include_data idata;
581 flags, target_ptr); 578 struct mu_cfg_cont *cont;
579
580 idata.progname = progname;
581 idata.progparam = progparam;
582 idata.flags = flags;
583 idata.target = target_ptr;
584
585 cont = mu_build_container (progname, &idata);
586
582 rc = mu_cfg_scan_tree (parse_tree, &cont->v.section, target_ptr, 587 rc = mu_cfg_scan_tree (parse_tree, &cont->v.section, target_ptr,
583 (void*) progname); 588 (void*) progname);
584 mu_config_destroy_container (&cont); 589 mu_config_destroy_container (&cont);
...@@ -601,8 +606,14 @@ void ...@@ -601,8 +606,14 @@ void
601 mu_format_config_tree (mu_stream_t stream, const char *progname, 606 mu_format_config_tree (mu_stream_t stream, const char *progname,
602 struct mu_cfg_param *progparam, int flags) 607 struct mu_cfg_param *progparam, int flags)
603 { 608 {
604 struct mu_cfg_cont *cont = mu_build_container (progname, progparam, flags, 609 struct include_data idata;
605 NULL); 610 struct mu_cfg_cont *cont;
611
612 idata.progname = progname;
613 idata.progparam = progparam;
614 idata.flags = flags;
615 idata.target = NULL;
616 cont = mu_build_container (progname, &idata);
606 mu_cfg_format_container (stream, cont); 617 mu_cfg_format_container (stream, cont);
607 mu_config_destroy_container (&cont); 618 mu_config_destroy_container (&cont);
608 } 619 }
......
...@@ -416,7 +416,7 @@ mu_ip_tcp_accept (mu_ip_server_t srv, void *call_data) ...@@ -416,7 +416,7 @@ mu_ip_tcp_accept (mu_ip_server_t srv, void *call_data)
416 IDENTSTR (srv), strerror (rc)); 416 IDENTSTR (srv), strerror (rc));
417 if (res == mu_acl_result_deny) 417 if (res == mu_acl_result_deny)
418 { 418 {
419 char *p = mu_sockaddr_to_astr (srv->addr, srv->addrlen); 419 char *p = mu_sockaddr_to_astr (&client.sa, size);
420 mu_diag_output (MU_DIAG_INFO, "Denying connection from %s", p); 420 mu_diag_output (MU_DIAG_INFO, "Denying connection from %s", p);
421 free (p); 421 free (p);
422 422
......
...@@ -632,8 +632,8 @@ m_srv_conn (int fd, struct sockaddr *sa, int salen, ...@@ -632,8 +632,8 @@ m_srv_conn (int fd, struct sockaddr *sa, int salen,
632 children++; 632 children++;
633 } 633 }
634 } 634 }
635 else if (pconf->msrv->prefork 635 else if (!pconf->msrv->prefork
636 && pconf->msrv->prefork (fd, pconf->msrv->data, sa, salen) == 0) 636 || pconf->msrv->prefork (fd, pconf->msrv->data, sa, salen) == 0)
637 pconf->msrv->conn (fd, sa, salen, pconf->msrv->data, srv, 637 pconf->msrv->conn (fd, sa, salen, pconf->msrv->data, srv,
638 pconf->timeout, pconf->transcript); 638 pconf->timeout, pconf->transcript);
639 return 0; 639 return 0;
......