From a68d3be1bc187fc3aed0f5014e3849e66f691ac6 Mon Sep 17 00:00:00 2001 From: Karol Babioch Date: Fri, 18 May 2018 12:22:07 +0200 Subject: [PATCH] Make code C90 compliant This moves variable declrations to the beginning of a block to be C90-compliant. --- pam_yubico.c | 3 ++- util.c | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pam_yubico.c b/pam_yubico.c index 251fe0b..a22076d 100644 --- a/pam_yubico.c +++ b/pam_yubico.c @@ -245,6 +245,7 @@ authorize_user_token_ldap (struct cfg *cfg, struct berval **vals; int rc; size_t i; + int j; char *filter = NULL; char *find = NULL; @@ -308,7 +309,7 @@ authorize_user_token_ldap (struct cfg *cfg, DBG ("Failed allocating %zu bytes", i); goto done; } - int j = snprintf (find, i, "%s=%s,%s", cfg->user_attr, user, cfg->ldapdn); + j = snprintf (find, i, "%s=%s,%s", cfg->user_attr, user, cfg->ldapdn); if (j < 0 || j >= i) { DBG ("Failed to format string"); goto done; diff --git a/util.c b/util.c index b3660bb..ff93ef5 100644 --- a/util.c +++ b/util.c @@ -62,13 +62,14 @@ get_user_cfgfile_path(const char *common_path, const char *filename, const struc */ char *userfile; size_t len; + int i; if (common_path != NULL) { len = strlen(common_path) + 1 + strlen(filename) + 1; if ((userfile = malloc(len)) == NULL) { return 0; } - int i = snprintf(userfile, len, "%s/%s", common_path, filename); + i = snprintf(userfile, len, "%s/%s", common_path, filename); if (i < 0 || i >= len) { return 0; } @@ -82,7 +83,7 @@ get_user_cfgfile_path(const char *common_path, const char *filename, const struc if ((userfile = malloc(len)) == NULL) { return 0; } - int i = snprintf(userfile, len, "%s/.yubico/%s", user->pw_dir, filename); + i = snprintf(userfile, len, "%s/.yubico/%s", user->pw_dir, filename); if (i < 0 || i >= len) { return 0; } @@ -306,6 +307,7 @@ check_user_challenge_file(const char *chalresp_path, const struct passwd *user, */ size_t len; int r; + int i; int ret = AUTH_NOT_FOUND; char *userfile = NULL; char *userfile_pattern = NULL; @@ -339,7 +341,7 @@ check_user_challenge_file(const char *chalresp_path, const struct passwd *user, goto out; } - int i = snprintf(userfile_pattern, len, "%s-*", userfile); + i = snprintf(userfile_pattern, len, "%s-*", userfile); if (i < 0 || i >= len) { D (debug_file, "Failed to format string correctly");