Skip to content

Commit

Permalink
Assertions to quiet clang scan
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok authored and arr2036 committed May 2, 2014
1 parent 19a6f25 commit 79f2df6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/modules/rlm_pap/rlm_pap.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ static rlm_rcode_t mod_authorize(void *instance, REQUEST *request)

static int pap_auth_clear(UNUSED rlm_pap_t *inst, REQUEST *request, VALUE_PAIR *vp)
{
rad_assert(request != NULL);

if (RDEBUG_ENABLED3) {
RDEBUG3("Comparing with \"known good\" Cleartext-Password \"%s\"", vp->vp_strvalue);
} else {
Expand All @@ -421,6 +423,8 @@ static int pap_auth_clear(UNUSED rlm_pap_t *inst, REQUEST *request, VALUE_PAIR *

static int pap_auth_crypt(UNUSED rlm_pap_t *inst, REQUEST *request, VALUE_PAIR *vp)
{
rad_assert(request != NULL);

if (RDEBUG_ENABLED3) {
RDEBUG3("Comparing with \"known good\" Crypt-Password \"%s\"", vp->vp_strvalue);
} else {
Expand All @@ -440,6 +444,8 @@ static int pap_auth_md5(rlm_pap_t *inst, REQUEST *request, VALUE_PAIR *vp)
FR_MD5_CTX md5_context;
uint8_t digest[128];

rad_assert(request != NULL);

RDEBUG("Comparing with \"known-good\" MD5-Password");

if (inst->normify) {
Expand Down Expand Up @@ -469,6 +475,8 @@ static int pap_auth_smd5(rlm_pap_t *inst, REQUEST *request, VALUE_PAIR *vp)
FR_MD5_CTX md5_context;
uint8_t digest[128];

rad_assert(request != NULL);

RDEBUG("Comparing with \"known-good\" SMD5-Password");

if (inst->normify) {
Expand Down Expand Up @@ -501,6 +509,8 @@ static int pap_auth_sha(rlm_pap_t *inst, REQUEST *request, VALUE_PAIR *vp)
fr_SHA1_CTX sha1_context;
uint8_t digest[128];

rad_assert(request != NULL);

RDEBUG("Comparing with \"known-good\" SHA-Password");

if (inst->normify) {
Expand Down Expand Up @@ -529,6 +539,8 @@ static int pap_auth_ssha(rlm_pap_t *inst, REQUEST *request, VALUE_PAIR *vp)
fr_SHA1_CTX sha1_context;
uint8_t digest[128];

rad_assert(request != NULL);

RDEBUG("Comparing with \"known-good\" SSHA-Password");

if (inst->normify) {
Expand Down Expand Up @@ -562,6 +574,8 @@ static int pap_auth_sha2(rlm_pap_t *inst, REQUEST *request, VALUE_PAIR *vp)
uint8_t digest[EVP_MAX_MD_SIZE];
unsigned int digestlen;

rad_assert(request != NULL);

RDEBUG("Comparing with \"known-good\" SHA2-Password");

if (inst->normify) {
Expand Down Expand Up @@ -625,6 +639,8 @@ static int pap_auth_nt(rlm_pap_t *inst, REQUEST *request, VALUE_PAIR *vp)
uint8_t digest[16];
char charbuf[32 + 1];

rad_assert(request != NULL);

RDEBUG("Comparing with \"known-good\" NT-Password");

if (inst->normify) {
Expand Down Expand Up @@ -654,6 +670,8 @@ static int pap_auth_lm(rlm_pap_t *inst, REQUEST *request, VALUE_PAIR *vp)
uint8_t digest[16];
char charbuf[32 + 1];

rad_assert(request != NULL);

RDEBUG("Comparing with \"known-good\" LM-Password");

if (inst->normify) {
Expand Down Expand Up @@ -684,6 +702,8 @@ static int pap_auth_ns_mta_md5(UNUSED rlm_pap_t *inst, REQUEST *request, VALUE_P
uint8_t buff[MAX_STRING_LEN];
char buff2[MAX_STRING_LEN + 50];

rad_assert(request != NULL);

RDEBUG("Using NT-MTA-MD5-Password");

if (vp->length != 64) {
Expand Down Expand Up @@ -749,6 +769,7 @@ static rlm_rcode_t mod_authenticate(void *instance, REQUEST *request)
vp_cursor_t cursor;
int (*auth_func)(rlm_pap_t *, REQUEST *, VALUE_PAIR *) = NULL;

rad_assert(request != NULL);

if (!request->password ||
(request->password->da->attr != PW_USER_PASSWORD)) {
Expand Down

0 comments on commit 79f2df6

Please sign in to comment.