8cffd2
From 02b0d44892a7c6953cfb70034dbfc1b77a2371fc Mon Sep 17 00:00:00 2001
8cffd2
From: Alexander Bokovoy <abokovoy@redhat.com>
8cffd2
Date: Tue, 23 Feb 2021 10:06:25 +0200
8cffd2
Subject: [PATCH] ipa-kdb: fix compiler warnings
8cffd2
8cffd2
There are few fields in KDB structures that have 'conflicting' types but
8cffd2
need to be compared. They come from MIT Kerberos and we have no choice
8cffd2
here.
8cffd2
8cffd2
In the same way, SID structures have own requirements.
8cffd2
8cffd2
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
8cffd2
Reviewed-By: Robbie Harwood <rharwood@redhat.com>
8cffd2
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
8cffd2
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
8cffd2
---
8cffd2
 daemons/ipa-kdb/ipa_kdb_audit_as.c   | 4 ++--
8cffd2
 daemons/ipa-kdb/ipa_kdb_mspac.c      | 4 ++--
8cffd2
 daemons/ipa-kdb/ipa_kdb_principals.c | 6 +++---
8cffd2
 daemons/ipa-kdb/ipa_kdb_pwdpolicy.c  | 2 +-
8cffd2
 4 files changed, 8 insertions(+), 8 deletions(-)
8cffd2
8cffd2
diff --git a/daemons/ipa-kdb/ipa_kdb_audit_as.c b/daemons/ipa-kdb/ipa_kdb_audit_as.c
8cffd2
index 77748a75d6b16ee4d080a5f53213cc58c81660dc..a5ffe29334509e23fe0f0b9973432166c254b484 100644
8cffd2
--- a/daemons/ipa-kdb/ipa_kdb_audit_as.c
8cffd2
+++ b/daemons/ipa-kdb/ipa_kdb_audit_as.c
8cffd2
@@ -110,13 +110,13 @@ void ipadb_audit_as_req(krb5_context kcontext,
8cffd2
         }
8cffd2
 
8cffd2
         if (client->last_failed + ied->pol->lockout_duration > authtime &&
8cffd2
-            (client->fail_auth_count >= ied->pol->max_fail && 
8cffd2
+            (client->fail_auth_count >= (krb5_kvno) ied->pol->max_fail && 
8cffd2
              ied->pol->max_fail != 0)) {
8cffd2
             /* client already locked, nothing more to do */
8cffd2
             break;
8cffd2
         }
8cffd2
         if (ied->pol->max_fail == 0 ||
8cffd2
-            client->fail_auth_count < ied->pol->max_fail) {
8cffd2
+            client->fail_auth_count < (krb5_kvno) ied->pol->max_fail) {
8cffd2
             /* let's increase the fail counter */
8cffd2
             client->fail_auth_count++;
8cffd2
             client->mask |= KMASK_FAIL_AUTH_COUNT;
8cffd2
diff --git a/daemons/ipa-kdb/ipa_kdb_mspac.c b/daemons/ipa-kdb/ipa_kdb_mspac.c
8cffd2
index 74cbb77cccb45188f7bd8a1a33085f8ef964930f..9f95d0dc407df4566467f2b4a960086a7d940bcc 100644
8cffd2
--- a/daemons/ipa-kdb/ipa_kdb_mspac.c
8cffd2
+++ b/daemons/ipa-kdb/ipa_kdb_mspac.c
8cffd2
@@ -158,9 +158,9 @@ int string_to_sid(const char *str, struct dom_sid *sid)
8cffd2
 
8cffd2
 char *dom_sid_string(TALLOC_CTX *memctx, const struct dom_sid *dom_sid)
8cffd2
 {
8cffd2
-    size_t c;
8cffd2
+    int8_t c;
8cffd2
     size_t len;
8cffd2
-    int ofs;
8cffd2
+    size_t ofs;
8cffd2
     uint32_t ia;
8cffd2
     char *buf;
8cffd2
 
8cffd2
diff --git a/daemons/ipa-kdb/ipa_kdb_principals.c b/daemons/ipa-kdb/ipa_kdb_principals.c
8cffd2
index 259a0d2563f4b9c038b041781b2580fe72d7ed7e..3b78970b118cb6d8bd97da82a79226d20ea784e1 100644
8cffd2
--- a/daemons/ipa-kdb/ipa_kdb_principals.c
8cffd2
+++ b/daemons/ipa-kdb/ipa_kdb_principals.c
8cffd2
@@ -498,7 +498,7 @@ static krb5_error_code ipadb_get_ldap_auth_ind(krb5_context kcontext,
8cffd2
     l = len;
8cffd2
     for (i = 0; i < count; i++) {
8cffd2
         ret = snprintf(ap, l, "%s ", authinds[i]);
8cffd2
-        if (ret <= 0 || ret > l) {
8cffd2
+        if (ret <= 0 || ret > (int) l) {
8cffd2
             ret = ENOMEM;
8cffd2
             goto cleanup;
8cffd2
         }
8cffd2
@@ -1867,7 +1867,7 @@ static krb5_error_code ipadb_get_ldap_mod_auth_ind(krb5_context kcontext,
8cffd2
     char *s = NULL;
8cffd2
     size_t ai_size = 0;
8cffd2
     int cnt = 0;
8cffd2
-    int i = 0;
8cffd2
+    size_t i = 0;
8cffd2
 
8cffd2
     ret = krb5_dbe_get_string(kcontext, entry, "require_auth", &ais);
8cffd2
     if (ret) {
8cffd2
@@ -2248,7 +2248,7 @@ static krb5_error_code ipadb_entry_default_attrs(struct ipadb_mods *imods)
8cffd2
 {
8cffd2
     krb5_error_code kerr;
8cffd2
     LDAPMod *m = NULL;
8cffd2
-    int i;
8cffd2
+    size_t i;
8cffd2
 
8cffd2
     kerr = ipadb_mods_new(imods, &m);
8cffd2
     if (kerr) {
8cffd2
diff --git a/daemons/ipa-kdb/ipa_kdb_pwdpolicy.c b/daemons/ipa-kdb/ipa_kdb_pwdpolicy.c
8cffd2
index 10f128700bfd01d6ed6b5dd224ea9226b6f0dd2e..a3be116f93458e7b1a50bbbc6bda916d0e11a47a 100644
8cffd2
--- a/daemons/ipa-kdb/ipa_kdb_pwdpolicy.c
8cffd2
+++ b/daemons/ipa-kdb/ipa_kdb_pwdpolicy.c
8cffd2
@@ -328,7 +328,7 @@ krb5_error_code ipadb_check_policy_as(krb5_context kcontext,
8cffd2
     }
8cffd2
 
8cffd2
     if (ied->pol->max_fail == 0 ||
8cffd2
-        client->fail_auth_count < ied->pol->max_fail) {
8cffd2
+        client->fail_auth_count < (krb5_kvno) ied->pol->max_fail) {
8cffd2
         /* still within allowed failures range */
8cffd2
         return 0;
8cffd2
     }
8cffd2
-- 
8cffd2
2.26.3
8cffd2