ident: replace some checks with asserts

These checks shouldn't ever trigger, and if they do, it's a problem.
This commit is contained in:
Elizabeth Myers 2016-04-04 03:48:42 -05:00
parent 751d39cc17
commit 9155a94867

View file

@ -87,11 +87,9 @@ ident_connected(rb_fde_t *F __unused, int error, void *data)
char authbuf[32]; char authbuf[32];
int authlen; int authlen;
if(auth == NULL) lrb_assert(auth != NULL);
return; query = get_provider_data(auth, PROVIDER_IDENT);
lrb_assert(query != NULL);
if((query = get_provider_data(auth, PROVIDER_IDENT)) == NULL)
return;
/* Check the error */ /* Check the error */
if(error != RB_OK) if(error != RB_OK)
@ -126,11 +124,9 @@ read_ident_reply(rb_fde_t *F, void *data)
ssize_t len; ssize_t len;
int count; int count;
if(auth == NULL) lrb_assert(auth != NULL);
return; query = get_provider_data(auth, PROVIDER_IDENT);
lrb_assert(query != NULL);
if((query = get_provider_data(auth, PROVIDER_IDENT)) == 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))
@ -176,8 +172,7 @@ client_fail(struct auth_client *auth, ident_message report)
{ {
struct ident_query *query = get_provider_data(auth, PROVIDER_IDENT); struct ident_query *query = get_provider_data(auth, PROVIDER_IDENT);
if(query == NULL) lrb_assert(query != NULL);
return;
rb_strlcpy(auth->username, "*", sizeof(auth->username)); rb_strlcpy(auth->username, "*", sizeof(auth->username));
@ -197,8 +192,7 @@ client_success(struct auth_client *auth)
{ {
struct ident_query *query = get_provider_data(auth, PROVIDER_IDENT); struct ident_query *query = get_provider_data(auth, PROVIDER_IDENT);
if(query == NULL) lrb_assert(query != NULL);
return;
if(query->F != NULL) if(query->F != NULL)
rb_close(query->F); rb_close(query->F);