listener->fd = -1;
listener->state = STATE_UNOPENED;
- detail_open(listener);
-
/*
- * Note that we don't open or create "detail"
- * again, as we don't know what permissions to
- * use.
+ * Try to open "detail" again. If we're on a
+ * busy RADIUS server, odds are that it will
+ * now exist.
*/
+ detail_open(listener);
return 0;
}
cs = cf_subsection_find_next(mainconfig.config,
cs, "listen")) {
int type;
- char *listen_type;
+ char *listen_type, *identity;
int listen_port;
int lineno = cf_section_lineno(cs);
lrad_ipaddr_t ipaddr;
listen_port = 0;
listen_type = NULL;
+ identity = NULL;
rcode = cf_item_parse(cs, "type", PW_TYPE_STRING_PTR,
&listen_type, "");
return -1;
}
+ /*
+ * FIXME: We leak identity if we return, but who
+ * cares... the server will kill itself anyhow.
+ */
+ rcode = cf_item_parse(cs, "identity", PW_TYPE_STRING_PTR,
+ &identity, NULL);
+ if (rcode < 0) return -1;
+
type = lrad_str2int(listen_compare, listen_type,
RAD_LISTEN_NONE);
if (type == RAD_LISTEN_NONE) {
this = rad_malloc(sizeof(*this));
memset(this, 0, sizeof(*this));
this->type = type;
+ this->identity = identity;
+ this->fd = -1;
+
this->recv = detail_recv;
this->send = detail_send;
this->detail = detail;
this->vps = NULL;
- this->fd = -1;
this->fp = NULL;
this->state = STATE_UNOPENED;
-
+
rcode = cf_item_parse(cs, "max_outstanding",
PW_TYPE_INTEGER,
&(this->max_outstanding), "0");
this = rad_malloc(sizeof(*this));
memset(this, 0, sizeof(*this));
this->type = type;
+ this->identity = identity;
+
this->ipaddr = ipaddr;
this->port = listen_port;
/*
* Some "magic" handlers, which are never in VP's, but
* which are in the packet.
+ *
+ * FIXME: We should really do this in a more
+ * intelligent way...
*/
if (packet) {
VALUE_PAIR localvp;
sizeof(packet->dst_ipaddr.ipaddr.ip4addr.s_addr));
break;
+ case PW_SERVER_IDENTITY:
+ if (!request->listener->identity) return 0;
+
+ snprintf(out, outlen, "%s", request->listener->identity);
+ return strlen(out);
+ break;
+
default:
return 0; /* not found */
break;