From 4f004c4ac496c2580d397989b9558f4b183475b6 Mon Sep 17 00:00:00 2001
From: el_kaboing <el_kaboing@localhost>
Date: Mon, 27 Nov 2006 16:14:43 +0000
Subject: [PATCH] Adding functional tests for Issues 304 and 305.

---
 opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_lockout_dur_long.ldif  |   29 ++
 opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_lockout_dur_short.ldif |   29 ++
 opends/tests/functional-tests/shared/data/security/pwd_policy/user_change_pwd5.ldif               |   29 ++
 opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml               |    4 
 opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_user_pwd3.ldif         |   29 ++
 opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_user_pwd2.ldif         |   29 ++
 opends/tests/functional-tests/shared/data/security/pwd_policy/admin_reset_lockout_dur.ldif        |   29 ++
 opends/tests/functional-tests/testcases/security/pwd_policy/security_lockout_duration.xml         |  445 ++++++++++++++++++++++++++++++++++++++++
 opends/tests/functional-tests/shared/data/security/pwd_policy/user_change_pwd6.ldif               |   29 ++
 9 files changed, 652 insertions(+), 0 deletions(-)

diff --git a/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_lockout_dur_long.ldif b/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_lockout_dur_long.ldif
new file mode 100644
index 0000000..a9c16a9
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_lockout_dur_long.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=Default Password Policy,cn=Password Policies,cn=config
+changetype: modify
+replace: ds-cfg-lockout-duration
+ds-cfg-lockout-duration: 5 days
diff --git a/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_lockout_dur_short.ldif b/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_lockout_dur_short.ldif
new file mode 100644
index 0000000..71728cc
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_lockout_dur_short.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=Default Password Policy,cn=Password Policies,cn=config
+changetype: modify
+replace: ds-cfg-lockout-duration
+ds-cfg-lockout-duration: 5 seconds
diff --git a/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_user_pwd2.ldif b/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_user_pwd2.ldif
new file mode 100644
index 0000000..a4c7bbf
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_user_pwd2.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: uid=mward,ou=People,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com
+changetype: modify
+replace: userpassword
+userpassword: adminnormal
diff --git a/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_user_pwd3.ldif b/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_user_pwd3.ldif
new file mode 100644
index 0000000..faea9b6
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_change_user_pwd3.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: uid=mward,ou=People,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com
+changetype: modify
+replace: userpassword
+userpassword: normal
diff --git a/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_reset_lockout_dur.ldif b/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_reset_lockout_dur.ldif
new file mode 100644
index 0000000..16695e0
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/pwd_policy/admin_reset_lockout_dur.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=Default Password Policy,cn=Password Policies,cn=config
+changetype: modify
+replace: ds-cfg-lockout-duration
+ds-cfg-lockout-duration: 0 seconds
diff --git a/opends/tests/functional-tests/shared/data/security/pwd_policy/user_change_pwd5.ldif b/opends/tests/functional-tests/shared/data/security/pwd_policy/user_change_pwd5.ldif
new file mode 100644
index 0000000..bc4c41e
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/pwd_policy/user_change_pwd5.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: uid=mward,ou=People,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com
+changetype: modify
+replace: userpassword
+userpassword: newnormal
diff --git a/opends/tests/functional-tests/shared/data/security/pwd_policy/user_change_pwd6.ldif b/opends/tests/functional-tests/shared/data/security/pwd_policy/user_change_pwd6.ldif
new file mode 100644
index 0000000..9af1b50
--- /dev/null
+++ b/opends/tests/functional-tests/shared/data/security/pwd_policy/user_change_pwd6.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: uid=bjablons,ou=People,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com
+changetype: modify
+replace: userpassword
+userpassword: newberry
diff --git a/opends/tests/functional-tests/testcases/security/pwd_policy/security_lockout_duration.xml b/opends/tests/functional-tests/testcases/security/pwd_policy/security_lockout_duration.xml
new file mode 100755
index 0000000..35c3eaa
--- /dev/null
+++ b/opends/tests/functional-tests/testcases/security/pwd_policy/security_lockout_duration.xml
@@ -0,0 +1,445 @@
+<?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 2006 Sun Microsystems, Inc.
+ -->
+<stax>
+
+  <defaultcall function="lockout_duration"/>
+
+  <function name="lockout_duration">
+
+      <sequence>
+
+        <testcase name="'Security: Lockout Duration: Preamble'">
+          <sequence>
+            <message>
+               'Security: Lockout Duration: Preamble Step 1. Checking existence of ds-cfg-lockout-duration'
+            </message>
+
+            <call function="'compareEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'attrToBeCompared'   : 'ds-cfg-lockout-duration:0 seconds',
+                'entryToBeCompared'   : 'cn=Default Password Policy,cn=Password Policies,cn=config' }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Lockout Duration: Preamble Step 2. Admin Changing Lockout Count'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/pwd_policy/admin_change_lockout_cnt.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Lockout Duration: Preamble Step 3. User Lockout With Bad Pwd 3x'
+            </message>
+
+            <script>
+                search_pwds = ['bad', 'bad', 'bad', 'normal']
+            </script>
+            
+            <iterate var="pwds" in="search_pwds" indexvar="index">
+              <call function="'SearchObject'">
+                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                  'dsInstanceDn'     : 'uid=mward,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                  'dsInstancePswd'   : '%s' % pwds,
+                  'dsBaseDN'   : 'dc=example,dc=com' ,
+                  'dsFilter'         : 'objectclass=*'  ,
+                  'extraParams'      : '-s base' }
+              </call>
+            </iterate>
+
+            <if expr="RC != 1">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Lockout Duration: Preamble Step 4. Admin Resetting User Pwd'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/pwd_policy/admin_change_user_pwd2.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+            
+            <message>
+               'Security: Lockout Duration: Preamble Step 5. User Bind With New Password'
+            </message>
+
+            <call function="'SearchObject'">
+                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                  'dsInstanceDn'     : 'uid=mward,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                  'dsInstancePswd'   : 'adminnormal' ,
+                  'dsBaseDN'   : 'dc=example,dc=com' ,
+                  'dsFilter'         : 'objectclass=*'  ,
+                  'extraParams'      : '-s base' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : Amin Change Lockout Cnt -->
+        <testcase name="'Security: Lockout Duration: Make Lockout Duration Short'">
+          <sequence>
+            <message>
+               'Security: Lockout Duration: Admin Making Lockout Duration Short'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/pwd_policy/admin_change_lockout_dur_short.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : Amin Change Lockout Duration -->
+        <testcase name="'Security: Lockout Duration: Short Lockout Duration'">
+          <sequence>
+            <message>
+               'Security: Lockout Duration: Short Lockout Duration Step 1. User Lockout With Bad Pwd 3x'
+            </message>
+
+            <script>
+                search_pwds = ['bad', 'bad', 'bad', 'adminnormal']
+            </script>
+            
+            <iterate var="pwds" in="search_pwds" indexvar="index">
+              <call function="'SearchObject'">
+                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                  'dsInstanceDn'     : 'uid=mward,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                  'dsInstancePswd'   : '%s' % pwds,
+                  'dsBaseDN'   : 'dc=example,dc=com' ,
+                  'dsFilter'         : 'objectclass=*'  ,
+                  'extraParams'      : '-s base' }
+              </call>
+            </iterate>
+
+            <if expr="RC != 1">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Lockout Duration: Short Lockout Duration - Sleeping'
+            </message>
+
+            <call function="'Sleep'">
+              { 'sleepForMilliSeconds' : '8000' }
+            </call>
+            
+            <message>
+               'Security: lockout Duration: Short Lockout Duration Step 2. User Changing Password'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : 'uid=mward,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                'dsInstancePswd'   : 'adminnormal' ,
+                'entryToBeModified'   : '%s/security/pwd_policy/user_change_pwd5.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Lockout Duration: Short Lockout Duration Step 3. User Bind With New Password'
+            </message>
+
+            <call function="'SearchObject'">
+                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                  'dsInstanceDn'     : 'uid=mward,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                  'dsInstancePswd'   : 'newnormal' ,
+                  'dsBaseDN'   : 'dc=example,dc=com' ,
+                  'dsFilter'         : 'objectclass=*'  ,
+                  'extraParams'      : '-s base' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : Amin Change Lockout Cnt -->
+        <testcase name="'Security: Lockout Duration: Make Lockout Duration Long'">
+          <sequence>
+            <message>
+               'Security: Lockout Duration: Admin Making Lockout Duration Long'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/pwd_policy/admin_change_lockout_dur_long.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+          </sequence>
+        </testcase>
+
+        <!--- Test Case : Amin Change Lockout Duration -->
+        <testcase name="'Security: Lockout Duration: Long Lockout Duration'">
+          <sequence>
+            <message>
+               'Security: Lockout Duration: Long Lockout Duration Step 1. User Initial Bind'
+            </message>
+
+            <call function="'SearchObject'">
+                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                  'dsInstanceDn'     : 'uid=bjablons,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                  'dsInstancePswd'   : 'strawberry' ,
+                  'dsBaseDN'   : 'dc=example,dc=com' ,
+                  'dsFilter'         : 'objectclass=*'  ,
+                  'extraParams'      : '-s base' }
+            </call>
+    
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Lockout Duration: Long Lockout Duration Step 2. User Lockout With Bad Pwd 3x'
+            </message>
+
+            <script>
+                search_pwds = ['bad', 'bad', 'bad', 'strawberry']
+            </script>
+            
+            <iterate var="pwds" in="search_pwds" indexvar="index">
+              <call function="'SearchObject'">
+                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                  'dsInstanceDn'     : 'uid=bjablons,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                  'dsInstancePswd'   : '%s' % pwds,
+                  'dsBaseDN'   : 'dc=example,dc=com' ,
+                  'dsFilter'         : 'objectclass=*'  ,
+                  'extraParams'      : '-s base' }
+              </call>
+            </iterate>
+
+            <if expr="RC != 1">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Lockout Duration: Long Lockout Duration - Sleeping'
+            </message>
+
+            <call function="'Sleep'">
+              { 'sleepForMilliSeconds' : '8000' }
+            </call>
+            
+            <message>
+               'Security: lockout Duration: Long Lockout Duration Step 3. User Changing Password'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : 'uid=bjablons,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                'dsInstancePswd'   : 'strawberry' ,
+                'entryToBeModified'   : '%s/security/pwd_policy/user_change_pwd6.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 1">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Lockout Duration: Long Lockout Duration Step 4. User Bind With New Password'
+            </message>
+
+            <call function="'SearchObject'">
+                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                  'dsInstanceDn'     : 'uid=bjablons,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                  'dsInstancePswd'   : 'newberry' ,
+                  'dsBaseDN'   : 'dc=example,dc=com' ,
+                  'dsFilter'         : 'objectclass=*'  ,
+                  'extraParams'      : '-s base' }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult ,
+                  'expected'   : 1}
+            </call>
+
+          </sequence>
+        </testcase>
+
+        <testcase name="'Security: Lockout Duration: Postamble'">
+          <sequence>
+            <message>
+               'Security: Lockout Duration: Postamble Step 1. Admin Resetting Lockout Duration'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/pwd_policy/admin_reset_lockout_dur.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Lockout Duration: Postamble Step 2. User Lockout With Bad Pwd 3x'
+            </message>
+
+            <script>
+                search_pwds = ['bad', 'bad', 'bad', 'newnormal']
+            </script>
+            
+            <iterate var="pwds" in="search_pwds" indexvar="index">
+              <call function="'SearchObject'">
+                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                  'dsInstanceDn'     : 'uid=mward,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                  'dsInstancePswd'   : '%s' % pwds,
+                  'dsBaseDN'   : 'dc=example,dc=com' ,
+                  'dsFilter'         : 'objectclass=*'  ,
+                  'extraParams'      : '-s base' }
+              </call>
+            </iterate>
+
+            <if expr="RC != 1">
+                <tcstatus result="'fail'"/>
+            </if>
+
+            <message>
+               'Security: Lockout Duration: Postamble Step 3. Admin Resetting User Pwd'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/pwd_policy/admin_change_user_pwd3.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+            
+            <message>
+               'Security: Lockout Duration: Postamble Step 4. User Bind With New Password'
+            </message>
+
+            <call function="'SearchObject'">
+                { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                  'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                  'dsInstanceDn'     : 'uid=mward,ou=people,ou=password tests,o=Pwd Policy Tests,dc=example,dc=com' ,
+                  'dsInstancePswd'   : 'normal' ,
+                  'dsBaseDN'   : 'dc=example,dc=com' ,
+                  'dsFilter'         : 'objectclass=*'  ,
+                  'extraParams'      : '-s base' }
+            </call>
+
+            <if expr="RC != 0">
+                <tcstatus result="'fail'"/>
+            </if>
+            
+            <message>
+               'Security: Lockout Duration: Postamble Step 5. Admin Resetting Lockout Count'
+            </message>
+
+            <call function="'modifyEntry'">
+              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'entryToBeModified'   : '%s/security/pwd_policy/admin_reset_lockout_cnt.ldif' % STAGED_DATA_DIR }
+            </call>
+
+            <call function="'checktestRC'">
+                { 'returncode' : RC ,
+                  'result'     : STAXResult }
+            </call>
+
+          </sequence>
+        </testcase>
+
+        <return>RC</return>
+
+     </sequence>
+
+  </function>
+
+</stax>
diff --git a/opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml b/opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml
index f462834..59048c1 100755
--- a/opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml
+++ b/opends/tests/functional-tests/testcases/security/pwd_policy/security_pwd_policy.xml
@@ -115,6 +115,10 @@
           file="'%s/testcases/security/pwd_policy/security_preencoded_pwds.xml' % (TESTS_DIR)"/>
         <call function="'preencoded_pwds'" />
 
+        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
+          file="'%s/testcases/security/pwd_policy/security_lockout_duration.xml' % (TESTS_DIR)"/>
+        <call function="'lockout_duration'" />
+
         <!--- Test Case : Stop DS -->
         <testcase name="'StopDS'">
           <sequence>

--
Gitblit v1.10.0