as-hostname address review comments
This commit is contained in:
@@ -26,6 +26,28 @@ release.</p>
|
||||
|
||||
-->
|
||||
|
||||
<h3>ACF Hostname from DNS</h3>
|
||||
|
||||
<p>ACF hostname has so far been a string provided by a CA client,
|
||||
which may or may not agree with DNS. An option is now available
|
||||
to cause IOCs to resolve hostnames, and compare against the actual
|
||||
client IP address.</p>
|
||||
<p> This resolution is done at ACF file load time,
|
||||
which has two consequences.</p>
|
||||
|
||||
<ul>
|
||||
<li>Slow/unavailable DNS will cause problems during ACF file
|
||||
loading. eg. during IOC start.</li>
|
||||
<li>Changes in host -> IP mapping will not be picked up until/unless
|
||||
the ACF file is reloaded.</li>
|
||||
</ul>
|
||||
|
||||
<p>This may be enabled with:</p>
|
||||
|
||||
<blockquote><pre>
|
||||
var("asCheckClientIP",1)
|
||||
</pre></blockquote>
|
||||
|
||||
<h3>Launchpad Bugs</h3>
|
||||
|
||||
<p>The list of tracked bugs fixed in this release can be found on the
|
||||
|
||||
@@ -862,9 +862,9 @@ static int host_name_action ( caHdrLargeArray *mp, void *pPayload,
|
||||
}
|
||||
|
||||
/* after all validation */
|
||||
if(asUseIP) {
|
||||
if(asCheckClientIP) {
|
||||
|
||||
DLOG (2, ( "CAS: host_name_action for \"%s\" ignores clist provided host name\n",
|
||||
DLOG (2, ( "CAS: host_name_action for \"%s\" ignores client provided host name\n",
|
||||
client->pHostName ) );
|
||||
return RSRV_OK;
|
||||
}
|
||||
|
||||
@@ -1421,7 +1421,7 @@ struct client *create_tcp_client (SOCKET sock , const osiSockAddr *peerAddr)
|
||||
}
|
||||
|
||||
client->addr = peerAddr->ia;
|
||||
if(asUseIP) {
|
||||
if(asCheckClientIP) {
|
||||
epicsUInt32 ip = ntohl(client->addr.sin_addr.s_addr);
|
||||
client->pHostName = malloc(24);
|
||||
if(!client->pHostName) {
|
||||
|
||||
@@ -24,7 +24,7 @@ extern "C" {
|
||||
/* 0 - Use (unverified) client provided host name string.
|
||||
* 1 - Use actual client IP address. HAG() are resolved to IPs at ACF load time.
|
||||
*/
|
||||
epicsShareExtern int asUseIP;
|
||||
epicsShareExtern int asCheckClientIP;
|
||||
|
||||
typedef struct asgMember *ASMEMBERPVT;
|
||||
typedef struct asgClient *ASCLIENTPVT;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "postfix.h"
|
||||
#include "asLib.h"
|
||||
|
||||
int asUseIP;
|
||||
int asCheckClientIP;
|
||||
|
||||
static epicsMutexId asLock;
|
||||
#define LOCK epicsMutexMustLock(asLock)
|
||||
@@ -1210,7 +1210,7 @@ static long asHagAddHost(HAG *phag,const char *host)
|
||||
int len, i;
|
||||
|
||||
if (!phag) return 0;
|
||||
if(!asUseIP) {
|
||||
if(!asCheckClientIP) {
|
||||
len = strlen(host);
|
||||
phagname = asCalloc(1, sizeof(HAGNAME) + len + 1);
|
||||
phagname->host = (char *)(phagname + 1);
|
||||
|
||||
@@ -393,7 +393,7 @@ static void installLastResortEventProviderCallFunc(const iocshArgBuf *args)
|
||||
installLastResortEventProvider();
|
||||
}
|
||||
|
||||
static iocshVarDef asUseIPDef = {"asUseIP", iocshArgInt, 0};
|
||||
static iocshVarDef asCheckClientIPDef = {"asCheckClientIP", iocshArgInt, 0};
|
||||
|
||||
void epicsShareAPI libComRegister(void)
|
||||
{
|
||||
@@ -428,6 +428,6 @@ void epicsShareAPI libComRegister(void)
|
||||
iocshRegister(&generalTimeReportFuncDef,generalTimeReportCallFunc);
|
||||
iocshRegister(&installLastResortEventProviderFuncDef, installLastResortEventProviderCallFunc);
|
||||
|
||||
asUseIPDef.pval = &asUseIP;
|
||||
iocshRegisterVariable(&asUseIPDef);
|
||||
asCheckClientIPDef.pval = &asCheckClientIP;
|
||||
iocshRegisterVariable(&asCheckClientIPDef);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ static const char hostname_config[] = ""
|
||||
static void testHostNames(void)
|
||||
{
|
||||
testDiag("testHostNames()");
|
||||
asUseIP = 0;
|
||||
asCheckClientIP = 0;
|
||||
|
||||
testOk1(asInitMem(hostname_config, NULL)==0);
|
||||
|
||||
@@ -102,7 +102,7 @@ static void testHostNames(void)
|
||||
testAccess("ro", 0);
|
||||
testAccess("rw", 0);
|
||||
|
||||
setHost("nosuchhost");
|
||||
setHost("guaranteed.invalid.");
|
||||
|
||||
testAccess("invalid", 0);
|
||||
testAccess("DEFAULT", 0);
|
||||
@@ -113,7 +113,7 @@ static void testHostNames(void)
|
||||
static void testUseIP(void)
|
||||
{
|
||||
testDiag("testUseIP()");
|
||||
asUseIP = 1;
|
||||
asCheckClientIP = 1;
|
||||
|
||||
/* still host names in .acf */
|
||||
testOk1(asInitMem(hostname_config, NULL)==0);
|
||||
@@ -135,7 +135,7 @@ static void testUseIP(void)
|
||||
testAccess("ro", 1);
|
||||
testAccess("rw", 3);
|
||||
|
||||
setHost("nosuchhost");
|
||||
setHost("guaranteed.invalid.");
|
||||
|
||||
testAccess("invalid", 0);
|
||||
testAccess("DEFAULT", 0);
|
||||
|
||||
Reference in New Issue
Block a user