From 7e983e4189f7006e4f5137ae1d5ddd00e6934766 Mon Sep 17 00:00:00 2001
From: Barry Jaspan <bjaspan@mit.edu>
Date: Wed, 16 Oct 1996 20:15:39 +0000
Subject: 	* rpc_test.0/expire.exp: add test for expired credentials 
 [krb5-admin/17]

	* server.c (log_miscerr): add log_miscerr

	* Makefile.in: don't delete rpc_test.x, we might be in souce tree

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9183 dc483132-0cff-0310-8789-dd5450dbe970
---
 src/lib/rpc/unit-test/ChangeLog             |  9 +++
 src/lib/rpc/unit-test/Makefile.in           |  4 +-
 src/lib/rpc/unit-test/rpc_test.0/expire.exp | 47 +++++++++++----
 src/lib/rpc/unit-test/server.c              | 94 ++++-------------------------
 4 files changed, 58 insertions(+), 96 deletions(-)

(limited to 'src/lib/rpc')

diff --git a/src/lib/rpc/unit-test/ChangeLog b/src/lib/rpc/unit-test/ChangeLog
index ccf008e2d3..c45bb419d8 100644
--- a/src/lib/rpc/unit-test/ChangeLog
+++ b/src/lib/rpc/unit-test/ChangeLog
@@ -1,3 +1,12 @@
+Wed Oct 16 16:13:13 1996  Barry Jaspan  <bjaspan@mit.edu>
+
+	* rpc_test.0/expire.exp: add test for expired credentials
+	[krb5-admin/17]
+	
+	* server.c (log_miscerr): add log_miscerr
+
+	* Makefile.in: don't delete rpc_test.x, we might be in souce tree
+
 Tue Oct 15 16:12:04 1996  Barry Jaspan  <bjaspan@mit.edu>
 
 	* initial changes to make rpc unit tests work with new build/test
diff --git a/src/lib/rpc/unit-test/Makefile.in b/src/lib/rpc/unit-test/Makefile.in
index fc666a1cd8..7ac96c6c7d 100644
--- a/src/lib/rpc/unit-test/Makefile.in
+++ b/src/lib/rpc/unit-test/Makefile.in
@@ -11,8 +11,8 @@ server: server.o rpc_test_svc.o $(DEPLIBS)
 client.c server.c: rpc_test.h
 
 rpc_test.h rpc_test_clnt.c rpc_test_svc.c: rpc_test.x
-	-rm -f rpc_test_clnt.c rpc_test_svc.c rpc_test.h rpc_test.x
-	ln -s $(srcdir)/rpc_test.x .
+	-rm -f rpc_test_clnt.c rpc_test_svc.c rpc_test.h
+	-ln -s $(srcdir)/rpc_test.x .
 	rpcgen -l rpc_test.x -o rpc_test_clnt.c
 	rpcgen -m rpc_test.x -o rpc_test_svc.c
 	rpcgen -h rpc_test.x -o rpc_test.h
diff --git a/src/lib/rpc/unit-test/rpc_test.0/expire.exp b/src/lib/rpc/unit-test/rpc_test.0/expire.exp
index d80bae6dae..6f7aa935ae 100644
--- a/src/lib/rpc/unit-test/rpc_test.0/expire.exp
+++ b/src/lib/rpc/unit-test/rpc_test.0/expire.exp
@@ -4,18 +4,41 @@ load_lib "helpers.exp"
 
 global spawn_id
 
-start_client expire 1 testuser notathena 20m 100
-set client1_id $spawn_id
-flush_server
+proc expired {} {
+    global spawn_id server_id
 
-start_client expire 2 testuser notathena 40m 300
-set client2_id $spawn_id
-flush_server
+    start_client expired expired testuser notathena -1m 100
+    eof_client expired expired $spawn_id 2
+
+    expect {
+	-i $server_id
+	-re "rpc_test server: Authen.*failed: .* referenced credentials have expired" { pass "expired" }
+	timeout { fail "expired: timeout waiting for expired creds error" }
+    }
+
+    flush_server
+}
+expired
+
+proc overlap {} {
+    global spawn_id
+
+    start_client expire 1 testuser notathena 20m 100
+    set client1_id $spawn_id
+    flush_server
+    
+    start_client expire 2 testuser notathena 40m 300
+    set client2_id $spawn_id
+    flush_server
+    
+    start_client expire 3 testuser notathena 60m 500
+    set client3_id $spawn_id
+    flush_server
+    
+    eof_client expire 1 $client1_id 0
+    eof_client expire 2 $client2_id 0
+    eof_client expire 3 $client3_id 0
+}
+overlap
 
-start_client expire 3 testuser notathena 60m 500
-set client3_id $spawn_id
-flush_server
 
-eof_client expire 1 $client1_id 0
-eof_client expire 2 $client2_id 0
-eof_client expire 3 $client3_id 0
diff --git a/src/lib/rpc/unit-test/server.c b/src/lib/rpc/unit-test/server.c
index 091a23de3b..35e3c58858 100644
--- a/src/lib/rpc/unit-test/server.c
+++ b/src/lib/rpc/unit-test/server.c
@@ -3,88 +3,6 @@
  *
  * $Id$
  * $Source$
- * 
- * $Log$
- * Revision 1.16  1996/10/15 20:15:06  bjaspan
- * 	* initial changes to make rpc unit tests work with new build/test
- *  	system
- *
- * Revision 1.15  1996/07/22 20:41:44  marc
- * this commit includes all the changes on the OV_9510_INTEGRATION and
- * OV_MERGE branches.  This includes, but is not limited to, the new openvision
- * admin system, and major changes to gssapi to add functionality, and bring
- * the implementation in line with rfc1964.  before committing, the
- * code was built and tested for netbsd and solaris.
- *
- * Revision 1.14.4.1  1996/07/18 04:20:06  marc
- * merged in changes from OV_9510_BP to OV_9510_FINAL1
- *
- * Revision 1.14.2.1  1996/06/20  23:42:16  marc
- * File added to the repository on a branch
- *
- * Revision 1.14  1996/05/12  06:59:06  marc
- * change SERVICE_NAME to "host" instead of "server"
- *
- * remove KRB5KTNAME support, since the library supports it internally now.
- *
- * Revision 1.13  1995/12/07  17:36:58  jik
- * Use "rpc_test" instead of "rpc-test", to avoid problems with rpcgen on
- * some systems.  See PR 3553.
- *
- * Revision 1.12  1995/11/07 23:20:44  grier
- * Add stdlib.h
- * Add string.h
- *
- * Revision 1.11  1995/03/24  19:55:28  jik
- * Cast a const gss_OID to (gss_OID) to prevent a compiler warning.
- *
- * Revision 1.10  1995/02/22 15:54:17  jik
- * I was a moron in revision 1.8.  This is the server function, not the
- * client function, so it gets a struct svc_req *, not a CLIENT *.
- *
- * Revision 1.9  1995/02/22 15:21:51  jik
- * Linux's rpcgen names the server function differently from the client
- * function ("_svc" is appended to the end of it).
- *
- * Revision 1.8  1995/02/22 14:35:05  jik
- * RPC server functions have CLIENT * passed into them, so I added it as
- * an argument to rpc_test_echo_1.
- *
- * Revision 1.7  1994/09/21 18:35:57  bjaspan
- * [gssapi/438: gss_nt_service_name should default to local host]
- * [secure-releng/2513: audit gssapi/438: gss_nt_service_name should default to local host]
- *
- * Sandbox:
- *
- *  Don't need to get local host name and put it in the service name,
- *  since the gssapi library does that now.  See PR 438.
- *
- * Revision 1.8  1994/09/01  17:21:59  jik
- * Don't need to get local host name and put it in the service name,
- * since the gssapi library does that now.  See PR 438.
- *
- * Revision 1.7  1994/04/08  17:22:11  bjaspan
- * add KRB5KTNAME hack so unit tests continue to work
- *
- * Revision 1.6  1994/04/05  20:50:26  bjaspan
- * print "running" when ready to tests can proceed
- *
- * Revision 1.5  1994/04/05  19:49:54  jik
- * Use host name instead of localhost.
- *
- * Revision 1.4  1994/03/08  00:14:58  shanzer
- * changed call to inet_ntoa
- *
- * Revision 1.3  1993/12/13  01:37:54  bjaspan
- * update for new test system
- * ,.
- *
- * Revision 1.2  1993/12/08  21:45:16  bjaspan
- * display badauth errors, improve arg handling
- *
- * Revision 1.1  1993/11/03  23:53:58  bjaspan
- * Initial revision
- *
  */
 
 #if !defined(lint) && !defined(__CODECENTER__)
@@ -119,6 +37,8 @@ extern int svc_debug_gssapi, misc_debug_gssapi;
 
 void rpc_test_badauth(OM_uint32 major, OM_uint32 minor,
 		 struct sockaddr_in *addr, void *data);
+void log_miscerr(struct svc_req *rqst, struct rpc_msg *msg, char
+		 *error, char *data);
 void log_badauth_display_status(OM_uint32 major, OM_uint32 minor);
 void log_badauth_display_status_1(OM_uint32 code, int type, int rec);
 static void rpc_test_badverf(gss_name_t client, gss_name_t server,
@@ -172,6 +92,7 @@ main(int argc, char **argv)
 
      _svcauth_gssapi_set_log_badauth_func(rpc_test_badauth, NULL);
      _svcauth_gssapi_set_log_badverf_func(rpc_test_badverf, NULL);
+     _svcauth_gssapi_set_log_miscerr_func(log_miscerr, NULL);
 
      printf("running\n");
      
@@ -244,6 +165,15 @@ void rpc_test_badauth(OM_uint32 major, OM_uint32 minor,
      printf("\n");
 }
 
+void log_miscerr(struct svc_req *rqst, struct rpc_msg *msg,
+		 char *error, char *data)
+{
+     char *a;
+     
+     a = inet_ntoa(rqst->rq_xprt->xp_raddr.sin_addr);
+     printf("Miscellaneous RPC error: %s, %s\n", a, error);
+}
+
 void log_badauth_display_status(OM_uint32 major, OM_uint32 minor)
 {
      log_badauth_display_status_1(major, GSS_C_GSS_CODE, 0);
-- 
cgit