Bug 24742

Summary: send adduser.message before dirs are created
Product: Base System Reporter: root <root>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-RELEASE   
Hardware: Any   
OS: Any   

Description root 2001-01-30 21:10:01 UTC
when using adduser in a setting where Maildirs are used the complementary
adduser.message can not be delivered since it gets send before the
actual userdirs have been created and filled from skeleton. Hence
postfix, in my case, will complain.

Fix: 

haven't looked at it. Work around is to not send the message.
How-To-Repeat: 
adding an user when running with, say, postfix though I'm sure
qmail will have the same problem.
Comment 1 Alex Kapranoff 2001-01-31 06:21:17 UTC
On Tue, Jan 30, 2001 at 10:01:09PM +0100, root@nl.nisser.com wrote:
> 
> >Number:         24742
> >Category:       bin
> >Synopsis:       send adduser.message before dirs are created

> >Description:
> 
> when using adduser in a setting where Maildirs are used the complementary
> adduser.message can not be delivered since it gets send before the
> actual userdirs have been created and filled from skeleton. Hence
> postfix, in my case, will complain.

Applying this patch in /usr/src/usr.sbin/adduser/ should fix it for
some values of 'fix':

--- /usr/src/usr.sbin/adduser/adduser.perl	Thu Dec 14 22:12:25 2000
+++ adduser.perl	Wed Jan 31 09:14:00 2001
@@ -711,9 +711,9 @@
 	    &new_users_pwdmkdb("$new_entry");
 	    &new_users_group_update;
 	    &new_users_passwd_update;  print "Added user ``$name''\n";
-	    &new_users_sendmessage;
 	    &adduser_log("$name:*:$u_id:$g_id($group_login):$fullname");
 	    &home_create($userhome, $name, $group_login);
+	    &new_users_sendmessage;
 	} else {
 	    $new_users_ok = 0;
 	}

-- 
Alex Kapranoff,                              Voice: +7(0832)791845
We've lived 30 days in the brand new millenium...
Comment 2 roelof 2001-01-31 19:40:33 UTC
Alex Kapranoff wrote:
> 
> -           &new_users_sendmessage;
>             &adduser_log("$name:*:$u_id:$g_id($group_login):$fullname");
>             &home_create($userhome, $name, $group_login);
> +           &new_users_sendmessage;

Alas:

Jan 31 20:33:47 nl postfix/local[7151]: 0FDBA12C31:
to=<vmail@nl.nisser.com>, relay=local, delay=1, status=bounced (maildir
delivery failed: create
/home/vmail/Maildir/tmp/980969627.7151_0.nl.nisser.com: Permission
denied)

That is after application:

nl:/usr/src/usr.sbin/adduser# diff adduser.perl.org adduser.perl
714d713
<           &new_users_sendmessage;
716a716
>             &new_users_sendmessage;



-- 
Home is where the (@) http://eboa.com/ is.
Nisser home -- http://nl.nisser.com/
Comment 3 Alex Kapranoff 2001-02-12 14:45:21 UTC
On Fri, Feb 02, 2001 at 02:27:27PM +0100, Roelof Osinga wrote:
> Alex Kapranoff wrote:
> > 
> > ...
> > Roelof,
> > you probably applied the patch to the sources and didn't remake and
> > reinstall them. I'm sorry to lead you into confusion. Try this:
> > ...
> >   Yeah, you patched the sources. Now install'em!
> 
> You betcha I did. If I can do anything wrong, I'll do it! Besides
> smooth sailing quickly becomes boring <g>.
> 
> I'll patch /usr/sbin/adduser before the next users and will let
> you know. Mind you, this does explain why the patch didn't work.
> And the 'funny' extension, too! ;).

That's fine. And next time please keep
FreeBSD-gnats-submit@freebsd.org on Cc: list so that you feedback
stay in PR database forever.

> Maybe I ought to have my head examined. Nah, he'll just say that
> would be crazy <g>.
> 
> Roelof

-- 
Alex Kapranoff,                              Voice: +7(0832)791845
We've lived 6 weeks in the brand new millenium...
Comment 4 Mike Makonnen freebsd_committer freebsd_triage 2003-02-22 23:42:05 UTC
State Changed
From-To: open->closed

The new adduser(8) sends the mail message _after_ creating 
the user, so this is no longer an issue.