version 1.46, 2002/11/04 10:07:53 |
version 1.47, 2003/04/08 20:21:28 |
|
|
|
|
/* deny if shell does not exists or is not executable */ |
/* deny if shell does not exists or is not executable */ |
if (stat(shell, &st) != 0) { |
if (stat(shell, &st) != 0) { |
log("User %.100s not allowed because shell %.100s does not exist", |
logit("User %.100s not allowed because shell %.100s does not exist", |
pw->pw_name, shell); |
pw->pw_name, shell); |
return 0; |
return 0; |
} |
} |
if (S_ISREG(st.st_mode) == 0 || |
if (S_ISREG(st.st_mode) == 0 || |
(st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP)) == 0) { |
(st.st_mode & (S_IXOTH|S_IXUSR|S_IXGRP)) == 0) { |
log("User %.100s not allowed because shell %.100s is not executable", |
logit("User %.100s not allowed because shell %.100s is not executable", |
pw->pw_name, shell); |
pw->pw_name, shell); |
return 0; |
return 0; |
} |
} |
|
|
for (i = 0; i < options.num_deny_users; i++) |
for (i = 0; i < options.num_deny_users; i++) |
if (match_user(pw->pw_name, hostname, ipaddr, |
if (match_user(pw->pw_name, hostname, ipaddr, |
options.deny_users[i])) { |
options.deny_users[i])) { |
log("User %.100s not allowed because listed in DenyUsers", |
logit("User %.100s not allowed because listed in DenyUsers", |
pw->pw_name); |
pw->pw_name); |
return 0; |
return 0; |
} |
} |
|
|
break; |
break; |
/* i < options.num_allow_users iff we break for loop */ |
/* i < options.num_allow_users iff we break for loop */ |
if (i >= options.num_allow_users) { |
if (i >= options.num_allow_users) { |
log("User %.100s not allowed because not listed in AllowUsers", |
logit("User %.100s not allowed because not listed in AllowUsers", |
pw->pw_name); |
pw->pw_name); |
return 0; |
return 0; |
} |
} |
|
|
if (options.num_deny_groups > 0 || options.num_allow_groups > 0) { |
if (options.num_deny_groups > 0 || options.num_allow_groups > 0) { |
/* Get the user's group access list (primary and supplementary) */ |
/* Get the user's group access list (primary and supplementary) */ |
if (ga_init(pw->pw_name, pw->pw_gid) == 0) { |
if (ga_init(pw->pw_name, pw->pw_gid) == 0) { |
log("User %.100s not allowed because not in any group", |
logit("User %.100s not allowed because not in any group", |
pw->pw_name); |
pw->pw_name); |
return 0; |
return 0; |
} |
} |
|
|
if (ga_match(options.deny_groups, |
if (ga_match(options.deny_groups, |
options.num_deny_groups)) { |
options.num_deny_groups)) { |
ga_free(); |
ga_free(); |
log("User %.100s not allowed because a group is listed in DenyGroups", |
logit("User %.100s not allowed because a group is listed in DenyGroups", |
pw->pw_name); |
pw->pw_name); |
return 0; |
return 0; |
} |
} |
|
|
if (!ga_match(options.allow_groups, |
if (!ga_match(options.allow_groups, |
options.num_allow_groups)) { |
options.num_allow_groups)) { |
ga_free(); |
ga_free(); |
log("User %.100s not allowed because none of user's groups are listed in AllowGroups", |
logit("User %.100s not allowed because none of user's groups are listed in AllowGroups", |
pw->pw_name); |
pw->pw_name); |
return 0; |
return 0; |
} |
} |
|
|
!authctxt->valid || |
!authctxt->valid || |
authctxt->failures >= AUTH_FAIL_LOG || |
authctxt->failures >= AUTH_FAIL_LOG || |
strcmp(method, "password") == 0) |
strcmp(method, "password") == 0) |
authlog = log; |
authlog = logit; |
|
|
if (authctxt->postponed) |
if (authctxt->postponed) |
authmsg = "Postponed"; |
authmsg = "Postponed"; |
|
|
break; |
break; |
case PERMIT_FORCED_ONLY: |
case PERMIT_FORCED_ONLY: |
if (forced_command) { |
if (forced_command) { |
log("Root login accepted for forced command."); |
logit("Root login accepted for forced command."); |
return 1; |
return 1; |
} |
} |
break; |
break; |
} |
} |
log("ROOT LOGIN REFUSED FROM %.200s", get_remote_ipaddr()); |
logit("ROOT LOGIN REFUSED FROM %.200s", get_remote_ipaddr()); |
return 0; |
return 0; |
} |
} |
|
|
|
|
(stat(user_hostfile, &st) == 0) && |
(stat(user_hostfile, &st) == 0) && |
((st.st_uid != 0 && st.st_uid != pw->pw_uid) || |
((st.st_uid != 0 && st.st_uid != pw->pw_uid) || |
(st.st_mode & 022) != 0)) { |
(st.st_mode & 022) != 0)) { |
log("Authentication refused for %.100s: " |
logit("Authentication refused for %.100s: " |
"bad owner or modes for %.200s", |
"bad owner or modes for %.200s", |
pw->pw_name, user_hostfile); |
pw->pw_name, user_hostfile); |
} else { |
} else { |
|
|
|
|
pw = getpwnam(user); |
pw = getpwnam(user); |
if (pw == NULL) { |
if (pw == NULL) { |
log("Illegal user %.100s from %.100s", |
logit("Illegal user %.100s from %.100s", |
user, get_remote_ipaddr()); |
user, get_remote_ipaddr()); |
return (NULL); |
return (NULL); |
} |
} |