Subject: pkg/11574: suggested patches for web500gw-2.1b3 package
To: None <gnats-bugs@gnats.netbsd.org>
From: Jim Dutton <jimd@amiga1.jim.dutton>
List: netbsd-bugs
Date: 11/27/2000 00:56:17
>Number:         11574
>Category:       pkg
>Synopsis:       suggested patches for web500gw-2.1b3 package
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 27 00:56:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Jim Dutton
>Release:        <NetBSD-current source date>
>Organization:
none
>Environment:
	<machine, os, target, libraries (multiple lines)>
System: NetBSD amiga1.jim.dutton 1.4.2 NetBSD 1.4.2 (SQUEEZED) #3: Sun Aug 13 06:51:03 GMT 2000 jimd@amiga1.jim.dutton:/usr/src/sys/arch/amiga/compile/SQUEEZED amiga


>Description:
	The web500gw-2.1b3 package will fail to compile and/or not be
        Y2K compliant without the included patches. Some patches are
        specific to OpenLDAP V2 only.

>How-To-Repeat:
	Attempt to compile web500gw-2.1b3 package without patches.
>Fix:
	Apply (attached) patches as appropriate.

--0-2078917053-975297415=:12321
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Disposition: attachment; filename="diffs.readme"

Patch/additional files for Web500gw-2.1b3 and OpenLDAP
------------------------------------------------------------------------
(Please review all patches before applying as some directory assumptions
 may need to be adjusted)
------------------------------------------------------------------------
4831 Nov 27 01:09 Makefile.diffs	- OpenLDAP V1/V2 patch
 276 Nov 12 02:16 config.c.diffs	- OpenLDAP V1/V2 patch
5574 Oct 29 19:05 util.c.diffs		- OpenLDAP V1/V2 Y2K patch
1437 Nov 12 02:17 web500gw.h.diffs	- OpenLDAP V2 patch
 249 Oct 29 21:39 old_UMichLDAP_defs.h	- OpenLDAP V2 additional file

--0-2078917053-975297415=:12321
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Disposition: attachment; filename="Makefile.diffs"

*** Makefile.orig	Sun Oct 29 19:04:57 2000
--- Makefile	Sun Oct 29 23:52:04 2000
***************
*** 3,9 ****
  #-----------------------------------------------------------------------------
  
  # Where to install web500gw
! INSTDIR = /usr/local/etc
  
  # Where to install the manual web500gw.8
  MANDIR	= /usr/local/man/man8
--- 3,9 ----
  #-----------------------------------------------------------------------------
  
  # Where to install web500gw
! INSTDIR = /usr/local/etc/openldap
  
  # Where to install the manual web500gw.8
  MANDIR	= /usr/local/man/man8
***************
*** 34,57 ****
  ## If you use OpenLDAP 1.0 or U-Mich LDAP 3.3 package (recommended)
  # If the LDAP include files and libraries installed in standard places 
  # (/usr/lib, /usr/include) use this:
! LDAPINCL = 
! LDAPLIBS = -lldap -llber
  # set LDAPVERSION (32 for ldap-3.2, 33 for 3.3 etc)
! LDAPVERSION = 33
! VERSION = 3.3
  
  # To use LDAP include files and libraries from the LDAP source directory 
  # use this:
  ## Tailor this: directory of openldap-1.0 or ldap-3.3 distribution
! #LDAPDIR = ../openldap-1.0.2
! #LDAPINCL  = -I$(LDAPDIR)/include
! #LDAPLIBS = -L$(LDAPDIR)/libraries -lldap -llber
! #LDAPVERSION = `sed -e 's/\.//' $(LDAPDIR)/build/version`
! #VERSION = `cat $(LDAPDIR)/build/version`
  
  # T.61 <-> ISO-8859-1 translation: This is built in from LDAP 3.2.
  # If you didn't define this translation there comment out the following line:
! STR_TRANSLATION = -DSTR_TRANSLATION
  # If you defined LDAP_DEBUG there and want to enable LDAP debugging
  # uncomment the following line:
  LDAP_DEBUG = -DLDAP_DEBUG
--- 34,62 ----
  ## If you use OpenLDAP 1.0 or U-Mich LDAP 3.3 package (recommended)
  # If the LDAP include files and libraries installed in standard places 
  # (/usr/lib, /usr/include) use this:
! #LDAPINCL = 
! #LDAPLIBS = -lldap -llber
  # set LDAPVERSION (32 for ldap-3.2, 33 for 3.3 etc)
! #LDAPVERSION = 33
! #VERSION = 3.3
  
  # To use LDAP include files and libraries from the LDAP source directory 
  # use this:
  ## Tailor this: directory of openldap-1.0 or ldap-3.3 distribution
! LDAPDIR = ../..
! LDAPINCL  = -I$(LDAPDIR)/include
! LDAPLIBS = -L$(LDAPDIR)/libraries -lldap -llber -L/usr/lib -lcompat
! 
! ### add next line if (OpenLDAP) SLAPD is compiled with TLS/SSL support  ###
! ### modify for correct path if used and different from below            ###
! SSLLIB = -L/usr/local/ssl/lib -lssl -lcrypto
! 
! LDAPVERSION = `sed -e 's/\.//g' $(LDAPDIR)/build/version`
! VERSION = `cat $(LDAPDIR)/build/version`
  
  # T.61 <-> ISO-8859-1 translation: This is built in from LDAP 3.2.
  # If you didn't define this translation there comment out the following line:
! #STR_TRANSLATION = -DSTR_TRANSLATION
  # If you defined LDAP_DEBUG there and want to enable LDAP debugging
  # uncomment the following line:
  LDAP_DEBUG = -DLDAP_DEBUG
***************
*** 69,75 ****
  
  # platform specific:
  # Linux
! PLATFORMCFLAGS= -Dlinux -DSYSV 
  # Solaris 2
  # PLATFORMCFLAGS= -Dsunos5
  # PLATFORMLDFLAGS= -lsocket -lnsl
--- 74,80 ----
  
  # platform specific:
  # Linux
! #PLATFORMCFLAGS= -Dlinux -DSYSV 
  # Solaris 2
  # PLATFORMCFLAGS= -Dsunos5
  # PLATFORMLDFLAGS= -lsocket -lnsl
***************
*** 81,89 ****
  # PLATFORMCFLAGS= -Dhpux9
  # AIX
  # PLATFORMCFLAGS= -Daix
! # NetBSD:
! #PLATFORMCFLAGS=
! #PLATFORMLDFLAGS= -lcompat
  # OSF/1
  #PLATFORMCFLAGS= -Dosf -DSYSV
  #PLATFORMLDFLAGS=
--- 86,94 ----
  # PLATFORMCFLAGS= -Dhpux9
  # AIX
  # PLATFORMCFLAGS= -Daix
! # NetBSD/FreeBSD:
! PLATFORMCFLAGS=-DHAVE_GMT
! PLATFORMLDFLAGS= -lcompat
  # OSF/1
  #PLATFORMCFLAGS= -Dosf -DSYSV
  #PLATFORMLDFLAGS=
***************
*** 100,106 ****
  CC	= gcc 
  #WARN = -Wall -Wno-implicit
  #CFLAGS	= -O4 $(WARN) $(ALLDEFINES) -fpcc-struct-return -fwritable-strings
! CFLAGS	= -g $(WARN) $(ALLDEFINES) -fpcc-struct-return -fwritable-strings
  
  # or cc:
  #CC	= cc
--- 105,111 ----
  CC	= gcc 
  #WARN = -Wall -Wno-implicit
  #CFLAGS	= -O4 $(WARN) $(ALLDEFINES) -fpcc-struct-return -fwritable-strings
! CFLAGS	= -g $(WARN) $(ALLDEFINES) -fwritable-strings
  
  # or cc:
  #CC	= cc
***************
*** 115,122 ****
  INSTALL = util/install.sh
  MKDIR   = mkdir
  # LIBEFENCE = -lefence
  
! LIBS	= $(LDAPLIBS) $(KRBLIBFLAG) $(KRBLIBS) $(LIBEFENCE)
  
  SRCS	=	web500gw.c read.c search.c bind.c modify.c add.c delete.c modrdn.c\
              navigation.c util.c web_util.c dir_util.c ldap2html.c init.c \
--- 120,128 ----
  INSTALL = util/install.sh
  MKDIR   = mkdir
  # LIBEFENCE = -lefence
+ ### add $(SSLLIB) to LIBS if (OpenLDAP) SLAPD is compilied with TLS/SSL ###
  
! LIBS	= $(LDAPLIBS) $(SSLLIB) $(KRBLIBFLAG) $(KRBLIBS) $(LIBEFENCE)
  
  SRCS	=	web500gw.c read.c search.c bind.c modify.c add.c delete.c modrdn.c\
              navigation.c util.c web_util.c dir_util.c ldap2html.c init.c \

--0-2078917053-975297415=:12321
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Disposition: attachment; filename="config.c.diffs"

*** config.c	Sun Oct 29 19:04:56 2000
--- config.c.bkup	Sun Oct 29 19:04:58 2000
***************
*** 1,4 ****
! #include <sys/unistd.h>
  #include "web500gw.h"
  
  /* read in configuration file */
--- 1,4 ----
! 
  #include "web500gw.h"
  
  /* read in configuration file */

--0-2078917053-975297415=:12321
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Disposition: attachment; filename="util.c.diffs"

*** util.c.orig	Sat Dec  4 03:05:09 1999
--- util.c	Tue Jan 25 00:27:36 2000
***************
*** 465,470 ****
--- 465,471 ----
      char        mydate[256];
      struct tm   tm, *ntm;
      time_t      t;
+     int		ds_off; /* date string offset */
  
  #ifdef WEB500GW_DEBUG
      Web500gw_debug(WEB500GW_DEBUG_UTIL, "  format_date (%s, \"%s\")\n",
***************
*** 473,487 ****
      if (!s)
          return(NULL);
  
!     /* s should point to: YYMMDDHHmmSSZ */
      /* ... well 2 digits for year :-( */
! 
!     tm.tm_year = 10*(s[0] - '0') + (s[1] - '0');
!     tm.tm_mon  = 10*(s[2] - '0') + (s[3] - '0') - 1;
!     tm.tm_mday = 10*(s[4] - '0') + (s[5] - '0');
!     tm.tm_hour = 10*(s[6] - '0') + (s[7] - '0');
!     tm.tm_min  = 10*(s[8] - '0') + (s[9] - '0');
!     tm.tm_sec  = 10*(s[10] - '0') + (s[11] - '0');
      tm.tm_isdst = 0;
  
  #if ! (defined(__hpux) || defined(_AIX) || defined(sunos5) || defined(linux) || defined(unixware7))
--- 474,494 ----
      if (!s)
          return(NULL);
  
!     /* s should point to: YYMMDDHHmmSSZ (13 chars) */
      /* ... well 2 digits for year :-( */
!     /* or: YYYYMMDDHHmmSSZ (15 chars; 4-digit years) */
!     syslog(LOG_INFO, "at line 479, strlen(s):%d", strlen(s));
!     syslog(LOG_INFO, "at line 480, sizeof(s):%d", sizeof(s));
!     if (strlen(s) == 13) {
!         tm.tm_year = 10*(s[0] - '0') + (s[1] - '0'); ds_off = 2;}
!     else {
!         tm.tm_year = 1000*(s[0] - '0') + 100*(s[1] - '0') +
!                        10*(s[2] - '0') +     (s[3] - '0'); ds_off = 4;}
!     tm.tm_mon  = 10*(s[ds_off] - '0')    + (s[ds_off+1] - '0') - 1;
!     tm.tm_mday = 10*(s[ds_off+2] - '0')  + (s[ds_off+3] - '0');
!     tm.tm_hour = 10*(s[ds_off+4] - '0')  + (s[ds_off+5] - '0');
!     tm.tm_min  = 10*(s[ds_off+6] - '0')  + (s[ds_off+7] - '0');
!     tm.tm_sec  = 10*(s[ds_off+8] - '0')  + (s[ds_off+9] - '0');
      tm.tm_isdst = 0;
  
  #if ! (defined(__hpux) || defined(_AIX) || defined(sunos5) || defined(linux) || defined(unixware7))
***************
*** 524,529 ****
--- 531,537 ----
      char month_name[4];
      int year = 0, month = 0, day = 0, hour = 0, min = 0, sec = 0;
      int i = 0;
+     int ds_off; /* date stamp offset */
  
  #ifdef WEB500GW_DEBUG
      Web500gw_debug(WEB500GW_DEBUG_UTIL, "  cmp_dates (%s, %s)\n",
***************
*** 552,560 ****
                          /* RFC 850: dd-Mmm-yy hh:mm:ss */
          sscanf(http_date, "%d-%3s-%d %d:%d:%d",
              &day, month_name, &year, &hour, &min, &sec);
!         if (year < 70)
!             year += 100;
!         year += 1900;
      } else {         /* normal HTTP date (RFC 822/1123): dd Mmm yyyy hh:mm:ss */
          sscanf(http_date, "%d %s %d %d:%d:%d", 
              &day, month_name, &year, &hour, &min, &sec);
--- 560,568 ----
                          /* RFC 850: dd-Mmm-yy hh:mm:ss */
          sscanf(http_date, "%d-%3s-%d %d:%d:%d",
              &day, month_name, &year, &hour, &min, &sec);
! 	/* convert 2-digit year into 4-digit year based on Unix beg date */
!         if (year < 70)   year += 100;
! 	if (year < 1900) year += 1900;
      } else {         /* normal HTTP date (RFC 822/1123): dd Mmm yyyy hh:mm:ss */
          sscanf(http_date, "%d %s %d %d:%d:%d", 
              &day, month_name, &year, &hour, &min, &sec);
***************
*** 568,584 ****
          day, month, year, 0);
      Web500gw_debug(WEB500GW_DEBUG_UTIL, "%d:%d:%d\n", hour, min, sec, 0);
  #endif
!     if ((i = ((10*(ldap_date[0] - '0') + (ldap_date[1] - '0') + 1900) - year)))
!         return i > 0;
!     if ((i = ((10*(ldap_date[2] - '0') + (ldap_date[3] - '0')) - month)))
          return i > 0;
!     if ((i = ((10*(ldap_date[4] - '0') + (ldap_date[5] - '0')) - day)))
          return i > 0;
!     if ((i = ((10*(ldap_date[6] - '0') + (ldap_date[7] - '0')) - hour)))
          return i > 0;
!     if ((i = ((10*(ldap_date[8] - '0') + (ldap_date[9] - '0')) - min)))
          return i > 0;
!     if ((i = ((10*(ldap_date[10] - '0') + (ldap_date[11] - '0')) - sec)))
          return i > 0;
  
      /* gone so far - dates are identical */
--- 576,606 ----
          day, month, year, 0);
      Web500gw_debug(WEB500GW_DEBUG_UTIL, "%d:%d:%d\n", hour, min, sec, 0);
  #endif
!     /* ldap_date should point to: YYMMDDHHmmSSZ (13 chars) */
!     /* ... well 2 digits for year :-( */
!     /* or: YYYYMMDDHHmmSSZ (15 chars; 4-digit years) */
!     syslog(LOG_INFO, "at line 583, strlen(ldap_date):%d", strlen(ldap_date));
!     syslog(LOG_INFO, "at line 584, sizeof(ldap_date):%d", sizeof(ldap_date));
!     if (strlen(ldap_date) == 13) { 
!       ds_off=2;
!       if ((i = ((10*(ldap_date[0] - '0') +
! 	 (ldap_date[1] - '0') + 1900) - year))) return i > 0;}
!     else {
!       ds_off=4;
!       if ((i = ((1000*(ldap_date[0] - '0') +
!                   100*(ldap_date[1] - '0') +
!                    10*(ldap_date[2] - '0') +
!                       (ldap_date[3] - '0')) - year ))) return i > 0;}
! 
!     if ((i = ((10*(ldap_date[ds_off] - '0') + (ldap_date[ds_off+1] - '0')) - month)))
          return i > 0;
!     if ((i = ((10*(ldap_date[ds_off+2] - '0') + (ldap_date[ds_off+3] - '0')) - day)))
          return i > 0;
!     if ((i = ((10*(ldap_date[ds_off+4] - '0') + (ldap_date[ds_off+5] - '0')) - hour)))
          return i > 0;
!     if ((i = ((10*(ldap_date[ds_off+6] - '0') + (ldap_date[ds_off+7] - '0')) - min)))
          return i > 0;
!     if ((i = ((10*(ldap_date[ds_off+8] - '0') + (ldap_date[ds_off+9] - '0')) - sec)))
          return i > 0;
  
      /* gone so far - dates are identical */

--0-2078917053-975297415=:12321
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Disposition: attachment; filename="web500gw.h.diffs"

*** web500gw.h	Sun Oct 29 21:17:14 2000
--- web500gw.h.bkup	Sun Oct 29 19:04:57 2000
***************
*** 21,27 ****
   */
  
  #include "lber.h"
- /* #include "../../libraries/liblber/lber-int.h" */
  #include "ldap.h"
  #include "disptmpl.h"
  #include <stdio.h>
--- 21,26 ----
***************
*** 53,67 ****
  #include <sys/access.h>
  #endif /* aix */
  
- /* OpenLDAP-2.x split old ldap.h into ldap.h and ldap-int.h */
- #include "../../libraries/libldap/ldap-int.h"
- 
  #include "portable.h"
  /*  #include "regex.h" */
  
- /* some defs from UMich LDAP-3.3/OpenLDAP-1.2.7 still used */
- #include "old_UMichLDAP_defs.h"
- 
  #include "config.h"
  
  /*
--- 52,60 ----
***************
*** 463,469 ****
      char    *c_helpfile;            /* name of helpfile */
      char    *c_attrfile;            /* name of helpfile for attributes */
      char    *c_friendlyfile;        /* name of friendlyfile */
!     LDAPFriendlyMap *c_fm;
      char    *c_messagefile;         /* name of messagefile */
      char    *c_msg[MSG_count + 1];
      char    **c_errmsg;
--- 456,462 ----
      char    *c_helpfile;            /* name of helpfile */
      char    *c_attrfile;            /* name of helpfile for attributes */
      char    *c_friendlyfile;        /* name of friendlyfile */
!     FriendlyMap *c_fm;
      char    *c_messagefile;         /* name of messagefile */
      char    *c_msg[MSG_count + 1];
      char    **c_errmsg;

--0-2078917053-975297415=:12321
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Disposition: attachment; filename="old_UMichLDAP_defs.h"

/* carry over definitions from when web500gw   */
/* was initially designed using UMich LDAP-3.3 */
/* OpenLDAP-1.x used the same defs             */
/* OpenLDAP-2.x has dropped the following defs */
#define NULLTMPLITEM ((struct ldap_tmplitem *)0)

--0-2078917053-975297415=:12321-
ontent-Type: TEXT/plain; CHARSET=US-ASCII
Content-Disposition: attachment; filename="old_UMichLDAP_defs.h"


>Release-Note:
>Audit-Trail:
>Unformatted:
 --0-2078917053-975297415=:12321
 Content-Type: TEXT/plain; charset=us-ascii
 
 X-send-pr-version: 3.95