File bug-226387_unenc_pwd.patch of Package turnpike
Index: VPNClient/CommonUI/vpncExtCert.c
===================================================================
--- VPNClient/CommonUI/vpncExtCert.c.orig
+++ VPNClient/CommonUI/vpncExtCert.c
@@ -34,6 +34,8 @@
#include <netdb.h>
#include "CommonUI.h"
#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
/* cli headers */
#include "vpncExtCert.h"
@@ -65,9 +67,11 @@ static int openFilesToReadAndWrite(const
{
extern Inf_t Inf;
+ mode_t old_mask = umask (0177);
if (!(fpx = fopen(pfxFilePath, "rb")))
{
+ umask (old_mask);
#ifdef __DEBUG__
fprintf(stderr, "Error opening file %s\n", pfxFilePath);
#endif
@@ -76,6 +80,7 @@ static int openFilesToReadAndWrite(const
if (!(fpp = fopen(Inf.userPvtKey, "w")))
{
+ umask (old_mask);
#ifdef __DEBUG__
fprintf(stderr, "Error opening file %s\n", Inf.userPvtKey);
#endif
@@ -84,6 +89,7 @@ static int openFilesToReadAndWrite(const
if (!(fpc = fopen(Inf.userCert, "w")))
{
+ umask (old_mask);
#ifdef __DEBUG__
fprintf(stderr, "Error opening file %s\n", Inf.userCert);
#endif
@@ -92,12 +98,14 @@ static int openFilesToReadAndWrite(const
#ifdef __WANT_CA__
if (!(fpca = fopen(CACERT, "w")))
{
+ umask (old_mask);
#ifdef __DEBUG__
fprintf(stderr, "Error opening file %s\n", CACERT);
#endif
return VPNC_ERR_DCRT_CRTCACERTFL;
}
#endif
+ umask (old_mask);
return 0;
}