integ/ldap/ldapscripts/debian/patches/0001-Update-ldapsetpasswd-error-message.patch
Karla Felix 114648cf5e Change ldapsetpasswd error message
This review is changing the ldapsetpasswd error message to comply
with new password rules:
- Minimum 12 characters
- At least 1 Uppercase letter
- At least 1 number
- At least 1 special character
- Cannot reuse past 5 passwords

Test Plan:
PASS: Try to change the password that doesn't comply with the
      new rules and verify if the correct message is shown.

Story: 2011084
Task: 49863

Change-Id: I1804ee40eaeb6e11b18bcc2a65aa0ebf07cd94e2
Signed-off-by: Karla Felix <karla.karolinenogueirafelix@windriver.com>
2024-04-12 11:39:53 -03:00

56 lines
1.9 KiB
Diff

From 45fa2de1f17dd421ac34f3485162b59c981f057c Mon Sep 17 00:00:00 2001
From: Alan Bandeira <Alan.PortelaBandeira@windriver.com>
Date: Tue, 28 Mar 2023 12:16:32 -0300
Subject: [PATCH] Update ldapsetpasswd error message
Signed-off-by: Alan Bandeira <Alan.PortelaBandeira@windriver.com>
---
sbin/ldapsetpasswd | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/sbin/ldapsetpasswd b/sbin/ldapsetpasswd
index 4cde4d7..452ed0c 100755
--- a/sbin/ldapsetpasswd
+++ b/sbin/ldapsetpasswd
@@ -19,6 +19,21 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA.
+# Password creation rules message
+_BADPASSWDMESSAGE=$(cat << EOF
+BAD PASSWORD!
+Password must comply with the following rules:
+* The password must be at least 12 characters long
+* You cannot reuse the last 5 passwords in history
+* Every password must differ from its previous one by at least 3 characters
+* The password must contain:
+ - at least 1 lower-case character
+ - at least 1 upper-case character
+ - at least 1 numeric character
+ - at least 1 special character
+EOF
+)
+
if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]
then
echo "Usage : $0 <username | uid> [encoded password]"
@@ -41,13 +56,13 @@ then
[ -z "$_PASSWORD" ] && end_die "Invalid password, please try again"
# Change user's password
_changepassword "$_PASSWORD" "$_ENTRY"
- [ $? -eq 0 ] || end_die "Error setting password for user $_ENTRY"
+ [ $? -eq 0 ] || end_die "${_BADPASSWDMESSAGE}"
end_ok "Successfully set password for user $_ENTRY"
else # Have to use the *encoded* password given on the command line
# Use LDIF info to modify the password
_PASSWORD="$2"
_extractldif 2 | _filterldif | _utf8encode | _ldapmodify
- [ $? -eq 0 ] || end_die "Error setting encoded password for user $_ENTRY"
+ [ $? -eq 0 ] || end_die "${_BADPASSWDMESSAGE}"
end_ok "Successfully set encoded password for user $_ENTRY"
fi
--
2.25.1