Ignore:
Timestamp:
2007-02-01T16:30:11+13:00 (17 years ago)
Author:
mdewsnip
Message:

Jeffrey's (DL Consulting) changes to userdb to make it a proper class, so it can be easily extended for collection-specific receptionists.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/authenaction.cpp

    r9620 r13844  
    169169  if (args["uan"].empty()) return true;
    170170
     171  userdbclass *user_database = new userdbclass(usersfile);
     172  keydbclass *key_database = new keydbclass(keyfile);
    171173
    172174  // failure means we have to redirect to this action to get authentication
     
    187189
    188190  // make sure we have a username
    189   if (!args_un.empty() && get_user_info (usersfile, args_un, thisuser)) {
     191  if (!args_un.empty() && (user_database->get_user_info (args_un, thisuser) == ERRNO_SUCCEED)) {
    190192    if (!args_pw.empty()) {
    191193      // we are authenticating using a password
    192       if (check_passwd (thisuser, args_pw)) args_ua = "1"; // succeeded
     194      if (user_database->check_passwd (thisuser.username, args_pw) == ERRNO_SUCCEED) args_ua = "1"; // succeeded
    193195     
    194196    } else if (!args_ky.empty()) {
    195197      // we are authenticating using a key
    196       if (check_key (keyfile, thisuser, args_ky, args_ug, keydecay)) args_ua = "1";
     198      if (key_database->check_key(thisuser, args_ky, args_ug, keydecay)) args_ua = "1";
    197199      else args_us = "stalekey";
    198200    }
     
    245247     // note: we don't need to set "ug" as it is already set to what it needs to be
    246248     args_us = "enabled";
    247     args_ky = generate_key (keyfile, args_un); // new key
     249     args_ky = key_database->generate_key(args_un); // new key
    248250   
    249251    // delete old keys around every 50 accesses
    250     if (rand()%50 == 1) remove_old_keys (keyfile, keydecay);
     252    if (rand()%50 == 1) key_database->remove_old_keys(keydecay);
    251253   
    252254      } else {
Note: See TracChangeset for help on using the changeset viewer.