From: Alan T. DeKok Date: Tue, 16 May 2017 20:33:22 +0000 (-0400) Subject: allow listener to be NULL X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=520830b1a765f0ffa0b459c17cdf890717cd08ca;p=thirdparty%2Ffreeradius-server.git allow listener to be NULL in preparation for new transport code --- diff --git a/src/modules/rlm_client/rlm_client.c b/src/modules/rlm_client/rlm_client.c index cf57c2c0d4c..00c0be0d16d 100644 --- a/src/modules/rlm_client/rlm_client.c +++ b/src/modules/rlm_client/rlm_client.c @@ -294,8 +294,10 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(UNUSED void *instance, UNUSED if (request->client->server) { server_cs = request->client->server_cs; - } else { + } else if (request->listener) { server_cs = request->listener->server_cs; + } else { + server_cs = "default"; /* @todo - delete this when we delete the old listeners */ } c = client_read(buffer, server_cs, true); diff --git a/src/modules/rlm_detail/rlm_detail.c b/src/modules/rlm_detail/rlm_detail.c index 1bd4f1089f3..d7010a8d708 100644 --- a/src/modules/rlm_detail/rlm_detail.c +++ b/src/modules/rlm_detail/rlm_detail.c @@ -379,7 +379,7 @@ static rlm_rcode_t CC_HINT(nonnull) detail_do(void const *instance, REQUEST *req * suppress the write. This check prevents an infinite * loop. */ - if ((request->listener->type == RAD_LISTEN_DETAIL) && + if (request->listener && (request->listener->type == RAD_LISTEN_DETAIL) && (fnmatch(((listen_detail_t *)request->listener->data)->filename, buffer, FNM_FILE_NAME | FNM_PERIOD ) == 0)) { RWDEBUG2("Suppressing infinite loop"); @@ -440,7 +440,7 @@ skip_group: static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, UNUSED void *thread, REQUEST *request) { #ifdef WITH_DETAIL - if (request->listener->type == RAD_LISTEN_DETAIL && + if (request->listener && (request->listener->type == RAD_LISTEN_DETAIL) && strcmp(((rlm_detail_t const *)instance)->filename, ((listen_detail_t *)request->listener->data)->filename) == 0) { RDEBUG("Suppressing writes to detail file as the request was just read from a detail file"); diff --git a/src/modules/rlm_realm/rlm_realm.c b/src/modules/rlm_realm/rlm_realm.c index 457e9f82bac..fd210f5d84e 100644 --- a/src/modules/rlm_realm/rlm_realm.c +++ b/src/modules/rlm_realm/rlm_realm.c @@ -321,7 +321,7 @@ static int check_for_realm(void const *instance, REQUEST *request, REALM **retur * additional checks. */ #ifdef WITH_DETAIL - } else if ((request->listener->type == RAD_LISTEN_DETAIL) && + } else if (request->listener && (request->listener->type == RAD_LISTEN_DETAIL) && !fr_is_inaddr_any(&request->packet->src_ipaddr)) { int i;