From d1b62e048b3a390a5565bdd2ecaaf15d8e46d660 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 25 Feb 2002 04:29:11 +0000 Subject: A few more tweaks and corrections to adduser.local, deluser.local and user-init. --- adduser.local | 68 +++++++++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 37 deletions(-) (limited to 'adduser.local') diff --git a/adduser.local b/adduser.local index e946bf5..129ae5b 100755 --- a/adduser.local +++ b/adduser.local @@ -7,15 +7,12 @@ NEWUID=$2 NEWGID=$3 NEWHOMEDIR=$4 -[ "x$NEWHOMEDIR" = "x/home/$NEWUSERNAME" ] || exit 0 +. /etc/adduser.conf -#su $1 -c 'echo "$realuser\@$host">~/.forward' +# Ignore non-human accounts silently +[ "$NEWUID" -ge "$FIRST_UID" -a "$NEWUID" -le "$LAST_UID" ] || exit 0 -addgroup $NEWUSERNAME users - -if [ -x /usr/local/sbin/user-init ]; then - /usr/local/sbin/user-init $NEWUSERNAME -fi +[ -f /etc/local/users.conf ] && . /etc/local/users.conf # Samba password #FIXME: Check if enabled in samba.conf (or included files!) @@ -33,7 +30,7 @@ if [ -x /usr/local/sbin/userforward ]; then read mail_address case $mail_address in ?*@?*.*) - /usr/local/sbin/userforward $1 $mailforward + /usr/local/sbin/userforward $NEWUSERNAME $mailforward ;; ?*) echo "That wasn't a proper email address - skipping..." @@ -44,6 +41,7 @@ if [ -x /usr/local/sbin/userforward ]; then fi # Mailing lists +#FIXME: Be more generic - support other mailinglists than mailman! listdir="/var/lib/mailman/lists" lists="" [ -d $listdir ] && \ @@ -61,33 +59,29 @@ for list in $lists; do fi done -#FIXME: Make this ALOT more generic (or move it to /etc/local/adduser.d)! -if [ -d /home/christof/ftp_christof_ro ]; then - echo "This seems to be a dummy/real user environment:" - echo " Real users have read/write access to personal files." - echo " Dummy users have read access to published files." - echo -n "Is this a *real* user (y/N)? " - read realuser - case $realuser in - y|Y) - addgroup $NEWUSERNAME realusers - ;; - *) - [ -e /home/christof/ftp_christof_ro/$1 ] \ - || mkdir /home/christof/ftp_christof_ro/$1 - chown christof: /home/christof/ftp_christof_ro/$1 - chmod u=rw,go=r,a+X /home/christof/ftp_christof_ro/$1 - if [ -e $4/images ]; then - if [ -L $4/images ]; then - rm -rf $4/images - ln -s /home/christof/ftp_christof_ro/$1 $4/images - else - echo "Something is wrong - $4/images exists already." - echo "This maybe isn't a dummy/real environment after all. Bailing out..." - fi - else - ln -s /home/christof/ftp_christof_ro/$1 $4/images - fi - ;; - esac +if [ -f /etc/local/users.conf ]; then + . /etc/local/users.conf + + if [ -n "$USERS_GROUPNAME" ]; then + addgroup $NEWUSERNAME $USERS_GROUPNAME + fi + + if [ -n "$REALUSERS_GROUPNAME" ]; then + echo "This system has both dummy and real users:" + echo " Dummy users have read access to specific files." + echo " Real users have read/write access to personal files." + echo -n "Is this a dummy user (Y/n)? " + read realuser + case $realuser in + y|Y|"") + ;; + *) + addgroup $NEWUSERNAME $REALUSERS_GROUPNAME + ;; + esac + fi +fi + +if [ -x /usr/local/sbin/user-init ]; then + /usr/local/sbin/user-init $NEWUSERNAME fi -- cgit v1.2.3