to be given numerically, and NOT by host name.
Added support in library to NOT call any 'gethostbyFOO' functions
if we have DNS turned off.
Added complaints in 'files.c' to error out if we fail to look
up a host name.
struct hostent *hp;
static char hstname[128];
+ /*
+ * No DNS: don't look up host names
+ */
+ if (!librad_dodns) {
+ ip_ntoa(hstname, ipaddr);
+ return(hstname);
+ }
+
hp = gethostbyaddr((char *)&ipaddr, sizeof (struct in_addr), AF_INET);
if (hp == 0) {
ip_ntoa(hstname, ipaddr);
if ((a = ip_addr(host)) != 0)
return a;
+ /*
+ * No DNS: don't look up host names
+ */
+ if (!librad_dodns) {
+ return 0;
+ }
+
if ((hp = gethostbyname(host)) == NULL)
return (UINT4)0;
}
c->ipaddr = ip_getaddr(hostnm);
+ if (c->ipaddr == 0) {
+ log(L_CONS|L_ERR, "%s[%d]: Failed to look up hostname %s",
+ file, lineno, hostnm);
+ return -1;
+ }
strcpy(c->secret, secret);
strcpy(c->shortname, shortnm);
strcpy(c->longname, ip_hostname(c->ipaddr));
}
if (strcmp(hostnm, "LOCAL") != 0)
c->ipaddr = ip_getaddr(hostnm);
+ if (c->ipaddr == 0) {
+ log(L_CONS|L_ERR, "%s[%d]: Failed to look up hostname %s",
+ file, lineno, hostnm);
+ return -1;
+ }
/*
* Double-check lengths to be sure they're sane
/*
* Process the options.
*/
- while((argval = getopt(argc, argv, "ASa:ci:l:d:bfp:svxyz")) != EOF) {
+ while((argval = getopt(argc, argv, "ASa:ci:l:d:bfnp:svxyz")) != EOF) {
switch(argval) {
case 'l':
radlog_dir = optarg;
break;
-
+
+ case 'n':
+ librad_dodns = 0;
+ break;
+
case 'S':
log_stripped_names++;
break;