#
# This patch fixes the dejagnu test suite and code to successfully run to
# completion.
#
# Note: Given that the changes are dependent upon Solaris' version of RPC it
# is not possible to contribute these changes to MIT unless RPC is also
# donated.
# Patch source: in-house
#
--- a/src/kadmin/testing/scripts/init_db
+++ b/src/kadmin/testing/scripts/init_db
@@ -215,7 +215,7 @@ changepw/kerberos@$REALM cil
EOF
-eval $LOCAL_MAKE_KEYTAB -princ kadmin/admin -princ kadmin/changepw -princ ovsec_adm/admin -princ ovsec_adm/changepw $K5ROOT/ovsec_adm.srvtab $REDIRECT
+eval $LOCAL_MAKE_KEYTAB -princ kadmin/$qualname -princ changepw/$qualname -princ ovsec_adm/admin -princ ovsec_adm/changepw $K5ROOT/ovsec_adm.srvtab $REDIRECT
# Create $K5ROOT/setup.csh to make it easy to run other programs against
# the test db
--- a/src/kadmin/testing/util/tcl_kadm5.c
+++ b/src/kadmin/testing/util/tcl_kadm5.c
@@ -13,8 +13,11 @@
#include <errno.h>
#include <stdlib.h>
#include <adb_err.h>
+#include <unistd.h>
#include "tcl_kadm5.h"
+#define MAXHOSTNAMELEN 256
+
struct flagval {
char *name;
krb5_flags val;
@@ -2504,12 +2507,14 @@ static int tcl_kadm5_get_privs(ClientDat
void Tcl_kadm5_init(Tcl_Interp *interp)
{
- char buf[20];
+ char buf[MAXHOSTNAMELEN], localname[MAXHOSTNAMELEN] = "localhost";
+
+ (void) gethostname(localname, MAXHOSTNAMELEN);
- Tcl_SetVar(interp, "KADM5_ADMIN_SERVICE",
- KADM5_ADMIN_SERVICE, TCL_GLOBAL_ONLY);
- Tcl_SetVar(interp, "KADM5_CHANGEPW_SERVICE",
- KADM5_CHANGEPW_SERVICE, TCL_GLOBAL_ONLY);
+ (void) sprintf(buf, "%s@%s", KADM5_ADMIN_HOST_SERVICE, localname);
+ Tcl_SetVar(interp, "KADM5_ADMIN_SERVICE", buf, TCL_GLOBAL_ONLY);
+ (void) sprintf(buf, "%s@%s", KADM5_CHANGEPW_HOST_SERVICE, localname);
+ Tcl_SetVar(interp, "KADM5_CHANGEPW_SERVICE", buf, TCL_GLOBAL_ONLY);
(void) sprintf(buf, "%d", KADM5_STRUCT_VERSION);
Tcl_SetVar(interp, "KADM5_STRUCT_VERSION", buf, TCL_GLOBAL_ONLY);
(void) sprintf(buf, "%d", KADM5_API_VERSION_2);
--- a/src/lib/kadm5/unit-test/Makefile.in
+++ b/src/lib/kadm5/unit-test/Makefile.in
@@ -103,7 +103,7 @@ unit-test-server-setup::
unit-test-server-cleanup::
$(ENV_SETUP) $(STOP_SERVERS_LOCAL)
-unit-test-client-body: site.exp test-noauth test-destroy test-handle-client
+unit-test-client-body: site.exp test-destroy test-handle-client
$(ENV_SETUP) $(RUNTEST) --tool api RPC=1 API=$(CLNTTCL) \
KINIT=$(BUILDTOP)/clients/kinit/kinit \
KDESTROY=$(BUILDTOP)/clients/kdestroy/kdestroy \
--- a/src/lib/kadm5/unit-test/api.current/init-v2.exp
+++ b/src/lib/kadm5/unit-test/api.current/init-v2.exp
@@ -70,7 +70,7 @@ proc test102 {} {
[config_params {KADM5_CONFIG_ADMIN_SERVER} does.not.exist] \
$KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
server_handle
- } "CANT_RESOLVE"
+ } "KADM5_RPC_ERROR"
}
if {$RPC} test102
@@ -412,7 +412,7 @@ test117
send "puts \$KADM5_ADMIN_SERVICE\n"
expect {
- -re "(\[a-zA-Z/@\]+)\n$prompt" {
+ -re "(\[a-zA-Z0-9/\\-.@\]+)\n$prompt" {
set KADM5_ADMIN_SERVICE $expect_out(1,string)
}
default {
@@ -423,7 +423,7 @@ expect {
send "puts \$KADM5_CHANGEPW_SERVICE\n"
expect {
- -re "(\[a-zA-Z/@\]+)\n$prompt" {
+ -re "(\[a-zA-Z0-9/\\-.@\]+)\n$prompt" {
set KADM5_CHANGEPW_SERVICE $expect_out(1,string)
}
default {
@@ -434,10 +434,11 @@ expect {
test "init 150"
proc test150 {} {
- global test KADM5_ADMIN_SERVICE
+ global test hostname
+ get_hostname
kdestroy
- kinit testuser notathena "-S $KADM5_ADMIN_SERVICE"
+ kinit testuser notathena "-S kadmin/$hostname"
one_line_succeed_test {
kadm5_init_with_creds testuser null $KADM5_ADMIN_SERVICE \
null $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
@@ -449,10 +450,11 @@ if {$RPC} test150
test "init 151"
proc test151 {} {
- global test KADM5_CHANGEPW_SERVICE
+ global test hostname
+ get_hostname
kdestroy
- kinit testuser notathena "-S $KADM5_CHANGEPW_SERVICE"
+ kinit testuser notathena "-S changepw/$hostname"
one_line_succeed_test {
kadm5_init_with_creds testuser null $KADM5_CHANGEPW_SERVICE \
null $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
--- a/src/lib/kadm5/unit-test/api.current/init.exp
+++ b/src/lib/kadm5/unit-test/api.current/init.exp
@@ -697,8 +697,8 @@ if {$RPC} {
# re-extract the keytab so it is right
exec rm $env(K5ROOT)/ovsec_adm.srvtab
exec $env(MAKE_KEYTAB) -princ ovsec_adm/admin -princ ovsec_adm/changepw \
- -princ kadmin/admin -princ kadmin/changepw \
- $env(K5ROOT)/ovsec_adm.srvtab
+ -princ kadmin/[exec $env(QUALNAME)] \
+ -princ changepw/[exec $env(QUALNAME)] $env(K5ROOT)/ovsec_adm.srvtab
}
return ""
--- a/src/lib/kadm5/unit-test/destroy-test.c
+++ b/src/lib/kadm5/unit-test/destroy-test.c
@@ -27,7 +27,7 @@ int main()
exit(2);
}
for(x = 0; x < TEST_NUM; x++) {
- ret = kadm5_init(context, "admin", "admin", KADM5_ADMIN_SERVICE, 0,
+ ret = kadm5_init(context, "admin", "admin", NULL, 0,
KADM5_STRUCT_VERSION, KADM5_API_VERSION_4, NULL,
&server_handle);
if(ret != KADM5_OK) {
--- a/src/lib/kadm5/unit-test/handle-test.c
+++ b/src/lib/kadm5/unit-test/handle-test.c
@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
kadm5_init_krb5_context(&context);
- ret = kadm5_init(context, "admin/none", "admin", KADM5_ADMIN_SERVICE, NULL,
+ ret = kadm5_init(context, "admin/none", "admin", NULL, NULL,
KADM5_STRUCT_VERSION, KADM5_API_VERSION_4, NULL,
&server_handle);
if(ret != KADM5_OK) {
--- a/src/lib/kadm5/unit-test/iter-test.c
+++ b/src/lib/kadm5/unit-test/iter-test.c
@@ -22,7 +22,7 @@ int main(int argc, char **argv)
com_err("iter-test", ret, "while initializing context");
exit(1);
}
- ret = kadm5_init("admin", "admin", KADM5_ADMIN_SERVICE, 0,
+ ret = kadm5_init("admin", "admin", NULL, 0,
KADM5_STRUCT_VERSION, KADM5_API_VERSION_4, NULL,
&server_handle);
if (ret != KADM5_OK) {
--- a/src/lib/kadm5/unit-test/randkey-test.c
+++ b/src/lib/kadm5/unit-test/randkey-test.c
@@ -23,7 +23,7 @@ int main()
kadm5_init_krb5_context(&context);
krb5_parse_name(context, "testuser", &tprinc);
- ret = kadm5_init(context, "admin", "admin", KADM5_ADMIN_SERVICE, NULL,
+ ret = kadm5_init(context, "admin", "admin", NULL, NULL,
KADM5_STRUCT_VERSION, KADM5_API_VERSION_4, NULL,
&server_handle);
if(ret != KADM5_OK) {
--- a/src/lib/kadm5/unit-test/setkey-test.c
+++ b/src/lib/kadm5/unit-test/setkey-test.c
@@ -119,7 +119,7 @@ main(int argc, char **argv)
exit(1);
}
- ret = kadm5_init(context, authprinc, NULL, KADM5_ADMIN_SERVICE, NULL,
+ ret = kadm5_init(context, authprinc, NULL, NULL, NULL,
KADM5_STRUCT_VERSION, KADM5_API_VERSION_4, NULL,
&handle);
if (ret) {
--- a/src/tests/dejagnu/krb-standalone/kadmin.exp
+++ b/src/tests/dejagnu/krb-standalone/kadmin.exp
@@ -1050,13 +1050,16 @@ proc kadmin_test { } {
return
}
+ # The fallback to kadmin/admin is an invalid test case for Solaris RPC.
+ # Ergo this test is now commented out.
+ #
# test fallback to kadmin/admin
- if {![kadmin_delete kadmin/$hostname] \
- || ![kadmin_list] \
- || ![kadmin_add_rnd kadmin/$hostname -allow_tgs_req] \
- || ![kadmin_list]} {
- return
- }
+ #if {![kadmin_delete kadmin/$hostname] \
+ # || ![kadmin_list] \
+ # || ![kadmin_add_rnd kadmin/$hostname -allow_tgs_req] \
+ # || ![kadmin_list]} {
+ # return
+ #}
verbose "kadmin_test succeeded"
}