[377] in Hesiod
Hesiod/Resolver diffs for NT/95 (fwd)
daemon@ATHENA.MIT.EDU (Randall S. Winchester)
Tue Feb 17 15:38:23 1998
Date: Tue, 17 Feb 1998 15:36:32 -0500 (EST)
From: "Randall S. Winchester" <rsw@Glue.umd.edu>
To: hesiod@MIT.EDU
Cc: Kevin Hildebrand <hildekca@Glue.umd.edu>
Kevin posted this for another list. Thought some of you would be interested.
The patches are against hesiod-3.0.2.
Randall
---------- Forwarded message ----------
Date: Tue, 17 Feb 1998 13:26:15 -0500 (EST)
From: Kevin Hildebrand <hildekca@Glue.umd.edu>
To: jason_young@ncsu.edu
Cc: rsw@Glue.umd.edu, hildekca@Glue.umd.edu
Subject: Hesiod/Resolver diffs for NT/95
Hi, Randall forwarded me your message, here's what I've got.
First, a patch to the resolver - I fixed the calls you mentioned about
close -> closesocket as well as the one that was really killing us.
It looks like the file descriptor numbers returned from opening a
socket are not necessarily sequential. Even though you get a valid
socket opened, in res_send there's a check to see if the socket number
is greater than FD_SETSIZE and if it is, it's assumed to be bogus. I
don't believe this condition holds true under NT, so I've #ifdef'ed
out that consistency check and get stable behavior.
The hesiod patches are to hesiod-3.0.2. I include my makefiles for
Microsoft Dev Studio, note that they are looking for include
files/libraries in \usr\local\bind so you might need to adjust them.
This stuff works for Windows 95 as well, just make sure that WINNT is
defined when including the BIND include files. (I define it in the
.mak file at the bottom just in case.)
Oh, one more thing - the makefile for the hesiod library builds it as
hesstat.lib instead of hesiod.lib (I originally had two projects, for
static and dynamic, decided not to bother with dynamic and then
couldn't figure out how to rename a project in MSVC). I think the
makefile for hesinfo looks for hesiod.lib though.
Enjoy!
Kevin Hildebrand
University of Maryland, College Park
===============================================================================
diffs for res/res_send.c in ntbind496rel
===============================================================================
*** ./res_send.c Tue Jun 24 14:31:56 1997
--- /homes/hildekca/wam/Win32/bind/res/res_send.c Thu Jan 29 13:34:30 1998
***************
*** 642,649 ****
if (s1 == INVALID_SOCKET)
#endif
goto bad_dg_sock;
! (void) dup2(s1, s);
! (void) close(s1);
Dprint(_res.options & RES_DEBUG,
(stdout, ";; new DG socket\n"))
#endif
--- 642,653 ----
if (s1 == INVALID_SOCKET)
#endif
goto bad_dg_sock;
! (void) dup2(s1, s);
! #ifndef WINNT
! (void) close(s1);
! #else
! (void) closesocket(s1);
! #endif
Dprint(_res.options & RES_DEBUG,
(stdout, ";; new DG socket\n"))
#endif
***************
*** 675,686 ****
timeout.tv_sec /= _res.nscount;
if ((long) timeout.tv_sec <= 0)
timeout.tv_sec = 1;
! timeout.tv_usec = 0;
if (s+1 > FD_SETSIZE) {
Perror(stderr, "s+1 > FD_SETSIZE", EMFILE);
res_close();
goto next_ns;
! }
wait:
FD_ZERO(&dsmask);
FD_SET(s, &dsmask);
--- 679,692 ----
timeout.tv_sec /= _res.nscount;
if ((long) timeout.tv_sec <= 0)
timeout.tv_sec = 1;
! timeout.tv_usec = 0;
! #ifndef WINNT
if (s+1 > FD_SETSIZE) {
Perror(stderr, "s+1 > FD_SETSIZE", EMFILE);
res_close();
goto next_ns;
! }
! #endif
wait:
FD_ZERO(&dsmask);
FD_SET(s, &dsmask);
***************
*** 880,891 ****
*/
void
res_close()
! {
if (s >= 0) {
! (void) close(s);
! #ifndef WINNT
! s = -1;
! #else
s = INVALID_SOCKET;
#endif
connected = 0;
--- 886,899 ----
*/
void
res_close()
! {
! #ifndef WINNT
if (s >= 0) {
! (void) close(s);
! s = -1;
! #else
! if (s != INVALID_SOCKET) {
! (void) closesocket(s);
s = INVALID_SOCKET;
#endif
connected = 0;
===============================================================================
hesiod-3.0.2 diffs
===============================================================================
*** 1.1 1998/02/17 17:45:17
--- hesiod.c 1998/02/17 17:45:20
***************
*** 41,50 ****
* it uses res_send() and accesses _res.
*/
! static const char rcsid[] = "$Id: hesiod.c,v 1.1 1998/02/17 17:45:17 hildekca Exp hildekca $";
#include <sys/types.h>
! #include <netinet/in.h>
#include <arpa/nameser.h>
#include <errno.h>
#include <netdb.h>
--- 41,52 ----
* it uses res_send() and accesses _res.
*/
! static const char rcsid[] = "$Id: hesiod.c,v 1.18.2.1 1997/01/03 20:48:20 ghudson Exp $";
#include <sys/types.h>
! #ifndef _WIN32
! #include <netinet/in.h>
! #endif
#include <arpa/nameser.h>
#include <errno.h>
#include <netdb.h>
***************
*** 52,58 ****
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
! #include <ctype.h>
#include "hesiod.h"
#include "hesiod_p.h"
--- 54,63 ----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
! #include <ctype.h>
! #ifdef _WIN32
! #include <windows.h>
! #endif
#include "hesiod.h"
#include "hesiod_p.h"
***************
*** 63,69 ****
#ifndef T_TXT
#define T_TXT 16
#endif
!
static int read_config_file(struct hesiod_p *ctx, const char *filename);
static char **get_txt_records(struct hesiod_p *ctx, int class,
const char *name);
--- 68,74 ----
#ifndef T_TXT
#define T_TXT 16
#endif
!
static int read_config_file(struct hesiod_p *ctx, const char *filename);
static char **get_txt_records(struct hesiod_p *ctx, int class,
const char *name);
***************
*** 74,88 ****
{
struct hesiod_p *ctx;
const char *p, *configname;
!
ctx = malloc(sizeof(struct hesiod_p));
if (ctx)
{
*context = ctx;
configname = getenv("HESIOD_CONFIG");
! if (!configname)
! configname = SYSCONFDIR "/hesiod.conf";
! if (read_config_file(ctx, configname) >= 0)
{
/* The default rhs can be overridden by an environment variable. */
p = getenv("HES_DOMAIN");
--- 79,100 ----
{
struct hesiod_p *ctx;
const char *p, *configname;
!
ctx = malloc(sizeof(struct hesiod_p));
if (ctx)
{
*context = ctx;
configname = getenv("HESIOD_CONFIG");
! if (!configname)
! #ifndef _WIN32
! configname = SYSCONFDIR "/hesiod.conf";
! #else
! configname = (char *) malloc (sizeof (char) * (256));
! if (GetSystemDirectory ((LPTSTR) configname, 255) <= 240) {
! lstrcat (configname, "\\HESIOD.CONF");
! }
! #endif
! if (read_config_file(ctx, configname) >= 0)
{
/* The default rhs can be overridden by an environment variable. */
p = getenv("HES_DOMAIN");
***************
*** 97,111 ****
strcpy(ctx->rhs + 1, (*p == '.') ? p + 1 : p);
return 0;
}
! else
! errno = ENOMEM;
}
else
return 0;
}
}
! else
! errno = ENOMEM;
if (ctx->lhs)
free(ctx->lhs);
--- 109,131 ----
strcpy(ctx->rhs + 1, (*p == '.') ? p + 1 : p);
return 0;
}
! else
! #ifndef _WIN32
! errno = ENOMEM;
! #else
! SetLastError(ENOMEM);
! #endif
}
else
return 0;
}
}
! else
! #ifndef _WIN32
! errno = ENOMEM;
! #else
! SetLastError(ENOMEM);
! #endif
if (ctx->lhs)
free(ctx->lhs);
***************
*** 124,130 ****
free(ctx->rhs);
if (ctx->lhs)
free(ctx->lhs);
! free(ctx);
}
/* This function takes a hesiod (name, type) and returns a DNS
--- 144,158 ----
free(ctx->rhs);
if (ctx->lhs)
free(ctx->lhs);
! free(ctx);
!
! #ifdef _WIN32
! /* Yuck. res_init calls WSAStartup, but since there's no res_end, we have
! to do the cleanup here to keep the counts even, since there's a good
! chance our caller has done a WSAStartup as well. */
!
! WSACleanup();
! #endif
}
/* This function takes a hesiod (name, type) and returns a DNS
***************
*** 152,159 ****
if (rhs_list)
rhs = *rhs_list;
else
! {
! errno = ENOENT;
return NULL;
}
}
--- 180,191 ----
if (rhs_list)
rhs = *rhs_list;
else
! {
! #ifndef _WIN32
! errno = ENOENT;
! #else
! SetLastError(ENOENT);
! #endif
return NULL;
}
}
***************
*** 169,175 ****
{
if (rhs_list)
hesiod_free_list(context, rhs_list);
! errno = EMSGSIZE;
return NULL;
}
--- 201,211 ----
{
if (rhs_list)
hesiod_free_list(context, rhs_list);
! #ifndef _WIN32
! errno = EMSGSIZE;
! #else
! SetLastError(WSAEMSGSIZE);
! #endif
return NULL;
}
***************
*** 193,200 ****
/* Make a copy of the result and return it to the caller. */
ret = malloc(strlen(bindname) + 1);
if (!ret)
! {
! errno = ENOMEM;
return NULL;
}
strcpy(ret, bindname);
--- 229,240 ----
/* Make a copy of the result and return it to the caller. */
ret = malloc(strlen(bindname) + 1);
if (!ret)
! {
! #ifndef _WIN32
! errno = ENOMEM;
! #else
! SetLastError(ENOMEM);
! #endif
return NULL;
}
strcpy(ret, bindname);
***************
*** 214,220 ****
return NULL;
retvec = get_txt_records(ctx, ctx->classes[0], bindname);
! if (retvec == NULL && errno == ENOENT && ctx->classes[1])
retvec = get_txt_records(ctx, ctx->classes[1], bindname);
free(bindname);
--- 254,266 ----
return NULL;
retvec = get_txt_records(ctx, ctx->classes[0], bindname);
! if (retvec == NULL &&
! #ifndef _WIN32
! errno == ENOENT
! #else
! GetLastError() == ENOENT
! #endif
! && ctx->classes[1])
retvec = get_txt_records(ctx, ctx->classes[1], bindname);
free(bindname);
***************
*** 258,265 ****
return 0;
}
else
! {
! errno = ENOMEM;
return -1;
}
}
--- 304,315 ----
return 0;
}
else
! {
! #ifndef _WIN32
! errno = ENOMEM;
! #else
! SetLastError(ENOMEM);
! #endif
return -1;
}
}
***************
*** 290,297 ****
which = (strcmp(key, "lhs") == 0) ? &ctx->lhs : &ctx->rhs;
*which = malloc(strlen(data) + 1);
if (!*which)
! {
! errno = ENOMEM;
return -1;
}
strcpy(*which, data);
--- 340,351 ----
which = (strcmp(key, "lhs") == 0) ? &ctx->lhs : &ctx->rhs;
*which = malloc(strlen(data) + 1);
if (!*which)
! {
! #ifndef _WIN32
! errno = ENOMEM;
! #else
! SetLastError(ENOMEM);
! #endif
return -1;
}
strcpy(*which, data);
***************
*** 319,326 ****
fclose(fp);
if (!ctx->rhs || ctx->classes[0] == 0 || ctx->classes[0] == ctx->classes[1])
! {
! errno = ENOEXEC;
return -1;
}
--- 373,384 ----
fclose(fp);
if (!ctx->rhs || ctx->classes[0] == 0 || ctx->classes[0] == ctx->classes[1])
! {
! #ifndef _WIN32
! errno = ENOEXEC;
! #else
! SetLastError(ENOEXEC);
! #endif
return -1;
}
***************
*** 351,358 ****
/* Send the query. */
n = res_send(qbuf, n, abuf, MAX_HESRESP);
if (n < 0)
! {
! errno = ECONNREFUSED;
return NULL;
}
--- 409,420 ----
/* Send the query. */
n = res_send(qbuf, n, abuf, MAX_HESRESP);
if (n < 0)
! {
! #ifndef _WIN32
! errno = ECONNREFUSED;
! #else
! SetLastError(ECONNREFUSED);
! #endif
return NULL;
}
***************
*** 369,375 ****
skip = dn_skipname(p, eom);
if (skip < 0 || p + skip + QFIXEDSZ > eom)
{
! errno = EMSGSIZE;
return NULL;
}
p += skip + QFIXEDSZ;
--- 431,441 ----
skip = dn_skipname(p, eom);
if (skip < 0 || p + skip + QFIXEDSZ > eom)
{
! #ifndef _WIN32
! errno = EMSGSIZE;
! #else
! SetLastError(WSAEMSGSIZE);
! #endif
return NULL;
}
p += skip + QFIXEDSZ;
***************
*** 378,385 ****
/* Allocate space for the text record answers. */
list = malloc((ancount + 1) * sizeof(char *));
if (!list)
! {
! errno = ENOMEM;
return NULL;
}
--- 444,455 ----
/* Allocate space for the text record answers. */
list = malloc((ancount + 1) * sizeof(char *));
if (!list)
! {
! #ifndef _WIN32
! errno = ENOMEM;
! #else
! SetLastError(ENOMEM);
! #endif
return NULL;
}
***************
*** 397,403 ****
p += skip + 10;
if (p + len > eom)
{
! errno = EMSGSIZE;
break;
}
--- 467,477 ----
p += skip + 10;
if (p + len > eom)
{
! #ifndef _WIN32
! errno = EMSGSIZE;
! #else
! SetLastError(WSAEMSGSIZE);
! #endif
break;
}
***************
*** 411,418 ****
/* Allocate space for this answer. */
list[j] = malloc(len);
if (!list[j])
! {
! errno = ENOMEM;
break;
}
dst = list[j++];
--- 485,496 ----
/* Allocate space for this answer. */
list[j] = malloc(len);
if (!list[j])
! {
! #ifndef _WIN32
! errno = ENOMEM;
! #else
! SetLastError(ENOMEM);
! #endif
break;
}
dst = list[j++];
***************
*** 423,430 ****
{
n = (unsigned char) *p++;
if (p + n > eor)
! {
! errno = EMSGSIZE;
break;
}
memcpy(dst, p, n);
--- 501,512 ----
{
n = (unsigned char) *p++;
if (p + n > eor)
! {
! #ifndef _WIN32
! errno = EMSGSIZE;
! #else
! SetLastError(WSAEMSGSIZE);
! #endif
break;
}
memcpy(dst, p, n);
***************
*** 432,439 ****
dst += n;
}
if (p < eor)
! {
! errno = EMSGSIZE;
break;
}
*dst = 0;
--- 514,525 ----
dst += n;
}
if (p < eor)
! {
! #ifndef _WIN32
! errno = EMSGSIZE;
! #else
! SetLastError(WSAEMSGSIZE);
! #endif
break;
}
*dst = 0;
***************
*** 449,456 ****
}
if (j == 0)
! {
! errno = ENOENT;
free(list);
return NULL;
}
--- 535,546 ----
}
if (j == 0)
! {
! #ifndef _WIN32
! errno = ENOENT;
! #else
! SetLastError(ENOENT);
! #endif
free(list);
return NULL;
}
*** 1.1 1998/02/17 17:43:23
--- hescompat.c 1998/02/17 17:44:19
***************
*** 17,23 ****
* backward-compatibility interfaces.
*/
! static char rcsid[] = "$Id: hescompat.c,v 1.1 1998/02/17 17:43:23 hildekca Exp hildekca $";
#include <stdio.h>
#include <stdlib.h>
--- 17,23 ----
* backward-compatibility interfaces.
*/
! static char rcsid[] = "$Id: hescompat.c,v 1.1.2.1 1996/12/16 08:37:45 ghudson Exp $";
#include <stdio.h>
#include <stdlib.h>
***************
*** 152,161 ****
case ENOENT:
errval = HES_ER_NOTFOUND;
break;
! case ECONNREFUSED:
case EMSGSIZE:
errval = HES_ER_NET;
break;
case ENOMEM:
default:
/* Not a good match, but the best we can do. */
--- 152,163 ----
case ENOENT:
errval = HES_ER_NOTFOUND;
break;
! #ifndef _WIN32
! case ECONNREFUSED:
case EMSGSIZE:
errval = HES_ER_NET;
break;
+ #endif
case ENOMEM:
default:
/* Not a good match, but the best we can do. */
*** 1.1 1998/02/17 17:46:31
--- hesiod.h 1998/02/17 17:46:41
***************
*** 1,4 ****
! /* $Id: hesiod.h,v 1.1 1998/02/17 17:46:31 hildekca Exp hildekca $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
--- 1,4 ----
! /* $Id: hesiod.h,v 1.2.2.1 1996/12/16 08:38:07 ghudson Exp $ */
/*
* Copyright (c) 1996 by Internet Software Consortium.
***************
*** 21,28 ****
--- 21,44 ----
#define HESIOD__INCLUDED
#include <sys/types.h>
+ #ifndef _WIN32
#include <pwd.h>
#include <netdb.h>
+ #else
+ typedef short uid_t, gid_t;
+ #define SYSCONFDIR "C:\\WINNT"
+ struct passwd {
+ char *pw_name;
+ char *pw_passwd;
+ uid_t pw_uid;
+ gid_t pw_gid;
+ int pw_quota;
+ char *pw_comment;
+ char *pw_gecos;
+ char *pw_dir;
+ char *pw_shell;
+ };
+ #endif
/* Application-visible define to signal that we have the new interfaces. */
#define HESIOD_INTERFACES
*** 1.1 1998/02/17 17:47:01
--- hesmailhost.c 1998/01/29 18:25:04
***************
*** 17,23 ****
* information for a user.
*/
! static char rcsid[] = "$Id: hesmailhost.c,v 1.1 1998/02/17 17:47:01 hildekca Exp $";
#include <stdio.h>
#include <stdlib.h>
--- 17,23 ----
* information for a user.
*/
! static char rcsid[] = "$Id: hesmailhost.c,v 1.8 1996/12/08 21:40:32 ghudson Exp $";
#include <stdio.h>
#include <stdlib.h>
***************
*** 25,31 ****
#include <string.h>
#include <errno.h>
#include <netdb.h>
! #include <pwd.h>
#include "hesiod.h"
struct hesiod_postoffice *hesiod_getmailhost(void *context, const char *user)
--- 25,33 ----
#include <string.h>
#include <errno.h>
#include <netdb.h>
! #ifndef _WIN32
! #include <pwd.h>
! #endif
#include "hesiod.h"
struct hesiod_postoffice *hesiod_getmailhost(void *context, const char *user)
*** 1.1 1998/02/17 17:47:35
--- hespwnam.c 1998/02/17 17:47:50
***************
*** 18,33 ****
* information about a user.
*/
! static char rcsid[] = "$Id: hespwnam.c,v 1.1 1998/02/17 17:47:35 hildekca Exp hildekca $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
! #include <pwd.h>
#include <errno.h>
#include <netdb.h>
#include "hesiod.h"
! #include "config.h"
static struct passwd *getpwcommon(void *context, const char *arg, int which);
static char *next_field(char *ptr);
--- 18,37 ----
* information about a user.
*/
! static char rcsid[] = "$Id: hespwnam.c,v 1.13 1996/12/08 21:40:37 ghudson Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
! #ifndef _WIN32
! #include <pwd.h>
! #endif
#include <errno.h>
#include <netdb.h>
#include "hesiod.h"
! #ifndef _WIN32
! #include "config.h"
! #endif
static struct passwd *getpwcommon(void *context, const char *arg, int which);
static char *next_field(char *ptr);
*** 1.1 1998/02/17 17:48:22
--- hesservbyname.c 1998/02/17 17:48:40
***************
*** 51,67 ****
* services.
*/
! static char rcsid[] = "$Id: hesservbyname.c,v 1.1 1998/02/17 17:48:22 hildekca Exp hildekca $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
! #include <pwd.h>
#include <netdb.h>
#include <sys/types.h>
! #include <netinet/in.h>
#include "hesiod.h"
static int cistrcmp(const char *s1, const char *s2);
--- 51,73 ----
* services.
*/
! static char rcsid[] = "$Id: hesservbyname.c,v 1.6 1996/12/08 21:40:44 ghudson Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
! #ifndef _WIN32
! #include <pwd.h>
! #endif
#include <netdb.h>
#include <sys/types.h>
! #ifndef _WIN32
! #include <netinet/in.h>
! #else
! #include <winsock.h>
! #endif
#include "hesiod.h"
static int cistrcmp(const char *s1, const char *s2);
***************
*** 70,76 ****
const char *proto)
{
char **item, **list;
! int i = 0, status;
/* Ask for all entries matching the given service name. */
list = hesiod_resolve(context, name, "service");
--- 76,82 ----
const char *proto)
{
char **item, **list;
! int i = 0;
/* Ask for all entries matching the given service name. */
list = hesiod_resolve(context, name, "service");
*** 1.1 1998/02/17 17:54:51
--- hesinfo.c 1998/02/17 17:55:03
***************
*** 15,34 ****
/* This file is a simple driver for the Hesiod library. */
! static char rcsid[] = "$Id: hesinfo.c,v 1.1 1998/02/17 17:54:51 hildekca Exp hildekca $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
! #include "hesiod.h"
extern int optind;
int main(int argc, char **argv)
{
char **list, **p, *bindname, *name, *type;
! int lflag = 0, errflg = 0, bflag = 0, c, status;
void *context;
while ((c = getopt(argc, argv, "lb")) != EOF)
--- 15,40 ----
/* This file is a simple driver for the Hesiod library. */
! static char rcsid[] = "$Id: hesinfo.c,v 1.8 1996/12/08 21:29:54 ghudson Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
! #include "hesiod.h"
! #ifdef _WIN32
! #include <windows.h>
! #define LOG_ERR 3
! HANDLE hReadWriteEvent = NULL;
! #endif
extern int optind;
+ extern int getopt();
int main(int argc, char **argv)
{
char **list, **p, *bindname, *name, *type;
! int lflag = 0, errflg = 0, bflag = 0, c;
void *context;
while ((c = getopt(argc, argv, "lb")) != EOF)
***************
*** 56,65 ****
name = argv[optind];
type = argv[optind + 1];
if (hesiod_init(&context) < 0)
! {
! if (errno == ENOEXEC)
fprintf(stderr, "hesiod_init: Invalid Hesiod configuration file.\n");
else
perror("hesiod_init");
--- 62,92 ----
name = argv[optind];
type = argv[optind + 1];
+
+ #ifdef _WIN32
+ hReadWriteEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
+
+ {
+ WORD wVersionRequested;
+ WSADATA wsaData;
+
+ wVersionRequested = MAKEWORD(1,1);
+ if (WSAStartup(wVersionRequested, &wsaData)) {
+ fprintf(stderr, "No useable winsock.dll");
+ return (-1);
+ }
+ }
+ #endif _WIN32
+
+
if (hesiod_init(&context) < 0)
! {
! #ifndef _WIN32
! if (errno == ENOEXEC)
! #else
! if (GetLastError() == ENOEXEC)
! #endif
fprintf(stderr, "hesiod_init: Invalid Hesiod configuration file.\n");
else
perror("hesiod_init");
***************
*** 74,84 ****
if (!bindname)
{
if (lflag)
! printf("nothing\n");
! if (errno == ENOENT)
fprintf(stderr, "hesiod_to_bind: Unknown rhs-extension.\n");
! else
! perror("hesiod_to_bind");
exit(1);
}
printf("%s\n", bindname);
--- 101,119 ----
if (!bindname)
{
if (lflag)
! printf("nothing\n");
! #ifndef _WIN32
! if (errno == ENOENT)
! #else
! if (GetLastError() == ENOENT)
! #endif
fprintf(stderr, "hesiod_to_bind: Unknown rhs-extension.\n");
! else
! #ifndef _WIN32
! perror("hesiod_to_bind");
! #else
! fprintf(stderr, "hesiod_to_bind: %s\n", strerror(GetLastError()));
! #endif
exit(1);
}
printf("%s\n", bindname);
***************
*** 93,105 ****
/* Do the hesiod resolve and check for errors. */
list = hesiod_resolve(context, name, type);
if (!list)
! {
! if (lflag)
! printf("nothing\n");
! if (errno == ENOENT)
! fprintf(stderr, "hesiod_resolve: Hesiod name not found.\n");
! else
! perror("hesiod_resolve");
return 1;
}
--- 128,153 ----
/* Do the hesiod resolve and check for errors. */
list = hesiod_resolve(context, name, type);
if (!list)
! {
! if (lflag)
! printf("nothing\n");
! #ifndef _WIN32
! if (errno == ENOENT)
! #else
! if (GetLastError() == ENOENT)
! #endif
! fprintf(stderr, "hesiod_resolve: Hesiod name not found.\n");
! else
! #ifndef _WIN32
! perror("hesiod_resolve");
! #else
! {
! if (GetLastError() < WSABASEERR)
! perror("hesiod_resolve");
! else
! fprintf(stderr, "Unknown network error\n");
! }
! #endif
return 1;
}
===============================================================================
hesinfo.mak
===============================================================================
# Microsoft Developer Studio Generated NMAKE File, Based on hesinfo.dsp
!IF "$(CFG)" == ""
CFG=hesinfo - Win32 Debug
!MESSAGE No configuration specified. Defaulting to hesinfo - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "hesinfo - Win32 Release" && "$(CFG)" !=\
"hesinfo - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "hesinfo.mak" CFG="hesinfo - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "hesinfo - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "hesinfo - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "hesinfo - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\hesinfo.exe"
!ELSE
ALL : "$(OUTDIR)\hesinfo.exe"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\hesinfo.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(OUTDIR)\hesinfo.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "\usr\local\bind\include" /D "WIN32" /D\
"NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\hesinfo.pch" /YX\
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\hesinfo.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib\
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\
uuid.lib \usr\local\athena\lib\hesiod.lib \usr\local\bind\lib\resolv.lib\
\usr\local\bind\lib\lib44bsd.lib wsock32.lib /nologo /subsystem:console\
/incremental:no /pdb:"$(OUTDIR)\hesinfo.pdb" /machine:I386\
/nodefaultlib:"libcmt.lib" /out:"$(OUTDIR)\hesinfo.exe"
LINK32_OBJS= \
"$(INTDIR)\hesinfo.obj"
"$(OUTDIR)\hesinfo.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "hesinfo - Win32 Debug"
OUTDIR=.\hesinfo_
INTDIR=.\hesinfo_
# Begin Custom Macros
OutDir=.\hesinfo_
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\hesinfo.exe"
!ELSE
ALL : "$(OUTDIR)\hesinfo.exe"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\hesinfo.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(INTDIR)\vc50.pdb"
-@erase "$(OUTDIR)\hesinfo.exe"
-@erase "$(OUTDIR)\hesinfo.ilk"
-@erase "$(OUTDIR)\hesinfo.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "\usr\local\bind\include" /D\
"WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\hesinfo.pch" /YX\
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\hesinfo_/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\hesinfo.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\
\usr\local\athena\lib\hesiod.lib \usr\local\bind\lib\resolv.lib\
\usr\local\bind\lib\lib44bsd.lib wsock32.lib /nologo /subsystem:console\
/incremental:yes /pdb:"$(OUTDIR)\hesinfo.pdb" /debug /machine:I386\
/nodefaultlib:"libcmt.lib" /out:"$(OUTDIR)\hesinfo.exe" /pdbtype:sept
LINK32_OBJS= \
"$(INTDIR)\hesinfo.obj"
"$(OUTDIR)\hesinfo.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(CFG)" == "hesinfo - Win32 Release" || "$(CFG)" ==\
"hesinfo - Win32 Debug"
SOURCE=.\hesinfo.c
DEP_CPP_HESIN=\
".\hesiod.h"\
"$(INTDIR)\hesinfo.obj" : $(SOURCE) $(DEP_CPP_HESIN) "$(INTDIR)"
!ENDIF
===============================================================================
hesstat.mak
===============================================================================
# Microsoft Developer Studio Generated NMAKE File, Based on hesstat.dsp
!IF "$(CFG)" == ""
CFG=hesstat - Win32 Debug
!MESSAGE No configuration specified. Defaulting to hesstat - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "hesstat - Win32 Release" && "$(CFG)" !=\
"hesstat - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "hesstat.mak" CFG="hesstat - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "hesstat - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "hesstat - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "hesstat - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\hesstat.lib"
!ELSE
ALL : "$(OUTDIR)\hesstat.lib"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\hescompat.obj"
-@erase "$(INTDIR)\hesiod.obj"
-@erase "$(INTDIR)\hesmailhost.obj"
-@erase "$(INTDIR)\hespwnam.obj"
-@erase "$(INTDIR)\hesservbyname.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(OUTDIR)\hesstat.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "\usr\local\bind\include" /D "NDEBUG" /D\
"WIN32" /D "_WINDOWS" /D "WINNT" /Fp"$(INTDIR)\hesstat.pch" /YX\
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\hesstat.bsc"
BSC32_SBRS= \
LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\hesstat.lib"
LIB32_OBJS= \
"$(INTDIR)\hescompat.obj" \
"$(INTDIR)\hesiod.obj" \
"$(INTDIR)\hesmailhost.obj" \
"$(INTDIR)\hespwnam.obj" \
"$(INTDIR)\hesservbyname.obj"
"$(OUTDIR)\hesstat.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ELSEIF "$(CFG)" == "hesstat - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\hesstat.lib"
!ELSE
ALL : "$(OUTDIR)\hesstat.lib"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\hescompat.obj"
-@erase "$(INTDIR)\hesiod.obj"
-@erase "$(INTDIR)\hesmailhost.obj"
-@erase "$(INTDIR)\hespwnam.obj"
-@erase "$(INTDIR)\hesservbyname.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(OUTDIR)\hesstat.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MLd /W3 /GX /Z7 /Od /I "\usr\local\bind\include" /D "_DEBUG"\
/D "WIN32" /D "_WINDOWS" /D "WINNT" /Fp"$(INTDIR)\hesstat.pch" /YX\
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Debug/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\hesstat.bsc"
BSC32_SBRS= \
LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\hesstat.lib"
LIB32_OBJS= \
"$(INTDIR)\hescompat.obj" \
"$(INTDIR)\hesiod.obj" \
"$(INTDIR)\hesmailhost.obj" \
"$(INTDIR)\hespwnam.obj" \
"$(INTDIR)\hesservbyname.obj"
"$(OUTDIR)\hesstat.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<<
!ENDIF
!IF "$(CFG)" == "hesstat - Win32 Release" || "$(CFG)" ==\
"hesstat - Win32 Debug"
SOURCE=.\hescompat.c
!IF "$(CFG)" == "hesstat - Win32 Release"
DEP_CPP_HESCO=\
"..\..\..\usr\local\bind\include\netdb.h"\
"..\..\..\usr\local\bind\include\sys\bitypes.h"\
"..\..\..\usr\local\bind\include\sys\cdefs.h"\
".\hesiod.h"\
{$(INCLUDE)}"sys\types.h"\
"$(INTDIR)\hescompat.obj" : $(SOURCE) $(DEP_CPP_HESCO) "$(INTDIR)"
!ELSEIF "$(CFG)" == "hesstat - Win32 Debug"
DEP_CPP_HESCO=\
".\hesiod.h"\
"$(INTDIR)\hescompat.obj" : $(SOURCE) $(DEP_CPP_HESCO) "$(INTDIR)"
!ENDIF
SOURCE=.\hesiod.c
!IF "$(CFG)" == "hesstat - Win32 Release"
DEP_CPP_HESIO=\
"..\..\..\usr\local\bind\include\arpa\nameser.h"\
"..\..\..\usr\local\bind\include\netdb.h"\
"..\..\..\usr\local\bind\include\portability.h"\
"..\..\..\usr\local\bind\include\resolv.h"\
"..\..\..\usr\local\bind\include\sys\bitypes.h"\
"..\..\..\usr\local\bind\include\sys\cdefs.h"\
".\hesiod.h"\
".\hesiod_p.h"\
{$(INCLUDE)}"sys\timeb.h"\
{$(INCLUDE)}"sys\types.h"\
"$(INTDIR)\hesiod.obj" : $(SOURCE) $(DEP_CPP_HESIO) "$(INTDIR)"
!ELSEIF "$(CFG)" == "hesstat - Win32 Debug"
DEP_CPP_HESIO=\
"..\..\..\usr\local\bind\include\arpa\nameser.h"\
"..\..\..\usr\local\bind\include\netdb.h"\
"..\..\..\usr\local\bind\include\portability.h"\
"..\..\..\usr\local\bind\include\resolv.h"\
"..\..\..\usr\local\bind\include\sys\bitypes.h"\
"..\..\..\usr\local\bind\include\sys\cdefs.h"\
".\hesiod.h"\
".\hesiod_p.h"\
"$(INTDIR)\hesiod.obj" : $(SOURCE) $(DEP_CPP_HESIO) "$(INTDIR)"
!ENDIF
SOURCE=.\hesmailhost.c
!IF "$(CFG)" == "hesstat - Win32 Release"
DEP_CPP_HESMA=\
"..\..\..\usr\local\bind\include\netdb.h"\
"..\..\..\usr\local\bind\include\sys\bitypes.h"\
"..\..\..\usr\local\bind\include\sys\cdefs.h"\
".\hesiod.h"\
{$(INCLUDE)}"sys\types.h"\
"$(INTDIR)\hesmailhost.obj" : $(SOURCE) $(DEP_CPP_HESMA) "$(INTDIR)"
!ELSEIF "$(CFG)" == "hesstat - Win32 Debug"
DEP_CPP_HESMA=\
"..\..\..\usr\local\bind\include\netdb.h"\
"..\..\..\usr\local\bind\include\sys\bitypes.h"\
"..\..\..\usr\local\bind\include\sys\cdefs.h"\
".\hesiod.h"\
"$(INTDIR)\hesmailhost.obj" : $(SOURCE) $(DEP_CPP_HESMA) "$(INTDIR)"
!ENDIF
SOURCE=.\hespwnam.c
!IF "$(CFG)" == "hesstat - Win32 Release"
DEP_CPP_HESPW=\
"..\..\..\usr\local\bind\include\netdb.h"\
"..\..\..\usr\local\bind\include\sys\bitypes.h"\
"..\..\..\usr\local\bind\include\sys\cdefs.h"\
".\hesiod.h"\
{$(INCLUDE)}"sys\types.h"\
NODEP_CPP_HESPW=\
".\config.h"\
"$(INTDIR)\hespwnam.obj" : $(SOURCE) $(DEP_CPP_HESPW) "$(INTDIR)"
!ELSEIF "$(CFG)" == "hesstat - Win32 Debug"
DEP_CPP_HESPW=\
"..\..\..\usr\local\bind\include\netdb.h"\
"..\..\..\usr\local\bind\include\sys\bitypes.h"\
"..\..\..\usr\local\bind\include\sys\cdefs.h"\
".\hesiod.h"\
"$(INTDIR)\hespwnam.obj" : $(SOURCE) $(DEP_CPP_HESPW) "$(INTDIR)"
!ENDIF
SOURCE=.\hesservbyname.c
!IF "$(CFG)" == "hesstat - Win32 Release"
DEP_CPP_HESSE=\
"..\..\..\usr\local\bind\include\netdb.h"\
"..\..\..\usr\local\bind\include\sys\bitypes.h"\
"..\..\..\usr\local\bind\include\sys\cdefs.h"\
".\hesiod.h"\
{$(INCLUDE)}"sys\types.h"\
"$(INTDIR)\hesservbyname.obj" : $(SOURCE) $(DEP_CPP_HESSE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "hesstat - Win32 Debug"
DEP_CPP_HESSE=\
"..\..\..\usr\local\bind\include\netdb.h"\
"..\..\..\usr\local\bind\include\sys\bitypes.h"\
"..\..\..\usr\local\bind\include\sys\cdefs.h"\
".\hesiod.h"\
"$(INTDIR)\hesservbyname.obj" : $(SOURCE) $(DEP_CPP_HESSE) "$(INTDIR)"
!ENDIF
!ENDIF