[Pkg-citadel-commit] r246 - citadel/trunk/debian
meskes at alioth.debian.org
meskes at alioth.debian.org
Mon Mar 2 12:14:31 UTC 2009
Author: meskes
Date: 2009-03-02 12:14:30 +0000 (Mon, 02 Mar 2009)
New Revision: 246
Modified:
citadel/trunk/debian/citadel-server.config
citadel/trunk/debian/citadel-server.postinst
citadel/trunk/debian/citadel-server.templates
Log:
Ask for password when creating new internal user.
Modified: citadel/trunk/debian/citadel-server.config
===================================================================
--- citadel/trunk/debian/citadel-server.config 2009-03-02 09:16:47 UTC (rev 245)
+++ citadel/trunk/debian/citadel-server.config 2009-03-02 12:14:30 UTC (rev 246)
@@ -8,6 +8,7 @@
db_capb backup
DO_CONFIGURE=no
+LASTSTATE=3
if test -n "$2"; then
# do we want to reconfigure?
@@ -20,13 +21,13 @@
# are we in first install?
if test "$1" = "configure"; then
DO_CONFIGURE=yes
+ LASTSTATE=5
fi
fi
if test "$DO_CONFIGURE" = "yes"; then
STATE=1
- LASTSTATE=3
while [ "$STATE" != 0 -a "$STATE" -le "$LASTSTATE" ]; do
case "$STATE" in
@@ -39,13 +40,59 @@
3)
db_input high citadel/Administrator || true
;;
+ 4)
+ db_input high citadel/Password || true
+ ;;
+ 5)
+ db_input high citadel/Password_again || true
+ ;;
+ esac
-
- esac
if db_go; then
- STATE=$(($STATE + 1))
+ case "$STATE" in
+ 1)
+ ;;
+ 2)
+ db_get citadel/LoginType
+ LoginType=$RET
+ if [ "$LoginType" = "true" ]; then
+ # external authentification, user has to exist
+ LASTSTATE=3
+ fi
+ ;;
+ 3)
+ if [ "$LoginType" = "true" ]; then
+ db_get citadel/Administrator
+ if ! getent passwd $RET >/dev/null; then
+ # user doesn't exist
+ db_fset citadel/BadUser seen false
+ db_input critical citadel/BadUser || true
+ db_go
+ STATE=$(($STATE - 1))
+ fi
+ fi
+ ;;
+ 4)
+ db_get citadel/Password
+ PW=$RET
+ if [ -z "$PW" ]; then
+ # empty password, no need to ask again
+ LASTSTATE=4
+ fi
+ ;;
+ 5)
+ db_get citadel/Password_again
+ # check if passwords match
+ if [ "$RET" != "$PW" ]; then
+ # try again
+ STATE=$(($STATE - 2))
+ PW=' '
+ fi
+ ;;
+ esac
+ STATE=$(($STATE + 1))
else
- STATE=$(($STATE - 1))
+ STATE=$(($STATE - 1))
fi
done
Modified: citadel/trunk/debian/citadel-server.postinst
===================================================================
--- citadel/trunk/debian/citadel-server.postinst 2009-03-02 09:16:47 UTC (rev 245)
+++ citadel/trunk/debian/citadel-server.postinst 2009-03-02 12:14:30 UTC (rev 246)
@@ -29,14 +29,13 @@
if test "$deb_enable_unix_auth" = "true"; then
export ENABLE_UNIX_AUTH=yes
- # check whether administrator user exists, if not create it
- if ! getent passwd $admin >/dev/null; then
- adduser --quiet --system \
- --no-create-home \
- --gecos "Citadel administrator" $admin
- fi
else
export ENABLE_UNIX_AUTH=no
+ # we're in a fresh install, so we have to set the password for the new user
+ if test -z "$2"; then
+ db_get citadel/Password && pw="$RET"
+ export SYSADMIN_PW=$pw
+ fi
fi
export IP_ADDR=$ip_addr
Modified: citadel/trunk/debian/citadel-server.templates
===================================================================
--- citadel/trunk/debian/citadel-server.templates 2009-03-02 09:16:47 UTC (rev 245)
+++ citadel/trunk/debian/citadel-server.templates 2009-03-02 12:14:30 UTC (rev 246)
@@ -26,4 +26,19 @@
_Description: Citadel administrator username:
Please enter the name of the Citadel user account that should be granted
administrative privileges once created.
- This user account will be created if needed.
+ If using internal authentification this user account will be created if it does
+ not exist. For external authentification this user account has to exist.
+
+Template: citadel/Password
+Type: password
+_Description: Administrator password:
+ While not mandatory, it is highly recommended that you set a password
+ for the administrator user.
+
+Template: citadel/Password_again
+Type: password
+Description: Repeat password for the administrator user:
+
+Template: citadel/BadUser
+Type: error
+Description: User does not exist.
More information about the Pkg-citadel-commit
mailing list