49#define GUEST_NAME "guest"
51#define MIN_PASSWORD_LEN 6
52#define MIN_PASSWORD_CAPS 0
53#define MIN_PASSWORD_NUMS 0
55#define MAX_AUTH_TRIES 3
56#define MAX_WAIT_TIME 300
86 _(
"Warning: the guest name '%s' has been "
87 "taken, renaming to user '%s'."),
tmpname, username);
94 log_normal(
_(
"%s was rejected: Guests not allowed."), username);
111 log_error(
"Error reading database; connection -> guest");
113 _(
"There was an error reading the user "
114 "database, logging in as guest connection '%s'."),
119 "and guest logins are not allowed. Sorry"),
121 log_normal(
_(
"%s was rejected: Database error and guests not "
122 "allowed."),
pconn->username);
127 fc_snprintf(buffer,
sizeof(buffer),
_(
"Enter password for %s:"),
136 sz_strlcpy(buffer,
_(
"First time login. Set a new password and confirm it."));
142 "users. Sorry."),
pconn);
143 log_normal(
_(
"%s was rejected: Only preregistered users allowed."),
166 log_normal(
_(
"%s was rejected: Too many wrong password "
167 "verifies for new user."),
pconn->username);
178 _(
"Warning: There was an error in saving to the database. "
179 "Continuing, but your stats will not be saved."));
192 pconn->server.auth_tries++;
209 switch (
pconn->server.status) {
216 if (
pconn->server.auth_settime > 0
217 && time(
NULL) >=
pconn->server.auth_settime) {
222 log_normal(
_(
"%s was rejected: Too many wrong password tries."),
231 _(
"Your password is incorrect. Try again."));
242 log_normal(
_(
"%s was rejected: Connection timeout waiting for "
243 "password."),
pconn->username);
308 _(
"Your password is too short, the minimum length is %d. "
314 _(
"The password must have at least %d capital letters, %d "
315 "numbers, and be at minimum %d [printable] characters long. "
352 return pconn->username;
362 return pconn->server.ipaddr;
static bool is_good_password(const char *password, char *msg)
#define MIN_PASSWORD_CAPS
#define MIN_PASSWORD_NUMS
bool auth_handle_reply(struct connection *pconn, char *password)
static bool is_guest_name(const char *name)
static const int auth_fail_wait[]
const char * auth_get_username(struct connection *pconn)
void auth_process_status(struct connection *pconn)
const char * auth_get_ipaddr(struct connection *pconn)
bool auth_user(struct connection *pconn, char *username)
static void get_unique_guest_name(char *name)
void reject_new_connection(const char *msg, struct connection *pconn)
void connection_close_server(struct connection *pconn, const char *reason)
void establish_new_connection(struct connection *pconn)
struct connection * conn_by_user(const char *user_name)
const struct ft_color ftc_warning
#define fc_assert_ret(condition)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_normal(message,...)
#define log_error(message,...)
void notify_conn(struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void notify_conn_early(struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
int dsend_packet_authentication_req(struct connection *pc, enum authentication_type type, const char *message)
int send_packet_authentication_req(struct connection *pc, const struct packet_authentication_req *packet)
bool script_fcdb_call(const char *func_name,...)
bool is_ascii_name(const char *name)
struct server_arguments srvarg
enum authentication_type type
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
int fc_strncasecmp(const char *str0, const char *str1, size_t n)
#define sz_strlcpy(dest, src)
#define fc_strncmp(_s1_, _s2_, _len_)