63 #define NUM_ACCOUNT_FIELDS 6 105 #define ACCOUNT_FILE "accounts" 127 if (accounts != NULL) {
128 LOG(
llevError,
"account_load_entries(): Called when accounts has been set.\n");
137 LOG(
llevInfo,
"Warning: Unable to open %s [%s]\n", fname, strerror(errno));
145 if (buf[0] ==
'#')
continue;
148 cp = strchr(buf,
'\n');
156 ac->
last_login = strtoul(tmp[2], (
char**)NULL, 10);
162 if (fields>4) ac->
created = strtoul(tmp[4], (
char**)NULL, 10);
169 if (tmp[3][0] == 0) {
179 for (cp = tmp[3]; *cp !=
'\0'; cp++) {
188 LOG(
llevError,
"account_load_entries: split_string found different number of characters: %d != %d\n",
193 LOG(
llevError,
"account_load_entries: Too many characters set for account %s - truncating to %d\n",
283 fprintf(fp,
"# IMPORTANT: Do not edit this file while the server is running. This file is\n" 284 "# only read when the server starts, and any changes will be overwritten when\n" 285 "# the server exits.\n");
286 fprintf(fp,
"# Format:\n");
287 fprintf(fp,
"# Account name:Password:Account last used:Characters (semicolon separated):created:expansion\n");
288 for (ac=accounts; ac; ac=ac->
next) {
313 for (ac=accounts; ac; ac=ac->
next) {
336 for (ac=accounts; ac; ac=ac->
next) {
371 const char *cp = str;
374 if (!isalnum(*str))
return 1;
375 for (; *str !=
'\0'; ++str) {
376 if (!isprint(*str))
return 1;
387 if (isspace(*(str-1)))
return 1;
388 if ((str - cp) >
MAX_NAME)
return 2;
464 for (ac=accounts; ac; ac=ac->
next) {
467 if (ac == NULL)
return 1;
501 if (account_name == NULL)
504 for (ac=accounts; ac; ac=ac->
next) {
507 if (ac == NULL)
return 1;
547 for (ac=accounts; ac; ac=ac->
next) {
567 for (ac=accounts; ac; ac=ac->
next) {
659 const char *current_password,
const char *new_password) {
669 for (ac = accounts; ac; ac = ac->
next) {
bool check_password(const char *typed, const char *crypted)
void accounts_clear(void)
char * character_names[MAX_CHARACTERS_PER_ACCOUNT+1]
#define NUM_ACCOUNT_FIELDS
struct account_struct * next
int account_link(const char *account_name, const char *player_name)
player * account_get_logged_in_player(const char *name)
socket_struct * init_sockets
const char * account_exists(const char *account_name)
int account_login(const char *account_name, const char *account_password)
void account_password(char *buf, int len, socket_struct *ns)
int of_close(OutputFile *of)
static int accounts_loaded
int account_remove_player(const char *account_name, const char *player_name)
struct account_struct account_struct
socket_struct * account_get_logged_in_init_socket(const char *name)
int account_new(const char *account_name, const char *account_password)
char ** account_get_players_for_account(const char *account_name)
int account_change_password(const char *account_name, const char *current_password, const char *new_password)
FILE * of_open(OutputFile *of, const char *fname)
#define MAX_CHARACTERS_PER_ACCOUNT
EXTERN player * first_player
int strcasecmp(const char *s1, const char *s2)
size_t split_string(char *str, char *array[], size_t array_size, char sep)
void LOG(LogLevel logLevel, const char *format,...)
int account_is_logged_in(const char *name)
int account_check_string(const char *str)
static void account_write_entry(FILE *fp, account_struct *ac)
static account_struct * accounts
char const * newhash(char const *password)
const char * account_get_account_for_char(const char *charname)