From a9731a320bf360b1ce11455d9e2f0888f2749131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Hon=C4=9Bk?= Date: Wed, 4 Jul 2018 10:39:58 +0200 Subject: [PATCH] MozNSS Compat. Layer: Make log messages more clear Resolves: #1598103 --- openldap-tlsmc.patch | 46 ++++++++++++++++++++++++++++++-------------- openldap.spec | 7 ++++++- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/openldap-tlsmc.patch b/openldap-tlsmc.patch index 234b2ae..0987413 100644 --- a/openldap-tlsmc.patch +++ b/openldap-tlsmc.patch @@ -1,7 +1,7 @@ MozNSS Interception Code Author: Matus Honek -Date: Thu Jun 28 14:36:55 CEST 2018 +Date: Wed Jul 4 10:35:04 CEST 2018 diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -283,7 +283,7 @@ diff --git a/libraries/libldap/tls_mc.c b/libraries/libldap/tls_mc.c new file mode 100644 --- /dev/null +++ b/libraries/libldap/tls_mc.c -@@ -0,0 +1,1351 @@ +@@ -0,0 +1,1369 @@ +#include "portable.h" + +#ifdef HAVE_MOZNSS_COMPATIBILITY @@ -365,23 +365,33 @@ new file mode 100644 + int rv = 0; + int fd = -1; + if ( 0 > ( fd = open( filename, O_WRONLY | O_CREAT | O_EXCL, S_IWUSR ) ) ) { -+ perror("IO ERROR: could not open file"); ++ Debug( LDAP_DEBUG_ANY, ++ "tlsmc_write_file: ERROR: could not open file: `%s': %s.\n", ++ filename, strerror(errno), 0 ); + goto bail; + } + if ( -1 >= write( fd, buf, strlen(buf) ) ) { -+ perror("IO ERROR: could not write file"); ++ Debug( LDAP_DEBUG_ANY, ++ "tlsmc_write_file: ERROR: could not write file: `%s': %s.\n", ++ filename, strerror(errno), 0 ); + goto bail; + } + if ( -1 >= fchmod( fd, final_mode ) ) { -+ perror("IO ERROR: could not set file mode"); ++ Debug( LDAP_DEBUG_ANY, ++ "tlsmc_write_file: ERROR: could not set file mode: `%s': %s.\n", ++ filename, strerror(errno), 0 ); + goto bail; + } + if ( -1 >= fsync( fd ) ) { -+ perror("IO ERROR: could not fsync the file"); ++ Debug( LDAP_DEBUG_ANY, ++ "tlsmc_write_file: ERROR: could not fsync file: `%s': %s.\n", ++ filename, strerror(errno), 0 ); + goto bail; + } + if ( 0 > close( fd ) ) { -+ perror("IO ERROR: could not close file"); ++ Debug( LDAP_DEBUG_ANY, ++ "tlsmc_write_file: ERROR: could not close file: `%s': %s.\n", ++ filename, strerror(errno), 0 ); + fd = -1; + goto bail; + } @@ -845,7 +855,9 @@ new file mode 100644 + goto bail; + } + if ( 0 == strftime(stime, sizeof(stime), "%FT%T", localtime(&attr.st_mtime)) ) { -+ perror("IO ERROR: could not format mtime"); ++ Debug( LDAP_DEBUG_ANY, ++ "tlsmc_filestamp: ERROR: could not format mtime: %s.\n", ++ strerror(errno), 0, 0 ); + goto bail; + } + @@ -932,7 +944,6 @@ new file mode 100644 + Debug( LDAP_DEBUG_ANY, + "tlsmc_prepare_dir: WARN: could not create the PEM directory.\n", + 0, 0, 0 ); -+ perror( "tlsmc_prepare_dir: WARN: could not create the PEM directory" ); + rv = 0; + goto bail; + } @@ -945,7 +956,6 @@ new file mode 100644 + Debug( LDAP_DEBUG_ANY, + "tlsmc_prepare_dir: WARN: could not create the subdirectory.\n", + 0, 0, 0 ); -+ perror( "tlsmc_prepare_dir: WARN: could not create the subdirectory" ); + rv = 0; + goto bail; + } @@ -1236,11 +1246,15 @@ new file mode 100644 + "tlsmc_extract_cert_key_pair: INFO: symlinking certificate file `%s' to file `%s'.\n", + nickname, cert_file_path, 0 ); + if ( NULL == ( file_realpath = realpath( nickname, NULL ) ) ) { -+ perror( "Could not get the realpath" ); ++ Debug( LDAP_DEBUG_ANY, ++ "tlsmc_extract_cert_key_pair: ERROR: could not get realpath of certificate file `%s'.\n", ++ nickname, 0, 0 ); + goto bail; + } + if ( -1 == symlink( file_realpath, cert_file_path ) ) { -+ perror( "Could not create a symlink" ); ++ Debug( LDAP_DEBUG_ANY, ++ "tlsmc_extract_cert_key_pair: ERROR: could not create a symlink of `%s' to `%s'.\n", ++ file_realpath, cert_file_path, 0 ); + goto bail; + } + if ( file_realpath ) free( file_realpath ); @@ -1249,11 +1263,15 @@ new file mode 100644 + "tlsmc_extract_cert_key_pair: INFO: symlinking PK file `%s' to file `%s'.\n", + pin_filename, key_file_path, 0 ); + if ( NULL == ( file_realpath = realpath( pin_filename, NULL ) ) ) { -+ perror( "Could not get the realpath" ); ++ Debug( LDAP_DEBUG_ANY, ++ "tlsmc_extract_cert_key_pair: ERROR: could not get realpath of PK file `%s'.\n", ++ pin_filename, 0, 0 ); + goto bail; + } + if ( -1 == symlink( file_realpath, key_file_path ) ) { -+ perror( "Could not create a symlink" ); ++ Debug( LDAP_DEBUG_ANY, ++ "tlsmc_extract_cert_key_pair: ERROR: could not create a symlink of `%s' to `%s'.\n", ++ file_realpath, key_file_path, 0 ); + goto bail; + } + } diff --git a/openldap.spec b/openldap.spec index 8c60e4d..b7879cb 100644 --- a/openldap.spec +++ b/openldap.spec @@ -12,7 +12,7 @@ Name: openldap Version: 2.4.46 -Release: 1%{?dist} +Release: 2%{?dist} Summary: LDAP support libraries License: OpenLDAP URL: http://www.openldap.org/ @@ -504,6 +504,11 @@ exit 0 %{_mandir}/man3/* %changelog +* Wed Jul 4 2018 Matus Honek - 2.4.46-2 +- MozNSS Compat. Layer: Make log messages more clear (#1598103) +- MozNSS Compat. Layer: Fix memleaks reported by valgrind (#1595203) +- MozNSS Compat. Layer: Fix typos, and spelling in the README file header (#1564161) + * Tue Mar 27 2018 Matus Honek - 2.4.46-1 - Rebase to version OpenLDAP 2.4.46 (#1559652)