make the load function for the root token work

This commit is contained in:
ian.mcgreer%sun.com 2002-01-23 15:36:54 +00:00
parent d16b06dced
commit 0af7b9c087

View File

@ -32,7 +32,7 @@
* may use your version of this file under either the MPL or the * may use your version of this file under either the MPL or the
* GPL. * GPL.
* *
# $Id: nssinit.c,v 1.34 2002/01/23 04:42:21 relyea%netscape.com Exp $ # $Id: nssinit.c,v 1.35 2002/01/23 15:36:54 ian.mcgreer%sun.com Exp $
*/ */
#include <ctype.h> #include <ctype.h>
@ -273,20 +273,23 @@ static const char *dllname =
#define FILE_SEP '/' #define FILE_SEP '/'
static void static void
nss_FindExternalRoot(char *dbname) nss_FindExternalRoot(const char *dbpath)
{ {
char *path, *cp, **cur_name; char *path;
int len = PORT_Strlen(dbname); int len, path_len;
int path_len = len - 1;
path_len = PORT_Strlen(dbpath);
len = path_len + PORT_Strlen(dllname) + 2; /* FILE_SEP + NULL */
path = PORT_Alloc(len+sizeof(dllname)); path = PORT_Alloc(len);
if (path == NULL) return; if (path == NULL) return;
/* back up to the top of the directory */ /* back up to the top of the directory */
PORT_Memcpy(path,dbname,path_len); PORT_Memcpy(path,dbpath,path_len);
path[path_len++] = FILE_SEP; if (path[path_len] != FILE_SEP) {
PORT_Memcpy(&path[path_len],*cur_name,PORT_Strlen(*cur_name)+1); path[path_len++] = FILE_SEP;
}
PORT_Memcpy(&path[path_len],dllname,PORT_Strlen(dllname));
(void) SECMOD_AddNewModule("Root Certs",path, 0, 0); (void) SECMOD_AddNewModule("Root Certs",path, 0, 0);
PORT_Free(path); PORT_Free(path);
return; return;