adduser.sh (134440) | adduser.sh (135616) |
---|---|
1#!/bin/sh 2# 3# Copyright (c) 2002-2004 Michael Telahun Makonnen. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24# 25# Email: Mike Makonnen <mtm@FreeBSD.Org> 26# | 1#!/bin/sh 2# 3# Copyright (c) 2002-2004 Michael Telahun Makonnen. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24# 25# Email: Mike Makonnen <mtm@FreeBSD.Org> 26# |
27# $FreeBSD: head/usr.sbin/adduser/adduser.sh 134440 2004-08-28 14:32:10Z mtm $ | 27# $FreeBSD: head/usr.sbin/adduser/adduser.sh 135616 2004-09-23 13:09:42Z roam $ |
28# 29 30# err msg 31# Display $msg on stderr, unless we're being quiet. 32# 33err() { 34 if [ -z "$quietflag" ]; then 35 echo 1>&2 ${THISCMD}: ERROR: $* --- 85 unchanged lines hidden (view full) --- 121# Given $shell, which is either the full path to a shell or 122# the basename component of a valid shell, get the 123# full path to the shell from the /etc/shells file. 124# 125fullpath_from_shell() { 126 _shell=$1 127 [ -z "$_shell" ] && return 1 128 | 28# 29 30# err msg 31# Display $msg on stderr, unless we're being quiet. 32# 33err() { 34 if [ -z "$quietflag" ]; then 35 echo 1>&2 ${THISCMD}: ERROR: $* --- 85 unchanged lines hidden (view full) --- 121# Given $shell, which is either the full path to a shell or 122# the basename component of a valid shell, get the 123# full path to the shell from the /etc/shells file. 124# 125fullpath_from_shell() { 126 _shell=$1 127 [ -z "$_shell" ] && return 1 128 |
129 # /usr/sbin/nologin is a special case; it needs to be handled 130 # before the cat | while loop, since a 'return' from within 131 # a subshell will not terminate the function's execution, and 132 # the path to the nologin shell might be printed out twice. 133 # 134 if [ "$_shell" = "${NOLOGIN}" -o \ 135 "$_shell" = "${NOLOGIN_PATH}" ]; then 136 echo ${NOLOGIN_PATH} 137 return 0; 138 fi 139 |
|
129 cat ${ETCSHELLS} | 130 while read _path _junk ; do 131 case "$_path" in 132 \#*|'') 133 ;; 134 *) 135 if [ "$_path" = "$_shell" -o \ 136 "`basename $_path`" = "$_shell" ]; then 137 echo $_path 138 return 0 139 fi 140 ;; 141 esac 142 done 143 | 140 cat ${ETCSHELLS} | 141 while read _path _junk ; do 142 case "$_path" in 143 \#*|'') 144 ;; 145 *) 146 if [ "$_path" = "$_shell" -o \ 147 "`basename $_path`" = "$_shell" ]; then 148 echo $_path 149 return 0 150 fi 151 ;; 152 esac 153 done 154 |
144 # /usr/sbin/nologin is a special case 145 if [ "$_shell" = "${NOLOGIN}" -o \ 146 "$_shell" = "${NOLOGIN_PATH}" ]; then 147 echo ${NOLOGIN_PATH} 148 return 0; 149 fi 150 | |
151 return 1 152} 153 154# shell_exists shell 155# If the given shell is listed in ${ETCSHELLS} or it is 156# the nologin shell this function will return 0. 157# Otherwise, it will return 1. If shell is valid but 158# the path is invalid or it is not executable it --- 846 unchanged lines hidden --- | 155 return 1 156} 157 158# shell_exists shell 159# If the given shell is listed in ${ETCSHELLS} or it is 160# the nologin shell this function will return 0. 161# Otherwise, it will return 1. If shell is valid but 162# the path is invalid or it is not executable it --- 846 unchanged lines hidden --- |