Revert "server: Refine 153f660 so that it reverts back to the original behavior by default."

This reverts commit 3cecde776b.
This commit is contained in:
Rom Walton 2015-11-18 15:40:22 -05:00
parent 2404092894
commit f660d9dd62
2 changed files with 7 additions and 32 deletions

View File

@ -51,6 +51,8 @@
using std::string;
// the random part of output filenames needs to be hard to guess
//
static struct random_init {
random_init() {
srand48(getpid() + time(0));
@ -158,9 +160,11 @@ int create_result(
int retval;
initialize_result(result, wu);
result.random = lrand48();
result.priority += priority_increase;
sprintf(result.name, "%s_%s", wu.name, result_name_suffix);
sprintf(base_outfile_name, "%s_", result.name);
sprintf(base_outfile_name, "%s_%ld", result.name, lrand48());
retval = read_filename(
result_template_filename, result_template, sizeof(result_template)
);

View File

@ -20,8 +20,6 @@
#include <string>
#include <cstdlib>
#include <cassert>
#include <unistd.h>
#include <sys/types.h>
#include "boinc_db.h"
#include "error_numbers.h"
@ -34,18 +32,9 @@
#include "fcgi_stdio.h"
#endif
#define OUTFILE_MACRO "<OUTFILE_"
#define RANDFILE_MACRO "<RANDFILE_"
#define OUTFILE_MACRO "<OUTFILE_"
#define UPLOAD_URL_MACRO "<UPLOAD_URL/>"
// the random part of output filenames needs to be hard to guess
//
static struct random_init {
random_init() {
srand48(getpid() + time(0));
}
} random_init;
// Add a signature at the end of every <file_info> element,
//
int add_signatures(char* xml, R_RSA_PRIVATE_KEY& key) {
@ -118,8 +107,6 @@ int remove_signatures(char* xml) {
// macro-substitute a result template:
// - replace OUTFILE_x with base_filename_x, etc.
// - replace RANDFILE_x with base_filename_r_x, etc., where r is a
// large random number
// - add signatures for file uploads
// - strip enclosing <output_template> tags
//
@ -133,7 +120,7 @@ int process_result_template(
SCHED_CONFIG& config_loc
) {
char* p,*q;
char temp[BLOB_SIZE], buf[256], buf2[256];
char temp[BLOB_SIZE], buf[256];
int retval;
while (1) {
@ -151,22 +138,6 @@ int process_result_template(
strcat(p, temp);
continue;
}
p = strstr(result_template, RANDFILE_MACRO);
if (p) {
q = p+strlen(RANDFILE_MACRO);
char* endptr = strstr(q, "/>");
if (!endptr) return ERR_XML_PARSE;
if (strchr(q, '>') != endptr+1) return ERR_XML_PARSE;
*endptr = 0;
strcpy(buf, q);
sprintf(buf2, "%ld_", lrand48());
strcpy(temp, endptr+2);
strcpy(p, base_filename);
strcpy(p, buf2);
strcat(p, buf);
strcat(p, temp);
continue;
}
p = strstr(result_template, UPLOAD_URL_MACRO);
if (p) {
strcpy(temp, p+strlen(UPLOAD_URL_MACRO));