providers/ident: more aggressive NULL checks
This commit is contained in:
parent
47ab6f6e6e
commit
f875cb8482
1 changed files with 21 additions and 5 deletions
|
@ -42,9 +42,9 @@ struct ident_query
|
||||||
/* Goinked from old s_auth.c --Elizafox */
|
/* Goinked from old s_auth.c --Elizafox */
|
||||||
static const char *messages[] =
|
static const char *messages[] =
|
||||||
{
|
{
|
||||||
":*** Checking Ident",
|
"*** Checking Ident",
|
||||||
":*** Got Ident response",
|
"*** Got Ident response",
|
||||||
":*** No Ident response",
|
"*** No Ident response",
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -101,6 +101,9 @@ ident_connected(rb_fde_t *F, int error, void *data)
|
||||||
char authbuf[32];
|
char authbuf[32];
|
||||||
int authlen;
|
int authlen;
|
||||||
|
|
||||||
|
if(query == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Check the error */
|
/* Check the error */
|
||||||
if(error != RB_OK)
|
if(error != RB_OK)
|
||||||
{
|
{
|
||||||
|
@ -133,6 +136,9 @@ read_ident_reply(rb_fde_t *F, void *data)
|
||||||
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(query == NULL)
|
||||||
|
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))
|
||||||
{
|
{
|
||||||
|
@ -178,9 +184,14 @@ client_fail(struct auth_client *auth, ident_message report)
|
||||||
{
|
{
|
||||||
struct ident_query *query = auth->data[PROVIDER_IDENT];
|
struct ident_query *query = auth->data[PROVIDER_IDENT];
|
||||||
|
|
||||||
|
if(query == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
rb_strlcpy(auth->username, "*", sizeof(auth->username));
|
rb_strlcpy(auth->username, "*", sizeof(auth->username));
|
||||||
|
|
||||||
rb_close(query->F);
|
if(query->F != NULL)
|
||||||
|
rb_close(query->F);
|
||||||
|
|
||||||
rb_free(query);
|
rb_free(query);
|
||||||
auth->data[PROVIDER_IDENT] = NULL;
|
auth->data[PROVIDER_IDENT] = NULL;
|
||||||
|
|
||||||
|
@ -193,7 +204,12 @@ client_success(struct auth_client *auth)
|
||||||
{
|
{
|
||||||
struct ident_query *query = auth->data[PROVIDER_IDENT];
|
struct ident_query *query = auth->data[PROVIDER_IDENT];
|
||||||
|
|
||||||
rb_close(query->F);
|
if(query == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(query->F != NULL)
|
||||||
|
rb_close(query->F);
|
||||||
|
|
||||||
rb_free(query);
|
rb_free(query);
|
||||||
auth->data[PROVIDER_IDENT] = NULL;
|
auth->data[PROVIDER_IDENT] = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue