Subject: my hp/ux 10.01 10.20 builds of beta 12

From: Albert Lunde <[email-masked]>
Date: Thu, 30 Jan 1997 17:40:42 -0600

[also mailed to [email-masked]]

I've gotten modified versions of beta 12 to build on HP/UX 10.01 and 10.20.

For various reasons, I first did 10.20 then back ported to 10.01.

In both cases I'm running with trusted systems/shadow passwords, which adds
some complications.

I modified the bigcrypt patches from the FAQ to piggyback on the SECUREOSF
code, since HP "Trusted Sustems" are based on a similar base of code from
"Secureware".

I don't claim these are the minimal patches needed to make it run; this is
just what worked for me.

The choice of some things like: config file and install paths, default
umask, syslog facility are purely local decisions.

Rather that use the .hpx files I created a new set of .cus files based on
them for my "custom" config.

Here are the source file diffs for 10.20:
= = =
wu-ftpd-2.4.2-beta-12/src/ftpcount.c
*** dist-wu-ftpd-2.4.2-beta-12/src/ftpcount.c	Tue Jan 14 16:07:02 1997
--- wu-ftpd-2.4.2-beta-12/src/ftpcount.c	Mon Jan 27 13:04:54 1997
***************
*** 227,232 ****
--- 227,237 ----
              stat = kill(buf[which], SIGCONT);
              if (((stat == -1) && (errno == EPERM)) || !stat) {
                  if (strcmp(progname,"ftpcount")) {
+ #if defined(HPUX10_PS)
+ 		  /* Albert Lunde 1/27/97, mod to keep ftpwho ps options
+                      like beta 11 */
+                     sprintf(line,"/usr/bin/ps -f -p %d",buf[which]);
+ #else
  #if defined(SVR4)
  #ifdef AIX
                      sprintf(line,"/bin/ps %d",buf[which]);
***************
*** 239,244 ****
--- 244,250 ----
                      sprintf(line,"/bin/ps -f -p %d",buf[which]);
  #else
                      sprintf(line,"/bin/ps %d",buf[which]);
+ #endif
  #endif
                      ZeFile = popen(line, "r");
                      fgets(line, 1024, ZeFile);
wu-ftpd-2.4.2-beta-12/src/ftpd.c
*** dist-wu-ftpd-2.4.2-beta-12/src/ftpd.c	Sun Jan 19 23:05:11 1997
--- wu-ftpd-2.4.2-beta-12/src/ftpd.c	Mon Jan 27 11:25:46 1997
***************
*** 241,246 ****
--- 241,255 ----
  char chbuff[80];
  #endif

+ #ifdef HP_BIGCRYPT
+ /* Albert Lunde 1/23/96 */
+ /* HP/UX 10.20 bigcrypt - trusted system long password support */
+ /* similar to SECUREOSF patch but with small differences */
+ /* use #define SHADOW_PASSWORD in conf.h
+    use LIBES = -lsupport -lc -lPW -lsec */
+ #define SECUREOSF
+ #include <hpsecurity.h>
+ #endif
  #ifdef SECUREOSF
  #define SecureWare
  #include <prot.h>
***************
*** 407,413 ****
--- 416,424 ----
  #endif

  #ifdef SecureWare
+ #ifndef HP_BIGCRYPT
      setluid(1);                         /* make sure there is a valid luid */
+ #endif
      set_auth_parameters(argc,argv);
      setreuid(0, 0);
  #endif
wu-ftpd-2.4.2-beta-12/src/extensions.c
*** dist-wu-ftpd-2.4.2-beta-12/src/extensions.c	Sun Jan 19 21:21:40 1997
--- wu-ftpd-2.4.2-beta-12/src/extensions.c	Wed Jan 22 13:41:55 1997
***************
*** 101,107 ****
    disctime[30];

  #ifdef __STDC__
! extern char *realpath(char *pathname, char *result);
  #else
  extern char *realpath();
  #endif
--- 101,107 ----
    disctime[30];

  #ifdef __STDC__
! extern char *realpath(const char *pathname, char *result);
  #else
  extern char *realpath();
  #endif
= = =
Here's my ./src/config/config.cus file
= = =
/*
 * modified from config.hpx for hp/ux 10.20
 *
 * config.h for HPUX
 * $Id: config.hpx,v 1.4 1995/12/05 09:54:15 sob Exp $
 */

#define HAVE_SYMLINK
#undef  BSD
#define  HAVE_DIRENT
#define  HAVE_D_NAMLEN
#undef  HAVE_FLOCK
#define HAVE_FTW
#define HAVE_GETCWD
#undef  HAVE_GETDTABLESIZE
#define HAVE_PSTAT
#define HAVE_REGEX_H
#define HAVE_ST_BLKSIZE
#undef  HAVE_SYSINFO
#undef  HAVE_UT_UT_HOST
#define HAVE_VPRINTF
#define OVERWRITE
#define REGEX
#define REGEXEC
#define SPT_TYPE SPT_PSTAT
#define  SHADOW_PASSWORD
#define SVR4
#define UPLOAD
#define USG

#define CMASK 022

#define _PATH_WTMP "/var/adm/wtmp"

/* #define RLIM_INFINITY 0x7fffffff */
#include <sys/resource.h>
#define	seteuid(x)	setresuid(-1,x,-1)
#define setegid(x)	setresgid(-1,x,-1)

#include <malloc.h>
#include <sys/signal.h>
#include <stdlib.h>
#include <unistd.h>

#ifndef FACILITY
#define FACILITY LOG_LOCAL5
#endif

typedef void	SIGNAL_TYPE;

#define _PATH_BSHELL "/usr/bin/sh"

/* choose paths for various files */

#define USE_VAR
#define USE_PID

/* HP trusted system support */
#define HP_BIGCRYPT

/* desired path, options for ps in ftpcount.c */
#define HPUX10_PS

/* suggested to fix problems with popen */
#define HAVE_GETRLIMIT

#include "../config.h"

= = =
I also changed this Makefile, and (install directories in
makefiles/Makefile.hpx)
= = =
diff  src/makefiles/Makefile.hpx src/makefiles/Makefile.cus
4a5,6
> # Modified for HP/UX 10.20, bigcrypt support 1/23/97 - Albert Lunde
> #
9c11
< LIBES    = -lsupport -lc -lPW
---
> LIBES    = -lsupport -lc -lPW -lsec
pubweb 100#
= = =

Getting it to build on hp/uh 10.02 required fixing a seeming typo in HP's
/usr/include/shadow.h file:
= = =
# more diff-shadow.h
*** usr-include-shadow.h-dist   Tue May 23 02:00:00 1995
--- usr-include-shadow.h-fixed  Thu Jan 30 11:24:13 1997
***************
*** 36,42 ****
       extern void endspent(void);
       extern struct spwd * getspent(void);
       extern struct spwd * getspnam(char *);
!      extern int lckpwdf(void),
       extern int ulckpwdf(void);
  #  else /* not __STDC__ || __cplusplus */
       void setspent();
--- 36,42 ----
       extern void endspent(void);
       extern struct spwd * getspent(void);
       extern struct spwd * getspnam(char *);
!      extern int lckpwdf(void);
       extern int ulckpwdf(void);
  #  else /* not __STDC__ || __cplusplus */
       void setspent();
#
= = =

Here are my source diffs for beta-12 on HP/UX 10.01:
= = =
wu-ftpd-2.4.2-beta-12/src/ftpcount.c
*** dist-wu-ftpd-2.4.2-beta-12/src/ftpcount.c	Tue Jan 14 16:07:02 1997
--- wu-ftpd-2.4.2-beta-12/src/ftpcount.c	Mon Jan 27 13:04:54 1997
***************
*** 227,232 ****
--- 227,237 ----
              stat = kill(buf[which], SIGCONT);
              if (((stat == -1) && (errno == EPERM)) || !stat) {
                  if (strcmp(progname,"ftpcount")) {
+ #if defined(HPUX10_PS)
+ 		  /* Albert Lunde 1/27/97, mod to keep ftpwho ps options
+                      like beta 11 */
+                     sprintf(line,"/usr/bin/ps -f -p %d",buf[which]);
+ #else
  #if defined(SVR4)
  #ifdef AIX
                      sprintf(line,"/bin/ps %d",buf[which]);
***************
*** 239,244 ****
--- 244,250 ----
                      sprintf(line,"/bin/ps -f -p %d",buf[which]);
  #else
                      sprintf(line,"/bin/ps %d",buf[which]);
+ #endif
  #endif
                      ZeFile = popen(line, "r");
                      fgets(line, 1024, ZeFile);
wu-ftpd-2.4.2-beta-12/src/ftpd.c
wu-ftpd-2.4.2-beta-12/src/ftpd.c
*** dist-wu-ftpd-2.4.2-beta-12/src/ftpd.c	Sun Jan 19 23:05:11 1997
--- wu-ftpd-2.4.2-beta-12/src/ftpd.c	Thu Jan 30 12:49:40 1997
***************
*** 241,246 ****
--- 241,255 ----
  char chbuff[80];
  #endif

+ #ifdef HP_BIGCRYPT
+ /* Albert Lunde 1/23/96 */
+ /* HP/UX 10.20 bigcrypt - trusted system long password support */
+ /* similar to SECUREOSF patch but with small differences */
+ /* use #define SHADOW_PASSWORD in conf.h
+    use LIBES = -lsupport -lc -lPW -lsec */
+ #define SECUREOSF
+ #include <hpsecurity.h>
+ #endif
  #ifdef SECUREOSF
  #define SecureWare
  #include <prot.h>
***************
*** 407,416 ****
--- 416,433 ----
  #endif

  #ifdef SecureWare
+ #ifndef HP_BIGCRYPT
      setluid(1);                         /* make sure there is a valid luid */
+ #endif
      set_auth_parameters(argc,argv);
+ #ifdef HAVE_SETREUID
      setreuid(0, 0);
+ #else
+     /* tacky patch for hpux 10.01 */
+     /* I don't know if this is correct, really */
+     setuid(0);
  #endif
+ #endif
  #if defined(M_UNIX) && !defined(_M_UNIX)
      res_init();                         /* bug in old (1.1.1) resolver     */
      _res.retrans = 20;                  /* because of fake syslog in 3.2.2 */
***************
*** 2276,2282 ****
--- 2293,2303 ----

          timeout.tv_usec = 0;
          timeout.tv_sec = 120;
+ /* patch old-style def of select in hp/ux 10.01
          if (select(pdata+1, &set, (fd_set *) 0, (fd_set *) 0, &timeout)
== 0 ||
+             (s = accept(pdata, (struct sockaddr *) &from, &fromlen)) < 0) {
+ */
+         if (select(pdata+1, (int *) &set, (int *) 0, (int *) 0, &timeout)
== 0 ||
              (s = accept(pdata, (struct sockaddr *) &from, &fromlen)) < 0) {
  #else
          alarm(120);
wu-ftpd-2.4.2-beta-12/src/extensions.c
*** dist-wu-ftpd-2.4.2-beta-12/src/extensions.c	Sun Jan 19 21:21:40 1997
--- wu-ftpd-2.4.2-beta-12/src/extensions.c	Wed Jan 22 13:41:55 1997
***************
*** 101,107 ****
    disctime[30];

  #ifdef __STDC__
! extern char *realpath(char *pathname, char *result);
  #else
  extern char *realpath();
  #endif
--- 101,107 ----
    disctime[30];

  #ifdef __STDC__
! extern char *realpath(const char *pathname, char *result);
  #else
  extern char *realpath();
  #endif
= = =
Here's config.cus
= = =
/*
 * modified from config.hpx for hp/ux 10.20
 * further hacked for 10.01
 * config.h for HPUX
 * $Id: config.hpx,v 1.4 1995/12/05 09:54:15 sob Exp $
 */

#define HAVE_SYMLINK
#undef  BSD
#define  HAVE_DIRENT
#define  HAVE_D_NAMLEN
#undef  HAVE_FLOCK
#define HAVE_FTW
#define HAVE_GETCWD
#undef  HAVE_GETDTABLESIZE
#define HAVE_PSTAT
#define HAVE_REGEX_H
#define HAVE_ST_BLKSIZE
#undef  HAVE_SYSINFO
#undef  HAVE_UT_UT_HOST
#define HAVE_VPRINTF
#define OVERWRITE
#define REGEX
#define REGEXEC
#define SPT_TYPE SPT_PSTAT
/* note 1-line patch needed in /usr/include/shadow.h on 10.01 */
#define  SHADOW_PASSWORD
#define SVR4
#define UPLOAD
#define USG

#define CMASK 022

#define _PATH_WTMP "/var/adm/wtmp"

/* RLIM_INFINITY needed on 10.01 not 10.20 */
#define RLIM_INFINITY 0x7fffffff
#include <sys/resource.h>
#define seteuid(x)      setresuid(-1,x,-1)
#define setegid(x)      setresgid(-1,x,-1)

#include <malloc.h>
#include <sys/signal.h>
#include <stdlib.h>
#include <unistd.h>

/* local mod to change where syslog goes */
#ifndef FACILITY
#define FACILITY LOG_LOCAL5
#endif

typedef void    SIGNAL_TYPE;

#define _PATH_BSHELL "/usr/bin/sh"

/* choose paths for various files */

#define USE_VAR
#define USE_PID

/* HP trusted system support */
#define HP_BIGCRYPT

/* desired path, options for ps in ftpcount.c */
#define HPUX10_PS

/* suggested to fix problems with popen */
#define HAVE_GETRLIMIT

#include "../config.h"

= = =
the same mod applies to the Makefile
= = =
# diff src/makefiles/Makefile.hpx src/makefiles/Makefile.cus
4a5,6
> # Modified for HP/UX 10.20, bigcrypt support 1/23/97 - Albert Lunde
> #
9c11
< LIBES    = -lsupport -lc -lPW
---
> LIBES    = -lsupport -lc -lPW -lsec
#
= = =

---
    Albert Lunde                      [email-masked]