From d4dccc1449f6daf7f0c7a174cce6178774e83223 Mon Sep 17 00:00:00 2001
From: dinoex <dinoex@FreeBSD.org>
Date: Mon, 15 Jul 2002 20:08:01 +0000
Subject: - Fix Problem with HAVE_HOST_IN_UTMP - update monitor.c

PR:		40576
Submitted by:	lxv@a-send-pr.sink.omut.org
---
 security/hpn-ssh/Makefile                        |  2 +-
 security/hpn-ssh/files/patch-loginrec.c          | 12 ++++++++++++
 security/hpn-ssh/files/patch-monitor.c           | 11 ++++++-----
 security/openssh-portable/Makefile               |  2 +-
 security/openssh-portable/files/patch-loginrec.c | 12 ++++++++++++
 security/openssh-portable/files/patch-monitor.c  | 11 ++++++-----
 6 files changed, 38 insertions(+), 12 deletions(-)
 create mode 100644 security/hpn-ssh/files/patch-loginrec.c
 create mode 100644 security/openssh-portable/files/patch-loginrec.c

(limited to 'security')

diff --git a/security/hpn-ssh/Makefile b/security/hpn-ssh/Makefile
index e0341a44d4be..7ea6157a902e 100644
--- a/security/hpn-ssh/Makefile
+++ b/security/hpn-ssh/Makefile
@@ -7,7 +7,7 @@
 
 PORTNAME=	openssh
 PORTVERSION=	3.4p1
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	security ipv6
 MASTER_SITES=	ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
 		ftp://ftp.op.net/pub/OpenBSD/OpenSSH/portable/ \
diff --git a/security/hpn-ssh/files/patch-loginrec.c b/security/hpn-ssh/files/patch-loginrec.c
new file mode 100644
index 000000000000..46247c11d571
--- /dev/null
+++ b/security/hpn-ssh/files/patch-loginrec.c
@@ -0,0 +1,12 @@
+--- loginrec.c.orig	Tue Apr 23 15:09:19 2002
++++ loginrec.c	Mon Jul 15 21:29:20 2002
+@@ -654,7 +655,8 @@
+ 	/* Use strncpy because we don't necessarily want null termination */
+ 	strncpy(ut->ut_name, li->username, MIN_SIZEOF(ut->ut_name, li->username));
+ # ifdef HAVE_HOST_IN_UTMP
+-	strncpy(ut->ut_host, li->hostname, MIN_SIZEOF(ut->ut_host, li->hostname));
++	realhostname_sa(ut->ut_host, sizeof ut->ut_host,
++	    &li->hostaddr.sa, li->hostaddr.sa.sa_len);
+ # endif
+ # ifdef HAVE_ADDR_IN_UTMP
+ 	/* this is just a 32-bit IP address */
diff --git a/security/hpn-ssh/files/patch-monitor.c b/security/hpn-ssh/files/patch-monitor.c
index 7671cf64e3b7..cca169c55f02 100644
--- a/security/hpn-ssh/files/patch-monitor.c
+++ b/security/hpn-ssh/files/patch-monitor.c
@@ -1,6 +1,6 @@
 --- monitor.c.orig	Wed Jun 26 15:27:11 2002
-+++ monitor.c	Wed Jul  3 06:24:31 2002
-@@ -118,6 +127,10 @@
++++ monitor.c	Mon Jul 15 21:33:45 2002
+@@ -118,6 +118,10 @@
  
  #ifdef USE_PAM
  int mm_answer_pam_start(int, Buffer *);
@@ -11,7 +11,7 @@
  #endif
  
  static Authctxt *authctxt;
-@@ -156,6 +169,10 @@
+@@ -156,6 +160,10 @@
      {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword},
  #ifdef USE_PAM
      {MONITOR_REQ_PAM_START, MON_ONCE, mm_answer_pam_start},
@@ -22,7 +22,7 @@
  #endif
  #ifdef BSD_AUTH
      {MONITOR_REQ_BSDAUTHQUERY, MON_ISAUTH, mm_answer_bsdauthquery},
-@@ -198,6 +215,10 @@
+@@ -198,6 +206,10 @@
  #endif
  #ifdef USE_PAM
      {MONITOR_REQ_PAM_START, MON_ONCE, mm_answer_pam_start},
@@ -33,7 +33,7 @@
  #endif
      {0, 0, NULL}
  };
-@@ -732,6 +749,100 @@
+@@ -732,6 +744,101 @@
  	xfree(user);
  
  	return (0);
@@ -73,6 +73,7 @@
 +	ret = (pam_device.query)(pam_ctxt, &name, &info, &num, &prompts, &echo_on);
 +	if (num > 1 || name == NULL || info == NULL)
 +		ret = -1;
++	buffer_clear(m);
 +	buffer_put_int(m, ret);
 +	buffer_put_cstring(m, name);
 +	xfree(name);
diff --git a/security/openssh-portable/Makefile b/security/openssh-portable/Makefile
index e0341a44d4be..7ea6157a902e 100644
--- a/security/openssh-portable/Makefile
+++ b/security/openssh-portable/Makefile
@@ -7,7 +7,7 @@
 
 PORTNAME=	openssh
 PORTVERSION=	3.4p1
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	security ipv6
 MASTER_SITES=	ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
 		ftp://ftp.op.net/pub/OpenBSD/OpenSSH/portable/ \
diff --git a/security/openssh-portable/files/patch-loginrec.c b/security/openssh-portable/files/patch-loginrec.c
new file mode 100644
index 000000000000..46247c11d571
--- /dev/null
+++ b/security/openssh-portable/files/patch-loginrec.c
@@ -0,0 +1,12 @@
+--- loginrec.c.orig	Tue Apr 23 15:09:19 2002
++++ loginrec.c	Mon Jul 15 21:29:20 2002
+@@ -654,7 +655,8 @@
+ 	/* Use strncpy because we don't necessarily want null termination */
+ 	strncpy(ut->ut_name, li->username, MIN_SIZEOF(ut->ut_name, li->username));
+ # ifdef HAVE_HOST_IN_UTMP
+-	strncpy(ut->ut_host, li->hostname, MIN_SIZEOF(ut->ut_host, li->hostname));
++	realhostname_sa(ut->ut_host, sizeof ut->ut_host,
++	    &li->hostaddr.sa, li->hostaddr.sa.sa_len);
+ # endif
+ # ifdef HAVE_ADDR_IN_UTMP
+ 	/* this is just a 32-bit IP address */
diff --git a/security/openssh-portable/files/patch-monitor.c b/security/openssh-portable/files/patch-monitor.c
index 7671cf64e3b7..cca169c55f02 100644
--- a/security/openssh-portable/files/patch-monitor.c
+++ b/security/openssh-portable/files/patch-monitor.c
@@ -1,6 +1,6 @@
 --- monitor.c.orig	Wed Jun 26 15:27:11 2002
-+++ monitor.c	Wed Jul  3 06:24:31 2002
-@@ -118,6 +127,10 @@
++++ monitor.c	Mon Jul 15 21:33:45 2002
+@@ -118,6 +118,10 @@
  
  #ifdef USE_PAM
  int mm_answer_pam_start(int, Buffer *);
@@ -11,7 +11,7 @@
  #endif
  
  static Authctxt *authctxt;
-@@ -156,6 +169,10 @@
+@@ -156,6 +160,10 @@
      {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword},
  #ifdef USE_PAM
      {MONITOR_REQ_PAM_START, MON_ONCE, mm_answer_pam_start},
@@ -22,7 +22,7 @@
  #endif
  #ifdef BSD_AUTH
      {MONITOR_REQ_BSDAUTHQUERY, MON_ISAUTH, mm_answer_bsdauthquery},
-@@ -198,6 +215,10 @@
+@@ -198,6 +206,10 @@
  #endif
  #ifdef USE_PAM
      {MONITOR_REQ_PAM_START, MON_ONCE, mm_answer_pam_start},
@@ -33,7 +33,7 @@
  #endif
      {0, 0, NULL}
  };
-@@ -732,6 +749,100 @@
+@@ -732,6 +744,101 @@
  	xfree(user);
  
  	return (0);
@@ -73,6 +73,7 @@
 +	ret = (pam_device.query)(pam_ctxt, &name, &info, &num, &prompts, &echo_on);
 +	if (num > 1 || name == NULL || info == NULL)
 +		ret = -1;
++	buffer_clear(m);
 +	buffer_put_int(m, ret);
 +	buffer_put_cstring(m, name);
 +	xfree(name);
-- 
cgit