|
Lines 485-498
Link Here
|
| 485 |
} |
485 |
} |
| 486 |
|
486 |
|
| 487 |
|
487 |
|
| 488 |
#ifdef XP_MAC |
|
|
| 489 |
#ifdef DEBUG |
| 490 |
#define LOADABLE_CERTS_MODULE NS_LITERAL_CSTRING("NSSckbiDebug.shlb") |
| 491 |
#else |
| 492 |
#define LOADABLE_CERTS_MODULE NS_LITERAL_CSTRING("NSSckbi.shlb") |
| 493 |
#endif /*DEBUG*/ |
| 494 |
#endif /*XP_MAC*/ |
| 495 |
|
| 496 |
static void setOCSPOptions(nsIPrefBranch * pref); |
488 |
static void setOCSPOptions(nsIPrefBranch * pref); |
| 497 |
|
489 |
|
| 498 |
NS_IMETHODIMP |
490 |
NS_IMETHODIMP |
|
Lines 686-725
Link Here
|
| 686 |
|
678 |
|
| 687 |
const char *possible_ckbi_locations[] = { |
679 |
const char *possible_ckbi_locations[] = { |
| 688 |
NS_GRE_DIR, |
680 |
NS_GRE_DIR, |
| 689 |
NS_XPCOM_CURRENT_PROCESS_DIR |
681 |
NS_XPCOM_CURRENT_PROCESS_DIR, |
|
|
682 |
0 // This special value means: |
| 683 |
// search for ckbi in the directories on the shared |
| 684 |
// library/DLL search path |
| 690 |
}; |
685 |
}; |
| 691 |
|
686 |
|
| 692 |
for (size_t il = 0; il < sizeof(possible_ckbi_locations)/sizeof(const char*); ++il) { |
687 |
for (size_t il = 0; il < sizeof(possible_ckbi_locations)/sizeof(const char*); ++il) { |
| 693 |
nsCOMPtr<nsILocalFile> mozFile; |
688 |
nsCOMPtr<nsILocalFile> mozFile; |
| 694 |
directoryService->Get( possible_ckbi_locations[il], |
689 |
char *fullModuleName = nsnull; |
| 695 |
NS_GET_IID(nsILocalFile), |
690 |
|
| 696 |
getter_AddRefs(mozFile)); |
691 |
if (!possible_ckbi_locations[il]) |
|
|
692 |
{ |
| 693 |
fullModuleName = PR_GetLibraryName(nsnull, "nssckbi"); |
| 694 |
} |
| 695 |
else |
| 696 |
{ |
| 697 |
directoryService->Get( possible_ckbi_locations[il], |
| 698 |
NS_GET_IID(nsILocalFile), |
| 699 |
getter_AddRefs(mozFile)); |
| 697 |
|
700 |
|
| 698 |
if (!mozFile) { |
701 |
if (!mozFile) { |
| 699 |
continue; |
702 |
continue; |
|
|
703 |
} |
| 704 |
|
| 705 |
nsCAutoString processDir; |
| 706 |
mozFile->GetNativePath(processDir); |
| 707 |
fullModuleName = PR_GetLibraryName(processDir.get(), "nssckbi"); |
| 700 |
} |
708 |
} |
| 701 |
|
709 |
|
| 702 |
char *fullModuleName = nsnull; |
|
|
| 703 |
#ifdef XP_MAC |
| 704 |
nsCAutoString nativePath; |
| 705 |
mozFile->AppendNative(NS_LITERAL_CSTRING("Essential Files")); |
| 706 |
mozFile->AppendNative(LOADABLE_CERTS_MODULE); |
| 707 |
mozFile->GetNativePath(nativePath); |
| 708 |
fullModuleName = (char *) nativePath.get(); |
| 709 |
#else |
| 710 |
nsCAutoString processDir; |
| 711 |
mozFile->GetNativePath(processDir); |
| 712 |
fullModuleName = PR_GetLibraryName(processDir.get(), "nssckbi"); |
| 713 |
#endif |
| 714 |
/* If a module exists with the same name, delete it. */ |
710 |
/* If a module exists with the same name, delete it. */ |
| 715 |
NS_ConvertUCS2toUTF8 modNameUTF8(modName); |
711 |
NS_ConvertUCS2toUTF8 modNameUTF8(modName); |
| 716 |
int modType; |
712 |
int modType; |
| 717 |
SECMOD_DeleteModule(NS_CONST_CAST(char*, modNameUTF8.get()), &modType); |
713 |
SECMOD_DeleteModule(NS_CONST_CAST(char*, modNameUTF8.get()), &modType); |
| 718 |
SECStatus rv_add = |
714 |
SECStatus rv_add = |
| 719 |
SECMOD_AddNewModule(NS_CONST_CAST(char*, modNameUTF8.get()), fullModuleName, 0, 0); |
715 |
SECMOD_AddNewModule(NS_CONST_CAST(char*, modNameUTF8.get()), fullModuleName, 0, 0); |
| 720 |
#ifndef XP_MAC |
716 |
PR_FreeLibraryName(fullModuleName); // allocated by NSPR |
| 721 |
PR_Free(fullModuleName); // allocated by NSPR |
|
|
| 722 |
#endif |
| 723 |
if (SECSuccess == rv_add) { |
717 |
if (SECSuccess == rv_add) { |
| 724 |
// found a module, no need to try other directories |
718 |
// found a module, no need to try other directories |
| 725 |
break; |
719 |
break; |