Example #1
0
int password_match(string name, string password) {
    if(account_exists(name)) {
        if(crypt(password, name) == accounts[name]["password"]) {
            return 1;
        }
    }
    return 0;
}
Example #2
0
void create_account(string name, string password, string email) {
    int firstWizard = 0;

    if(number_of_accounts() < 1)
        firstWizard = 1;

    if(!account_exists(name)) {
        accounts[name] = ([]);
    }
Example #3
0
/*
 * Close_socket()
 *
 * Will close one socket directly, freeing all
 * resources and making the socket availably on
 * the socket free_list.
 */
void close_socket(SOCKET_DATA *dsock, bool reconnect)
{
  if (dsock->lookup_status > TSTATE_DONE) return;
  dsock->lookup_status += 2;

  /* remove the socket from the polling list */
  FD_CLR(dsock->control, &fSet);

  /* remove ourself from the list */
  //
  // NO! We don't want to remove ourself from the list just yet.
  // We will do that the next time we show up in the game_loop.
  // removing now will not close the socket completely. Why, I'm not
  // entirely sure... but it doesn't ;)
  //   - Geoff, Dec26/04
  //
  //  listRemove(socket_list, dsock);
  //

  // we have a character, and it's one that's
  // not in the process of being created
  if (dsock->player && charGetUID(dsock->player) != NOBODY) {
    if (reconnect)
      text_to_socket(dsock, "This connection has been taken over.\r\n");
    else {
      charSetSocket(dsock->player, NULL);
      log_string("Closing link to %s", charGetName(dsock->player));
    }
  }
  else if(dsock->player) {
    charSetSocket(dsock->player, NULL);
    extract_mobile(dsock->player);
  }
  
  if(dsock->account) {
    if(account_exists(accountGetName(dsock->account)))
      unreference_account(dsock->account);
    else
      deleteAccount(dsock->account);
  }

  /* set the closed state */
  dsock->closed = TRUE;
  //  dsock->state = STATE_CLOSED;
}
Example #4
0
int PyAccount_init(PyAccount *self, PyObject *args, PyObject *kwds) {
  char *kwlist[] = {"name", NULL};
  char     *name = NULL;

  // get the uid
  if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &name)) {
    PyErr_Format(PyExc_TypeError, "Accounts may only be created using a name");
    return -1;
  }

  // make sure an account with this name exists
  if(!account_exists(name)) {
    PyErr_Format(PyExc_TypeError, "Account with name %s does not exist.", name);
    return -1;
  }

  self->account = get_account(name);
  return 0;
}
Example #5
0
//*****************************************************************************
// allocation, deallocation, initialization, and comparison
//*****************************************************************************
void PyAccount_dealloc(PyAccount *self) {
  if(account_exists(accountGetName(self->account)))
    unreference_account(self->account);
  self->ob_type->tp_free((PyObject*)self);
}