scheduler: if gui_urls.xml or project_files.xml don't end with \n, add one

Otherwise the scheduler reply has two tags on one line,
which messes up old clients that don't use the new XML parse
This commit is contained in:
David Anderson 2014-02-26 16:16:51 -08:00
parent f59aec574a
commit 593181e196
3 changed files with 18 additions and 0 deletions

View File

@ -703,3 +703,14 @@ void strip_translation(char* p) {
remove_str(p, "_(\"");
remove_str(p, "\")");
}
char* lf_terminate(char* p) {
int n = strlen(p);
if (p[n-1] == '\n') {
return p;
}
p = (char*)realloc(p, n+2);
p[n] = '\n';
p[n+1] = 0;
return p;
}

View File

@ -75,6 +75,11 @@ extern int string_substitute(
//
extern void mysql_timestamp(double, char*);
// take a malloced string.
// if \n is not last char, add it.
//
extern char* lf_terminate(char*);
extern const char* network_status_string(int);
extern const char* rpc_reason_string(int);
extern const char* suspend_reason_string(int reason);

View File

@ -1344,6 +1344,7 @@ void GLOBAL_PREFS::defaults() {
void GUI_URLS::init() {
text = 0;
read_file_malloc(config.project_path("gui_urls.xml"), text);
text = lf_terminate(text);
}
void GUI_URLS::get_gui_urls(USER& user, HOST& host, TEAM& team, char* buf, int len) {
@ -1385,6 +1386,7 @@ void GUI_URLS::get_gui_urls(USER& user, HOST& host, TEAM& team, char* buf, int l
void PROJECT_FILES::init() {
text = 0;
read_file_malloc(config.project_path("project_files.xml"), text);
text = lf_terminate(text);
}
void get_weak_auth(USER& user, char* buf) {