char const *secret);
int rad_digest_cmp(uint8_t const *a, uint8_t const *b, size_t length);
-RADIUS_PACKET *rad_alloc(TALLOC_CTX *ctx, int newvector);
+RADIUS_PACKET *rad_alloc(TALLOC_CTX *ctx, bool new_vector);
RADIUS_PACKET *rad_alloc_reply(TALLOC_CTX *ctx, RADIUS_PACKET *);
RADIUS_PACKET *rad_copy_packet(TALLOC_CTX *ctx, RADIUS_PACKET const *in);
/*
* Allocate the new request data structure
*/
- packet = rad_alloc(NULL, 0);
+ packet = rad_alloc(NULL, false);
if (!packet) {
fr_strerror_printf("out of memory");
return NULL;
*
* @param ctx the context in which the packet is allocated. May be NULL if
* the packet is not associated with a REQUEST.
- * @param newvector if true a new request authenticator will be generated.
+ * @param new_vector if true a new request authenticator will be generated.
* @return a new RADIUS_PACKET or NULL on error.
*/
-RADIUS_PACKET *rad_alloc(TALLOC_CTX *ctx, int newvector)
+RADIUS_PACKET *rad_alloc(TALLOC_CTX *ctx, bool new_vector)
{
RADIUS_PACKET *rp;
rp->id = -1;
rp->offset = -1;
- if (newvector) {
+ if (new_vector) {
int i;
uint32_t hash, base;
if (!packet) return NULL;
- reply = rad_alloc(ctx, 0);
+ reply = rad_alloc(ctx, false);
if (!reply) return NULL;
/*
{
RADIUS_PACKET *out;
- out = rad_alloc(ctx, 0);
+ out = rad_alloc(ctx, false);
if (!out) return NULL;
/*
RADIUS_PACKET *fr_tcp_recv(int sockfd, int flags)
{
- RADIUS_PACKET *packet = rad_alloc(NULL, 0);
+ RADIUS_PACKET *packet = rad_alloc(NULL, false);
if (!packet) return NULL;
fake->decode = null_socket_dencode;
fake->send = null_socket_send;
- packet = rad_alloc(NULL, 0);
+ packet = rad_alloc(NULL, false);
packet->src_ipaddr = sock->src_ipaddr;
packet->src_port = 0;
* Allocate the packet. If we fail, it's a serious
* problem.
*/
- packet = rad_alloc(NULL, 1);
+ packet = rad_alloc(NULL, true);
if (!packet) {
ERROR("FATAL: Failed allocating memory for detail");
fr_exit(1);
* Allocate a packet for partial reads.
*/
if (!sock->packet) {
- sock->packet = rad_alloc(sock, 0);
+ sock->packet = rad_alloc(sock, false);
if (!sock->packet) return 0;
sock->packet->sockfd = listener->fd;
* Create and initialize the new request.
*/
request = request_alloc(NULL);
- request->reply = rad_alloc(request, 0);
+ request->reply = rad_alloc(request, false);
if (!request->reply) {
ERROR("No memory");
talloc_free(request);
request->number = request_num_counter++;
NO_CHILD_THREAD;
- request->proxy = rad_alloc(request, 1);
+ request->proxy = rad_alloc(request, true);
rad_assert(request->proxy != NULL);
if (home->ping_check == HOME_PING_CHECK_STATUS_SERVER) {
goto error;
}
- request->packet = rad_alloc(request, 1);
+ request->packet = rad_alloc(request, true);
if (!request->packet) {
ERROR("Out of memory");
goto error;
* recover once some requests timeout, so make an effort to deal
* with allocation failures gracefully.
*/
- current = rad_alloc(conf, 0);
+ current = rad_alloc(conf, false);
if (!current) {
REDEBUG("Failed allocating memory to hold decoded packet");
rs_tv_add_ms(&header->ts, conf->stats.timeout, &stats->quiet);
RADCLIENT *client = sock->client;
if (!sock->packet) {
- sock->packet = rad_alloc(sock, 0);
+ sock->packet = rad_alloc(sock, false);
if (!sock->packet) return 0;
sock->packet->sockfd = listener->fd;
/*
* Not sure if we should do this on every packet...
*/
- request->reply = rad_alloc(request, 0);
+ request->reply = rad_alloc(request, false);
if (!request->reply) return 0;
rad_assert(sock->ssn == NULL);
data = sock->data;
- packet = rad_alloc(sock, 0);
+ packet = rad_alloc(sock, false);
packet->sockfd = listener->fd;
packet->src_ipaddr = sock->other_ipaddr;
packet->src_port = sock->other_port;
*/
request = request_alloc(NULL);
- request->packet = rad_alloc(request, 0);
+ request->packet = rad_alloc(request, false);
if (!request->packet) {
ERROR("No memory");
talloc_free(request);
return NULL;
}
- request->reply = rad_alloc(request, 0);
+ request->reply = rad_alloc(request, false);
if (!request->reply) {
ERROR("No memory");
talloc_free(request);
*/
fake->server = request->server;
- fake->packet = rad_alloc(fake, 1);
+ fake->packet = rad_alloc(fake, true);
if (!fake->packet) {
talloc_free(fake);
return NULL;
}
- fake->reply = rad_alloc(fake, 0);
+ fake->reply = rad_alloc(fake, false);
if (!fake->reply) {
talloc_free(fake);
return NULL;
request->coa->packet->code = 0; /* unknown, as of yet */
request->coa->child_state = REQUEST_RUNNING;
- request->coa->proxy = rad_alloc(request->coa, 0);
+ request->coa->proxy = rad_alloc(request->coa, false);
if (!request->coa->proxy) {
TALLOC_FREE(request->coa);
return NULL;
uint8_t *code;
ssize_t data_len;
- packet = rad_alloc(NULL, 0);
+ packet = rad_alloc(NULL, false);
if (!packet) {
fr_strerror_printf("Failed allocating packet");
return NULL;
fp = stdin;
}
- request = rad_alloc(NULL, 0);
+ request = rad_alloc(NULL, false);
/*
* Read the VP's.
/*
* Allocate the new request data structure
*/
- packet = rad_alloc(NULL, 0);
+ packet = rad_alloc(NULL, false);
if (!packet) {
fr_strerror_printf("out of memory");
return NULL;
DEBUG2("Including dictionary file %s/%s", radius_dir, RADIUS_DICTIONARY);
}
- req = rad_alloc(NULL, 1);
+ req = rad_alloc(NULL, true);
if (!req) {
ERROR("%s", fr_strerror());
exit(1);
return 1;
}
- req = rad_alloc(NULL, 1)
+ req = rad_alloc(NULL, true)
if (!req) {
ERROR("%s", fr_strerror());
exit(1);
}
- req2 = rad_alloc(NULL, 1);
+ req2 = rad_alloc(NULL, true);
if (!req2) {
ERROR("%s", fr_strerror());
exit(1);
* we built here.
*/
if (!packet) {
- packet = rad_alloc(request, 1);
+ packet = rad_alloc(request, true);
if (!packet) {
return RLM_MODULE_FAIL;
}