From: Klas Lindfors Date: Tue, 30 Apr 2013 12:01:29 +0000 (+0200) Subject: check that the flag is set to what we check X-Git-Tag: v1.14.0~11 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=673849b420f8e1cae5bf39f6dff4e93d6d6dd5be;p=yubikey-personalization check that the flag is set to what we check since we overload flags in curious ways it's important to check that the flag is set to the thing we check for, not just set. --- diff --git a/ykpers.c b/ykpers.c index 5945104..7931a26 100644 --- a/ykpers.c +++ b/ykpers.c @@ -773,7 +773,7 @@ int ykp_set_tktflag_ ## type(YKP_CONFIG *cfg, bool state) \ bool ykp_get_tktflag_ ## type(YKP_CONFIG *cfg) \ { \ if (cfg) { \ - if(cfg->ykcore_config.tktFlags & TKTFLAG_ ## type) \ + if((cfg->ykcore_config.tktFlags & TKTFLAG_ ## type) == TKTFLAG_ ## type) \ return true; \ else \ return false; \ @@ -803,7 +803,7 @@ int ykp_set_cfgflag_ ## type(YKP_CONFIG *cfg, bool state) \ bool ykp_get_cfgflag_ ## type(YKP_CONFIG *cfg) \ { \ if (cfg) { \ - if(cfg->ykcore_config.cfgFlags & CFGFLAG_ ## type) \ + if((cfg->ykcore_config.cfgFlags & CFGFLAG_ ## type) == CFGFLAG_ ## type) \ return true; \ else \ return false; \ @@ -832,7 +832,7 @@ int ykp_set_extflag_ ## type(YKP_CONFIG *cfg, bool state) \ bool ykp_get_extflag_ ## type(YKP_CONFIG *cfg) \ { \ if (cfg) { \ - if(cfg->ykcore_config.extFlags & EXTFLAG_ ## type) \ + if((cfg->ykcore_config.extFlags & EXTFLAG_ ## type) == EXTFLAG_ ## type) \ return true; \ else \ return false; \