[Pkg-shadow-devel] [PATCH] Removed hard-coded default mail spool in useradd
Serge E. Hallyn
serge at hallyn.com
Mon Mar 9 15:53:58 GMT 2020
Do you mind sending a PR to github.com/shadow-maint/shadow?
On Mon, Mar 09, 2020 at 11:33:32AM +0000, Geoffrey Krug wrote:
> The useradd program should be consistent with userdel and usermod and use the
> MAIL_SPOOL_DIR variable as the default spool, if it is defined. Otherwise,
> don't create a new mailbox, because it won't be cleaned up by userdel when run
> with the -r flag.
> ---
> src/useradd.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/useradd.c b/src/useradd.c
> index 645d4a40..62c74379 100644
> --- a/src/useradd.c
> +++ b/src/useradd.c
> @@ -2203,8 +2203,13 @@ static void create_mail (void)
> mode_t mode;
>
> spool = getdef_str ("MAIL_DIR");
> +#ifdef MAIL_SPOOL_DIR
> + if ((NULL == spool) && (getdef_str ("MAIL_FILE") == NULL)) {
> + spool = MAIL_SPOOL_DIR;
> + }
> +#endif /* MAIL_SPOOL_DIR */
> if (NULL == spool) {
> - spool = "/var/mail";
> + return;
> }
> file = alloca (strlen (prefix) + strlen (spool) + strlen (user_name) + 2);
> if(prefix[0])
> --
> 2.15.3.AMZN
>
>
> _______________________________________________
> Pkg-shadow-devel mailing list
> Pkg-shadow-devel at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-shadow-devel
More information about the Pkg-shadow-devel
mailing list