]> err.no Git - yubikey-personalization/commitdiff
check that the flag is set to what we check
authorKlas Lindfors <klas@yubico.com>
Tue, 30 Apr 2013 12:01:29 +0000 (14:01 +0200)
committerKlas Lindfors <klas@yubico.com>
Tue, 30 Apr 2013 12:01:29 +0000 (14:01 +0200)
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.

ykpers.c

index 5945104e00a35893cccb7d36a26f088c680c3b9a..7931a26c1f03f0824fa57318c6b5904cffec295e 100644 (file)
--- 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;                           \