public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* Cluster Project branch, master, updated. gfs-kernel_0_1_22-57-g9941c55
@ 2008-03-04 22:52 lhh
  0 siblings, 0 replies; only message in thread
From: lhh @ 2008-03-04 22:52 UTC (permalink / raw)
  To: cluster-cvs, cluster-devel

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=9941c556945e8e802738b2a700636293ec5696fd

The branch, master has been updated
       via  9941c556945e8e802738b2a700636293ec5696fd (commit)
      from  72d3a7438aef3d8c31873fb96544f7540fdb8e47 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9941c556945e8e802738b2a700636293ec5696fd
Author: Lon Hohberger <lhh@redhat.com>
Date:   Tue Mar 4 17:24:15 2008 -0500

    [fence] Make fence_xvmd support reloading of key files on the fly.

-----------------------------------------------------------------------

Summary of changes:
 fence/agents/xvm/fence_xvm.c   |    2 +-
 fence/agents/xvm/fence_xvmd.c  |   31 +++++++++++++++++++++++++++++--
 fence/agents/xvm/simple_auth.c |    2 ++
 fence/agents/xvm/xvm.h         |    1 +
 4 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/fence/agents/xvm/fence_xvm.c b/fence/agents/xvm/fence_xvm.c
index 4ce4693..8c8ce64 100644
--- a/fence/agents/xvm/fence_xvm.c
+++ b/fence/agents/xvm/fence_xvm.c
@@ -219,7 +219,7 @@ int
 fence_xen_domain(fence_xvm_args_t *args)
 {
 	ip_list_t ipl;
-	char key[4096];
+	char key[MAX_KEY_LEN];
 	int lfd, key_len = 0, fd;
 	int attempts = 0;
 	
diff --git a/fence/agents/xvm/fence_xvmd.c b/fence/agents/xvm/fence_xvmd.c
index 82f08f5..1280310 100644
--- a/fence/agents/xvm/fence_xvmd.c
+++ b/fence/agents/xvm/fence_xvmd.c
@@ -57,6 +57,7 @@
 #define LIBVIRT_XEN_URI "xen:///"
 
 static int running = 1;
+static int reload_key;
 
 
 int cleanup_xml(char *xmldesc, char **ret, size_t *retsz);
@@ -573,6 +574,27 @@ xvmd_loop(cman_handle_t ch, void *h, int fd, fence_xvm_args_t *args,
 			virConnectClose(vp);
 			vp = NULL;
 		}
+
+		if (reload_key) {
+			char temp_key[MAX_KEY_LEN];
+			int ret;
+
+			reload_key = 0;
+
+			ret = read_key_file(args->key_file, temp_key, sizeof(temp_key));
+			if (ret < 0) {
+				printf("Could not read %s; not updating key",
+					args->key_file);
+			} else {
+				memcpy(key, temp_key, MAX_KEY_LEN);
+				key_len = (size_t) ret;
+
+				if (args->auth == AUTH_NONE)
+					args->auth = AUTH_SHA256;
+				if (args->hash == HASH_NONE)
+					args->hash = HASH_SHA256;
+			}
+		}
 		
 		n = select(fd+1, &rfds, NULL, NULL, &tv);
 		if (n < 0)
@@ -678,6 +700,11 @@ sigint_handler(int sig)
 	running = 0;
 }
 
+void
+sighup_handler(int sig)
+{
+	reload_key = 1;
+}
 
 void malloc_dump_table(void);
 
@@ -687,7 +714,7 @@ main(int argc, char **argv)
 {
 	fence_xvm_args_t args;
 	int mc_sock;
-	char key[4096];
+	char key[MAX_KEY_LEN];
 	int key_len = 0, x;
 	char *my_options = "dfi:a:p:C:c:k:u?hLXV";
 	cman_handle_t ch = NULL;
@@ -780,7 +807,6 @@ main(int argc, char **argv)
 		if (x)
 			printf("Checkpoint initialized\n");
 	}
-
 	if (args.family == PF_INET)
 		mc_sock = ipv4_recv_sk(args.addr, args.port);
 	else
@@ -791,6 +817,7 @@ main(int argc, char **argv)
 	}
 
 
+	signal(SIGHUP, sighup_handler);
 	signal(SIGINT, sigint_handler);
 	signal(SIGTERM, sigint_handler);
 	signal(SIGQUIT, sigint_handler);
diff --git a/fence/agents/xvm/simple_auth.c b/fence/agents/xvm/simple_auth.c
index 0064e5c..7eb26ee 100644
--- a/fence/agents/xvm/simple_auth.c
+++ b/fence/agents/xvm/simple_auth.c
@@ -390,6 +390,8 @@ read_key_file(char *file, char *key, size_t max_len)
 	while (remain) {
 		nread = read(fd, p, remain);
 		if (nread < 0) {
+			if (errno == EINTR)
+				continue;
 			dbg_printf(2, "Error from read: %s\n", strerror(errno));
 			close(fd);
 			return -1;
diff --git a/fence/agents/xvm/xvm.h b/fence/agents/xvm/xvm.h
index bee9f3f..4272246 100644
--- a/fence/agents/xvm/xvm.h
+++ b/fence/agents/xvm/xvm.h
@@ -59,6 +59,7 @@ typedef enum {
 #define DEFAULT_TTL 4
 
 #define MAX_HASH_LENGTH SHA512_LENGTH
+#define MAX_KEY_LEN 4096
 
 typedef struct __attribute__ ((packed)) _fence_req {
 	uint8_t  request;		/* Fence request */


hooks/post-receive
--
Cluster Project


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-04 22:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-04 22:52 Cluster Project branch, master, updated. gfs-kernel_0_1_22-57-g9941c55 lhh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).