else {
AFS_COPYIN((char *)parm3, tcell.cellName, parm4, code);
if (!code)
- afs_NewCell(tcell.cellName, tcell.hosts, parm5,
- (char *)0, (u_short)0, (u_short)0, (int)0);
+ afs_NewCell(tcell.cellName, tcell.hosts, parm5, (char *)0,
+ (u_short)0, (u_short)0, (int)0, (char *)0);
}
}
} else if (parm == AFSOP_ADDCELL2) {
}
}
if (!code)
- afs_NewCell(tbuffer1, tcell.hosts, cflags,
- lcnamep, (u_short)0, (u_short)0, (int)0);
+ afs_NewCell(tbuffer1, tcell.hosts, cflags, lcnamep,
+ (u_short)0, (u_short)0, (int)0, (char *)0);
}
}
osi_FreeSmallSpace(tbuffer);
char afs_AfsdbHandler_Completed = 0;
-struct cell *afs_GetCellByName2();
-
int afs_strcasecmp(s1, s2)
register char *s1, *s2;
{
struct cell *tc;
int timeout;
- /* Don't need to do anything if no timeout or it's not expired */
- if (!ac->timeout || ac->timeout > osi_Time()) return;
+ if (ac->cellHosts[0]) /* If we already have some servers.. */
+ if (!ac->timeout || ac->timeout > osi_Time())
+ /* Don't refresh if not expired */
+ return;
if (afs_GetCellHostsFromDns(ac->cellName, cellHosts, &timeout, &realName))
/* In case of lookup failure, keep old data */
* Look up the entry we just updated, to compensate for
* uppercase-vs-lowercase lossage with DNS.
*/
- tc = afs_GetCellByName2(realName, READ_LOCK, 0 /* no AFSDB */);
+ tc = afs_FindCellByName(realName, READ_LOCK);
if (tc) {
afs_NewCell(ac->cellName, 0, CAlias, (char *) 0, 0, 0,
* Look up the entry we just updated, to compensate for
* uppercase-vs-lowercase lossage with DNS.
*/
- tc = afs_GetCellByName2(realName, READ_LOCK, 0 /* no AFSDB */);
+ tc = afs_FindCellByName(realName, READ_LOCK);
if (!tc)
goto bad;
if (realName)
afs_osi_Free(realName, strlen(realName) + 1);
- return afs_GetCellByName2(acellName, locktype, 0);
+ return afs_FindCellByName(acellName, locktype);
bad:
if (realName)
}
-struct cell *afs_GetCellByName2(acellName, locktype, trydns)
+struct cell *afs_FindCellByName(acellName, locktype)
register char *acellName;
afs_int32 locktype;
- char trydns;
{
register struct cell *tc;
register struct afs_q *cq, *tq;
return tc;
}
}
- ReleaseWriteLock(&afs_xcell);
- return trydns ? afs_GetCellByName_Dns(acellName, locktype)
- : (struct cell *) 0;
-} /*afs_GetCellByName2*/
+ ReleaseWriteLock(&afs_xcell);
+ return (struct cell *) 0;
+} /*afs_FindCellByName*/
struct cell *afs_GetCellByName(acellName, locktype)
register char *acellName;
afs_int32 locktype;
{
- return afs_GetCellByName2(acellName, locktype, 1);
+ struct cell *tc;
+
+ tc = afs_FindCellByName(acellName, locktype);
+ if (!tc)
+ tc = afs_GetCellByName_Dns(acellName, locktype);
+ return tc;
} /*afs_GetCellByName*/
static struct cell *afs_GetCellInternal(acell, locktype, holdxcell)
register struct afs_q *cq, *tq;
AFS_STATCNT(afs_NewCell);
- if (!(aflags & CAlias) && *acellHosts == 0)
- /* need >= one host to gen cell # */
- return EINVAL;
ObtainWriteLock(&afs_xcell,103);
for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
tc = QTOC(cq); tq = QNext(cq);
if (afs_strcasecmp(tc->cellName, acellName) == 0) {
- /* if the cell we've found has the correct name but no timeout,
+ /* If the cell we've found has the correct name but no timeout,
* and we're called with a non-zero timeout, bail out: never
- * override static configuration entries with AFSDB ones. */
- if (timeout && !tc->timeout) {
+ * override static configuration entries with AFSDB ones.
+ * One exception: if the original cell entry had no servers,
+ * it must get servers from AFSDB.
+ */
+ if (timeout && !tc->timeout && tc->cellHosts[0]) {
ReleaseWriteLock(&afs_xcell);
return 0;
}