andykimpe / rpms / 389-ds-base

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