michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * JARNAV.C michael@0: * michael@0: * JAR stuff needed for client only. michael@0: * michael@0: */ michael@0: michael@0: #include "jar.h" michael@0: #include "jarint.h" michael@0: michael@0: /* from proto.h */ michael@0: extern MWContext *FE_GetInitContext(void); michael@0: michael@0: /* To return an MWContext for Java */ michael@0: static MWContext *(*jar_fn_FindSomeContext) (void) = NULL; michael@0: michael@0: /* To fabricate an MWContext for FE_GetPassword */ michael@0: static MWContext *(*jar_fn_GetInitContext) (void) = NULL; michael@0: michael@0: /* michael@0: * J A R _ i n i t michael@0: * michael@0: * Initialize the JAR functions. michael@0: * michael@0: */ michael@0: michael@0: void JAR_init (void) michael@0: { michael@0: JAR_init_callbacks (XP_GetString, NULL, NULL); michael@0: } michael@0: michael@0: /* michael@0: * J A R _ s e t _ c o n t e x t michael@0: * michael@0: * Set the jar window context for use by PKCS11, since michael@0: * it may be needed to prompt the user for a password. michael@0: * michael@0: */ michael@0: int michael@0: JAR_set_context(JAR *jar, MWContext *mw) michael@0: { michael@0: if (mw) { michael@0: jar->mw = mw; michael@0: } else { michael@0: /* jar->mw = XP_FindSomeContext(); */ michael@0: jar->mw = NULL; michael@0: /* michael@0: * We can't find a context because we're in startup state and none michael@0: * exist yet. go get an FE_InitContext that only works at michael@0: * initialization time. michael@0: */ michael@0: /* Turn on the mac when we get the FE_ function */ michael@0: if (jar->mw == NULL) { michael@0: jar->mw = jar_fn_GetInitContext(); michael@0: } michael@0: } michael@0: return 0; michael@0: }