Subject: pkg/18518: Missing uid field in pkgsrc/mail/sendmail/Makefile PKG_USERS entry
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kivinen@ssh.fi>
List: netbsd-bugs
Date: 10/03/2002 12:17:49
>Number:         18518
>Category:       pkg
>Synopsis:       Missing uid field in pkgsrc/mail/sendmail/Makefile PKG_USERS entry
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 03 02:18:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Tero Kivinen
>Release:        NetBSD 1.6
>Organization:
SSH Communications Security
>Environment:
System: NetBSD fireball.acr.fi 1.6 NetBSD 1.6 (FIREBALL) #0: Wed Oct 2 15:13:02 EEST 2002 tk@fireball.acr.fi:/usr/src/sys/arch/i386/compile/FIREBALL i386
Architecture: i386
Machine: i386
>Description:

	When installing /usr/pkgsrc/mail/sendmail the installation will
	fail if the smmsp user is not found before installation
	begins. The installation will try to create the user but it
	fails as the PKG_USER variable is set incorreclty (the uid
	field is missing), and it causes useradd to complain about
	when -u option is given the description instead of uid.

	What is really bad in here is that the .INSTALL script calling
	the useradd DOES NOT detect this but continues instead. This
	causes the sendmail installation later fail, when it tries to
	install libexec/sendmail/sendmail with user id smmsp causing
	partial installation (even this is not detected by the
	Makefile, the installation seems to be successfull but it is
	not).

	The installation will also create the /var/spool/clientmqueue
	with wrong ownership and that needs manual fixing even when
	the problem is fixed in the Makefile, as the directory is not
	createed again if it already exists, and its ownership is not
	modified (I think the makefile should fix its permissions and
	owner even if it exists before installation). 

>How-To-Repeat:

	Make sure master.passwd does not have smmsp user, go to
	pkgsrc/mail/sendmail and say make install. The make install
	seems to succeed, but no /usr/pkg/libexec/sendmail/sendmail is
	installed and the /var/spool/clientmqueue has wrong
	permissions. pkg_delete the sendmail, fix the PKG_USER line
	and reinstall. Again the installation succeeds, but the
	/var/spool/clientmqueue still has wrong permissions and this
	needs to be fixed manually before the sendmail works. 

>Fix:

Here is the diff for the base problem, but the pkgsrc system should
detect if the useradd fails and exit instead of continuing:
----------------------------------------------------------------------

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/mail/sendmail/Makefile,v
retrieving revision 1.53
diff -u -r1.53 Makefile
--- Makefile    2002/09/23 12:56:57     1.53
+++ Makefile    2002/10/03 09:08:11
@@ -90,7 +90,7 @@
 .endif
 
 PKG_GROUPS=    smmsp
-PKG_USERS=     smmsp:smmsp:Sendmail\\ Message\\ Submission\\ Program
+PKG_USERS=     smmsp:smmsp::Sendmail\\ Message\\ Submission\\ Program
 
 .include "../../mk/bsd.pkg.install.mk"
 .include "../../mk/bsd.pkg.mk"
>Release-Note:
>Audit-Trail:
>Unformatted: