diff options
author | Tom Yu <tlyu@mit.edu> | 2004-08-21 02:31:10 +0000 |
---|---|---|
committer | Tom Yu <tlyu@mit.edu> | 2004-08-21 02:31:10 +0000 |
commit | cad0ad67abab8fbaa0093b8462911749dbed7b1d (patch) | |
tree | f76da1399c734fd009989fbf415b56c8a7077d21 /src | |
parent | 8b47d3950a6f8020e241d8c6f9a69762eaa64ad8 (diff) | |
download | krb5-cad0ad67abab8fbaa0093b8462911749dbed7b1d.zip krb5-cad0ad67abab8fbaa0093b8462911749dbed7b1d.tar.gz krb5-cad0ad67abab8fbaa0093b8462911749dbed7b1d.tar.bz2 |
Fix no-auth test to use a config mask flag to ask for no-auth, to
avoid the icky repeated build of client_init.c
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16678 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/kadm5/ChangeLog | 4 | ||||
-rw-r--r-- | src/lib/kadm5/admin.h | 1 | ||||
-rw-r--r-- | src/lib/kadm5/clnt/ChangeLog | 5 | ||||
-rw-r--r-- | src/lib/kadm5/clnt/client_init.c | 10 | ||||
-rw-r--r-- | src/lib/kadm5/unit-test/ChangeLog | 9 | ||||
-rw-r--r-- | src/lib/kadm5/unit-test/Makefile.in | 7 | ||||
-rw-r--r-- | src/lib/kadm5/unit-test/init-test.c | 27 |
7 files changed, 38 insertions, 25 deletions
diff --git a/src/lib/kadm5/ChangeLog b/src/lib/kadm5/ChangeLog index c0630ac..0e0ae8a 100644 --- a/src/lib/kadm5/ChangeLog +++ b/src/lib/kadm5/ChangeLog @@ -1,3 +1,7 @@ +2004-08-20 Tom Yu <tlyu@mit.edu> + + * admin.h (KADM5_CONFIG_NO_AUTH): New flag. + 2004-06-25 Tom Yu <tlyu@mit.edu> * adb.h: diff --git a/src/lib/kadm5/admin.h b/src/lib/kadm5/admin.h index b64b807..866cfb0 100644 --- a/src/lib/kadm5/admin.h +++ b/src/lib/kadm5/admin.h @@ -122,6 +122,7 @@ typedef long kadm5_ret_t; #define KADM5_CONFIG_MKEY_FROM_KBD 0x040000 #define KADM5_CONFIG_KPASSWD_PORT 0x080000 #define KADM5_CONFIG_OLD_AUTH_GSSAPI 0x100000 +#define KADM5_CONFIG_NO_AUTH 0x200000 /* * permission bits diff --git a/src/lib/kadm5/clnt/ChangeLog b/src/lib/kadm5/clnt/ChangeLog index 66766ee..2bdcf07 100644 --- a/src/lib/kadm5/clnt/ChangeLog +++ b/src/lib/kadm5/clnt/ChangeLog @@ -1,3 +1,8 @@ +2004-08-20 Tom Yu <tlyu@mit.edu> + + * client_init.c (_kadm5_init_any): Remove INIT_TEST ifdefs. Use + KADM5_CONFIG_NO_AUTH to request no auth (for testing). + 2004-06-30 Ken Raeburn <raeburn@mit.edu> * libkadm5clnt.exports: Export kadm5_get_admin_service_name. diff --git a/src/lib/kadm5/clnt/client_init.c b/src/lib/kadm5/clnt/client_init.c index 7312531..c5bd4b9 100644 --- a/src/lib/kadm5/clnt/client_init.c +++ b/src/lib/kadm5/clnt/client_init.c @@ -155,9 +155,7 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, OM_uint32 gssstat, minor_stat; gss_buffer_desc input_name; gss_name_t gss_client; -#ifndef INIT_TEST gss_name_t gss_target; -#endif gss_cred_id_t gss_client_creds = GSS_C_NO_CREDENTIAL; kadm5_server_handle_t handle; @@ -474,8 +472,6 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, else ccname_orig = 0; - -#ifndef INIT_TEST input_name.value = full_service_name; input_name.length = strlen((char *)input_name.value) + 1; gssstat = gss_import_name(&minor_stat, &input_name, @@ -484,7 +480,6 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, code = KADM5_GSS_ERROR; goto error; } -#endif /* ! INIT_TEST */ input_name.value = client_name; input_name.length = strlen((char *)input_name.value) + 1; @@ -504,7 +499,6 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, goto error; } -#ifndef INIT_TEST if (params_in != NULL && (params_in->mask & KADM5_CONFIG_OLD_AUTH_GSSAPI)) { handle->clnt->cl_auth = auth_gssapi_create(handle->clnt, @@ -519,7 +513,8 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, NULL, NULL, NULL); - } else { + } else if (params_in == NULL || + !(params_in->mask & KADM5_CONFIG_NO_AUTH)) { struct rpc_gss_sec sec; sec.mech = gss_mech_krb5; sec.qop = GSS_C_QOP_DEFAULT; @@ -529,7 +524,6 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, gss_target, &sec); } (void) gss_release_name(&minor_stat, &gss_target); -#endif /* ! INIT_TEST */ if (ccname_orig) { gssstat = gss_krb5_ccache_name(&minor_stat, ccname_orig, NULL); diff --git a/src/lib/kadm5/unit-test/ChangeLog b/src/lib/kadm5/unit-test/ChangeLog index 85c048d..7b54c00 100644 --- a/src/lib/kadm5/unit-test/ChangeLog +++ b/src/lib/kadm5/unit-test/ChangeLog @@ -1,3 +1,12 @@ +2004-08-20 Tom Yu <tlyu@mit.edu> + + * Makefile.in (init-test): Don't use local copy of client_init.o + + * init-test.c (main): Use kadm5_init() instead of + ovsec_kadm_init(). Make error messages a little more + informative. Use KADM5_CONFIG_NO_AUTH to test no-auth condition, + as the previous method was really gross. + 2004-02-13 Tom Yu <tlyu@mit.edu> * config/unix.exp (PRIOCNTL_HACK): Use "==" instead of "eq", which diff --git a/src/lib/kadm5/unit-test/Makefile.in b/src/lib/kadm5/unit-test/Makefile.in index 382ac14..5d4fc1f 100644 --- a/src/lib/kadm5/unit-test/Makefile.in +++ b/src/lib/kadm5/unit-test/Makefile.in @@ -14,13 +14,10 @@ all:: server-setkey-test client-setkey-test # The client-side test programs. # -init-test: init-test.o client_init.o $(KADMCLNT_DEPLIBS) $(KRB5_BASE_DEPLIBS) - $(CC_LINK) -o init-test init-test.o client_init.o \ +init-test: init-test.o $(KADMCLNT_DEPLIBS) $(KRB5_BASE_DEPLIBS) + $(CC_LINK) -o init-test init-test.o \ $(KADMCLNT_LIBS) $(KRB5_BASE_LIBS) -client_init.o: $(SRCTOP)/lib/kadm5/clnt/client_init.c - $(CC) $(ALL_CFLAGS) -UUSE_KADM5_API_VERSION -DUSE_KADM5_API_VERSION=2 -DINIT_TEST -c -I$(SRCTOP)/lib/kadm5 $(SRCTOP)/lib/kadm5/clnt/client_init.c - destroy-test: destroy-test.o $(KADMCLNT_DEPLIBS) $(KRB5_BASE_DEPLIBS) $(CC_LINK) -o destroy-test destroy-test.o \ $(KADMCLNT_LIBS) $(KRB5_BASE_LIBS) diff --git a/src/lib/kadm5/unit-test/init-test.c b/src/lib/kadm5/unit-test/init-test.c index 5389caf..86b3566 100644 --- a/src/lib/kadm5/unit-test/init-test.c +++ b/src/lib/kadm5/unit-test/init-test.c @@ -1,26 +1,29 @@ +#undef USE_KADM5_API_VERSION #include <kadm5/admin.h> #include <com_err.h> #include <stdio.h> +#include <stdlib.h> #include <krb5.h> int main() { - ovsec_kadm_ret_t ret; + kadm5_ret_t ret; void *server_handle; + kadm5_config_params params; - ret = ovsec_kadm_init("admin", "admin", OVSEC_KADM_ADMIN_SERVICE, 0, - OVSEC_KADM_STRUCT_VERSION, - OVSEC_KADM_API_VERSION_1, - &server_handle); - if (ret == OVSEC_KADM_RPC_ERROR) + memset(¶ms, 0, sizeof(params)); + params.mask |= KADM5_CONFIG_NO_AUTH; + ret = kadm5_init("admin", "admin", NULL, ¶ms, + KADM5_STRUCT_VERSION, KADM5_API_VERSION_2, + &server_handle); + if (ret == KADM5_RPC_ERROR) exit(0); - else if (ret != OVSEC_KADM_OK) { - com_err("init-test", ret, "while (hacked) initializing"); + else if (ret != 0) { + com_err("init-test", ret, "while initializing without auth"); exit(1); - } - else { - fprintf(stderr, "Unexpected success while (hacked) initializing!\n"); - (void) ovsec_kadm_destroy(server_handle); + } else { + fprintf(stderr, "Unexpected success while initializing without auth!\n"); + (void) kadm5_destroy(server_handle); exit(1); } } |