From 7086c9e8635a47966a7222e8efa30e873f0c1d95 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Wed, 3 Nov 2010 16:54:44 +0100 Subject: Silence compilation warnings in SLAPI plugins Signed-off-by: Simo Sorce --- daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c | 27 ++++++++---------- .../ipa-pwd-extop/ipa_pwd_extop.c | 2 +- .../ipa-pwd-extop/ipapwd_common.c | 32 ++++++---------------- .../ipa-pwd-extop/ipapwd_encoding.c | 14 ++++++++++ .../ipa-pwd-extop/ipapwd_prepost.c | 3 +- daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c | 21 ++++++-------- .../ipa-winsync/ipa-winsync-config.c | 3 +- .../ipa-slapi-plugins/ipa-winsync/ipa-winsync.c | 6 ++-- .../ipa-slapi-plugins/ipa-winsync/ipa-winsync.h | 5 +++- 9 files changed, 54 insertions(+), 59 deletions(-) (limited to 'daemons') diff --git a/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c b/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c index 1e094f1d..5a0cef57 100644 --- a/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c +++ b/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c @@ -111,9 +111,9 @@ static int ipamodrdn_close(Slapi_PBlock * pb); * Local operation functions * */ -static int ipamodrdn_load_plugin_config(); +static int ipamodrdn_load_plugin_config(void); static int ipamodrdn_parse_config_entry(Slapi_Entry * e, bool apply); -static void ipamodrdn_delete_config(); +static void ipamodrdn_delete_config(void); static void ipamodrdn_free_config_entry(struct configEntry ** entry); /** @@ -135,7 +135,7 @@ static int ipamodrdn_post_op(Slapi_PBlock * pb); /** * debug functions - global, for the debugger */ -void ipamodrdn_dump_config(); +void ipamodrdn_dump_config(void); void ipamodrdn_dump_config_entry(struct configEntry *); /** @@ -143,17 +143,17 @@ void ipamodrdn_dump_config_entry(struct configEntry *); * Deal with cache locking * */ -void ipamodrdn_read_lock() +void ipamodrdn_read_lock(void) { PR_RWLock_Rlock(g_ipamodrdn_cache_lock); } -void ipamodrdn_write_lock() +void ipamodrdn_write_lock(void) { PR_RWLock_Wlock(g_ipamodrdn_cache_lock); } -void ipamodrdn_unlock() +void ipamodrdn_unlock(void) { PR_RWLock_Unlock(g_ipamodrdn_cache_lock); } @@ -163,7 +163,7 @@ void ipamodrdn_unlock() * Get the plug-in version * */ -int ipamodrdn_version() +int ipamodrdn_version(void) { return IPAMODRDN_PLUGIN_VERSION; } @@ -176,7 +176,7 @@ void setPluginID(void *pluginID) _PluginID = pluginID; } -void *getPluginID() +void *getPluginID(void) { return _PluginID; } @@ -186,7 +186,7 @@ void setPluginDN(char *pluginDN) _PluginDN = pluginDN; } -char *getPluginDN() +char *getPluginDN(void) { return _PluginDN; } @@ -330,12 +330,11 @@ ipamodrdn_close(Slapi_PBlock * pb) * ------ cn=etc etc */ static int -ipamodrdn_load_plugin_config() +ipamodrdn_load_plugin_config(void) { int status = EOK; int result; int i; - time_t now; Slapi_PBlock *search_pb; Slapi_Entry **entries = NULL; @@ -399,7 +398,6 @@ ipamodrdn_parse_config_entry(Slapi_Entry * e, bool apply) struct configEntry *config_entry; PRCList *list; int entry_added = 0; - int i = 0; int ret = EOK; LOG_TRACE("--in-->\n"); @@ -512,7 +510,6 @@ ipamodrdn_parse_config_entry(Slapi_Entry * e, bool apply) break; } - next: list = PR_NEXT_LINK(list); if (ipamodrdn_global_config == list) { @@ -594,7 +591,7 @@ ipamodrdn_delete_configEntry(PRCList *entry) } static void -ipamodrdn_delete_config() +ipamodrdn_delete_config(void) { PRCList *list; @@ -710,8 +707,6 @@ static int ipamodrdn_post_op(Slapi_PBlock *pb) struct slapi_entry *e = NULL; Slapi_Attr *sattr = NULL; Slapi_Attr *tattr = NULL; - char *value = NULL; - char *errstr = NULL; int ret = LDAP_SUCCESS; LOG_TRACE("--in-->\n"); diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c index 8df766e0..f347eef2 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c @@ -916,7 +916,7 @@ static int ipapwd_setkeytab(Slapi_PBlock *pb, struct ipapwd_krbcfg *krbcfg) if (ret != -1) { struct berval *bvp; - LDAPControl new_ctrl = {0}; + LDAPControl new_ctrl; ret = ber_flatten(ber, &bvp); if (ret == -1) { diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c index 92c388a2..99ade121 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c @@ -535,20 +535,6 @@ static Slapi_Value *ipapwd_strip_pw_date(Slapi_Value *pw) return slapi_value_new_string(&pwstr[GENERALIZED_TIME_LENGTH]); } -/* ascii hex output of bytes in "in" - * out len is 32 (preallocated) - * in len is 16 */ -static const char hexchars[] = "0123456789ABCDEF"; -void hexbuf(char *out, const uint8_t *in) -{ - int i; - - for (i = 0; i < 16; i++) { - out[i*2] = hexchars[in[i] >> 4]; - out[i*2+1] = hexchars[in[i] & 0x0f]; - } -} - /* searches the directory and finds the policy closest to the DN */ /* return 0 on success, -1 on error or if no policy is found */ static int ipapwd_sv_pw_cmp(const void *pv1, const void *pv2) @@ -564,7 +550,7 @@ static int ipapwd_sv_pw_cmp(const void *pv1, const void *pv2) int ipapwd_entry_checks(Slapi_PBlock *pb, struct slapi_entry *e, int *is_root, int *is_krb, int *is_smb, - char *attr, int access) + char *attr, int acc) { Slapi_Value *sval; int rc; @@ -574,7 +560,7 @@ int ipapwd_entry_checks(Slapi_PBlock *pb, struct slapi_entry *e, if (!*is_root) { /* verify this user is allowed to write a user password */ - rc = slapi_access_allowed(pb, e, attr, NULL, access); + rc = slapi_access_allowed(pb, e, attr, NULL, acc); if (rc != LDAP_SUCCESS) { /* we have no business here, the operation will be denied anyway */ rc = LDAP_SUCCESS; @@ -932,14 +918,14 @@ int ipapwd_CheckPolicy(struct ipapwd_data *data) ret = slapi_entry_attr_find(data->target, "passwordHistory", &passwordHistory); if (ret == 0) { - int ret, hint, count, i, j; + int err, hint, count, i, j; const char *pwstr; Slapi_Value **pH; Slapi_Value *pw; hint = 0; count = 0; - ret = slapi_attr_get_numvalues(passwordHistory, &count); + err = slapi_attr_get_numvalues(passwordHistory, &count); /* check history only if we have one */ if (count > 0 && data->pwHistoryLen > 0) { pH = calloc(count + 2, sizeof(Slapi_Value *)); @@ -982,7 +968,7 @@ int ipapwd_CheckPolicy(struct ipapwd_data *data) return LDAP_OPERATIONS_ERROR; } - ret = slapi_pw_find_sv(pH, pw); + err = slapi_pw_find_sv(pH, pw); for (j = 0; pH[j]; j++) { slapi_value_free(&pH[j]); @@ -990,7 +976,7 @@ int ipapwd_CheckPolicy(struct ipapwd_data *data) slapi_value_free(&pw); free(pH); - if (ret == 0) { + if (err == 0) { LOG_TRACE("Password in history\n"); slapi_entry_free(policy); return IPAPWD_POLICY_ERROR | LDAP_PWPOLICY_PWDINHISTORY; @@ -1111,8 +1097,6 @@ int ipapwd_SetPassword(struct ipapwd_krbcfg *krbcfg, Slapi_Value **pwvals = NULL; struct tm utctime; char timestr[GENERALIZED_TIME_LENGTH+1]; - krb5_context krbctx; - krb5_error_code krberr; char *lm = NULL; char *nt = NULL; int is_smb = 0; @@ -1259,13 +1243,13 @@ Slapi_Value **ipapwd_setPasswordHistory(Slapi_Mods *smods, ret = slapi_entry_attr_find(data->target, "passwordHistory", &passwordHistory); if (ret == 0) { - int ret, hint, count, i, j; + int err, hint, count, i, j; const char *pwstr; Slapi_Value *pw; hint = 0; count = 0; - ret = slapi_attr_get_numvalues(passwordHistory, &count); + err = slapi_attr_get_numvalues(passwordHistory, &count); /* if we have one */ if (count > 0 && data->pwHistoryLen > 0) { pH = calloc(count + 2, sizeof(Slapi_Value *)); diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c index bba63677..6746d63b 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c @@ -112,6 +112,20 @@ void krb5int_c_free_keyblock_contents(krb5_context context, */ +/* ascii hex output of bytes in "in" + * out len is 32 (preallocated) + * in len is 16 */ +static const char hexchars[] = "0123456789ABCDEF"; +static void hexbuf(char *out, const uint8_t *in) +{ + int i; + + for (i = 0; i < 16; i++) { + out[i*2] = hexchars[in[i] >> 4]; + out[i*2+1] = hexchars[in[i] & 0x0f]; + } +} + struct berval *encode_keys(struct ipapwd_keyset *kset) { BerElement *be = NULL; diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_prepost.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_prepost.c index 44b280bf..281522f6 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_prepost.c +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_prepost.c @@ -41,8 +41,10 @@ # include #endif +#define _XOPEN_SOURCE /* strptime needs this */ #include #include +#include #include #include #include @@ -880,7 +882,6 @@ static int ipapwd_pre_bind(Slapi_PBlock *pb) Slapi_Value *value = NULL; Slapi_Attr *attr = NULL; struct tm expire_tm; - time_t expire_time; char *errMesg = "Internal operations error\n"; /* error message */ char *expire = NULL; /* passwordExpirationTime attribute value */ char *dn = NULL; /* bind DN */ diff --git a/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c b/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c index 1f6e5d30..27e5e8e0 100644 --- a/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c +++ b/daemons/ipa-slapi-plugins/ipa-uuid/ipa_uuid.c @@ -119,9 +119,9 @@ static int ipauuid_postop_init(Slapi_PBlock * pb); * Local operation functions * */ -static int ipauuid_load_plugin_config(); +static int ipauuid_load_plugin_config(void); static int ipauuid_parse_config_entry(Slapi_Entry * e, bool apply); -static void ipauuid_delete_config(); +static void ipauuid_delete_config(void); static void ipauuid_free_config_entry(struct configEntry ** entry); /** @@ -146,7 +146,7 @@ static int ipauuid_add_pre_op(Slapi_PBlock * pb); /** * debug functions - global, for the debugger */ -void ipauuid_dump_config(); +void ipauuid_dump_config(void); void ipauuid_dump_config_entry(struct configEntry *); /** @@ -154,17 +154,17 @@ void ipauuid_dump_config_entry(struct configEntry *); * Deal with cache locking * */ -void ipauuid_read_lock() +void ipauuid_read_lock(void) { PR_RWLock_Rlock(g_ipauuid_cache_lock); } -void ipauuid_write_lock() +void ipauuid_write_lock(void) { PR_RWLock_Wlock(g_ipauuid_cache_lock); } -void ipauuid_unlock() +void ipauuid_unlock(void) { PR_RWLock_Unlock(g_ipauuid_cache_lock); } @@ -174,7 +174,7 @@ void ipauuid_unlock() * Get the plug-in version * */ -int ipauuid_version() +int ipauuid_version(void) { return IPAUUID_PLUGIN_VERSION; } @@ -187,7 +187,7 @@ void setPluginID(void *pluginID) _PluginID = pluginID; } -void *getPluginID() +void *getPluginID(void) { return _PluginID; } @@ -197,7 +197,7 @@ void setPluginDN(char *pluginDN) _PluginDN = pluginDN; } -char *getPluginDN() +char *getPluginDN(void) { return _PluginDN; } @@ -404,7 +404,6 @@ ipauuid_load_plugin_config() int status = EOK; int result; int i; - time_t now; Slapi_PBlock *search_pb; Slapi_Entry **entries = NULL; @@ -468,7 +467,6 @@ ipauuid_parse_config_entry(Slapi_Entry * e, bool apply) struct configEntry *config_entry; PRCList *list; int entry_added = 0; - int i = 0; int ret = EOK; LOG_TRACE("--in-->\n"); @@ -571,7 +569,6 @@ ipauuid_parse_config_entry(Slapi_Entry * e, bool apply) break; } - next: list = PR_NEXT_LINK(list); if (ipauuid_global_config == list) { diff --git a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c index 5e762bc4..88f6df35 100644 --- a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c +++ b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync-config.c @@ -59,7 +59,7 @@ #endif #include "ipa-winsync.h" -#include +#include "plstr.h" #define IPA_WINSYNC_CONFIG_FILTER "(objectclass=*)" @@ -542,7 +542,6 @@ ipa_winsync_apply_config (Slapi_PBlock *pb, Slapi_Entry* entryBefore, PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Error: could not add value [%s] for attribute name " "[%s] - ldap error [%d: %s]", val, attrsvals[ii], - attrsvals[ii], IPA_WINSYNC_NEW_USER_ATTRS_VALS, rc, ldap_err2string(rc)); slapi_entry_free(theConfig.config_e); theConfig.config_e = NULL; diff --git a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.c b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.c index 4e2d534f..ecdda238 100644 --- a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.c +++ b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.c @@ -59,6 +59,9 @@ #endif #include "ipa-winsync.h" +#include +#include "plstr.h" + static void sync_acct_disable( void *cbdata, /* the usual domain config data */ @@ -224,7 +227,6 @@ ipa_winsync_pre_ds_add_user_cb(void *cbdata, const Slapi_Entry *rawentry, Slapi_Attr *attr = NULL; Slapi_Attr *e_attr = NULL; char *type = NULL; - IPA_WinSync_Config *global_ipaconfig = ipa_winsync_get_config(); LOG("--> ipa_winsync_pre_ds_add_user_cb -- begin\n"); @@ -544,7 +546,7 @@ void ipa_winsync_set_plugin_identity(void * identity) ipa_winsync_plugin_id=identity; } -void * ipa_winsync_get_plugin_identity() +void * ipa_winsync_get_plugin_identity(void) { return ipa_winsync_plugin_id; } diff --git a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.h b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.h index 338e67cf..735f6568 100644 --- a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.h +++ b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.h @@ -52,6 +52,9 @@ #include #endif /* WINSYNC_TEST_IPA */ +#include +#include + #include "util.h" #define IPA_PLUGIN_NAME "ipa-winsync" @@ -86,7 +89,7 @@ typedef struct ipa_winsync_domain_config { } IPA_WinSync_Domain_Config; void ipa_winsync_set_plugin_identity(void * identity); -void * ipa_winsync_get_plugin_identity(); +void * ipa_winsync_get_plugin_identity(void); int ipa_winsync_config( Slapi_Entry *config_e ); IPA_WinSync_Config *ipa_winsync_get_config( void ); -- cgit