e4187a3e3f5f47339190d1daead5dfaa6644c0d8 hiram Thu Jul 23 09:00:57 2026 -0700 use hg.conf to determine .ucsc.edu domain - does not work with gethostname() refs #31811 diff --git src/hg/hubApi/liftOver.c src/hg/hubApi/liftOver.c index 7a93ee56d96..756bc824c1b 100644 --- src/hg/hubApi/liftOver.c +++ src/hg/hubApi/liftOver.c @@ -182,34 +182,40 @@ * via the genome.ucsc.edu name, sending them into an infinite self-relay * loop in fetchGbMembersFromCentral(). */ { static char host[256]; static boolean init = FALSE; if (!init) { if (gethostname(host, sizeof(host)) != 0) host[0] = '\0'; init = TRUE; } return host; } static boolean inUcscEduDomain() -/* Return TRUE if this host is anywhere under the ucsc.edu domain. */ -{ -char *hostName = thisHostName(); -return (hostName[0] != '\0' && endsWith(hostName, ".ucsc.edu")); +/* Return TRUE if this machine is configured as belonging to the ucsc.edu + * domain, per hg.conf's central.domain setting (the same setting used for + * the cross-host login cookie domain). This is deployment config rather + * than something derived from the machine's own OS hostname/DNS: a box's + * local/cloud-assigned hostname and its UCSC-facing name (e.g. + * genome-euro.ucsc.edu) can be unrelated DNS labels with no way to bridge + * them via gethostname()/getaddrinfo(). */ +{ +char *domain = cfgOption(CFG_CENTRAL_DOMAIN); +return (domain != NULL && strstr(domain, ".ucsc.edu") != NULL); } static boolean onGenomeRRMachine() /* Return TRUE if running on one of the genome.ucsc.edu round-robin * machines (hgw0, hgw1, hgw2, ...), which carry SQL grants on * hgcentral.gbMembers. Only meaningful within inUcscEduDomain(). */ { if (hIsPrivateHost()) // stay on localhost for hgwdev and hgwbeta return TRUE; char *hostName = thisHostName(); if (hostName[0] == '\0' || !startsWith("hgw", hostName)) return FALSE; char afterHgw = hostName[3]; return (afterHgw >= '0' && afterHgw <= '9'); }