summaryrefslogtreecommitdiffstats
path: root/src/appl
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>2011-03-05 17:37:21 +0000
committerEzra Peisach <epeisach@mit.edu>2011-03-05 17:37:21 +0000
commit483b7f3daad3b87c5beb238bcdfdb52303120b93 (patch)
tree3c2f11a5484eb13846729906e6e260a47189130c /src/appl
parentfba2b0eb5a49768eecd2572f0f4636e715bb3c95 (diff)
downloadkrb5-483b7f3daad3b87c5beb238bcdfdb52303120b93.tar.gz
krb5-483b7f3daad3b87c5beb238bcdfdb52303120b93.tar.xz
krb5-483b7f3daad3b87c5beb238bcdfdb52303120b93.zip
Add test script for user2user programs
Simple test programs to make sure that user2user functions. ticket: 6878 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24685 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl')
-rw-r--r--src/appl/user_user/Makefile.in4
-rw-r--r--src/appl/user_user/server.c17
-rw-r--r--src/appl/user_user/t_user2user.py18
3 files changed, 35 insertions, 4 deletions
diff --git a/src/appl/user_user/Makefile.in b/src/appl/user_user/Makefile.in
index 381ece63c8..20ddc59110 100644
--- a/src/appl/user_user/Makefile.in
+++ b/src/appl/user_user/Makefile.in
@@ -1,11 +1,15 @@
mydir=appl$(S)user_user
BUILDTOP=$(REL)..$(S)..
+# If you remove the -DDEBUG, the test program needs a line changed
DEFINES = -DDEBUG
PROG_LIBPATH=-L$(TOPLIBD)
PROG_RPATH=$(KRB5_LIBDIR)
all:: uuclient uuserver
+check-pytests:: uuclient uuserver
+ $(RUNPYTEST) $(srcdir)/t_user2user.py $(PYTESTFLAGS)
+
uuclient: client.o $(KRB5_BASE_DEPLIBS)
$(CC_LINK) -o uuclient client.o $(KRB5_BASE_LIBS)
diff --git a/src/appl/user_user/server.c b/src/appl/user_user/server.c
index 25c7b10a33..b3cfcc1639 100644
--- a/src/appl/user_user/server.c
+++ b/src/appl/user_user/server.c
@@ -84,16 +84,25 @@ int main(argc, argv)
l_inaddr.sin_family = AF_INET;
l_inaddr.sin_addr.s_addr = 0;
- if (!(sp = getservbyname("uu-sample", "tcp"))) {
- com_err("uu-server", 0, "can't find uu-sample/tcp service");
- exit(3);
+ if (argc == 2) {
+ l_inaddr.sin_port = htons(atoi(argv[1]));
+ } else {
+ if (!(sp = getservbyname("uu-sample", "tcp"))) {
+ com_err("uu-server", 0, "can't find uu-sample/tcp service");
+ exit(3);
+ }
+ l_inaddr.sin_port = sp->s_port;
}
+
(void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof (one));
- l_inaddr.sin_port = sp->s_port;
if (bind(sock, (struct sockaddr *)&l_inaddr, sizeof(l_inaddr))) {
com_err("uu-server", errno, "binding socket");
exit(3);
}
+
+ printf("Server started\n");
+ fflush(stdout);
+
if (listen(sock, 1) == -1) {
com_err("uu-server", errno, "listening");
exit(3);
diff --git a/src/appl/user_user/t_user2user.py b/src/appl/user_user/t_user2user.py
new file mode 100644
index 0000000000..bb9c42f42d
--- /dev/null
+++ b/src/appl/user_user/t_user2user.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+from k5test import *
+
+# If uuserver is not compiled under -DDEBUG, then set to 0
+debug_compiled=1
+
+for realm in multipass_realms():
+ if debug_compiled == 0:
+ realm.start_in_inetd(['./uuserver', 'uuserver'], port=9999)
+ else:
+ srv_output = realm.start_server(['./uuserver', '9999'], 'Server started')
+
+ output = realm.run_as_client(['./uuclient', hostname, 'testing message', '9999'])
+ if 'uu-client: server says \"Hello, other end of connection.\"' not in output:
+ fail('Message not echoed back.')
+
+
+success('User-2-user test programs.')