summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/hosting/server/put-auth
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/trunk/hosting/server/put-auth')
-rwxr-xr-xsca-cpp/trunk/hosting/server/put-auth65
1 files changed, 34 insertions, 31 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,60 +18,63 @@
# 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`
-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
- scheme="http"
- addr=`echo $conf | awk '{ print $7 }'`
- host=`$here/../../modules/http/httpd-addr ip $addr`
- if [ "$host" = "" ]; then
- host="localhost"
+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
+ scheme="http"
+ addr=`echo $conf | awk '{ print $7 }'`
+ host=`$here/../../modules/http/httpd-addr ip $addr`
+ if [ "$host" = "" ]; then
+ host="localhost"
+ fi
+ port=`$here/../../modules/http/httpd-addr port $addr`
+ else
+ scheme="https"
+ ssladdr=`echo $sslconf | awk '{ print $6 }'`
+ host=`$here/../../modules/http/httpd-addr ip $ssladdr`
+ if [ "$host" = "" ]; then
+ host="localhost"
+ fi
+ port=`$here/../../modules/http/httpd-addr port $ssladdr`
fi
- port=`$here/../../modules/http/httpd-addr port $addr`
else
scheme="https"
- ssladdr=`echo $sslconf | awk '{ print $6 }'`
- host=`$here/../../modules/http/httpd-addr ip $ssladdr`
- if [ "$host" = "" ]; then
- host="localhost"
- fi
- port=`$here/../../modules/http/httpd-addr port $ssladdr`
+ 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">
- <hash>$hash</hash>
+ <authn>
+ <user>$user</user>
+ <hash>$hash</hash>
+ </authn>
</content>
</entry>
EOF