mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
providers/ident: fix some nasty crashes
This commit is contained in:
parent
0cff7adb13
commit
d1b70e3524
1 changed files with 17 additions and 7 deletions
|
@ -68,7 +68,7 @@ static int ident_timeout = 5;
|
||||||
|
|
||||||
/* Timeout outstanding queries */
|
/* Timeout outstanding queries */
|
||||||
static void
|
static void
|
||||||
timeout_ident_queries_event(void *notused)
|
timeout_ident_queries_event(void *notused __unused)
|
||||||
{
|
{
|
||||||
struct auth_client *auth;
|
struct auth_client *auth;
|
||||||
rb_dictionary_iter iter;
|
rb_dictionary_iter iter;
|
||||||
|
@ -94,13 +94,18 @@ timeout_ident_queries_event(void *notused)
|
||||||
* problems arise. -avalon
|
* problems arise. -avalon
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
ident_connected(rb_fde_t *F, int error, void *data)
|
ident_connected(rb_fde_t *F __unused, int error, void *data)
|
||||||
{
|
{
|
||||||
struct auth_client *auth = data;
|
struct auth_client *auth = data;
|
||||||
struct ident_query *query = auth->data[PROVIDER_IDENT];
|
struct ident_query *query;
|
||||||
char authbuf[32];
|
char authbuf[32];
|
||||||
int authlen;
|
int authlen;
|
||||||
|
|
||||||
|
if(auth == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
query = auth->data[PROVIDER_IDENT];
|
||||||
|
|
||||||
if(query == NULL)
|
if(query == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -129,20 +134,25 @@ static void
|
||||||
read_ident_reply(rb_fde_t *F, void *data)
|
read_ident_reply(rb_fde_t *F, void *data)
|
||||||
{
|
{
|
||||||
struct auth_client *auth = data;
|
struct auth_client *auth = data;
|
||||||
struct ident_query *query = auth->data[PROVIDER_IDENT];
|
struct ident_query *query;
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
char *t = NULL;
|
char *t = NULL;
|
||||||
int len;
|
int len;
|
||||||
int count;
|
int count;
|
||||||
char buf[IDENT_BUFSIZE + 1]; /* buffer to read auth reply into */
|
char buf[IDENT_BUFSIZE + 1]; /* buffer to read auth reply into */
|
||||||
|
|
||||||
|
if(auth == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
query = auth->data[PROVIDER_IDENT];
|
||||||
|
|
||||||
if(query == NULL)
|
if(query == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
len = rb_read(F, buf, IDENT_BUFSIZE);
|
len = rb_read(F, buf, IDENT_BUFSIZE);
|
||||||
if(len < 0 && rb_ignore_errno(errno))
|
if(len < 0 && rb_ignore_errno(errno))
|
||||||
{
|
{
|
||||||
rb_setselect(F, RB_SELECT_READ, read_ident_reply, query);
|
rb_setselect(F, RB_SELECT_READ, read_ident_reply, auth);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +352,7 @@ static bool ident_start(struct auth_client *auth)
|
||||||
rb_connect_tcp(query->F, (struct sockaddr *)&c_addr,
|
rb_connect_tcp(query->F, (struct sockaddr *)&c_addr,
|
||||||
(struct sockaddr *)&l_addr,
|
(struct sockaddr *)&l_addr,
|
||||||
GET_SS_LEN(&l_addr), ident_connected,
|
GET_SS_LEN(&l_addr), ident_connected,
|
||||||
query, ident_timeout);
|
auth, ident_timeout);
|
||||||
|
|
||||||
set_provider_on(auth, PROVIDER_IDENT);
|
set_provider_on(auth, PROVIDER_IDENT);
|
||||||
|
|
||||||
|
@ -359,7 +369,7 @@ ident_cancel(struct auth_client *auth)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_conf_ident_timeout(const char *key, int parc, const char **parv)
|
add_conf_ident_timeout(const char *key __unused, int parc __unused, const char **parv)
|
||||||
{
|
{
|
||||||
int timeout = atoi(parv[0]);
|
int timeout = atoi(parv[0]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue