- (stevek) Reworked progname support.

- (bal) Misplaced #include "includes.h" in bsd-setproctitle.c.  Patch by
   Shinichi Maruyama <marya@st.jip.co.jp>

I assume the progname patch was finished.  I believe stevek is on vacation,
but it passes compiling under Linux and NeXTStep.
This commit is contained in:
Ben Lindstrom 2000-11-17 03:47:20 +00:00
Родитель baaa2c05dd
Коммит 49a79c0976
15 изменённых файлов: 78 добавлений и 47 удалений

Просмотреть файл

@ -1,6 +1,9 @@
20001117
- (bal) Changed from 'primes' to 'primes.out' for consistancy sake. It
has no affect the output. Patch by Corinna Vinschen <vinschen@redhat.com>
- (stevek) Reworked progname support.
- (bal) Misplaced #include "includes.h" in bsd-setproctitle.c. Patch by
Shinichi Maruyama <marya@st.jip.co.jp>
20001116
- (bal) Added in MAXSYMLINK test in bsd-realpath.c. Required for some SCO

Просмотреть файл

@ -26,6 +26,26 @@
#include "xmalloc.h"
#include "ssh.h"
char *get_progname(char *argv0)
{
#ifdef HAVE___PROGNAME
extern char *__progname;
return __progname;
#else
char *p;
if (argv0 == NULL)
return "unknown"; /* XXX */
p = strrchr(argv0, '/');
if (p == NULL)
p = argv0;
else
p++;
return p;
#endif
}
#ifndef HAVE_SETLOGIN
int setlogin(const char *name)
{

Просмотреть файл

@ -27,11 +27,12 @@
#include "config.h"
char *get_progname(char *argv0);
#ifndef HAVE_SETSID
#define setsid() setpgrp(0, getpid())
#endif /* !HAVE_SETSID */
#ifndef HAVE_SETENV
int setenv(const char *name, const char *value, int overwrite);
#endif /* !HAVE_SETENV */

Просмотреть файл

@ -38,10 +38,10 @@
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"
#ifndef HAVE_SETPROCTITLE
#define SPT_NONE 0
#define SPT_PSTAT 1
@ -56,11 +56,7 @@ static char rcsid[] = "$OpenBSD: setproctitle.c,v 1.7 1999/02/25 22:10:12 art Ex
#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

Просмотреть файл

@ -43,12 +43,6 @@ RCSID("$OpenBSD: log-server.c,v 1.17 2000/09/12 20:53:10 markus Exp $");
#include "xmalloc.h"
#include "ssh.h"
#ifdef HAVE___PROGNAME
extern char *__progname;
#else /* HAVE___PROGNAME */
static const char *__progname = "sshd";
#endif /* HAVE___PROGNAME */
static LogLevel log_level = SYSLOG_LEVEL_INFO;
static int log_on_stderr = 0;
static int log_facility = LOG_AUTH;
@ -129,6 +123,7 @@ do_log(LogLevel level, const char *fmt, va_list args)
char fmtbuf[MSGBUFSIZ];
char *txt = NULL;
int pri = LOG_INFO;
extern char *__progname;
if (level > log_level)
return;

8
scp.c
Просмотреть файл

@ -84,6 +84,12 @@ RCSID("$OpenBSD: scp.c,v 1.43 2000/10/18 18:23:02 markus Exp $");
#define _PATH_CP "cp"
#endif
#ifdef HAVE___PROGNAME
extern char *__progname;
#else
char *__progname;
#endif
/* For progressmeter() -- number of seconds before xfer considered "stalled" */
#define STALLTIME 5
@ -249,6 +255,8 @@ main(argc, argv)
extern char *optarg;
extern int optind;
__progname = get_progname(argv[0]);
args.list = NULL;
addargs("ssh"); /* overwritten with ssh_program */
addargs("-x");

Просмотреть файл

@ -58,6 +58,9 @@ RCSID("$OpenBSD: session.c,v 1.43 2000/11/06 23:04:56 markus Exp $");
#ifdef WITH_IRIX_JOBS
#include <sys/resource.h>
#endif
#ifdef WITH_IRIX_AUDIT
#include <sat.h>
#endif /* WITH_IRIX_AUDIT */
#if defined(HAVE_USERSEC_H)
#include <usersec.h>
@ -131,12 +134,7 @@ do_child(const char *command, struct passwd * pw, const char *term,
/* import */
extern ServerOptions options;
#ifdef HAVE___PROGNAME
extern char *__progname;
#else /* HAVE___PROGNAME */
static const char *__progname = "sshd";
#endif /* HAVE___PROGNAME */
extern int log_stderr;
extern int debug_flag;
extern unsigned int utmp_len;
@ -1104,7 +1102,6 @@ do_child(const char *command, struct passwd * pw, const char *term,
strerror(errno));
}
# endif /* WITH_IRIX_JOBS */
# ifdef WITH_IRIX_ARRAY
/* initialize array session */
if (jid == 0) {
@ -1123,6 +1120,14 @@ do_child(const char *command, struct passwd * pw, const char *term,
fatal("Failed to initialize project %d for %s: %.100s",
(int)projid, pw->pw_name, strerror(errno));
# endif /* WITH_IRIX_PROJECT */
#ifdef WITH_IRIX_AUDIT
if (sysconf(_SC_AUDIT)) {
debug("Setting sat id to %d", (int) pw->pw_uid);
if (satsetid(pw->pw_uid))
debug("error setting satid: %.100s", strerror(errno));
}
#endif /* WITH_IRIX_AUDIT */
/* Permanently switch to the desired uid. */
permanently_set_uid(pw->pw_uid);
# endif /* HAVE_LOGIN_CAP */

Просмотреть файл

@ -90,6 +90,12 @@ RCSID("$OpenBSD: sftp-server.c,v 1.6 2000/09/07 20:27:53 deraadt Exp $");
#define get_string(lenp) buffer_get_string(&iqueue, lenp);
#define TRACE log
#ifdef HAVE___PROGNAME
extern char *__progname;
#else
char *__progname;
#endif
/* input and output queue */
Buffer iqueue;
Buffer oqueue;
@ -1015,6 +1021,7 @@ main(int ac, char **av)
int in, out, max;
ssize_t len, olen;
__progname = get_progname(av[0]);
handle_init();
in = dup(STDIN_FILENO);

Просмотреть файл

@ -50,9 +50,9 @@ RCSID("$OpenBSD: ssh-add.c,v 1.23 2000/11/12 19:50:38 markus Exp $");
#ifdef HAVE___PROGNAME
extern char *__progname;
#else /* HAVE___PROGNAME */
static const char *__progname = "ssh-add";
#endif /* HAVE___PROGNAME */
#else
char *__progname;
#endif
void
delete_file(AuthenticationConnection *ac, const char *filename)
@ -249,6 +249,7 @@ main(int argc, char **argv)
int i;
int deleting = 0;
__progname = get_progname(argv[0]);
init_rng();
SSLeay_add_all_algorithms();

Просмотреть файл

@ -93,9 +93,9 @@ char socket_dir[1024];
#ifdef HAVE___PROGNAME
extern char *__progname;
#else /* HAVE___PROGNAME */
static const char *__progname = "ssh-agent";
#endif /* HAVE___PROGNAME */
#else
char *__progname;
#endif
void
idtab_init(void)
@ -672,6 +672,7 @@ main(int ac, char **av)
char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid];
extern int optind;
__progname = get_progname(av[0]);
init_rng();
#ifdef __GNU_LIBRARY__

Просмотреть файл

@ -74,9 +74,9 @@ char *key_type_name = NULL;
/* argv0 */
#ifdef HAVE___PROGNAME
extern char *__progname;
#else /* HAVE___PROGNAME */
static const char *__progname = "ssh-keygen";
#endif /* HAVE___PROGNAME */
#else
char *__progname;
#endif
char hostname[MAXHOSTNAMELEN];
@ -610,6 +610,7 @@ main(int ac, char **av)
extern int optind;
extern char *optarg;
__progname = get_progname(av[0]);
init_rng();
SSLeay_add_all_algorithms();

7
ssh.c
Просмотреть файл

@ -62,9 +62,9 @@ RCSID("$OpenBSD: ssh.c,v 1.72 2000/11/12 19:50:38 markus Exp $");
#ifdef HAVE___PROGNAME
extern char *__progname;
#else /* HAVE___PROGNAME */
static const char *__progname = "ssh";
#endif /* HAVE___PROGNAME */
#else
char *__progname;
#endif
/* Flag indicating whether IPv4 or IPv6. This can be set on the command line.
Default value is AF_UNSPEC means both IPv4 and IPv6. */
@ -237,6 +237,7 @@ main(int ac, char **av)
int dummy;
uid_t original_effective_uid;
__progname = get_progname(av[0]);
init_rng();
/*

Просмотреть файл

@ -35,11 +35,7 @@ char *client_version_string = NULL;
char *server_version_string = NULL;
extern Options options;
#ifdef HAVE___PROGNAME
extern char *__progname;
#else /* HAVE___PROGNAME */
static const char *__progname = "ssh";
#endif /* HAVE___PROGNAME */
/*
* Connect to the given ssh server using a proxy command.

7
sshd.c
Просмотреть файл

@ -78,6 +78,12 @@ int deny_severity = LOG_WARNING;
#define O_NOCTTY 0
#endif
#ifdef HAVE___PROGNAME
extern char *__progname;
#else
char *__progname;
#endif
/* Server configuration options. */
ServerOptions options;
@ -562,6 +568,7 @@ main(int ac, char **av)
int startup_p[2];
int startups = 0;
__progname = get_progname(av[0]);
init_rng();
/* Save argv[0]. */

Просмотреть файл

@ -16,9 +16,6 @@ RCSID("$OpenBSD: uidswap.c,v 1.9 2000/09/07 20:27:55 deraadt Exp $");
#include "ssh.h"
#include "uidswap.h"
#ifdef WITH_IRIX_AUDIT
#include <sat.h>
#endif /* WITH_IRIX_AUDIT */
/*
* Note: all these functions must work in all of the following cases:
@ -91,14 +88,6 @@ restore_uid()
void
permanently_set_uid(uid_t uid)
{
#ifdef WITH_IRIX_AUDIT
if (sysconf(_SC_AUDIT)) {
debug("Setting sat id to %d", (int) uid);
if (satsetid(uid))
debug("error setting satid: %.100s", strerror(errno));
}
#endif /* WITH_IRIX_AUDIT */
if (setuid(uid) < 0)
debug("setuid %u: %.100s", (u_int) uid, strerror(errno));
}