NS_WITH_SERVICE(nsIPSMComponent, psm, PSM_COMPONENT_CONTRACTID, &res); PCMT_CONTROL control; if (NS_SUCCEEDED(res) && NS_SUCCEEDED(psm->GetControlConnection(&control))) {
NS_WITH_SERVICE(nsISecurityManagerComponent, psm, PSM_COMPONENT_CONTRACTID, &res); if (NS_SUCCEEDED(res)) {
wallet_IsFromCartman(nsIURI* aURL) {  PRBool retval = PR_FALSE;  char* host;  aURL->GetHost(&host);  if (host && PL_strncasecmp(host, "127.0.0.1",  9) == 0) {    /* submit is to server on local machine */    nsresult res;    NS_WITH_SERVICE(nsIPSMComponent, psm, PSM_COMPONENT_CONTRACTID, &res);    PCMT_CONTROL control;    if (NS_SUCCEEDED(res) && NS_SUCCEEDED(psm->GetControlConnection(&control))) {       char* password;      aURL->GetPassword(&password);      if (password && PL_strncasecmp(password, (const char*)control->nonce.data, control->nonce.len) == 0) {        /* password for submit is cartman's password */        retval = PR_TRUE;      }      if (password) {        Recycle(password);      }    }  }  if (host) {   Recycle(host);  }  return retval;}