]> err.no Git - yubikey-personalization/commitdiff
only look at mode if p->mode is set
authorKlas Lindfors <klas@yubico.com>
Fri, 12 Apr 2013 09:51:22 +0000 (11:51 +0200)
committerKlas Lindfors <klas@yubico.com>
Fri, 12 Apr 2013 09:51:22 +0000 (11:51 +0200)
ykpers.c

index db768881cef10fb576c00c9026c4cb98707c68bf..48ae8d605021e8f22175ec37414eec69f2c409ae 100644 (file)
--- a/ykpers.c
+++ b/ykpers.c
@@ -1005,7 +1005,7 @@ int ykp_write_config(const YKP_CONFIG *cfg,
                for (p = ticket_flags_map; p->flag; p++) {
                        if ((ycfg.tktFlags & p->flag) == p->flag
                            && p->capability(cfg)
-                           && (mode & p->mode) == mode) {
+                           && (!p->mode || (mode & p->mode) == mode)) {
                                if (*buffer) {
                                        strcat(buffer, str_flags_separator);
                                        strcat(buffer, p->flag_text);
@@ -1027,7 +1027,7 @@ int ykp_write_config(const YKP_CONFIG *cfg,
                for (p = config_flags_map; p->flag; p++) {
                        if ((t_flags & p->flag) == p->flag
                            && p->capability(cfg)
-                           && (mode & p->mode) == mode) {
+                           && (!p->mode || (mode & p->mode) == mode)) {
                                if (*buffer) {
                                        strcat(buffer, str_flags_separator);
                                        strcat(buffer, p->flag_text);
@@ -1052,7 +1052,7 @@ int ykp_write_config(const YKP_CONFIG *cfg,
                for (p = extended_flags_map; p->flag; p++) {
                        if ((ycfg.extFlags & p->flag) == p->flag
                            && p->capability(cfg)
-                           && (mode & p->mode) == mode) {
+                           && (!p->mode || (mode & p->mode) == mode)) {
                                if (*buffer) {
                                        strcat(buffer, str_flags_separator);
                                        strcat(buffer, p->flag_text);