[2587] in Athena Bugs
bugs in global message system
daemon@ATHENA.MIT.EDU (John T Kohl)
Tue Jul 18 14:09:42 1989
Date: Tue, 18 Jul 89 14:09:17 EDT
From: John T Kohl <jtkohl@ATHENA.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
Following are patches needed to compile GMS on the PMAX. The first is
an undefined symbol; the second a null-pointer deref fix.
Apply to /paris/source/4.3/bin.athena/gms/
*** /tmp/,RCSt1a01000 Tue Jul 18 14:08:00 1989
--- gethost_errors.c Tue Jul 18 13:37:17 1989
***************
*** 19,24 ****
--- 19,26 ----
Code_t gethost_error()
{
+ extern int h_errno;
+
init_ghs_err_tbl();
switch(h_errno) {
*** /tmp/,RCSt1a01000 Tue Jul 18 14:08:01 1989
--- get_servername.c Tue Jul 18 13:57:44 1989
***************
*** 14,24 ****
#include "globalmessage.h"
#include <hesiod.h>
Code_t get_servername(ret_name)
char ***ret_name; /* pointer to array of string... */
{
! char **retval, **data; /* for copying out the hesiod data */
int datacnt, i; /* number of hesiod records returned */
/* Guard against NULL arguments */
--- 14,25 ----
#include "globalmessage.h"
#include <hesiod.h>
+ #include "hesiod_err.h"
Code_t get_servername(ret_name)
char ***ret_name; /* pointer to array of string... */
{
! char **retval, **_data; /* for copying out the hesiod data */
int datacnt, i; /* number of hesiod records returned */
/* Guard against NULL arguments */
***************
*** 27,51 ****
}
/* Fetch the list of servers from Hesiod. */
! data = hes_resolve(GMS_NAME_CLASS, GMS_NAME_TYPE);
! if(!data) {
/* deal with hesiod error */
return(hesiod_error());
}
/* Copy the Hesiod data into stable space. */
! for(datacnt=0; data[datacnt++]; ); /* count the data */
retval = (char **)malloc(datacnt * sizeof(char *));
for(i=0; i<datacnt; i++) {
! retval[i] = malloc(strlen(data[i])+1);
if(!retval[i]) {
/* malloc failed... */
for(;--i;free(retval[i]));
return(GMS_MALLOC_ERR);
}
! strcpy(retval[i], data[i]);
}
/* Clean up and return normally. */
--- 28,56 ----
}
/* Fetch the list of servers from Hesiod. */
! _data = hes_resolve(GMS_NAME_CLASS, GMS_NAME_TYPE);
! if(!_data) {
/* deal with hesiod error */
return(hesiod_error());
}
/* Copy the Hesiod data into stable space. */
! for(datacnt=0; _data[datacnt]; datacnt++); /* count the data */
+ if (!datacnt) {
+ /* an answer, but no contents! */
+ return(HESIOD_ER_INVALID); /* XXX */
+ }
retval = (char **)malloc(datacnt * sizeof(char *));
for(i=0; i<datacnt; i++) {
! retval[i] = malloc(strlen(_data[i])+1);
if(!retval[i]) {
/* malloc failed... */
for(;--i;free(retval[i]));
return(GMS_MALLOC_ERR);
}
! strcpy(retval[i], _data[i]);
}
/* Clean up and return normally. */