Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsNSSHelper.h File Reference
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "pk11func.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  PipUIContext

Functions

nsresult getNSSDialogs (void **_result, REFNSIID aIID, const char *contract)
PRBool pip_ucs2_ascii_conversion_fn (PRBool toUnicode, unsigned char *inBuf, unsigned int inBufLen, unsigned char *outBuf, unsigned int maxOutBufLen, unsigned int *outBufLen, PRBool swapBytes)
nsresult setPassword (PK11SlotInfo *slot, nsIInterfaceRequestor *ctx)

Function Documentation

nsresult getNSSDialogs ( void **  _result,
REFNSIID  aIID,
const char *  contract 
)

Definition at line 2311 of file nsNSSComponent.cpp.

{
  nsresult rv;

  nsCOMPtr<nsISupports> svc = do_GetService(contract, &rv);
  if (NS_FAILED(rv)) 
    return rv;

  nsCOMPtr<nsIProxyObjectManager> proxyman =
      do_GetService(NS_XPCOMPROXY_CONTRACTID, &rv);
  if (NS_FAILED(rv))
    return rv;
 
  rv = proxyman->GetProxyForObject(NS_UI_THREAD_EVENTQ,
                                   aIID, svc, PROXY_SYNC,
                                   _result);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool pip_ucs2_ascii_conversion_fn ( PRBool  toUnicode,
unsigned char *  inBuf,
unsigned int  inBufLen,
unsigned char *  outBuf,
unsigned int  maxOutBufLen,
unsigned int outBufLen,
PRBool  swapBytes 
)

Definition at line 817 of file nsPKCS12Blob.cpp.

{
  // do a no-op, since I've already got unicode.  Hah!
  *outBufLen = inBufLen;
  memcpy(outBuf, inBuf, inBufLen);
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult setPassword ( PK11SlotInfo *  slot,
nsIInterfaceRequestor ctx 
)

Definition at line 2331 of file nsNSSComponent.cpp.

{
  nsNSSShutDownPreventionLock locker;
  nsresult rv = NS_OK;
  
  if (PK11_NeedUserInit(slot)) {
    nsITokenPasswordDialogs *dialogs;
    PRBool canceled;
    NS_ConvertUTF8toUCS2 tokenName(PK11_GetTokenName(slot));

    rv = getNSSDialogs((void**)&dialogs,
                       NS_GET_IID(nsITokenPasswordDialogs),
                       NS_TOKENPASSWORDSDIALOG_CONTRACTID);

    if (NS_FAILED(rv)) goto loser;

    {
      nsPSMUITracker tracker;
      if (tracker.isUIForbidden()) {
        rv = NS_ERROR_NOT_AVAILABLE;
      }
      else {
        rv = dialogs->SetPassword(ctx,
                                  tokenName.get(),
                                  &canceled);
      }
    }
    NS_RELEASE(dialogs);
    if (NS_FAILED(rv)) goto loser;

    if (canceled) { rv = NS_ERROR_NOT_AVAILABLE; goto loser; }
  }
 loser:
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function: