svn rev #21967: trunk/src/lib/krb5/ccache/

epeisach@MIT.EDU epeisach at MIT.EDU
Wed Feb 11 07:47:53 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=21967
Commit By: epeisach
Log Message:
Add test for krb5_cc_get_principal and ensure returned value correct.




Changed Files:
U   trunk/src/lib/krb5/ccache/t_cc.c
Modified: trunk/src/lib/krb5/ccache/t_cc.c
===================================================================
--- trunk/src/lib/krb5/ccache/t_cc.c	2009-02-11 05:00:24 UTC (rev 21966)
+++ trunk/src/lib/krb5/ccache/t_cc.c	2009-02-11 12:47:51 UTC (rev 21967)
@@ -189,15 +189,23 @@
           exit(1);\
      } else if(debug) printf("%s went ok\n", msg);
 
+#define CHECK_BOOL(expr,errstr,msg) \
+     if (expr) {\
+          fprintf(stderr, "%s %s\n", msg, errstr);	\
+          exit(1); \
+     } else if(debug) printf("%s went ok\n", msg);
+
 #define CHECK_FAIL(experr, kret, msg) \
      if (experr != kret) { CHECK(kret, msg);}
 
-static void cc_test(krb5_context context, const char *name, int flags)
+static void cc_test(krb5_context context, const char *name, krb5_flags flags)
 {
      krb5_ccache id, id2;
      krb5_creds creds;
      krb5_error_code kret;
      krb5_cc_cursor cursor;
+     krb5_principal tmp;
+
      const char *c_name;
      char newcache[300];
      char *save_type;
@@ -221,8 +229,21 @@
      kret = krb5_cc_store_cred(context, id, &test_creds);
      CHECK(kret, "store");
 
+     kret = krb5_cc_get_principal(context, id, &tmp);
+     CHECK(kret, "get_principal");
+
+     CHECK_BOOL(krb5_realm_compare(context, tmp, test_creds.client) != TRUE,
+		"realms do not match", "realm_compare");
+
+
+     CHECK_BOOL(krb5_principal_compare(context, tmp, test_creds.client) != TRUE,
+		"principals do not match", "principal_compare");
+
+     krb5_free_principal(context, tmp);
+
      kret = krb5_cc_set_flags (context, id, flags);
      CHECK(kret, "set_flags");
+
      kret = krb5_cc_start_seq_get(context, id, &cursor);
      CHECK(kret, "start_seq_get");
      kret = 0;




More information about the cvs-krb5 mailing list