-/* $OpenBSD: ssh.c,v 1.602 2024/12/06 16:21:48 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.603 2025/02/10 23:19:26 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/wait.h>
+#include <sys/utsname.h>
#include <ctype.h>
#include <errno.h>
struct ssh *ssh = NULL;
int i, r, opt, exit_status, use_syslog, direct, timeout_ms;
int was_addr, config_test = 0, opt_terminated = 0, want_final_pass = 0;
- char *p, *cp, *line, *argv0, *logfile;
+ char *p, *cp, *line, *argv0, *logfile, *args;
char cname[NI_MAXHOST], thishost[NI_MAXHOST];
struct stat st;
struct passwd *pw;
struct addrinfo *addrs = NULL;
size_t n, len;
u_int j;
+ struct utsname utsname;
struct ssh_conn_info *cinfo = NULL;
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
fatal("Couldn't allocate session state");
channel_init_channels(ssh);
+
/* Parse command-line arguments. */
+ args = argv_assemble(ac, av); /* logged later */
host = NULL;
use_syslog = 0;
logfile = NULL;
SYSLOG_FACILITY_USER : options.log_facility,
!use_syslog);
- if (debug_flag)
- logit("%s, %s", SSH_RELEASE, SSH_OPENSSL_VERSION);
+ debug("%s, %s", SSH_RELEASE, SSH_OPENSSL_VERSION);
+ if (uname(&utsname) != 0) {
+ memset(&utsname, 0, sizeof(utsname));
+ strlcpy(utsname.sysname, "UNKNOWN", sizeof(utsname.sysname));
+ }
+ debug3("Running on %s %s %s %s", utsname.sysname, utsname.release,
+ utsname.version, utsname.machine);
+ debug3("Started with: %s", args);
+ free(args);
/* Parse the configuration files */
process_config_files(options.host_arg, pw, 0, &want_final_pass);
-/* $OpenBSD: sshd.c,v 1.614 2024/12/07 10:12:19 djm Exp $ */
+/* $OpenBSD: sshd.c,v 1.615 2025/02/10 23:19:26 djm Exp $ */
/*
* Copyright (c) 2000, 2001, 2002 Markus Friedl. All rights reserved.
* Copyright (c) 2002 Niels Provos. All rights reserved.
#include "openbsd-compat/sys-tree.h"
#include "openbsd-compat/sys-queue.h"
#include <sys/wait.h>
+#include <sys/utsname.h>
#include <errno.h>
#include <fcntl.h>
int sock_in = -1, sock_out = -1, newsock = -1, rexec_argc = 0;
int devnull, config_s[2] = { -1 , -1 }, have_connection_info = 0;
int need_chroot = 1;
- char *fp, *line, *logfile = NULL, **rexec_argv = NULL;
+ char *args, *fp, *line, *logfile = NULL, **rexec_argv = NULL;
struct stat sb;
u_int i, j;
mode_t new_umask;
struct sshkey *key;
struct sshkey *pubkey;
struct connection_info connection_info;
+ struct utsname utsname;
sigset_t sigmask;
memset(&connection_info, 0, sizeof(connection_info));
initialize_server_options(&options);
/* Parse command-line arguments. */
+ args = argv_assemble(ac, av); /* logged later */
while ((opt = getopt(ac, av,
"C:E:b:c:f:g:h:k:o:p:u:46DGQRTdeiqrtV")) != -1) {
switch (opt) {
fatal("Config test connection parameter (-C) provided without "
"test mode (-T)");
+ debug("sshd version %s, %s", SSH_VERSION, SSH_OPENSSL_VERSION);
+ if (uname(&utsname) != 0) {
+ memset(&utsname, 0, sizeof(utsname));
+ strlcpy(utsname.sysname, "UNKNOWN", sizeof(utsname.sysname));
+ }
+ debug3("Running on %s %s %s %s", utsname.sysname, utsname.release,
+ utsname.version, utsname.machine);
+ debug3("Started with: %s", args);
+ free(args);
+
/* Fetch our configuration */
if ((cfg = sshbuf_new()) == NULL)
fatal("sshbuf_new config failed");
exit(1);
}
- debug("sshd version %s, %s", SSH_VERSION, SSH_OPENSSL_VERSION);
-
if (do_dump_cfg)
print_config(&connection_info);