boinc_cmd looks for password in file

svn path=/trunk/boinc/; revision=8747
This commit is contained in:
David Anderson 2005-10-26 05:43:36 +00:00
parent fb0a3565e0
commit 2d5bb1fbed
3 changed files with 37 additions and 8 deletions

View File

@ -13363,3 +13363,10 @@ Charlie 25 Oct 2005
client/ client/
gui_rpc_server.C gui_rpc_server.C
David 25 Oct 2005
- "boinc_cmd" looks for a password in gui_rpc_auth.cfg
client/
acct_setup.C
lib/
boinc_cmd.C

View File

@ -22,6 +22,7 @@
#include "parse.h" #include "parse.h"
#include "filesys.h" #include "filesys.h"
#include "util.h" #include "util.h"
#include "client_msgs.h"
#include "acct_setup.h" #include "acct_setup.h"
@ -80,7 +81,9 @@ void ACCOUNT_IN::parse(char* buf) {
int GET_PROJECT_CONFIG_OP::do_rpc(string master_url) { int GET_PROJECT_CONFIG_OP::do_rpc(string master_url) {
int retval; int retval;
string url = master_url + "get_project_config.php"; string url = master_url + "get_project_config.php";
printf("doing RPC to %s, file %s\n", url.c_str(), GET_PROJECT_CONFIG_FILENAME); msg_printf(NULL, MSG_INFO,
"Fetching config info from %s", url.c_str()
);
retval = gstate.gui_http.do_rpc(this, url, GET_PROJECT_CONFIG_FILENAME); retval = gstate.gui_http.do_rpc(this, url, GET_PROJECT_CONFIG_FILENAME);
if (retval) { if (retval) {
error_num = retval; error_num = retval;

View File

@ -120,14 +120,33 @@ char* next_arg(int argc, char** argv, int& i) {
} }
// If there's a password file, read it
//
void read_password_from_file(char* buf) {
FILE* f = fopen("gui_rpc_auth.cfg", "r");
if (!f) return;
fgets(buf, 256, f);
int n = strlen(buf);
// trim CR
//
if (n && buf[n-1]=='\n') {
buf[n-1] = 0;
}
fclose(f);
}
int main(int argc, char** argv) { int main(int argc, char** argv) {
RPC_CLIENT rpc; RPC_CLIENT rpc;
int i; int i;
char passwd_buf[256];
MESSAGES messages; MESSAGES messages;
int retval; int retval;
char* hostname = NULL; char* hostname = NULL;
char* passwd = NULL; char* passwd = passwd_buf;
strcpy(passwd_buf, "");
read_password_from_file(passwd_buf);
#ifdef _WIN32 #ifdef _WIN32
WSADATA wsdata; WSADATA wsdata;