char *p;
proxy_record tmp_record;
time_t current_time;
+ int line_num = 0;
assert(record != NULL);
memset(&tmp_record, 0, sizeof(tmp_record));
current_time = time(NULL);
while (fgets(line, sizeof(line), fd) != NULL) {
+ line_num++;
free_record(&tmp_record);
p = strchr(line, '\n');
if (p)
*p = '\0';
ret = decode_record(line, &tmp_record);
- if (ret)
- return ret; /* XXX continue */
+ if (ret) {
+ edg_wlpr_Log(LOG_ERR, "Skipping invalid entry at line %d", line_num);
+ continue;
+ }
if (record->suffix >= 0) {
if (record->suffix == tmp_record.suffix) {
record->suffix = tmp_record.suffix;
* parameters (currently myproxy location) provided by user */
char *server = record->myproxy_server;
- memset(record, sizeof(*record), 0);
+ memset(record, 0, sizeof(*record));
record->suffix = tmp_record.suffix;
- if (record->myproxy_server)
- free(record->myproxy_server);
record->myproxy_server = server;
free_record(&tmp_record);
return 0;
proxy_record tmp_record;
char tmp_file[FILENAME_MAX];
char meta_file[FILENAME_MAX];
+ int line_num = 0;
assert (record != NULL);
goto end;
}
while (fgets(line, sizeof(line), fd) != NULL) {
+ line_num++;
free_record(&tmp_record);
p = strchr(line, '\n');
if (p)
*p = '\0';
ret = decode_record(line, &tmp_record);
- if (ret)
- goto end;
+ if (ret) {
+ edg_wlpr_Log(LOG_ERR, "Removing invalid entry at line %d in %s", line_num, basename);
+ continue;
+ }
if (record->suffix == tmp_record.suffix &&
record->unique == tmp_record.unique) {
tmp_record.next_renewal = record->next_renewal;
free_record(&record);
record.suffix = suffix;
record.myproxy_server = server;
- edg_wlpr_Log(LOG_WARNING, "Removed expired proxy (suffix %d)",
- suffix);
+ edg_wlpr_Log(LOG_WARNING, "Removed expired proxy %s", cur_proxy);
} else
get_times(cur_proxy, &record);
} else {
char *cadir = NULL;
char *vomsdir = NULL;
int voms_enabled = 0;
+char *cert = NULL;
+char *key = NULL;
char *vomsconf = "/opt/edg/etc/vomses";
{ "VOMSdir", required_argument, NULL, 'V' },
{ "enable-voms", no_argument, NULL, 'A' },
{ "voms-config", required_argument, NULL, 'G' },
+ { "cert", required_argument, NULL, 't' },
+ { "key", required_argument, NULL, 'k' },
{ NULL, 0, NULL, 0 }
};
goto end;
}
- edg_wlpr_Log(LOG_INFO, "Received command code %d for proxy %s",
+ edg_wlpr_Log(LOG_INFO, "Received command code %d for proxy %s and jobid %s",
request.command,
- request.proxy_filename ? request.proxy_filename : "(unspecified)");
+ request.proxy_filename ? request.proxy_filename : "(unspecified)",
+ request.jobid ? request.jobid : "(unspecified)");
command->handler(&request, &response);
repository = EDG_WLPR_REPOSITORY_ROOT;
debug = 0;
- while ((opt = getopt_long(argc, argv, "hvdr:c:C:V:AG:", opts, NULL)) != EOF)
+ while ((opt = getopt_long(argc, argv, "hvdr:c:C:V:AG:t:k:", opts, NULL)) != EOF)
switch (opt) {
case 'h': usage(progname); exit(0);
case 'v': fprintf(stdout, "%s:\t%s\n", progname, rcsid); exit(0);
case 'V': vomsdir = optarg; break;
case 'A': voms_enabled = 1; break;
case 'G': vomsconf = optarg; break;
+ case 't': cert = optarg; break;
+ case 'k': key = optarg; break;
case '?': usage(progname); return 1;
}
openlog(progname, LOG_PID, LOG_DAEMON);
}
+ if (cert)
+ setenv("X509_USER_CERT", cert, 1);
+
+ if (key)
+ setenv("X509_USER_KEY", key, 1);
+
+ if (cadir)
+ setenv("X509_CERT_DIR", cadir, 1);
+
memset(&sa,0,sizeof(sa));
sa.sa_handler = catchsig;
sigaction(SIGINT,&sa,NULL);