From ddbc6562b0a79f1000b155ac0489f0e4deab8dff Mon Sep 17 00:00:00 2001
From: mkeyes <mkeyes@localhost>
Date: Tue, 21 Aug 2007 17:55:28 +0000
Subject: [PATCH] dded functional test cases for CRYPT password storage scheme.

---
 opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_CRYPT.xml   |  196 +++++++++++++++++++++++++++++++++++++++++++++++++
 opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml |    4 +
 2 files changed, 200 insertions(+), 0 deletions(-)

diff --git a/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_CRYPT.xml b/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_CRYPT.xml
new file mode 100755
index 0000000..1ab5133
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_CRYPT.xml
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE stax SYSTEM "../../../CRYPTred/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 2006-2007 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+  <defaultcall function="pwd_CRYPT"/>
+
+  <function name="pwd_CRYPT">
+      <!---
+            Place suite-specific test information here.
+            #@TestSuiteName             CRYPT Tests
+            #@TestSuitePurpose          Test the CRYPT storage scheme.
+            #@TestSuiteGroup            CRYPT Storage Scheme Tests
+            #@TestScript                security_pwd_CRYPT.xml
+      -->
+      <sequence>
+
+        <!--- Test case: Admin Change To CRYPT Storage Scheme -->
+       <!---
+            Place test-specific test information here.
+            The tag, TestMarker, must be the same as the tag, TestSuiteName.
+            #@TestMarker                CRYPT Tests
+            #@TestName                  CRYPT Preamble
+            #@TestIssue                 313
+            #@TestPurpose               Change password storage scheme to CRYPT.
+            #@TestPreamble              none
+            #@TestStep                  Client calls ldapmodify 
+                                        with the filename to the appropriate file.
+            #@TestPostamble             none
+            #@TestResult                Success if OpenDS returns 0
+        -->
+        <testcase name="getTestCaseName('CRYPT - Preamble')">
+          <sequence>
+            <call function="'testCase_Preamble'"/>
+            <message>
+               'Security: Pwd Storage CRYPT: Preamble - Admin Changing to CRYPT Storage Scheme'
+            </message>
+
+            <call function="'modifyPwdPolicy'">
+                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
+                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
+                    'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
+                    'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
+                    'propertyName'           : 'Default Password Policy' ,
+                    'attributeName'          : 'default-password-storage-scheme' ,
+                    'attributeValue'         : 'CRYPT' }
+            </call>
+            
+            <call function="'testCase_Postamble'"/>
+            
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : User Change Password CRYPT Scheme-->
+       <!---
+            Place test-specific test information here.
+            The tag, TestMarker, must be the same as the tag, TestSuiteName.
+            #@TestMarker                CRYPT Tests
+            #@TestName                  CRYPT Test 1
+            #@TestIssue                 313
+            #@TestPurpose               Test CRYPT password storage scheme.
+            #@TestPreamble              none
+            #@TestStep                  Admin changes a user's password to convert 
+                                        so it is stored as CRYPT scheme. 
+            #@TestStep                  The user binds with the new password.
+            #@TestStep                  Admin retrieves the user's password and 
+                                        checks for the required {CRYPT} prefix.
+            #@TestPostamble             none
+            #@TestResult                Success if OpenDS returns 0 for the ldap
+                                        operations and the password has the {CRYPT} prefix.
+        -->
+        <testcase name="getTestCaseName('CRYPT - Pwd Change')">
+          <sequence>
+            <call function="'testCase_Preamble'"/>
+            <message>
+               'Security: Pwd Storage CRYPT: User Changing Password'
+            </message>
+
+            <call function="'modifyAnAttribute'">
+                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
+                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
+                    'dsInstanceDn'           : 'uid=rdaugherty,ou=people,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com' ,
+                    'dsInstancePswd'         : 'apples' ,
+                    'DNToModify'             : 'uid=rdaugherty,ou=people,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com' ,
+                    'attributeName'          : 'userpassword' ,
+                    'newAttributeValue'      : 'CRYPTapples' ,
+                    'changetype'             : 'replace' }
+            </call>
+            
+            <message>
+               'Security: Pwd Storage CRYPT: User Binding With New Password'
+            </message>
+
+            <call function="'SearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : 'uid=rdaugherty,ou=people,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com' ,
+                'dsInstancePswd'   : 'CRYPTapples' ,
+                'dsBaseDN'         : 'dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'extraParams'      : '-s base' }
+            </call>
+
+            <message>
+               'Security: Pwd Storage CRYPT: Checking for CRYPT Scheme On New Password'
+            </message>
+
+            <call function="'SearchObject'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'dsBaseDN'         : 'uid=rdaugherty,ou=people,ou=password tests,o=Pwd Storage Tests,dc=example,dc=com' ,
+                'dsFilter'         : 'objectclass=*'  ,
+                'attributes'       : 'userpassword' }
+            </call>
+
+            <script> 
+             returnString = STAXResult[0][1]
+            </script> 
+
+            <call function="'checktestString'">
+                { 'returnString'       : returnString ,
+                  'expectedString'     : '{CRYPT}' }
+            </call>
+            
+            <call function="'testCase_Postamble'"/>
+          
+          </sequence>
+        </testcase>
+
+        <!--- Test case: Admin Reset To SCRYPT Storage Scheme -->
+        <!---
+            Place test-specific test information here.
+            The tag, TestMarker, must be the same as the tag, TestSuiteName.
+            #@TestMarker                CRYPT Tests
+            #@TestName                  CRYPT Postamble
+            #@TestIssue                 313
+            #@TestPurpose               Reset password storage scheme to the default, SCRYPT.
+            #@TestPreamble              none
+            #@TestStep                  Client calls ldapmodify 
+                                        with the filename to the appropriate file.
+            #@TestPostamble             none
+            #@TestResult                Success if OpenDS returns 0
+         -->
+        <testcase name="getTestCaseName('CRYPT - Postamble')">
+          <sequence>
+            <call function="'testCase_Preamble'"/>
+            <message>
+               'Security: Pwd Storage CRYPT: Postamble - Admin Resetting to SCRYPT Storage Scheme'
+            </message>
+
+            <call function="'modifyPwdPolicy'">
+                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
+                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
+                    'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
+                    'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
+                    'propertyName'           : 'Default Password Policy' ,
+                    'attributeName'          : 'default-password-storage-scheme' ,
+                    'attributeValue'         : 'SSHA' }
+            </call>
+            
+            <call function="'testCase_Postamble'"/>
+              
+          </sequence>
+        </testcase>
+
+     </sequence>
+
+  </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml b/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml
index f905267..026e5b1 100755
--- a/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml
+++ b/opends/tests/functional-tests/testcases/security/pwd_storage/security_pwd_storage.xml
@@ -92,6 +92,10 @@
           <call function="'pwd_CLEAR'" />
   
           <import machine="STAF_LOCAL_HOSTNAME"
+            file="'%s/testcases/security/pwd_storage/security_pwd_CRYPT.xml' % (TESTS_DIR)"/>
+          <call function="'pwd_CRYPT'" />
+  
+          <import machine="STAF_LOCAL_HOSTNAME"
             file="'%s/testcases/security/pwd_storage/security_multiple_schemes.xml' % (TESTS_DIR)"/>
           <call function="'multiple_schemes'" />
   

--
Gitblit v1.10.0