Use a special variable name since USER is always defined from the environment
This commit is contained in:
parent
252fe746a7
commit
2f2e723bc0
|
@ -13,6 +13,8 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
|
|||
|
||||
### Fixed
|
||||
|
||||
* Use a special variable name since USER is always defined from the environment
|
||||
|
||||
### Security
|
||||
|
||||
## [23.10] - 2023-10-09
|
||||
|
|
|
@ -122,8 +122,8 @@ get_now() {
|
|||
}
|
||||
|
||||
get_user() {
|
||||
if [ -n "${USER}" ]; then
|
||||
echo "${USER}"
|
||||
if [ -n "${FORCE_USER}" ]; then
|
||||
echo "${FORCE_USER}"
|
||||
else
|
||||
logname
|
||||
fi
|
||||
|
@ -399,7 +399,7 @@ AUTO=${AUTO:-"0"}
|
|||
EVOCHECK=${EVOCHECK:-"0"}
|
||||
GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20}
|
||||
API_ENDPOINT=${API_ENDPOINT:-""}
|
||||
USER=${USER:-""}
|
||||
FORCE_USER=${FORCE_USER:-""}
|
||||
|
||||
# initialize variables
|
||||
MESSAGE=""
|
||||
|
@ -481,12 +481,12 @@ while :; do
|
|||
# Deprecated, backward compatibility
|
||||
# author change as autosysadmin
|
||||
printf 'WARNING: "--autosysadmin" is deprecated, use "--user autosysadmin".\n' >&2
|
||||
USER="autosysadmin"
|
||||
FORCE_USER="autosysadmin"
|
||||
;;
|
||||
-u|--user)
|
||||
# user options, with value speparated by space
|
||||
if [ -n "$2" ]; then
|
||||
USER=$2
|
||||
FORCE_USER=$2
|
||||
shift
|
||||
else
|
||||
printf 'ERROR: "--user" requires a non-empty option argument.\n' >&2
|
||||
|
@ -495,7 +495,7 @@ while :; do
|
|||
;;
|
||||
--user=?*)
|
||||
# message options, with value speparated by =
|
||||
USER=${1#*=}
|
||||
FORCE_USER=${1#*=}
|
||||
;;
|
||||
--user=)
|
||||
# message options, without value
|
||||
|
|
Loading…
Reference in a new issue