Merge remote-tracking branch 'lp-asLib/as-hostname' into 7.0

* lp-asLib/as-hostname:
  update release notes
  asLib more string size...
  asLib one short
  asLib: asUseIP name lookup soft-fail
  Expand Release Note entry for as-hostname changes.
  as-hostname address review comments
  asLib: test asUseIP
  as,rsrv: use real client IP instead of untrusted host name

# Conflicts:
#	documentation/RELEASE_NOTES.html
This commit is contained in:
Michael Davidsaver
2019-08-31 15:07:22 -07:00
8 changed files with 153 additions and 12 deletions
@@ -861,6 +861,14 @@ static int host_name_action ( caHdrLargeArray *mp, void *pPayload,
return RSRV_ERROR;
}
/* after all validation */
if(asCheckClientIP) {
DLOG (2, ( "CAS: host_name_action for \"%s\" ignores client provided host name\n",
client->pHostName ) );
return RSRV_OK;
}
/*
* user name will not change if there isnt enough memory
*/
@@ -1421,6 +1421,20 @@ struct client *create_tcp_client (SOCKET sock , const osiSockAddr *peerAddr)
}
client->addr = peerAddr->ia;
if(asCheckClientIP) {
epicsUInt32 ip = ntohl(client->addr.sin_addr.s_addr);
client->pHostName = malloc(24);
if(!client->pHostName) {
destroy_client ( client );
return NULL;
}
epicsSnprintf(client->pHostName, 24,
"%u.%u.%u.%u",
(ip>>24)&0xff,
(ip>>16)&0xff,
(ip>>8)&0xff,
(ip>>0)&0xff);
}
/*
* see TCP(4P) this seems to make unsolicited single events much
+1 -1
View File
@@ -86,7 +86,7 @@ typedef struct client {
ELLLIST chanList;
ELLLIST chanPendingUpdateARList;
ELLLIST putNotifyQue;
struct sockaddr_in addr;
struct sockaddr_in addr; /* peer address, TCP only */
epicsTimeStamp time_at_last_send;
epicsTimeStamp time_at_last_recv;
void *evuser;