~ubuntu-branches/ubuntu/trusty/nordugrid-arc/trusty

« back to all changes in this revision

Viewing changes to src/clients/credentials/arcproxy.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2012-12-13 16:41:31 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20121213164131-wii0p2fcv7e3en93
Tags: 2.0.1-1
* 2.0.1 Release
* Drop patches accepted upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
#else
223
223
  std::string home_path = Glib::get_home_dir();
224
224
#endif
 
225
 
 
226
#if defined(_MACOSX)
 
227
  std::string ff_home = home_path + G_DIR_SEPARATOR_S "Library" G_DIR_SEPARATOR_S "Application Support" G_DIR_SEPARATOR_S "Firefox";
 
228
#elif defined(WIN32)
 
229
  std::string ff_home = home_path + G_DIR_SEPARATOR_S "AppData" G_DIR_SEPARATOR_S "Roaming" G_DIR_SEPARATOR_S "Mozilla" G_DIR_SEPARATOR_S "Firefox";
 
230
#else
225
231
  std::string ff_home = home_path + G_DIR_SEPARATOR_S ".mozilla" G_DIR_SEPARATOR_S "firefox";
 
232
#endif
226
233
 
227
234
  struct stat st;
228
235
  if(::stat(ff_home.c_str(),&st) != 0) return std::string();
436
443
    res = AuthN::nssInit(configdir);
437
444
    std::cout<< Arc::IString("nss db to be accesses: %s\n", configdir.c_str());
438
445
 
439
 
    char* slotpw = NULL; //"secretpw"; 
 
446
    char* slotpw = NULL; //"secretpw";  //TODO: Input passphrase to nss db 
440
447
    //The nss db under firefox profile seems to not be protected by any passphrase by default
441
448
    bool ascii = true;
442
449
    const char* trusts = "p,p,p";
486
493
    proxy_cred_str.append(proxy_privk_str).append(eec_cert_str);
487
494
    write_proxy_file(proxy_path, proxy_cred_str);
488
495
 
 
496
    Arc::Credential proxy_cred(proxy_path, proxy_path, "", "");
 
497
    Arc::Time left = proxy_cred.GetEndTime();
 
498
    std::cout << Arc::IString("Proxy generation succeeded") << std::endl;
 
499
    std::cout << Arc::IString("Your proxy is valid until: %s", left.str(Arc::UserTime)) << std::endl;
 
500
 
489
501
    return EXIT_SUCCESS;
490
502
  }
491
503
#endif
991
1003
 
992
1004
      std::string proxy_cred_str_pem;
993
1005
     
994
 
      Arc::UserConfig usercfg_tmp(Arc::initializeCredentialsType(Arc::initializeCredentialsType::SkipCredentials));
 
1006
      Arc::initializeCredentialsType cred_type(Arc::initializeCredentialsType::SkipCredentials);
 
1007
      Arc::UserConfig usercfg_tmp(cred_type);
995
1008
      usercfg_tmp.CACertificatesDirectory(usercfg.CACertificatesDirectory());
996
1009
 
997
1010
      Arc::CredentialStore cstore(usercfg_tmp,Arc::URL("myproxy://"+myproxy_server));
1293
1306
                std::string tmp = str.substr(pos + tmp_str.size() + 1); 
1294
1307
                std::cout << Arc::IString("The validity duration of VOMS AC is shortened from %s to %s, due to the validity constraint on voms server side.\n", voms_period, tmp);
1295
1308
              }
1296
 
              else
1297
 
              std::cout << Arc::IString("Cannot get any AC or attributes info from VOMS server: %s;\n       Returned message from VOMS server: %s\n", voms_server, str);
1298
 
              break; //since the voms servers with the same name should be looked as the same for robust reason, the other voms server should that can be reached could returned the same message. So we exists the loop, even if there are other backup voms server exist.
 
1309
              else {
 
1310
                std::cout << Arc::IString("Cannot get any AC or attributes info from VOMS server: %s;\n       Returned message from VOMS server: %s\n", voms_server, str);
 
1311
                break; //since the voms servers with the same name should be looked as the same for robust reason, the other voms server that can be reached could returned the same message. So we exists the loop, even if there are other backup voms server exist.
 
1312
              }
1299
1313
            }
1300
 
            else
 
1314
            else {
1301
1315
              std::cout << Arc::IString("Returned message from VOMS server %s is: %s\n", voms_server, ret_str);
1302
 
              break; 
 
1316
              break;
 
1317
            } 
1303
1318
          }
1304
1319
 
1305
1320
          //Put the return attribute certificate into proxy certificate as the extension part
1308
1323
            codedac = (std::string)(node["bitstr"]);
1309
1324
          else
1310
1325
            codedac = (std::string)(node["ac"]);
 
1326
 
1311
1327
          std::string decodedac;
1312
1328
          int size;
1313
1329
          char *dec = NULL;