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];
int authlen;
if(auth == NULL)
return;
if((query = get_provider_data(auth, PROVIDER_IDENT)) == NULL)
return;
lrb_assert(auth != NULL);
query = get_provider_data(auth, PROVIDER_IDENT);
lrb_assert(query != NULL);
/* Check the error */
if(error != RB_OK)
@ -126,11 +124,9 @@ read_ident_reply(rb_fde_t *F, void *data)
ssize_t len;
int count;
if(auth == NULL)
return;
if((query = get_provider_data(auth, PROVIDER_IDENT)) == NULL)
return;
lrb_assert(auth != NULL);
query = get_provider_data(auth, PROVIDER_IDENT);
lrb_assert(query != NULL);
len = rb_read(F, buf, IDENT_BUFSIZE);
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);
if(query == NULL)
return;
lrb_assert(query != NULL);
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);
if(query == NULL)
return;
lrb_assert(query != NULL);
if(query->F != NULL)
rb_close(query->F);