summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-11-26 14:34:13 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-11-26 14:34:13 +0000
commit736f45309f3463345750cebf8616910b67b4c722 (patch)
treee629315a7aa5ea83d6fdceeb355cccb0c0944807
parentdf054f40a7a7fcd6e649ebbb071da98f2e1d971e (diff)
downloadmailutils-736f45309f3463345750cebf8616910b67b4c722.tar.gz
mailutils-736f45309f3463345750cebf8616910b67b4c722.tar.bz2
* configure.ac (MU_APP_LIBRARIES): Load libmuaux after libmuargp
and libcfg. (fgetpwent): Use AC_CHECK_FUNCS * auth/virtual.c: Use mu_fgetpwent if fgetpwent is not available. * lib/Makefile.am: Add back utmp.c * lib/utmp.c: Restore after unintended remove. * m4/utmp.m4: Fix quoting. * libcfg/gsasl.c, libcfg/ldap.c, libcfg/pam.c, libcfg/radius.c, libcfg/sieve.c, libcfg/sql.c, libcfg/tls.c, libcfg/virtdomain.c: Include stdlib.h * libproto/imap/folder.c, libproto/mbox/mbox.c, libproto/mbox/mbox0.h, libproto/pop/mbox.c, mailbox/attachment.c, mailbox/mailbox.c, mailbox/parsedate.y: Do not use alloca. * mailbox/Makefile.am (libmailutils_la_SOURCES): Add fgetpwent.c and intprops.h. * mailbox/fgetpwent.c (fgetpwent): Rename to mu_fgetpwent. * mailbox/gocs.c: Revert recent change. It broke the testsuite in sieve. * mailbox/syslog.c (log_facility): Initialize to LOG_FACILITY.
-rw-r--r--ChangeLog24
-rw-r--r--auth/virtual.c6
-rw-r--r--configure.ac4
-rw-r--r--lib/Makefile.am4
-rw-r--r--lib/utmp.c59
-rw-r--r--libcfg/gsasl.c1
-rw-r--r--libcfg/ldap.c1
-rw-r--r--libcfg/pam.c1
-rw-r--r--libcfg/radius.c1
-rw-r--r--libcfg/sieve.c1
-rw-r--r--libcfg/sql.c1
-rw-r--r--libcfg/tls.c1
-rw-r--r--libcfg/virtdomain.c1
-rw-r--r--libproto/imap/folder.c27
-rw-r--r--libproto/mbox/mbox.c7
-rw-r--r--libproto/mbox/mbox0.h4
-rw-r--r--libproto/pop/mbox.c4
-rw-r--r--m4/utmp.m44
-rw-r--r--mailbox/Makefile.am3
-rw-r--r--mailbox/attachment.c35
-rw-r--r--mailbox/fgetpwent.c3
-rw-r--r--mailbox/gocs.c5
-rw-r--r--mailbox/mailbox.c48
-rw-r--r--mailbox/parsedate.y3
-rw-r--r--mailbox/syslog.c2
25 files changed, 177 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index f61ae9726..69998d3c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
2007-11-26 Sergey Poznyakoff <gray@gnu.org.ua>
+ * configure.ac (MU_APP_LIBRARIES): Load libmuaux after libmuargp
+ and libcfg.
+ (fgetpwent): Use AC_CHECK_FUNCS
+ * auth/virtual.c: Use mu_fgetpwent if fgetpwent is not available.
+
+ * lib/Makefile.am: Add back utmp.c
+ * lib/utmp.c: Restore after unintended remove.
+ * m4/utmp.m4: Fix quoting.
+
+ * libcfg/gsasl.c, libcfg/ldap.c, libcfg/pam.c, libcfg/radius.c,
+ libcfg/sieve.c, libcfg/sql.c, libcfg/tls.c, libcfg/virtdomain.c:
+ Include stdlib.h
+
+ * libproto/imap/folder.c, libproto/mbox/mbox.c,
+ libproto/mbox/mbox0.h, libproto/pop/mbox.c, mailbox/attachment.c,
+ mailbox/mailbox.c, mailbox/parsedate.y: Do not use alloca.
+
+ * mailbox/Makefile.am (libmailutils_la_SOURCES): Add fgetpwent.c
+ and intprops.h.
+ * mailbox/fgetpwent.c (fgetpwent): Rename to mu_fgetpwent.
+ * mailbox/gocs.c: Revert recent change. It broke the testsuite in
+ sieve.
+ * mailbox/syslog.c (log_facility): Initialize to LOG_FACILITY.
+
* configure.ac, NEWS: Add LDAP support.
* auth/Makefile.am (libmuauth_la_SOURCES): Add ldap.c.
* auth/ldap.c: New file.
diff --git a/auth/virtual.c b/auth/virtual.c
index 01223d473..53719862e 100644
--- a/auth/virtual.c
+++ b/auth/virtual.c
@@ -70,6 +70,12 @@ mu_virtual_module_init (void *data)
return 0;
}
+#if !HAVE_FGETPWENT
+/* FIXME: A temporary solution. Need proper declaration in .h */
+extern struct passwd *mu_fgetpwent (FILE *fp);
+#define fgetpwent mu_fgetpwent
+#endif
+
static struct passwd *
getpwnam_virtual (const char *u)
{
diff --git a/configure.ac b/configure.ac
index 7780f342c..4843756d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,7 +50,7 @@ dnl Other variables
AC_SUBST(SIEVE_MODDIR,'$(libdir)/$(PACKAGE)')
AC_SUBST(MU_COMMON_LIBRARIES,'$(LTLIBINTL) $(LTLIBICONV)')
-AC_SUBST(MU_APP_LIBRARIES,'../lib/libmuaux.la ../libargp/libmuargp.a ../libcfg/libmucfg.la')
+AC_SUBST(MU_APP_LIBRARIES,'../libargp/libmuargp.a ../libcfg/libmucfg.la ../lib/libmuaux.la')
AC_SUBST(MU_COMMON_INCLUDES,'-I${srcdir} -I${top_srcdir}/include -I${top_srcdir}/lib -I${top_builddir}/lib -I${top_builddir} -I${top_builddir}/include -I${top_srcdir}/mailbox -I${top_srcdir}/libargp -I${top_srcdir}/libcfg')
@@ -438,7 +438,7 @@ AH_BOTTOM([
#endif
])
-AC_CHECK_FUNC(fgetpwent)
+AC_CHECK_FUNCS(fgetpwent)
## Check for presence of utmp.h and utmp-related functions
MU_CHECK_UTMP
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 4b8f80be7..6ae24202c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -31,4 +31,8 @@ noinst_HEADERS +=\
mu_dbm.h\
mu_asprintf.h
+EXTRA_DIST += utmp.c
+gl_LIBOBJS += @LIBOBJS@
+gl_LTLIBOBJS += @LTLIBOBJS@
+
diff --git a/lib/utmp.c b/lib/utmp.c
new file mode 100644
index 000000000..27d60cc9f
--- /dev/null
+++ b/lib/utmp.c
@@ -0,0 +1,59 @@
+/* utmp.c -- Replacements for {set,get,end}utmp functions
+
+Copyright (C) 2002 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public
+Licensealong with this program; if not, write to the Free
+SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+MA 02110-1301 USA. */
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <utmp.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+static char *utmp_name = _PATH_UTMP;
+static int fd = -1;
+static struct utmp ut;
+
+void
+endutent ()
+{
+ if (fd > 0)
+ close (fd);
+ fd = -1;
+}
+
+void
+setutent ()
+{
+ endutent ();
+ if ((fd = open (utmp_name, O_RDWR)) < 0
+ && ((fd = open (utmp_name, O_RDONLY)) < 0))
+ perror ("setutent: Can't open utmp file");
+}
+
+struct utmp *
+getutent ()
+{
+ if (fd < 0)
+ setutent ();
+
+ if (fd < 0 || read (fd, &ut, sizeof ut) != sizeof ut)
+ return NULL;
+
+ return &ut;
+}
diff --git a/libcfg/gsasl.c b/libcfg/gsasl.c
index 2d284d734..e45f8595a 100644
--- a/libcfg/gsasl.c
+++ b/libcfg/gsasl.c
@@ -18,6 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <stdlib.h>
#include "mailutils/libcfg.h"
#include <mailutils/gsasl.h>
diff --git a/libcfg/ldap.c b/libcfg/ldap.c
index fbd171c90..3d467e162 100644
--- a/libcfg/ldap.c
+++ b/libcfg/ldap.c
@@ -18,6 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <stdlib.h>
#include "mailutils/libcfg.h"
#include "mailutils/mutil.h"
#include "mailutils/ldap.h"
diff --git a/libcfg/pam.c b/libcfg/pam.c
index d689b1cdf..02d38ee9e 100644
--- a/libcfg/pam.c
+++ b/libcfg/pam.c
@@ -18,6 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <stdlib.h>
#include "mailutils/libcfg.h"
static char *pam_settings;
diff --git a/libcfg/radius.c b/libcfg/radius.c
index c5b37a049..4b5e7b109 100644
--- a/libcfg/radius.c
+++ b/libcfg/radius.c
@@ -18,6 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <stdlib.h>
#include "mailutils/libcfg.h"
#include <mailutils/radius.h>
diff --git a/libcfg/sieve.c b/libcfg/sieve.c
index b5ea0ba88..704cdfbad 100644
--- a/libcfg/sieve.c
+++ b/libcfg/sieve.c
@@ -18,6 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <stdlib.h>
#include "mailutils/libcfg.h"
#include <mailutils/libsieve.h>
diff --git a/libcfg/sql.c b/libcfg/sql.c
index 55914a23c..d7af25395 100644
--- a/libcfg/sql.c
+++ b/libcfg/sql.c
@@ -18,6 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <stdlib.h>
#include "mailutils/libcfg.h"
#include <mailutils/sql.h>
#include <mailutils/mutil.h>
diff --git a/libcfg/tls.c b/libcfg/tls.c
index d92a98ddf..4055c7999 100644
--- a/libcfg/tls.c
+++ b/libcfg/tls.c
@@ -18,6 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <stdlib.h>
#include "mailutils/libcfg.h"
#include <mailutils/tls.h>
diff --git a/libcfg/virtdomain.c b/libcfg/virtdomain.c
index 5a50e5df9..bd7943c33 100644
--- a/libcfg/virtdomain.c
+++ b/libcfg/virtdomain.c
@@ -18,6 +18,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <stdlib.h>
#include "mailutils/libcfg.h"
static char *virtdomain_settings;
diff --git a/libproto/imap/folder.c b/libproto/imap/folder.c
index 534003046..b504c8c63 100644
--- a/libproto/imap/folder.c
+++ b/libproto/imap/folder.c
@@ -31,10 +31,6 @@
#include <assert.h>
#include <fnmatch.h>
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
@@ -1388,7 +1384,9 @@ imap_list (f_imap_t f_imap)
int argc;
char **argv;
- buffer = alloca (len);
+ buffer = malloc (len);
+ if (!buffer)
+ return ENOMEM;
memcpy (buffer, f_imap->buffer, len);
buffer[len] = '\0';
@@ -1475,7 +1473,7 @@ imap_list (f_imap_t f_imap)
}
}
mu_argcv_free (argc, argv);
-
+ free (buffer);
return status;
}
@@ -1769,16 +1767,22 @@ imap_body (f_imap_t f_imap, char **ptr)
if (**ptr == '[')
{
char *sep = strchr (*ptr, ']');
- (*ptr)++; /* Move pass the '[' */
+ (*ptr)++; /* Move past the '[' */
if (sep)
{
size_t len = sep - *ptr;
- char *section = alloca (len + 1);
- char *p = section;
+ char *section = malloc (len + 1);
+ char *p;
+
+ if (!section)
+ return ENOMEM;
+
strncpy (section, *ptr, len);
section[len] = '\0';
/* strupper. */
- for (; *p; p++) if (isupper((unsigned)*p)) *p = toupper ((unsigned)*p);
+ for (p = section; *p; p++)
+ *p = toupper ((unsigned)*p);
+
/* Set the string type to update the correct line count. */
/*if (!strstr (section, "FIELD"))*/
{
@@ -1795,7 +1799,8 @@ imap_body (f_imap_t f_imap, char **ptr)
f_imap->string.type = IMAP_MESSAGE;
}
}
- sep++; /* Move pass the ']' */
+ free (section);
+ sep++; /* Move past the ']' */
*ptr = sep;
}
}
diff --git a/libproto/mbox/mbox.c b/libproto/mbox/mbox.c
index ac78aab69..f2409b82a 100644
--- a/libproto/mbox/mbox.c
+++ b/libproto/mbox/mbox.c
@@ -485,7 +485,9 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
/* Create temporary mu_mailbox_t. */
{
mbox_data_t tmp_mud;
- char *m = alloca (5 + strlen (tmpmboxname) + 1);
+ char *m = malloc (5 + strlen (tmpmboxname) + 1);
+ if (!m)
+ return ENOMEM;
/* Try via the mbox: protocol. */
sprintf (m, "mbox:%s", tmpmboxname);
status = mu_mailbox_create (&tmpmailbox, m);
@@ -499,11 +501,12 @@ mbox_expunge0 (mu_mailbox_t mailbox, int remove_deleted)
/* Ok give up. */
close (tempfile);
remove (tmpmboxname);
+ free (m);
free (tmpmboxname);
return status;
}
}
-
+ free (m);
/* Must be flag CREATE if not the mu_mailbox_open will try to mmap()
the file. */
status = mu_mailbox_open (tmpmailbox, MU_STREAM_CREAT | MU_STREAM_RDWR);
diff --git a/libproto/mbox/mbox0.h b/libproto/mbox/mbox0.h
index f5b897520..5f45877f6 100644
--- a/libproto/mbox/mbox0.h
+++ b/libproto/mbox/mbox0.h
@@ -38,10 +38,6 @@
# endif
#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
diff --git a/libproto/pop/mbox.c b/libproto/pop/mbox.c
index 46eb9aacd..362a70a5c 100644
--- a/libproto/pop/mbox.c
+++ b/libproto/pop/mbox.c
@@ -34,10 +34,6 @@
#include <stdarg.h>
#include <ctype.h>
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
diff --git a/m4/utmp.m4 b/m4/utmp.m4
index fe8e52915..ce9406a91 100644
--- a/m4/utmp.m4
+++ b/m4/utmp.m4
@@ -2,7 +2,7 @@ dnl MU_CHECK_UTMP -- Check for the presence of utmp.h, setutent, getutent
dnl and endutent calls.
AC_DEFUN([MU_CHECK_UTMP],
[
- AC_CHECK_HEADERS(utmp.h)
+ AC_CHECK_HEADERS([utmp.h])
# The three functions setutent,getutent and endutent depend on each other,
# so it seems reasonable to provide replacements for all three if getutent
# is not present.
@@ -10,5 +10,5 @@ AC_DEFUN([MU_CHECK_UTMP],
AC_DEFINE(HAVE_GETUTENT_CALLS,,
[Define if your system has the three ???utent functions]),
[if test "$ac_cv_header_utmp_h" = "yes"; then
- AC_LIBOBJ(utmp)
+ AC_LIBOBJ([utmp])
fi])])
diff --git a/mailbox/Makefile.am b/mailbox/Makefile.am
index e2814e2d8..b85f82c23 100644
--- a/mailbox/Makefile.am
+++ b/mailbox/Makefile.am
@@ -52,6 +52,7 @@ libmailutils_la_SOURCES = \
cfg_lexer.c\
cfg_parser.c\
envelope.c\
+ fgetpwent.c\
file_stream.c\
filter.c\
filter_iconv.c\
@@ -100,7 +101,7 @@ libmailutils_la_SOURCES = \
url.c\
version.c\
wicket.c\
- imaxtostr.c offtostr.c umaxtostr.c
+ imaxtostr.c offtostr.c umaxtostr.c intprops.h
BUILT_SOURCES = parsedate.c muerrno.c cfg_parser.c cfg_parser.h
MOSTLYCLEANFILES=
diff --git a/mailbox/attachment.c b/mailbox/attachment.c
index 0f30cf71e..550115676 100644
--- a/mailbox/attachment.c
+++ b/mailbox/attachment.c
@@ -28,10 +28,6 @@
#include <unistd.h>
#include <ctype.h>
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-
#ifdef HAVE_LIBGEN_H
# include <libgen.h>
#endif
@@ -74,7 +70,7 @@ mu_message_create_attachment (const char *content_type, const char *encoding,
mu_header_t hdr;
mu_body_t body;
mu_stream_t fstream = NULL, tstream = NULL;
- char *header, *name = NULL, *fname = NULL;
+ char *header = NULL, *name = NULL, *fname = NULL;
int ret;
if (newmsg == NULL)
@@ -96,7 +92,7 @@ mu_message_create_attachment (const char *content_type, const char *encoding,
else
name = fname;
if ((header =
- alloca (strlen (MSG_HDR) + strlen (content_type) +
+ malloc (strlen (MSG_HDR) + strlen (content_type) +
strlen (name) * 2 + strlen (encoding) + 1)) == NULL)
ret = ENOMEM;
else
@@ -124,6 +120,7 @@ mu_message_create_attachment (const char *content_type, const char *encoding,
}
}
}
+ free (header);
}
}
}
@@ -326,7 +323,6 @@ mu_message_save_attachment (mu_message_t msg, const char *filename,
size_t size;
size_t nbytes;
mu_header_t hdr;
- char *content_encoding;
const char *fname = NULL;
char *partname = NULL;
@@ -353,20 +349,26 @@ mu_message_save_attachment (mu_message_t msg, const char *filename,
{
if ((ret = mu_stream_open (info->fstream)) == 0)
{
+ char *content_encoding;
+ char *content_encoding_mem = NULL;
+
mu_header_get_value (hdr, "Content-Transfer-Encoding", NULL, 0,
&size);
if (size)
{
- if ((content_encoding = alloca (size + 1)) == NULL)
+ content_encoding_mem = malloc (size + 1);
+ if (content_encoding_mem == NULL)
ret = ENOMEM;
+ content_encoding = content_encoding_mem;
mu_header_get_value (hdr, "Content-Transfer-Encoding",
content_encoding, size + 1, 0);
}
else
- content_encoding = (char *) "7bit";
+ content_encoding = "7bit";
ret =
mu_filter_create (&info->stream, istream, content_encoding,
MU_FILTER_DECODE, MU_STREAM_READ);
+ free (content_encoding_mem);
}
}
}
@@ -402,8 +404,8 @@ mu_message_save_attachment (mu_message_t msg, const char *filename,
}
/* Free fname if we allocated it. */
- if(partname)
- free(partname);
+ if (partname)
+ free (partname);
return ret;
}
@@ -473,7 +475,6 @@ mu_message_unencapsulate (mu_message_t msg, mu_message_t * newmsg, void **data)
{
size_t size, nbytes;
int ret = 0;
- char *content_type;
mu_header_t hdr;
mu_stream_t istream, ostream;
struct _msg_info *info = NULL;
@@ -489,12 +490,14 @@ mu_message_unencapsulate (mu_message_t msg, mu_message_t * newmsg, void **data)
mu_header_get_value (hdr, "Content-Type", NULL, 0, &size);
if (size)
{
- if ((content_type = alloca (size + 1)) == NULL)
+ char *content_type;
+ if ((content_type = malloc (size + 1)) == NULL)
return ENOMEM;
mu_header_get_value (hdr, "Content-Type", content_type, size + 1, 0);
- if (strncasecmp
- (content_type, "message/rfc822",
- strlen ("message/rfc822")) != 0)
+ ret = strncasecmp (content_type, "message/rfc822",
+ strlen ("message/rfc822"));
+ free (content_type);
+ if (ret != 0)
return EINVAL;
}
else
diff --git a/mailbox/fgetpwent.c b/mailbox/fgetpwent.c
index 79a3b9bbb..68b83cee0 100644
--- a/mailbox/fgetpwent.c
+++ b/mailbox/fgetpwent.c
@@ -40,7 +40,6 @@ static char *buffer;
static size_t buflen;
static struct passwd pw;
-
static char *
parse_line (char *s, char **p)
{
@@ -81,7 +80,7 @@ getentry (char *s)
}
struct passwd *
-fgetpwent (FILE *fp)
+mu_fgetpwent (FILE *fp)
{
size_t pos = 0;
int done = 0;
diff --git a/mailbox/gocs.c b/mailbox/gocs.c
index 510a3543d..d85bd788d 100644
--- a/mailbox/gocs.c
+++ b/mailbox/gocs.c
@@ -212,10 +212,7 @@ mu_gocs_logging_init (void *data)
mu_debug_default_printer = mu_debug_syslog_printer;
}
else
- {
- log_facility = LOG_FACILITY;
- mu_debug_default_printer = mu_debug_stderr_printer;
- }
+ mu_debug_default_printer = mu_debug_stderr_printer;
/* FIXME: Tag */
return 0;
diff --git a/mailbox/mailbox.c b/mailbox/mailbox.c
index 0a56f3f2e..eaf17c358 100644
--- a/mailbox/mailbox.c
+++ b/mailbox/mailbox.c
@@ -23,7 +23,6 @@
#include <stdlib.h>
#include <errno.h>
-#include <alloca.h>
#include <string.h>
#include <mailutils/debug.h>
@@ -85,28 +84,11 @@ mu_mailbox_get_default_proto ()
return default_proto ? default_proto : "/";
}
-/* The Mailbox Factory.
- Create an iterator for registrar and see if any url scheme match,
- Then we call the mailbox's mu_url_create() to parse the URL. Last
- initialize the concrete mailbox and folder. */
-int
-mu_mailbox_create (mu_mailbox_t *pmbox, const char *name)
+static int
+_create_mailbox (mu_mailbox_t *pmbox, const char *name)
{
mu_record_t record = NULL;
-
- if (pmbox == NULL)
- return MU_ERR_OUT_PTR_NULL;
- if (!mu_is_proto (name) && default_proto)
- {
- char *tmp_name = alloca (strlen (default_proto) + strlen (name) + 1);
- if (!tmp_name)
- return ENOMEM;
- strcpy (tmp_name, default_proto);
- strcat (tmp_name, name);
- name = tmp_name;
- }
-
if (mu_registrar_lookup (name, MU_FOLDER_ATTRIBUTE_FILE, &record, NULL) == 0)
{
int (*m_init) (mu_mailbox_t) = NULL;
@@ -159,10 +141,34 @@ mu_mailbox_create (mu_mailbox_t *pmbox, const char *name)
return status;
}
}
-
return MU_ERR_NO_HANDLER;
}
+/* The Mailbox Factory.
+ Create an iterator for registrar and see if any url scheme match,
+ Then we call the mailbox's mu_url_create() to parse the URL. Last
+ initialize the concrete mailbox and folder. */
+int
+mu_mailbox_create (mu_mailbox_t *pmbox, const char *name)
+{
+ int rc;
+
+ if (pmbox == NULL)
+ return MU_ERR_OUT_PTR_NULL;
+
+ if (!mu_is_proto (name) && default_proto)
+ {
+ char *tmp_name = malloc (strlen (default_proto) + strlen (name) + 1);
+ strcpy (tmp_name, default_proto);
+ strcat (tmp_name, name);
+ rc = _create_mailbox (pmbox, name);
+ free (name);
+ }
+ else
+ rc = _create_mailbox (pmbox, name);
+ return rc;
+}
+
void
mu_mailbox_destroy (mu_mailbox_t *pmbox)
{
diff --git a/mailbox/parsedate.y b/mailbox/parsedate.y
index 3f9d2294e..96c7892c8 100644
--- a/mailbox/parsedate.y
+++ b/mailbox/parsedate.y
@@ -26,9 +26,6 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
-# ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-# endif
#endif
#include <stdio.h>
diff --git a/mailbox/syslog.c b/mailbox/syslog.c
index 4e783cf06..ee2831064 100644
--- a/mailbox/syslog.c
+++ b/mailbox/syslog.c
@@ -107,4 +107,4 @@ mu_syslog_priority_to_string (int n)
}
-int log_facility;
+int log_facility = LOG_FACILITY;

Return to:

Send suggestions and report system problems to the System administrator.