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 --- .../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 +- 4 files changed, 25 insertions(+), 26 deletions(-) (limited to 'daemons/ipa-slapi-plugins/ipa-pwd-extop') 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 8df766e03..f347eef2d 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 92c388a25..99ade1211 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 bba636773..6746d63b6 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 44b280bfd..281522f6a 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 */ -- cgit