|
|
a09104 |
diff --git a/lib/sysinit/nsssysinit.c b/lib/sysinit/nsssysinit.c
|
|
|
a09104 |
--- a/lib/sysinit/nsssysinit.c
|
|
|
a09104 |
+++ b/lib/sysinit/nsssysinit.c
|
|
|
a09104 |
@@ -1,11 +1,15 @@
|
|
|
a09104 |
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
a09104 |
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
a09104 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
a09104 |
+
|
|
|
a09104 |
+#define _GNU_SOURCE 1
|
|
|
a09104 |
+#include <stdlib.h>
|
|
|
a09104 |
+
|
|
|
a09104 |
#include "seccomon.h"
|
|
|
a09104 |
#include "prio.h"
|
|
|
a09104 |
#include "prprf.h"
|
|
|
a09104 |
#include "plhash.h"
|
|
|
a09104 |
#include "prenv.h"
|
|
|
a09104 |
|
|
|
a09104 |
/*
|
|
|
a09104 |
* The following provides a default example for operating systems to set up
|
|
|
a09104 |
@@ -37,17 +41,17 @@ testdir(char *dir)
|
|
|
a09104 |
return S_ISDIR(buf.st_mode);
|
|
|
a09104 |
}
|
|
|
a09104 |
|
|
|
a09104 |
#define NSS_USER_PATH1 "/.pki"
|
|
|
a09104 |
#define NSS_USER_PATH2 "/nssdb"
|
|
|
a09104 |
static char *
|
|
|
a09104 |
getUserDB(void)
|
|
|
a09104 |
{
|
|
|
a09104 |
- char *userdir = PR_GetEnvSecure("HOME");
|
|
|
a09104 |
+ char *userdir = secure_getenv("HOME");
|
|
|
a09104 |
char *nssdir = NULL;
|
|
|
a09104 |
|
|
|
a09104 |
if (userdir == NULL) {
|
|
|
a09104 |
return NULL;
|
|
|
a09104 |
}
|
|
|
a09104 |
|
|
|
a09104 |
nssdir = PORT_Alloc(strlen(userdir) + sizeof(NSS_USER_PATH1) + sizeof(NSS_USER_PATH2));
|
|
|
a09104 |
if (nssdir == NULL) {
|
|
|
a09104 |
@@ -129,17 +133,17 @@ userCanModifySystemDB()
|
|
|
a09104 |
#else
|
|
|
a09104 |
#error "Need to write getUserDB, SystemDB, userIsRoot, and userCanModifySystemDB functions"
|
|
|
a09104 |
#endif
|
|
|
a09104 |
#endif
|
|
|
a09104 |
|
|
|
a09104 |
static PRBool
|
|
|
a09104 |
getFIPSEnv(void)
|
|
|
a09104 |
{
|
|
|
a09104 |
- char *fipsEnv = PR_GetEnvSecure("NSS_FIPS");
|
|
|
a09104 |
+ char *fipsEnv = secure_getenv("NSS_FIPS");
|
|
|
a09104 |
if (!fipsEnv) {
|
|
|
a09104 |
return PR_FALSE;
|
|
|
a09104 |
}
|
|
|
a09104 |
if ((strcasecmp(fipsEnv, "fips") == 0) ||
|
|
|
a09104 |
(strcasecmp(fipsEnv, "true") == 0) ||
|
|
|
a09104 |
(strcasecmp(fipsEnv, "on") == 0) ||
|
|
|
a09104 |
(strcasecmp(fipsEnv, "1") == 0)) {
|
|
|
a09104 |
return PR_TRUE;
|