This repository has been archived by the owner on Feb 4, 2019. It is now read-only.
forked from cinek810/libnss-pool
-
Notifications
You must be signed in to change notification settings - Fork 1
Strcpy concatenates new username to old username length #2
Labels
bug
Something isn't working
Comments
define USER_NAME_MAX_LENGTH 32 Source: shadow-maint/shadow#20 |
Test Case:
Current Behaviour:
See also: |
For now, I'll just add in a check to ensure that Also, added this script, to dynamically generate long pool usernames. #!/bin/bash
# generate_pool.sh
set -euo pipefail
IFS=$'\n\t'
create_name() {
echo "pool_$((RANDOM%10000000000000000000000000000000-99999999999999999999999999999999))"
}
# For more info see `man passwd`
create_passwd_entry() {
local name=$1
local uid=$2
# Default `users` group in Debian
echo "${name}:!:${uid}:100:::/bin/bash"
}
show_usage() {
echo 'Usage: generate_pool.sh ${pool_size} ${uid_start}'
echo " pool_size - number of users in pool"
echo " uid_start - first free uid (check /etc/passwd)"
}
main() {
if [ "$#" -ne 2 ]; then
show_usage
exit 1
fi
local pool_size="$1"
local uid_start="$(expr $2 - 1)"
for i in $(seq ${pool_size}); do
create_passwd_entry $(create_name) $(expr $uid_start + $i)
done
}
main $@
|
Jnchi
added a commit
that referenced
this issue
Dec 18, 2018
Jnchi
added a commit
that referenced
this issue
Dec 18, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Source:
libnss_pool.c
The text was updated successfully, but these errors were encountered: