diff options
author | wtc%google.com <devnull@localhost> | 2012-11-17 01:33:59 +0000 |
---|---|---|
committer | wtc%google.com <devnull@localhost> | 2012-11-17 01:33:59 +0000 |
commit | 391c55ca5b98fb71d1e84d97f89fc696f095e264 (patch) | |
tree | c17c09cbf4080a5641be82a5f9dbd0242b16f677 | |
parent | 1caee61782c52f75172334be4f06a7452321e5dc (diff) | |
download | nss-hg-391c55ca5b98fb71d1e84d97f89fc696f095e264.tar.gz |
Bug 812399: Bring back the fix for bug 641052, which was partially lost
when bug 753116 was fixed. r=rrelyea.
Modified Files:
utilmod.c utilpars.c
-rw-r--r-- | security/nss/lib/util/utilmod.c | 23 | ||||
-rw-r--r-- | security/nss/lib/util/utilpars.c | 8 |
2 files changed, 21 insertions, 10 deletions
diff --git a/security/nss/lib/util/utilmod.c b/security/nss/lib/util/utilmod.c index daf061fce..3595e2917 100644 --- a/security/nss/lib/util/utilmod.c +++ b/security/nss/lib/util/utilmod.c @@ -115,15 +115,19 @@ char *_NSSUTIL_GetOldSecmodName(const char *dbname,const char *filename) char *sep; sep = PORT_Strrchr(dirPath,*NSSUTIL_PATH_SEPARATOR); -#ifdef WINDOWS +#ifdef _WIN32 if (!sep) { + /* utilparst.h defines NSSUTIL_PATH_SEPARATOR as "/" for all + * platforms. */ sep = PORT_Strrchr(dirPath,'\\'); } #endif if (sep) { - *(sep)=0; + *sep = 0; + file = PR_smprintf("%s"NSSUTIL_PATH_SEPARATOR"%s", dirPath, filename); + } else { + file = PR_smprintf("%s", filename); } - file= PR_smprintf("%s"NSSUTIL_PATH_SEPARATOR"%s", dirPath, filename); PORT_Free(dirPath); return file; } @@ -177,14 +181,13 @@ nssutil_ReadSecmodDB(NSSDBType dbType, const char *appName, char *paramsValue=NULL; PRBool failed = PR_TRUE; - if (dbname == NULL) { - PORT_SetError(SEC_ERROR_INVALID_ARGS); - return NULL; - } - moduleList = (char **) PORT_ZAlloc(useCount*sizeof(char **)); if (moduleList == NULL) return NULL; + if (dbname == NULL) { + goto return_default; + } + /* do we really want to use streams here */ fd = fopen(dbname, "r"); if (fd == NULL) goto done; @@ -351,7 +354,7 @@ done: goto bail; } - /* old one doesn't exist */ + /* old one exists */ status = PR_Access(olddbname, PR_ACCESS_EXISTS); if (status == PR_SUCCESS) { PR_smprintf_free(olddbname); @@ -364,6 +367,8 @@ bail: PR_smprintf_free(olddbname); } } + +return_default: if (!moduleList[0]) { char * newParams; diff --git a/security/nss/lib/util/utilpars.c b/security/nss/lib/util/utilpars.c index 5f94ca751..4bb2d3ff9 100644 --- a/security/nss/lib/util/utilpars.c +++ b/security/nss/lib/util/utilpars.c @@ -1064,6 +1064,7 @@ _NSSUTIL_GetSecmodName(char *param, NSSDBType *dbType, char **appName, char *value = NULL; char *save_params = param; const char *lconfigdir; + PRBool noModDB = PR_FALSE; param = NSSUTIL_ArgStrip(param); @@ -1088,7 +1089,10 @@ _NSSUTIL_GetSecmodName(char *param, NSSDBType *dbType, char **appName, if (NSSUTIL_ArgHasFlag("flags","noModDB",save_params)) { /* there isn't a module db, don't load the legacy support */ + noModDB = PR_TRUE; *dbType = NSS_DB_TYPE_SQL; + PORT_Free(*filename); + *filename = NULL; *rw = PR_FALSE; } @@ -1098,7 +1102,9 @@ _NSSUTIL_GetSecmodName(char *param, NSSDBType *dbType, char **appName, secmodName="pkcs11.txt"; } - if (lconfigdir) { + if (noModDB) { + value = NULL; + } else if (lconfigdir && lconfigdir[0] != '\0') { value = PR_smprintf("%s" NSSUTIL_PATH_SEPARATOR "%s", lconfigdir,secmodName); } else { |