b8da0b
From 7345c51c68dfd90a704ccbb0e5b1e736af80f146 Mon Sep 17 00:00:00 2001
b8da0b
From: Thierry Bordaz <tbordaz@redhat.com>
b8da0b
Date: Mon, 17 May 2021 16:10:22 +0200
b8da0b
Subject: [PATCH] Issue 4725 - Fix compiler warnings
b8da0b
b8da0b
---
b8da0b
 ldap/servers/slapd/proto-slap.h | 2 +-
b8da0b
 ldap/servers/slapd/pw.c         | 9 ++++-----
b8da0b
 ldap/servers/slapd/pw_retry.c   | 2 --
b8da0b
 3 files changed, 5 insertions(+), 8 deletions(-)
b8da0b
b8da0b
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
b8da0b
index 6ff178127..2768d5a1d 100644
b8da0b
--- a/ldap/servers/slapd/proto-slap.h
b8da0b
+++ b/ldap/servers/slapd/proto-slap.h
b8da0b
@@ -1012,7 +1012,7 @@ int add_shadow_ext_password_attrs(Slapi_PBlock *pb, Slapi_Entry **e);
b8da0b
  * pw_retry.c
b8da0b
  */
b8da0b
 int update_pw_retry(Slapi_PBlock *pb);
b8da0b
-int update_trp_pw_usecount(Slapi_PBlock *pb, Slapi_Entry *e, int32_t use_count);
b8da0b
+int update_tpr_pw_usecount(Slapi_PBlock *pb, Slapi_Entry *e, int32_t use_count);
b8da0b
 void pw_apply_mods(const Slapi_DN *sdn, Slapi_Mods *mods);
b8da0b
 void pw_set_componentID(struct slapi_componentid *cid);
b8da0b
 struct slapi_componentid *pw_get_componentID(void);
b8da0b
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
b8da0b
index d98422513..2a167c8f1 100644
b8da0b
--- a/ldap/servers/slapd/pw.c
b8da0b
+++ b/ldap/servers/slapd/pw.c
b8da0b
@@ -2622,7 +2622,6 @@ int
b8da0b
 slapi_check_tpr_limits(Slapi_PBlock *pb, Slapi_Entry *bind_target_entry, int send_result) {
b8da0b
     passwdPolicy *pwpolicy = NULL;
b8da0b
     char *dn = NULL;
b8da0b
-    int tpr_maxuse;
b8da0b
     char *value;
b8da0b
     time_t cur_time;
b8da0b
     char *cur_time_str = NULL;
b8da0b
@@ -2638,7 +2637,7 @@ slapi_check_tpr_limits(Slapi_PBlock *pb, Slapi_Entry *bind_target_entry, int sen
b8da0b
         return 0;
b8da0b
     }
b8da0b
 
b8da0b
-    if (slapi_entry_attr_hasvalue(bind_target_entry, "pwdTPRReset", "TRUE") == NULL) {
b8da0b
+    if (!slapi_entry_attr_hasvalue(bind_target_entry, "pwdTPRReset", "TRUE")) {
b8da0b
         /* the password was not reset by an admin while a TRP pwp was set, just returned */
b8da0b
         return 0;
b8da0b
     }
b8da0b
@@ -2646,7 +2645,7 @@ slapi_check_tpr_limits(Slapi_PBlock *pb, Slapi_Entry *bind_target_entry, int sen
b8da0b
     /* Check entry TPR max use */
b8da0b
     if (pwpolicy->pw_tpr_maxuse >= 0) {
b8da0b
         uint use_count;
b8da0b
-        value = slapi_entry_attr_get_ref(bind_target_entry, "pwdTPRUseCount");
b8da0b
+        value = (char *) slapi_entry_attr_get_ref(bind_target_entry, "pwdTPRUseCount");
b8da0b
         if (value) {
b8da0b
             /* max Use is enforced */
b8da0b
             use_count = strtoull(value, 0, 0);
b8da0b
@@ -2681,7 +2680,7 @@ slapi_check_tpr_limits(Slapi_PBlock *pb, Slapi_Entry *bind_target_entry, int sen
b8da0b
 
b8da0b
     /* Check entry TPR expiration at a specific time */
b8da0b
     if (pwpolicy->pw_tpr_delay_expire_at >= 0) {
b8da0b
-        value = slapi_entry_attr_get_ref(bind_target_entry, "pwdTPRExpireAt");
b8da0b
+        value = (char *) slapi_entry_attr_get_ref(bind_target_entry, "pwdTPRExpireAt");
b8da0b
         if (value) {
b8da0b
             /* max Use is enforced */
b8da0b
             if (difftime(parse_genTime(cur_time_str), parse_genTime(value)) >= 0) {
b8da0b
@@ -2709,7 +2708,7 @@ slapi_check_tpr_limits(Slapi_PBlock *pb, Slapi_Entry *bind_target_entry, int sen
b8da0b
 
b8da0b
     /* Check entry TPR valid after a specific time */
b8da0b
     if (pwpolicy->pw_tpr_delay_valid_from >= 0) {
b8da0b
-        value = slapi_entry_attr_get_ref(bind_target_entry, "pwdTPRValidFrom");
b8da0b
+        value = (char *) slapi_entry_attr_get_ref(bind_target_entry, "pwdTPRValidFrom");
b8da0b
         if (value) {
b8da0b
             /* validity after a specific time is enforced */
b8da0b
             if (difftime(parse_genTime(value), parse_genTime(cur_time_str)) >= 0) {
b8da0b
diff --git a/ldap/servers/slapd/pw_retry.c b/ldap/servers/slapd/pw_retry.c
b8da0b
index 5d13eb636..af54aa19d 100644
b8da0b
--- a/ldap/servers/slapd/pw_retry.c
b8da0b
+++ b/ldap/servers/slapd/pw_retry.c
b8da0b
@@ -163,8 +163,6 @@ set_retry_cnt_and_time(Slapi_PBlock *pb, int count, time_t cur_time)
b8da0b
 int
b8da0b
 set_tpr_usecount_mods(Slapi_PBlock *pb, Slapi_Mods *smods, int count)
b8da0b
 {
b8da0b
-    char *timestr;
b8da0b
-    time_t unlock_time;
b8da0b
     char retry_cnt[16] = {0}; /* 1-65535 */
b8da0b
     const char *dn = NULL;
b8da0b
     Slapi_DN *sdn = NULL;
b8da0b
-- 
b8da0b
2.31.1
b8da0b