- (stevesk) OpenSSH CVS update:

- markus@cvs.openbsd.org 2000/12/12 15:30:02
     [ssh-keyscan.c ssh.c sshd.c]
     consistently use __progname; from stevesk@pobox.com
This commit is contained in:
Kevin Steves 2000-12-13 17:45:15 +00:00
parent 152cea206a
commit ec84dc12db
4 changed files with 24 additions and 36 deletions

View File

@ -1,6 +1,10 @@
20001213
- (djm) Make sure we reset the SIGPIPE disposition after we fork. Report
from Andreas M. Kirchwitz <amk@krell.zikzak.de>
- (stevesk) OpenSSH CVS update:
- markus@cvs.openbsd.org 2000/12/12 15:30:02
[ssh-keyscan.c ssh.c sshd.c]
consistently use __progname; from stevesk@pobox.com
20001211
- (bal) Applied patch to include ssh-keyscan into Redhat's package, and

View File

@ -40,7 +40,11 @@ int timeout = 5;
int maxfd;
#define maxcon (maxfd - 10)
char *prog;
#ifdef HAVE___PROGNAME
extern char *__progname;
#else
char *__progname;
#endif
fd_set read_wait;
int ncon;
@ -544,7 +548,7 @@ nexthost(int argc, char **argv)
static void
usage(void)
{
fatal("usage: %s [-t timeout] { [--] host | -f file } ...\n", prog);
fatal("usage: %s [-t timeout] { [--] host | -f file } ...\n", __progname);
return;
}
@ -553,13 +557,9 @@ main(int argc, char **argv)
{
char *host = NULL;
__progname = get_progname(argv[0]);
TAILQ_INIT(&tq);
if ((prog = strrchr(argv[0], '/')))
prog++;
else
prog = argv[0];
if (argc <= argno)
usage();
@ -580,11 +580,11 @@ main(int argc, char **argv)
maxfd = fdlim_get(1);
if (maxfd < 0)
fatal("%s: fdlim_get: bad value\n", prog);
fatal("%s: fdlim_get: bad value\n", __progname);
if (maxfd > MAXMAXFD)
maxfd = MAXMAXFD;
if (maxcon <= 0)
fatal("%s: not enough file descriptors\n", prog);
fatal("%s: not enough file descriptors\n", __progname);
if (maxfd > fdlim_get(0))
fdlim_set(maxfd);
fdcon = xmalloc(maxfd * sizeof(con));

15
ssh.c
View File

@ -121,9 +121,6 @@ struct sockaddr_storage hostaddr;
*/
volatile int received_window_change_signal = 0;
/* Value of argv[0] (set in the main program). */
char *av0;
/* Flag indicating whether we have a valid host private key loaded. */
int host_private_key_loaded = 0;
@ -141,7 +138,7 @@ Buffer command;
void
usage()
{
fprintf(stderr, "Usage: %s [options] host [command]\n", av0);
fprintf(stderr, "Usage: %s [options] host [command]\n", __progname);
fprintf(stderr, "Options:\n");
fprintf(stderr, " -l user Log in using this user name.\n");
fprintf(stderr, " -n Redirect input from /dev/null.\n");
@ -169,7 +166,7 @@ usage()
fprintf(stderr, " -p port Connect to this port. Server must be on the same port.\n");
fprintf(stderr, " -L listen-port:host:port Forward local port to remote address\n");
fprintf(stderr, " -R listen-port:host:port Forward remote port to local address\n");
fprintf(stderr, " These cause %s to listen for connections on a port, and\n", av0);
fprintf(stderr, " These cause %s to listen for connections on a port, and\n", __progname);
fprintf(stderr, " forward them to the other side by connecting to host:port.\n");
fprintf(stderr, " -C Enable compression.\n");
fprintf(stderr, " -N Do not execute a shell or command.\n");
@ -273,9 +270,6 @@ main(int ac, char **av)
*/
umask(022);
/* Save our own name. */
av0 = av[0];
/* Initialize option structure to indicate that no values have been set. */
initialize_options(&options);
@ -283,10 +277,7 @@ main(int ac, char **av)
host = NULL;
/* If program name is not one of the standard names, use it as host name. */
if (strchr(av0, '/'))
cp = strrchr(av0, '/') + 1;
else
cp = av0;
cp = __progname;
#ifdef HAVE_CYGWIN
if (strcasecmp(cp, "rsh") && strcasecmp(cp, "ssh") &&
strcasecmp(cp, "rlogin") && strcasecmp(cp, "slogin") &&

23
sshd.c
View File

@ -117,9 +117,6 @@ int no_daemon_flag = 0;
/* debug goes to stderr unless inetd_flag is set */
int log_stderr = 0;
/* argv[0] without path. */
char *av0;
/* Saved arguments to main(). */
char **saved_argv;
int saved_argc;
@ -215,7 +212,7 @@ sighup_restart()
log("Received SIGHUP; restarting.");
close_listen_socks();
execv(saved_argv[0], saved_argv);
log("RESTART FAILED: av0='%s', error: %s.", av0, strerror(errno));
log("RESTART FAILED: av[0]='%.100s', error: %.100s.", saved_argv[0], strerror(errno));
exit(1);
}
@ -574,13 +571,9 @@ main(int ac, char **av)
__progname = get_progname(av[0]);
init_rng();
/* Save argv[0]. */
/* Save argv. */
saved_argc = ac;
saved_argv = av;
if (strchr(av[0], '/'))
av0 = strrchr(av[0], '/') + 1;
else
av0 = av[0];
/* Initialize configuration options to their default values. */
initialize_server_options(&options);
@ -655,7 +648,7 @@ main(int ac, char **av)
case '?':
default:
fprintf(stderr, "sshd version %s\n", SSH_VERSION);
fprintf(stderr, "Usage: %s [options]\n", av0);
fprintf(stderr, "Usage: %s [options]\n", __progname);
fprintf(stderr, "Options:\n");
fprintf(stderr, " -f file Configuration file (default %s)\n", SERVER_CONFIG_FILE);
fprintf(stderr, " -d Debugging mode (multiple -d means more debugging)\n");
@ -678,7 +671,7 @@ main(int ac, char **av)
* Force logging to stderr until we have loaded the private host
* key (unless started from inetd)
*/
log_init(av0,
log_init(__progname,
options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level,
options.log_facility == -1 ? SYSLOG_FACILITY_AUTH : options.log_facility,
!silent && !inetd_flag);
@ -768,7 +761,7 @@ main(int ac, char **av)
/* Initialize the log (it is reinitialized below in case we forked). */
if (debug_flag && !inetd_flag)
log_stderr = 1;
log_init(av0, options.log_level, options.log_facility, log_stderr);
log_init(__progname, options.log_level, options.log_facility, log_stderr);
/*
* If not in debugging mode, and not started from inetd, disconnect
@ -792,7 +785,7 @@ main(int ac, char **av)
#endif /* TIOCNOTTY */
}
/* Reinitialize the log (because of the fork above). */
log_init(av0, options.log_level, options.log_facility, log_stderr);
log_init(__progname, options.log_level, options.log_facility, log_stderr);
/* Initialize the random number generator. */
arc4random_stir();
@ -1031,7 +1024,7 @@ main(int ac, char **av)
close_listen_socks();
sock_in = newsock;
sock_out = newsock;
log_init(av0, options.log_level, options.log_facility, log_stderr);
log_init(__progname, options.log_level, options.log_facility, log_stderr);
break;
}
}
@ -1098,7 +1091,7 @@ main(int ac, char **av)
{
struct request_info req;
request_init(&req, RQ_DAEMON, av0, RQ_FILE, sock_in, NULL);
request_init(&req, RQ_DAEMON, __progname, RQ_FILE, sock_in, NULL);
fromhost(&req);
if (!hosts_access(&req)) {