From e6149dee47c1410dd15afc6c7064acdbaf6a3766 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Thu, 11 Feb 2016 15:11:36 +0000 Subject: [PATCH] fix build failure with GCC 6 (#1306632) Resolves: rhbz#1306632 --- crypto-utils.spec | 5 ++++- keyutil.c | 49 ++++++++++++----------------------------------- 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/crypto-utils.spec b/crypto-utils.spec index 3a47b96..9df7a45 100644 --- a/crypto-utils.spec +++ b/crypto-utils.spec @@ -4,7 +4,7 @@ Summary: SSL certificate and key management utilities Name: crypto-utils Version: 2.4.1 -Release: 60%{?dist} +Release: 61%{?dist} Group: Applications/System # certwatch.c is GPLv2 # pemutil.c etc are (MPLv1.1+ or GPLv2+ or LPGLv2+) @@ -135,6 +135,9 @@ chmod -R u+w $RPM_BUILD_ROOT %{perl_vendorarch}/auto/Crypt %changelog +* Thu Feb 11 2016 Joe Orton - 2.4.1-61 +- fix build failure with GCC 6 (#1306632) + * Wed Feb 03 2016 Fedora Release Engineering - 2.4.1-60 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/keyutil.c b/keyutil.c index 16d1c10..1a6f380 100644 --- a/keyutil.c +++ b/keyutil.c @@ -673,7 +673,6 @@ CertReq(SECKEYPrivateKey *privk, SECKEYPublicKey *pubk, KeyType keyType, /* Encode request in specified format */ if (ascii) { char *obuf; - char *name, *email, *org, *state, *country; SECItem *it; int total; @@ -682,43 +681,19 @@ CertReq(SECKEYPrivateKey *privk, SECKEYPublicKey *pubk, KeyType keyType, obuf = BTOA_ConvertItemToAscii(it); total = PL_strlen(obuf); - name = CERT_GetCommonName(subject); - if (!name) { - name = strdup("(not specified)"); + PR_fprintf(outFile, "%s\n", NS_CERTREQ_HEADER); + numBytes = PR_Write(outFile, obuf, total); + if (numBytes != total) { + SECU_PrintSystemError(progName, "write error"); + return SECFailure; + } + PR_fprintf(outFile, "\n%s\n", NS_CERTREQ_TRAILER); + } else { + numBytes = PR_Write(outFile, result.data, result.len); + if (numBytes != (int)result.len) { + SECU_PrintSystemError(progName, "write error"); + return SECFailure; } - - if (!phone) - phone = strdup("(not specified)"); - - email = CERT_GetCertEmailAddress(subject); - if (!email) - email = strdup("(not specified)"); - - org = CERT_GetOrgName(subject); - if (!org) - org = strdup("(not specified)"); - - state = CERT_GetStateName(subject); - if (!state) - state = strdup("(not specified)"); - - country = CERT_GetCountryName(subject); - if (!country) - country = strdup("(not specified)"); - - PR_fprintf(outFile, "%s\n", NS_CERTREQ_HEADER); - numBytes = PR_Write(outFile, obuf, total); - if (numBytes != total) { - SECU_PrintSystemError(progName, "write error"); - return SECFailure; - } - PR_fprintf(outFile, "\n%s\n", NS_CERTREQ_TRAILER); - } else { - numBytes = PR_Write(outFile, result.data, result.len); - if (numBytes != (int)result.len) { - SECU_PrintSystemError(progName, "write error"); - return SECFailure; - } } return SECSuccess; }