utils: Fix get_nt_dom routine, add tests
authorKai Blin <kai@samba.org>
Thu, 10 Sep 2009 16:51:18 +0000 (18:51 +0200)
committerKai Blin <kai@samba.org>
Thu, 10 Sep 2009 16:52:08 +0000 (18:52 +0200)
test_utils.sh [new file with mode: 0644]
utils.sh

diff --git a/test_utils.sh b/test_utils.sh
new file mode 100644 (file)
index 0000000..1a188c8
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+source `dirname $0`/utils.sh
+
+INPUT="administrator@AD.EXAMPLE.COM%secret"
+echo "Principal for $INPUT is " $( get_principal $INPUT )
+echo "Password  for $INPUT is " $( get_password $INPUT )
+echo "Realm     for $INPUT is " $( get_realm $INPUT )
+echo "NT_DOM    for $INPUT is " $( get_nt_dom $INPUT )
index 0753e2e3a329384be38914e9245d86a2c4dae004..f2d465fd4f758e54f734ab3262cfa8c170598e80 100644 (file)
--- a/utils.sh
+++ b/utils.sh
@@ -46,7 +46,7 @@ get_realm () {
 }
 
 get_nt_dom () {
-       NT_DOM=$( echo $1 | ${SED} -e "s/.*@\(.*\)\..*/\1/" )
+       NT_DOM=$( echo $1 | ${SED} -e "s/.*@\([A-Z1-9-]*\)\..*/\1/" )
        echo "$NT_DOM"
 }