[openssh-commits] [openssh] 04/05: upstream: include arguments the command was invoked with, and
git+noreply at mindrot.org
git+noreply at mindrot.org
Tue Feb 11 10:35:36 AEDT 2025
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit aa1409e7a0a5605f0127651a3ba5a348666325bc
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Mon Feb 10 23:19:26 2025 +0000
upstream: include arguments the command was invoked with, and
operating system name, version and architecture in startup debugging output;
ok dtucker
OpenBSD-Commit-ID: 2a509d319aaf31a6bf9998e1842832883fbc3edd
---
ssh.c | 19 +++++++++++++++----
sshd.c | 19 +++++++++++++++----
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/ssh.c b/ssh.c
index 5cd6a603..d82f2fb8 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $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 at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -50,6 +50,7 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/wait.h>
+#include <sys/utsname.h>
#include <ctype.h>
#include <errno.h>
@@ -670,7 +671,7 @@ main(int ac, char **av)
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;
@@ -680,6 +681,7 @@ main(int ac, char **av)
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 */
@@ -738,7 +740,9 @@ main(int ac, char **av)
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;
@@ -1201,8 +1205,15 @@ main(int ac, char **av)
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);
diff --git a/sshd.c b/sshd.c
index 9cf519cf..862023e2 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -38,6 +38,7 @@
#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>
@@ -1185,13 +1186,14 @@ main(int ac, char **av)
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));
@@ -1227,6 +1229,7 @@ main(int ac, char **av)
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) {
@@ -1396,6 +1399,16 @@ main(int ac, char **av)
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");
@@ -1443,8 +1456,6 @@ main(int ac, char **av)
exit(1);
}
- debug("sshd version %s, %s", SSH_VERSION, SSH_OPENSSL_VERSION);
-
if (do_dump_cfg)
print_config(&connection_info);
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list