[BACK]Return to auth.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/auth.c between version 1.46 and 1.46.2.1

version 1.46, 2002/11/04 10:07:53 version 1.46.2.1, 2003/09/16 20:50:42
Line 79 
Line 79 
   
         /* 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;
         }          }
   
         if (options.num_deny_users > 0 || options.num_allow_users > 0) {          if (options.num_deny_users > 0 || options.num_allow_users > 0) {
                 hostname = get_canonical_hostname(options.verify_reverse_mapping);                  hostname = get_canonical_hostname(options.use_dns);
                 ipaddr = get_remote_ipaddr();                  ipaddr = get_remote_ipaddr();
         }          }
   
Line 100 
Line 100 
                 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;
                         }                          }
Line 113 
Line 113 
                                 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;
                 }                  }
Line 121 
Line 121 
         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;
                 }                  }
Line 131 
Line 131 
                         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;
                         }                          }
Line 143 
Line 143 
                         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;
                         }                          }
Line 172 
Line 172 
             !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";
Line 205 
Line 205 
                 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;
 }  }
   
Line 302 
Line 302 
                     (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 {
Line 406 
Line 406 
   
         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);
         }          }
Line 470 
Line 470 
                 buffer_init(&auth_debug);                  buffer_init(&auth_debug);
                 auth_debug_init = 1;                  auth_debug_init = 1;
         }          }
   }
   
   struct passwd *
   fakepw(void)
   {
           static struct passwd fake;
   
           memset(&fake, 0, sizeof(fake));
           fake.pw_name = "NOUSER";
           fake.pw_passwd =
               "$2a$06$r3.juUaHZDlIbQaO2dS9FuYxL1W9M81R1Tc92PoSNmzvpEqLkLGrK";
           fake.pw_gecos = "NOUSER";
           fake.pw_uid = -1;
           fake.pw_gid = -1;
           fake.pw_class = "";
           fake.pw_dir = "/nonexist";
           fake.pw_shell = "/nonexist";
   
           return (&fake);
 }  }

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.46.2.1