mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-30 17:25:09 +02:00
- (djm) Merged cleanup patch from Mark Miller <markm@swoon.net>
- (djm) A bit more cleanup - created cygwin_util.h
This commit is contained in:
parent
62cee00753
commit
72c9a7e958
@ -1,3 +1,7 @@
|
|||||||
|
20000924
|
||||||
|
- (djm) Merged cleanup patch from Mark Miller <markm@swoon.net>
|
||||||
|
- (djm) A bit more cleanup - created cygwin_util.h
|
||||||
|
|
||||||
20000923
|
20000923
|
||||||
- (djm) Fix address logging in utmp from Kevin Steves
|
- (djm) Fix address logging in utmp from Kevin Steves
|
||||||
<stevesk@sweden.hp.com>
|
<stevesk@sweden.hp.com>
|
||||||
|
@ -23,11 +23,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include <openssl/rand.h>
|
|
||||||
#include <openssl/rc4.h>
|
|
||||||
|
|
||||||
#ifndef HAVE_ARC4RANDOM
|
#ifndef HAVE_ARC4RANDOM
|
||||||
|
|
||||||
|
#include <openssl/rand.h>
|
||||||
|
#include <openssl/rc4.h>
|
||||||
|
|
||||||
/* Size of key to use */
|
/* Size of key to use */
|
||||||
#define SEED_SIZE 20
|
#define SEED_SIZE 20
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ if test -z "$no_libnsl" ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h)
|
AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h)
|
||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo futimes gai_strerror getaddrinfo getnameinfo getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop)
|
AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo futimes gai_strerror getaddrinfo getnameinfo getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop)
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef HAVE_CYGWIN
|
#ifdef HAVE_CYGWIN
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -25,35 +26,37 @@
|
|||||||
|
|
||||||
int binary_open(const char *filename, int flags, mode_t mode)
|
int binary_open(const char *filename, int flags, mode_t mode)
|
||||||
{
|
{
|
||||||
return open(filename, flags | O_BINARY, mode);
|
return open(filename, flags | O_BINARY, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int binary_pipe(int fd[2])
|
int binary_pipe(int fd[2])
|
||||||
{
|
{
|
||||||
int ret = pipe(fd);
|
int ret = pipe(fd);
|
||||||
if (!ret) {
|
|
||||||
setmode (fd[0], O_BINARY);
|
if (!ret) {
|
||||||
setmode (fd[1], O_BINARY);
|
setmode (fd[0], O_BINARY);
|
||||||
}
|
setmode (fd[1], O_BINARY);
|
||||||
return ret;
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_nt_auth (int pwd_authenticated, uid_t uid)
|
int check_nt_auth(int pwd_authenticated, uid_t uid)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The only authentication which is able to change the user
|
* The only authentication which is able to change the user
|
||||||
* context on NT systems is the password authentication. So
|
* context on NT systems is the password authentication. So
|
||||||
* we deny all requsts for changing the user context if another
|
* we deny all requsts for changing the user context if another
|
||||||
* authentication method is used.
|
* authentication method is used.
|
||||||
* This may change in future when a special openssh
|
* This may change in future when a special openssh
|
||||||
* subauthentication package is available.
|
* subauthentication package is available.
|
||||||
*/
|
*/
|
||||||
if (is_winnt && !pwd_authenticated && geteuid() != uid)
|
if (is_winnt && !pwd_authenticated && geteuid() != uid)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int check_ntsec (const char *filename)
|
int check_ntsec(const char *filename)
|
||||||
{
|
{
|
||||||
char *cygwin;
|
char *cygwin;
|
||||||
int allow_ntea = 0;
|
int allow_ntea = 0;
|
||||||
@ -98,4 +101,5 @@ int check_ntsec (const char *filename)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif /* HAVE_CYGWIN */
|
||||||
|
28
cygwin_util.h
Normal file
28
cygwin_util.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* cygwin_util.c
|
||||||
|
*
|
||||||
|
* Author: Corinna Vinschen <vinschen@cygnus.com>
|
||||||
|
*
|
||||||
|
* Copyright (c) 2000 Corinna Vinschen <vinschen@cygnus.com>, Duisburg, Germany
|
||||||
|
* All rights reserved
|
||||||
|
*
|
||||||
|
* Created: Sat Sep 02 12:17:00 2000 cv
|
||||||
|
*
|
||||||
|
* This file contains functions for forcing opened file descriptors to
|
||||||
|
* binary mode on Windows systems.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_CYGWIN
|
||||||
|
|
||||||
|
int binary_open(const char *filename, int flags, mode_t mode);
|
||||||
|
int binary_pipe(int fd[2]);
|
||||||
|
int check_nt_auth(int pwd_authenticated, uid_t uid);
|
||||||
|
int check_ntsec(const char *filename);
|
||||||
|
|
||||||
|
#define open binary_open
|
||||||
|
#define pipe binary_pipe
|
||||||
|
|
||||||
|
#endif /* HAVE_CYGWIN */
|
16
defines.h
16
defines.h
@ -250,6 +250,8 @@ typedef int mode_t;
|
|||||||
#ifndef _PATH_RSH
|
#ifndef _PATH_RSH
|
||||||
# ifdef RSH_PATH
|
# ifdef RSH_PATH
|
||||||
# define _PATH_RSH RSH_PATH
|
# define _PATH_RSH RSH_PATH
|
||||||
|
# else /* RSH_PATH */
|
||||||
|
# define _PATH_RSH "/usr/bin/rsh"
|
||||||
# endif /* RSH_PATH */
|
# endif /* RSH_PATH */
|
||||||
#endif /* _PATH_RSH */
|
#endif /* _PATH_RSH */
|
||||||
|
|
||||||
@ -257,6 +259,11 @@ typedef int mode_t;
|
|||||||
# define _PATH_NOLOGIN "/etc/nologin"
|
# define _PATH_NOLOGIN "/etc/nologin"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Define this to be the path of the xauth program. */
|
||||||
|
#ifndef XAUTH_PATH
|
||||||
|
#define XAUTH_PATH "/usr/X11R6/bin/xauth"
|
||||||
|
#endif /* XAUTH_PATH */
|
||||||
|
|
||||||
/* Macros */
|
/* Macros */
|
||||||
|
|
||||||
#if defined(HAVE_LOGIN_GETCAPBOOL) && defined(HAVE_LOGIN_CAP_H)
|
#if defined(HAVE_LOGIN_GETCAPBOOL) && defined(HAVE_LOGIN_CAP_H)
|
||||||
@ -332,6 +339,15 @@ typedef int mode_t;
|
|||||||
# define getpgrp() getpgrp(0)
|
# define getpgrp() getpgrp(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define this to use pipes instead of socketpairs for communicating with the
|
||||||
|
* client program. Socketpairs do not seem to work on all systems.
|
||||||
|
*
|
||||||
|
* configure.in sets this for a few OS's which are known to have problems
|
||||||
|
* but you may need to set it yourself
|
||||||
|
*/
|
||||||
|
/* #define USE_PIPES 1 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** login recorder definitions
|
** login recorder definitions
|
||||||
**/
|
**/
|
||||||
|
34
includes.h
34
includes.h
@ -46,10 +46,10 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#ifdef HAVE_CYGWIN
|
|
||||||
|
#ifdef HAVE_GETOPT_H
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_BSTRING_H
|
#ifdef HAVE_BSTRING_H
|
||||||
# include <bstring.h>
|
# include <bstring.h>
|
||||||
#endif
|
#endif
|
||||||
@ -90,34 +90,8 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
/* OpenBSD function replacements */
|
|
||||||
#include "openbsd-compat.h"
|
#include "openbsd-compat.h"
|
||||||
|
#include "cygwin_util.h"
|
||||||
/* Entropy collection */
|
|
||||||
#include "entropy.h"
|
#include "entropy.h"
|
||||||
|
|
||||||
/* Define this to be the path of the xauth program. */
|
#endif /* INCLUDES_H */
|
||||||
#ifndef XAUTH_PATH
|
|
||||||
#define XAUTH_PATH "/usr/X11R6/bin/xauth"
|
|
||||||
#endif /* XAUTH_PATH */
|
|
||||||
|
|
||||||
/* Define this to be the path of the rsh program. */
|
|
||||||
#ifndef _PATH_RSH
|
|
||||||
#define _PATH_RSH "/usr/bin/rsh"
|
|
||||||
#endif /* _PATH_RSH */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Define this to use pipes instead of socketpairs for communicating with the
|
|
||||||
* client program. Socketpairs do not seem to work on all systems.
|
|
||||||
*/
|
|
||||||
/* #define USE_PIPES 1 */
|
|
||||||
|
|
||||||
#ifdef HAVE_CYGWIN
|
|
||||||
#define open binary_open
|
|
||||||
#define pipe binary_pipe
|
|
||||||
extern int binary_open();
|
|
||||||
extern int binary_pipe();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* INCLUDES_H */
|
|
||||||
|
20
next-posix.h
20
next-posix.h
@ -10,7 +10,7 @@
|
|||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
|
|
||||||
/* readdir() returns struct direct (BSD) not struct dirent (POSIX) */
|
/* readdir() returns struct direct (BSD) not struct dirent (POSIX) */
|
||||||
#define dirent direct
|
#define dirent direct
|
||||||
|
|
||||||
/* POSIX utime() struct */
|
/* POSIX utime() struct */
|
||||||
struct utimbuf {
|
struct utimbuf {
|
||||||
@ -19,7 +19,7 @@ struct utimbuf {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* FILE */
|
/* FILE */
|
||||||
#define O_NONBLOCK 00004 /* non-blocking open */
|
#define O_NONBLOCK 00004 /* non-blocking open */
|
||||||
|
|
||||||
/* WAITPID */
|
/* WAITPID */
|
||||||
#undef WIFEXITED
|
#undef WIFEXITED
|
||||||
@ -29,8 +29,8 @@ struct utimbuf {
|
|||||||
#define WIFEXITED(w) (!((w) & 0377))
|
#define WIFEXITED(w) (!((w) & 0377))
|
||||||
#define WIFSTOPPED(w) ((w) & 0100)
|
#define WIFSTOPPED(w) ((w) & 0100)
|
||||||
#define WIFSIGNALED(w) (!WIFEXITED(w) && !WIFSTOPPED(w))
|
#define WIFSIGNALED(w) (!WIFEXITED(w) && !WIFSTOPPED(w))
|
||||||
#define WEXITSTATUS(w) (int)(WIFEXITED(w) ? ((w >> 8) & 0377) : -1)
|
#define WEXITSTATUS(w) (int)(WIFEXITED(w) ? (((w) >> 8) & 0377) : -1)
|
||||||
#define WTERMSIG(w) (int)(WIFSIGNALED(w) ? (w & 0177) : -1)
|
#define WTERMSIG(w) (int)(WIFSIGNALED(w) ? ((w) & 0177) : -1)
|
||||||
#define WCOREFLAG 0x80
|
#define WCOREFLAG 0x80
|
||||||
#define WCOREDUMP(w) ((w) & WCOREFLAG)
|
#define WCOREDUMP(w) ((w) & WCOREFLAG)
|
||||||
|
|
||||||
@ -42,17 +42,17 @@ pid_t posix_wait(int *status); /* new wait() */
|
|||||||
#define wait posix_wait
|
#define wait posix_wait
|
||||||
|
|
||||||
/* MISC functions */
|
/* MISC functions */
|
||||||
int waitpid(int pid,int *stat_loc,int options);
|
int waitpid(int pid, int *stat_loc, int options);
|
||||||
pid_t setsid(void);
|
pid_t setsid(void);
|
||||||
|
|
||||||
/* TC */
|
/* TERMCAP */
|
||||||
int tcgetattr(int fd,struct termios *t);
|
int tcgetattr(int fd, struct termios *t);
|
||||||
int tcsetattr(int fd,int opt,const struct termios *t);
|
int tcsetattr(int fd, int opt, const struct termios *t);
|
||||||
int tcsetpgrp(int fd, pid_t pgrp);
|
int tcsetpgrp(int fd, pid_t pgrp);
|
||||||
speed_t cfgetospeed(const struct termios *t);
|
speed_t cfgetospeed(const struct termios *t);
|
||||||
speed_t cfgetispeed(const struct termios *t);
|
speed_t cfgetispeed(const struct termios *t);
|
||||||
int cfsetospeed(struct termios *t,int speed);
|
int cfsetospeed(struct termios *t, int speed);
|
||||||
|
|
||||||
|
|
||||||
#endif /* HAVE_NEXT */
|
#endif /* HAVE_NEXT */
|
||||||
|
|
||||||
#endif /* _NEXT_POSIX_H */
|
#endif /* _NEXT_POSIX_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user