From owner-freebsd-ports Mon Mar 25 17:50:17 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0DB0F37B419 for ; Mon, 25 Mar 2002 17:50:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g2Q1o1h80183; Mon, 25 Mar 2002 17:50:01 -0800 (PST) (envelope-from gnats) Received: from h1.generalresources.com (h1.generalresources.com [211.21.66.250]) by hub.freebsd.org (Postfix) with ESMTP id 4938F37B416; Mon, 25 Mar 2002 17:47:44 -0800 (PST) Received: from server.tucheng.generalresources.com (int-1-253.generalresources.com [192.168.1.253]) by h1.generalresources.com (8.11.6/8.11.6) with ESMTP id g2Q1lbU39515; Tue, 26 Mar 2002 09:47:37 +0800 (CST) (envelope-from hsw@generalresources.com) Received: from x4.tucheng.generalresources.com (x4.tucheng.generalresources.com [192.168.2.4]) by server.tucheng.generalresources.com (8.11.4/8.11.4) with ESMTP id g2Q1laL87999; Tue, 26 Mar 2002 09:47:36 +0800 (CST) (envelope-from hsw@generalresources.com) Received: (from hsw@localhost) by x4.tucheng.generalresources.com (8.11.6/8.11.6) id g2Q1lXa38915; Tue, 26 Mar 2002 09:47:33 +0800 (CST) (envelope-from hsw) Message-Id: <200203260147.g2Q1lXa38915@x4.tucheng.generalresources.com> Date: Tue, 26 Mar 2002 09:47:33 +0800 (CST) From: Christopher Hall Reply-To: Christopher Hall To: FreeBSD-gnats-submit@FreeBSD.org Cc: dwcjr@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/36318: net/samba: printing fails, smbpasswd stored in package [patch] Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 36318 >Category: ports >Synopsis: net/samba: printing fails, smbpasswd stored in package [patch] >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 25 17:50:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Christopher Hall >Release: FreeBSD 4.5-STABLE i386 >Organization: >Environment: System: FreeBSD x4.tucheng.generalresources.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Mon Mar 25 11:37:41 CST 2002 toor@x4.tucheng.generalresources.com:/usr/obj/usr/src/sys/GENERIC i386 >Description: A. samba2.2.3a compiled with "make package" and the package installed an a freshly installed FreeBSD installation, printing fails. After investigation I found that "/var/spool/samba" was not created by the pkg_add. B. When I recompiled it as "make PACKAGE_BUILDING=yes package" it added my "/usr/local/private/smbpasswd" to the package. Which contained all the usernames/passwords from the machine I generated the package on. C. samba-devel looks like it may have the same problem as the Makefiles are similar. >How-To-Repeat: machine 1: cd /usr/ports/net/samba && make package OR: cd /usr/ports/net/samba && make PACKAGE_BUILDING=yes package machine 2: pkg_add samba-2.2.3a.tgz >Fix: Patch the Makefile: The patch below appends @exec/@unexec code to the TMPPLIST for creating and removing "PREFIX/private" and "/var/spool/samba". PREFIX is substituted to "%D". "/var" remains as an absolute path in the +CONTENTS file. --- Makefile.orig Mon Mar 18 08:34:19 2002 +++ Makefile Tue Mar 26 09:29:22 2002 @@ -89,6 +89,8 @@ MAN8= nmbd.8 smbd.8 smbmnt.8 smbmount.8 \ smbpasswd.8 smbspool.8 smbumount.8 swat.8 winbindd.8 +SED_PLIST= ${SED} -e 's!${PREFIX}!%D!g' + post-install: ${MKDIR} ${PREFIX}/share/examples/samba ${CP} -rp ${WRKDIR}/${DISTNAME}/examples/* ${PREFIX}/share/examples/samba @@ -111,19 +113,27 @@ ${CHOWN} root:wheel ${SAMBA_PRIVATE} ; \ fi ${CHMOD} 700 ${SAMBA_PRIVATE} + if [ ! -f ${SAMBA_PRIVATE}/smbpasswd.default ] ; then \ + ${CAT} /etc/passwd | ${GREP} -v "^#" | ${PREFIX}/bin/make_smbpasswd > ${SAMBA_PRIVATE}/smbpasswd.default ; \ + ${CHMOD} 600 ${SAMBA_PRIVATE}/smbpasswd.default ; \ + fi if [ ! -f ${SAMBA_PRIVATE}/smbpasswd ] ; then \ - ${CAT} /etc/passwd | ${GREP} -v "^#" | ${PREFIX}/bin/make_smbpasswd > ${SAMBA_PRIVATE}/smbpasswd ; \ - ${CHMOD} 600 ${SAMBA_PRIVATE}/smbpasswd ; \ + ${CP} -p ${SAMBA_PRIVATE}/smbpasswd.default ${SAMBA_PRIVATE}/smbpasswd ; \ + ${CHMOD} 600 ${SAMBA_PRIVATE}/smbpasswd ; \ fi ${CHMOD} 500 ${SAMBA_PRIVATE} ${CHOWN} root:wheel ${PREFIX}/bin/smbpasswd ${CHMOD} 111 ${PREFIX}/bin/smbpasswd -.if defined(PACKAGE_BUILDING) - ${ECHO_CMD} "private/smbpasswd" >> ${TMPPLIST} - ${ECHO_CMD} "@dirrm private" >> ${TMPPLIST} -.else - ${ECHO_CMD} "@unexec ${ECHO_CMD} \"Warning: If you will *NOT* use this package anymore, please remove %D/private/smbpasswd manually.\"" >> ${TMPPLIST} -.endif + ${ECHO_CMD} "@exec ${TEST} -d ${SAMBA_SPOOL} || ${MKDIR} ${SAMBA_SPOOL} && ${CHMOD} 1777 ${SAMBA_SPOOL}" | ${SED_PLIST} >> ${TMPPLIST} + ${ECHO_CMD} "@unexec ${RM} -rf ${SAMBA_SPOOL}" | ${SED_PLIST} >> ${TMPPLIST} + ${ECHO_CMD} "@exec ${MKDIR} -m 500 ${SAMBA_PRIVATE}" | ${SED_PLIST} >> ${TMPPLIST} + ${ECHO_CMD} "@exec ${CHOWN} root:wheel ${SAMBA_PRIVATE}" | ${SED_PLIST} >> ${TMPPLIST} + ${ECHO_CMD} "@exec ${CAT} /etc/passwd | ${GREP} -v "^#" | ${PREFIX}/bin/make_smbpasswd > ${SAMBA_PRIVATE}/smbpasswd.default" | ${SED_PLIST} >> ${TMPPLIST} + ${ECHO_CMD} "@exec ${TEST} -e ${SAMBA_PRIVATE}/smbpasswd || ${CP} -p ${SAMBA_PRIVATE}/smbpasswd.default ${SAMBA_PRIVATE}/smbpasswd" | ${SED_PLIST} >> ${TMPPLIST} + ${ECHO_CMD} "@exec ${CHMOD} 600 ${SAMBA_PRIVATE}/smbpasswd*" | ${SED_PLIST} >> ${TMPPLIST} + ${ECHO_CMD} "@unexec /usr/bin/cmp -s ${SAMBA_PRIVATE}/smbpasswd ${SAMBA_PRIVATE}/smbpasswd.default && ${RM} -f ${SAMBA_PRIVATE}/smbpasswd ${SAMBA_PRIVATE}/secrets.tdb || ${TRUE}" | ${SED_PLIST} >> ${TMPPLIST} + ${ECHO_CMD} "@unexec ${RM} -f ${SAMBA_PRIVATE}/smbpasswd.default" | ${SED_PLIST} >> ${TMPPLIST} + ${ECHO_CMD} "@unexec ${RMDIR} ${SAMBA_PRIVATE} || (${ECHO_CMD} \"Warning: If you will *NOT* use this package anymore,\" && ${ECHO_CMD} \" please remove ${SAMBA_PRIVATE} and its contents manually.\")" | ${SED_PLIST} >> ${TMPPLIST} .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message