Commit c046b130 authored by J.C. Jones's avatar J.C. Jones

Bug 1609673 - Conditionally compile out all libnssdbm glue if NSS_DISABLE_DBM is set r=mt

Remove `lgglue` from compilation entirely if DBM is disabled

Differential Revision: https://phabricator.services.mozilla.com/D61759

--HG--
extra : moz-landing-system : lando
parent 99b62217
......@@ -19,7 +19,6 @@
},
{
'files': [
'lgglue.h',
'pkcs11ni.h',
'sdb.h',
'sftkdbt.h',
......@@ -27,7 +26,14 @@
'softoken.h',
'softoknt.h'
],
'destination': '<(nss_private_dist_dir)/<(module)'
'destination': '<(nss_private_dist_dir)/<(module)',
'conditions': [
[ 'disable_dbm==0', {
'files': [
'lgglue.h',
]
}]
]
}
]
}
......
......@@ -23,7 +23,6 @@ EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
lgglue.h \
pkcs11ni.h \
softoken.h \
softoknt.h \
......@@ -37,7 +36,6 @@ CSRCS = \
fipstest.c \
fipstokn.c \
kbkdf.c \
lgglue.c \
lowkey.c \
lowpbe.c \
padbuf.c \
......@@ -55,6 +53,11 @@ CSRCS = \
jpakesftk.c \
$(NULL)
ifndef NSS_DISABLE_DBM
PRIVATE_EXPORTS += lgglue.h
CSRCS += lgglue.c
endif
ifdef SQLITE_UNSAFE_THREADS
DEFINES += -DSQLITE_UNSAFE_THREADS
endif
......
......@@ -2937,12 +2937,14 @@ SFTK_DestroySlotData(SFTKSlot *slot)
char **
NSC_ModuleDBFunc(unsigned long function, char *parameters, void *args)
{
#ifndef NSS_DISABLE_DBM
char *secmod = NULL;
char *appName = NULL;
char *filename = NULL;
NSSDBType dbType = NSS_DB_TYPE_NONE;
PRBool rw;
static char *success = "Success";
#endif /* NSS_DISABLE_DBM */
char **rvstr = NULL;
rvstr = NSSUTIL_DoModuleDBFunction(function, parameters, args);
......@@ -2954,6 +2956,7 @@ NSC_ModuleDBFunc(unsigned long function, char *parameters, void *args)
return NULL;
}
#ifndef NSS_DISABLE_DBM
/* The legacy database uses the old dbm, which is only linked with the
* legacy DB handler, which is only callable from softoken */
......@@ -3045,6 +3048,7 @@ loser:
PORT_Free(appName);
if (filename)
PORT_Free(filename);
#endif /* NSS_DISABLE_DBM */
return rvstr;
}
......
......@@ -2693,6 +2693,7 @@ sftkdb_ResetKeyDB(SFTKDBHandle *handle)
return SECSuccess;
}
#ifndef NSS_DISABLE_DBM
static PRBool
sftk_oldVersionExists(const char *dir, int version)
{
......@@ -2796,6 +2797,7 @@ sftk_hasLegacyDB(const char *confdir, const char *certPrefix,
PR_smprintf_free(dir);
return exists;
}
#endif /* NSS_DISABLE_DBM */
/*
* initialize certificate and key database handles as a pair.
......@@ -2819,7 +2821,9 @@ sftk_DBInit(const char *configdir, const char *certPrefix,
CK_RV crv = CKR_OK;
int flags = SDB_RDONLY;
PRBool newInit = PR_FALSE;
#ifndef NSS_DISABLE_DBM
PRBool needUpdate = PR_FALSE;
#endif /* NSS_DISABLE_DBM */
char *nconfdir = NULL;
PRBool legacy = PR_TRUE;
......@@ -2842,6 +2846,7 @@ sftk_DBInit(const char *configdir, const char *certPrefix,
* now initialize the appropriate database
*/
switch (dbType) {
#ifndef NSS_DISABLE_DBM
case NSS_DB_TYPE_LEGACY:
crv = sftkdbCall_open(confdir, certPrefix, keyPrefix, 8, 3, flags,
noCertDB ? NULL : &certSDB, noKeyDB ? NULL : &keySDB);
......@@ -2850,10 +2855,13 @@ sftk_DBInit(const char *configdir, const char *certPrefix,
crv = sftkdbCall_open(configdir, certPrefix, keyPrefix, 8, 3, flags,
noCertDB ? NULL : &certSDB, noKeyDB ? NULL : &keySDB);
break;
#endif /* NSS_DISABLE_DBM */
case NSS_DB_TYPE_SQL:
case NSS_DB_TYPE_EXTERN: /* SHOULD open a loadable db */
crv = s_open(confdir, certPrefix, keyPrefix, 9, 4, flags,
noCertDB ? NULL : &certSDB, noKeyDB ? NULL : &keySDB, &newInit);
#ifndef NSS_DISABLE_DBM
legacy = PR_FALSE;
/*
......@@ -2905,6 +2913,7 @@ sftk_DBInit(const char *configdir, const char *certPrefix,
needUpdate = PR_TRUE;
}
}
#endif /* NSS_DISABLE_DBM */
break;
default:
crv = CKR_GENERAL_ERROR; /* can't happen, EvaluationConfigDir MUST
......@@ -2933,6 +2942,7 @@ sftk_DBInit(const char *configdir, const char *certPrefix,
(*keyDB)->peerDB = *certDB;
}
#ifndef NSS_DISABLE_DBM
/*
* if we need to update, open the legacy database and
* mark the handle as needing update.
......@@ -2970,6 +2980,8 @@ sftk_DBInit(const char *configdir, const char *certPrefix,
}
}
}
#endif /* NSS_DISABLE_DBM */
done:
if (appName) {
PORT_Free(appName);
......@@ -2984,6 +2996,8 @@ CK_RV
sftkdb_Shutdown(void)
{
s_shutdown();
#ifndef NSS_DISABLE_DBM
sftkdbCall_Shutdown();
#endif /* NSS_DISABLE_DBM */
return CKR_OK;
}
......@@ -49,7 +49,6 @@
'fipstokn.c',
'jpakesftk.c',
'kbkdf.c',
'lgglue.c',
'lowkey.c',
'lowpbe.c',
'padbuf.c',
......@@ -65,6 +64,13 @@
'softkver.c',
'tlsprf.c'
],
'conditions': [
[ 'disable_dbm==0', {
'sources': [
'lgglue.c',
]
}]
]
},
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment