From eb438e782c1dfc1b096cec5245c08a35db0ec305 Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Fri, 15 Apr 2011 16:30:06 +0200 Subject: [PATCH] parse_cfg: Use memset to clear cfg struct. The code will be easier to maintain if one does not have to remember explicitly initializing all new members of the config struct. --- pam_yubico.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/pam_yubico.c b/pam_yubico.c index d1fbef0..5cc32b6 100644 --- a/pam_yubico.c +++ b/pam_yubico.c @@ -543,24 +543,10 @@ parse_cfg (int flags, int argc, const char **argv, struct cfg *cfg) { int i; + memset (cfg, 0, sizeof(struct cfg)); cfg->client_id = -1; - cfg->client_key = NULL; - cfg->debug = 0; - cfg->alwaysok = 0; - cfg->verbose_otp = 0; - cfg->try_first_pass = 0; - cfg->use_first_pass = 0; - cfg->auth_file = NULL; - cfg->capath = NULL; - cfg->url = NULL; - cfg->ldapserver = NULL; - cfg->ldap_uri = NULL; - cfg->ldapdn = NULL; - cfg->user_attr = NULL; - cfg->yubi_attr = NULL; cfg->token_id_length = DEFAULT_TOKEN_ID_LEN; cfg->mode = CLIENT; - cfg->chalresp_path = NULL; for (i = 0; i < argc; i++) {