diff options
author | Tim Rice <tim@multitalents.net> | 2001-11-26 17:19:43 -0800 |
---|---|---|
committer | Tim Rice <tim@multitalents.net> | 2001-11-26 17:19:43 -0800 |
commit | fe1d100ffdf3595f3aaddc02efbf0b49a265d90c (patch) | |
tree | b2657508f6c2bec9b1912d6dc8d881895572db37 /openbsd-compat | |
parent | f7c6f95682684856db063d104be88a6e3b22a828 (diff) |
[contrib/cygwin/README, openbsd-compat/bsd-cygwin_util.c,
openbsd-compat/bsd-cygwin_util.h, openbsd-compat/daemon.c]
Allow SSHD to install as service under WIndows 9x/Me
[configure.ac] Fix to allow linking against PCRE on Cygwin
Patches by Corinna Vinschen <vinschen@redhat.com>
Diffstat (limited to 'openbsd-compat')
-rw-r--r-- | openbsd-compat/bsd-cygwin_util.c | 24 | ||||
-rw-r--r-- | openbsd-compat/bsd-cygwin_util.h | 3 | ||||
-rw-r--r-- | openbsd-compat/daemon.c | 3 |
3 files changed, 28 insertions, 2 deletions
diff --git a/openbsd-compat/bsd-cygwin_util.c b/openbsd-compat/bsd-cygwin_util.c index 87f36c0c..6d6aafa4 100644 --- a/openbsd-compat/bsd-cygwin_util.c +++ b/openbsd-compat/bsd-cygwin_util.c @@ -15,7 +15,7 @@ #include "includes.h" -RCSID("$Id: bsd-cygwin_util.c,v 1.5 2001/07/18 16:19:49 mouring Exp $"); +RCSID("$Id: bsd-cygwin_util.c,v 1.6 2001/11/27 01:19:44 tim Exp $"); #ifdef HAVE_CYGWIN @@ -139,4 +139,26 @@ int check_ntsec(const char *filename) return 0; } +void register_9x_service(void) +{ + HINSTANCE kerneldll; + DWORD (*RegisterServiceProcess)(DWORD, DWORD); + + /* The service register mechanism in 9x/Me is pretty different from + * NT/2K/XP. In NT/2K/XP we're using a special service starter + * application to register and control sshd as service. This method + * doesn't play nicely with 9x/Me. For that reason we register here + * as service when running under 9x/Me. This function is only called + * by the child sshd when it's going to daemonize. + */ + if (is_winnt) + return; + if (! (kerneldll = LoadLibrary("KERNEL32.DLL"))) + return; + if (! (RegisterServiceProcess = (DWORD (*)(DWORD, DWORD)) + GetProcAddress(kerneldll, "RegisterServiceProcess"))) + return; + RegisterServiceProcess(0, 1); +} + #endif /* HAVE_CYGWIN */ diff --git a/openbsd-compat/bsd-cygwin_util.h b/openbsd-compat/bsd-cygwin_util.h index 7879501e..24063d31 100644 --- a/openbsd-compat/bsd-cygwin_util.h +++ b/openbsd-compat/bsd-cygwin_util.h @@ -13,7 +13,7 @@ * binary mode on Windows systems. */ -/* $Id: bsd-cygwin_util.h,v 1.4 2001/04/13 14:28:43 djm Exp $ */ +/* $Id: bsd-cygwin_util.h,v 1.5 2001/11/27 01:19:44 tim Exp $ */ #ifndef _BSD_CYGWIN_UTIL_H #define _BSD_CYGWIN_UTIL_H @@ -26,6 +26,7 @@ int binary_open(const char *filename, int flags, ...); int binary_pipe(int fd[2]); int check_nt_auth(int pwd_authenticated, uid_t uid); int check_ntsec(const char *filename); +void register_9x_service(void); #define open binary_open #define pipe binary_pipe diff --git a/openbsd-compat/daemon.c b/openbsd-compat/daemon.c index f704a904..7d23b246 100644 --- a/openbsd-compat/daemon.c +++ b/openbsd-compat/daemon.c @@ -49,6 +49,9 @@ daemon(nochdir, noclose) case -1: return (-1); case 0: +#ifdef HAVE_CYGWIN + register_9x_service(); +#endif break; default: #ifdef HAVE_CYGWIN |