Commit c060b5fd c060b5fddd1ae0a06089df418c4cb4393b2de615 by Sergey Poznyakoff

* TODO, NEWS: Update.

* mailbox/msrv.c: New file.
* mailbox/Makefile.am: Add msrv.c.
* include/mailutils/server.h (mu_tcp_server_conn_fp): Take
sockaddr as argument
(mu_tcp_server_create,mu_tcp_server_get_sockaddr): Likewise.
(mu_m_server_*): New prototypes.
* include/mailutils/types.hin (mu_m_server_t): New type.
* mailbox/acl.c: Fix debugging output.
(mu_sockaddr_to_str, mu_sockaddr_to_astr): New functions.

* mailbox/tcpsrv.c: Handle AF_INET and AF_UNIX sockets.
* examples/echosrv.c: Update mu_tcp_server_* calls.
* examples/config/Makefile.am: Remove comsat.conf and
mailutils.rc.

* imap4d/imap4d.c, imap4d/imap4d.h, imap4d/signal.c,
maidag/lmtp.c, maidag/maidag.c, maidag/maidag.h, pop3d/extra.c,
pop3d/pop3d.c, pop3d/pop3d.h, pop3d/signal.c: Rewrite using
m-server.

* include/mailutils/cfg.h (mu_offsetof): Bug fix.
* mailbox/cfg_driver.c (dup_container): Bugfix. Offset was not
copied.
(mu_cfg_section_add_params): If identifier starts with a dot, it
is hidden, i.e. its substatements are copied directly into the
parent structure.
* mailbox/cfg_lexer.c (isword): Take care of opening braces.
(default_lexer): Several fixes.
* mailbox/cfg_parser.y (mu_cfg_parse): Initialize debugging level
from global settings.
(_scan_tree_helper): Ensure debugging object has correct locus
information before calling the section parser.
(mu_cfg_scan_tree): If no debugging object is supplied, use the
one from diag.c
* mailbox/daemon.c (mu_daemon_create_pidfile): Return a meaningful
error code.
* mailbox/debug.c (mu_debug_create): Initialize printer to NULL.
(mu_debug_vprintf): If printer is NULL, use
mu_debug_default_printer.
(mu_debug_check_level): Bugfix.

* mailbox/server.c: Minor indentation fix.
* mailbox/syslog.c (mu_diag_syslog_printer): Chop off \r as well.
* mailbox/folder.c (mu_folder_create_from_record): Bugfixes.

* include/mailutils/debug.hm4 (mu_sockaddr_to_str)
(mu_sockaddr_to_astr): New functions.

* include/mailutils/.cvsignore: Add debug.h

* po/POTFILES.in: Update.
1 parent c51fa40b
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2001, 2002, 2003, 2005, 2 Copyright (C) 1999, 2001, 2002, 2003, 2005,
3 2007 Free Software Foundation, Inc. 3 2007, 2008 Free Software Foundation, Inc.
4 4
5 GNU Mailutils is free software; you can redistribute it and/or modify 5 GNU Mailutils is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
...@@ -202,6 +202,22 @@ pop3d_is_master () ...@@ -202,6 +202,22 @@ pop3d_is_master ()
202 return ostream == NULL; 202 return ostream == NULL;
203 } 203 }
204 204
205 static void
206 transcript (const char *pfx, const char *buf)
207 {
208 if (pop3d_transcript)
209 {
210 int len = strlen (buf);
211 if (len > 0 && buf[len-1] == '\n')
212 {
213 len--;
214 if (len > 0 && buf[len-1] == '\r')
215 len--;
216 }
217 mu_diag_output (MU_DIAG_DEBUG, "%s: %-.*s", pfx, len, buf);
218 }
219 }
220
205 void 221 void
206 pop3d_outf (const char *fmt, ...) 222 pop3d_outf (const char *fmt, ...)
207 { 223 {
...@@ -216,8 +232,7 @@ pop3d_outf (const char *fmt, ...) ...@@ -216,8 +232,7 @@ pop3d_outf (const char *fmt, ...)
216 if (!buf) 232 if (!buf)
217 pop3d_abquit (ERR_NO_MEM); 233 pop3d_abquit (ERR_NO_MEM);
218 234
219 if (mu_gocs_daemon.transcript) 235 transcript ("sent", buf);
220 mu_diag_output (MU_DIAG_DEBUG, "sent: %s", buf);
221 236
222 rc = mu_stream_sequential_write (ostream, buf, strlen (buf)); 237 rc = mu_stream_sequential_write (ostream, buf, strlen (buf));
223 free (buf); 238 free (buf);
...@@ -232,7 +247,6 @@ pop3d_outf (const char *fmt, ...) ...@@ -232,7 +247,6 @@ pop3d_outf (const char *fmt, ...)
232 } 247 }
233 } 248 }
234 249
235
236 /* Gets a line of input from the client, caller should free() */ 250 /* Gets a line of input from the client, caller should free() */
237 char * 251 char *
238 pop3d_readline (char *buffer, size_t size) 252 pop3d_readline (char *buffer, size_t size)
...@@ -240,7 +254,7 @@ pop3d_readline (char *buffer, size_t size) ...@@ -240,7 +254,7 @@ pop3d_readline (char *buffer, size_t size)
240 int rc; 254 int rc;
241 size_t nbytes; 255 size_t nbytes;
242 256
243 alarm (mu_gocs_daemon.timeout); 257 alarm (idle_timeout);
244 rc = mu_stream_sequential_readline (istream, buffer, size, &nbytes); 258 rc = mu_stream_sequential_readline (istream, buffer, size, &nbytes);
245 alarm (0); 259 alarm (0);
246 260
...@@ -259,8 +273,7 @@ pop3d_readline (char *buffer, size_t size) ...@@ -259,8 +273,7 @@ pop3d_readline (char *buffer, size_t size)
259 pop3d_abquit (ERR_NO_OFILE); 273 pop3d_abquit (ERR_NO_OFILE);
260 } 274 }
261 275
262 if (mu_gocs_daemon.transcript) 276 transcript ("recv", buffer);
263 mu_diag_output (MU_DIAG_DEBUG, "recv: %s", buffer);
264 277
265 /* Caller should not free () this ... should we strdup() then? */ 278 /* Caller should not free () this ... should we strdup() then? */
266 return buffer; 279 return buffer;
......
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 GNU Mailutils is free software; you can redistribute it and/or modify 5 GNU Mailutils is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
...@@ -156,6 +156,7 @@ extern int expire_on_exit; ...@@ -156,6 +156,7 @@ extern int expire_on_exit;
156 #include <mailutils/url.h> 156 #include <mailutils/url.h>
157 #include <mailutils/md5.h> 157 #include <mailutils/md5.h>
158 #include <mailutils/acl.h> 158 #include <mailutils/acl.h>
159 #include <mailutils/server.h>
159 160
160 /* For Berkley DB2 APOP password file */ 161 /* For Berkley DB2 APOP password file */
161 #ifdef HAVE_DB_H 162 #ifdef HAVE_DB_H
...@@ -205,6 +206,9 @@ extern int expire_on_exit; ...@@ -205,6 +206,9 @@ extern int expire_on_exit;
205 #define ERR_TLS_IO 18 206 #define ERR_TLS_IO 18
206 #define ERR_LOGIN_DELAY 19 207 #define ERR_LOGIN_DELAY 19
207 208
209 typedef struct mu_pop_server *mu_pop_server_t;
210
211 extern mu_pop_server_t pop3srv;
208 extern mu_mailbox_t mbox; 212 extern mu_mailbox_t mbox;
209 extern int state; 213 extern int state;
210 extern int initial_state; 214 extern int initial_state;
...@@ -220,6 +224,8 @@ extern int tls_done; ...@@ -220,6 +224,8 @@ extern int tls_done;
220 #endif /* WITH_TLS */ 224 #endif /* WITH_TLS */
221 extern int undelete_on_startup; 225 extern int undelete_on_startup;
222 extern struct mu_auth_data *auth_data; 226 extern struct mu_auth_data *auth_data;
227 extern unsigned int idle_timeout;
228 extern int pop3d_transcript;
223 229
224 extern void pop3d_bye (void); 230 extern void pop3d_bye (void);
225 extern int pop3d_abquit (int); 231 extern int pop3d_abquit (int);
...@@ -238,7 +244,6 @@ extern int pop3d_retr (const char *); ...@@ -238,7 +244,6 @@ extern int pop3d_retr (const char *);
238 extern int pop3d_rset (const char *); 244 extern int pop3d_rset (const char *);
239 extern void process_cleanup (void); 245 extern void process_cleanup (void);
240 246
241 extern RETSIGTYPE pop3d_sigchld (int);
242 extern RETSIGTYPE pop3d_signal (int); 247 extern RETSIGTYPE pop3d_signal (int);
243 extern int pop3d_stat (const char *); 248 extern int pop3d_stat (const char *);
244 #ifdef WITH_TLS 249 #ifdef WITH_TLS
......
1
2 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
3 Copyright (C) 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000, 2001, 2002, 2007, 2008
3 Free Software Foundation, Inc.
4 4
5 GNU Mailutils is free software; you can redistribute it and/or modify 5 GNU Mailutils is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
...@@ -19,30 +19,6 @@ ...@@ -19,30 +19,6 @@
19 19
20 #include "pop3d.h" 20 #include "pop3d.h"
21 21
22 static int need_cleanup = 0;
23
24 void
25 process_cleanup ()
26 {
27 pid_t pid;
28 int status;
29
30 if (need_cleanup)
31 {
32 need_cleanup = 0;
33 while ( (pid = waitpid (-1, &status, WNOHANG)) > 0)
34 --children;
35 }
36 }
37
38 RETSIGTYPE
39 pop3d_sigchld (int signo MU_ARG_UNUSED)
40 {
41 need_cleanup = 1;
42 #ifndef HAVE_SIGACTION
43 signal (signo, pop3d_sigchld);
44 #endif
45 }
46 22
47 /* Default signal handler to call the pop3d_abquit() function */ 23 /* Default signal handler to call the pop3d_abquit() function */
48 24
......