From 5b50d1940bc1b63736c584fd6ec7d0883c5bc319 Mon Sep 17 00:00:00 2001
From: el_kaboing <el_kaboing@localhost>
Date: Fri, 12 Jan 2007 15:19:51 +0000
Subject: [PATCH] Adding test cases for Issue 345

---
 opends/tests/functional-tests/shared/data/security/sasl/admin_change_user_pwd4.ldif |   35 ++
 opends/tests/functional-tests/shared/data/security/sasl/admin_del_realm.ldif        |   28 ++
 opends/tests/functional-tests/shared/data/security/sasl/sasl_startup.ldif           |   82 ++++++
 opends/tests/functional-tests/testcases/security/sasl/security_sasl.xml             |    4 
 opends/tests/functional-tests/shared/data/security/sasl/admin_change_user_pwd3.ldif |   35 ++
 opends/tests/functional-tests/testcases/security/sasl/security_sasl_digest-md5.xml  |  461 ++++++++++++++++++++++++++++++++++++++
 opends/tests/functional-tests/shared/data/security/sasl/admin_add_realm.ldif        |   29 ++
 7 files changed, 674 insertions(+), 0 deletions(-)

diff --git a/opends/tests/functional-tests/shared/data/security/sasl/admin_add_realm.ldif b/opends/tests/functional-tests/shared/data/security/sasl/admin_add_realm.ldif
new file mode 100644
index 0000000..b773ca9
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/sasl/admin_add_realm.ldif
@@ -0,0 +1,29 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE
+# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+# add the following below this CDDL HEADER, with the fields enclosed
+# by brackets "[]" replaced with your own identifying * information:
+#      Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#      Portions Copyright 2006 Sun Microsystems, Inc.
+#
+
+dn: cn=DIGEST-MD5,cn=SASL Mechanisms,cn=config
+changetype: modify
+add: ds-cfg-realm
+ds-cfg-realm: o=SASL Realm Tests,dc=example,dc=com
diff --git a/opends/tests/functional-tests/shared/data/security/sasl/admin_change_user_pwd3.ldif b/opends/tests/functional-tests/shared/data/security/sasl/admin_change_user_pwd3.ldif
new file mode 100644
index 0000000..9cbc9dc
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/sasl/admin_change_user_pwd3.ldif
@@ -0,0 +1,35 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE
+# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+# add the following below this CDDL HEADER, with the fields enclosed
+# by brackets "[]" replaced with your own identifying * information:
+#      Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#      Portions Copyright 2006 Sun Microsystems, Inc.
+#
+
+dn: uid=jsprinter, ou=People, o=SASL Tests, dc=example,dc=com
+changetype: modify
+replace: userpassword
+userpassword: frogleg
+
+dn: uid=jwalleye, ou=People, o=SASL Realm Tests, dc=example,dc=com
+changetype: modify
+replace: userpassword
+userpassword: frogleg
+
diff --git a/opends/tests/functional-tests/shared/data/security/sasl/admin_change_user_pwd4.ldif b/opends/tests/functional-tests/shared/data/security/sasl/admin_change_user_pwd4.ldif
new file mode 100644
index 0000000..53746f0
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/sasl/admin_change_user_pwd4.ldif
@@ -0,0 +1,35 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE
+# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+# add the following below this CDDL HEADER, with the fields enclosed
+# by brackets "[]" replaced with your own identifying * information:
+#      Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#      Portions Copyright 2006 Sun Microsystems, Inc.
+#
+
+dn: uid=jsprinter, ou=People, o=SASL Tests, dc=example,dc=com
+changetype: modify
+replace: userpassword
+userpassword: catleg
+
+dn: uid=jwalleye, ou=People, o=SASL Realm Tests, dc=example,dc=com
+changetype: modify
+replace: userpassword
+userpassword: catleg
+
diff --git a/opends/tests/functional-tests/shared/data/security/sasl/admin_del_realm.ldif b/opends/tests/functional-tests/shared/data/security/sasl/admin_del_realm.ldif
new file mode 100644
index 0000000..48d2c7a
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/sasl/admin_del_realm.ldif
@@ -0,0 +1,28 @@
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE
+# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+# add the following below this CDDL HEADER, with the fields enclosed
+# by brackets "[]" replaced with your own identifying * information:
+#      Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#      Portions Copyright 2006 Sun Microsystems, Inc.
+#
+
+dn: cn=DIGEST-MD5,cn=SASL Mechanisms,cn=config
+changetype: modify
+delete: ds-cfg-realm
diff --git a/opends/tests/functional-tests/shared/data/security/sasl/sasl_startup.ldif b/opends/tests/functional-tests/shared/data/security/sasl/sasl_startup.ldif
index 8fe5cab..08c3056 100644
--- a/opends/tests/functional-tests/shared/data/security/sasl/sasl_startup.ldif
+++ b/opends/tests/functional-tests/shared/data/security/sasl/sasl_startup.ldif
@@ -241,6 +241,24 @@
 roomnumber: 3915
 userpassword: dogleg
 
+dn: uid=jsprinter, ou=People, o=SASL Tests, dc=example,dc=com
+cn: John Sprinter
+sn: Sprinter
+givenname: John
+objectclass: top
+objectclass: person
+objectclass: organizationalPerson
+objectclass: inetOrgPerson
+ou: Product Testing
+ou: People
+l: Cupertino
+uid: jsprinter
+mail: jsprinter@example.com
+telephonenumber: +1 408 555 1476
+facsimiletelephonenumber: +1 408 555 1992
+roomnumber: 3915
+userpassword: dogleg
+
 dn: uid=jrunner, ou=People, o=SASL Tests, dc=example,dc=com
 cn: John Runner
 sn: Runner
@@ -367,3 +385,67 @@
 roomnumber: 3915
 userpassword: dogleg
 
+dn: o=SASL Realm Tests, dc=example,dc=com
+objectclass: top
+objectclass: organization
+o: SASL Realm Tests
+
+dn: ou=People, o=SASL Realm Tests, dc=example,dc=com
+objectclass: top
+objectclass: organizationalunit
+ou: People
+
+dn: uid=cschmith, ou=People, o=SASL Realm Tests, dc=example,dc=com
+cn: Chris Schmith
+sn: Schmith
+givenname: Chris
+objectclass: top
+objectclass: person
+objectclass: organizationalPerson
+objectclass: inetOrgPerson
+ou: Human Resources
+ou: People
+l: Santa Clara
+uid: cschmith
+mail: cschmith@example.com
+telephonenumber: +1 408 555 8011
+facsimiletelephonenumber: +1 408 555 4774
+roomnumber: 0416
+userpassword: hypotenuse
+
+dn: uid=jwalleye, ou=People, o=SASL Realm Tests, dc=example,dc=com
+cn: Judy Walleye
+sn: Walleye
+givenname: Judy
+objectclass: top
+objectclass: person
+objectclass: organizationalPerson
+objectclass: inetOrgPerson
+ou: Accounting
+ou: People
+l: Sunnyvale
+uid: jwalleye
+mail: jwalleye@example.com
+telephonenumber: +1 408 555 0319
+facsimiletelephonenumber: +1 408 555 8473
+roomnumber: 1033
+userpassword: linear
+
+dn: uid=jsprinter, ou=People, o=SASL Realm Tests, dc=example,dc=com
+cn: John Sprinter
+sn: Sprinter
+givenname: John
+objectclass: top
+objectclass: person
+objectclass: organizationalPerson
+objectclass: inetOrgPerson
+ou: Product Testing
+ou: People
+l: Cupertino
+uid: jsprinter
+mail: jsprinter@example.com
+telephonenumber: +1 408 555 1476
+facsimiletelephonenumber: +1 408 555 1992
+roomnumber: 3915
+userpassword: dogleg
+
diff --git a/opends/tests/functional-tests/testcases/security/sasl/security_sasl.xml b/opends/tests/functional-tests/testcases/security/sasl/security_sasl.xml
index 71af743..4acc05b 100755
--- a/opends/tests/functional-tests/testcases/security/sasl/security_sasl.xml
+++ b/opends/tests/functional-tests/testcases/security/sasl/security_sasl.xml
@@ -80,6 +80,10 @@
         <call function="'sasl_cram-md5'" />
 
         <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/sasl/security_sasl_digest-md5.xml' % (TESTS_DIR)"/>
+        <call function="'sasl_digest-md5'" />
+
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
           file="'%s/testcases/security/sasl/security_teardown_sasl.xml' % (TESTS_DIR)"/>
         <call function="'teardown_sasl'" />
 
diff --git a/opends/tests/functional-tests/testcases/security/sasl/security_sasl_digest-md5.xml b/opends/tests/functional-tests/testcases/security/sasl/security_sasl_digest-md5.xml
new file mode 100755
index 0000000..86509e0
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/security/sasl/security_sasl_digest-md5.xml
@@ -0,0 +1,461 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "stax.dtd">
+<!--
+ ! CDDL HEADER START
+ !
+ ! The contents of this file are subject to the terms of the
+ ! Common Development and Distribution License, Version 1.0 only
+ ! (the "License").  You may not use this file except in compliance
+ ! with the License.
+ !
+ ! You can obtain a copy of the license at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, include this CDDL HEADER in each
+ ! file and include the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ ! add the following below this CDDL HEADER, with the fields enclosed
+ ! by brackets "[]" replaced with your own identifying * information:
+ !      Portions Copyright [yyyy] [name of copyright owner]
+ !
+ ! CDDL HEADER END
+ !
+ !      Portions Copyright 2007 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+  <defaultcall function="sasl_digest-md5"/>
+
+  <function name="sasl_digest-md5">
+
+      <sequence>
+
+        <!--- Test case: DIGEST-MD5 SASL Mechanism -->
+        <testcase name="'Security: SASL DIGEST-MD5: Preamble'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: Preamble Step 1 - Admin Changing Pwd Storage to CLEAR'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/sasl/admin_change_CLEAR.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: SASL DIGEST-MD5: Preamble Step 2 - Admin Changing User Password'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/sasl/admin_change_user_pwd3.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: Dupe uid (u:) Bind'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User With Dupe uid (u:) Binding'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o authid=u:jsprinter -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 1 }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: User (u:) Bind'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User (u:) Binding'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o authid=u:jwalleye -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: Dupe uid (dn:) Bind'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User With Dupe uid (dn:) Binding'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=dn:uid=jsprinter,ou=People,o=SASL Tests,dc=example,dc=com" -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: User (dn:) Bind'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User (dn:) Binding'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=dn:uid=jwalleye,ou=People,o=SASL Realm Tests,dc=example,dc=com" -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test case: Admin creating realm -->
+        <testcase name="'Security: SASL DIGEST-MD5: Create Realm'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: Admin Creating Realm'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/sasl/admin_add_realm.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: Dupe uid (u:) Bind With Realm'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User With Dupe uid (u:) Binding With Realm'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=u:jsprinter" -o "realm=o=SASL Realm Tests,dc=example,dc=com" -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 1 }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: User (u:) Bind With Realm'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User (u:) Binding With Realm'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=u:jwalleye" -o "realm=o=SASL Realm Tests,dc=example,dc=com" -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: Dupe uid (dn:) Bind With Realm'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User With Dupe uid (dn:) Binding With Realm'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=dn:uid=jsprinter,ou=People,o=SASL Tests,dc=example,dc=com" -o "realm=o=SASL Realm Tests,dc=example,dc=com" -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: User (dn:) Bind With Realm'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User (dn:) Binding With Realm'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=dn:uid=jwalleye,ou=People,o=SASL Realm Tests,dc=example,dc=com" -o "realm=o=SASL Realm Tests,dc=example,dc=com" -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: Dupe uid (u:) Bind With Undefined Realm'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User With Dupe uid (u:) Binding With Undefined Realm'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=u:jsprinter" -o "realm=o=SASL Tests,dc=example,dc=com" -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 1 }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: User (u:) Bind With Undefined Realm'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User (u:) Binding With Undefined Realm'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=u:jwalleye" -o "realm=o=SASL Tests,dc=example,dc=com" -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 1 }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: Dupe uid (dn:) Bind With Undefined Realm'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User With Dupe uid (dn:) Binding With Undefined Realm'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=dn:uid=jsprinter,ou=People,o=SASL Tests,dc=example,dc=com" -o "realm=o=SASL Tests,dc=example,dc=com" -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 1 }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Bind With DIGEST-MD5 SASL Mechanism-->
+        <testcase name="'Security: SASL DIGEST-MD5: User (dn:) Bind With Undeined Realm'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: User (dn:) Binding With Undefined Realm'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=dn:uid=jwalleye,ou=People,o=SASL Realm Tests,dc=example,dc=com" -o "realm=o=SASL Tests,dc=example,dc=com" -w frogleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 1 }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test case: DIGEST-MD5 SASL Mechanism -->
+        <testcase name="'Security: SASL DIGEST-MD5: Postamble'">
+          <sequence>
+            <message>
+               'Security: SASL DIGEST-MD5: Postamble Step 1 - Admin Changing Pwd Storage to SSHA'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/sasl/admin_change_SSHA.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: SASL DIGEST-MD5: Postamble Step 2 - Admin Changing User Password'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/sasl/admin_change_user_pwd4.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: SASL DIGEST-MD5: Postamble Step 3 - Admin Deleting Realm'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/sasl/admin_del_realm.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: SASL DIGEST-MD5: Postamble Step 4 - User (dn:) Binding With Simple Authentication'
+            </message>
+
+            <call function="'SearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : 'uid=jwalleye,ou=People,o=SASL Realm Tests,dc=example,dc=com' ,
+                'dsInstancePswd'   : 'catleg' ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-s base' }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: SASL DIGEST-MD5: Postamble Step 5 - User (dn:) Binding 2'
+            </message>
+
+           <call function="'AnonSearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsBaseDN'   : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-o mech=DIGEST-MD5 -o "authid=dn:uid=jwalleye,ou=People,o=SASL Realm Tests,dc=example,dc=com" -w catleg' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 1}
+            </call>
+          </sequence>
+        </testcase>
+
+        <return>RC</return>
+
+     </sequence>
+
+  </function>
+
+</stax>

--
Gitblit v1.10.0