openssh for UWIN

David Korn dgk at research.att.com
Sat Jun 8 01:09:39 EST 2002


I am enclosing a context diff of the changes that I made to get
openssh working on UWIN.  UWIN is a UNIX operating system layer
that runs on Win32 systems.  For more information on UWIN
go to http://www.research.att.com/sw/tools/uwin/.

I also ran configure using -with-cppflags=-D_BSDCOMP=2.  I don't
know where that information would go with the source code.
Let me know if you need more information.

=====================cut here==================
*** auth-passwd.c.orig	Mon Mar 04 20:45:57 2002
--- auth-passwd.c	Fri Jun 07 10:37:59 2002
***************
*** 44,49 ****
--- 44,52 ----
  #include "log.h"
  #include "servconf.h"
  #include "auth.h"
+ #ifdef _UWIN
+ #   include	<uwin.h>
+ #endif
  
  #ifdef HAVE_CRYPT_H
  # include <crypt.h>
***************
*** 114,119 ****
--- 117,125 ----
  	/* deny if no user. */
  	if (pw == NULL)
  		return 0;
+ #ifdef _UWIN
+ 	return(uwin_mktoken(pw->pw_name,password,UWIN_TOKCLOSE)!=0);
+ #endif
  #ifndef HAVE_CYGWIN
         if (pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES)
  		return 0;
*** readconf.c.orig	Mon Feb 04 20:26:35 2002
--- readconf.c	Thu May 30 16:55:00 2002
***************
*** 200,206 ****
  		  u_short host_port)
  {
  	Forward *fwd;
! #ifndef HAVE_CYGWIN
  	extern uid_t original_real_uid;
  	if (port < IPPORT_RESERVED && original_real_uid != 0)
  		fatal("Privileged ports can only be forwarded by root.");
--- 200,206 ----
  		  u_short host_port)
  {
  	Forward *fwd;
! #if !defined(HAVE_CYGWIN) && !defined(_UWIN)
  	extern uid_t original_real_uid;
  	if (port < IPPORT_RESERVED && original_real_uid != 0)
  		fatal("Privileged ports can only be forwarded by root.");
*** ssh.c.orig	Mon Feb 18 23:20:58 2002
--- ssh.c	Thu May 30 16:40:07 2002
***************
*** 640,646 ****
  		host = options.hostname;
  
  	/* Disable rhosts authentication if not running as root. */
! #ifdef HAVE_CYGWIN
  	/* Ignore uid if running under Windows */
  	if (!options.use_privileged_port) {
  #else
--- 640,646 ----
  		host = options.hostname;
  
  	/* Disable rhosts authentication if not running as root. */
! #if define(HAVE_CYGWIN) || defined(_UWIN)
  	/* Ignore uid if running under Windows */
  	if (!options.use_privileged_port) {
  #else
*** sshpty.c.orig	Thu Dec 20 22:45:52 2001
--- sshpty.c	Thu May 30 16:37:50 2002
***************
*** 124,130 ****
  		close(*ptyfd);
  		return 0;
  	}
! #ifndef HAVE_CYGWIN
  	/*
  	 * Push the appropriate streams modules, as described in Solaris pts(7).
  	 * HP-UX pts(7) doesn't have ttcompat module.
--- 124,130 ----
  		close(*ptyfd);
  		return 0;
  	}
! #if !defined(HAVE_CYGWIN) && !defined(_UWIN)
  	/*
  	 * Push the appropriate streams modules, as described in Solaris pts(7).
  	 * HP-UX pts(7) doesn't have ttcompat module.
*** uidswap.c.orig	Thu Dec 20 22:45:52 2001
--- uidswap.c	Thu May 30 16:36:30 2002
***************
*** 80,86 ****
  		if (user_groupslen < 0)
  			fatal("getgroups: %.100s", strerror(errno));
  	}
! #ifndef HAVE_CYGWIN
  	/* Set the effective uid to the given (unprivileged) uid. */
  	if (setgroups(user_groupslen, user_groups) < 0)
  		fatal("setgroups: %.100s", strerror(errno));
--- 80,86 ----
  		if (user_groupslen < 0)
  			fatal("getgroups: %.100s", strerror(errno));
  	}
! #if !defined(HAVE_CYGWIN) && !defined(_UWIN) 
  	/* Set the effective uid to the given (unprivileged) uid. */
  	if (setgroups(user_groupslen, user_groups) < 0)
  		fatal("setgroups: %.100s", strerror(errno));
***************
*** 131,137 ****
  	setgid(getgid());
  #endif /* SAVED_IDS_WORK_WITH_SETEUID */
  
! #ifndef HAVE_CYGWIN
  	if (setgroups(saved_egroupslen, saved_egroups) < 0)
  		fatal("setgroups: %.100s", strerror(errno));
  #endif /* !HAVE_CYGWIN */
--- 131,137 ----
  	setgid(getgid());
  #endif /* SAVED_IDS_WORK_WITH_SETEUID */
  
! #if !defined(HAVE_CYGWIN) && !defined(_UWIN) 
  	if (setgroups(saved_egroupslen, saved_egroups) < 0)
  		fatal("setgroups: %.100s", strerror(errno));
  #endif /* !HAVE_CYGWIN */
=====================cut here==================

David Korn
research!dgk
dgk at research.att.com



More information about the openssh-unix-dev mailing list