This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Mailutils".
http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=131ddb25a51862bb31fe5fd7a1111896fbb20c58 The branch, master has been updated via 131ddb25a51862bb31fe5fd7a1111896fbb20c58 (commit) from 22b58503041ddd74f2919e28bcbdd08a278dccc5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 131ddb25a51862bb31fe5fd7a1111896fbb20c58 Author: Sergey Poznyakoff <g...@gnu.org> Date: Sun May 3 20:14:18 2015 +0300 Honor MAIL and FOLDER envars if _mu_mailbox_pattern is not set. The _mu_mailbox_pattern variable is supposed to be set only from configuration file. However, the mu_mailbox_url function would also set it as a side effect. This produced strange results; in particular unsetting HOME variable caused mail utilities to ignore MAIL variable as well (as reported by Dan Jacobson on 2015-04-30, <87vbgemcc7....@jidanni.org>). * configure.ac (MU_PATH_MAILDIR): Don't end with a slash. * libmailutils/mailbox/mbx_default.c (mu_normalize_mailbox_url): Use mu_make_file_name. (mu_mailbox_url): Don't set _mu_mailbox_pattern. ----------------------------------------------------------------------- Summary of changes: configure.ac | 2 +- libmailutils/mailbox/mbx_default.c | 52 ++++++++++++----------------------- 2 files changed, 19 insertions(+), 35 deletions(-) diff --git a/configure.ac b/configure.ac index 1dabd30..57cebb8 100644 --- a/configure.ac +++ b/configure.ac @@ -350,7 +350,7 @@ AH_BOTTOM( #ifdef MU_CONF_MAILDIR # define MU_PATH_MAILDIR MU_CONF_MAILDIR #else -# define MU_PATH_MAILDIR PATH_MAILDIR "/" +# define MU_PATH_MAILDIR PATH_MAILDIR #endif]) ################################## diff --git a/libmailutils/mailbox/mbx_default.c b/libmailutils/mailbox/mbx_default.c index 3f8238e..ab93fff 100644 --- a/libmailutils/mailbox/mbx_default.c +++ b/libmailutils/mailbox/mbx_default.c @@ -49,12 +49,12 @@ static char *_mu_mailbox_pattern; static char *_default_folder_dir = "Mail"; static char *_mu_folder_dir; +#define USERSUFFIX "${user}" + static int mu_normalize_mailbox_url (char **pout, const char *dir) { int len; - int addslash = 0; -#define USERSUFFIX "${user}" if (!pout) return MU_ERR_OUT_PTR_NULL; @@ -67,18 +67,12 @@ mu_normalize_mailbox_url (char **pout, const char *dir) else return MU_ERR_BAD_FILENAME; } - else if (dir[len-1] != '/') - addslash = 1; + else + *pout = mu_make_file_name (dir, USERSUFFIX); - *pout = malloc (strlen (dir) + (addslash ? 1 : 0) + sizeof USERSUFFIX); if (!*pout) - return ENOMEM; + return errno; - strcpy (*pout, dir); - if (addslash) - strcat (*pout, "/"); - strcat (*pout, USERSUFFIX); -#undef USERSUFFIX return 0; } @@ -129,9 +123,9 @@ mu_set_folder_directory (const char *p) const char * mu_mailbox_url () { - if (!_mu_mailbox_pattern) - mu_set_mail_directory (MU_PATH_MAILDIR); - return _mu_mailbox_pattern; + if (_mu_mailbox_pattern) + return _mu_mailbox_pattern; + return MU_PATH_MAILDIR "/" USERSUFFIX; } const char * @@ -145,6 +139,7 @@ mu_folder_directory () int mu_construct_user_mailbox_url (char **pout, const char *name) { + int rc; const char *pat = mu_mailbox_url (); const char *env[3]; struct mu_wordsplit ws; @@ -153,13 +148,15 @@ mu_construct_user_mailbox_url (char **pout, const char *name) env[1] = (char*) name; env[2] = NULL; ws.ws_env = env; - if (mu_wordsplit (pat, &ws, - MU_WRDSF_NOSPLIT | MU_WRDSF_NOCMD | - MU_WRDSF_ENV | MU_WRDSF_ENV_KV)) + rc = mu_wordsplit (pat, &ws, + MU_WRDSF_NOSPLIT | MU_WRDSF_NOCMD | + MU_WRDSF_ENV | MU_WRDSF_ENV_KV); + + if (rc) { mu_error (_("cannot expand line `%s': %s"), pat, mu_wordsplit_strerror (&ws)); - return errno; + return rc; } if (ws.ws_wordc == 0) @@ -173,9 +170,6 @@ mu_construct_user_mailbox_url (char **pout, const char *name) return 0; } -/* Is this a security risk? */ -#define USE_ENVIRON 1 - static int split_shortcut (const char *file, const char pfx[], char **user, char **rest) { @@ -239,7 +233,6 @@ get_homedir (const char *user) } else { -#ifdef USE_ENVIRON /* NOTE: Should we honor ${HOME}? */ homedir = getenv ("HOME"); if (homedir == NULL) @@ -248,11 +241,6 @@ get_homedir (const char *user) if (auth) homedir = auth->dir; } -#else - auth = mu_get_auth_by_name (user); - if (auth) - homedir = auth->dir; -#endif } if (homedir) @@ -264,10 +252,8 @@ get_homedir (const char *user) static int user_mailbox_name (const char *user, char **mailbox_name) { -#ifdef USE_ENVIRON if (!user) user = (getenv ("LOGNAME")) ? getenv ("LOGNAME") : getenv ("USER"); -#endif if (user) { @@ -416,10 +402,8 @@ mu_mailbox_create_default (mu_mailbox_t *pmbox, const char *mail) use FOLDER instead, to not confuse others by using MAIL. */ mail = getenv ("FOLDER"); if (!mail) - { - /* Fallback to well-known environment. */ - mail = getenv ("MAIL"); - } + /* Fallback to well-known environment. */ + mail = getenv ("MAIL"); } if (!mail) @@ -429,7 +413,7 @@ mu_mailbox_create_default (mu_mailbox_t *pmbox, const char *mail) mail = tmp_mbox; } } - + p = mu_tilde_expansion (mail, MU_HIERARCHY_DELIMITER, NULL); if (tmp_mbox) free (tmp_mbox); hooks/post-receive -- GNU Mailutils _______________________________________________ Commit-mailutils mailing list Commit-mailutils@gnu.org https://lists.gnu.org/mailman/listinfo/commit-mailutils