1
0
forked from bip/bip

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 untrusted user: 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);
break;
case LEX_PORT:
s->port = t->ndata;
s->port = (unsigned short)t->ndata;
break;
default:
fatal("Config error in server block (%d)", t->type);
@ -317,8 +317,13 @@ static int add_network(bip_t *bip, list_t *data)
break;
#endif
case LEX_SERVER:
n->serverv = bip_realloc(n->serverv, (n->serverc + 1)
* sizeof(struct server));
if (n->serverc < 0) {
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++;
memset(&n->serverv[n->serverc - 1], 0,
sizeof(struct server));

View File

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

View File

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

View File

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