63
63
surl = dtr->get_source()->TransferLocations()[0].fullstr();
66
logger_->msg(Arc::ERROR, "DTR %s: No locations defined for %s", dtr_id, dtr->get_source()->str());
66
logger_->msg(Arc::ERROR, "No locations defined for %s", dtr->get_source()->str());
70
70
if (dtr->get_destination()->TransferLocations().empty()) {
71
logger_->msg(Arc::ERROR, "DTR %s: No locations defined for %s", dtr_id, dtr->get_destination()->str());
71
logger_->msg(Arc::ERROR, "No locations defined for %s", dtr->get_destination()->str());
74
74
std::string durl = dtr->get_destination()->TransferLocations()[0].fullstr();
83
83
child_uid = dtr->get_local_user().get_uid();
84
84
child_gid = dtr->get_local_user().get_gid();
86
// If child is going to be run under different user ID
87
// we must ensure it will be able to read credentials.
88
tmp_proxy_ = prepare_proxy(dtr->get_usercfg().ProxyPath(), child_uid, child_gid);
89
86
args.push_back("--surl");
90
87
args.push_back(surl);
91
88
args.push_back("--durl");
92
89
args.push_back(durl);
93
if (!tmp_proxy_.empty()) {
94
args.push_back("--sopt");
95
args.push_back("credential="+tmp_proxy_);
96
args.push_back("--dopt");
97
args.push_back("credential="+tmp_proxy_);
98
} else if(!dtr->get_usercfg().ProxyPath().empty()) {
99
args.push_back("--sopt");
100
args.push_back("credential="+dtr->get_usercfg().ProxyPath());
101
args.push_back("--dopt");
102
args.push_back("credential="+dtr->get_usercfg().ProxyPath());
90
if (!dtr->get_source()->RequiresCredentialsInFile() &&
91
!dtr->get_destination()->RequiresCredentialsInFile() &&
92
!dtr->get_usercfg().CredentialString().empty()) {
93
// If file-based credentials are not required then send through stdin
94
stdin_ = dtr->get_usercfg().CredentialString();
96
// If child is going to be run under different user ID
97
// we must ensure it will be able to read credentials.
98
tmp_proxy_ = prepare_proxy(dtr->get_usercfg().ProxyPath(), child_uid, child_gid);
99
if (!tmp_proxy_.empty()) {
100
args.push_back("--sopt");
101
args.push_back("credential="+tmp_proxy_);
102
args.push_back("--dopt");
103
args.push_back("credential="+tmp_proxy_);
104
} else if(!dtr->get_usercfg().ProxyPath().empty()) {
105
args.push_back("--sopt");
106
args.push_back("credential="+dtr->get_usercfg().ProxyPath());
107
args.push_back("--dopt");
108
args.push_back("credential="+dtr->get_usercfg().ProxyPath());
104
111
if (!dtr->get_usercfg().CACertificatesDirectory().empty()) {
105
112
args.push_back("--sopt");
120
127
std::string csum(dtr->get_source()->GetCheckSum());
121
128
std::string::size_type pos(csum.find(':'));
122
129
if (pos == std::string::npos || pos == csum.length()-1) {
123
logger_->msg(Arc::WARNING, "DTR %s: Bad checksum format %s", dtr_id, csum);
130
logger_->msg(Arc::WARNING, "Bad checksum format %s", csum);
125
132
args.push_back("--cstype");
126
133
args.push_back(csum.substr(0, pos));
141
148
child_->KeepStdin(false);
142
149
child_->AssignUserId(child_uid);
143
150
child_->AssignGroupId(child_gid);
151
child_->AssignStdin(stdin_);
146
154
for(std::list<std::string>::iterator arg = args.begin();arg!=args.end();++arg) {
150
logger_->msg(Arc::DEBUG, "DTR %s: Running command: %s", dtr_id, cmd);
158
logger_->msg(Arc::DEBUG, "Running command: %s", cmd);
151
159
if(!child_->Start()) {
186
194
char* end = strchr(start,'\n');
187
195
if(end) *end = 0;
188
logger_->msg(Arc::INFO, "DTR %s: DataDelivery: %s", dtr_id, start);
196
logger_->msg(Arc::INFO, "DataDelivery: %s", start);
198
206
status_.commstatus = CommExited;
199
207
if(child_->Result() != 0) {
200
logger_->msg(Arc::ERROR, "DTR %s: DataStagingDelivery exited with code %i", dtr_id, child_->Result());
208
logger_->msg(Arc::ERROR, "DataStagingDelivery exited with code %i", child_->Result());
201
209
status_.commstatus = CommFailed;
216
224
// check for stuck child process (no report through comm channel)
217
225
Arc::Period t = Arc::Time() - last_comm;
218
226
if (transfer_params.max_inactivity_time > 0 && t >= transfer_params.max_inactivity_time*2) {
219
logger_->msg(Arc::ERROR, "DTR %s: Transfer killed after %i seconds without communication", dtr_id, t.GetPeriod());
227
logger_->msg(Arc::ERROR, "Transfer killed after %i seconds without communication", t.GetPeriod());