Fix no-auth test to use a config mask flag to ask for no-auth, to
authorTom Yu <tlyu@mit.edu>
Sat, 21 Aug 2004 02:31:10 +0000 (02:31 +0000)
committerTom Yu <tlyu@mit.edu>
Sat, 21 Aug 2004 02:31:10 +0000 (02:31 +0000)
avoid the icky repeated build of client_init.c

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16678 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm5/ChangeLog
src/lib/kadm5/admin.h
src/lib/kadm5/clnt/ChangeLog
src/lib/kadm5/clnt/client_init.c
src/lib/kadm5/unit-test/ChangeLog
src/lib/kadm5/unit-test/Makefile.in
src/lib/kadm5/unit-test/init-test.c

index c0630ac9b1435403944d3bb72813e1e0408f500b..0e0ae8acf7bbf62e7866449e97d6beb07e0bf2ed 100644 (file)
@@ -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:
index b64b80756d0f04d19cae262374ca1989d3b8e613..866cfb0bb5888641e9e61417de7b1568d90e01be 100644 (file)
@@ -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
index 66766eef5a0bbc82ad43152c57c2fa8cb301aece..2bdcf07d8a34e992f7ef51bf4d7f49c5a5bcf672 100644 (file)
@@ -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.
index 7312531654bbfa4c8d21f052a26b7c1799731494..c5bd4b9716e1eb0e98bee12b2fc7cc279ff8fa81 100644 (file)
@@ -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);
index 85c048d02f8274d1bbe5ec974cad0b25933b0c26..7b54c00cc3bf5539c632ae8951604fb0bd0614ec 100644 (file)
@@ -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
index 382ac14d1326f8a7afeaff71ebadc58910bdba2f..5d4fc1f70f1e010fcdf7c1ca0d9d8b47915b821e 100644 (file)
@@ -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)
index 5389caf7105e5365a8fe901c9f63b36ca3d3e17c..86b35668685fd157058dabe8d039a9d032c67739 100644 (file)
@@ -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(&params, 0, sizeof(params));
+     params.mask |= KADM5_CONFIG_NO_AUTH;
+     ret = kadm5_init("admin", "admin", NULL, &params,
+                     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);
      }
 }