Skip to content

Commit

Permalink
Compile modutil with shared libraries.
Browse files Browse the repository at this point in the history
  • Loading branch information
relyea%netscape.com committed Jan 28, 2003
1 parent 781ae49 commit 048fb53
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
6 changes: 4 additions & 2 deletions security/nss/cmd/modutil/manifest.mn
Expand Up @@ -55,6 +55,8 @@ REQUIRES = seccmd nss dbm
DEFINES = -DNSPR20

# sigh
INCLUDES += -I$(CORE_DEPTH)/nss/lib/pk11wrap
#INCLUDES += -I$(CORE_DEPTH)/nss/lib/pk11wrap

USE_STATIC_LIBS = 1
# USE_STATIC_LIBS = 1

EXTRA_LIBS += $(JAR_LIBS)
47 changes: 31 additions & 16 deletions security/nss/cmd/modutil/pk11.c
Expand Up @@ -32,13 +32,11 @@
*/

#include "modutil.h"
#include "secmodti.h"
/* #include "secmodti.h" */
#include "pk11func.h"

extern PK11DefaultArrayEntry PK11_DefaultArray[];
extern int num_pk11_default_mechanisms;
extern SECStatus PK11_UpdateSlotAttribute(PK11SlotInfo*, PK11DefaultArrayEntry*,
PRBool);
static PK11DefaultArrayEntry *pk11_DefaultArray = NULL;
static int pk11_DefaultArraySize = 0;

/*************************************************************************
*
Expand Down Expand Up @@ -494,7 +492,8 @@ ListModule(char *moduleName)
PR_fprintf(PR_STDOUT, "Cipher Enable Flags: %s\n", ciphers);
mechanisms = NULL;
if(module->slotCount > 0) {
mechanisms = getStringFromFlags(module->slots[0]->defaultFlags,
mechanisms = getStringFromFlags(
PK11_GetDefaultFlags(module->slots[0]),
mechanismStrings, numMechanismStrings);
}
if(mechanisms[0] =='\0') {
Expand All @@ -516,15 +515,15 @@ ListModule(char *moduleName)

/* Slot Info */
PR_fprintf(PR_STDOUT, "\n"PAD"Slot: %s\n", PK11_GetSlotName(slot));
mechanisms = getStringFromFlags(slot->defaultFlags,
mechanisms = getStringFromFlags(PK11_GetDefaultFlags(slot),
mechanismStrings, numMechanismStrings);
if(mechanisms[0] =='\0') {
mechanisms = "None";
}
PR_fprintf(PR_STDOUT, PAD"Slot Mechanism Flags: %s\n", mechanisms);
PR_fprintf(PR_STDOUT, PAD"Manufacturer: %.32s\n",
slotinfo.manufacturerID);
if(slot->isHW) {
if (PK11_IsHW(slot)) {
PR_fprintf(PR_STDOUT, PAD"Type: Hardware\n");
} else {
PR_fprintf(PR_STDOUT, PAD"Type: Software\n");
Expand All @@ -533,7 +532,7 @@ ListModule(char *moduleName)
slotinfo.hardwareVersion.major, slotinfo.hardwareVersion.minor);
PR_fprintf(PR_STDOUT, PAD"Firmware Version: %d.%d\n",
slotinfo.firmwareVersion.major, slotinfo.firmwareVersion.minor);
if(slot->disabled) {
if (PK11_IsDisabled(slot)) {
reason = PK11_GetDisabledReason(slot);
if(reason < numDisableReasonStr) {
PR_fprintf(PR_STDOUT, PAD"Status: DISABLED (%s)\n",
Expand All @@ -547,7 +546,7 @@ ListModule(char *moduleName)

if(PK11_GetTokenInfo(slot, &tokeninfo) != SECSuccess) {
PR_fprintf(PR_STDERR, errStrings[TOKEN_INFO_ERR],
slot->token_name);
PK11_GetTokenName(slot));
rv = TOKEN_INFO_ERR;
continue;
}
Expand Down Expand Up @@ -758,6 +757,14 @@ SetDefaultModule(char *moduleName, char *slotName, char *mechanisms)
PRBool found = PR_FALSE;
Error errcode = UNSPECIFIED_ERR;

if (pk11_DefaultArray == NULL) {
pk11_DefaultArray = PK11_GetDefaultArray(&pk11_DefaultArraySize);
if (pk11_DefaultArray == NULL) {
/* should assert. This shouldn't happen */
goto loser;
}
}

mechFlags = SECMOD_PubMechFlagstoInternal(mechFlags);

module = SECMOD_FindModule(moduleName);
Expand All @@ -781,10 +788,10 @@ SetDefaultModule(char *moduleName, char *slotName, char *mechanisms)
found = PR_TRUE;

/* Go through each mechanism */
for(i=0; i < num_pk11_default_mechanisms; i++) {
if(PK11_DefaultArray[i].flag & mechFlags) {
for(i=0; i < pk11_DefaultArraySize; i++) {
if(pk11_DefaultArray[i].flag & mechFlags) {
/* Enable this default mechanism */
PK11_UpdateSlotAttribute(slot, &(PK11_DefaultArray[i]),
PK11_UpdateSlotAttribute(slot, &(pk11_DefaultArray[i]),
PR_TRUE);
}
}
Expand Down Expand Up @@ -824,6 +831,14 @@ UnsetDefaultModule(char *moduleName, char *slotName, char *mechanisms)
mechanismStrings, numMechanismStrings);
PRBool found = PR_FALSE;

if (pk11_DefaultArray == NULL) {
pk11_DefaultArray = PK11_GetDefaultArray(&pk11_DefaultArraySize);
if (pk11_DefaultArray == NULL) {
/* should assert. This shouldn't happen */
return UNSPECIFIED_ERR;
}
}

mechFlags = SECMOD_PubMechFlagstoInternal(mechFlags);

module = SECMOD_FindModule(moduleName);
Expand All @@ -840,9 +855,9 @@ UnsetDefaultModule(char *moduleName, char *slotName, char *mechanisms)
/* we are only interested in changing the one slot */
continue;
}
for(i=0; i <num_pk11_default_mechanisms; i++) {
if(PK11_DefaultArray[i].flag & mechFlags) {
PK11_UpdateSlotAttribute(slot, &(PK11_DefaultArray[i]),
for(i=0; i < pk11_DefaultArraySize ; i++) {
if(pk11_DefaultArray[i].flag & mechFlags) {
PK11_UpdateSlotAttribute(slot, &(pk11_DefaultArray[i]),
PR_FALSE);
}
}
Expand Down
12 changes: 12 additions & 0 deletions security/nss/cmd/platlibs.mk
Expand Up @@ -33,6 +33,8 @@


ifdef USE_STATIC_LIBS

JAR_LIBS=
# can't do this in manifest.mn because OS_ARCH isn't defined there.
ifeq ($(OS_ARCH), WINNT)

Expand Down Expand Up @@ -187,6 +189,16 @@ EXTRA_SHARED_LIBS += -B/usr/ccs/bin/
endif
endif

ifeq ($(OS_ARCH), WINNT)
JAR_LIBS = $(DIST)/lib/jar.lib \
$(DIST)/lib/zlib.lib \
$(NULL)
else
JAR_LIBS = $(DIST)/lib/$(LIB_PREFIX)jar.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)zlib.$(LIB_SUFFIX) \
$(NULL)
endif

# $(PROGRAM) has NO explicit dependencies on $(EXTRA_SHARED_LIBS)
# $(EXTRA_SHARED_LIBS) come before $(OS_LIBS), except on AIX.
EXTRA_SHARED_LIBS += \
Expand Down

0 comments on commit 048fb53

Please sign in to comment.