freebsd-ports/net/freeradius-client/files/patch-lib::ip_util.c
Beech Rintoul 55e7e27424 The FreeRADIUS Client is a framework and library for writing RADIUS
Clients which additionally includes radlogin, a flexible RADIUS aware
login replacement, a command line program to send RADIUS
authentication/authorisation requests and accounting records and a
utility to query the status of a RADIUS server.  All these programs are
based on a library which lets you develop a RADIUS-aware application in
less than 50 lines of C code. It is highly portable and runs on Linux,
many BSD variants and Solaris.

PR:		ports/129250
Submitted by:	netch at netch.kiev.ua
2008-12-22 08:24:42 +00:00

39 lines
824 B
C

--- lib/ip_util.c
+++ lib/ip_util.c
@@ -350,6 +350,36 @@
}
/*
+ * Function: rc_nasaddress
+ *
+ * Purpose: get the IP address to be declared as NAS-Address
+ * for sending requests in host order
+ *
+ * Returns: IP address, or 0 if didn't specified
+ *
+ */
+
+uint32_t rc_nasaddress(rc_handle *rh)
+{
+ const char *cs;
+ char hostname[256];
+ uint32_t rval;
+
+ cs = rc_conf_str(rh, "nasaddr");
+ if (cs == NULL || 0 == strcmp(cs, "*"))
+ return 0;
+
+ strncpy(hostname, cs, sizeof(hostname));
+ hostname[sizeof(hostname) - 1] = '\0';
+ if ((rval = rc_get_ipaddr(hostname)) == 0) {
+ rc_log(LOG_ERR, "rc_own_ipaddress: couldn't get IP address from bindaddr");
+ rval = INADDR_ANY;
+ }
+
+ return rval;
+}
+
+/*
* Function: rc_get_srcaddr
*
* Purpose: given remote address find local address which the