From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci/ricci ClientInstance.cpp Ricci.cpp ...
Date: 9 Sep 2007 01:06:17 -0000 [thread overview]
Message-ID: <20070909010617.30056.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-09-09 01:06:15
Modified files:
ricci/ricci : ClientInstance.cpp Ricci.cpp SSLInstance.cpp
Server.cpp
Log message:
Fix a couple of bugs that caused certificates to not be saved and batch queue files to not be written correctly
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/ClientInstance.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Ricci.cpp.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/SSLInstance.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/Server.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8
--- conga/ricci/ricci/ClientInstance.cpp 2007/08/30 17:08:44 1.9
+++ conga/ricci/ricci/ClientInstance.cpp 2007/09/09 01:06:15 1.10
@@ -106,6 +106,7 @@
}
bool authed = _ssl.client_cert_authed();
+ bool was_authed = authed;
// send hello
send(ricci.hello(authed));
@@ -130,15 +131,11 @@
XMLObject response = ricci.request(request, authed,
save_cert, remove_cert, done);
- if (!authed && save_cert) {
+ if (!was_authed && save_cert)
_ssl.save_client_cert();
- authed = true;
- }
- if (authed && remove_cert) {
+ if (was_authed && remove_cert)
_ssl.remove_client_cert();
- authed = false;
- }
send(response);
}
send(XMLObject("bye"));
--- conga/ricci/ricci/Ricci.cpp 2007/08/30 17:07:14 1.26
+++ conga/ricci/ricci/Ricci.cpp 2007/09/09 01:06:15 1.27
@@ -156,6 +156,7 @@
success = RRC_SUCCESS;
remove_cert = true;
}
+ authenticated = false;
} else if (function == "list_modules") {
// available modules
if (!authenticated) {
@@ -290,29 +291,32 @@
}
// create file
- int fd = open(path_tmp.c_str(), O_RDONLY | O_CREAT | O_EXCL, 0640);
+ int fd = open(path_tmp.c_str(), O_RDWR | O_CREAT | O_EXCL, 0640);
if (fd == -1)
throw String("unable to create batch file: ") + String(strerror(errno));
- // write file
- FILE *file = fdopen(fd, "w+");
- if (!file)
- throw String("unable to open batch file: ") + String(strerror(errno));
-
try {
// save request
String xml_str(generateXML(_report));
- if (fwrite(xml_str.c_str(), xml_str.size(), 1, file) != 1) {
- throw String("unable to write batch request: ")
- + String(strerror(errno));
+ while (xml_str.size()) {
+ ssize_t ret = write(fd, xml_str.c_str(), xml_str.size());
+ if (ret < 0) {
+ if (errno == EINTR)
+ continue;
+ throw String("unable to write batch request: ")
+ + String(strerror(errno));
+ }
+ xml_str = xml_str.substr(ret);
}
- fclose(file);
+
+ close(fd);
+
if (rename(path_tmp.c_str(), _path.c_str())) {
throw String("failed to rename batch file: ")
+ String(strerror(errno));
}
} catch ( ... ) {
- fclose(file);
+ close(fd);
unlink(path_tmp.c_str());
throw;
}
--- conga/ricci/ricci/SSLInstance.cpp 2007/08/30 17:07:14 1.9
+++ conga/ricci/ricci/SSLInstance.cpp 2007/09/09 01:06:15 1.10
@@ -450,8 +450,10 @@
iter != authorized_certs.end() ;
iter++)
{
- if (iter->cert == _cert_pem)
- unlink(iter->file.c_str());
+ if (iter->cert == _cert_pem) {
+ if (unlink(iter->file.c_str()) != 0)
+ throw String("error removing certificate");
+ }
}
load_client_certs();
@@ -469,6 +471,8 @@
{
want_read = want_write = false;
+ int err = errno;
+
String e;
switch (SSL_get_error(_ssl, value)) {
case SSL_ERROR_NONE:
@@ -499,5 +503,5 @@
e = "SSL_ERROR_SSL";
break;
}
- throw String("SSL_read() error: ") + e;
+ throw String("SSL_read() error: ") + e + ": " + String(strerror(err));
}
--- conga/ricci/ricci/Server.cpp 2007/08/30 17:07:14 1.7
+++ conga/ricci/ricci/Server.cpp 2007/09/09 01:06:15 1.8
@@ -131,8 +131,8 @@
}
if (poll_data.revents & (POLLERR | POLLHUP | POLLNVAL))
- throw String("server socket error????");
- } // while
+ throw String("server socket error");
+ }
}
void
reply other threads:[~2007-09-09 1:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070909010617.30056.qmail@sourceware.org \
--to=rmccabe@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.