From a26fdbdf9102866a791c8028e591a8cb4dd754a4 Mon Sep 17 00:00:00 2001 From: imaginos Date: Sun, 9 Oct 2005 07:01:14 +0000 Subject: [PATCH] need to make a different serial on each generation git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@546 726aef4b-f618-498e-8847-2d620e286838 --- Utils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Utils.cpp b/Utils.cpp index 5a4fb499..d753618a 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -45,7 +45,10 @@ void CUtils::GenerateCert(FILE *pOut, bool bEncPrivKey) { EVP_PKEY *pKey = NULL; X509 *pCert = NULL; X509_NAME *pName = NULL; - int serial = 0, days = 365; + int days = 365; + + u_int iSeed = time( NULL ); + int serial = ( rand_r( &iSeed ) % 9999 ); RSA *pRSA = RSA_generate_key(1024, 0x10001, NULL, NULL); if( ( pKey = EVP_PKEY_new() ) ) {