Revision: 14910
Author: adrian.chadd
Date: Sun Jul 10 23:12:30 2011
Log: Add a program to generate digest password file entries.
http://code.google.com/p/lusca-cache/source/detail?r=14910
Added:
/branches/LUSCA_HEAD/helpers/digest_auth/password/digest_passwd
=======================================
--- /dev/null
+++ /branches/LUSCA_HEAD/helpers/digest_auth/password/digest_passwd Sun Jul
10 23:12:30 2011
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#
+# This program creates a digest password file entry with the given
username,
+# password and realm.
+#
+# Please note that it doesn't even begin to pretend to correctly handle
+# certain cases: eg the username, password or realm having a colon or quote
+# mark in them.
+#
+# A better password creation program should likely be written.
+# The digest code should also be double-checked to ensure encodings
+# for special and UTF-8 characters are correctly handled.
+#
+
+user="$1"
+realm="$3"
+pass="$2"
+
+echocmd="/bin/echo"
+
+if [ -z "$1" -o -z "$2" -o -z "$3" ] ; then
+ echo "Usage: $0 user pass 'realm'";
+ exit 1
+fi
+
+# Since (at least) MacOS X sh has a built-in echo that doesn't understand
-n
+# (and happily adds it to the output), manually call the echo binary.
+
+ha1=$(${echocmd} -n "$user:$realm:$pass" | md5)
+
+echo "$user:$realm:$ha1"
--
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en.