handle more config errors, use char not int:1

This commit is contained in:
Loïc Gomez 2022-01-09 19:34:49 +01:00 committed by Pierre-Louis Bonicoli
parent fbfae37d65
commit 94fe272018
Signed by: pilou
GPG Key ID: 06914C4A5EDAA6DD
4 changed files with 24 additions and 14 deletions

View File

@ -111,7 +111,7 @@ static int add_server(bip_t *bip, struct server *s, list_t *data)
MOVE_STRING(s->host, t->pdata); MOVE_STRING(s->host, t->pdata);
break; break;
case LEX_PORT: case LEX_PORT:
s->port = t->ndata; s->port = (unsigned short)t->ndata;
break; break;
default: default:
fatal("Config error in server block (%d)", t->type); fatal("Config error in server block (%d)", t->type);
@ -317,8 +317,13 @@ static int add_network(bip_t *bip, list_t *data)
break; break;
#endif #endif
case LEX_SERVER: case LEX_SERVER:
n->serverv = bip_realloc(n->serverv, (n->serverc + 1) if (n->serverc < 0) {
* sizeof(struct server)); conf_die(bip, "internal error in network statement");
return 0;
}
n->serverv = bip_realloc(n->serverv,
(unsigned int)(n->serverc + 1) * sizeof(struct server));
n->serverc++; n->serverc++;
memset(&n->serverv[n->serverc - 1], 0, memset(&n->serverv[n->serverc - 1], 0,
sizeof(struct server)); sizeof(struct server));

View File

@ -1496,6 +1496,9 @@ static int SSLize(connection_t *cn, int *nc)
return 1; return 1;
} }
break; break;
default:
mylog(LOG_ERROR, "Unknown ssl_check_mode (%d)!", cn->ssl_check_mode);
return 1;
} }
if (err2 == SSL_ERROR_SYSCALL) { if (err2 == SSL_ERROR_SYSCALL) {
@ -1533,6 +1536,8 @@ static connection_t *_connection_new_SSL(char *dsthostname, char *dstport,
switch (conn->ssl_check_mode) { switch (conn->ssl_check_mode) {
struct stat st_buf; struct stat st_buf;
case SSL_CHECK_NONE:
break;
case SSL_CHECK_BASIC: case SSL_CHECK_BASIC:
if (!SSL_CTX_load_verify_locations(conn->ssl_ctx_h, check_store, if (!SSL_CTX_load_verify_locations(conn->ssl_ctx_h, check_store,
NULL)) { NULL)) {

View File

@ -1360,7 +1360,7 @@ int irc_dispatch(bip_t *bip, struct link_any *l, struct line *line)
break; break;
#endif #endif
default: default:
fatal("gnéééééé"); fatal("irc_dispatch: unknown IRC_TYPE_SERVER");
} }
return ERR_PROTOCOL; /* never reached */ return ERR_PROTOCOL; /* never reached */
} }

View File

@ -77,12 +77,12 @@ struct bipuser {
char *default_realname; char *default_realname;
/* backlog options */ /* backlog options */
int backlog:1; char backlog;
int backlog_lines; int backlog_lines;
int always_backlog:1; char always_backlog;
int bl_msg_only:1; char bl_msg_only;
int blreset_on_talk:1; char blreset_on_talk;
int blreset_connection:1; char blreset_connection;
enum BLTimestamp backlog_timestamp; enum BLTimestamp backlog_timestamp;
@ -93,7 +93,7 @@ struct bipuser {
#endif #endif
hash_t connections; hash_t connections;
int in_use:1; /* for mark and sweep on reload */ char in_use; /* for mark and sweep on reload */
}; };
struct network struct network
@ -137,10 +137,10 @@ struct link {
/** link options */ /** link options */
int follow_nick:1; char follow_nick;
int ignore_first_nick:1; char ignore_first_nick;
int autojoin_on_kick:1; char autojoin_on_kick;
int ignore_server_capab:1; char ignore_server_capab;
list_t on_connect_send; list_t on_connect_send;
char *no_client_away_msg; char *no_client_away_msg;
char *away_nick; char *away_nick;