[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::axp-developer

Title:Alpha Developer Support
Notice:alpha-developer@digital.com, 800-332-4786
Moderator:HYDRA::SYSTEM
Created:Mon Jun 06 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3722
Total number of notes:11359

3218.0. "template" by HYDRA::AXPDEVELOPER (Alpha Developer support) Wed Feb 19 1997 06:01

    Company Name :  template
    Contact Name :  Forrest Chang
    Phone        :  
    Fax          :  
    Email        :  forrest.chang@template.com
    Date/Time in :  19-FEB-1997 03:01:29
    Entered by   :  Richard Readings
    SPE center   :  REO

    Category     :  unix
    OS Version   :  
    System H/W   :  


    Brief Description of Problem:
    -----------------------------

From:	SMTP%"forrest.chang@template.com" 18-FEB-1997 19:54:18.66
To:	alpha-developer@digital.com
CC:	
Subj:	gethostent behavior

Return-Path: forrest.chang@template.com
Received: by asimov.mro.dec.com (UCX V4.1-12, OpenVMS V6.2 VAX);
	Tue, 18 Feb 1997 19:54:16 -0500
Received: from pobox1.pa.dec.com by fluid.mro.dec.com; (5.65v3.2/1.1.8.2/19Nov96-0448PM)
	id AA30410; Tue, 18 Feb 1997 19:54:29 -0500
Received: by pobox1.pa.dec.com; id AA14522; Tue, 18 Feb 97 16:54:32 -0800
Received: from smtp.template.com by mail1.digital.com (5.65 EXP 4/12/95 for V3.2/1.0/WV)
	id AA19977; Tue, 18 Feb 1997 16:33:30 -0800
Message-Id: <9702190033.AA19977@mail1.digital.com>
Date: Tue, 18 Feb 1997 19:34:27 -0500
From: Forrest Chang <forrest.chang@template.com>
To: alpha-developer@digital.com
Subject: gethostent behavior


Dir Sir or Madam:

	My company is part of the assoc. of software and applications
partners program, the agreement documents point out this is a place to
get migration information.  The question in particular are on a dec
alpha running digital unix v4.0A.

	My questions entails the use of sethostent/gethostent.  On
other platforms we get all list of all hostnames on the network with a
loop similar to the code example included below.  On the other
platforms we work on, the sequence of calls successfully queries the
YP database, but on the alpha, it seems that we are only reading the
local /etc/hosts file, which returns just the localhostname localhost.
The man page for sethostent implies that /etc/svc.conf may be the
source of our problem, but it seems that our svc.conf seems to conform
with proper guidelines (also included).  Below is a quote from the manpage


  The sethostent() (set host entry) function opens either the local
  /etc/hosts file or one of the files distributed by BIND or NIS, and resets
  the file marker to the beginning of the file.  To determine which file or
  files to search, and in which order, the system uses the switches in the
  /etc/svc.conf file.


	I'm looking for the proper sequence to do the
gethostent/sethostent calls to get all the hosts in the YP database.

	Thank you


					Forrest Chang



/**********************************************************************/

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>.
 
main()
{
   struct hostent * ptr;
   printf( "sethostent = %d\n", sethostent( 1));
   while(( ptr = gethostent()) != 0) {
      printf( "gethostent = %d: ", ptr);
      printf(" name = %s\n", ptr->h_name);
   }
   endhostent();
}
/**********************************************************************/

	

#
# *****************************************************************
# *                                                               *
# *    Copyright (c) Digital Equipment Corporation, 1991, 1996    *
# *                                                               *
# *   All Rights Reserved.  Unpublished rights  reserved  under   *
# *   the copyright laws of the United States.                    *
# *                                                               *
# *   The software contained on this media  is  proprietary  to   *
# *   and  embodies  the  confidential  technology  of  Digital   *
# *   Equipment Corporation.  Possession, use,  duplication  or   *
# *   dissemination of the software and media is authorized only  *
# *   pursuant to a valid written license from Digital Equipment  *
# *   Corporation.                                                *
# *                                                               *
# *   RESTRICTED RIGHTS LEGEND   Use, duplication, or disclosure  *
# *   by the U.S. Government is subject to restrictions  as  set  *
# *   forth in Subparagraph (c)(1)(ii)  of  DFARS  252.227-7013,  *
# *   or  in  FAR 52.227-19, as applicable.                       *
# *                                                               *
# *****************************************************************
#
# WARNING: This file is MANDATORY !
#
# Setup recommendation: As you add distributed services to database
#       entries, it is recommended that "local" is the first service.
#       For example:
#                       passwd=local,yp
#
# Note: White space allowed only after commas or newlines.
#
# File Format
# -----------
# database=service,service
#
# The database can be:
#       aliases 
#       group 
#       hosts 
#       netgroup 
#       networks 
#       passwd 
#       protocols
#       rpc 
#       services 
# The service can be:
#       local 
#       yp 
#       bind (hosts ONLY)
#
aliases=local,yp
group=local,yp
hosts=local,yp
netgroup=local,yp
networks=local,yp
passwd=local,yp
protocols=local,yp
rpc=local,yp
services=local,yp

SECLEVEL=BSD   # for backwards compatibility ONLY

T.RTitleUserPersonal
Name
DateLines
3218.1Patch ID: OSF405-400106RDGENG::READINGS_RRichard ReadingsWed Feb 19 1997 10:0512
>         My questions entails the use of sethostent/gethostent.  On
> other platforms we get all list of all hostnames on the network with a
> loop similar to the code example included below.  On the other
> platforms we work on, the sequence of calls successfully queries the
> YP database, but on the alpha, it seems that we are only reading the
> local /etc/hosts file, which returns just the localhostname localhost.

This is a known problem, for which a patch is available (Patch ID:
OSF405-400106). You can obtain this from your local Customer Support
Centre, failing that I could e-mail it but it is > 4MB.

Richard