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

« back to all changes in this revision

Viewing changes to src/libs/data-staging/DataStagingDelivery.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2013-11-29 13:39:10 UTC
  • mfrom: (3.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20131129133910-sy6ayoavphc5hozs
Tags: 4.0.0-1
4.0.0 Release (Closes: #715131) (LP: #1049798)

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
  CheckSumAny crc_source;
204
204
  CheckSumAny crc_dest;
205
205
 
 
206
  // Read credential from stdin if available
 
207
  std::string proxy_cred;
 
208
  std::getline(std::cin, proxy_cred, '\0');
 
209
 
206
210
  initializeCredentialsType source_cred(initializeCredentialsType::SkipCredentials);
207
211
  UserConfig source_cfg(source_cred);
208
212
  if(!source_cred_path.empty()) source_cfg.ProxyPath(source_cred_path);
 
213
  else if (!proxy_cred.empty()) source_cfg.CredentialString(proxy_cred);
209
214
  if(!source_ca_path.empty()) source_cfg.CACertificatesDirectory(source_ca_path);
210
215
  //source_cfg.UtilsDirPath(...); - probably not needed
211
216
  DataHandle source(source_url,source_cfg);
214
219
    _exit(-1);
215
220
    //return -1;
216
221
  };
 
222
  if (source->RequiresCredentialsInFile() && source_cred_path.empty()) {
 
223
    logger.msg(ERROR, "No credentials supplied");
 
224
    _exit(-1);
 
225
  }
 
226
 
217
227
  source->SetSecure(false);
218
228
  source->Passive(true);
219
229
  initializeCredentialsType dest_cred(initializeCredentialsType::SkipCredentials);
220
230
  UserConfig dest_cfg(dest_cred);
221
231
  if(!dest_cred_path.empty()) dest_cfg.ProxyPath(dest_cred_path);
 
232
  else if (!proxy_cred.empty()) dest_cfg.CredentialString(proxy_cred);
222
233
  if(!dest_ca_path.empty()) dest_cfg.CACertificatesDirectory(dest_ca_path);
223
234
  //dest_cfg.UtilsDirPath(...); - probably not needed
224
235
  DataHandle dest(dest_url,dest_cfg);
227
238
    _exit(-1);
228
239
    //return -1;
229
240
  };
 
241
  if (dest->RequiresCredentialsInFile() && dest_cred_path.empty()) {
 
242
    logger.msg(ERROR, "No credentials supplied");
 
243
    _exit(-1);
 
244
  }
230
245
  dest->SetSecure(false);
231
246
  dest->Passive(true);
232
247
 
233
248
  // set X509* for 3rd party tools which need it (eg GFAL)
234
 
  SetEnv("X509_USER_PROXY", source_cfg.ProxyPath());
235
 
  if (!source_cfg.CACertificatesDirectory().empty()) SetEnv("X509_CERT_DIR", source_cfg.CACertificatesDirectory());
236
 
  // those tools also use hostcert by default if the user is root...
237
 
  if (getuid() == 0) {
238
 
    SetEnv("X509_USER_CERT", source_cfg.ProxyPath());
239
 
    SetEnv("X509_USER_KEY", source_cfg.ProxyPath());
 
249
  if (!source_cfg.ProxyPath().empty()) {
 
250
    SetEnv("X509_USER_PROXY", source_cfg.ProxyPath());
 
251
    if (!source_cfg.CACertificatesDirectory().empty()) SetEnv("X509_CERT_DIR", source_cfg.CACertificatesDirectory());
 
252
    // those tools also use hostcert by default if the user is root...
 
253
    if (getuid() == 0) {
 
254
      SetEnv("X509_USER_CERT", source_cfg.ProxyPath());
 
255
      SetEnv("X509_USER_KEY", source_cfg.ProxyPath());
 
256
    }
240
257
  }
241
258
 
242
259
  // set signal handlers