mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=5576
This commit is contained in:
parent
2944a46d99
commit
71a6e7e75a
|
@ -25599,3 +25599,14 @@ David 7 Mar 2005
|
||||||
lib/
|
lib/
|
||||||
Makefile.am
|
Makefile.am
|
||||||
network.C,h
|
network.C,h
|
||||||
|
|
||||||
|
David 7 Mar 2005
|
||||||
|
- Bug fixes in GUI RPC protection.
|
||||||
|
It works now using boinc_cmd.
|
||||||
|
(need to integrate in BOINC manager)
|
||||||
|
|
||||||
|
client/
|
||||||
|
gui_rpc_server.C
|
||||||
|
lib/
|
||||||
|
boinc_cmd.C
|
||||||
|
gui_rpc_client.C
|
||||||
|
|
|
@ -474,6 +474,7 @@ void GUI_RPC_CONN::handle_auth2(char* buf, MIOFILE& fout) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fout.printf("<authorized/>\n");
|
fout.printf("<authorized/>\n");
|
||||||
|
auth_needed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GUI_RPC_CONN::handle_rpc() {
|
int GUI_RPC_CONN::handle_rpc() {
|
||||||
|
@ -510,9 +511,9 @@ int GUI_RPC_CONN::handle_rpc() {
|
||||||
"<client_version>%d</client_version>\n",
|
"<client_version>%d</client_version>\n",
|
||||||
gstate.version()
|
gstate.version()
|
||||||
);
|
);
|
||||||
if (match_tag(request_msg, "<auth1>")) {
|
if (match_tag(request_msg, "<auth1")) {
|
||||||
handle_auth1(mf);
|
handle_auth1(mf);
|
||||||
} else if (match_tag(request_msg, "<auth2>")) {
|
} else if (match_tag(request_msg, "<auth2")) {
|
||||||
handle_auth2(request_msg, mf);
|
handle_auth2(request_msg, mf);
|
||||||
} else if (auth_needed) {
|
} else if (auth_needed) {
|
||||||
auth_failure(mf);
|
auth_failure(mf);
|
||||||
|
|
|
@ -87,6 +87,16 @@ void parse_display_args(char** argv, DISPLAY_INFO& di) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void show_error(int retval) {
|
||||||
|
switch(retval) {
|
||||||
|
case ERR_AUTHENTICATOR:
|
||||||
|
fprintf(stderr, "Authentication failure\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "Error %d\n", retval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
RPC_CLIENT rpc;
|
RPC_CLIENT rpc;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -121,7 +131,7 @@ int main(int argc, char** argv) {
|
||||||
if (passwd) {
|
if (passwd) {
|
||||||
retval = rpc.authorize(passwd);
|
retval = rpc.authorize(passwd);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
fprintf(stderr, "can't authorize\n");
|
fprintf(stderr, "Authorization failure: %d\n", retval);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,7 +303,7 @@ int main(int argc, char** argv) {
|
||||||
fprintf(stderr, "unrecognized command %s\n", argv[i]);
|
fprintf(stderr, "unrecognized command %s\n", argv[i]);
|
||||||
}
|
}
|
||||||
if (retval) {
|
if (retval) {
|
||||||
fprintf(stderr, "Operation failed: %d\n", retval);
|
show_error(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
//#define DEBUG
|
||||||
|
|
||||||
DISPLAY_INFO::DISPLAY_INFO() {
|
DISPLAY_INFO::DISPLAY_INFO() {
|
||||||
memset(this, 0, sizeof(DISPLAY_INFO));
|
memset(this, 0, sizeof(DISPLAY_INFO));
|
||||||
}
|
}
|
||||||
|
@ -1001,8 +1003,8 @@ int RPC_CLIENT::authorize(char* passwd) {
|
||||||
|
|
||||||
sprintf(buf, "%s%s", nonce, passwd);
|
sprintf(buf, "%s%s", nonce, passwd);
|
||||||
md5_block((const unsigned char*)buf, strlen(buf), nonce_hash);
|
md5_block((const unsigned char*)buf, strlen(buf), nonce_hash);
|
||||||
sprintf(buf, "<nonce_hash>%s</nonce_hash>\n", nonce_hash);
|
sprintf(buf, "<auth2/>\n<nonce_hash>%s</nonce_hash>\n", nonce_hash);
|
||||||
retval = rpc.do_rpc("<auth2/>\n");
|
retval = rpc.do_rpc(buf);
|
||||||
if (retval) return retval;
|
if (retval) return retval;
|
||||||
while (rpc.fin.fgets(buf, 256)) {
|
while (rpc.fin.fgets(buf, 256)) {
|
||||||
if (match_tag(buf, "<authorized/>")) {
|
if (match_tag(buf, "<authorized/>")) {
|
||||||
|
@ -1058,11 +1060,17 @@ int RPC::do_rpc(const char* req) {
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if (rpc_client->sock == 0) return ERR_CONNECT;
|
if (rpc_client->sock == 0) return ERR_CONNECT;
|
||||||
|
#ifdef DEBUG
|
||||||
|
puts(req);
|
||||||
|
#endif
|
||||||
retval = rpc_client->send_request(req);
|
retval = rpc_client->send_request(req);
|
||||||
if (retval) return retval;
|
if (retval) return retval;
|
||||||
retval = rpc_client->get_reply(mbuf);
|
retval = rpc_client->get_reply(mbuf);
|
||||||
if (retval) return retval;
|
if (retval) return retval;
|
||||||
fin.init_buf(mbuf);
|
fin.init_buf(mbuf);
|
||||||
|
#ifdef DEBUG
|
||||||
|
puts(mbuf);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1079,6 +1087,9 @@ int RPC_CLIENT::get_state(CC_STATE& state) {
|
||||||
if (retval) return retval;
|
if (retval) return retval;
|
||||||
|
|
||||||
while (rpc.fin.fgets(buf, 256)) {
|
while (rpc.fin.fgets(buf, 256)) {
|
||||||
|
if (match_tag(buf, "<unauthorized")) {
|
||||||
|
return ERR_AUTHENTICATOR;
|
||||||
|
}
|
||||||
if (match_tag(buf, "</client_state>")) break;
|
if (match_tag(buf, "</client_state>")) break;
|
||||||
else if (parse_int(buf, "<client_version>", client_version)) continue;
|
else if (parse_int(buf, "<client_version>", client_version)) continue;
|
||||||
else if (match_tag(buf, "<project>")) {
|
else if (match_tag(buf, "<project>")) {
|
||||||
|
|
Loading…
Reference in New Issue