From: Tom Yu Date: Sat, 21 Aug 2004 02:31:10 +0000 (+0000) Subject: Fix no-auth test to use a config mask flag to ask for no-auth, to X-Git-Tag: krb5-1.4-beta1~134 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cad0ad67abab8fbaa0093b8462911749dbed7b1d;p=krb5.git 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 --- diff --git a/src/lib/kadm5/ChangeLog b/src/lib/kadm5/ChangeLog index c0630ac9b..0e0ae8acf 100644 --- a/src/lib/kadm5/ChangeLog +++ b/src/lib/kadm5/ChangeLog @@ -1,3 +1,7 @@ +2004-08-20 Tom Yu + + * admin.h (KADM5_CONFIG_NO_AUTH): New flag. + 2004-06-25 Tom Yu * adb.h: diff --git a/src/lib/kadm5/admin.h b/src/lib/kadm5/admin.h index b64b80756..866cfb0bb 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 66766eef5..2bdcf07d8 100644 --- a/src/lib/kadm5/clnt/ChangeLog +++ b/src/lib/kadm5/clnt/ChangeLog @@ -1,3 +1,8 @@ +2004-08-20 Tom Yu + + * 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 * 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 731253165..c5bd4b971 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 85c048d02..7b54c00cc 100644 --- a/src/lib/kadm5/unit-test/ChangeLog +++ b/src/lib/kadm5/unit-test/ChangeLog @@ -1,3 +1,12 @@ +2004-08-20 Tom Yu + + * 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 * 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 382ac14d1..5d4fc1f70 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 5389caf71..86b356686 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 #include #include +#include #include 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); } }