diff options
Diffstat (limited to 'sca-cpp/trunk/hosting/server/put-auth')
-rwxr-xr-x | sca-cpp/trunk/hosting/server/put-auth | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/sca-cpp/trunk/hosting/server/put-auth b/sca-cpp/trunk/hosting/server/put-auth index 351c9b7d7a..883841136f 100755 --- a/sca-cpp/trunk/hosting/server/put-auth +++ b/sca-cpp/trunk/hosting/server/put-auth @@ -18,15 +18,18 @@ # under the License. here=`echo "import os; print os.path.realpath('$0')" | python`; here=`dirname $here` -mkdir -p $1 +mkdir -p $1/conf root=`echo "import os; print os.path.realpath('$1')" | python` admin=$2 apass=$3 -user=$4 -upass=$5 +email=$4 +user=$5 +upass=$6 +host=$7 httpd_prefix=`cat $here/../../modules/http/httpd.prefix` +if [ "$host" = "" ]; then conf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-conf"` sslconf=`cat $root/conf/httpd.conf | grep "# Generated by: httpd-ssl-conf"` if [ "$sslconf" = "" ]; then @@ -46,32 +49,32 @@ else fi port=`$here/../../modules/http/httpd-addr port $ssladdr` fi +else + scheme="https" + port="443" +fi # Get password hash rm -f $root/conf/auth.passwd touch $root/conf/auth.passwd -$httpd_prefix/bin/htpasswd -b $root/conf/auth.passwd "$user" "$upass" 2>/dev/null +$httpd_prefix/bin/htpasswd -b $root/conf/auth.passwd "$email" "$upass" 2>/dev/null hash=`cat $root/conf/auth.passwd | awk -F ":" '{ print $2 }'` rm -f $root/conf/auth.passwd -# Compute user id -slash=`echo $user | grep "/"` -if [ "$slash" = "" ]; then - id="\"$user\"" - upath=$user -else - id=`echo $user | awk -F "/" '{ printf "\"%s\" \"%s\"", $2, $3 }'` - upath=`echo $user | awk -F "/" '{ printf "%s/%s", $2, $3 }'` -fi +# Compute user URI +upath=$email # Put user auth cat >$root/conf/auth.entry <<EOF <?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom"> - <title type="text">$user</title> - <id>$user</id> + <title type="text">$email</title> + <id>$email</id> <content type="application/xml"> + <authn> + <user>$user</user> <hash>$hash</hash> + </authn> </content> </entry> EOF |