perl -p -i -e 's/([^ ()|=]+) == NULL/!$1/g' $(find src/modules/ -name "*.c" -print)
* No entry matched. We didn't do anything.
*/
if (!found) {
- rad_assert(output == NULL);
+ rad_assert(!output);
return RLM_MODULE_NOOP;
}
/*
* Discover the attribute number of the key.
*/
- if (inst->attribute == NULL) {
+ if (!inst->attribute) {
radlog(L_ERR, "rlm_attr_rewrite: 'attribute' must be set.");
return -1;
}
- if (inst->search == NULL || inst->replace == NULL) {
+ if (!inst->search || !inst->replace) {
radlog(L_ERR, "rlm_attr_rewrite: search/replace strings must be set.");
return -1;
}
radlog(L_ERR, "rlm_attr_rewrite: Illegal range for match number.");
return -1;
}
- if (inst->searchin_str == NULL) {
+ if (!inst->searchin_str) {
radlog(L_ERR, "rlm_attr_rewrite: Illegal searchin directive given. Assuming packet.");
inst->searchin = RLM_REGEX_INPACKET;
}
}
}
dattr = dict_attrbyname(inst->attribute);
- if (dattr == NULL) {
+ if (!dattr) {
radlog(L_ERR, "rlm_attr_rewrite: No such attribute %s",
inst->attribute);
return -1;
char replace_STR[MAX_STRING_LEN];
if ((attr_vp = pairfind(request->config_items, PW_REWRITE_RULE, 0, TAG_ANY)) != NULL){
- if (inst->name == NULL || strcmp(inst->name,attr_vp->vp_strvalue))
+ if (!inst->name || strcmp(inst->name,attr_vp->vp_strvalue))
return RLM_MODULE_NOOP;
}
* @todo: this shouldn't really be the request.
*/
attr_vp = pairmake(request, NULL, inst->attribute,replace_STR,0);
- if (attr_vp == NULL){
+ if (!attr_vp){
DEBUG2("%s: Could not add new attribute %s with value '%s'", inst->name,
inst->attribute,replace_STR);
return rcode;
do_again:
if (tmp != NULL)
attr_vp = pairfind(tmp, inst->da->attr, inst->da->vendor, TAG_ANY);
- if (attr_vp == NULL) {
+ if (!attr_vp) {
DEBUG2("%s: Could not find value pair for attribute %s", inst->name,inst->attribute);
return rcode;
}
* Find the key attribute.
*/
key_vp = pairfind(request, inst->key_attr, 0, TAG_ANY);
- if (key_vp == NULL) {
+ if (!key_vp) {
return RLM_MODULE_NOOP;
}
count_datum = gdbm_fetch(inst->gdbm, key_datum);
- if (count_datum.dptr == NULL) {
+ if (!count_datum.dptr) {
return -1;
}
memcpy(&counter, count_datum.dptr, sizeof(rad_counter));
*/
inst->gdbm = gdbm_open(inst->filename, sizeof(int),
GDBM_NEWDB | GDBM_COUNTER_OPTS, 0600, NULL);
- if (inst->gdbm == NULL) {
+ if (!inst->gdbm) {
radlog(L_ERR, "rlm_counter: Failed to open file %s: %s",
inst->filename, strerror(errno));
return RLM_MODULE_FAIL;
if (len == 0) *sCurrentTime = '\0';
tm->tm_sec = tm->tm_min = 0;
- if (inst->reset == NULL)
+ if (!inst->reset)
return -1;
if (isdigit((int) inst->reset[0])){
len = strlen(inst->reset);
/*
* Discover the attribute number of the key.
*/
- if (inst->key_name == NULL) {
+ if (!inst->key_name) {
radlog(L_ERR, "rlm_counter: 'key' must be set.");
mod_detach(inst);
return -1;
}
dattr = dict_attrbyname(inst->key_name);
- if (dattr == NULL) {
+ if (!dattr) {
radlog(L_ERR, "rlm_counter: No such attribute %s",
inst->key_name);
mod_detach(inst);
/*
* Discover the attribute number of the counter.
*/
- if (inst->count_attribute == NULL) {
+ if (!inst->count_attribute) {
radlog(L_ERR, "rlm_counter: 'count-attribute' must be set.");
mod_detach(inst);
return -1;
}
dattr = dict_attrbyname(inst->count_attribute);
- if (dattr == NULL) {
+ if (!dattr) {
radlog(L_ERR, "rlm_counter: No such attribute %s",
inst->count_attribute);
mod_detach(inst);
*/
if (inst->reply_name != NULL) {
dattr = dict_attrbyname(inst->reply_name);
- if (dattr == NULL) {
+ if (!dattr) {
radlog(L_ERR, "rlm_counter: No such attribute %s",
inst->reply_name);
mod_detach(inst);
/*
* Create a new attribute for the counter.
*/
- if (inst->counter_name == NULL) {
+ if (!inst->counter_name) {
radlog(L_ERR, "rlm_counter: 'counter-name' must be set.");
return -1;
}
}
dattr = dict_attrbyname(inst->counter_name);
- if (dattr == NULL) {
+ if (!dattr) {
radlog(L_ERR, "rlm_counter: Failed to find counter attribute %s",
inst->counter_name);
return -1;
/*
* Create a new attribute for the check item.
*/
- if (inst->check_name == NULL) {
+ if (!inst->check_name) {
radlog(L_ERR, "rlm_counter: 'check-name' must be set.");
return -1;
}
}
dattr = dict_attrbyname(inst->check_name);
- if (dattr == NULL) {
+ if (!dattr) {
radlog(L_ERR, "rlm_counter: Failed to find check attribute %s",
inst->counter_name);
return -1;
/*
* Find when to reset the database.
*/
- if (inst->reset == NULL) {
+ if (!inst->reset) {
radlog(L_ERR, "rlm_counter: 'reset' must be set.");
return -1;
}
return -1;
}
- if (inst->filename == NULL) {
+ if (!inst->filename) {
radlog(L_ERR, "rlm_counter: 'filename' must be set.");
return -1;
}
inst->gdbm = gdbm_open(inst->filename, sizeof(int),
GDBM_WRCREAT | GDBM_COUNTER_OPTS,
0600, NULL);
- if (inst->gdbm == NULL) {
+ if (!inst->gdbm) {
radlog(L_ERR, "rlm_counter: Failed to open file %s: %s",
inst->filename, strerror(errno));
return -1;
* The REAL username, after stripping.
*/
key_vp = (inst->key_attr == PW_USER_NAME) ? request->username : pairfind(request->packet->vps, inst->key_attr, 0, TAG_ANY);
- if (key_vp == NULL){
+ if (!key_vp){
DEBUG("rlm_counter: Could not find the key-attribute in the request. Returning NOOP.");
return RLM_MODULE_NOOP;
}
* Look for the attribute to use as a counter.
*/
count_vp = pairfind(request->packet->vps, inst->count_attr, 0, TAG_ANY);
- if (count_vp == NULL){
+ if (!count_vp){
DEBUG("rlm_counter: Could not find the count-attribute in the request.");
return RLM_MODULE_NOOP;
}
pthread_mutex_lock(&inst->mutex);
count_datum = gdbm_fetch(inst->gdbm, key_datum);
pthread_mutex_unlock(&inst->mutex);
- if (count_datum.dptr == NULL){
+ if (!count_datum.dptr){
DEBUG("rlm_counter: Could not find the requested key in the database.");
counter.user_counter = 0;
if (uniqueid_vp != NULL)
*/
DEBUG2("rlm_counter: Entering module authorize code");
key_vp = (inst->key_attr == PW_USER_NAME) ? request->username : pairfind(request->packet->vps, inst->key_attr, 0, TAG_ANY);
- if (key_vp == NULL) {
+ if (!key_vp) {
DEBUG2("rlm_counter: Could not find Key value pair");
return rcode;
}
gid = strtol(inst->group, &endptr, 10);
if (*endptr != '\0') {
grp = getgrnam(inst->group);
- if (grp == NULL) {
+ if (!grp) {
RDEBUG2("rlm_detail: Unable to find system group \"%s\"", inst->group);
goto skip_group;
}
if ((fr_dhcp_decode_options(request->packet,
vp->vp_octets, vp->length, &head) < 0) ||
- (head == NULL)) {
+ (!head)) {
RDEBUGW("DHCP option decoding failed");
goto fail;
}
* We need both of these attributes to do the authentication.
*/
vp = pairfind(request->packet->vps, PW_DIGEST_RESPONSE, 0, TAG_ANY);
- if (vp == NULL) {
+ if (!vp) {
return RLM_MODULE_NOOP;
}
* We need these, too.
*/
vp = pairfind(request->packet->vps, PW_DIGEST_ATTRIBUTES, 0, TAG_ANY);
- if (vp == NULL) {
+ if (!vp) {
return RLM_MODULE_NOOP;
}
* We need these, too.
*/
vp = pairfind(request->packet->vps, PW_DIGEST_ATTRIBUTES, 0, TAG_ANY);
- if (vp == NULL) {
+ if (!vp) {
error:
RDEBUGE("You set 'Auth-Type = Digest' for a request that does not contain any digest attributes!");
return RLM_MODULE_INVALID;
* Assume MD5 if no Digest-Algorithm attribute received
*/
algo = pairfind(request->packet->vps, PW_DIGEST_ALGORITHM, 0, TAG_ANY);
- if ((algo == NULL) ||
+ if ((!algo) ||
(strcasecmp(algo->vp_strvalue, "MD5") == 0)) {
/*
* Set A1 to Digest-HA1 if no User-Password found
*/
if ((next < PW_EAP_MD5) ||
(next >= PW_EAP_MAX_TYPES) ||
- (inst->methods[next] == NULL)) {
+ (!inst->methods[next])) {
RDEBUG2E("Tried to start unsupported method (%d)",
next);
VALUE_PAIR *eap_msg;
eap_msg = pairfind(request->packet->vps, PW_EAP_MESSAGE, 0, TAG_ANY);
- if (eap_msg == NULL) {
+ if (!eap_msg) {
RDEBUG2("No EAP-Message, not doing EAP");
return EAP_NOOP;
}
* to it.
*/
realm = realm_find(proxy->vp_strvalue);
- if (!realm || (realm && (realm->auth_pool == NULL))) {
+ if (!realm || (realm && (!realm->auth_pool))) {
proxy = NULL;
}
}
inst->ignore_unknown_types &&
((eap_msg->vp_octets[4] == 0) ||
(eap_msg->vp_octets[4] >= PW_EAP_MAX_TYPES) ||
- (inst->methods[eap_msg->vp_octets[4]] == NULL))) {
+ (!inst->methods[eap_msg->vp_octets[4]]))) {
RDEBUG2(" Ignoring Unknown EAP type");
return EAP_NOOP;
}
inst->ignore_unknown_types &&
((eap_msg->vp_octets[5] == 0) ||
(eap_msg->vp_octets[5] >= PW_EAP_MAX_TYPES) ||
- (inst->methods[eap_msg->vp_octets[5]] == NULL))) {
+ (!inst->methods[eap_msg->vp_octets[5]]))) {
RDEBUG2("Ignoring NAK with request for unknown EAP type");
return EAP_NOOP;
}
uint16_t len;
char *identity;
- if ((eap_packet == NULL) ||
+ if ((!eap_packet) ||
(eap_packet->code != PW_EAP_RESPONSE) ||
(eap_packet->data[0] != PW_EAP_IDENTITY)) {
return NULL;
*/
if (eap_packet->data[0] != PW_EAP_IDENTITY) {
handler = eaplist_find(inst, request, eap_packet);
- if (handler == NULL) {
+ if (!handler) {
/* Either send EAP_Identity or EAP-Fail */
RDEBUG("Either EAP-request timed out OR"
" EAP-response to an unknown EAP-request");
*/
RDEBUG2("Broken NAS did not set User-Name, setting from EAP Identity");
vp = pairmake(request->packet, NULL, "User-Name", handler->identity, T_OP_EQ);
- if (vp == NULL) {
+ if (!vp) {
goto error;
}
vp->next = request->packet->vps;
}
} else { /* packet was EAP identity */
handler = eap_handler_alloc(inst);
- if (handler == NULL) {
+ if (!handler) {
goto error;
}
* All fields in the handler are set to zero.
*/
handler->identity = eap_identity(request, handler, eap_packet);
- if (handler->identity == NULL) {
+ if (!handler->identity) {
RDEBUG("Identity Unknown, authentication failed");
error2:
eap_handler_free(inst, handler);
*/
RDEBUG2W("NAS did not set User-Name. Setting it locally from EAP Identity");
vp = pairmake(request->packet, NULL, "User-Name", handler->identity, T_OP_EQ);
- if (vp == NULL) {
+ if (!vp) {
goto error2;
}
vp->next = request->packet->vps;
}
handler->eap_ds = eap_buildds(handler, eap_packet_p);
- if (handler->eap_ds == NULL) {
+ if (!handler->eap_ds) {
goto error2;
}
*
* Find if this is a reply to the previous request sent
*/
- if ((eaptls_packet == NULL) ||
+ if ((!eaptls_packet) ||
((eap_ds->response->length == EAP_HEADER_LEN + 2) &&
((eaptls_packet->flags & 0xc0) == 0x00))) {
* (It is because Last fragment will not have M bit set)
*/
if (!prev_eap_ds ||
- (prev_eap_ds->response == NULL) ||
- (eaptls_prev == NULL) ||
+ (!prev_eap_ds->response) ||
+ (!eaptls_prev) ||
!TLS_MORE_FRAGMENTS(eaptls_prev->flags)) {
RDEBUG2("Received EAP-TLS First Fragment of the message");
assert(eap_ds->response->length > 2);
tlspacket = talloc(eap_ds, EAPTLS_PACKET);
- if (tlspacket == NULL) return NULL;
+ if (!tlspacket) return NULL;
/*
* Code & id for EAPTLS & EAP are same
if (data_len) {
tlspacket->data = talloc_array(tlspacket, uint8_t,
data_len);
- if (tlspacket->data == NULL) {
+ if (!tlspacket->data) {
talloc_free(tlspacket);
return NULL;
}
*/
eap_ds->request->type.data = talloc_array(eap_ds->request, uint8_t,
reply->length - TLS_HEADER_LEN + 1);
- if (eap_ds->request->type.data == NULL) {
+ if (!eap_ds->request->type.data) {
return 0;
}
eap_packet_raw_t *header;
uint16_t total_length = 0;
- if (reply == NULL) return EAP_INVALID;
+ if (!reply) return EAP_INVALID;
/*
* If reply->packet is set, then the wire format
* Get only EAP-Message attribute list
*/
first = pairfind(vps, PW_EAP_MESSAGE, 0, TAG_ANY);
- if (first == NULL) {
+ if (!first) {
DEBUG("rlm_eap: EAP-Message not found");
return NULL;
}
* Now that we know the lengths are OK, allocate memory.
*/
eap_packet = (eap_packet_raw_t *) talloc_zero_array(ctx, uint8_t, len);
- if (eap_packet == NULL) {
+ if (!eap_packet) {
return NULL;
}
*
*/
vp = pairfind(r->vps, ATTRIBUTE_EAP_SIM_SUBTYPE, 0, TAG_ANY);
- if(vp == NULL)
+ if(!vp)
{
subtype = eapsim_start;
}
}
vp = pairfind(r->vps, ATTRIBUTE_EAP_ID, 0, TAG_ANY);
- if(vp == NULL)
+ if(!vp)
{
id = ((int)getpid() & 0xff);
}
}
vp = pairfind(r->vps, ATTRIBUTE_EAP_CODE, 0, TAG_ANY);
- if(vp == NULL)
+ if(!vp)
{
eapcode = PW_EAP_REQUEST;
}
encoded_size += 3;
encodedmsg = talloc_array(ep, uint8_t, encoded_size);
- if (encodedmsg == NULL) {
+ if (!encodedmsg) {
return 0;
}
memset(encodedmsg, 0, encoded_size);
}
/* if we had an AT_MAC and no key, then fail */
- if(macspace != NULL && vp == NULL)
+ if(macspace != NULL && !vp)
{
if(encodedmsg != NULL)
talloc_free(encodedmsg);
mac = pairfind(rvps, ATTRIBUTE_EAP_SIM_BASE+PW_EAP_SIM_MAC, 0, TAG_ANY);
- if(mac == NULL
+ if(!mac
|| mac->length != 18) {
/* can't check a packet with no AT_MAC attribute */
return 0;
fullauthidreq_vp = pairfind(req->vps, ATTRIBUTE_EAP_SIM_BASE+PW_EAP_SIM_FULLAUTH_ID_REQ, 0, TAG_ANY);
permanentidreq_vp = pairfind(req->vps, ATTRIBUTE_EAP_SIM_BASE+PW_EAP_SIM_PERMANENT_ID_REQ, 0, TAG_ANY);
- if(fullauthidreq_vp == NULL ||
+ if(!fullauthidreq_vp ||
anyidreq_vp != NULL ||
permanentidreq_vp != NULL) {
fprintf(stderr, "start message has %sanyidreq, %sfullauthid and %spermanentid. Illegal combination.\n",
* insert the identity here.
*/
vp = pairfind(rep->vps, PW_USER_NAME, 0, TAG_ANY);
- if(vp == NULL)
+ if(!vp)
{
fprintf(stderr, "eap-sim: We need to have a User-Name attribute!\n");
return 0;
/* look for the AT_MAC and the challenge data */
mac = pairfind(req->vps, ATTRIBUTE_EAP_SIM_BASE+PW_EAP_SIM_MAC, 0, TAG_ANY);
randvp= pairfind(req->vps, ATTRIBUTE_EAP_SIM_BASE+PW_EAP_SIM_RAND, 0, TAG_ANY);
- if(mac == NULL || randvp == NULL) {
+ if(!mac || !randvp) {
fprintf(stderr, "radeapclient: challenge message needs to contain RAND and MAC\n");
return 0;
}
randcfgvp[1] = pairfind(rep->vps, ATTRIBUTE_EAP_SIM_RAND2, 0, TAG_ANY);
randcfgvp[2] = pairfind(rep->vps, ATTRIBUTE_EAP_SIM_RAND3, 0, TAG_ANY);
- if(randcfgvp[0] == NULL ||
- randcfgvp[1] == NULL ||
- randcfgvp[2] == NULL) {
+ if(!randcfgvp[0] ||
+ !randcfgvp[1] ||
+ !randcfgvp[2]) {
fprintf(stderr, "radeapclient: needs to have rand1, 2 and 3 set.\n");
return 0;
}
sres2 = pairfind(rep->vps, ATTRIBUTE_EAP_SIM_SRES2, 0, TAG_ANY);
sres3 = pairfind(rep->vps, ATTRIBUTE_EAP_SIM_SRES3, 0, TAG_ANY);
- if(sres1 == NULL ||
- sres2 == NULL ||
- sres3 == NULL) {
+ if(!sres1 ||
+ !sres2 ||
+ !sres3) {
fprintf(stderr, "radeapclient: needs to have sres1, 2 and 3 set.\n");
return 0;
}
Kc2 = pairfind(rep->vps, ATTRIBUTE_EAP_SIM_KC2, 0, TAG_ANY);
Kc3 = pairfind(rep->vps, ATTRIBUTE_EAP_SIM_KC3, 0, TAG_ANY);
- if(Kc1 == NULL ||
- Kc2 == NULL ||
- Kc3 == NULL) {
+ if(!Kc1 ||
+ !Kc2 ||
+ !Kc3) {
fprintf(stderr, "radeapclient: needs to have Kc1, 2 and 3 set.\n");
return 0;
}
argv += (optind - 1);
if ((argc < 3) ||
- ((secret == NULL) && (argc < 4))) {
+ ((!secret) && (argc < 4))) {
usage();
}
int eap_method;
vp = pairfind(req->vps, ATTRIBUTE_EAP_ID, 0, TAG_ANY);
- if(vp == NULL) {
+ if(!vp) {
id = ((int)getpid() & 0xff);
} else {
id = vp->vp_integer;
}
vp = pairfind(req->vps, ATTRIBUTE_EAP_CODE, 0, TAG_ANY);
- if(vp == NULL) {
+ if(!vp) {
eapcode = PW_EAP_REQUEST;
} else {
eapcode = vp->vp_integer;
}
}
- if(vp == NULL) {
+ if(!vp) {
return;
}
e = eap_vp2packet(NULL, rep->vps);
/* nothing to do! */
- if(e == NULL) return;
+ if(!e) return;
/* create EAP-ID and EAP-CODE attributes to start */
eap1 = paircreate(rep, ATTRIBUTE_EAP_ID, 0, PW_TYPE_INTEGER);
VALUE_PAIR *esvp;
esvp = pairfind(r->vps, ATTRIBUTE_EAP_BASE+PW_EAP_SIM, 0, TAG_ANY);
- if (esvp == NULL) {
+ if (!esvp) {
radlog(L_ERR, "eap: EAP-Sim attribute not found");
return 0;
}
/* find the EAP-Message, copy it to req2 */
vp = paircopy2(NULL, req->vps, PW_EAP_MESSAGE, 0, TAG_ANY);
- if(vp == NULL) continue;
+ if(!vp) continue;
pairadd(&req2->vps, vp);
return -1;
}
- if (inst->methods[method] == NULL) {
+ if (!inst->methods[method]) {
radlog(L_ERR, "rlm_eap (%s): No such sub-type for default EAP method %s", inst->xlat_name,
inst->default_method_name);
mod_detach(inst);
* Get the eap packet to start with
*/
eap_packet = eap_vp2packet(request, request->packet->vps);
- if (eap_packet == NULL) {
+ if (!eap_packet) {
radlog_request(L_ERR, 0, request, "Malformed EAP Message");
return RLM_MODULE_FAIL;
}
* this call.
*/
handler = eap_handler(inst, &eap_packet, request);
- if (handler == NULL) {
+ if (!handler) {
RDEBUG2("Failed in handler");
return RLM_MODULE_INVALID;
}
if (request->proxy != NULL) {
VALUE_PAIR *vp = NULL;
- rad_assert(request->proxy_reply == NULL);
+ rad_assert(!request->proxy_reply);
/*
* Add the handle to the proxied list, so that we
}
eap_packet = eap_vp2packet(request, request->packet->vps);
- if (eap_packet == NULL) {
+ if (!eap_packet) {
radlog_request(L_ERR, 0, request, "Malformed EAP Message");
return RLM_MODULE_FAIL;
}
handler = eap_handler(inst, &eap_packet, request);
- if (handler == NULL) {
+ if (!handler) {
RDEBUG2("Failed to get handler, probably already removed, not inserting EAP-Failure");
return RLM_MODULE_NOOP;
}
eap_ds->request->type.data = talloc_array(eap_ds->request,
uint8_t, length);
- if (eap_ds->request->type.data == NULL) {
+ if (!eap_ds->request->type.data) {
return 0;
}
int len=(int)ntohs(((struct EAPHeader *)out)->Length);
eap_ds->request->type.data = talloc_array(eap_ds->request,
uint8_t, len);
- if (eap_ds->request->type.data == NULL) {
+ if (!eap_ds->request->type.data) {
return 1;
}
memcpy(eap_ds->request->type.data,out+5,len-5);
i2 = Create_ikev2_ctx();
- if (i2 == NULL) {
+ if (!i2) {
return -1;
}
*instance =i2;
packet->count = data->count;
packet->challenge = talloc_array(packet, uint8_t, packet->count);
- if (packet->challenge == NULL) {
+ if (!packet->challenge) {
talloc_free(packet);
return NULL;
}
/*
* No password or previous packet. Die.
*/
- if ((password == NULL) || (session == NULL)) {
+ if ((!password) || (!session)) {
return 0;
}
/*
* No password or previous packet. Die.
*/
- if ((password == NULL) || (session == NULL)) {
+ if ((!password) || (!session)) {
return NULL;
}
reply->count = 24;
reply->challenge = talloc_array(reply, uint8_t, reply->count);
- if (reply->challenge == NULL) {
+ if (!reply->challenge) {
talloc_free(reply);
return NULL;
}
* The LEAP packet also contains the user name.
*/
reply->name = talloc_array(reply, char, user_name->length + 1);
- if (reply->name == NULL) {
+ if (!reply->name) {
talloc_free(reply);
return NULL;
}
leap_packet_t *reply;
reply = talloc(eap_ds, leap_packet_t);
- if (reply == NULL) {
+ if (!reply) {
return NULL;
}
reply->count = 8; /* random challenge */
reply->challenge = talloc_array(reply, uint8_t, reply->count);
- if (reply->challenge == NULL) {
+ if (!reply->challenge) {
talloc_free(reply);
return NULL;
}
* The LEAP packet also contains the user name.
*/
reply->name = talloc_array(reply, char, user_name->length + 1);
- if (reply->name == NULL) {
+ if (!reply->name) {
talloc_free(reply);
return NULL;
}
eap_ds->request->type.data = talloc_array(eap_ds->request,
uint8_t,
reply->length);
- if (eap_ds->request->type.data == NULL) {
+ if (!eap_ds->request->type.data) {
return 0;
}
data = (leap_packet_raw_t *) eap_ds->request->type.data;
}
reply = eapleap_initiate(handler->eap_ds, handler->request->username);
- if (reply == NULL)
+ if (!reply)
return 0;
eapleap_compose(handler->eap_ds, reply);
* Allocate room for the data, and copy over the data.
*/
packet->value = talloc_array(packet, uint8_t, packet->value_size);
- if (packet->value == NULL) {
+ if (!packet->value) {
talloc_free(packet);
return NULL;
}
eap_ds->request->type.data = talloc_array(eap_ds->request,
uint8_t,
reply->length);
- if (eap_ds->request->type.data == NULL) {
+ if (!eap_ds->request->type.data) {
talloc_free(reply);
return 0;
}
* Allocate an EAP-MD5 packet.
*/
reply = talloc(handler, MD5_PACKET);
- if (reply == NULL) {
+ if (!reply) {
return 0;
}
* Allocate user data.
*/
reply->value = talloc_array(reply, uint8_t, reply->value_size);
- if (reply->value == NULL) {
+ if (!reply->value) {
talloc_free(reply);
return 0;
}
rad_assert(handler->stage == AUTHENTICATE);
password = pairfind(handler->request->config_items, PW_CLEARTEXT_PASSWORD, 0, TAG_ANY);
- if (password == NULL) {
+ if (!password) {
DEBUG2("rlm_eap_md5: Cleartext-Password is required for EAP-MD5 authentication");
return 0;
}
/*
* Allocate room for the EAP-MS-CHAPv2 data.
*/
- if (eap_ds->request->type.data == NULL) {
+ if (!eap_ds->request->type.data) {
return 0;
}
eap_ds->request->type.length = length;
/*
* Allocate room for the EAP-MS-CHAPv2 data.
*/
- if (eap_ds->request->type.data == NULL) {
+ if (!eap_ds->request->type.data) {
return 0;
}
memset(eap_ds->request->type.data, 0, length);
/*
* Allocate room for the EAP-MS-CHAPv2 data.
*/
- if (eap_ds->request->type.data == NULL) {
+ if (!eap_ds->request->type.data) {
return 0;
}
memset(eap_ds->request->type.data, 0, length);
pairdelete(&reply->vps, 16, VENDORPEC_MICROSOFT, TAG_ANY);
pairdelete(&reply->vps, 17, VENDORPEC_MICROSOFT, TAG_ANY);
- rad_assert(t->accept_vps == NULL);
+ rad_assert(!t->accept_vps);
pairfilter(t, &t->accept_vps, &reply->vps, 0, 0, TAG_ANY);
- rad_assert(reply->vps == NULL);
+ rad_assert(!reply->vps);
}
break;
pairdelete(&reply->vps, PW_PROXY_STATE, 0, TAG_ANY);
pairdelete(&reply->vps, PW_MESSAGE_AUTHENTICATOR, 0, TAG_ANY);
- rad_assert(t->accept_vps == NULL);
+ rad_assert(!t->accept_vps);
pairfilter(t, &t->accept_vps, &reply->vps,
0, 0, TAG_ANY);
- rad_assert(reply->vps == NULL);
+ rad_assert(!reply->vps);
}
/*
/*
* Terrible hacks.
*/
- rad_assert(fake->packet == NULL);
+ rad_assert(!fake->packet);
fake->packet = request->proxy;
fake->packet->src_ipaddr = request->packet->src_ipaddr;
request->proxy = NULL;
- rad_assert(fake->reply == NULL);
+ rad_assert(!fake->reply);
fake->reply = request->proxy_reply;
request->proxy_reply = NULL;
break;
}
}
- request_free(&fake); /* robust if fake == NULL */
+ request_free(&fake); /* robust if !fake */
/*
* If there was no EAP-Message in the reply packet, then
case PEAP_STATUS_WAIT_FOR_SOH_RESPONSE:
fake = request_alloc_fake(request);
- rad_assert(fake->packet->vps == NULL);
+ rad_assert(!fake->packet->vps);
eapsoh_verify(request, fake->packet, data, data_len);
setup_fake_request(request, fake, t);
}
/* save the SoH VPs */
- rad_assert(t->soh_reply_vps == NULL);
+ rad_assert(!t->soh_reply_vps);
pairfilter(t, &t->soh_reply_vps, &fake->reply->vps, 0, 0, TAG_ANY);
- rad_assert(fake->reply->vps == NULL);
+ rad_assert(!fake->reply->vps);
request_free(&fake);
if (t->session_resumption_state == PEAP_RESUMPTION_YES) {
fake = request_alloc_fake(request);
- rad_assert(fake->packet->vps == NULL);
+ rad_assert(!fake->packet->vps);
switch (t->status) {
/*
debug_pair_list(fake->packet->vps);
fprintf(fr_log_fp, "server %s {\n",
- (fake->server == NULL) ? "" : fake->server);
+ (!fake->server) ? "" : fake->server);
}
/*
debug_pair_list(fake->packet->vps);
fprintf(fr_log_fp, "server %s {\n",
- (fake->server == NULL) ? "" : fake->server);
+ (!fake->server) ? "" : fake->server);
}
/*
*/
if ((debug_flag > 0) && fr_log_fp) {
fprintf(fr_log_fp, "} # server %s\n",
- (fake->server == NULL) ? "" : fake->server);
+ (!fake->server) ? "" : fake->server);
RDEBUG("Got tunneled reply code %d", fake->reply->code);
* Seed the proxy packet with the
* tunneled request.
*/
- rad_assert(request->proxy == NULL);
+ rad_assert(!request->proxy);
request->proxy = fake->packet;
memset(&request->proxy->src_ipaddr, 0,
sizeof(request->proxy->src_ipaddr));
{
pwd_session_t *session = (pwd_session_t *)data;
- if (session == NULL) {
+ if (!session) {
radlog(L_ERR, "rlm_eap_pwd: freeing a NULL session...naughty, naughty");
return;
}
/*
* make sure the server's been configured properly
*/
- if (inst->conf->server_id == NULL) {
+ if (!inst->conf->server_id) {
radlog(L_ERR, "rlm_eap_pwd: server ID is not configured!");
return -1;
}
uint8_t peer_confirm[SHA256_DIGEST_LENGTH];
BIGNUM *x = NULL, *y = NULL;
- if ((handler == NULL) ||
+ if ((!handler) ||
((eap_ds = handler->eap_ds) == NULL) ||
- (inst == NULL)) {
+ (!inst)) {
return 0;
}
pwd_session = (pwd_session_t *)handler->opaque;
debug_pair_list(fake->packet->vps);
fprintf(fr_log_fp, "server %s {\n",
- (fake->server == NULL) ? "" : fake->server);
+ (!fake->server) ? "" : fake->server);
}
/*
*/
if ((debug_flag > 0) && fr_log_fp) {
fprintf(fr_log_fp, "} # server %s\n",
- (fake->server == NULL) ? "" : fake->server);
+ (!fake->server) ? "" : fake->server);
RDEBUG("Got tunneled reply code %d", fake->reply->code);
rad_assert(chalno >= 0 && chalno < 3);
vp = pairfind(vps, ATTRIBUTE_EAP_SIM_RAND1+chalno, 0, TAG_ANY);
- if(vp == NULL) {
+ if(!vp) {
/* bad, we can't find stuff! */
DEBUG2(" eap-sim can not find sim-challenge%d",chalno+1);
return 0;
memcpy(ess->keys.rand[chalno], vp->vp_strvalue, EAPSIM_RAND_SIZE);
vp = pairfind(vps, ATTRIBUTE_EAP_SIM_SRES1+chalno, 0, TAG_ANY);
- if(vp == NULL) {
+ if(!vp) {
/* bad, we can't find stuff! */
DEBUG2(" eap-sim can not find sim-sres%d",chalno+1);
return 0;
memcpy(ess->keys.sres[chalno], vp->vp_strvalue, EAPSIM_SRES_SIZE);
vp = pairfind(vps, ATTRIBUTE_EAP_SIM_KC1+chalno, 0, TAG_ANY);
- if(vp == NULL) {
+ if(!vp) {
/* bad, we can't find stuff! */
DEBUG2(" eap-sim can not find sim-kc%d",chalno+1);
return 0;
instance = instance; /* shut up compiler */
vp = pairfind(outvps, ATTRIBUTE_EAP_SIM_RAND1, 0, TAG_ANY);
- if(vp == NULL) {
+ if(!vp) {
DEBUG2(" can not initiate sim, no RAND1 attribute");
return 0;
}
ess = talloc_zero(handler, struct eap_sim_server_state);
- if(ess == NULL) {
+ if(!ess) {
DEBUG2(" no space for eap sim state");
return 0;
}
nonce_vp = pairfind(vps, ATTRIBUTE_EAP_SIM_BASE+PW_EAP_SIM_NONCE_MT, 0, TAG_ANY);
selectedversion_vp = pairfind(vps, ATTRIBUTE_EAP_SIM_BASE+PW_EAP_SIM_SELECTED_VERSION, 0, TAG_ANY);
- if(nonce_vp == NULL ||
- selectedversion_vp == NULL) {
+ if(!nonce_vp ||
+ !selectedversion_vp) {
DEBUG2(" client did not select a version and send a NONCE");
eap_sim_stateenter(handler, ess, eapsim_server_start);
return 1;
/* create a fake request */
fake = request_alloc_fake(request);
- rad_assert(fake->packet->vps == NULL);
+ rad_assert(!fake->packet->vps);
fake->packet->vps = paircopy(fake->packet, request->packet->vps);
* Use the tunneled reply, but not now.
*/
if (t->use_tunneled_reply) {
- rad_assert(t->accept_vps == NULL);
+ rad_assert(!t->accept_vps);
pairfilter(t, &t->accept_vps, &reply->vps,
0, 0, TAG_ANY);
- rad_assert(reply->vps == NULL);
+ rad_assert(!reply->vps);
}
} else { /* no MS-CHAP2-Success */
/*
* Terrible hacks.
*/
- rad_assert(fake->packet == NULL);
+ rad_assert(!fake->packet);
fake->packet = request->proxy;
fake->packet->src_ipaddr = request->packet->src_ipaddr;
request->proxy = NULL;
- rad_assert(fake->reply == NULL);
+ rad_assert(!fake->reply);
fake->reply = request->proxy_reply;
request->proxy_reply = NULL;
if ((debug_flag > 0) && fr_log_fp) {
fprintf(fr_log_fp, "server %s {\n",
- (fake->server == NULL) ? "" : fake->server);
+ (!fake->server) ? "" : fake->server);
}
/*
if ((debug_flag > 0) && fr_log_fp) {
fprintf(fr_log_fp, "} # server %s\n",
- (fake->server == NULL) ? "" : fake->server);
+ (!fake->server) ? "" : fake->server);
RDEBUG("Final reply from tunneled session code %d",
fake->reply->code);
break;
}
}
- request_free(&fake); /* robust if fake == NULL */
+ request_free(&fake); /* robust if !fake */
/*
* Process the reply from the home server.
*/
fake = request_alloc_fake(request);
- rad_assert(fake->packet->vps == NULL);
+ rad_assert(!fake->packet->vps);
/*
* Add the tunneled attributes to the fake request.
debug_pair_list(fake->packet->vps);
fprintf(fr_log_fp, "server %s {\n",
- (fake->server == NULL) ? "" : fake->server);
+ (!fake->server) ? "" : fake->server);
}
/*
*/
if ((debug_flag > 0) && fr_log_fp) {
fprintf(fr_log_fp, "} # server %s\n",
- (fake->server == NULL) ? "" : fake->server);
+ (!fake->server) ? "" : fake->server);
RDEBUG("Got tunneled reply code %d", fake->reply->code);
* Seed the proxy packet with the
* tunneled request.
*/
- rad_assert(request->proxy == NULL);
+ rad_assert(!request->proxy);
request->proxy = fake->packet;
memset(&request->proxy->src_ipaddr, 0,
sizeof(request->proxy->src_ipaddr));
os_memset(&tconf, 0, sizeof(tconf));
inst->tls_ctx = tls_init(&tconf);
- if (inst->tls_ctx == NULL)
+ if (!inst->tls_ctx)
return -1;
if (tls_global_set_params(inst->tls_ctx, &inst->tparams)) {
* Get only EAP-Message attribute list
*/
first = pairfind(vps, PW_EAP_MESSAGE, 0, TAG_ANY);
- if (first == NULL) {
+ if (!first) {
radlog(L_ERR, "rlm_eap2: EAP-Message not found");
return -1;
}
handler->server_ctx.eap = eap_server_sm_init(handler,
&handler->eap_cb,
&handler->eap_conf);
- if (handler->server_ctx.eap == NULL) {
+ if (!handler->server_ctx.eap) {
free(handler);
return RLM_MODULE_FAIL;
}
}
cache_size = data->cache_size;
- if (data->session_db == NULL) {
+ if (!data->session_db) {
radlog(L_ERR, "rlm_ippool: 'session-db' must be set.");
return -1;
}
- if (data->ip_index == NULL) {
+ if (!data->ip_index) {
radlog(L_ERR, "rlm_ippool: 'ip-index' must be set.");
return -1;
}
data->gdbm = gdbm_open(data->session_db, sizeof(int),
GDBM_WRCREAT | GDBM_IPPOOL_OPTS, 0600, NULL);
- if (data->gdbm == NULL) {
+ if (!data->gdbm) {
radlog(L_ERR, "rlm_ippool: Failed to open file %s: %s",
data->session_db, strerror(errno));
return -1;
}
data->ip = gdbm_open(data->ip_index, sizeof(int),
GDBM_WRCREAT | GDBM_IPPOOL_OPTS, 0600, NULL);
- if (data->ip == NULL) {
+ if (!data->ip) {
radlog(L_ERR, "rlm_ippool: Failed to open file %s: %s",
data->ip_index, strerror(errno));
return -1;
radlog(L_ERR, "rlm_ippool: Failed to set cache size");
key_datum = gdbm_firstkey(data->gdbm);
- if (key_datum.dptr == NULL){
+ if (!key_datum.dptr){
/*
* If the database does not exist initialize it.
* We set the nas/port pairs to not existent values and
* run only if they match
*/
if ((vp = pairfind(request->config_items, PW_POOL_NAME, 0, TAG_ANY)) != NULL){
- if (data->name == NULL || (strcmp(data->name,vp->vp_strvalue) && strcmp(vp->vp_strvalue,"DEFAULT")))
+ if (!data->name || (strcmp(data->name,vp->vp_strvalue) && strcmp(vp->vp_strvalue,"DEFAULT")))
return RLM_MODULE_NOOP;
} else {
RDEBUG("Could not find Pool-Name attribute.");
}
}
- if (key_datum.dptr == NULL){
+ if (!key_datum.dptr){
key_datum = gdbm_firstkey(data->gdbm);
while(key_datum.dptr){
data_datum = gdbm_fetch(data->gdbm, key_datum);
return;
}
- if (sessiondb == NULL) {
+ if (!sessiondb) {
printf("rlm_ippool_tool: Unable to open DB '%s'\n", sessiondbname);
return;
}
- if (indexdb == NULL) {
+ if (!indexdb) {
printf("rlm_ippool_tool: Unable to open DB '%s'\n", indexdbname);
return;
}
}
key_datum.dptr = NULL;
- if (key_datum.dptr == NULL) {
+ if (!key_datum.dptr) {
key_datum = gdbm_firstkey(sessiondb);
while (key_datum.dptr) {
sessiondb = gdbm_open(sessiondbname, 512, GDBM_READER, 0,NULL);
newsessiondb = gdbm_open(newsessiondbname, 512, GDBM_NEWDB, 0,NULL);
- if (sessiondb == NULL || newsessiondb == NULL) return;
+ if (!sessiondb || !newsessiondb) return;
memset(key_str, 0, 17);
newkey_datum.dsize = sizeof(ippool_key);
data_datum = gdbm_fetch(sessiondb, key_datum);
- if (data_datum.dptr == NULL) {
+ if (!data_datum.dptr) {
goto next;
}
sessiondb = gdbm_open(sessiondbname, 512, mode, 0,NULL);
indexdb = gdbm_open(indexdbname, 512, mode, 0,NULL);
- if ((sessiondb == NULL) || (indexdb == NULL)) {
+ if ((!sessiondb) || (!indexdb)) {
return;
}
}
data_datum = gdbm_fetch(sessiondb, key_datum);
- if (data_datum.dptr == NULL) {
+ if (!data_datum.dptr) {
goto next;
}
if (vflag && MATCH_IP(ipaddress, ip) && MATCH_ACTIVE(info)) {
printf("\n");
- } else if (vflag && ipaddress == NULL){
+ } else if (vflag && !ipaddress){
if (old) {
printf("NAS:%s port:0x%x\n", old_key.nas, old_key.port);
} else {
gid = strtol(inst->group, &endptr, 10);
if (*endptr != '\0') {
grp = getgrnam(inst->group);
- if (grp == NULL) {
+ if (!grp) {
RDEBUG2("Unable to find system group \"%s\"", inst->group);
goto skip_group;
}
tDataList *pUserNode = NULL;
int result = RLM_MODULE_FAIL;
- if (inUserName == NULL) {
+ if (!inUserName) {
radlog(L_ERR, "rlm_mschap: getUserNodeRef(): no username");
return RLM_MODULE_FAIL;
}
tDataBuff = dsDataBufferAllocate(dsRef, 4096);
- if (tDataBuff == NULL) {
+ if (!tDataBuff) {
radlog(L_ERR, "rlm_mschap: getUserNodeRef(): dsDataBufferAllocate() status = %ld", status);
return RLM_MODULE_FAIL;
}
}
pUserNode = dsBuildFromPath(dsRef, pUserLocation, "/");
- if (pUserNode == NULL) {
+ if (!pUserNode) {
radlog(L_ERR,"rlm_mschap: getUserNodeRef(): dsBuildFromPath() returned NULL");
result = RLM_MODULE_FAIL;
break;
#endif
username_string = talloc_array(request, char, usernamepair->length + 1);
- if (username_string == NULL)
+ if (!username_string)
return RLM_MODULE_FAIL;
strlcpy(username_string, (char *)usernamepair->vp_strvalue,
uint32_t uiLen = 0;
uint32_t pwLen = 0;
- if (uname == NULL || password == NULL)
+ if (!uname || !password)
return result;
do
return result;
tDataBuff = dsDataBufferAllocate( dsRef, 4096 );
- if (tDataBuff == NULL)
+ if (!tDataBuff)
break;
/* find user on search node */
if (uuid_parse(rad_client->community, guid_nasgroup) != 0) {
/* attempt to resolve the name */
groupdata = getgrnam(rad_client->community);
- if (groupdata == NULL) {
+ if (!groupdata) {
radlog(L_AUTH, "rlm_opendirectory: The group \"%s\" does not exist on this system.", rad_client->community);
return RLM_MODULE_FAIL;
}
else
#endif
{
- if (rad_client == NULL) {
+ if (!rad_client) {
RDEBUG("The client record could not be found for host %s.",
ip_ntoh(&request->packet->src_ipaddr,
host_ipaddr, sizeof(host_ipaddr)));
/*
* No attribute was found that looked like a password to match.
*/
- if (auth_func == NULL) {
+ if (!auth_func) {
RDEBUG("No password configured for the user. Cannot do authentication");
return RLM_MODULE_FAIL;
}
static void release_hash_table(struct hashtable * ht){
int i;
- if (ht == NULL) return;
+ if (!ht) return;
for (i = 0; i < ht->tablesize; i++)
if (ht->table[i])
destroy_password(ht->table[i]);
}
lf = talloc_strdup(inst, inst->format);
- if ( lf == NULL) {
+ if ( !lf) {
radlog(L_ERR, "rlm_passwd: memory allocation failed for lf");
return -1;
}
PL_endav = end_AV;
xlat_name = cf_section_name2(conf);
- if (xlat_name == NULL)
+ if (!xlat_name)
xlat_name = cf_section_name1(conf);
if (xlat_name) {
xlat_register(xlat_name, perl_xlat, inst);
pairfree(&sublist);
}
- rad_assert(head == NULL);
+ rad_assert(!head);
}
/*
*/
request_pairs = request->packet->vps;
namepair = pairfind(request_pairs, PW_USER_NAME, 0, TAG_ANY);
- if ((namepair == NULL) ||
+ if ((!namepair) ||
(namepair->length <= 0)) {
return;
}
VALUE_PAIR *tmp;
int result = -1;
- if (check == NULL) return 0;
+ if (!check) return 0;
while (result != 0 && check_item != NULL) {
request_pairs = request->packet->vps;
- if (hints == NULL || request_pairs == NULL)
+ if (!hints || !request_pairs)
return RLM_MODULE_NOOP;
/*
else
name = (char *)tmp->vp_strvalue;
- if (name == NULL || name[0] == 0)
+ if (!name || name[0] == 0)
/*
* No name, nothing to do.
*/
* We're not controlling access by huntgroups:
* Allow them in.
*/
- if (huntgroups == NULL)
+ if (!huntgroups)
return RLM_MODULE_OK;
for(i = huntgroups; i; i = i->next) {
Pyx_BLOCK_THREADS
PyErr_Fetch(&pType, &pValue, &pTraceback);
- if (pType == NULL || pValue == NULL)
+ if (!pType || !pValue)
goto failed;
if (((pStr1 = PyObject_Str(pType)) == NULL) ||
((pStr2 = PyObject_Str(pValue)) == NULL))
else
pStr = PyString_FromString(vp->da->name);
- if (pStr == NULL)
+ if (!pStr)
goto failed;
PyTuple_SET_ITEM(pPair, 0, pStr);
PyGILState_STATE gstate;
/* Return with "OK, continue" if the function is not defined. */
- if (pFunc == NULL)
+ if (!pFunc)
return RLM_MODULE_OK;
/* Default return value is "OK, continue" */
/* Call Python function. */
pRet = PyObject_CallFunctionObjArgs(pFunc, pArgs, NULL);
- if (pRet == NULL)
+ if (!pRet)
goto failed;
- if (request == NULL)
+ if (!request)
goto okay;
/*
* Also, if there's no User-Name attribute, we can't
* proxy it, either.
*/
- if ((request->username == NULL)
+ if ((!request->username)
#ifdef WITH_PROXY
|| (request->proxy != NULL)
#endif
realm = realm_find(realmname);
if (!realm) {
RDEBUG2("No such realm \"%s\"",
- (realmname == NULL) ? "NULL" : realmname);
+ (!realmname) ? "NULL" : realmname);
return RLM_MODULE_NOOP;
}
if( inst->ignore_default &&
break;
}
- if ((ret >= freespace) || (buffer_ptr == NULL)) {
+ if ((ret >= freespace) || (!buffer_ptr)) {
RDEBUG("rlm_redis (%s): Can't write result, insufficient space or unsupported result\n",
inst->xlat_name);
ret = 0;
"¿Unknown?"));
q = strchr(p, '&');
- len = (q == NULL) ? (rawlen - (p - raw)) : (unsigned)(q - p);
+ len = (!q) ? (rawlen - (p - raw)) : (unsigned)(q - p);
value = curl_easy_unescape(candle, p, len, &curl_len);
* if we didn't we do *NOT* want to skip over the end
* of the buffer...
*/
- p += (q == NULL) ? len : (len + 1);
+ p += (!q) ? len : (len + 1);
RDEBUG2("\tLength : %i", curl_len);
RDEBUG2("\tValue : \"%s\"", value);
* of reason_code.
*/
q = memchr(p, ' ', s);
- if (q == NULL) goto malformed;
+ if (!q) goto malformed;
s -= (q - p);
p = q;
s -= 4;
q = memchr(p, '\r', s);
- if (q == NULL) goto malformed;
+ if (!q) goto malformed;
len = (q - p);
* If there's not, find the end of this
* header.
*/
- if (q == NULL) q = memchr(p, '\r', s);
+ if (!q) q = memchr(p, '\r', s);
- len = (q == NULL) ? s : (unsigned)(q - p);
+ len = (!q) ? s : (unsigned)(q - p);
type = fr_substr2int(http_content_type_table,
p, HTTP_BODY_UNKNOWN,
int ret;
- if (ctx->write.buffer == NULL) {
+ if (!ctx->write.buffer) {
RDEBUG("Skipping attribute processing, no body data received");
return FALSE;
}
}
xlat_name = cf_section_name2(conf);
- if (xlat_name == NULL) {
+ if (!xlat_name) {
xlat_name = cf_section_name1(conf);
}
* Import a user module and load a function from it
*/
static int load_function(const char *f_name, int *func, VALUE module) {
- if (f_name == NULL) {
+ if (!f_name) {
*func = 0;
} else {
*func = rb_intern(f_name);
/* Add functions into module */
rb_define_module_function(module, "radlog", radlog_rb, 2);
- if (data->scriptFile == NULL) {
+ if (!data->scriptFile) {
/* TODO: What actualy should we do? Exit with module fail? Or continue... but what the point then? */
radlog(L_ERR, "Script File was not set");
} else {
*replyMsgBuffer = '\0';
pSecurid_session = securid_sessionlist_find(inst,request);
- if (pSecurid_session == NULL) {
+ if (!pSecurid_session) {
/* securid session not found */
SDI_HANDLE sdiHandle = SDI_HANDLE_NONE;
{
rlm_sql_freetds_conn_t *conn = handle->conn;
- if (conn->dbproc == NULL || DBDEAD(conn->dbproc)) {
+ if (!conn->dbproc || DBDEAD(conn->dbproc)) {
radlog(L_ERR, "rlm_sql_freetds (%s): Socket not connected", config->xlat_name);
return SQL_DOWN;
}
return -1;
}
- if (conn->dbc_handle == NULL) {
+ if (!conn->dbc_handle) {
radlog(L_ERR, "sql_query: Socket not connected");
return -1;
}
{
rlm_sql_mysql_conn_t *conn = handle->conn;
- if (conn->sock == NULL) {
+ if (!conn->sock) {
radlog(L_ERR, "rlm_sql_mysql: Socket not connected");
return SQL_DOWN;
}
rlm_sql_mysql_conn_t *conn = handle->conn;
int status;
- if (conn->sock == NULL) {
+ if (!conn->sock) {
radlog(L_ERR, "rlm_sql_mysql: Socket not connected");
return SQL_DOWN;
}
retry_fetch_row:
handle->row = mysql_fetch_row(conn->result);
- if (handle->row == NULL) {
+ if (!handle->row) {
status = sql_check_error(mysql_errno(conn->sock));
if (status != 0) {
radlog(L_ERR, "rlm_sql_mysql: Cannot fetch row");
{
rlm_sql_mysql_conn_t *conn = handle->conn;
- if (conn == NULL || conn->sock == NULL) {
+ if (!conn || !conn->sock) {
return "rlm_sql_mysql: no connection to db";
}
return mysql_error(conn->sock);
char *errorcode;
char *errormsg;
- if (conn->db == NULL) {
+ if (!conn->db) {
radlog(L_ERR, "rlm_sql_postgresql: Socket not connected");
return SQL_DOWN;
}
CS_RETCODE ret, results_ret;
CS_INT result_type;
- if (conn->db == NULL) {
+ if (!conn->db) {
radlog(L_ERR, "Socket not connected");
return -1;
}
int colcount,i;
char **rowdata;
- if (conn->db == NULL) {
+ if (!conn->db) {
radlog(L_ERR, "Socket not connected");
return -1;
}
}
handle = sql_get_socket(inst);
- if (handle == NULL)
+ if (!handle)
return 0;
rlm_sql_query_log(inst, request, NULL, querystr);
}
row = handle->row;
- if (row == NULL) {
+ if (!row) {
RDEBUG("SQL query did not return any results");
(inst->module->sql_finish_select_query)(handle, inst->config);
sql_release_socket(inst,handle);
return 0;
}
- if (row[0] == NULL){
+ if (!row[0]){
RDEBUG("Null value in first column");
(inst->module->sql_finish_select_query)(handle, inst->config);
sql_release_socket(inst,handle);
inst->config->xlat_name, querystr);
handle = sql_get_socket(inst);
- if (handle == NULL)
+ if (!handle)
return -1;
if (rlm_sql_select_query(&handle,inst,querystr)){
return -1;
while(rlm_sql_fetch_row(&handle, inst) == 0) {
i++;
row = handle->row;
- if (row == NULL)
+ if (!row)
break;
/*
* The return data for each row MUST be in the following order:
}
while (rlm_sql_fetch_row(&handle, inst) == 0) {
row = handle->row;
- if (row == NULL)
+ if (!row)
break;
- if (row[0] == NULL){
+ if (!row[0]){
RDEBUG("row[0] returned NULL");
(inst->module->sql_finish_select_query)(handle, inst->config);
talloc_free(entry);
* Get a socket for this lookup
*/
handle = sql_get_socket(inst);
- if (handle == NULL) {
+ if (!handle) {
return 1;
}
inst->cs = conf;
xlat_name = cf_section_name2(conf);
- if (xlat_name == NULL) {
+ if (!xlat_name) {
xlat_name = cf_section_name1(conf);
} else {
char *group_name;
* Load the appropriate driver for our database
*/
inst->handle = lt_dlopenext(inst->config->sql_driver_name);
- if (inst->handle == NULL) {
+ if (!inst->handle) {
radlog(L_ERR, "Could not link driver %s: %s",
inst->config->sql_driver_name,
dlerror());
* temporary pairlists and temporary attributes.
*/
handle = sql_get_socket(inst);
- if (handle == NULL)
+ if (!handle)
goto error;
/*
RDEBUG2("Using query template '%s'", attr);
handle = sql_get_socket(inst);
- if (handle == NULL)
+ if (!handle)
return RLM_MODULE_FAIL;
sql_set_user(inst, request, NULL);
return RLM_MODULE_NOOP;
}
- if((request->username == NULL) || (request->username->length == 0)) {
+ if((!request->username) || (request->username->length == 0)) {
radlog_request(L_ERR, 0, request,
"Zero Length username not permitted\n");
return RLM_MODULE_INVALID;
/* initialize the sql socket */
handle = sql_get_socket(inst);
- if(handle == NULL)
+ if(!handle)
return RLM_MODULE_FAIL;
if(rlm_sql_select_query(&handle, inst, querystr)) {
}
row = handle->row;
- if (row == NULL) {
+ if (!row) {
(inst->module->sql_finish_select_query)(handle, inst->config);
sql_release_socket(inst, handle);
return RLM_MODULE_FAIL;
while (rlm_sql_fetch_row(&handle, inst) == 0) {
row = handle->row;
- if (row == NULL)
+ if (!row)
break;
if (!row[2]){
(inst->module->sql_finish_select_query)(handle, inst->config);
/*
* Verify the 'Attribute' field
*/
- if (row[2] == NULL || row[2][0] == '\0') {
+ if (!row[2] || row[2][0] == '\0') {
radlog(L_ERR, "rlm_sql: The 'Attribute' field is empty or NULL, skipping the entire row.");
return -1;
}
}
pwd = getpwnam(req->username->vp_strvalue);
- if (pwd == NULL)
+ if (!pwd)
return -1;
grp = getgrnam(check->vp_strvalue);
- if (grp == NULL)
+ if (!grp)
return -1;
retval = (pwd->pw_gid == grp->gr_gid) ? 0 : -1;
* prevents users from using NULL password fields as things
* stand right now.
*/
- if ((encrypted_pass == NULL) || (strlen(encrypted_pass) < 10)) {
+ if ((!encrypted_pass) || (strlen(encrypted_pass) < 10)) {
if ((spwd = getspnam(name)) == NULL) {
return RLM_MODULE_NOTFOUND;
}
}
}
endusershell();
- if (shell == NULL) {
+ if (!shell) {
radlog_request(L_AUTH, 0, request, "[%s]: invalid shell [%s]",
name, pwd->pw_shell);
return RLM_MODULE_REJECT;