constants for the different auth levels.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@988 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1996-11-16 19:12:09 +00:00
parent 6bed98db4d
commit b7ac6b631d

View File

@@ -185,7 +185,12 @@ static char ttyline[20];
* 2 only authorized and anonymous connections, * 2 only authorized and anonymous connections,
* 3 only authorized * 3 only authorized
*/ */
static int auth_level = 1; #define AUTH_NONE 0
#define AUTH_OTP 1
#define AUTH_SAFE 2
#define AUTH_USER 3
static int auth_level = AUTH_SAFE;
/* /*
* Timeout intervals for retrying connections * Timeout intervals for retrying connections
@@ -282,13 +287,13 @@ main(int argc, char **argv)
case 'a': case 'a':
{ {
if(strcmp(optarg, "none") == 0) if(strcmp(optarg, "none") == 0)
auth_level = 0; auth_level = AUTH_NONE;
else if(strcmp(optarg, "otp") == 0) else if(strcmp(optarg, "otp") == 0)
auth_level = 1; auth_level = AUTH_OTP;
else if(strcmp(optarg, "safe") == 0) else if(strcmp(optarg, "safe") == 0)
auth_level = 2; auth_level = AUTH_SAFE;
else if(strcmp(optarg, "user") == 0) else if(strcmp(optarg, "user") == 0)
auth_level = 3; auth_level = AUTH_USER;
else else
warnx("bad value for -a"); warnx("bad value for -a");
break; break;
@@ -516,7 +521,7 @@ user(char *name)
{ {
char *cp, *shell; char *cp, *shell;
if(auth_level == 3 && !auth_complete){ if(auth_level == AUTH_USER && !auth_complete){
reply(530, "No login allowed without authorization."); reply(530, "No login allowed without authorization.");
return; return;
} }
@@ -549,7 +554,7 @@ user(char *name)
"ANONYMOUS FTP LOGIN REFUSED FROM %s", remotehost); "ANONYMOUS FTP LOGIN REFUSED FROM %s", remotehost);
return; return;
} }
if(auth_level == 2 && !auth_complete){ if(auth_level == AUTH_SAFE && !auth_complete){
reply(530, "Only authorized and anonymous login allowed."); reply(530, "Only authorized and anonymous login allowed.");
return; return;
} }
@@ -582,7 +587,7 @@ user(char *name)
reply(331, "Password %s for %s required.", reply(331, "Password %s for %s required.",
ss, name); ss, name);
askpasswd = 1; askpasswd = 1;
} else if (auth_level == 0) { } else if (auth_level == AUTH_NONE) {
reply(331, "Password required for %s.", name); reply(331, "Password required for %s.", name);
askpasswd = 1; askpasswd = 1;
} else { } else {
@@ -750,7 +755,7 @@ pass(char *passwd)
rval = 1; /* failure below */ rval = 1; /* failure below */
else if (otp_verify_user (&otp_ctx, passwd) == 0) { else if (otp_verify_user (&otp_ctx, passwd) == 0) {
rval = 0; rval = 0;
} else if(auth_level == 0) { } else if(auth_level == AUTH_NONE) {
char realm[REALM_SZ]; char realm[REALM_SZ];
if((rval = krb_get_lrealm(realm, 1)) == KSUCCESS) if((rval = krb_get_lrealm(realm, 1)) == KSUCCESS)
rval = krb_verify_user(pw->pw_name, "", realm, rval = krb_verify_user(pw->pw_name, "", realm,