53{
54
55
59
60
61
62
63 const char *dnsName = nullptr;
64 if ((dnsName = getenv("XRDNET_IDENTITY")))
69 return false;
70 }
71
72
73
76
79
80
81
85
86
87
88
89
90
92 const char *domP = nullptr;
93 char *theIPA[2] = { nullptr, nullptr };
94 char *theName[2] = { nullptr, nullptr };
96
97 while((ifNow = ifList))
98 {int i = (ifNow->sval[1] ? 1 : 0);
99
100 if (i >= 0 && theName[i] == 0 && !theAddr.
Set(ifNow->
text, 0)
101 && (dnsName = theAddr.
Name(0,&
DNS_Error)) && (domP = index(dnsName,
'.')))
102 {int n = domP - dnsName;
103 if (n == hnLen && !strncmp(
DNS_FQN, dnsName, n))
104 {theName[i] = strdup(dnsName);
105 } else {
106 if (theIPA[i]) free(theIPA[i]);
107 theIPA[i] = strdup(ifNow->
text);
108 }
109 }
110 ifList = ifList->
next;
111 delete ifNow;
112 }
113
114
115
117
118
119
120 if (theName[0])
122 goto done;
123 }
124
125
126
127 if (theName[1])
129 goto done;
130 }
131
132
133
134
135
138
139
140
141 if (dnsName)
143 goto done;
144 }
145
146
147
148
149
150
151 if (theIPA[0])
153 goto done;
154 }
155
156 if (theIPA[1])
158 goto done;
159 }
160
161
162
163
165 return true;
166
167done:
168 free(theName[0]);
169 free(theName[1]);
170 free(theIPA[0]);
171 free(theIPA[1]);
172
175 return true;
176}
static const char * DNS_Error
static const char * DNS_Domain
const char * XrdSysE2T(int errcode)
static bool isHostName(const char *name)
const char * Name(const char *eName=0, const char **eText=0)
const char * Set(const char *hSpec, int pNum=PortInSpec)
static int GetIF(XrdOucTList **ifList, const char **eText=0)
static void toLower(char *str)