add an invalid protection level to the enum

This commit is contained in:
Love Hörnquist Åstrand
2011-07-24 14:00:23 -07:00
parent af4aea85ae
commit 16eabf8e4c
2 changed files with 7 additions and 6 deletions

View File

@@ -81,7 +81,7 @@ name_to_level(const char *name)
for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++) for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
if(!strncasecmp(level_names[i].name, name, strlen(name))) if(!strncasecmp(level_names[i].name, name, strlen(name)))
return level_names[i].level; return level_names[i].level;
return (enum protection_level)-1; return prot_invalid;
} }
#endif #endif
@@ -683,7 +683,7 @@ set_command_prot(enum protection_level level)
ret = command("CCC"); ret = command("CCC");
if(ret != COMPLETE) { if(ret != COMPLETE) {
printf("Failed to clear command channel.\n"); printf("Failed to clear command channel.\n");
return -1; return prot_invalid;
} }
} }
command_prot = level; command_prot = level;

View File

@@ -37,10 +37,11 @@
#define __security_h__ #define __security_h__
enum protection_level { enum protection_level {
prot_clear, prot_invalid = -1,
prot_safe, prot_clear = 0,
prot_confidential, prot_safe = 1,
prot_private prot_confidential = 2,
prot_private = 3
}; };
struct sec_client_mech { struct sec_client_mech {