aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-03-09 23:11:02 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2011-03-09 23:11:02 +0200
commite26f01c28f5d91a9cc6dbca8af49b6bbc526ef8e (patch)
tree5e3cb135b858d3a886ad2ac8395031642b32b392
parent24e67bf1f154d15ecf6e7bbf82cd4d5a909c25ee (diff)
downloadsmap-e26f01c28f5d91a9cc6dbca8af49b6bbc526ef8e.tar.gz
smap-e26f01c28f5d91a9cc6dbca8af49b6bbc526ef8e.tar.bz2
Bugfixes.
* modules/guile/Makefile.am (BUILT_SOURCES): Don't list guile.c * modules/mailutils/mailutils.c (checksize): Rewrite as a wrapper over an auxiliary function, to avoid memory leaks on errors. Make sure res->auth always has a meaningful value. * NEWS, configure.ac: version 1.1.90
-rw-r--r--NEWS5
-rw-r--r--configure.ac2
-rw-r--r--modules/guile/Makefile.am2
-rw-r--r--modules/mailutils/mailutils.c54
4 files changed, 39 insertions, 24 deletions
diff --git a/NEWS b/NEWS
index 2a19d04..cadeb42 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,13 @@
-Smap NEWS -- history of user-visible changes. 2010-07-03
+Smap NEWS -- history of user-visible changes. 2011-03-09
Copyright (C) 2006, 2007, 2008, 2009, 2010 Sergey Poznyakoff
See the end of file for copying conditions.
Please send Smap bug reports to <gray+smap@gnu.org.ua>
+Version 1.1.90, Git
+
+
Version 1.1, 2010-07-03
* New configuration statements
diff --git a/configure.ac b/configure.ac
index 9ee1d18..3722c75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@
AC_PREREQ(2.63)
m4_define([SMAP_VERSION_MAJOR], 1)
m4_define([SMAP_VERSION_MINOR], 1)
-dnl m4_define([SMAP_VERSION_PATCH], 0)
+m4_define([SMAP_VERSION_PATCH], 90)
AC_INIT([smap],
SMAP_VERSION_MAJOR.SMAP_VERSION_MINOR[]m4_ifdef([SMAP_VERSION_PATCH],.SMAP_VERSION_PATCH),
[gray+smap@gnu.org.ua])
diff --git a/modules/guile/Makefile.am b/modules/guile/Makefile.am
index be2f4f4..3b86e93 100644
--- a/modules/guile/Makefile.am
+++ b/modules/guile/Makefile.am
@@ -24,7 +24,7 @@ AM_LDFLAGS = -module -avoid-version -no-undefined
INCLUDES = -I$(top_srcdir)/include @GUILE_INCLUDES@
SUFFIXES =
-BUILT_SOURCES = guile.c
+BUILT_SOURCES =
EXTRA_DIST = guile.x getpw.scm
DOT_X_FILES = guile.x
CLEANFILES=
diff --git a/modules/mailutils/mailutils.c b/modules/mailutils/mailutils.c
index b838317..06a9933 100644
--- a/modules/mailutils/mailutils.c
+++ b/modules/mailutils/mailutils.c
@@ -226,27 +226,14 @@ switch_user_id(struct mu_auth_data *auth, int user)
}
static int
-checksize(struct _mu_smap_db *mdb, smap_stream_t ostr,
- const char *user, struct _mu_smap_result *res,
+checksize_user(struct _mu_smap_db *mdb, smap_stream_t ostr,
+ struct _mu_smap_result *res,
char **preply)
{
- struct mu_auth_data *auth;
+ int status, rc = 0;
+ struct mu_auth_data *auth = res->auth;
mu_mailbox_t mbox;
- int status;
-
- *preply = NULL;
- auth = mu_get_auth_by_name(user);
- res->auth = auth;
- if (!auth) {
- res->diag = "user not found";
- smap_debug(dbgid, 1, ("%s: user not found", user));
- return 0;
- }
- if (switch_user_id(auth, 1)) {
- res->diag = "local system error";
- return 0;
- }
status = mu_mailbox_create_default(&mbox, auth->mailbox);
if (status) {
res->diag = "local system error";
@@ -291,16 +278,41 @@ checksize(struct _mu_smap_db *mdb, smap_stream_t ostr,
stat = mdb->positive_reply;
res->diag = "QUOTAOK";
}
- if (expand_reply_text(stat, res, preply))
- return 1;
+ rc = expand_reply_text(stat, res, preply);
}
- switch_user_id(auth, 0);
mu_mailbox_close(mbox);
}
mu_mailbox_destroy(&mbox);
- mu_auth_data_free(auth);
+ return rc;
+}
+
+static int
+checksize(struct _mu_smap_db *mdb, smap_stream_t ostr,
+ const char *user, struct _mu_smap_result *res,
+ char **preply)
+{
+ struct mu_auth_data *auth;
+ int status;
+
+ *preply = NULL;
+
+ auth = mu_get_auth_by_name(user);
+ if (!auth) {
+ res->diag = "user not found";
+ smap_debug(dbgid, 1, ("%s: user not found", user));
return 0;
}
+ if (switch_user_id(auth, 1)) {
+ res->diag = "local system error";
+ return 0;
+ }
+ res->auth = auth;
+ status = checksize_user(mdb, ostr, res, preply);
+ switch_user_id(auth, 0);
+ mu_auth_data_free(auth);
+ res->auth = NULL;
+ return status;
+}
static int
_mu_mbq_query(smap_database_t dbp,

Return to:

Send suggestions and report system problems to the System administrator.