mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 13:38:01 +00:00
afs: incorrect types for AFSDB IPv4 addresses
DNS lookup results were being handled with int types. Fortunately, this seems to be harmless, due to use of memcpy when the types don't match, and assignment only when both sides were int. However, to avoid any future unpleasantness, change them to afs_uint32. No functional change should be incurred. Change-Id: I31aeabb4ae3194a00b29a1fa767d05af167b4e4f Reviewed-on: http://gerrit.openafs.org/12117 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Chas Williams <3chas3@gmail.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
parent
17ca935bbd
commit
b8757341fb
@ -15,14 +15,14 @@
|
|||||||
names for the given cell, ending in null */
|
names for the given cell, ending in null */
|
||||||
int getAFSServer(const char *service, const char *protocol, const char *cellname,
|
int getAFSServer(const char *service, const char *protocol, const char *cellname,
|
||||||
unsigned short afsdbPort,
|
unsigned short afsdbPort,
|
||||||
int *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS],
|
afs_uint32 *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS],
|
||||||
unsigned short ports[], unsigned short ipRanks[], int *numServers, int *ttl);
|
unsigned short ports[], unsigned short ipRanks[], int *numServers, int *ttl);
|
||||||
|
|
||||||
/* Same as above, but using cm_unichar_t. Note that this functon will
|
/* Same as above, but using cm_unichar_t. Note that this functon will
|
||||||
only be defined for DNSAPI_ENV. */
|
only be defined for DNSAPI_ENV. */
|
||||||
int getAFSServerW(const cm_unichar_t *service, const cm_unichar_t *protocol, const cm_unichar_t *cellName,
|
int getAFSServerW(const cm_unichar_t *service, const cm_unichar_t *protocol, const cm_unichar_t *cellName,
|
||||||
unsigned short afsdbPort,
|
unsigned short afsdbPort,
|
||||||
int *cellHostAddrs,
|
afs_uint32 *cellHostAddrs,
|
||||||
cm_unichar_t cellHostNames[][MAXHOSTCHARS],
|
cm_unichar_t cellHostNames[][MAXHOSTCHARS],
|
||||||
unsigned short ports[],
|
unsigned short ports[],
|
||||||
unsigned short ipRanks[],
|
unsigned short ipRanks[],
|
||||||
|
@ -964,7 +964,7 @@ afsconf_GetExtendedCellInfo(struct afsconf_dir *adir, char *acellName,
|
|||||||
int
|
int
|
||||||
afsconf_LookupServer(const char *service, const char *protocol,
|
afsconf_LookupServer(const char *service, const char *protocol,
|
||||||
const char *cellName, unsigned short afsdbPort,
|
const char *cellName, unsigned short afsdbPort,
|
||||||
int *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS],
|
afs_uint32 *cellHostAddrs, char cellHostNames[][MAXHOSTCHARS],
|
||||||
unsigned short ports[], unsigned short ipRanks[],
|
unsigned short ports[], unsigned short ipRanks[],
|
||||||
int *numServers, int *ttl, char **arealCellName)
|
int *numServers, int *ttl, char **arealCellName)
|
||||||
{
|
{
|
||||||
@ -1104,7 +1104,7 @@ afsconf_LookupServer(const char *service, const char *protocol,
|
|||||||
/* Do we want to get TTL data for the A record as well? */
|
/* Do we want to get TTL data for the A record as well? */
|
||||||
(he = gethostbyname(host))) {
|
(he = gethostbyname(host))) {
|
||||||
if (he->h_addrtype == AF_INET) {
|
if (he->h_addrtype == AF_INET) {
|
||||||
afs_int32 ipaddr;
|
afs_uint32 ipaddr;
|
||||||
memcpy(&ipaddr, he->h_addr, sizeof(ipaddr));
|
memcpy(&ipaddr, he->h_addr, sizeof(ipaddr));
|
||||||
cellHostAddrs[server_num] = ipaddr;
|
cellHostAddrs[server_num] = ipaddr;
|
||||||
ports[server_num] = afsdbPort;
|
ports[server_num] = afsdbPort;
|
||||||
@ -1138,7 +1138,7 @@ afsconf_LookupServer(const char *service, const char *protocol,
|
|||||||
/* Do we want to get TTL data for the A record as well? */
|
/* Do we want to get TTL data for the A record as well? */
|
||||||
(he = gethostbyname(host))) {
|
(he = gethostbyname(host))) {
|
||||||
if (he->h_addrtype == AF_INET) {
|
if (he->h_addrtype == AF_INET) {
|
||||||
afs_int32 ipaddr;
|
afs_uint32 ipaddr;
|
||||||
|
|
||||||
memcpy(&ipaddr, he->h_addr, sizeof(ipaddr));
|
memcpy(&ipaddr, he->h_addr, sizeof(ipaddr));
|
||||||
cellHostAddrs[server_num] = ipaddr;
|
cellHostAddrs[server_num] = ipaddr;
|
||||||
@ -1188,7 +1188,7 @@ int
|
|||||||
afsconf_GetAfsdbInfo(char *acellName, char *aservice,
|
afsconf_GetAfsdbInfo(char *acellName, char *aservice,
|
||||||
struct afsconf_cell *acellInfo)
|
struct afsconf_cell *acellInfo)
|
||||||
{
|
{
|
||||||
afs_int32 cellHostAddrs[AFSMAXCELLHOSTS];
|
afs_uint32 cellHostAddrs[AFSMAXCELLHOSTS];
|
||||||
char cellHostNames[AFSMAXCELLHOSTS][MAXHOSTCHARS];
|
char cellHostNames[AFSMAXCELLHOSTS][MAXHOSTCHARS];
|
||||||
unsigned short ipRanks[AFSMAXCELLHOSTS];
|
unsigned short ipRanks[AFSMAXCELLHOSTS];
|
||||||
unsigned short ports[AFSMAXCELLHOSTS];
|
unsigned short ports[AFSMAXCELLHOSTS];
|
||||||
@ -1256,7 +1256,7 @@ afsconf_GetAfsdbInfo(char *acellName, char *aservice,
|
|||||||
int tservice = afsconf_FindService(aservice); /* network byte order */
|
int tservice = afsconf_FindService(aservice); /* network byte order */
|
||||||
const char *ianaName = afsconf_FindIANAName(aservice);
|
const char *ianaName = afsconf_FindIANAName(aservice);
|
||||||
struct afsconf_entry DNSce;
|
struct afsconf_entry DNSce;
|
||||||
afs_int32 cellHostAddrs[AFSMAXCELLHOSTS];
|
afs_uint32 cellHostAddrs[AFSMAXCELLHOSTS];
|
||||||
char cellHostNames[AFSMAXCELLHOSTS][MAXHOSTCHARS];
|
char cellHostNames[AFSMAXCELLHOSTS][MAXHOSTCHARS];
|
||||||
unsigned short ipRanks[AFSMAXCELLHOSTS];
|
unsigned short ipRanks[AFSMAXCELLHOSTS];
|
||||||
unsigned short ports[AFSMAXCELLHOSTS]; /* network byte order */
|
unsigned short ports[AFSMAXCELLHOSTS]; /* network byte order */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user