Skip to content

Commit

Permalink
Make code C90 compliant
Browse files Browse the repository at this point in the history
This moves variable declrations to the beginning of a block to be C90-compliant.
  • Loading branch information
kbabioch committed May 18, 2018
1 parent 80e7484 commit a68d3be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pam_yubico.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions util.c
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit a68d3be

Please sign in to comment.