svn rev #24994: trunk/src/util/gss-kernel-lib/
ghudson@MIT.EDU
ghudson at MIT.EDU
Mon Jun 27 18:23:18 EDT 2011
http://src.mit.edu/fisheye/changelog/krb5/?cs=24994
Commit By: ghudson
Log Message:
Make kgss test processes run in lock-step.
Changed Files:
U trunk/src/util/gss-kernel-lib/t_kgss_common.c
U trunk/src/util/gss-kernel-lib/t_kgss_common.h
U trunk/src/util/gss-kernel-lib/t_kgss_kernel.c
U trunk/src/util/gss-kernel-lib/t_kgss_user.c
Modified: trunk/src/util/gss-kernel-lib/t_kgss_common.c
===================================================================
--- trunk/src/util/gss-kernel-lib/t_kgss_common.c 2011-06-27 21:07:20 UTC (rev 24993)
+++ trunk/src/util/gss-kernel-lib/t_kgss_common.c 2011-06-27 22:23:18 UTC (rev 24994)
@@ -82,3 +82,24 @@
*data_out = data;
*len_out = len;
}
+
+/*
+ * Acknowledgements are used to make the parent and child processes operate in
+ * lock-step. That way, if the child fails, the parent isn't several steps
+ * ahead before it finds out.
+ */
+
+void
+send_ack(int fd)
+{
+ rewrite(fd, "ack", 3);
+}
+
+void
+read_ack(int fd)
+{
+ char buf[3];
+
+ reread(fd, buf, 3);
+ assert(memcmp(buf, "ack", 3) == 0);
+}
Modified: trunk/src/util/gss-kernel-lib/t_kgss_common.h
===================================================================
--- trunk/src/util/gss-kernel-lib/t_kgss_common.h 2011-06-27 21:07:20 UTC (rev 24993)
+++ trunk/src/util/gss-kernel-lib/t_kgss_common.h 2011-06-27 22:23:18 UTC (rev 24994)
@@ -28,3 +28,5 @@
void reread(int fd, void *buf, size_t len);
void send_data(int fd, const void *data, size_t len);
void read_data(int fd, void **data_out, size_t *len_out);
+void send_ack(int fd);
+void read_ack(int fd);
Modified: trunk/src/util/gss-kernel-lib/t_kgss_kernel.c
===================================================================
--- trunk/src/util/gss-kernel-lib/t_kgss_kernel.c 2011-06-27 21:07:20 UTC (rev 24993)
+++ trunk/src/util/gss-kernel-lib/t_kgss_kernel.c 2011-06-27 22:23:18 UTC (rev 24994)
@@ -273,12 +273,21 @@
krb5_c_random_os_entropy(NULL, 0, &dummy);
read_lucid_context(&acceptor);
+ send_ack(STDOUT_FILENO);
read_wrap_token(acceptor);
+ send_ack(STDOUT_FILENO);
read_mic_token(acceptor);
+ send_ack(STDOUT_FILENO);
read_iov_token(acceptor);
+ send_ack(STDOUT_FILENO);
+
send_wrap_token(acceptor);
+ read_ack(STDIN_FILENO);
send_mic_token(acceptor);
+ read_ack(STDIN_FILENO);
send_iov_token(acceptor);
+ read_ack(STDIN_FILENO);
+
cleanup_context(acceptor);
return 0;
}
Modified: trunk/src/util/gss-kernel-lib/t_kgss_user.c
===================================================================
--- trunk/src/util/gss-kernel-lib/t_kgss_user.c 2011-06-27 21:07:20 UTC (rev 24993)
+++ trunk/src/util/gss-kernel-lib/t_kgss_user.c 2011-06-27 22:23:18 UTC (rev 24994)
@@ -378,13 +378,23 @@
establish_contexts(argv[1], &initiator, &acceptor);
start_child(&to_child, &from_child, &child_pid);
+
send_lucid_context(acceptor, to_child);
+ read_ack(from_child);
send_wrap_token(initiator, to_child);
+ read_ack(from_child);
send_mic_token(initiator, to_child);
+ read_ack(from_child);
send_iov_token(initiator, to_child);
+ read_ack(from_child);
+
read_wrap_token(initiator, from_child);
+ send_ack(to_child);
read_mic_token(initiator, from_child);
+ send_ack(to_child);
read_iov_token(initiator, from_child);
+ send_ack(to_child);
+
cleanup_context(initiator);
close(to_child);
close(from_child);
More information about the cvs-krb5
mailing list