diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | bsd-misc.c | 20 | ||||
-rw-r--r-- | bsd-misc.h | 3 | ||||
-rw-r--r-- | bsd-setproctitle.c | 8 | ||||
-rw-r--r-- | log-server.c | 7 | ||||
-rw-r--r-- | scp.c | 8 | ||||
-rw-r--r-- | session.c | 19 | ||||
-rw-r--r-- | sftp-server.c | 7 | ||||
-rw-r--r-- | ssh-add.c | 7 | ||||
-rw-r--r-- | ssh-agent.c | 7 | ||||
-rw-r--r-- | ssh-keygen.c | 7 | ||||
-rw-r--r-- | ssh.c | 7 | ||||
-rw-r--r-- | sshconnect.c | 4 | ||||
-rw-r--r-- | sshd.c | 7 | ||||
-rw-r--r-- | uidswap.c | 11 |
15 files changed, 78 insertions, 47 deletions
@@ -1,6 +1,9 @@ | |||
1 | 20001117 | 1 | 20001117 |
2 | - (bal) Changed from 'primes' to 'primes.out' for consistancy sake. It | 2 | - (bal) Changed from 'primes' to 'primes.out' for consistancy sake. It |
3 | has no affect the output. Patch by Corinna Vinschen <vinschen@redhat.com> | 3 | has no affect the output. Patch by Corinna Vinschen <vinschen@redhat.com> |
4 | - (stevek) Reworked progname support. | ||
5 | - (bal) Misplaced #include "includes.h" in bsd-setproctitle.c. Patch by | ||
6 | Shinichi Maruyama <marya@st.jip.co.jp> | ||
4 | 7 | ||
5 | 20001116 | 8 | 20001116 |
6 | - (bal) Added in MAXSYMLINK test in bsd-realpath.c. Required for some SCO | 9 | - (bal) Added in MAXSYMLINK test in bsd-realpath.c. Required for some SCO |
diff --git a/bsd-misc.c b/bsd-misc.c index 59814946c..2a0596593 100644 --- a/bsd-misc.c +++ b/bsd-misc.c | |||
@@ -26,6 +26,26 @@ | |||
26 | #include "xmalloc.h" | 26 | #include "xmalloc.h" |
27 | #include "ssh.h" | 27 | #include "ssh.h" |
28 | 28 | ||
29 | char *get_progname(char *argv0) | ||
30 | { | ||
31 | #ifdef HAVE___PROGNAME | ||
32 | extern char *__progname; | ||
33 | |||
34 | return __progname; | ||
35 | #else | ||
36 | char *p; | ||
37 | |||
38 | if (argv0 == NULL) | ||
39 | return "unknown"; /* XXX */ | ||
40 | p = strrchr(argv0, '/'); | ||
41 | if (p == NULL) | ||
42 | p = argv0; | ||
43 | else | ||
44 | p++; | ||
45 | return p; | ||
46 | #endif | ||
47 | } | ||
48 | |||
29 | #ifndef HAVE_SETLOGIN | 49 | #ifndef HAVE_SETLOGIN |
30 | int setlogin(const char *name) | 50 | int setlogin(const char *name) |
31 | { | 51 | { |
diff --git a/bsd-misc.h b/bsd-misc.h index ae2b3ffff..d8376562a 100644 --- a/bsd-misc.h +++ b/bsd-misc.h | |||
@@ -27,11 +27,12 @@ | |||
27 | 27 | ||
28 | #include "config.h" | 28 | #include "config.h" |
29 | 29 | ||
30 | char *get_progname(char *argv0); | ||
31 | |||
30 | #ifndef HAVE_SETSID | 32 | #ifndef HAVE_SETSID |
31 | #define setsid() setpgrp(0, getpid()) | 33 | #define setsid() setpgrp(0, getpid()) |
32 | #endif /* !HAVE_SETSID */ | 34 | #endif /* !HAVE_SETSID */ |
33 | 35 | ||
34 | |||
35 | #ifndef HAVE_SETENV | 36 | #ifndef HAVE_SETENV |
36 | int setenv(const char *name, const char *value, int overwrite); | 37 | int setenv(const char *name, const char *value, int overwrite); |
37 | #endif /* !HAVE_SETENV */ | 38 | #endif /* !HAVE_SETENV */ |
diff --git a/bsd-setproctitle.c b/bsd-setproctitle.c index 51a642e85..38eca9ad7 100644 --- a/bsd-setproctitle.c +++ b/bsd-setproctitle.c | |||
@@ -38,10 +38,10 @@ | |||
38 | static char rcsid[] = "$OpenBSD: setproctitle.c,v 1.7 1999/02/25 22:10:12 art Exp $"; | 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 */ | 39 | #endif /* LIBC_SCCS and not lint */ |
40 | 40 | ||
41 | #ifndef HAVE_SETPROCTITLE | ||
42 | |||
43 | #include "includes.h" | 41 | #include "includes.h" |
44 | 42 | ||
43 | #ifndef HAVE_SETPROCTITLE | ||
44 | |||
45 | #define SPT_NONE 0 | 45 | #define SPT_NONE 0 |
46 | #define SPT_PSTAT 1 | 46 | #define SPT_PSTAT 1 |
47 | 47 | ||
@@ -56,11 +56,7 @@ static char rcsid[] = "$OpenBSD: setproctitle.c,v 1.7 1999/02/25 22:10:12 art Ex | |||
56 | 56 | ||
57 | #define MAX_PROCTITLE 2048 | 57 | #define MAX_PROCTITLE 2048 |
58 | 58 | ||
59 | #ifdef HAVE___PROGNAME | ||
60 | extern char *__progname; | 59 | extern char *__progname; |
61 | #else | ||
62 | static const char *__progname = "sshd"; | ||
63 | #endif /* HAVE___PROGNAME */ | ||
64 | 60 | ||
65 | /* | 61 | /* |
66 | * Set Process Title (SPT) defines. Modeled after sendmail's | 62 | * Set Process Title (SPT) defines. Modeled after sendmail's |
diff --git a/log-server.c b/log-server.c index 270a3c698..de3d5cfeb 100644 --- a/log-server.c +++ b/log-server.c | |||
@@ -43,12 +43,6 @@ RCSID("$OpenBSD: log-server.c,v 1.17 2000/09/12 20:53:10 markus Exp $"); | |||
43 | #include "xmalloc.h" | 43 | #include "xmalloc.h" |
44 | #include "ssh.h" | 44 | #include "ssh.h" |
45 | 45 | ||
46 | #ifdef HAVE___PROGNAME | ||
47 | extern char *__progname; | ||
48 | #else /* HAVE___PROGNAME */ | ||
49 | static const char *__progname = "sshd"; | ||
50 | #endif /* HAVE___PROGNAME */ | ||
51 | |||
52 | static LogLevel log_level = SYSLOG_LEVEL_INFO; | 46 | static LogLevel log_level = SYSLOG_LEVEL_INFO; |
53 | static int log_on_stderr = 0; | 47 | static int log_on_stderr = 0; |
54 | static int log_facility = LOG_AUTH; | 48 | static int log_facility = LOG_AUTH; |
@@ -129,6 +123,7 @@ do_log(LogLevel level, const char *fmt, va_list args) | |||
129 | char fmtbuf[MSGBUFSIZ]; | 123 | char fmtbuf[MSGBUFSIZ]; |
130 | char *txt = NULL; | 124 | char *txt = NULL; |
131 | int pri = LOG_INFO; | 125 | int pri = LOG_INFO; |
126 | extern char *__progname; | ||
132 | 127 | ||
133 | if (level > log_level) | 128 | if (level > log_level) |
134 | return; | 129 | return; |
@@ -84,6 +84,12 @@ RCSID("$OpenBSD: scp.c,v 1.43 2000/10/18 18:23:02 markus Exp $"); | |||
84 | #define _PATH_CP "cp" | 84 | #define _PATH_CP "cp" |
85 | #endif | 85 | #endif |
86 | 86 | ||
87 | #ifdef HAVE___PROGNAME | ||
88 | extern char *__progname; | ||
89 | #else | ||
90 | char *__progname; | ||
91 | #endif | ||
92 | |||
87 | /* For progressmeter() -- number of seconds before xfer considered "stalled" */ | 93 | /* For progressmeter() -- number of seconds before xfer considered "stalled" */ |
88 | #define STALLTIME 5 | 94 | #define STALLTIME 5 |
89 | 95 | ||
@@ -249,6 +255,8 @@ main(argc, argv) | |||
249 | extern char *optarg; | 255 | extern char *optarg; |
250 | extern int optind; | 256 | extern int optind; |
251 | 257 | ||
258 | __progname = get_progname(argv[0]); | ||
259 | |||
252 | args.list = NULL; | 260 | args.list = NULL; |
253 | addargs("ssh"); /* overwritten with ssh_program */ | 261 | addargs("ssh"); /* overwritten with ssh_program */ |
254 | addargs("-x"); | 262 | addargs("-x"); |
@@ -57,7 +57,10 @@ RCSID("$OpenBSD: session.c,v 1.43 2000/11/06 23:04:56 markus Exp $"); | |||
57 | #endif /* WITH_IRIX_PROJECT */ | 57 | #endif /* WITH_IRIX_PROJECT */ |
58 | #ifdef WITH_IRIX_JOBS | 58 | #ifdef WITH_IRIX_JOBS |
59 | #include <sys/resource.h> | 59 | #include <sys/resource.h> |
60 | #endif | 60 | #endif |
61 | #ifdef WITH_IRIX_AUDIT | ||
62 | #include <sat.h> | ||
63 | #endif /* WITH_IRIX_AUDIT */ | ||
61 | 64 | ||
62 | #if defined(HAVE_USERSEC_H) | 65 | #if defined(HAVE_USERSEC_H) |
63 | #include <usersec.h> | 66 | #include <usersec.h> |
@@ -131,12 +134,7 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
131 | 134 | ||
132 | /* import */ | 135 | /* import */ |
133 | extern ServerOptions options; | 136 | extern ServerOptions options; |
134 | #ifdef HAVE___PROGNAME | ||
135 | extern char *__progname; | 137 | extern char *__progname; |
136 | #else /* HAVE___PROGNAME */ | ||
137 | static const char *__progname = "sshd"; | ||
138 | #endif /* HAVE___PROGNAME */ | ||
139 | |||
140 | extern int log_stderr; | 138 | extern int log_stderr; |
141 | extern int debug_flag; | 139 | extern int debug_flag; |
142 | extern unsigned int utmp_len; | 140 | extern unsigned int utmp_len; |
@@ -1104,7 +1102,6 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
1104 | strerror(errno)); | 1102 | strerror(errno)); |
1105 | } | 1103 | } |
1106 | # endif /* WITH_IRIX_JOBS */ | 1104 | # endif /* WITH_IRIX_JOBS */ |
1107 | |||
1108 | # ifdef WITH_IRIX_ARRAY | 1105 | # ifdef WITH_IRIX_ARRAY |
1109 | /* initialize array session */ | 1106 | /* initialize array session */ |
1110 | if (jid == 0) { | 1107 | if (jid == 0) { |
@@ -1123,6 +1120,14 @@ do_child(const char *command, struct passwd * pw, const char *term, | |||
1123 | fatal("Failed to initialize project %d for %s: %.100s", | 1120 | fatal("Failed to initialize project %d for %s: %.100s", |
1124 | (int)projid, pw->pw_name, strerror(errno)); | 1121 | (int)projid, pw->pw_name, strerror(errno)); |
1125 | # endif /* WITH_IRIX_PROJECT */ | 1122 | # endif /* WITH_IRIX_PROJECT */ |
1123 | #ifdef WITH_IRIX_AUDIT | ||
1124 | if (sysconf(_SC_AUDIT)) { | ||
1125 | debug("Setting sat id to %d", (int) pw->pw_uid); | ||
1126 | if (satsetid(pw->pw_uid)) | ||
1127 | debug("error setting satid: %.100s", strerror(errno)); | ||
1128 | } | ||
1129 | #endif /* WITH_IRIX_AUDIT */ | ||
1130 | |||
1126 | /* Permanently switch to the desired uid. */ | 1131 | /* Permanently switch to the desired uid. */ |
1127 | permanently_set_uid(pw->pw_uid); | 1132 | permanently_set_uid(pw->pw_uid); |
1128 | # endif /* HAVE_LOGIN_CAP */ | 1133 | # endif /* HAVE_LOGIN_CAP */ |
diff --git a/sftp-server.c b/sftp-server.c index 538e5e267..fb6f0131b 100644 --- a/sftp-server.c +++ b/sftp-server.c | |||
@@ -90,6 +90,12 @@ RCSID("$OpenBSD: sftp-server.c,v 1.6 2000/09/07 20:27:53 deraadt Exp $"); | |||
90 | #define get_string(lenp) buffer_get_string(&iqueue, lenp); | 90 | #define get_string(lenp) buffer_get_string(&iqueue, lenp); |
91 | #define TRACE log | 91 | #define TRACE log |
92 | 92 | ||
93 | #ifdef HAVE___PROGNAME | ||
94 | extern char *__progname; | ||
95 | #else | ||
96 | char *__progname; | ||
97 | #endif | ||
98 | |||
93 | /* input and output queue */ | 99 | /* input and output queue */ |
94 | Buffer iqueue; | 100 | Buffer iqueue; |
95 | Buffer oqueue; | 101 | Buffer oqueue; |
@@ -1015,6 +1021,7 @@ main(int ac, char **av) | |||
1015 | int in, out, max; | 1021 | int in, out, max; |
1016 | ssize_t len, olen; | 1022 | ssize_t len, olen; |
1017 | 1023 | ||
1024 | __progname = get_progname(av[0]); | ||
1018 | handle_init(); | 1025 | handle_init(); |
1019 | 1026 | ||
1020 | in = dup(STDIN_FILENO); | 1027 | in = dup(STDIN_FILENO); |
@@ -50,9 +50,9 @@ RCSID("$OpenBSD: ssh-add.c,v 1.23 2000/11/12 19:50:38 markus Exp $"); | |||
50 | 50 | ||
51 | #ifdef HAVE___PROGNAME | 51 | #ifdef HAVE___PROGNAME |
52 | extern char *__progname; | 52 | extern char *__progname; |
53 | #else /* HAVE___PROGNAME */ | 53 | #else |
54 | static const char *__progname = "ssh-add"; | 54 | char *__progname; |
55 | #endif /* HAVE___PROGNAME */ | 55 | #endif |
56 | 56 | ||
57 | void | 57 | void |
58 | delete_file(AuthenticationConnection *ac, const char *filename) | 58 | delete_file(AuthenticationConnection *ac, const char *filename) |
@@ -249,6 +249,7 @@ main(int argc, char **argv) | |||
249 | int i; | 249 | int i; |
250 | int deleting = 0; | 250 | int deleting = 0; |
251 | 251 | ||
252 | __progname = get_progname(argv[0]); | ||
252 | init_rng(); | 253 | init_rng(); |
253 | 254 | ||
254 | SSLeay_add_all_algorithms(); | 255 | SSLeay_add_all_algorithms(); |
diff --git a/ssh-agent.c b/ssh-agent.c index 9f61aec3b..f5f87cca3 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -93,9 +93,9 @@ char socket_dir[1024]; | |||
93 | 93 | ||
94 | #ifdef HAVE___PROGNAME | 94 | #ifdef HAVE___PROGNAME |
95 | extern char *__progname; | 95 | extern char *__progname; |
96 | #else /* HAVE___PROGNAME */ | 96 | #else |
97 | static const char *__progname = "ssh-agent"; | 97 | char *__progname; |
98 | #endif /* HAVE___PROGNAME */ | 98 | #endif |
99 | 99 | ||
100 | void | 100 | void |
101 | idtab_init(void) | 101 | idtab_init(void) |
@@ -672,6 +672,7 @@ main(int ac, char **av) | |||
672 | char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid]; | 672 | char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid]; |
673 | extern int optind; | 673 | extern int optind; |
674 | 674 | ||
675 | __progname = get_progname(av[0]); | ||
675 | init_rng(); | 676 | init_rng(); |
676 | 677 | ||
677 | #ifdef __GNU_LIBRARY__ | 678 | #ifdef __GNU_LIBRARY__ |
diff --git a/ssh-keygen.c b/ssh-keygen.c index 76edc5301..3653fc244 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c | |||
@@ -74,9 +74,9 @@ char *key_type_name = NULL; | |||
74 | /* argv0 */ | 74 | /* argv0 */ |
75 | #ifdef HAVE___PROGNAME | 75 | #ifdef HAVE___PROGNAME |
76 | extern char *__progname; | 76 | extern char *__progname; |
77 | #else /* HAVE___PROGNAME */ | 77 | #else |
78 | static const char *__progname = "ssh-keygen"; | 78 | char *__progname; |
79 | #endif /* HAVE___PROGNAME */ | 79 | #endif |
80 | 80 | ||
81 | char hostname[MAXHOSTNAMELEN]; | 81 | char hostname[MAXHOSTNAMELEN]; |
82 | 82 | ||
@@ -610,6 +610,7 @@ main(int ac, char **av) | |||
610 | extern int optind; | 610 | extern int optind; |
611 | extern char *optarg; | 611 | extern char *optarg; |
612 | 612 | ||
613 | __progname = get_progname(av[0]); | ||
613 | init_rng(); | 614 | init_rng(); |
614 | 615 | ||
615 | SSLeay_add_all_algorithms(); | 616 | SSLeay_add_all_algorithms(); |
@@ -62,9 +62,9 @@ RCSID("$OpenBSD: ssh.c,v 1.72 2000/11/12 19:50:38 markus Exp $"); | |||
62 | 62 | ||
63 | #ifdef HAVE___PROGNAME | 63 | #ifdef HAVE___PROGNAME |
64 | extern char *__progname; | 64 | extern char *__progname; |
65 | #else /* HAVE___PROGNAME */ | 65 | #else |
66 | static const char *__progname = "ssh"; | 66 | char *__progname; |
67 | #endif /* HAVE___PROGNAME */ | 67 | #endif |
68 | 68 | ||
69 | /* Flag indicating whether IPv4 or IPv6. This can be set on the command line. | 69 | /* Flag indicating whether IPv4 or IPv6. This can be set on the command line. |
70 | Default value is AF_UNSPEC means both IPv4 and IPv6. */ | 70 | Default value is AF_UNSPEC means both IPv4 and IPv6. */ |
@@ -237,6 +237,7 @@ main(int ac, char **av) | |||
237 | int dummy; | 237 | int dummy; |
238 | uid_t original_effective_uid; | 238 | uid_t original_effective_uid; |
239 | 239 | ||
240 | __progname = get_progname(av[0]); | ||
240 | init_rng(); | 241 | init_rng(); |
241 | 242 | ||
242 | /* | 243 | /* |
diff --git a/sshconnect.c b/sshconnect.c index 12ca69fd6..b33f20958 100644 --- a/sshconnect.c +++ b/sshconnect.c | |||
@@ -35,11 +35,7 @@ char *client_version_string = NULL; | |||
35 | char *server_version_string = NULL; | 35 | char *server_version_string = NULL; |
36 | 36 | ||
37 | extern Options options; | 37 | extern Options options; |
38 | #ifdef HAVE___PROGNAME | ||
39 | extern char *__progname; | 38 | extern char *__progname; |
40 | #else /* HAVE___PROGNAME */ | ||
41 | static const char *__progname = "ssh"; | ||
42 | #endif /* HAVE___PROGNAME */ | ||
43 | 39 | ||
44 | /* | 40 | /* |
45 | * Connect to the given ssh server using a proxy command. | 41 | * Connect to the given ssh server using a proxy command. |
@@ -78,6 +78,12 @@ int deny_severity = LOG_WARNING; | |||
78 | #define O_NOCTTY 0 | 78 | #define O_NOCTTY 0 |
79 | #endif | 79 | #endif |
80 | 80 | ||
81 | #ifdef HAVE___PROGNAME | ||
82 | extern char *__progname; | ||
83 | #else | ||
84 | char *__progname; | ||
85 | #endif | ||
86 | |||
81 | /* Server configuration options. */ | 87 | /* Server configuration options. */ |
82 | ServerOptions options; | 88 | ServerOptions options; |
83 | 89 | ||
@@ -562,6 +568,7 @@ main(int ac, char **av) | |||
562 | int startup_p[2]; | 568 | int startup_p[2]; |
563 | int startups = 0; | 569 | int startups = 0; |
564 | 570 | ||
571 | __progname = get_progname(av[0]); | ||
565 | init_rng(); | 572 | init_rng(); |
566 | 573 | ||
567 | /* Save argv[0]. */ | 574 | /* Save argv[0]. */ |
@@ -16,9 +16,6 @@ RCSID("$OpenBSD: uidswap.c,v 1.9 2000/09/07 20:27:55 deraadt Exp $"); | |||
16 | 16 | ||
17 | #include "ssh.h" | 17 | #include "ssh.h" |
18 | #include "uidswap.h" | 18 | #include "uidswap.h" |
19 | #ifdef WITH_IRIX_AUDIT | ||
20 | #include <sat.h> | ||
21 | #endif /* WITH_IRIX_AUDIT */ | ||
22 | 19 | ||
23 | /* | 20 | /* |
24 | * Note: all these functions must work in all of the following cases: | 21 | * Note: all these functions must work in all of the following cases: |
@@ -91,14 +88,6 @@ restore_uid() | |||
91 | void | 88 | void |
92 | permanently_set_uid(uid_t uid) | 89 | permanently_set_uid(uid_t uid) |
93 | { | 90 | { |
94 | #ifdef WITH_IRIX_AUDIT | ||
95 | if (sysconf(_SC_AUDIT)) { | ||
96 | debug("Setting sat id to %d", (int) uid); | ||
97 | if (satsetid(uid)) | ||
98 | debug("error setting satid: %.100s", strerror(errno)); | ||
99 | } | ||
100 | #endif /* WITH_IRIX_AUDIT */ | ||
101 | |||
102 | if (setuid(uid) < 0) | 91 | if (setuid(uid) < 0) |
103 | debug("setuid %u: %.100s", (u_int) uid, strerror(errno)); | 92 | debug("setuid %u: %.100s", (u_int) uid, strerror(errno)); |
104 | } | 93 | } |