diff options
author | dwcjr <dwcjr@FreeBSD.org> | 2002-05-24 10:01:13 +0800 |
---|---|---|
committer | dwcjr <dwcjr@FreeBSD.org> | 2002-05-24 10:01:13 +0800 |
commit | 4e231b0dd95acf10b85e4df583b16532daca8931 (patch) | |
tree | f795888706695544abd3e1ee09d1c1f88012c926 /security | |
parent | 0a037b0f3e7d29a78d5d60363be51f3fb231e915 (diff) | |
download | freebsd-ports-gnome-4e231b0dd95acf10b85e4df583b16532daca8931.tar.gz freebsd-ports-gnome-4e231b0dd95acf10b85e4df583b16532daca8931.tar.zst freebsd-ports-gnome-4e231b0dd95acf10b85e4df583b16532daca8931.zip |
Do not add a shell to cyrus user.
PR: 38434
Submitted by: maintainer
Diffstat (limited to 'security')
-rw-r--r-- | security/cyrus-sasl/pkg-deinstall | 3 | ||||
-rw-r--r-- | security/cyrus-sasl/pkg-install | 50 | ||||
-rw-r--r-- | security/cyrus-sasl2/pkg-deinstall | 3 | ||||
-rw-r--r-- | security/cyrus-sasl2/pkg-install | 50 |
4 files changed, 62 insertions, 44 deletions
diff --git a/security/cyrus-sasl/pkg-deinstall b/security/cyrus-sasl/pkg-deinstall index 87f8409132f5..cda7889285c6 100644 --- a/security/cyrus-sasl/pkg-deinstall +++ b/security/cyrus-sasl/pkg-deinstall @@ -28,6 +28,9 @@ delete_user() { if pw usershow cyrus 2>/dev/null 1>&2; then echo "To delete Cyrus user permanently, use 'pw userdel cyrus'" fi + if pw groupshow cyrus 2>/dev/null 1>&2; then + echo "To delete Cyrus group permanently, use 'pw groupdel cyrus'" + fi } diff --git a/security/cyrus-sasl/pkg-install b/security/cyrus-sasl/pkg-install index 506861e57b29..2c1c68c35df0 100644 --- a/security/cyrus-sasl/pkg-install +++ b/security/cyrus-sasl/pkg-install @@ -18,51 +18,57 @@ SASLDB_NAME=${PKG_PREFIX}/etc/%%SASLDB%% # create_user() { - if [ ! -x /usr/sbin/pw ]; then - echo "*** Please add a user and a group named \`cyrus' before installing this package." - exit 69 - fi + USER=cyrus + GROUP=cyrus + PW=/usr/sbin/pw + + if [ -x /sbin/nologin ]; then + shell=/sbin/nologin + else + shell=/nonexistent + fi + uhome="/nonexistent" - if ! pw show group cyrus -q >/dev/null; then + if ! ${PW} show group ${GROUP} -q >/dev/null; then gid=60 - while pw show group -g ${gid} -q >/dev/null; do + while ${PW} show group -g ${gid} -q >/dev/null; do gid=`expr ${gid} + 1` done - if ! pw add group cyrus -g ${gid}; then + if ! ${PW} add group ${GROUP} -g ${gid}; then e=$? - echo "*** Failed to add group \`cyrus'. Please add it manually." + echo "*** Failed to add group \`${GROUP}'. Please add it manually." exit ${e} fi - echo "*** Added group \`cyrus' (id ${gid})" + echo "*** Added group \`${GROUP}' (id ${gid})" else - gid=`pw show group cyrus 2>/dev/null | cut -d: -f3` + gid=`${PW} show group ${GROUP} 2>/dev/null | cut -d: -f3` fi - if ! pw show user cyrus -q >/dev/null; then + if ! ${PW} show user ${USER} -q >/dev/null; then uid=60 - while pw show user -u ${uid} -q >/dev/null; do + while ${PW} show user -u ${uid} -q >/dev/null; do uid=`expr ${uid} + 1` done - if ! pw add user cyrus -u ${uid} -g ${gid} -d "${PKG_PREFIX}/cyrus" \ - -c "the cyrus mail server" -s "/bin/csh" -p "*" \ + if ! ${PW} add user ${USER} -u ${uid} -g ${gid} -d "${uhome}" \ + -c "the cyrus mail server" -s "${shell}" -p "*" \ ; then e=$? - echo "*** Failed to add user \`cyrus'. Please add it manually." + echo "*** Failed to add user \`${USER}'. Please add it manually." exit ${e} fi - echo "*** Added user \`cyrus' (id ${uid})" + echo "*** Added user \`${USER}' (id ${uid})" else - if ! pw mod user cyrus -g ${gid} -d "${PKG_PREFIX}/cyrus" \ - -c "the cyrus mail server" -s "/bin/csh" -p "*" \ + if ! ${PW} mod user ${USER} -g ${gid} -d "${uhome}" \ + -c "the cyrus mail server" -s "${shell}" -p "*" \ ; then e=$? - echo "*** Failed to update user \`cyrus'." + echo "*** Failed to update user \`${USER}'." exit ${e} fi - echo "*** Updated user \`cyrus'." + echo "*** Updated user \`${USER}'." fi - if ! pw group mod cyrus -m daemon; then - echo "*** can't add user \`daemon' to group \`cyrus'" + if ! ${PW} group mod ${USER} -m daemon; then + echo "*** can't add user \`${USER}' to group \`${GROUP}'" fi } diff --git a/security/cyrus-sasl2/pkg-deinstall b/security/cyrus-sasl2/pkg-deinstall index 87f8409132f5..cda7889285c6 100644 --- a/security/cyrus-sasl2/pkg-deinstall +++ b/security/cyrus-sasl2/pkg-deinstall @@ -28,6 +28,9 @@ delete_user() { if pw usershow cyrus 2>/dev/null 1>&2; then echo "To delete Cyrus user permanently, use 'pw userdel cyrus'" fi + if pw groupshow cyrus 2>/dev/null 1>&2; then + echo "To delete Cyrus group permanently, use 'pw groupdel cyrus'" + fi } diff --git a/security/cyrus-sasl2/pkg-install b/security/cyrus-sasl2/pkg-install index 506861e57b29..2c1c68c35df0 100644 --- a/security/cyrus-sasl2/pkg-install +++ b/security/cyrus-sasl2/pkg-install @@ -18,51 +18,57 @@ SASLDB_NAME=${PKG_PREFIX}/etc/%%SASLDB%% # create_user() { - if [ ! -x /usr/sbin/pw ]; then - echo "*** Please add a user and a group named \`cyrus' before installing this package." - exit 69 - fi + USER=cyrus + GROUP=cyrus + PW=/usr/sbin/pw + + if [ -x /sbin/nologin ]; then + shell=/sbin/nologin + else + shell=/nonexistent + fi + uhome="/nonexistent" - if ! pw show group cyrus -q >/dev/null; then + if ! ${PW} show group ${GROUP} -q >/dev/null; then gid=60 - while pw show group -g ${gid} -q >/dev/null; do + while ${PW} show group -g ${gid} -q >/dev/null; do gid=`expr ${gid} + 1` done - if ! pw add group cyrus -g ${gid}; then + if ! ${PW} add group ${GROUP} -g ${gid}; then e=$? - echo "*** Failed to add group \`cyrus'. Please add it manually." + echo "*** Failed to add group \`${GROUP}'. Please add it manually." exit ${e} fi - echo "*** Added group \`cyrus' (id ${gid})" + echo "*** Added group \`${GROUP}' (id ${gid})" else - gid=`pw show group cyrus 2>/dev/null | cut -d: -f3` + gid=`${PW} show group ${GROUP} 2>/dev/null | cut -d: -f3` fi - if ! pw show user cyrus -q >/dev/null; then + if ! ${PW} show user ${USER} -q >/dev/null; then uid=60 - while pw show user -u ${uid} -q >/dev/null; do + while ${PW} show user -u ${uid} -q >/dev/null; do uid=`expr ${uid} + 1` done - if ! pw add user cyrus -u ${uid} -g ${gid} -d "${PKG_PREFIX}/cyrus" \ - -c "the cyrus mail server" -s "/bin/csh" -p "*" \ + if ! ${PW} add user ${USER} -u ${uid} -g ${gid} -d "${uhome}" \ + -c "the cyrus mail server" -s "${shell}" -p "*" \ ; then e=$? - echo "*** Failed to add user \`cyrus'. Please add it manually." + echo "*** Failed to add user \`${USER}'. Please add it manually." exit ${e} fi - echo "*** Added user \`cyrus' (id ${uid})" + echo "*** Added user \`${USER}' (id ${uid})" else - if ! pw mod user cyrus -g ${gid} -d "${PKG_PREFIX}/cyrus" \ - -c "the cyrus mail server" -s "/bin/csh" -p "*" \ + if ! ${PW} mod user ${USER} -g ${gid} -d "${uhome}" \ + -c "the cyrus mail server" -s "${shell}" -p "*" \ ; then e=$? - echo "*** Failed to update user \`cyrus'." + echo "*** Failed to update user \`${USER}'." exit ${e} fi - echo "*** Updated user \`cyrus'." + echo "*** Updated user \`${USER}'." fi - if ! pw group mod cyrus -m daemon; then - echo "*** can't add user \`daemon' to group \`cyrus'" + if ! ${PW} group mod ${USER} -m daemon; then + echo "*** can't add user \`${USER}' to group \`${GROUP}'" fi } |