svn rev #23295: trunk/src/lib/kadm5/unit-test/

epeisach@MIT.EDU epeisach at MIT.EDU
Fri Nov 20 15:55:34 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=23295
Commit By: epeisach
Log Message:
Correct argument to kadm5_get_principal is a pointer to a struct - not
a pointer to a pointer.... Does not really matter as the field is not used - 
this test program expects a failer.

Clean up memory leaks by freeing principal and releasing context.




Changed Files:
U   trunk/src/lib/kadm5/unit-test/handle-test.c
Modified: trunk/src/lib/kadm5/unit-test/handle-test.c
===================================================================
--- trunk/src/lib/kadm5/unit-test/handle-test.c	2009-11-20 03:42:40 UTC (rev 23294)
+++ trunk/src/lib/kadm5/unit-test/handle-test.c	2009-11-20 20:55:34 UTC (rev 23295)
@@ -21,7 +21,8 @@
     kadm5_server_handle_t handle;
     kadm5_server_handle_rec orig_handle;
     kadm5_policy_ent_rec       pol;
-    kadm5_principal_ent_t      princ;
+    kadm5_principal_ent_t    princ;
+    kadm5_principal_ent_rec  kprinc;
     krb5_keyblock      *key;
     krb5_principal     tprinc;
     krb5_context       context;
@@ -40,7 +41,7 @@
     orig_handle = *handle;
     handle->magic_number = KADM5_STRUCT_VERSION;
     krb5_parse_name(context, "testuser", &tprinc);
-    ret = kadm5_get_principal(server_handle, tprinc, &princ,
+    ret = kadm5_get_principal(server_handle, tprinc, &kprinc,
                               KADM5_PRINCIPAL_NORMAL_MASK);
     if(ret != KADM5_BAD_SERVER_HANDLE) {
         fprintf(stderr, "%s -- returned -- %s\n", "get-principal",
@@ -55,6 +56,7 @@
         exit(1);
     }
 
+    princ = &kprinc;
     ret = kadm5_create_principal(server_handle, princ, KADM5_PRINCIPAL, "pass");
     if(ret != KADM5_BAD_SERVER_HANDLE) {
         fprintf(stderr, "%s -- returned -- %s\n", "create-principal",
@@ -132,5 +134,7 @@
         exit(1);
     }
 
+    krb5_free_principal(context, tprinc);
+    krb5_free_context(context);
     exit(0);
 }




More information about the cvs-krb5 mailing list