Date: Tue, 26 Mar 2002 09:47:33 +0800 (CST) From: Christopher Hall <hsw@acm.org> To: FreeBSD-gnats-submit@FreeBSD.org Cc: dwcjr@FreeBSD.org Subject: ports/36318: net/samba: printing fails, smbpasswd stored in package [patch] Message-ID: <200203260147.g2Q1lXa38915@x4.tucheng.generalresources.com>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203260147.g2Q1lXa38915>