- (stevesk) Add initial support for setproctitle(). Current
support is for the HP-UX pstat(PSTAT_SETCMD, ...) method.
This commit is contained in:
parent
b5628647ad
commit
8848b249ff
|
@ -1,3 +1,7 @@
|
||||||
|
20001018
|
||||||
|
- (stevesk) Add initial support for setproctitle(). Current
|
||||||
|
support is for the HP-UX pstat(PSTAT_SETCMD, ...) method.
|
||||||
|
|
||||||
20001017
|
20001017
|
||||||
- (djm) Add -lregex to cywin libs from Corinna Vinschen
|
- (djm) Add -lregex to cywin libs from Corinna Vinschen
|
||||||
<vinschen@cygnus.com>
|
<vinschen@cygnus.com>
|
||||||
|
|
|
@ -37,7 +37,7 @@ TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-agen
|
||||||
|
|
||||||
LIBSSH_OBJS=atomicio.o authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o cli.o compat.o compress.o crc32.o cygwin_util.o deattack.o dispatch.o dsa.o hmac.o hostfile.o key.o kex.o log.o match.o mpaux.o nchan.o packet.o radix.o rijndael.o entropy.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o util.o uuencode.o xmalloc.o
|
LIBSSH_OBJS=atomicio.o authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o cli.o compat.o compress.o crc32.o cygwin_util.o deattack.o dispatch.o dsa.o hmac.o hostfile.o key.o kex.o log.o match.o mpaux.o nchan.o packet.o radix.o rijndael.o entropy.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o util.o uuencode.o xmalloc.o
|
||||||
|
|
||||||
LIBOPENBSD_COMPAT_OBJS=bsd-arc4random.o bsd-base64.o bsd-bindresvport.o bsd-daemon.o bsd-getcwd.o bsd-inet_aton.o bsd-inet_ntoa.o bsd-misc.o bsd-mktemp.o bsd-realpath.o bsd-rresvport.o bsd-setenv.o bsd-sigaction.o bsd-snprintf.o bsd-strlcat.o bsd-strlcpy.o bsd-strsep.o bsd-strtok.o bsd-vis.o fake-getaddrinfo.o fake-getnameinfo.o next-posix.o
|
LIBOPENBSD_COMPAT_OBJS=bsd-arc4random.o bsd-base64.o bsd-bindresvport.o bsd-daemon.o bsd-getcwd.o bsd-inet_aton.o bsd-inet_ntoa.o bsd-misc.o bsd-mktemp.o bsd-realpath.o bsd-rresvport.o bsd-setenv.o bsd-sigaction.o bsd-snprintf.o bsd-strlcat.o bsd-strlcpy.o bsd-strsep.o bsd-strtok.o bsd-vis.o bsd-setproctitle.o fake-getaddrinfo.o fake-getnameinfo.o next-posix.o
|
||||||
|
|
||||||
SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o
|
SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
|
|
||||||
@TOP@
|
@TOP@
|
||||||
|
|
||||||
|
/* Define to a Set Process Title type if your system is */
|
||||||
|
/* supported by bsd-setproctitle.c */
|
||||||
|
#undef SPT_TYPE
|
||||||
|
|
||||||
/* SCO workaround */
|
/* SCO workaround */
|
||||||
#undef BROKEN_SYS_TERMIO_H
|
#undef BROKEN_SYS_TERMIO_H
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,6 @@
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
|
|
||||||
#ifndef HAVE_SETPROCTITLE
|
|
||||||
void setproctitle(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
/* FIXME */
|
|
||||||
}
|
|
||||||
#endif /* !HAVE_SETPROCTITLE */
|
|
||||||
|
|
||||||
#ifndef HAVE_SETLOGIN
|
#ifndef HAVE_SETLOGIN
|
||||||
int setlogin(const char *name)
|
int setlogin(const char *name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,10 +27,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef HAVE_SETPROCTITLE
|
|
||||||
void setproctitle(const char *fmt, ...);
|
|
||||||
#endif /* !HAVE_SETPROCTITLE */
|
|
||||||
|
|
||||||
#ifndef HAVE_SETENV
|
#ifndef HAVE_SETENV
|
||||||
int setenv(const char *name, const char *value, int overwrite);
|
int setenv(const char *name, const char *value, int overwrite);
|
||||||
#endif /* !HAVE_SETENV */
|
#endif /* !HAVE_SETENV */
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
* Modified for OpenSSH by Kevin Steves
|
||||||
|
* October 2000
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1994, 1995 Christopher G. Demetriou
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by Christopher G. Demetriou
|
||||||
|
* for the NetBSD Project.
|
||||||
|
* 4. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
|
static char rcsid[] = "$OpenBSD: setproctitle.c,v 1.7 1999/02/25 22:10:12 art Exp $";
|
||||||
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
|
#ifndef HAVE_SETPROCTITLE
|
||||||
|
|
||||||
|
#include "includes.h"
|
||||||
|
|
||||||
|
#define SPT_NONE 0
|
||||||
|
#define SPT_PSTAT 1
|
||||||
|
|
||||||
|
#ifndef SPT_TYPE
|
||||||
|
#define SPT_TYPE SPT_NONE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SPT_TYPE == SPT_PSTAT
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/pstat.h>
|
||||||
|
#endif /* SPT_TYPE == SPT_PSTAT */
|
||||||
|
|
||||||
|
#define MAX_PROCTITLE 2048
|
||||||
|
|
||||||
|
#ifdef HAVE___PROGNAME
|
||||||
|
extern char *__progname;
|
||||||
|
#else
|
||||||
|
static const char *__progname = "sshd";
|
||||||
|
#endif /* HAVE___PROGNAME */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set Process Title (SPT) defines. Modeled after sendmail's
|
||||||
|
* SPT type definition strategy.
|
||||||
|
*
|
||||||
|
* SPT_TYPE:
|
||||||
|
*
|
||||||
|
* SPT_NONE: Don't set the process title. Default.
|
||||||
|
* SPT_PSTAT: Use pstat(PSTAT_SETCMD). HP-UX specific.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
setproctitle(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
#if SPT_TYPE != SPT_NONE
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
char buf[MAX_PROCTITLE];
|
||||||
|
size_t used;
|
||||||
|
|
||||||
|
#if SPT_TYPE == SPT_PSTAT
|
||||||
|
union pstun pst;
|
||||||
|
#endif /* SPT_TYPE == SPT_PSTAT */
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
if (fmt != NULL) {
|
||||||
|
used = snprintf(buf, MAX_PROCTITLE, "%s: ", __progname);
|
||||||
|
if (used >= MAX_PROCTITLE)
|
||||||
|
used = MAX_PROCTITLE - 1;
|
||||||
|
(void)vsnprintf(buf + used, MAX_PROCTITLE - used, fmt, ap);
|
||||||
|
} else
|
||||||
|
(void)snprintf(buf, MAX_PROCTITLE, "%s", __progname);
|
||||||
|
va_end(ap);
|
||||||
|
used = strlen(buf);
|
||||||
|
|
||||||
|
#if SPT_TYPE == SPT_PSTAT
|
||||||
|
pst.pst_command = buf;
|
||||||
|
pstat(PSTAT_SETCMD, pst, used, 0, 0);
|
||||||
|
#endif /* SPT_TYPE == SPT_PSTAT */
|
||||||
|
|
||||||
|
#endif /* SPT_TYPE != SPT_NONE */
|
||||||
|
}
|
||||||
|
#endif /* HAVE_SETPROCTITLE */
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef _BSD_SETPROCTITLE_H
|
||||||
|
#define _BSD_SETPROCTITLE_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_SETPROCTITLE
|
||||||
|
void setproctitle(const char *fmt, ...);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _BSD_SETPROCTITLE_H */
|
|
@ -78,6 +78,7 @@ case "$host" in
|
||||||
AC_DEFINE(USE_PIPES)
|
AC_DEFINE(USE_PIPES)
|
||||||
AC_DEFINE(DISABLE_SHADOW)
|
AC_DEFINE(DISABLE_SHADOW)
|
||||||
AC_DEFINE(DISABLE_UTMP)
|
AC_DEFINE(DISABLE_UTMP)
|
||||||
|
AC_DEFINE(SPT_TYPE,SPT_PSTAT)
|
||||||
LIBS="$LIBS -lsec"
|
LIBS="$LIBS -lsec"
|
||||||
MANTYPE='$(CATMAN)'
|
MANTYPE='$(CATMAN)'
|
||||||
mansubdir=cat
|
mansubdir=cat
|
||||||
|
@ -88,6 +89,7 @@ case "$host" in
|
||||||
AC_DEFINE(USE_PIPES)
|
AC_DEFINE(USE_PIPES)
|
||||||
AC_DEFINE(DISABLE_SHADOW)
|
AC_DEFINE(DISABLE_SHADOW)
|
||||||
AC_DEFINE(DISABLE_UTMP)
|
AC_DEFINE(DISABLE_UTMP)
|
||||||
|
AC_DEFINE(SPT_TYPE,SPT_PSTAT)
|
||||||
LIBS="$LIBS -lsec"
|
LIBS="$LIBS -lsec"
|
||||||
MANTYPE='$(CATMAN)'
|
MANTYPE='$(CATMAN)'
|
||||||
mansubdir=cat
|
mansubdir=cat
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "bsd-strsep.h"
|
#include "bsd-strsep.h"
|
||||||
#include "bsd-strtok.h"
|
#include "bsd-strtok.h"
|
||||||
#include "bsd-vis.h"
|
#include "bsd-vis.h"
|
||||||
|
#include "bsd-setproctitle.h"
|
||||||
|
|
||||||
/* rfc2553 socket API replacements */
|
/* rfc2553 socket API replacements */
|
||||||
#include "fake-getaddrinfo.h"
|
#include "fake-getaddrinfo.h"
|
||||||
|
|
Loading…
Reference in New Issue