BSD 4_3_Net_2 release
[unix-history] / usr / src / usr.sbin / amd / amd / info_hes.c
index 8d68be4..77ee5d8 100644 (file)
@@ -1,6 +1,4 @@
 /*
 /*
- * $Id: info_hes.c,v 5.2.1.3 91/03/03 20:39:41 jsp Alpha $
- *
  * Copyright (c) 1989 Jan-Simon Pendry
  * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  * Copyright (c) 1989 The Regents of the University of California.
  * Copyright (c) 1989 Jan-Simon Pendry
  * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  * Copyright (c) 1989 The Regents of the University of California.
@@ -9,9 +7,38 @@
  * This code is derived from software contributed to Berkeley by
  * Jan-Simon Pendry at Imperial College, London.
  *
  * This code is derived from software contributed to Berkeley by
  * Jan-Simon Pendry at Imperial College, London.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)info_hes.c  5.3 (Berkeley) 5/12/91
+ *
+ * $Id: info_hes.c,v 5.2.1.5 91/05/07 22:17:58 jsp Alpha $
  *
  *
- *     @(#)info_hes.c  5.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -72,7 +99,9 @@ time_t *tp;
  * of /defaults in hesiod.home will result in a
  * call to hes_resolve("/defaults", "home.automount");
  */
  * of /defaults in hesiod.home will result in a
  * call to hes_resolve("/defaults", "home.automount");
  */
+#ifdef notdef
 #define MAKE_HES_NAME(dest, src) sprintf(dest, "%s%s", src + HES_PREFLEN, ".automount")
 #define MAKE_HES_NAME(dest, src) sprintf(dest, "%s%s", src + HES_PREFLEN, ".automount")
+#endif
 
 /*
  * Do a Hesiod nameserver call.
 
 /*
  * Do a Hesiod nameserver call.
@@ -87,24 +116,25 @@ char **pval;
 time_t *tp;
 {
        int error;
 time_t *tp;
 {
        int error;
-       char hes_map[MAXPATHLEN];
+       char hes_key[MAXPATHLEN];
        char **rvec;
 #ifdef DEBUG
        dlog("hesiod_search(m=%x, map=%s, key=%s, pval=%x tp=%x)", m, map, key, pval, tp);
 #endif
        char **rvec;
 #ifdef DEBUG
        dlog("hesiod_search(m=%x, map=%s, key=%s, pval=%x tp=%x)", m, map, key, pval, tp);
 #endif
-       MAKE_HES_NAME(hes_map, map);
+       /*MAKE_HES_NAME(hes_map, map);*/
+       sprintf(hes_key, "%s.%s", key, map+HES_PREFLEN);
 
        /*
         * Call the resolver
         */
 #ifdef DEBUG
 
        /*
         * Call the resolver
         */
 #ifdef DEBUG
-       dlog("hesiod_search: hes_resolve(%s, %s)", key, hes_map);
+       dlog("hesiod_search: hes_resolve(%s, %s)", hes_key, "automount");
 #ifdef HAS_HESIOD_RELOAD
        if (debug_flags & D_FULL)
                _res.options |= RES_DEBUG;
 #endif
 #endif
 #ifdef HAS_HESIOD_RELOAD
        if (debug_flags & D_FULL)
                _res.options |= RES_DEBUG;
 #endif
 #endif
-       rvec = hes_resolve(key, hes_map);
+       rvec = hes_resolve(hes_key, "automount");
        /*
         * If a reply was forthcoming then return
         * it (and free subsequent replies)
        /*
         * If a reply was forthcoming then return
         * it (and free subsequent replies)
@@ -153,7 +183,6 @@ mnt_map *m;
 char *map;
 void (*fn)();
 {
 char *map;
 void (*fn)();
 {
-       char hes_map[MAXPATHLEN];
        char *zone_name, *cp;
        short domainlen;
        int status;
        char *zone_name, *cp;
        short domainlen;
        int status;
@@ -170,8 +199,7 @@ void (*fn)();
        _res.retrans = 90;
        hs_map = m;
        domainlen = strlen(hostdomain);
        _res.retrans = 90;
        hs_map = m;
        domainlen = strlen(hostdomain);
-       MAKE_HES_NAME(hes_map, map);
-       zone_name = hes_to_bind("", hes_map);
+       zone_name = hes_to_bind(map+HES_PREFLEN, "automount");
        if (*zone_name == '.')
                zone_name++;
        hs_domain = zone_name;
        if (*zone_name == '.')
                zone_name++;
        hs_domain = zone_name;