[Freeipa-devel] [PATCHES] Fix C compiler warnings

Lukas Slebodnik lslebodn at redhat.com
Wed Jul 24 11:47:40 UTC 2013


ehlo,

Three patches are attached.
PATCH 1: fixes warning: passing argument from incompatible pointer type
   another posiible solution is to cast "(void *(*) (void *))" function pointer
   at function call pthread_create.
PATCH 2: Remove unused variable
PATCH 3: warning: variable was set, but it was not used.
   failcnt_interval = slapi_entry_attr_get_uint(policy_entry, "krbPwdFailureCountInterval");
                ^^^^^^
Variable failcnt_interval is not used after this line.
If this variable should be realy unused,
     then I can squash 3rd patch to 2nd.
     else "PATCH 3" only remove warrning and does not fix problem.

LS
-------------- next part --------------
>From a186f016a6bbfec60cceacde82cf505ecef1b646 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 23 Jul 2013 00:37:32 +0200
Subject: [PATCH 1/3] Use right function prototype for thread function

warning: passing argument from incompatible pointer type
---
 daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h        | 3 ++-
 daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_worker.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h
index ae0b06f..7b0c2aa 100644
--- a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h
+++ b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap.h
@@ -98,7 +98,8 @@ struct ipa_cldap_req {
     struct kvp_list kvps;
 };
 
-void *ipa_cldap_worker(struct ipa_cldap_ctx *ctx);
+/*void *ipa_cldap_worker(struct ipa_cldap_ctx *ctx);*/
+void *ipa_cldap_worker(void *arg);
 
 int ipa_cldap_netlogon(struct ipa_cldap_ctx *ctx,
                        struct ipa_cldap_req *req,
diff --git a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_worker.c b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_worker.c
index 37de786..df7cc11 100644
--- a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_worker.c
+++ b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_worker.c
@@ -314,11 +314,12 @@ static struct ipa_cldap_req *ipa_cldap_recv_dgram(struct ipa_cldap_ctx *ctx)
     return req;
 }
 
-void *ipa_cldap_worker(struct ipa_cldap_ctx *ctx)
+void *ipa_cldap_worker(void *arg)
 {
     struct ipa_cldap_req *req;
     struct pollfd fds[2];
     bool stop = false;
+    struct ipa_cldap_ctx *ctx = (struct ipa_cldap_ctx *) arg;
     int ret;
 
     while (!stop) {
-- 
1.8.3.1

-------------- next part --------------
>From c85ab04e5346d6c180fc7a0fac802a3bf05b2b39 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 23 Jul 2013 00:42:33 +0200
Subject: [PATCH 2/3] Remove unused variable

---
 daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c b/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c
index 0b3b841..6b5ae04 100644
--- a/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c
+++ b/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c
@@ -393,7 +393,6 @@ static int ipalockout_postop(Slapi_PBlock *pb)
     Slapi_Entry *target_entry = NULL;
     Slapi_Entry *policy_entry = NULL;
     Slapi_DN *sdn = NULL;
-    Slapi_DN *pdn = NULL;
     Slapi_PBlock *pbtm = NULL;
     Slapi_Mods *smods = NULL;
     Slapi_Value *objectclass = NULL;
-- 
1.8.3.1

-------------- next part --------------
>From eff291b99a44e3cb107835bd7d90ef7574cdeb14 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 23 Jul 2013 00:43:07 +0200
Subject: [PATCH 3/3] Remove unused variable

Variable was set, but it was not used.
---
 daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c b/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c
index 6b5ae04..9e903aa 100644
--- a/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c
+++ b/daemons/ipa-slapi-plugins/ipa-lockout/ipa_lockout.c
@@ -668,7 +668,6 @@ static int ipalockout_preop(Slapi_PBlock *pb)
     int ret = LDAP_SUCCESS;
     unsigned long failedcount = 0;
     time_t time_now;
-    unsigned int failcnt_interval = 0;
     unsigned int max_fail = 0;
     unsigned int lockout_duration = 0;
     time_t last_failed = 0;
@@ -737,7 +736,6 @@ static int ipalockout_preop(Slapi_PBlock *pb)
 
     failedcount = slapi_entry_attr_get_ulong(target_entry, "krbLoginFailedCount");
     time_now = time(NULL);
-    failcnt_interval = slapi_entry_attr_get_uint(policy_entry, "krbPwdFailureCountInterval");
     lockout_duration = slapi_entry_attr_get_uint(policy_entry, "krbPwdLockoutDuration");
 
     lastfail = slapi_entry_attr_get_charptr(target_entry, "krbLastFailedAuth");
-- 
1.8.3.1



More information about the Freeipa-devel mailing list