diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | acconfig.h | 4 | ||||
-rw-r--r-- | bsd-misc.c | 7 | ||||
-rw-r--r-- | bsd-misc.h | 4 | ||||
-rw-r--r-- | bsd-setproctitle.c | 106 | ||||
-rw-r--r-- | bsd-setproctitle.h | 10 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | openbsd-compat.h | 1 |
9 files changed, 128 insertions, 12 deletions
@@ -1,3 +1,7 @@ | |||
1 | 20001018 | ||
2 | - (stevesk) Add initial support for setproctitle(). Current | ||
3 | support is for the HP-UX pstat(PSTAT_SETCMD, ...) method. | ||
4 | |||
1 | 20001017 | 5 | 20001017 |
2 | - (djm) Add -lregex to cywin libs from Corinna Vinschen | 6 | - (djm) Add -lregex to cywin libs from Corinna Vinschen |
3 | <vinschen@cygnus.com> | 7 | <vinschen@cygnus.com> |
diff --git a/Makefile.in b/Makefile.in index a08b3731b..03c745914 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -37,7 +37,7 @@ TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-agen | |||
37 | 37 | ||
38 | 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 | 38 | 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 |
39 | 39 | ||
40 | 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 | 40 | 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 |
41 | 41 | ||
42 | SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o | 42 | SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o |
43 | 43 | ||
diff --git a/acconfig.h b/acconfig.h index 0837eb3f4..9e95f426b 100644 --- a/acconfig.h +++ b/acconfig.h | |||
@@ -6,6 +6,10 @@ | |||
6 | 6 | ||
7 | @TOP@ | 7 | @TOP@ |
8 | 8 | ||
9 | /* Define to a Set Process Title type if your system is */ | ||
10 | /* supported by bsd-setproctitle.c */ | ||
11 | #undef SPT_TYPE | ||
12 | |||
9 | /* SCO workaround */ | 13 | /* SCO workaround */ |
10 | #undef BROKEN_SYS_TERMIO_H | 14 | #undef BROKEN_SYS_TERMIO_H |
11 | 15 | ||
diff --git a/bsd-misc.c b/bsd-misc.c index 6059f5d39..59814946c 100644 --- a/bsd-misc.c +++ b/bsd-misc.c | |||
@@ -26,13 +26,6 @@ | |||
26 | #include "xmalloc.h" | 26 | #include "xmalloc.h" |
27 | #include "ssh.h" | 27 | #include "ssh.h" |
28 | 28 | ||
29 | #ifndef HAVE_SETPROCTITLE | ||
30 | void setproctitle(const char *fmt, ...) | ||
31 | { | ||
32 | /* FIXME */ | ||
33 | } | ||
34 | #endif /* !HAVE_SETPROCTITLE */ | ||
35 | |||
36 | #ifndef HAVE_SETLOGIN | 29 | #ifndef HAVE_SETLOGIN |
37 | int setlogin(const char *name) | 30 | int setlogin(const char *name) |
38 | { | 31 | { |
diff --git a/bsd-misc.h b/bsd-misc.h index 477048b74..0546ef1fe 100644 --- a/bsd-misc.h +++ b/bsd-misc.h | |||
@@ -27,10 +27,6 @@ | |||
27 | 27 | ||
28 | #include "config.h" | 28 | #include "config.h" |
29 | 29 | ||
30 | #ifndef HAVE_SETPROCTITLE | ||
31 | void setproctitle(const char *fmt, ...); | ||
32 | #endif /* !HAVE_SETPROCTITLE */ | ||
33 | |||
34 | #ifndef HAVE_SETENV | 30 | #ifndef HAVE_SETENV |
35 | int setenv(const char *name, const char *value, int overwrite); | 31 | int setenv(const char *name, const char *value, int overwrite); |
36 | #endif /* !HAVE_SETENV */ | 32 | #endif /* !HAVE_SETENV */ |
diff --git a/bsd-setproctitle.c b/bsd-setproctitle.c new file mode 100644 index 000000000..51a642e85 --- /dev/null +++ b/bsd-setproctitle.c | |||
@@ -0,0 +1,106 @@ | |||
1 | /* | ||
2 | * Modified for OpenSSH by Kevin Steves | ||
3 | * October 2000 | ||
4 | */ | ||
5 | |||
6 | /* | ||
7 | * Copyright (c) 1994, 1995 Christopher G. Demetriou | ||
8 | * All rights reserved. | ||
9 | * | ||
10 | * Redistribution and use in source and binary forms, with or without | ||
11 | * modification, are permitted provided that the following conditions | ||
12 | * are met: | ||
13 | * 1. Redistributions of source code must retain the above copyright | ||
14 | * notice, this list of conditions and the following disclaimer. | ||
15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
16 | * notice, this list of conditions and the following disclaimer in the | ||
17 | * documentation and/or other materials provided with the distribution. | ||
18 | * 3. All advertising materials mentioning features or use of this software | ||
19 | * must display the following acknowledgement: | ||
20 | * This product includes software developed by Christopher G. Demetriou | ||
21 | * for the NetBSD Project. | ||
22 | * 4. The name of the author may not be used to endorse or promote products | ||
23 | * derived from this software without specific prior written permission | ||
24 | * | ||
25 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
26 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
27 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
28 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
29 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
30 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
34 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | #if defined(LIBC_SCCS) && !defined(lint) | ||
38 | static char rcsid[] = "$OpenBSD: setproctitle.c,v 1.7 1999/02/25 22:10:12 art Exp $"; | ||
39 | #endif /* LIBC_SCCS and not lint */ | ||
40 | |||
41 | #ifndef HAVE_SETPROCTITLE | ||
42 | |||
43 | #include "includes.h" | ||
44 | |||
45 | #define SPT_NONE 0 | ||
46 | #define SPT_PSTAT 1 | ||
47 | |||
48 | #ifndef SPT_TYPE | ||
49 | #define SPT_TYPE SPT_NONE | ||
50 | #endif | ||
51 | |||
52 | #if SPT_TYPE == SPT_PSTAT | ||
53 | #include <sys/param.h> | ||
54 | #include <sys/pstat.h> | ||
55 | #endif /* SPT_TYPE == SPT_PSTAT */ | ||
56 | |||
57 | #define MAX_PROCTITLE 2048 | ||
58 | |||
59 | #ifdef HAVE___PROGNAME | ||
60 | extern char *__progname; | ||
61 | #else | ||
62 | static const char *__progname = "sshd"; | ||
63 | #endif /* HAVE___PROGNAME */ | ||
64 | |||
65 | /* | ||
66 | * Set Process Title (SPT) defines. Modeled after sendmail's | ||
67 | * SPT type definition strategy. | ||
68 | * | ||
69 | * SPT_TYPE: | ||
70 | * | ||
71 | * SPT_NONE: Don't set the process title. Default. | ||
72 | * SPT_PSTAT: Use pstat(PSTAT_SETCMD). HP-UX specific. | ||
73 | */ | ||
74 | |||
75 | void | ||
76 | setproctitle(const char *fmt, ...) | ||
77 | { | ||
78 | #if SPT_TYPE != SPT_NONE | ||
79 | va_list ap; | ||
80 | |||
81 | char buf[MAX_PROCTITLE]; | ||
82 | size_t used; | ||
83 | |||
84 | #if SPT_TYPE == SPT_PSTAT | ||
85 | union pstun pst; | ||
86 | #endif /* SPT_TYPE == SPT_PSTAT */ | ||
87 | |||
88 | va_start(ap, fmt); | ||
89 | if (fmt != NULL) { | ||
90 | used = snprintf(buf, MAX_PROCTITLE, "%s: ", __progname); | ||
91 | if (used >= MAX_PROCTITLE) | ||
92 | used = MAX_PROCTITLE - 1; | ||
93 | (void)vsnprintf(buf + used, MAX_PROCTITLE - used, fmt, ap); | ||
94 | } else | ||
95 | (void)snprintf(buf, MAX_PROCTITLE, "%s", __progname); | ||
96 | va_end(ap); | ||
97 | used = strlen(buf); | ||
98 | |||
99 | #if SPT_TYPE == SPT_PSTAT | ||
100 | pst.pst_command = buf; | ||
101 | pstat(PSTAT_SETCMD, pst, used, 0, 0); | ||
102 | #endif /* SPT_TYPE == SPT_PSTAT */ | ||
103 | |||
104 | #endif /* SPT_TYPE != SPT_NONE */ | ||
105 | } | ||
106 | #endif /* HAVE_SETPROCTITLE */ | ||
diff --git a/bsd-setproctitle.h b/bsd-setproctitle.h new file mode 100644 index 000000000..000689fac --- /dev/null +++ b/bsd-setproctitle.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef _BSD_SETPROCTITLE_H | ||
2 | #define _BSD_SETPROCTITLE_H | ||
3 | |||
4 | #include "config.h" | ||
5 | |||
6 | #ifndef HAVE_SETPROCTITLE | ||
7 | void setproctitle(const char *fmt, ...); | ||
8 | #endif | ||
9 | |||
10 | #endif /* _BSD_SETPROCTITLE_H */ | ||
diff --git a/configure.in b/configure.in index 1a57583fa..ed4d05199 100644 --- a/configure.in +++ b/configure.in | |||
@@ -78,6 +78,7 @@ case "$host" in | |||
78 | AC_DEFINE(USE_PIPES) | 78 | AC_DEFINE(USE_PIPES) |
79 | AC_DEFINE(DISABLE_SHADOW) | 79 | AC_DEFINE(DISABLE_SHADOW) |
80 | AC_DEFINE(DISABLE_UTMP) | 80 | AC_DEFINE(DISABLE_UTMP) |
81 | AC_DEFINE(SPT_TYPE,SPT_PSTAT) | ||
81 | LIBS="$LIBS -lsec" | 82 | LIBS="$LIBS -lsec" |
82 | MANTYPE='$(CATMAN)' | 83 | MANTYPE='$(CATMAN)' |
83 | mansubdir=cat | 84 | mansubdir=cat |
@@ -88,6 +89,7 @@ case "$host" in | |||
88 | AC_DEFINE(USE_PIPES) | 89 | AC_DEFINE(USE_PIPES) |
89 | AC_DEFINE(DISABLE_SHADOW) | 90 | AC_DEFINE(DISABLE_SHADOW) |
90 | AC_DEFINE(DISABLE_UTMP) | 91 | AC_DEFINE(DISABLE_UTMP) |
92 | AC_DEFINE(SPT_TYPE,SPT_PSTAT) | ||
91 | LIBS="$LIBS -lsec" | 93 | LIBS="$LIBS -lsec" |
92 | MANTYPE='$(CATMAN)' | 94 | MANTYPE='$(CATMAN)' |
93 | mansubdir=cat | 95 | mansubdir=cat |
diff --git a/openbsd-compat.h b/openbsd-compat.h index 18c67f088..0d5e7427a 100644 --- a/openbsd-compat.h +++ b/openbsd-compat.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "bsd-strsep.h" | 22 | #include "bsd-strsep.h" |
23 | #include "bsd-strtok.h" | 23 | #include "bsd-strtok.h" |
24 | #include "bsd-vis.h" | 24 | #include "bsd-vis.h" |
25 | #include "bsd-setproctitle.h" | ||
25 | 26 | ||
26 | /* rfc2553 socket API replacements */ | 27 | /* rfc2553 socket API replacements */ |
27 | #include "fake-getaddrinfo.h" | 28 | #include "fake-getaddrinfo.h" |