vishalmishra434 / rpms / openssh

Forked from rpms/openssh 4 months ago
Clone
6ec986
diff -up openssh-9.9p1/log.c.xxx openssh-9.9p1/log.c
6ec986
--- openssh-9.9p1/log.c.xxx	2024-10-22 11:55:44.281939275 +0200
6ec986
+++ openssh-9.9p1/log.c	2024-10-22 11:56:16.709676267 +0200
6ec986
@@ -52,6 +52,9 @@
6ec986
 
6ec986
 #include "log.h"
6ec986
 #include "match.h"
6ec986
+#ifdef WITH_OPENSSL
6ec986
+#include <openssl/err.h>
6ec986
+#endif
6ec986
 
6ec986
 static LogLevel log_level = SYSLOG_LEVEL_INFO;
6ec986
 static int log_on_stderr = 1;
6ec986
@@ -438,6 +438,26 @@ sshlog(const char *file, const char *fun
6ec986
 	va_end(args);
6ec986
 }
6ec986
 
6ec986
+#ifdef WITH_OPENSSL
6ec986
+static int
6ec986
+openssl_error_print_cb(const char *str, size_t len, void *u)
6ec986
+{
6ec986
+	sshlogdirect(SYSLOG_LEVEL_DEBUG1, 0, "openssl error %s", str);
6ec986
+	return 0;
6ec986
+}
6ec986
+#endif
6ec986
+
6ec986
+void
6ec986
+sshlog_openssl(int r)
6ec986
+{
6ec986
+#ifdef WITH_OPENSSL
6ec986
+	if (r != SSH_ERR_LIBCRYPTO_ERROR) return;
6ec986
+
6ec986
+	ERR_print_errors_cb(openssl_error_print_cb, NULL);
6ec986
+#endif
6ec986
+	return;
6ec986
+}
6ec986
+
6ec986
 void
6ec986
 sshlogdie(const char *file, const char *func, int line, int showfunc,
6ec986
     LogLevel level, const char *suffix, const char *fmt, ...)
6ec986
diff -up openssh-8.7p1/log.h.xxx openssh-8.7p1/log.h
6ec986
--- openssh-8.7p1/log.h.xxx	2024-10-18 12:56:18.944971946 +0200
6ec986
+++ openssh-8.7p1/log.h	2024-10-18 13:03:38.324351416 +0200
6ec986
@@ -71,6 +71,7 @@ void	 cleanup_exit(int) __attribute__((n
6ec986
 void	 sshlog(const char *, const char *, int, int,
6ec986
     LogLevel, const char *, const char *, ...)
6ec986
     __attribute__((format(printf, 7, 8)));
6ec986
+void	 sshlog_openssl(int);
6ec986
 void	 sshlogv(const char *, const char *, int, int,
6ec986
     LogLevel, const char *, const char *, va_list);
6ec986
 void	 sshlogdie(const char *, const char *, int, int,
6ec986
diff -up openssh-8.7p1/auth2-pubkey.c.yyy openssh-8.7p1/auth2-pubkey.c
6ec986
--- openssh-8.7p1/auth2-pubkey.c.yyy	2024-10-18 13:27:00.709055845 +0200
6ec986
+++ openssh-8.7p1/auth2-pubkey.c	2024-10-18 13:27:31.638784460 +0200
6ec986
@@ -131,6 +131,7 @@ userauth_pubkey(struct ssh *ssh)
6ec986
 		goto done;
6ec986
 	}
6ec986
 	if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) {
6ec986
+		sshlog_openssl(r);
6ec986
 		error_fr(r, "parse key");
6ec986
 		goto done;
6ec986
 	}
6ec986
diff -up openssh-8.7p1/dispatch.c.yyy openssh-8.7p1/dispatch.c
6ec986
--- openssh-8.7p1/dispatch.c.yyy	2024-10-18 13:27:56.349366570 +0200
6ec986
+++ openssh-8.7p1/dispatch.c	2024-10-18 13:28:17.921874757 +0200
6ec986
@@ -130,6 +130,8 @@ ssh_dispatch_run_fatal(struct ssh *ssh,
6ec986
 {
6ec986
 	int r;
6ec986
 
6ec986
-	if ((r = ssh_dispatch_run(ssh, mode, done)) != 0)
6ec986
+	if ((r = ssh_dispatch_run(ssh, mode, done)) != 0) {
6ec986
+		sshlog_openssl(r);
6ec986
 		sshpkt_fatal(ssh, r, "%s", __func__);
6ec986
+	}
6ec986
 }