예제 #1
0
Protocol_Record *
PMS_Ruser::insert_protocol_info (Protocol_Record &protocol_record)
{
  Drwho_Node *current_node = protocol_record.get_drwho_list ();
  Protocol_Record *prp = this->ss->insert (current_node->get_host_name (),
                                           MAXHOSTNAMELEN);
  Drwho_Node *np = this->get_drwho_node (ACE::strnnew (protocol_record.get_login (),
                                                       MAXUSERIDNAMELEN),
                                         prp->drwho_list_);

  if (Options::get_opt (Options::PRINT_LOGIN_NAME))
    np->set_real_name ("");
  else
    {
      passwd *pwent = ACE_OS::getpwnam (np->get_login_name ());
      char *cp =
        (char *) ACE_OS::strchr (np->set_real_name (pwent == 0
                                                    ? np->get_login_name ()
                                                    : ACE::strnew (pwent->pw_gecos)),
                                 ',');
      if (cp != 0)
        *cp = '\0';
    }

  if (current_node->get_idle_time () >= MAX_USER_TIMEOUT)
    np->inactive_count_++;
  else
    np->active_count_++;

  return prp;
}
예제 #2
0
Protocol_Record *
PMC_Ruser::insert_protocol_info (Protocol_Record &protocol_record)
{
    Protocol_Record *prp = this->ss->insert (protocol_record.get_host (),
                           MAXHOSTNAMELEN);
    Drwho_Node *current_node = protocol_record.get_drwho_list ();
    Drwho_Node *np = this->get_drwho_node (ACE::strnnew (current_node->get_login_name (),
                                           MAXUSERIDNAMELEN),
                                           prp->drwho_list_);
    int length = ACE_OS::strlen (prp->get_host ());

    np->set_real_name (ACE::strnew (current_node->get_real_name ()));

    if (np->get_active_count () < current_node->get_active_count ())
        np->set_active_count (current_node->get_active_count ());
    if (np->get_inactive_count () < current_node->get_inactive_count())
        np->set_inactive_count (current_node->get_inactive_count ());

    if (length > this->max_key_length)
        this->max_key_length = length;

    return prp;
}