afsconf srv lookup fill cellname
[openafs.git] / src / auth / cellconfig.c
index 18a286b..2009978 100644 (file)
@@ -1027,6 +1027,18 @@ afsconf_LookupServer(const char *service, const char *protocol,
     if (!dotcellname)
        return AFSCONF_NOTFOUND;        /* service not found */
 
+#ifdef HAVE_RES_RETRANSRETRY
+    if ((_res.options & RES_INIT) == 0 && res_init() == -1)
+      return (0);
+
+    /*
+     * Rx timeout is typically 56 seconds; limit user experience to
+     * similar timeout
+     */
+    _res.retrans = 18;
+    _res.retry = 3;
+#endif
+
  retryafsdb:
     switch (pass) {
     case 0:
@@ -1135,6 +1147,13 @@ afsconf_LookupServer(const char *service, const char *protocol,
        }
        if (type == T_SRV) {
            struct hostent *he;
+           /* math here: _ is 1, _ ._ is 3, _ ._ . is 4. then the domain. */
+           if ((strncmp(host + 1, IANAname, strlen(IANAname)) == 0) &&
+               (strncmp(host + strlen(IANAname) + 3, protocol,
+                        strlen(protocol)) == 0)) {
+               realCellName = strdup(host + strlen(IANAname) +
+                                     strlen(protocol) + 4);
+           }
 
            code = dn_expand(answer, answer + len, p + 6, host, sizeof(host));
            if (code < 0) {