Subject: openssh3.3p1 on solaris2.6
To: None <tech-pkg@netbsd.org>
From: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
List: tech-pkg
Date: 06/25/2002 23:32:36
I'm using Zoularis on Solaris2.6.  I noticed the following diff is
necessary to use compression and priviledge separation, because
it doesn't have MAP_ANON.
Does this diff look OK?  I'd like to commit it shortly.


*** work/openssh-3.3p1/monitor_mm.c.orig	Tue Jun 25 23:17:30 2002
--- work/openssh-3.3p1/monitor_mm.c	Tue Jun 25 22:44:46 2002
***************
*** 70,75 ****
--- 70,76 ----
  mm_create(struct mm_master *mmalloc, size_t size)
  {
  	void *address;
+ 	int fd;
  	struct mm_master *mm;
  
  	if (mmalloc == NULL)
***************
*** 87,98 ****
  #if  defined(HAVE_MMAP) && defined(MAP_ANON)
  	address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED,
  	    -1, 0);
- 	if (address == MAP_FAILED)
- 		fatal("mmap(%lu): %s", (u_long)size, strerror(errno));
  #else
! 	fatal("%s: UsePrivilegeSeparation=yes not supported",
! 	    __func__);
  #endif
  
  	mm->address = address;
  	mm->size = size;
--- 88,101 ----
  #if  defined(HAVE_MMAP) && defined(MAP_ANON)
  	address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED,
  	    -1, 0);
  #else
! 	fd = open("/dev/zero", O_RDWR);
! 	address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED,
! 	    fd, 0);
! 	close(fd);
  #endif
+ 	if (address == MAP_FAILED)
+ 		fatal("mmap(%lu): %s", (u_long)size, strerror(errno));
  
  	mm->address = address;
  	mm->size = size;
*** work/openssh-3.3p1/servconf.c.orig	Tue Jun 25 23:29:27 2002
--- work/openssh-3.3p1/servconf.c	Tue Jun 25 22:38:48 2002
***************
*** 257,271 ****
  	if (use_privsep == -1)
  		use_privsep = 1;
  
- #if !defined(HAVE_MMAP) || !defined(MAP_ANON)
- 	if (use_privsep && options->compression == 1) {
- 		error("This platform does not support both privilege "
- 		    "separation and compression");
- 		error("Compression disabled");
- 		options->compression = 0;
- 	}
- #endif
- 
  }
  
  /* Keyword tokens. */
--- 257,262 ----