[26219] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

svn rev #25559: trunk/src/windows/ include/ leashdll/

daemon@ATHENA.MIT.EDU (tlyu@mit.edu)
Mon Dec 12 15:45:51 2011

Date: Mon, 12 Dec 2011 15:45:49 -0500
From: tlyu@mit.edu
Message-Id: <201112122045.pBCKjn4F005438@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

http://src.mit.edu/fisheye/changelog/krb5/?cs=25559
Commit By: tlyu
Log Message:
ticket: 7050
subject: kfw fixes: krb5_get_init_creds_opt_init->krb5_get_init_creds_opt_alloc

Should enable leash to generate config credentials (needs verification!)

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>


Changed Files:
U   trunk/src/windows/include/loadfuncs-krb5.h
U   trunk/src/windows/leashdll/krb5routines.c
U   trunk/src/windows/leashdll/leashdll.c
U   trunk/src/windows/leashdll/leashdll.h
Modified: trunk/src/windows/include/loadfuncs-krb5.h
===================================================================
--- trunk/src/windows/include/loadfuncs-krb5.h	2011-12-12 20:45:46 UTC (rev 25558)
+++ trunk/src/windows/include/loadfuncs-krb5.h	2011-12-12 20:45:49 UTC (rev 25559)
@@ -1384,8 +1384,24 @@
     );
 
 TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
+    krb5_get_init_creds_opt_alloc,
+    (krb5_context ctx,
+     krb5_get_init_creds_opt **opt)
+    );
+
+TYPEDEF_FUNC(
     void,
     KRB5_CALLCONV,
+    krb5_get_init_creds_opt_free,
+    (krb5_context ctx,
+     krb5_get_init_creds_opt *opt)
+    );
+
+TYPEDEF_FUNC(
+    void,
+    KRB5_CALLCONV,
     krb5_get_init_creds_opt_init,
     (krb5_get_init_creds_opt *opt)
     );
@@ -1468,6 +1484,15 @@
 TYPEDEF_FUNC(
     krb5_error_code,
     KRB5_CALLCONV,
+    krb5_get_init_creds_opt_set_out_ccache,
+    (krb5_context context,
+     krb5_get_init_creds_opt *opt,
+     krb5_ccache ccache)
+    );
+
+TYPEDEF_FUNC(
+    krb5_error_code,
+    KRB5_CALLCONV,
     krb5_get_init_creds_password,
     (krb5_context context,
      krb5_creds *creds,

Modified: trunk/src/windows/leashdll/krb5routines.c
===================================================================
--- trunk/src/windows/leashdll/krb5routines.c	2011-12-12 20:45:46 UTC (rev 25558)
+++ trunk/src/windows/leashdll/krb5routines.c	2011-12-12 20:45:49 UTC (rev 25559)
@@ -835,14 +835,13 @@
     krb5_principal		        me = 0;
     char*                       name = 0;
     krb5_creds			        my_creds;
-    krb5_get_init_creds_opt     options;
+    krb5_get_init_creds_opt *   options = NULL;
     krb5_address **             addrs = NULL;
     int                         i = 0, addr_count = 0;
 
     if (!pkrb5_init_context)
         return 0;
 
-    pkrb5_get_init_creds_opt_init(&options);
     memset(&my_creds, 0, sizeof(my_creds));
 
     if (alt_ctx)
@@ -855,6 +854,9 @@
         if (code) goto cleanup;
     }
 
+    code = pkrb5_get_init_creds_opt_alloc(ctx, &options);
+    if (code) goto cleanup;
+
     code = pkrb5_cc_default(ctx, &cc);
     if (code) goto cleanup;
 
@@ -873,15 +875,15 @@
 		renew_life *= 5*60;
 
     if (lifetime)
-        pkrb5_get_init_creds_opt_set_tkt_life(&options, lifetime);
-	pkrb5_get_init_creds_opt_set_forwardable(&options,
-                                                 forwardable ? 1 : 0);
-	pkrb5_get_init_creds_opt_set_proxiable(&options,
-                                               proxiable ? 1 : 0);
-	pkrb5_get_init_creds_opt_set_renew_life(&options,
-                                               renew_life);
+        pkrb5_get_init_creds_opt_set_tkt_life(options, lifetime);
+	pkrb5_get_init_creds_opt_set_forwardable(options,
+                                             forwardable ? 1 : 0);
+	pkrb5_get_init_creds_opt_set_proxiable(options,
+                                           proxiable ? 1 : 0);
+	pkrb5_get_init_creds_opt_set_renew_life(options,
+                                            renew_life);
     if (addressless)
-        pkrb5_get_init_creds_opt_set_address_list(&options,NULL);
+        pkrb5_get_init_creds_opt_set_address_list(options,NULL);
     else {
 		if (publicIP)
         {
@@ -937,11 +939,15 @@
             netIPAddr = htonl(publicIP);
             memcpy(addrs[i]->contents,&netIPAddr,4);
 
-            pkrb5_get_init_creds_opt_set_address_list(&options,addrs);
+            pkrb5_get_init_creds_opt_set_address_list(options,addrs);
 
         }
     }
 
+    code = pkrb5_get_init_creds_opt_set_out_ccache(ctx, options, cc);
+    if (code)
+        goto cleanup;
+
     code = pkrb5_get_init_creds_password(ctx,
                                        &my_creds,
                                        me,
@@ -950,15 +956,7 @@
                                        hParent, // prompter data
                                        0, // start time
                                        0, // service name
-                                       &options);
-    if (code) goto cleanup;
-
-    code = pkrb5_cc_initialize(ctx, cc, me);
-    if (code) goto cleanup;
-
-    code = pkrb5_cc_store_cred(ctx, cc, &my_creds);
-    if (code) goto cleanup;
-
+                                       options);
  cleanup:
     if ( addrs ) {
         for ( i=0;i<addr_count;i++ ) {
@@ -978,6 +976,8 @@
 	pkrb5_free_principal(ctx, me);
     if (cc)
 	pkrb5_cc_close(ctx, cc);
+    if (options)
+        pkrb5_get_init_creds_opt_free(ctx, options);
     if (ctx && (ctx != alt_ctx))
 	pkrb5_free_context(ctx);
     return(code);

Modified: trunk/src/windows/leashdll/leashdll.c
===================================================================
--- trunk/src/windows/leashdll/leashdll.c	2011-12-12 20:45:46 UTC (rev 25558)
+++ trunk/src/windows/leashdll/leashdll.c	2011-12-12 20:45:49 UTC (rev 25559)
@@ -22,12 +22,15 @@
 
 // krb5 functions
 DECL_FUNC_PTR(krb5_change_password);
+DECL_FUNC_PTR(krb5_get_init_creds_opt_alloc);
+DECL_FUNC_PTR(krb5_get_init_creds_opt_free);
 DECL_FUNC_PTR(krb5_get_init_creds_opt_init);
 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_tkt_life);
 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_forwardable);
 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_proxiable);
 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_address_list);
+DECL_FUNC_PTR(krb5_get_init_creds_opt_set_out_ccache);
 DECL_FUNC_PTR(krb5_get_init_creds_password);
 DECL_FUNC_PTR(krb5_build_principal_ext);
 DECL_FUNC_PTR(krb5_cc_resolve);
@@ -119,12 +122,15 @@
 
 FUNC_INFO k5_fi[] = {
     MAKE_FUNC_INFO(krb5_change_password),
+    MAKE_FUNC_INFO(krb5_get_init_creds_opt_alloc),
+    MAKE_FUNC_INFO(krb5_get_init_creds_opt_free),
     MAKE_FUNC_INFO(krb5_get_init_creds_opt_init),
     MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_tkt_life),
     MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_renew_life),
     MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_forwardable),
     MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_proxiable),
     MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_address_list),
+    MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_out_ccache),
     MAKE_FUNC_INFO(krb5_get_init_creds_password),
     MAKE_FUNC_INFO(krb5_build_principal_ext),
     MAKE_FUNC_INFO(krb5_cc_resolve),

Modified: trunk/src/windows/leashdll/leashdll.h
===================================================================
--- trunk/src/windows/leashdll/leashdll.h	2011-12-12 20:45:46 UTC (rev 25558)
+++ trunk/src/windows/leashdll/leashdll.h	2011-12-12 20:45:49 UTC (rev 25559)
@@ -160,6 +160,8 @@
 
 // krb5 functions
 extern DECL_FUNC_PTR(krb5_change_password);
+extern DECL_FUNC_PTR(krb5_get_init_creds_opt_alloc);
+extern DECL_FUNC_PTR(krb5_get_init_creds_opt_free);
 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_init);
 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_tkt_life);
 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
@@ -167,6 +169,7 @@
 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_proxiable);
 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_address_list);
+extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_out_ccache);
 extern DECL_FUNC_PTR(krb5_get_init_creds_password);
 extern DECL_FUNC_PTR(krb5_build_principal_ext);
 extern DECL_FUNC_PTR(krb5_cc_resolve);

_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post