make it possible to set the command protection level with `prot'

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7076 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1999-10-03 15:38:38 +00:00
parent 13fa38d015
commit 0387e48ba6

View File

@@ -608,25 +608,17 @@ sec_prot(int argc, char **argv)
{ {
int level = -1; int level = -1;
if(argc != 2){ if(argc < 2 || argc > 3)
printf("usage: %s (clear | safe | confidential | private)\n", goto usage;
argv[0]); if(!sec_complete) {
code = -1;
return;
}
if(!sec_complete){
printf("No security data exchange has taken place.\n"); printf("No security data exchange has taken place.\n");
code = -1; code = -1;
return; return;
} }
level = name_to_level(argv[1]); level = name_to_level(argv[argc - 1]);
if(level == -1){ if(level == -1)
printf("usage: %s (clear | safe | confidential | private)\n", goto usage;
argv[0]);
code = -1;
return;
}
if((*mech->check_prot)(app_data, level)) { if((*mech->check_prot)(app_data, level)) {
printf("%s does not implement %s protection.\n", printf("%s does not implement %s protection.\n",
@@ -635,11 +627,22 @@ sec_prot(int argc, char **argv)
return; return;
} }
if(sec_prot_internal(level) < 0){ if(argc == 2 || strcasecmp(argv[1], "data") == 0) {
code = -1; if(sec_prot_internal(level) < 0){
return; code = -1;
} return;
}
} else if(strcasecmp(argv[1], "command") == 0)
command_prot = level;
else
goto usage;
code = 0; code = 0;
return;
usage:
printf("usage: %s (command | data) "
"(clear | safe | confidential | private)\n",
argv[0]);
code = -1;
} }
static enum protection_level request_data_prot; static enum protection_level request_data_prot;