Removed all references to DECLARG and OLDDECLARG.
authorChris Provenzano <proven@mit.edu>
Fri, 13 Jan 1995 21:21:42 +0000 (21:21 +0000)
committerChris Provenzano <proven@mit.edu>
Fri, 13 Jan 1995 21:21:42 +0000 (21:21 +0000)
Added krb5_context to all krb5_routines.

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

153 files changed:
src/lib/krb5/ccache/ChangeLog
src/lib/krb5/ccache/ccbase.c
src/lib/krb5/ccache/ccdefault.c
src/lib/krb5/ccache/file/ChangeLog
src/lib/krb5/ccache/file/fcc-proto.h
src/lib/krb5/ccache/file/fcc.h
src/lib/krb5/ccache/file/fcc_close.c
src/lib/krb5/ccache/file/fcc_defnam.c
src/lib/krb5/ccache/file/fcc_destry.c
src/lib/krb5/ccache/file/fcc_errs.c
src/lib/krb5/ccache/file/fcc_eseq.c
src/lib/krb5/ccache/file/fcc_gennew.c
src/lib/krb5/ccache/file/fcc_getnam.c
src/lib/krb5/ccache/file/fcc_gprin.c
src/lib/krb5/ccache/file/fcc_init.c
src/lib/krb5/ccache/file/fcc_maybe.c
src/lib/krb5/ccache/file/fcc_nseq.c
src/lib/krb5/ccache/file/fcc_read.c
src/lib/krb5/ccache/file/fcc_reslv.c
src/lib/krb5/ccache/file/fcc_retrv.c
src/lib/krb5/ccache/file/fcc_sflags.c
src/lib/krb5/ccache/file/fcc_skip.c
src/lib/krb5/ccache/file/fcc_sseq.c
src/lib/krb5/ccache/file/fcc_store.c
src/lib/krb5/ccache/file/fcc_test.c
src/lib/krb5/ccache/file/fcc_write.c
src/lib/krb5/ccache/stdio/ChangeLog
src/lib/krb5/ccache/stdio/scc-proto.h
src/lib/krb5/ccache/stdio/scc.h
src/lib/krb5/ccache/stdio/scc_close.c
src/lib/krb5/ccache/stdio/scc_defnam.c
src/lib/krb5/ccache/stdio/scc_destry.c
src/lib/krb5/ccache/stdio/scc_errs.c
src/lib/krb5/ccache/stdio/scc_eseq.c
src/lib/krb5/ccache/stdio/scc_gennew.c
src/lib/krb5/ccache/stdio/scc_getnam.c
src/lib/krb5/ccache/stdio/scc_gprin.c
src/lib/krb5/ccache/stdio/scc_init.c
src/lib/krb5/ccache/stdio/scc_maybe.c
src/lib/krb5/ccache/stdio/scc_nseq.c
src/lib/krb5/ccache/stdio/scc_read.c
src/lib/krb5/ccache/stdio/scc_reslv.c
src/lib/krb5/ccache/stdio/scc_retrv.c
src/lib/krb5/ccache/stdio/scc_sflags.c
src/lib/krb5/ccache/stdio/scc_skip.c
src/lib/krb5/ccache/stdio/scc_sseq.c
src/lib/krb5/ccache/stdio/scc_store.c
src/lib/krb5/ccache/stdio/scc_test.c
src/lib/krb5/ccache/stdio/scc_write.c
src/lib/krb5/error_tables/init_ets.c
src/lib/krb5/free/ChangeLog
src/lib/krb5/free/f_addr.c
src/lib/krb5/free/f_address.c
src/lib/krb5/free/f_ap_rep.c
src/lib/krb5/free/f_ap_req.c
src/lib/krb5/free/f_arep_enc.c
src/lib/krb5/free/f_auth_cnt.c
src/lib/krb5/free/f_authdata.c
src/lib/krb5/free/f_authent.c
src/lib/krb5/free/f_cksum.c
src/lib/krb5/free/f_cred.c
src/lib/krb5/free/f_cred_cnt.c
src/lib/krb5/free/f_cred_enc.c
src/lib/krb5/free/f_creds.c
src/lib/krb5/free/f_enc_kdc.c
src/lib/krb5/free/f_enc_tkt.c
src/lib/krb5/free/f_error.c
src/lib/krb5/free/f_kdc_rep.c
src/lib/krb5/free/f_kdc_req.c
src/lib/krb5/free/f_keyblock.c
src/lib/krb5/free/f_last_req.c
src/lib/krb5/free/f_padata.c
src/lib/krb5/free/f_princ.c
src/lib/krb5/free/f_priv.c
src/lib/krb5/free/f_priv_enc.c
src/lib/krb5/free/f_pwd_data.c
src/lib/krb5/free/f_pwd_seq.c
src/lib/krb5/free/f_safe.c
src/lib/krb5/free/f_tgt_cred.c
src/lib/krb5/free/f_ticket.c
src/lib/krb5/free/f_tickets.c
src/lib/krb5/free/f_tkt_auth.c
src/lib/krb5/keytab/ChangeLog
src/lib/krb5/keytab/ktadd.c
src/lib/krb5/keytab/ktbase.c
src/lib/krb5/keytab/ktdefault.c
src/lib/krb5/keytab/ktfr_entry.c
src/lib/krb5/keytab/ktremove.c
src/lib/krb5/keytab/read_servi.c
src/lib/krb5/krb/ChangeLog
src/lib/krb5/krb/addr_comp.c
src/lib/krb5/krb/addr_order.c
src/lib/krb5/krb/addr_srch.c
src/lib/krb5/krb/bld_pr_ext.c
src/lib/krb5/krb/bld_princ.c
src/lib/krb5/krb/chk_trans.c
src/lib/krb5/krb/compat_recv.c
src/lib/krb5/krb/conv_princ.c
src/lib/krb5/krb/copy_addrs.c
src/lib/krb5/krb/copy_athctr.c
src/lib/krb5/krb/copy_auth.c
src/lib/krb5/krb/copy_cksum.c
src/lib/krb5/krb/copy_creds.c
src/lib/krb5/krb/copy_data.c
src/lib/krb5/krb/copy_key.c
src/lib/krb5/krb/copy_princ.c
src/lib/krb5/krb/copy_tick.c
src/lib/krb5/krb/cp_key_cnt.c
src/lib/krb5/krb/decode_kdc.c
src/lib/krb5/krb/decrypt_tk.c
src/lib/krb5/krb/encode_kdc.c
src/lib/krb5/krb/encrypt_tk.c
src/lib/krb5/krb/faddr_ordr.c
src/lib/krb5/krb/free_rtree.c
src/lib/krb5/krb/gc_2tgt.c
src/lib/krb5/krb/gc_frm_kdc.c
src/lib/krb5/krb/gc_via_tgt.c
src/lib/krb5/krb/gen_seqnum.c
src/lib/krb5/krb/gen_subkey.c
src/lib/krb5/krb/get_creds.c
src/lib/krb5/krb/get_fcreds.c
src/lib/krb5/krb/get_in_tkt.c
src/lib/krb5/krb/in_tkt_pwd.c
src/lib/krb5/krb/in_tkt_sky.c
src/lib/krb5/krb/int-proto.h
src/lib/krb5/krb/kdc_rep_dc.c
src/lib/krb5/krb/mk_cred.c
src/lib/krb5/krb/mk_error.c
src/lib/krb5/krb/mk_priv.c
src/lib/krb5/krb/mk_rep.c
src/lib/krb5/krb/mk_req.c
src/lib/krb5/krb/mk_req_ext.c
src/lib/krb5/krb/mk_safe.c
src/lib/krb5/krb/parse.c
src/lib/krb5/krb/pr_to_salt.c
src/lib/krb5/krb/preauth.c
src/lib/krb5/krb/princ_comp.c
src/lib/krb5/krb/rd_cred.c
src/lib/krb5/krb/rd_error.c
src/lib/krb5/krb/rd_priv.c
src/lib/krb5/krb/rd_rep.c
src/lib/krb5/krb/rd_req.c
src/lib/krb5/krb/rd_req_dec.c
src/lib/krb5/krb/rd_req_sim.c
src/lib/krb5/krb/rd_safe.c
src/lib/krb5/krb/recvauth.c
src/lib/krb5/krb/send_tgs.c
src/lib/krb5/krb/sendauth.c
src/lib/krb5/krb/srv_rcache.c
src/lib/krb5/krb/t_walk_rtree.c
src/lib/krb5/krb/tgtname.c
src/lib/krb5/krb/unparse.c
src/lib/krb5/krb/walk_rtree.c

index 0de41cc144ccda34f5e84549d0c901a3d0abd306..07366413fd8fd5f225db25bf4c4465a102a2d9f4 100644 (file)
@@ -1,3 +1,7 @@
+Fri Jan 13 15:23:47 1995  Chris Provenzano (proven@mit.edu)
+
+    * Added krb5_context to all krb5_routines 
+
 Thu Oct 13 17:23:08 1994  Theodore Y. Ts'o  (tytso@maytag)
 
        * configure.in: Add ISODE_DEFS
index dfcefbece7848b95847f86e1144bcc757aa4cf2f..c9e295c84ab445caf643fc898aeb7f2e91e204d3 100644 (file)
@@ -42,10 +42,10 @@ static struct krb5_cc_typelist *cc_typehead = 0;
  */
 
 krb5_error_code
-krb5_cc_register(DECLARG(krb5_cc_ops *,ops),
-                DECLARG(krb5_boolean,override))
-OLDDECLARG(krb5_cc_ops *,ops)
-OLDDECLARG(krb5_boolean,override)
+krb5_cc_register(context, ops, override)
+   krb5_context context;
+   krb5_cc_ops *ops;
+   krb5_boolean override;
 {
     struct krb5_cc_typelist *t;
     for (t = cc_typehead;t && strcmp(t->ops->prefix,ops->prefix);t = t->next)
@@ -75,9 +75,10 @@ OLDDECLARG(krb5_boolean,override)
  * particular cache type.
  */
 
-krb5_error_code krb5_cc_resolve (name, cache)
-    char *name;
-    krb5_ccache *cache;
+krb5_error_code krb5_cc_resolve (context, name, cache)
+   krb5_context context;
+   char *name;
+   krb5_ccache *cache;
 {
     struct krb5_cc_typelist *tlist;
     char *pfx, *resid, *cp;
@@ -86,7 +87,7 @@ krb5_error_code krb5_cc_resolve (name, cache)
     cp = strchr (name, ':');
     if (!cp) {
        if (krb5_cc_dfl_ops)
-           return (*krb5_cc_dfl_ops->resolve)(cache, name);
+           return (*krb5_cc_dfl_ops->resolve)(context, cache, name);
        else
            return KRB5_CC_BADNAME;
     }
@@ -106,12 +107,12 @@ krb5_error_code krb5_cc_resolve (name, cache)
     for (tlist = cc_typehead; tlist; tlist = tlist->next) {
        if (strcmp (tlist->ops->prefix, pfx) == 0) {
            free(pfx);
-           return (*tlist->ops->resolve)(cache, resid);
+           return (*tlist->ops->resolve)(context, cache, resid);
        }
     }
     if (krb5_cc_dfl_ops && !strcmp (pfx, krb5_cc_dfl_ops->prefix)) {
        free (pfx);
-       return (*krb5_cc_dfl_ops->resolve)(cache, resid);
+       return (*krb5_cc_dfl_ops->resolve)(context, cache, resid);
     }
     free(pfx);
     return KRB5_CC_UNKNOWN_TYPE;
index e1f5f654057d9618576de9ec4c4f3f8ee57f6573..3400fa2dc0fb640e0ec52abc46f5fcf6c61752c4 100644 (file)
@@ -27,8 +27,9 @@
 
 #include <krb5/krb5.h>
 
-krb5_error_code krb5_cc_default(ccache)
-krb5_ccache *ccache;
+krb5_error_code krb5_cc_default(context, ccache)
+   krb5_context context;
+   krb5_ccache *ccache;
 {
-    return krb5_cc_resolve(krb5_cc_default_name(), ccache);
+    return krb5_cc_resolve(context, krb5_cc_default_name(context), ccache);
 }
index 3234f48d4038c75968e2fc20faf1a7b1450a89dd..e105df37d0a093973275c294f7f88c8f37b7be15 100644 (file)
@@ -1,3 +1,7 @@
+Fri Jan 13 15:23:47 1995  Chris Provenzano (proven@mit.edu)
+
+       * Added krb5_context to all krb5_routines
+
 Wed Dec  7 16:58:59 1994    <tytso@rsx-11.mit.edu>
 
        * fcc_write.c (krb5_fcc_store_addrs): If a null addresses is
index 56d4a1d3d9b97b9398fad9e7b64b2ca0ad6b7aac..e7bee704e2aafc3eeaed355c015de3f5cf6b8664 100644 (file)
 #define KRB5_FCC_PROTO__
 
 /* fcc_close.c */
-krb5_error_code krb5_fcc_close PROTOTYPE((krb5_ccache id ));
+krb5_error_code krb5_fcc_close 
+       PROTOTYPE((krb5_context, krb5_ccache id ));
 
 /* fcc_defnam.c */
-char *krb5_fcc_default_name PROTOTYPE((void ));
+char *krb5_fcc_default_name 
+       PROTOTYPE((krb5_context));
 
 /* fcc_destry.c */
-krb5_error_code krb5_fcc_destroy PROTOTYPE((krb5_ccache id ));
+krb5_error_code krb5_fcc_destroy 
+       PROTOTYPE((krb5_context, krb5_ccache id ));
 
 /* fcc_eseq.c */
-krb5_error_code krb5_fcc_end_seq_get PROTOTYPE((krb5_ccache id , krb5_cc_cursor *cursor ));
+krb5_error_code krb5_fcc_end_seq_get 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_cc_cursor *cursor ));
 
 /* fcc_gennew.c */
-krb5_error_code krb5_fcc_generate_new PROTOTYPE((krb5_ccache *id ));
+krb5_error_code krb5_fcc_generate_new 
+       PROTOTYPE((krb5_context, krb5_ccache *id ));
 
 /* fcc_getnam.c */
-char *krb5_fcc_get_name PROTOTYPE((krb5_ccache id ));
+char *krb5_fcc_get_name 
+       PROTOTYPE((krb5_context, krb5_ccache id ));
 
 /* fcc_gprin.c */
-krb5_error_code krb5_fcc_get_principal PROTOTYPE((krb5_ccache id , krb5_principal *princ ));
+krb5_error_code krb5_fcc_get_principal 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_principal *princ ));
 
 /* fcc_init.c */
-krb5_error_code krb5_fcc_initialize PROTOTYPE((krb5_ccache id , krb5_principal princ ));
+krb5_error_code krb5_fcc_initialize 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_principal princ ));
 
 /* fcc_nseq.c */
-krb5_error_code krb5_fcc_next_cred PROTOTYPE((krb5_ccache id , krb5_cc_cursor *cursor , krb5_creds *creds ));
+krb5_error_code krb5_fcc_next_cred 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_cc_cursor *cursor , 
+                  krb5_creds *creds ));
 
 /* fcc_read.c */
-krb5_error_code krb5_fcc_read_principal PROTOTYPE((krb5_ccache id , krb5_principal *princ ));
-krb5_error_code krb5_fcc_read_keyblock PROTOTYPE((krb5_ccache id , krb5_keyblock *keyblock ));
-krb5_error_code krb5_fcc_read_data PROTOTYPE((krb5_ccache id , krb5_data *data ));
-krb5_error_code krb5_fcc_read_int32 PROTOTYPE((krb5_ccache id , krb5_int32 *i ));
-krb5_error_code krb5_fcc_read_ui_2 PROTOTYPE((krb5_ccache id , krb5_ui_2 *i ));
-krb5_error_code krb5_fcc_read_octet PROTOTYPE((krb5_ccache id , krb5_octet *i ));
-krb5_error_code krb5_fcc_read_times PROTOTYPE((krb5_ccache id , krb5_ticket_times *t ));
-krb5_error_code krb5_fcc_read_addrs PROTOTYPE((krb5_ccache, krb5_address ***));
-krb5_error_code krb5_fcc_read_addr PROTOTYPE((krb5_ccache, krb5_address *));
-krb5_error_code krb5_fcc_read_authdata PROTOTYPE((krb5_ccache , krb5_authdata ***));
-krb5_error_code krb5_fcc_read_authdatum PROTOTYPE((krb5_ccache , krb5_authdata *));
+krb5_error_code krb5_fcc_read_principal 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_principal *princ ));
+krb5_error_code krb5_fcc_read_keyblock 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_keyblock *keyblock ));
+krb5_error_code krb5_fcc_read_data 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_data *data ));
+krb5_error_code krb5_fcc_read_int32 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_int32 *i ));
+krb5_error_code krb5_fcc_read_ui_2 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_ui_2 *i ));
+krb5_error_code krb5_fcc_read_octet 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_octet *i ));
+krb5_error_code krb5_fcc_read_times 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_ticket_times *t ));
+krb5_error_code krb5_fcc_read_addrs 
+       PROTOTYPE((krb5_context, krb5_ccache, krb5_address ***));
+krb5_error_code krb5_fcc_read_addr 
+       PROTOTYPE((krb5_context, krb5_ccache, krb5_address *));
+krb5_error_code krb5_fcc_read_authdata 
+       PROTOTYPE((krb5_context, krb5_ccache , krb5_authdata ***));
+krb5_error_code krb5_fcc_read_authdatum 
+       PROTOTYPE((krb5_context, krb5_ccache , krb5_authdata *));
 
 /* fcc_reslv.c */
-krb5_error_code krb5_fcc_resolve PROTOTYPE((krb5_ccache *id , char *residual ));
+krb5_error_code krb5_fcc_resolve 
+       PROTOTYPE((krb5_context, krb5_ccache *id , char *residual ));
 
 /* fcc_retrv.c */
-krb5_error_code krb5_fcc_retrieve PROTOTYPE((krb5_ccache id , krb5_flags whichfields , krb5_creds *mcreds , krb5_creds *creds ));
+krb5_error_code krb5_fcc_retrieve 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_flags whichfields , 
+                  krb5_creds *mcreds , 
+                  krb5_creds *creds ));
 
 /* fcc_sseq.c */
-krb5_error_code krb5_fcc_start_seq_get PROTOTYPE((krb5_ccache id , krb5_cc_cursor *cursor ));
+krb5_error_code krb5_fcc_start_seq_get 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_cc_cursor *cursor ));
 
 /* fcc_store.c */
-krb5_error_code krb5_fcc_store PROTOTYPE((krb5_ccache id , krb5_creds *creds ));
+krb5_error_code krb5_fcc_store 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_creds *creds ));
 
 /* fcc_skip.c */
-krb5_error_code krb5_fcc_skip_principal PROTOTYPE((krb5_ccache id ));
+krb5_error_code krb5_fcc_skip_principal 
+       PROTOTYPE((krb5_context, krb5_ccache id ));
 
 /* fcc_sflags.c */
-krb5_error_code krb5_fcc_set_flags PROTOTYPE((krb5_ccache id , krb5_flags flags ));
+krb5_error_code krb5_fcc_set_flags 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_flags flags ));
 
 /* fcc_ops.c */
 extern krb5_cc_ops krb5_cc_file_ops;
 
 /* fcc_write.c */
-krb5_error_code krb5_fcc_write PROTOTYPE((krb5_ccache id , krb5_pointer buf , int len ));
-krb5_error_code krb5_fcc_store_principal PROTOTYPE((krb5_ccache id , krb5_principal princ ));
-krb5_error_code krb5_fcc_store_keyblock PROTOTYPE((krb5_ccache id , krb5_keyblock *keyblock ));
-krb5_error_code krb5_fcc_store_data PROTOTYPE((krb5_ccache id , krb5_data *data ));
-krb5_error_code krb5_fcc_store_int32 PROTOTYPE((krb5_ccache id , krb5_int32 i ));
-krb5_error_code krb5_fcc_store_ui_2 PROTOTYPE((krb5_ccache id , krb5_int32 i ));
-krb5_error_code krb5_fcc_store_octet PROTOTYPE((krb5_ccache id , krb5_int32 i ));
-krb5_error_code krb5_fcc_store_times PROTOTYPE((krb5_ccache id , krb5_ticket_times *t ));
-krb5_error_code krb5_fcc_store_addrs PROTOTYPE((krb5_ccache , krb5_address ** ));
-krb5_error_code krb5_fcc_store_addr PROTOTYPE((krb5_ccache , krb5_address * ));
-krb5_error_code krb5_fcc_store_authdata PROTOTYPE((krb5_ccache , krb5_authdata **));
-krb5_error_code krb5_fcc_store_authdatum PROTOTYPE((krb5_ccache , krb5_authdata *));
+krb5_error_code krb5_fcc_write 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_pointer buf , int len ));
+krb5_error_code krb5_fcc_store_principal 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_principal princ ));
+krb5_error_code krb5_fcc_store_keyblock 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_keyblock *keyblock ));
+krb5_error_code krb5_fcc_store_data 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_data *data ));
+krb5_error_code krb5_fcc_store_int32 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_int32 i ));
+krb5_error_code krb5_fcc_store_ui_2 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_int32 i ));
+krb5_error_code krb5_fcc_store_octet 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_int32 i ));
+krb5_error_code krb5_fcc_store_times 
+       PROTOTYPE((krb5_context, krb5_ccache id , krb5_ticket_times *t ));
+krb5_error_code krb5_fcc_store_addrs 
+       PROTOTYPE((krb5_context, krb5_ccache , krb5_address ** ));
+krb5_error_code krb5_fcc_store_addr 
+       PROTOTYPE((krb5_context, krb5_ccache , krb5_address * ));
+krb5_error_code krb5_fcc_store_authdata 
+       PROTOTYPE((krb5_context, krb5_ccache , krb5_authdata **));
+krb5_error_code krb5_fcc_store_authdatum 
+       PROTOTYPE((krb5_context, krb5_ccache , krb5_authdata *));
 
 /* fcc_errs.c */
-krb5_error_code krb5_fcc_interpret PROTOTYPE((int ));
+krb5_error_code krb5_fcc_interpret 
+       PROTOTYPE((krb5_context, int ));
 
 /* fcc_maybe.c */
-krb5_error_code krb5_fcc_close_file PROTOTYPE((krb5_ccache));
-krb5_error_code krb5_fcc_open_file PROTOTYPE((krb5_ccache, int));
+krb5_error_code krb5_fcc_close_file 
+       PROTOTYPE((krb5_context, krb5_ccache));
+krb5_error_code krb5_fcc_open_file 
+       PROTOTYPE((krb5_context, krb5_ccache, int));
 
 #endif /* KRB5_FCC_PROTO__ */
index 18d560a329011cf40931d879f4dc8512c2b4bef7..bd7f0f90ce30c75df3cd5d5bfa4a81ccd5fd606d 100644 (file)
@@ -85,22 +85,22 @@ typedef struct _krb5_fcc_cursor {
      off_t pos;
 } krb5_fcc_cursor;
 
-#define MAYBE_OPEN(ID, MODE) \
+#define MAYBE_OPEN(CONTEXT, ID, MODE) \
 {                                                                      \
     if (OPENCLOSE (ID)) {                                              \
-       krb5_error_code maybe_open_ret = krb5_fcc_open_file (ID,MODE);  \
+       krb5_error_code maybe_open_ret = krb5_fcc_open_file (CONTEXT,ID,MODE);  \
        if (maybe_open_ret) return maybe_open_ret; } }
 
-#define MAYBE_CLOSE(ID, RET) \
+#define MAYBE_CLOSE(CONTEXT, ID, RET) \
 {                                                                      \
     if (OPENCLOSE (ID)) {                                              \
-       krb5_error_code maybe_close_ret = krb5_fcc_close_file (ID);     \
+       krb5_error_code maybe_close_ret = krb5_fcc_close_file (CONTEXT,ID);     \
        if (!(RET)) RET = maybe_close_ret; } }
 
-#define MAYBE_CLOSE_IGNORE(ID) \
+#define MAYBE_CLOSE_IGNORE(CONTEXT, ID) \
 {                                                                      \
     if (OPENCLOSE (ID)) {                                              \
-       (void) krb5_fcc_close_file (ID); } }
+       (void) krb5_fcc_close_file (CONTEXT,ID); } }
 
 /* DO NOT ADD ANYTHING AFTER THIS #endif */
 #endif /* __KRB5_FILE_CCACHE__ */
index 30961d8668ec9bef94d21c85276e69192c05bc6f..d59516e4d617ad35f2a93cbcee7948469d384d65 100644 (file)
  * associated with the cache.
  */
 krb5_error_code
-krb5_fcc_close(id)
+krb5_fcc_close(context, id)
+   krb5_context context;
    krb5_ccache id;
 {
      register int closeval = KRB5_OK;
 
      if (((krb5_fcc_data *) id->data)->fd >= 0)
-            krb5_fcc_close_file(id);
+            krb5_fcc_close_file(context, id);
 
      krb5_xfree(((krb5_fcc_data *) id->data)->filename);
      krb5_xfree(((krb5_fcc_data *) id->data));
index f8265d5adba175d73c155698740d4ea7da3411b7..5926aca9fac7eb99606852b7e59ecfa8f89bb899 100644 (file)
@@ -49,7 +49,8 @@ static char krb5_default_name_string[KRB5_FCC_MAXLEN] = "";
  */
 
 char *
-krb5_fcc_default_name ()
+krb5_fcc_default_name (context)
+   krb5_context context;
 {
      char *krb5ccache, *getenv();
      int len;
index 6a3298b41b8fe6f67da8b19e509e6d6b282c65e1..9fb13f63eb87b1a393fa2c306aae38e2a62963ef 100644 (file)
@@ -35,7 +35,8 @@
  * Errors:
  * system errors
  */
-krb5_error_code krb5_fcc_destroy(id)
+krb5_error_code krb5_fcc_destroy(context, id)
+   krb5_context context;
    krb5_ccache id;
 {
      struct stat buf;
@@ -46,7 +47,7 @@ krb5_error_code krb5_fcc_destroy(id)
      if (OPENCLOSE(id)) {
          ret = open(((krb5_fcc_data *) id->data)->filename, O_RDWR, 0);
          if (ret < 0) {
-             ret = krb5_fcc_interpret(errno);
+             ret = krb5_fcc_interpret(context, errno);
              goto cleanup;
          }
          ((krb5_fcc_data *) id->data)->fd = ret;
@@ -56,7 +57,7 @@ krb5_error_code krb5_fcc_destroy(id)
 
      ret = unlink(((krb5_fcc_data *) id->data)->filename);
      if (ret < 0) {
-        ret = krb5_fcc_interpret(errno);
+        ret = krb5_fcc_interpret(context, errno);
         if (OPENCLOSE(id)) {
             (void) close(((krb5_fcc_data *)id->data)->fd);
             ((krb5_fcc_data *) id->data)->fd = -1;
@@ -66,7 +67,7 @@ krb5_error_code krb5_fcc_destroy(id)
      
      ret = fstat(((krb5_fcc_data *) id->data)->fd, &buf);
      if (ret < 0) {
-        ret = krb5_fcc_interpret(errno);
+        ret = krb5_fcc_interpret(context, errno);
         if (OPENCLOSE(id)) {
             (void) close(((krb5_fcc_data *)id->data)->fd);
             ((krb5_fcc_data *) id->data)->fd = -1;
@@ -80,7 +81,7 @@ krb5_error_code krb5_fcc_destroy(id)
      memset(zeros, 0, BUFSIZ);
      for (i=0; i < size / BUFSIZ; i++)
          if (write(((krb5_fcc_data *) id->data)->fd, zeros, BUFSIZ) < 0) {
-             ret = krb5_fcc_interpret(errno);
+             ret = krb5_fcc_interpret(context, errno);
              if (OPENCLOSE(id)) {
                  (void) close(((krb5_fcc_data *)id->data)->fd);
                  ((krb5_fcc_data *) id->data)->fd = -1;
@@ -89,7 +90,7 @@ krb5_error_code krb5_fcc_destroy(id)
          }
 
      if (write(((krb5_fcc_data *) id->data)->fd, zeros, size % BUFSIZ) < 0) {
-        ret = krb5_fcc_interpret(errno);
+        ret = krb5_fcc_interpret(context, errno);
         if (OPENCLOSE(id)) {
             (void) close(((krb5_fcc_data *)id->data)->fd);
             ((krb5_fcc_data *) id->data)->fd = -1;
@@ -101,7 +102,7 @@ krb5_error_code krb5_fcc_destroy(id)
      ((krb5_fcc_data *) id->data)->fd = -1;
 
      if (ret)
-        ret = krb5_fcc_interpret(errno);
+        ret = krb5_fcc_interpret(context, errno);
 
   cleanup:
      krb5_xfree(((krb5_fcc_data *) id->data)->filename);
index 1dd96788d917d2bf157ff9780e777ef6be3d3cd6..8a4834ab18b33fb7369f974247273b9f4b515276 100644 (file)
@@ -29,7 +29,8 @@
 #include "fcc.h"
 
 krb5_error_code
-krb5_fcc_interpret(errnum)
+krb5_fcc_interpret(context, errnum)
+   krb5_context context;
 int errnum;
 {
     register int retval;
index d60a5b750ad64323e5c4aeb6528e94425cf7b666..d2b5f1f8d3a09cde0c0f90d4c9d9ca2d9f1dc897 100644 (file)
@@ -41,7 +41,8 @@
  */
 /* ARGSUSED */
 krb5_error_code
-krb5_fcc_end_seq_get(id, cursor)
+krb5_fcc_end_seq_get(context, id, cursor)
+   krb5_context context;
    krb5_ccache id;
    krb5_cc_cursor *cursor;
 {
@@ -50,7 +51,7 @@ krb5_fcc_end_seq_get(id, cursor)
      /* don't close; it may be left open by the caller,
        and if not, fcc_start_seq_get and/or fcc_next_cred will do the
        MAYBE_CLOSE.
-     MAYBE_CLOSE(id, kret); */
+     MAYBE_CLOSE(context, id, kret); */
      krb5_xfree((krb5_fcc_cursor *) *cursor);
 
      return kret;
index 36d00aab789c4916cbafbaf289658cf76b8e5a23..9b843ee8aecc4a041f0565de8fd9ef203de540fe 100644 (file)
@@ -52,7 +52,8 @@ extern krb5_cc_ops krb5_fcc_ops;
  * system errors (from open)
  */
 krb5_error_code
-krb5_fcc_generate_new (id)
+krb5_fcc_generate_new (context, id)
+   krb5_context context;
    krb5_ccache *id;
 {
      krb5_ccache lid;
@@ -100,7 +101,7 @@ krb5_fcc_generate_new (id)
      ret = open(((krb5_fcc_data *) lid->data)->filename,
                O_CREAT | O_EXCL | O_WRONLY, 0);
      if (ret == -1) {
-         retcode = krb5_fcc_interpret(errno);
+         retcode = krb5_fcc_interpret(context, errno);
           goto err_out;
      } else {
          krb5_int16 fcc_fvno = htons(KRB5_FCC_DEFAULT_FVNO);
@@ -117,13 +118,13 @@ krb5_fcc_generate_new (id)
              errsave = errno;
              (void) close(ret);
              (void) unlink(((krb5_fcc_data *) lid->data)->filename);
-             retcode = (cnt == -1) ? krb5_fcc_interpret(errsave) : KRB5_CC_IO;
+             retcode = (cnt == -1) ? krb5_fcc_interpret(context, errsave) : KRB5_CC_IO;
               goto err_out;
          }
          if (close(ret) == -1) {
              errsave = errno;
              (void) unlink(((krb5_fcc_data *) lid->data)->filename);
-             retcode = krb5_fcc_interpret(errsave);
+             retcode = krb5_fcc_interpret(context, errsave);
               goto err_out;
          }
 
index 76faf8825a85ae830a75580db2729e9ef9387a56..f3357f1012578d61373234fef6126fdaa9c3a61d 100644 (file)
@@ -36,7 +36,8 @@
  * The name of the file cred cache id.
  */
 char *
-krb5_fcc_get_name (id)
+krb5_fcc_get_name (context, id)
+   krb5_context context;
    krb5_ccache id;
 {
      return (char *) ((krb5_fcc_data *) id->data)->filename;
index f239c6dbc95d53afc813d86a20cc9ebf89924b10..a97abd62e9cbd36c843465ed87eb27a9f3f36962 100644 (file)
  * KRB5_CC_NOMEM
  */
 krb5_error_code
-krb5_fcc_get_principal(id, princ)
+krb5_fcc_get_principal(context, id, princ)
+   krb5_context context;
    krb5_ccache id;
    krb5_principal *princ;
 {
      krb5_error_code kret = KRB5_OK;
 
-     MAYBE_OPEN(id, FCC_OPEN_RDONLY);
+     MAYBE_OPEN(context, id, FCC_OPEN_RDONLY);
      /* make sure we're beyond the vno */
      lseek(((krb5_fcc_data *) id->data)->fd, sizeof(krb5_int16), SEEK_SET);
 
-     kret = krb5_fcc_read_principal(id, princ);
+     kret = krb5_fcc_read_principal(context, id, princ);
 
-     MAYBE_CLOSE(id, kret);
+     MAYBE_CLOSE(context, id, kret);
      return kret;
 }
 
index 019640fa5ec1d4164f61b8a98e2933e3aa1d0e8f..fffc09a88cb01bbaa2488bf1d80a4ceb239bab39 100644 (file)
  * permission errors
  */
 krb5_error_code
-krb5_fcc_initialize(id, princ)
+krb5_fcc_initialize(context, id, princ)
+   krb5_context context;
    krb5_ccache id;
    krb5_principal princ;
 {
      int ret = KRB5_OK;
 
-     MAYBE_OPEN(id, FCC_OPEN_AND_ERASE);
+     MAYBE_OPEN(context, id, FCC_OPEN_AND_ERASE);
 
 #ifdef NOFCHMOD
      ret = chmod(((krb5_fcc_data *) id->data)->filename, S_IREAD | S_IWRITE);
@@ -55,13 +56,13 @@ krb5_fcc_initialize(id, princ)
      ret = fchmod(((krb5_fcc_data *) id->data)->fd, S_IREAD | S_IWRITE);
 #endif
      if (ret == -1) {
-        ret = krb5_fcc_interpret(errno);
-        MAYBE_CLOSE(id, ret);
+        ret = krb5_fcc_interpret(context, errno);
+        MAYBE_CLOSE(context, id, ret);
         return ret;
      }
-     krb5_fcc_store_principal(id, princ);
+     krb5_fcc_store_principal(context, id, princ);
 
-     MAYBE_CLOSE(id, ret);
+     MAYBE_CLOSE(context, id, ret);
      return ret;
 }
 
index 5fcfc3aac450e1cd318da0b7e40e767e2643b077..e72e812cc0af01c33d2ae47ce010d3e538770d7a 100644 (file)
@@ -118,7 +118,8 @@ int lockunlock;
 }
 
 krb5_error_code
-krb5_fcc_close_file (id)
+krb5_fcc_close_file (context, id)
+   krb5_context context;
     krb5_ccache id;
 {
      int ret;
@@ -134,11 +135,12 @@ krb5_fcc_close_file (id)
      if (retval)
         return retval;
      else
-     return (ret == -1) ? krb5_fcc_interpret (errno) : 0;
+     return (ret == -1) ? krb5_fcc_interpret (context, errno) : 0;
 }
 
 krb5_error_code
-krb5_fcc_open_file (id, mode)
+krb5_fcc_open_file (context, id, mode)
+   krb5_context context;
     krb5_ccache id;
     int mode;
 {
@@ -170,7 +172,7 @@ krb5_fcc_open_file (id, mode)
 
      fd = open (data->filename, open_flag, 0600);
      if (fd == -1)
-         return krb5_fcc_interpret (errno);
+         return krb5_fcc_interpret (context, errno);
 
      if (retval = fcc_lock_file(data, fd, LOCK_IT)) {
         (void) close(fd);
@@ -188,7 +190,7 @@ krb5_fcc_open_file (id, mode)
             errsave = errno;
             (void) fcc_lock_file(data, fd, UNLOCK_IT);
             (void) close(fd);
-            return (cnt == -1) ? krb5_fcc_interpret(errsave) : KRB5_CC_IO;
+            return (cnt == -1) ? krb5_fcc_interpret(context, errsave) : KRB5_CC_IO;
         }
      } else {
         /* verify a valid version number is there */
index 08746a6b5ce7f17f81a886d41b3cc96e92f31ecf..1a85acd0a54e3ec934118ffe8c56df3e497805b4 100644 (file)
@@ -49,7 +49,8 @@
  * system errors
  */
 krb5_error_code
-krb5_fcc_next_cred(id, cursor, creds)
+krb5_fcc_next_cred(context, id, cursor, creds)
+   krb5_context context;
    krb5_ccache id;
    krb5_cc_cursor *cursor;
    krb5_creds *creds;
@@ -63,47 +64,47 @@ krb5_fcc_next_cred(id, cursor, creds)
 
      memset((char *)creds, 0, sizeof(*creds));
 
-     MAYBE_OPEN(id, FCC_OPEN_RDONLY);
+     MAYBE_OPEN(context, id, FCC_OPEN_RDONLY);
 
      fcursor = (krb5_fcc_cursor *) *cursor;
 
      ret = lseek(((krb5_fcc_data *) id->data)->fd, fcursor->pos, SEEK_SET);
      if (ret < 0) {
-        ret = krb5_fcc_interpret(errno);
-        MAYBE_CLOSE(id, ret);
+        ret = krb5_fcc_interpret(context, errno);
+        MAYBE_CLOSE(context, id, ret);
         return ret;
      }
 
-     kret = krb5_fcc_read_principal(id, &creds->client);
+     kret = krb5_fcc_read_principal(context, id, &creds->client);
      TCHECK(kret);
-     kret = krb5_fcc_read_principal(id, &creds->server);
+     kret = krb5_fcc_read_principal(context, id, &creds->server);
      TCHECK(kret);
-     kret = krb5_fcc_read_keyblock(id, &creds->keyblock);
+     kret = krb5_fcc_read_keyblock(context, id, &creds->keyblock);
      TCHECK(kret);
-     kret = krb5_fcc_read_times(id, &creds->times);
+     kret = krb5_fcc_read_times(context, id, &creds->times);
      TCHECK(kret);
-     kret = krb5_fcc_read_octet(id, &octet);
+     kret = krb5_fcc_read_octet(context, id, &octet);
      TCHECK(kret);
      creds->is_skey = octet;
-     kret = krb5_fcc_read_int32(id, &int32);
+     kret = krb5_fcc_read_int32(context, id, &int32);
      TCHECK(kret);
      creds->ticket_flags = int32;
-     kret = krb5_fcc_read_addrs(id, &creds->addresses);
+     kret = krb5_fcc_read_addrs(context, id, &creds->addresses);
      TCHECK(kret);
-     kret = krb5_fcc_read_authdata(id, &creds->authdata);
+     kret = krb5_fcc_read_authdata(context, id, &creds->authdata);
      TCHECK(kret);
-     kret = krb5_fcc_read_data(id, &creds->ticket);
+     kret = krb5_fcc_read_data(context, id, &creds->ticket);
      TCHECK(kret);
-     kret = krb5_fcc_read_data(id, &creds->second_ticket);
+     kret = krb5_fcc_read_data(context, id, &creds->second_ticket);
      TCHECK(kret);
      
      fcursor->pos = lseek(((krb5_fcc_data *) id->data)->fd, 0, SEEK_CUR);
      cursor = (krb5_cc_cursor *) fcursor;
 
 lose:
-     MAYBE_CLOSE(id, kret);            /* won't overwrite kret
+     MAYBE_CLOSE(context, id, kret);           /* won't overwrite kret
                                           if already set */
      if (kret != KRB5_OK)
-        krb5_free_cred_contents(creds);
+        krb5_free_cred_contents(context, creds);
      return kret;
 }
index 7a91d6a0fb22d264dfeb9c7a14a9e4a3712a2404..801cb7501a4765f94788b1b1cf97b06228610c5b 100644 (file)
@@ -41,7 +41,8 @@
  * system errors (read)
  */
 krb5_error_code
-krb5_fcc_read(id, buf, len)
+krb5_fcc_read(context, id, buf, len)
+   krb5_context context;
    krb5_ccache id;
    krb5_pointer buf;
    int len;
@@ -50,7 +51,7 @@ krb5_fcc_read(id, buf, len)
 
      ret = read(((krb5_fcc_data *) id->data)->fd, (char *) buf, len);
      if (ret == -1)
-         return krb5_fcc_interpret(errno);
+         return krb5_fcc_interpret(context, errno);
      else if (ret != len)
          return KRB5_CC_END;
      else
@@ -75,7 +76,8 @@ krb5_fcc_read(id, buf, len)
  */
 
 krb5_error_code
-krb5_fcc_read_principal(id, princ)
+krb5_fcc_read_principal(context, id, princ)
+   krb5_context context;
    krb5_ccache id;
    krb5_principal *princ;
 {
@@ -89,13 +91,13 @@ krb5_fcc_read_principal(id, princ)
        type = KRB5_NT_UNKNOWN;
     } else {
         /* Read principal type */
-        kret = krb5_fcc_read_int32(id, &type);
+        kret = krb5_fcc_read_int32(context, id, &type);
         if (kret != KRB5_OK)
            return kret;
     }
 
     /* Read the number of components */
-    kret = krb5_fcc_read_int32(id, &length);
+    kret = krb5_fcc_read_int32(context, id, &length);
     if (kret != KRB5_OK)
        return kret;
 
@@ -121,13 +123,13 @@ krb5_fcc_read_principal(id, princ)
     tmpprinc->length = length;
     tmpprinc->type = type;
 
-    kret = krb5_fcc_read_data(id, krb5_princ_realm(tmpprinc));
+    kret = krb5_fcc_read_data(context, id, krb5_princ_realm(context, tmpprinc));
 
     i = 0;
     CHECK(kret);
 
     for (i=0; i < length; i++) {
-       kret = krb5_fcc_read_data(id, krb5_princ_component(tmpprinc, i));
+       kret = krb5_fcc_read_data(context, id, krb5_princ_component(context, tmpprinc, i));
        CHECK(kret);
     }
     *princ = tmpprinc;
@@ -135,14 +137,15 @@ krb5_fcc_read_principal(id, princ)
 
  errout:
     while(--i >= 0)
-       free(krb5_princ_component(tmpprinc, i)->data);
+       free(krb5_princ_component(context, tmpprinc, i)->data);
     free((char *)tmpprinc->data);
     free((char *)tmpprinc);
     return kret;
 }
 
 krb5_error_code
-krb5_fcc_read_addrs(id, addrs)
+krb5_fcc_read_addrs(context, id, addrs)
+   krb5_context context;
    krb5_ccache id;
    krb5_address ***addrs;
 {
@@ -153,7 +156,7 @@ krb5_fcc_read_addrs(id, addrs)
      *addrs = 0;
 
      /* Read the number of components */
-     kret = krb5_fcc_read_int32(id, &length);
+     kret = krb5_fcc_read_int32(context, id, &length);
      CHECK(kret);
 
      /* Make *addrs able to hold length pointers to krb5_address structs
@@ -166,22 +169,23 @@ krb5_fcc_read_addrs(id, addrs)
      for (i=0; i < length; i++) {
          (*addrs)[i] = (krb5_address *) malloc(sizeof(krb5_address));
          if ((*addrs)[i] == NULL) {
-             krb5_free_addresses(*addrs);
+             krb5_free_addresses(context, *addrs);
              return KRB5_CC_NOMEM;
          }       
-         kret = krb5_fcc_read_addr(id, (*addrs)[i]);
+         kret = krb5_fcc_read_addr(context, id, (*addrs)[i]);
          CHECK(kret);
      }
 
      return KRB5_OK;
  errout:
      if (*addrs)
-        krb5_free_addresses(*addrs);
+        krb5_free_addresses(context, *addrs);
      return kret;
 }
 
 krb5_error_code
-krb5_fcc_read_keyblock(id, keyblock)
+krb5_fcc_read_keyblock(context, id, keyblock)
+   krb5_context context;
    krb5_ccache id;
    krb5_keyblock *keyblock;
 {
@@ -193,19 +197,19 @@ krb5_fcc_read_keyblock(id, keyblock)
      keyblock->magic = KV5M_KEYBLOCK;
      keyblock->contents = 0;
 
-     kret = krb5_fcc_read_ui_2(id, &ui2);
+     kret = krb5_fcc_read_ui_2(context, id, &ui2);
      keyblock->keytype = ui2;
      CHECK(kret);
      if ((data->version == KRB5_FCC_FVNO_1) ||
         (data->version == KRB5_FCC_FVNO_2))
             keyblock->etype = ETYPE_UNKNOWN;
      else {
-            kret = krb5_fcc_read_ui_2(id, &ui2);
+            kret = krb5_fcc_read_ui_2(context, id, &ui2);
             keyblock->etype = ui2;
             CHECK(kret);
      }
 
-     kret = krb5_fcc_read_int32(id, &int32);
+     kret = krb5_fcc_read_int32(context, id, &int32);
      CHECK(kret);
      keyblock->length = int32;
      if ( keyblock->length == 0 )
@@ -215,7 +219,7 @@ krb5_fcc_read_keyblock(id, keyblock)
      if (keyblock->contents == NULL)
          return KRB5_CC_NOMEM;
      
-     kret = krb5_fcc_read(id, keyblock->contents, keyblock->length);
+     kret = krb5_fcc_read(context, id, keyblock->contents, keyblock->length);
      if (kret)
         goto errout;
 
@@ -227,7 +231,8 @@ krb5_fcc_read_keyblock(id, keyblock)
 }
 
 krb5_error_code
-krb5_fcc_read_data(id, data)
+krb5_fcc_read_data(context, id, data)
+   krb5_context context;
    krb5_ccache id;
    krb5_data *data;
 {
@@ -236,7 +241,7 @@ krb5_fcc_read_data(id, data)
      data->magic = KV5M_DATA;
      data->data = 0;
 
-     kret = krb5_fcc_read_int32(id, &data->length);
+     kret = krb5_fcc_read_int32(context, id, &data->length);
      CHECK(kret);
 
      if (data->length == 0) {
@@ -248,7 +253,7 @@ krb5_fcc_read_data(id, data)
      if (data->data == NULL)
          return KRB5_CC_NOMEM;
 
-     kret = krb5_fcc_read(id, data->data, data->length);
+     kret = krb5_fcc_read(context, id, data->data, data->length);
      CHECK(kret);
      
      data->data[data->length] = 0; /* Null terminate, just in case.... */
@@ -260,7 +265,8 @@ krb5_fcc_read_data(id, data)
 }
 
 krb5_error_code
-krb5_fcc_read_addr(id, addr)
+krb5_fcc_read_addr(context, id, addr)
+   krb5_context context;
    krb5_ccache id;
    krb5_address *addr;
 {
@@ -271,11 +277,11 @@ krb5_fcc_read_addr(id, addr)
      addr->magic = KV5M_ADDRESS;
      addr->contents = 0;
 
-     kret = krb5_fcc_read_ui_2(id, &ui2);
+     kret = krb5_fcc_read_ui_2(context, id, &ui2);
      CHECK(kret);
      addr->addrtype = ui2;
      
-     kret = krb5_fcc_read_int32(id, &int32);
+     kret = krb5_fcc_read_int32(context, id, &int32);
      CHECK(kret);
      addr->length = int32;
 
@@ -286,7 +292,7 @@ krb5_fcc_read_addr(id, addr)
      if (addr->contents == NULL)
          return KRB5_CC_NOMEM;
 
-     kret = krb5_fcc_read(id, addr->contents, addr->length);
+     kret = krb5_fcc_read(context, id, addr->contents, addr->length);
      CHECK(kret);
 
      return KRB5_OK;
@@ -297,7 +303,8 @@ krb5_fcc_read_addr(id, addr)
 }
 
 krb5_error_code
-krb5_fcc_read_int32(id, i)
+krb5_fcc_read_int32(context, id, i)
+   krb5_context context;
    krb5_ccache id;
    krb5_int32 *i;
 {
@@ -307,9 +314,9 @@ krb5_fcc_read_int32(id, i)
 
     if ((data->version == KRB5_FCC_FVNO_1) ||
        (data->version == KRB5_FCC_FVNO_2)) 
-       return krb5_fcc_read(id, (krb5_pointer) i, sizeof(krb5_int32));
+       return krb5_fcc_read(context, id, (krb5_pointer) i, sizeof(krb5_int32));
     else {
-       retval = krb5_fcc_read(id, buf, 4);
+       retval = krb5_fcc_read(context, id, buf, 4);
        if (retval)
            return retval;
        *i = (((((buf[0] << 8) + buf[1]) << 8 ) + buf[2]) << 8) + buf[3];
@@ -318,7 +325,8 @@ krb5_fcc_read_int32(id, i)
 }
 
 krb5_error_code
-krb5_fcc_read_ui_2(id, i)
+krb5_fcc_read_ui_2(context, id, i)
+   krb5_context context;
    krb5_ccache id;
    krb5_ui_2 *i;
 {
@@ -328,9 +336,9 @@ krb5_fcc_read_ui_2(id, i)
     
     if ((data->version == KRB5_FCC_FVNO_1) ||
        (data->version == KRB5_FCC_FVNO_2))
-       return krb5_fcc_read(id, (krb5_pointer) i, sizeof(krb5_ui_2));
+       return krb5_fcc_read(context, id, (krb5_pointer) i, sizeof(krb5_ui_2));
     else {
-       retval = krb5_fcc_read(id, buf, 2);
+       retval = krb5_fcc_read(context, id, buf, 2);
        if (retval)
            return retval;
        *i = (buf[0] << 8) + buf[1];
@@ -339,16 +347,18 @@ krb5_fcc_read_ui_2(id, i)
 }    
 
 krb5_error_code
-krb5_fcc_read_octet(id, i)
+krb5_fcc_read_octet(context, id, i)
+   krb5_context context;
    krb5_ccache id;
    krb5_octet *i;
 {
-    return krb5_fcc_read(id, (krb5_pointer) i, 1);
+    return krb5_fcc_read(context, id, (krb5_pointer) i, 1);
 }    
 
 
 krb5_error_code
-krb5_fcc_read_times(id, t)
+krb5_fcc_read_times(context, id, t)
+   krb5_context context;
    krb5_ccache id;
    krb5_ticket_times *t;
 {
@@ -358,21 +368,21 @@ krb5_fcc_read_times(id, t)
     
     if ((data->version == KRB5_FCC_FVNO_1) ||
        (data->version == KRB5_FCC_FVNO_2))
-       return krb5_fcc_read(id, (krb5_pointer) t, sizeof(krb5_ticket_times));
+       return krb5_fcc_read(context, id, (krb5_pointer) t, sizeof(krb5_ticket_times));
     else {
-       retval = krb5_fcc_read_int32(id, &i);
+       retval = krb5_fcc_read_int32(context, id, &i);
        CHECK(retval);
        t->authtime = i;
        
-       retval = krb5_fcc_read_int32(id, &i);
+       retval = krb5_fcc_read_int32(context, id, &i);
        CHECK(retval);
        t->starttime = i;
 
-       retval = krb5_fcc_read_int32(id, &i);
+       retval = krb5_fcc_read_int32(context, id, &i);
        CHECK(retval);
        t->endtime = i;
 
-       retval = krb5_fcc_read_int32(id, &i);
+       retval = krb5_fcc_read_int32(context, id, &i);
        CHECK(retval);
        t->renew_till = i;
     }
@@ -382,7 +392,8 @@ errout:
 }
 
 krb5_error_code
-krb5_fcc_read_authdata(id, a)
+krb5_fcc_read_authdata(context, id, a)
+   krb5_context context;
     krb5_ccache id;
     krb5_authdata ***a;
 {
@@ -393,7 +404,7 @@ krb5_fcc_read_authdata(id, a)
      *a = 0;
 
      /* Read the number of components */
-     kret = krb5_fcc_read_int32(id, &length);
+     kret = krb5_fcc_read_int32(context, id, &length);
      CHECK(kret);
 
      if (length == 0)
@@ -409,22 +420,23 @@ krb5_fcc_read_authdata(id, a)
      for (i=0; i < length; i++) {
          (*a)[i] = (krb5_authdata *) malloc(sizeof(krb5_authdata));
          if ((*a)[i] == NULL) {
-             krb5_free_authdata(*a);
+             krb5_free_authdata(context, *a);
              return KRB5_CC_NOMEM;
          }       
-         kret = krb5_fcc_read_authdatum(id, (*a)[i]);
+         kret = krb5_fcc_read_authdatum(context, id, (*a)[i]);
          CHECK(kret);
      }
 
      return KRB5_OK;
  errout:
      if (*a)
-        krb5_free_authdata(*a);
+        krb5_free_authdata(context, *a);
      return kret;
 }
 
 krb5_error_code
-krb5_fcc_read_authdatum(id, a)
+krb5_fcc_read_authdatum(context, id, a)
+   krb5_context context;
     krb5_ccache id;
     krb5_authdata *a;
 {
@@ -435,9 +447,9 @@ krb5_fcc_read_authdatum(id, a)
     a->magic = KV5M_AUTHDATA;
     a->contents = NULL;
 
-    kret = krb5_fcc_read_ui_2(id, &a->ad_type);
+    kret = krb5_fcc_read_ui_2(context, id, &a->ad_type);
     CHECK(kret);
-    kret = krb5_fcc_read_int32(id, &int32);
+    kret = krb5_fcc_read_int32(context, id, &int32);
     CHECK(kret);
     a->length = int32;
     
@@ -448,7 +460,7 @@ krb5_fcc_read_authdatum(id, a)
     if (a->contents == NULL)
        return KRB5_CC_NOMEM;
 
-    kret = krb5_fcc_read(id, a->contents, a->length);
+    kret = krb5_fcc_read(context, id, a->contents, a->length);
     CHECK(kret);
     
      return KRB5_OK;
index 7c61ec52d9889e6671c6f9ee41fa018dd2b2ea59..2944f43bb76448e41b1622e089f16afbc36769e3 100644 (file)
@@ -50,7 +50,8 @@ extern krb5_cc_ops krb5_fcc_ops;
  * permission errors
  */
 krb5_error_code
-krb5_fcc_resolve (id, residual)
+krb5_fcc_resolve (context, id, residual)
+   krb5_context context;
    krb5_ccache *id;
    char *residual;
 {
index cf96ce05868cabd774129c6bba8a4767c9f456f9..b9d324224a515b860bac252a1b9176cb841a50a4 100644 (file)
 static krb5_boolean times_match PROTOTYPE((const krb5_ticket_times *,
                                           const krb5_ticket_times *));
 static krb5_boolean standard_fields_match
-    PROTOTYPE((const krb5_creds *,
+    PROTOTYPE((krb5_context,
+                  const krb5_creds *,
               const krb5_creds *));
 
 static krb5_boolean srvname_match
-    PROTOTYPE((const krb5_creds *,
+    PROTOTYPE((krb5_context,
+                  const krb5_creds *,
               const krb5_creds *));
 
 static krb5_boolean authdata_match
@@ -83,7 +85,8 @@ register const krb5_data *data1, *data2;
  * KRB5_CC_NOMEM
  */
 krb5_error_code
-krb5_fcc_retrieve(id, whichfields, mcreds, creds)
+krb5_fcc_retrieve(context, id, whichfields, mcreds, creds)
+   krb5_context context;
    krb5_ccache id;
    krb5_flags whichfields;
    krb5_creds *mcreds;
@@ -96,14 +99,14 @@ krb5_fcc_retrieve(id, whichfields, mcreds, creds)
      krb5_error_code kret;
      krb5_creds fetchcreds;
 
-     kret = krb5_fcc_start_seq_get(id, &cursor);
+     kret = krb5_fcc_start_seq_get(context, id, &cursor);
      if (kret != KRB5_OK)
          return kret;
 
-     while ((kret = krb5_fcc_next_cred(id, &cursor, &fetchcreds)) == KRB5_OK) {
+     while ((kret = krb5_fcc_next_cred(context, id, &cursor, &fetchcreds)) == KRB5_OK) {
          if (((set(KRB5_TC_MATCH_SRV_NAMEONLY) &&
-                  srvname_match(mcreds, &fetchcreds)) ||
-              standard_fields_match(mcreds, &fetchcreds))
+                  srvname_match(context, mcreds, &fetchcreds)) ||
+              standard_fields_match(context, mcreds, &fetchcreds))
              &&
              (! set(KRB5_TC_MATCH_IS_SKEY) ||
               mcreds->is_skey == fetchcreds.is_skey)
@@ -127,17 +130,17 @@ krb5_fcc_retrieve(id, whichfields, mcreds, creds)
               data_match (&mcreds->second_ticket, &fetchcreds.second_ticket))
              )
          {
-              krb5_fcc_end_seq_get(id, &cursor);
+              krb5_fcc_end_seq_get(context, id, &cursor);
               *creds = fetchcreds;
               return KRB5_OK;
          }
 
          /* This one doesn't match */
-         krb5_free_cred_contents(&fetchcreds);
+         krb5_free_cred_contents(context, &fetchcreds);
      }
 
      /* If we get here, a match wasn't found */
-     krb5_fcc_end_seq_get(id, &cursor);
+     krb5_fcc_end_seq_get(context, id, &cursor);
      return KRB5_CC_NOTFOUND;
 }
 
@@ -159,23 +162,25 @@ register const krb5_ticket_times *t2;
 }
 
 static krb5_boolean
-standard_fields_match(mcreds, creds)
+standard_fields_match(context, mcreds, creds)
+   krb5_context context;
 register const krb5_creds *mcreds, *creds;
 {
-    return (krb5_principal_compare(mcreds->client,creds->client) &&
-           krb5_principal_compare(mcreds->server,creds->server));
+    return (krb5_principal_compare(context, mcreds->client,creds->client) &&
+           krb5_principal_compare(context, mcreds->server,creds->server));
 }
 
 /* only match the server name portion, not the server realm portion */
 
 static krb5_boolean
-srvname_match(mcreds, creds)
+srvname_match(context, mcreds, creds)
+   krb5_context context;
 register const krb5_creds *mcreds, *creds;
 {
     krb5_boolean retval;
     krb5_principal_data p1, p2;
     
-    retval = krb5_principal_compare(mcreds->client,creds->client);
+    retval = krb5_principal_compare(context, mcreds->client,creds->client);
     if (retval != TRUE)
        return retval;
     /*
@@ -184,7 +189,7 @@ register const krb5_creds *mcreds, *creds;
     p1 = *mcreds->server;
     p2 = *creds->server;
     p1.realm = p2.realm;
-    return krb5_principal_compare(&p1, &p2);
+    return krb5_principal_compare(context, &p1, &p2);
 }
 
 static krb5_boolean
index 1eb42afd4a8a9773593fbae2968a6ab66d65989d..ac4b5a96f1ca73d8179abb57c31251b5c9cc8479 100644 (file)
@@ -40,7 +40,8 @@
  * Sets the operational flags of id to flags.
  */
 krb5_error_code
-krb5_fcc_set_flags(id, flags)
+krb5_fcc_set_flags(context, id, flags)
+   krb5_context context;
    krb5_ccache id;
    krb5_flags flags;
 {
@@ -48,12 +49,12 @@ krb5_fcc_set_flags(id, flags)
     if (flags & KRB5_TC_OPENCLOSE) {
        /* asking to turn on OPENCLOSE mode */
        if (!OPENCLOSE(id)) {
-           (void) krb5_fcc_close_file (id);
+           (void) krb5_fcc_close_file (context, id);
        }
     } else {
        /* asking to turn off OPENCLOSE mode, meaning it must be
           left open.  We open if it's not yet open */
-       MAYBE_OPEN(id, FCC_OPEN_RDONLY);
+       MAYBE_OPEN(context, id, FCC_OPEN_RDONLY);
     }
 
     ((krb5_fcc_data *) id->data)->flags = flags;
index 2cafdb0e2af07e77ae20f6fe0a3666e42422ac87..15aa43bd227c0576ea9b47146baa77115a62a08e 100644 (file)
 #include "fcc.h"
 
 krb5_error_code
-krb5_fcc_skip_principal(id)
+krb5_fcc_skip_principal(context, id)
+   krb5_context context;
    krb5_ccache id;
 {
      krb5_error_code kret;
      krb5_principal princ;
 
-     kret = krb5_fcc_read_principal(id, &princ);
+     kret = krb5_fcc_read_principal(context, id, &princ);
      if (kret != KRB5_OK)
          return kret;
 
-     krb5_free_principal(princ);
+     krb5_free_principal(context, princ);
      return KRB5_OK;
 }
 
index 1cdc0136f0cd0339813e61d8b8762af85f031ca4..622cd5701d95f42dfc0412dec8bfcaf527c24553 100644 (file)
@@ -41,7 +41,8 @@
  * system errors
  */
 krb5_error_code
-krb5_fcc_start_seq_get(id, cursor)
+krb5_fcc_start_seq_get(context, id, cursor)
+   krb5_context context;
    krb5_ccache id;
    krb5_cc_cursor *cursor;
 {
@@ -52,7 +53,7 @@ krb5_fcc_start_seq_get(id, cursor)
      if (fcursor == NULL)
          return KRB5_CC_NOMEM;
      if (OPENCLOSE(id)) {
-         ret = krb5_fcc_open_file(id, FCC_OPEN_RDONLY);
+         ret = krb5_fcc_open_file(context, id, FCC_OPEN_RDONLY);
          if (ret) {
              krb5_xfree(fcursor);
              return ret;
@@ -64,10 +65,10 @@ krb5_fcc_start_seq_get(id, cursor)
 
      /* Make sure we start reading right after the primary principal */
 
-     krb5_fcc_skip_principal(id);
+     krb5_fcc_skip_principal(context, id);
      fcursor->pos = lseek(((krb5_fcc_data *) id->data)->fd, 0, SEEK_CUR);
      *cursor = (krb5_cc_cursor) fcursor;
 
-     MAYBE_CLOSE(id, ret);
+     MAYBE_CLOSE(context, id, ret);
      return ret;
 }
index 9586f7483bc520e91b795698baf68320c5cca003..352cae763415565aaf5b77fcdbc673092e0d0a0f 100644 (file)
  * storage failure errors
  */
 krb5_error_code
-krb5_fcc_store(id, creds)
+krb5_fcc_store(context, id, creds)
+   krb5_context context;
    krb5_ccache id;
    krb5_creds *creds;
 {
 #define TCHECK(ret) if (ret != KRB5_OK) goto lose;
      krb5_error_code ret;
 
-     MAYBE_OPEN(id, FCC_OPEN_RDWR);
+     MAYBE_OPEN(context, id, FCC_OPEN_RDWR);
 
      /* Make sure we are writing to the end of the file */
      ret = lseek(((krb5_fcc_data *) id->data)->fd, 0, SEEK_END);
      if (ret < 0) {
-         MAYBE_CLOSE_IGNORE(id);
-         return krb5_fcc_interpret(errno);
+         MAYBE_CLOSE_IGNORE(context, id);
+         return krb5_fcc_interpret(context, errno);
      }
 
-     ret = krb5_fcc_store_principal(id, creds->client);
+     ret = krb5_fcc_store_principal(context, id, creds->client);
      TCHECK(ret);
-     ret = krb5_fcc_store_principal(id, creds->server);
+     ret = krb5_fcc_store_principal(context, id, creds->server);
      TCHECK(ret);
-     ret = krb5_fcc_store_keyblock(id, &creds->keyblock);
+     ret = krb5_fcc_store_keyblock(context, id, &creds->keyblock);
      TCHECK(ret);
-     ret = krb5_fcc_store_times(id, &creds->times);
+     ret = krb5_fcc_store_times(context, id, &creds->times);
      TCHECK(ret);
-     ret = krb5_fcc_store_octet(id, creds->is_skey);
+     ret = krb5_fcc_store_octet(context, id, creds->is_skey);
      TCHECK(ret);
-     ret = krb5_fcc_store_int32(id, creds->ticket_flags);
+     ret = krb5_fcc_store_int32(context, id, creds->ticket_flags);
      TCHECK(ret);
-     ret = krb5_fcc_store_addrs(id, creds->addresses);
+     ret = krb5_fcc_store_addrs(context, id, creds->addresses);
      TCHECK(ret);
-     ret = krb5_fcc_store_authdata(id, creds->authdata);
+     ret = krb5_fcc_store_authdata(context, id, creds->authdata);
      TCHECK(ret);
-     ret = krb5_fcc_store_data(id, &creds->ticket);
+     ret = krb5_fcc_store_data(context, id, &creds->ticket);
      TCHECK(ret);
-     ret = krb5_fcc_store_data(id, &creds->second_ticket);
+     ret = krb5_fcc_store_data(context, id, &creds->second_ticket);
      TCHECK(ret);
 
 lose:
-     MAYBE_CLOSE(id, ret);
+     MAYBE_CLOSE(context, id, ret);
      return ret;
 #undef TCHECK
 }
index 497e9c529ea9f33cd498efcd27fb1c367fe29014..3e3b5c57c6cfe276084d0d26bbbfbcb438f44e19 100644 (file)
@@ -111,27 +111,27 @@ void fcc_test()
 
      init_test_cred();
 
-     kret = krb5_fcc_resolve(&id, "/tmp/tkt_test");
+     kret = krb5_fcc_resolve(context, &id, "/tmp/tkt_test");
      CHECK(kret, "resolve");
-     kret = krb5_fcc_initialize(id, test_creds.client);
+     kret = krb5_fcc_initialize(context, id, test_creds.client);
      CHECK(kret, "initialize");
-     kret = krb5_fcc_store(id, &test_creds);
+     kret = krb5_fcc_store(context, id, &test_creds);
      CHECK(kret, "store");
 
-     kret = krb5_fcc_start_seq_get(id, &cursor);
+     kret = krb5_fcc_start_seq_get(context, id, &cursor);
      CHECK(kret, "start_seq_get");
      kret = 0;
      while (kret != KRB5_CC_END) {
          printf("Calling next_cred\n");
-         kret = krb5_fcc_next_cred(id, &cursor, &creds);
+         kret = krb5_fcc_next_cred(context, id, &cursor, &creds);
          CHECK(kret, "next_cred");
      }
-     kret = krb5_fcc_end_seq_get(id, &cursor);
+     kret = krb5_fcc_end_seq_get(context, id, &cursor);
      CHECK(kret, "end_seq_get");
 
-     kret = krb5_fcc_destroy(id);
+     kret = krb5_fcc_destroy(context, id);
      CHECK(kret, "destroy");
-     kret = krb5_fcc_close(id);
+     kret = krb5_fcc_close(context, id);
      CHECK(kret, "close");
 }
 
index 2633bd5095ada3d98d77133d76ae1ac261f2ea33..f5c8f8c30638511f1a92cc364da57d8ba93b0ba4 100644 (file)
@@ -42,7 +42,8 @@
  * system errors
  */
 krb5_error_code
-krb5_fcc_write(id, buf, len)
+krb5_fcc_write(context, id, buf, len)
+   krb5_context context;
    krb5_ccache id;
    krb5_pointer buf;
    int len;
@@ -51,7 +52,7 @@ krb5_fcc_write(id, buf, len)
 
      ret = write(((krb5_fcc_data *)id->data)->fd, (char *) buf, len);
      if (ret < 0)
-         return krb5_fcc_interpret(errno);
+         return krb5_fcc_interpret(context, errno);
      if (ret != len)
         return KRB5_CC_WRITE;
      return KRB5_OK;
@@ -72,7 +73,8 @@ krb5_fcc_write(id, buf, len)
  */
 
 krb5_error_code
-krb5_fcc_store_principal(id, princ)
+krb5_fcc_store_principal(context, id, princ)
+   krb5_context context;
    krb5_ccache id;
    krb5_principal princ;
 {
@@ -80,8 +82,8 @@ krb5_fcc_store_principal(id, princ)
     krb5_error_code ret;
     krb5_int32 i, length, tmp, type;
 
-    type = krb5_princ_type(princ);
-    tmp = length = krb5_princ_size(princ);
+    type = krb5_princ_type(context, princ);
+    tmp = length = krb5_princ_size(context, princ);
 
     if (data->version == KRB5_FCC_FVNO_1) {
        /*
@@ -91,18 +93,18 @@ krb5_fcc_store_principal(id, princ)
         */
        tmp++;
     } else {
-       ret = krb5_fcc_store_int32(id, type);
+       ret = krb5_fcc_store_int32(context, id, type);
        CHECK(ret);
     }
     
-    ret = krb5_fcc_store_int32(id, tmp);
+    ret = krb5_fcc_store_int32(context, id, tmp);
     CHECK(ret);
 
-    ret = krb5_fcc_store_data(id, krb5_princ_realm(princ));
+    ret = krb5_fcc_store_data(context, id, krb5_princ_realm(context, princ));
     CHECK(ret);
 
     for (i=0; i < length; i++) {
-       ret = krb5_fcc_store_data(id, krb5_princ_component(princ, i));
+       ret = krb5_fcc_store_data(context, id, krb5_princ_component(context, princ, i));
        CHECK(ret);
     }
 
@@ -110,7 +112,8 @@ krb5_fcc_store_principal(id, princ)
 }
 
 krb5_error_code
-krb5_fcc_store_addrs(id, addrs)
+krb5_fcc_store_addrs(context, id, addrs)
+   krb5_context context;
    krb5_ccache id;
    krb5_address ** addrs;
 {
@@ -125,10 +128,10 @@ krb5_fcc_store_addrs(id, addrs)
                     length += 1;
      }
 
-     ret = krb5_fcc_store_int32(id, length);
+     ret = krb5_fcc_store_int32(context, id, length);
      CHECK(ret);
      for (i=0; i < length; i++) {
-         ret = krb5_fcc_store_addr(id, addrs[i]);
+         ret = krb5_fcc_store_addr(context, id, addrs[i]);
          CHECK(ret);
      }
 
@@ -136,54 +139,58 @@ krb5_fcc_store_addrs(id, addrs)
 }
 
 krb5_error_code
-krb5_fcc_store_keyblock(id, keyblock)
+krb5_fcc_store_keyblock(context, id, keyblock)
+   krb5_context context;
    krb5_ccache id;
    krb5_keyblock *keyblock;
 {
      krb5_fcc_data *data = (krb5_fcc_data *)id->data;
      krb5_error_code ret;
 
-     ret = krb5_fcc_store_ui_2(id, keyblock->keytype);
+     ret = krb5_fcc_store_ui_2(context, id, keyblock->keytype);
      CHECK(ret);
      if ((data->version != KRB5_FCC_FVNO_1) &&
         (data->version != KRB5_FCC_FVNO_2)) {
-        ret = krb5_fcc_store_ui_2(id, keyblock->etype);
+        ret = krb5_fcc_store_ui_2(context, id, keyblock->etype);
         CHECK(ret);
      }
-     ret = krb5_fcc_store_int32(id, keyblock->length);
+     ret = krb5_fcc_store_int32(context, id, keyblock->length);
      CHECK(ret);
-     return krb5_fcc_write(id, (char *) keyblock->contents, keyblock->length);
+     return krb5_fcc_write(context, id, (char *) keyblock->contents, keyblock->length);
 }
 
 krb5_error_code
-krb5_fcc_store_addr(id, addr)
+krb5_fcc_store_addr(context, id, addr)
+   krb5_context context;
    krb5_ccache id;
    krb5_address *addr;
 {
      krb5_error_code ret;
 
-     ret = krb5_fcc_store_ui_2(id, addr->addrtype);
+     ret = krb5_fcc_store_ui_2(context, id, addr->addrtype);
      CHECK(ret);
-     ret = krb5_fcc_store_int32(id, addr->length);
+     ret = krb5_fcc_store_int32(context, id, addr->length);
      CHECK(ret);
-     return krb5_fcc_write(id, (char *) addr->contents, addr->length);
+     return krb5_fcc_write(context, id, (char *) addr->contents, addr->length);
 }
 
 
 krb5_error_code
-krb5_fcc_store_data(id, data)
+krb5_fcc_store_data(context, id, data)
+   krb5_context context;
    krb5_ccache id;
    krb5_data *data;
 {
      krb5_error_code ret;
 
-     ret = krb5_fcc_store_int32(id, data->length);
+     ret = krb5_fcc_store_int32(context, id, data->length);
      CHECK(ret);
-     return krb5_fcc_write(id, data->data, data->length);
+     return krb5_fcc_write(context, id, data->data, data->length);
 }
 
 krb5_error_code
-krb5_fcc_store_int32(id, i)
+krb5_fcc_store_int32(context, id, i)
+   krb5_context context;
    krb5_ccache id;
    krb5_int32 i;
 {
@@ -192,7 +199,7 @@ krb5_fcc_store_int32(id, i)
 
     if ((data->version == KRB5_FCC_FVNO_1) ||
        (data->version == KRB5_FCC_FVNO_2)) 
-       return krb5_fcc_write(id, (char *) &i, sizeof(krb5_int32));
+       return krb5_fcc_write(context, id, (char *) &i, sizeof(krb5_int32));
     else {
        buf[3] = i & 0xFF;
        i >>= 8;
@@ -202,12 +209,13 @@ krb5_fcc_store_int32(id, i)
        i >>= 8;
        buf[0] = i & 0xFF;
        
-       return krb5_fcc_write(id, buf, 4);
+       return krb5_fcc_write(context, id, buf, 4);
     }
 }
 
 krb5_error_code
-krb5_fcc_store_ui_2(id, i)
+krb5_fcc_store_ui_2(context, id, i)
+   krb5_context context;
     krb5_ccache id;
     krb5_int32 i;
 {
@@ -218,29 +226,31 @@ krb5_fcc_store_ui_2(id, i)
     if ((data->version == KRB5_FCC_FVNO_1) ||
        (data->version == KRB5_FCC_FVNO_2)) {
        ibuf = i;
-       return krb5_fcc_write(id, (char *) &ibuf, sizeof(krb5_ui_2));
+       return krb5_fcc_write(context, id, (char *) &ibuf, sizeof(krb5_ui_2));
     } else {
        buf[1] = i & 0xFF;
        i >>= 8;
        buf[0] = i & 0xFF;
        
-       return krb5_fcc_write(id, buf, 2);
+       return krb5_fcc_write(context, id, buf, 2);
     }
 }
    
 krb5_error_code
-krb5_fcc_store_octet(id, i)
+krb5_fcc_store_octet(context, id, i)
+   krb5_context context;
     krb5_ccache id;
     krb5_int32 i;
 {
     krb5_octet ibuf;
 
     ibuf = i;
-    return krb5_fcc_write(id, (char *) &ibuf, 1);
+    return krb5_fcc_write(context, id, (char *) &ibuf, 1);
 }
    
 krb5_error_code
-krb5_fcc_store_times(id, t)
+krb5_fcc_store_times(context, id, t)
+   krb5_context context;
    krb5_ccache id;
    krb5_ticket_times *t;
 {
@@ -249,22 +259,23 @@ krb5_fcc_store_times(id, t)
 
     if ((data->version == KRB5_FCC_FVNO_1) ||
        (data->version == KRB5_FCC_FVNO_2))
-       return krb5_fcc_write(id, (char *) t, sizeof(krb5_ticket_times));
+       return krb5_fcc_write(context, id, (char *) t, sizeof(krb5_ticket_times));
     else {
-       retval = krb5_fcc_store_int32(id, t->authtime);
+       retval = krb5_fcc_store_int32(context, id, t->authtime);
        CHECK(retval);
-       retval = krb5_fcc_store_int32(id, t->starttime);
+       retval = krb5_fcc_store_int32(context, id, t->starttime);
        CHECK(retval);
-       retval = krb5_fcc_store_int32(id, t->endtime);
+       retval = krb5_fcc_store_int32(context, id, t->endtime);
        CHECK(retval);
-       retval = krb5_fcc_store_int32(id, t->renew_till);
+       retval = krb5_fcc_store_int32(context, id, t->renew_till);
        CHECK(retval);
        return 0;
     }
 }
    
 krb5_error_code
-krb5_fcc_store_authdata(id, a)
+krb5_fcc_store_authdata(context, id, a)
+   krb5_context context;
     krb5_ccache id;
     krb5_authdata **a;
 {
@@ -277,24 +288,25 @@ krb5_fcc_store_authdata(id, a)
            length++;
     }
 
-    ret = krb5_fcc_store_int32(id, length);
+    ret = krb5_fcc_store_int32(context, id, length);
     CHECK(ret);
     for (i=0; i<length; i++) {
-       ret = krb5_fcc_store_authdatum (id, a[i]);
+       ret = krb5_fcc_store_authdatum (context, id, a[i]);
        CHECK(ret);
     }
     return KRB5_OK;
 }
 
 krb5_error_code
-krb5_fcc_store_authdatum (id, a)
+krb5_fcc_store_authdatum (context, id, a)
+   krb5_context context;
     krb5_ccache id;
     krb5_authdata *a;
 {
     krb5_error_code ret;
-    ret = krb5_fcc_store_ui_2(id, a->ad_type);
+    ret = krb5_fcc_store_ui_2(context, id, a->ad_type);
     CHECK(ret);
-    ret = krb5_fcc_store_int32(id, a->length);
+    ret = krb5_fcc_store_int32(context, id, a->length);
     CHECK(ret);
-    return krb5_fcc_write(id, (krb5_pointer) a->contents, a->length);
+    return krb5_fcc_write(context, id, (krb5_pointer) a->contents, a->length);
 }
index 13a9b22a42adfac4663ee5da11dc1343137fbed2..98f59a2be2750e80e2e2aaa80984d4d11d480fff 100644 (file)
@@ -1,3 +1,7 @@
+Fri Jan 13 15:23:47 1995  Chris Provenzano (proven@mit.edu)
+
+    * Added krb5_context to all krb5_routines 
+
 Tue Dec 13 15:42:50 1994    <tytso@rsx-11.mit.edu>
 
        * scc_write.c (krb5_scc_store_addrs): If a null addresses is
index 9cae8412314d3d2a3e4585db0963c94b4c4f7b9a..cf2e69fd200ca2ff9a6a9fe9443e152c7c1714cf 100644 (file)
 #define KRB5_SCC_PROTO__
 
 /* scc_close.c */
-krb5_error_code krb5_scc_close PROTOTYPE((krb5_ccache id ));
+krb5_error_code krb5_scc_close 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id ));
 
 /* scc_defnam.c */
-char *krb5_scc_default_name PROTOTYPE((void ));
+char *krb5_scc_default_name 
+       PROTOTYPE((krb5_context));
 
 /* scc_destry.c */
-krb5_error_code krb5_scc_destroy PROTOTYPE((krb5_ccache id ));
+krb5_error_code krb5_scc_destroy 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id ));
 
 /* scc_eseq.c */
-krb5_error_code krb5_scc_end_seq_get PROTOTYPE((krb5_ccache id , krb5_cc_cursor *cursor ));
+krb5_error_code krb5_scc_end_seq_get 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_cc_cursor *cursor ));
 
 /* scc_gennew.c */
-krb5_error_code krb5_scc_generate_new PROTOTYPE((krb5_ccache *id ));
+krb5_error_code krb5_scc_generate_new 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache *id ));
 
 /* scc_getnam.c */
-char *krb5_scc_get_name PROTOTYPE((krb5_ccache id ));
+char *krb5_scc_get_name 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id ));
 
 /* scc_gprin.c */
-krb5_error_code krb5_scc_get_principal PROTOTYPE((krb5_ccache id , krb5_principal *princ ));
+krb5_error_code krb5_scc_get_principal 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_principal *princ ));
 
 /* scc_init.c */
-krb5_error_code krb5_scc_initialize PROTOTYPE((krb5_ccache id , krb5_principal princ ));
+krb5_error_code krb5_scc_initialize 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_principal princ ));
 
 /* scc_maybe.c */
-krb5_error_code krb5_scc_close_file PROTOTYPE((krb5_ccache));
-krb5_error_code krb5_scc_open_file PROTOTYPE((krb5_ccache,int));
+krb5_error_code krb5_scc_close_file 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache));
+krb5_error_code krb5_scc_open_file 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache,
+                  int));
 
 /* scc_nseq.c */
-krb5_error_code krb5_scc_next_cred PROTOTYPE((krb5_ccache id , krb5_cc_cursor *cursor , krb5_creds *creds ));
+krb5_error_code krb5_scc_next_cred 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_cc_cursor *cursor , 
+                  krb5_creds *creds ));
 
 /* scc_read.c */
-krb5_error_code krb5_scc_read_principal PROTOTYPE((krb5_ccache id , krb5_principal *princ ));
-krb5_error_code krb5_scc_read_keyblock PROTOTYPE((krb5_ccache id , krb5_keyblock *keyblock ));
-krb5_error_code krb5_scc_read_data PROTOTYPE((krb5_ccache id , krb5_data *data ));
-krb5_error_code krb5_scc_read_int32 PROTOTYPE((krb5_ccache id , krb5_int32 *i ));
-krb5_error_code krb5_scc_read_ui_2 PROTOTYPE((krb5_ccache id , krb5_ui_2 *i ));
-krb5_error_code krb5_scc_read_octet PROTOTYPE((krb5_ccache id , krb5_octet *i ));
-krb5_error_code krb5_scc_read_times PROTOTYPE((krb5_ccache id , krb5_ticket_times *t ));
-krb5_error_code krb5_scc_read_addrs PROTOTYPE((krb5_ccache, krb5_address ***));
-krb5_error_code krb5_scc_read_addr PROTOTYPE((krb5_ccache, krb5_address *));
-krb5_error_code krb5_scc_read_authdata PROTOTYPE((krb5_ccache, krb5_authdata***));
-krb5_error_code krb5_scc_read_authdatum PROTOTYPE((krb5_ccache, krb5_authdata*));
+krb5_error_code krb5_scc_read_principal 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_principal *princ ));
+krb5_error_code krb5_scc_read_keyblock 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_keyblock *keyblock ));
+krb5_error_code krb5_scc_read_data 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_data *data ));
+krb5_error_code krb5_scc_read_int32 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_int32 *i ));
+krb5_error_code krb5_scc_read_ui_2 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_ui_2 *i ));
+krb5_error_code krb5_scc_read_octet 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_octet *i ));
+krb5_error_code krb5_scc_read_times 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_ticket_times *t ));
+krb5_error_code krb5_scc_read_addrs 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache, 
+                  krb5_address ***));
+krb5_error_code krb5_scc_read_addr 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache, 
+                  krb5_address *));
+krb5_error_code krb5_scc_read_authdata 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache, 
+                  krb5_authdata***));
+krb5_error_code krb5_scc_read_authdatum 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache, 
+                  krb5_authdata*));
 
 /* scc_reslv.c */
-krb5_error_code krb5_scc_resolve PROTOTYPE((krb5_ccache *id , char *residual ));
+krb5_error_code krb5_scc_resolve 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache *id , 
+                  char *residual ));
 
 /* scc_retrv.c */
-krb5_error_code krb5_scc_retrieve PROTOTYPE((krb5_ccache id , krb5_flags whichfields , krb5_creds *mcreds , krb5_creds *creds ));
+krb5_error_code krb5_scc_retrieve 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_flags whichfields , 
+                  krb5_creds *mcreds , 
+                  krb5_creds *creds ));
 
 /* scc_sseq.c */
-krb5_error_code krb5_scc_start_seq_get PROTOTYPE((krb5_ccache id , krb5_cc_cursor *cursor ));
+krb5_error_code krb5_scc_start_seq_get 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_cc_cursor *cursor ));
 
 /* scc_store.c */
-krb5_error_code krb5_scc_store PROTOTYPE((krb5_ccache id , krb5_creds *creds ));
+krb5_error_code krb5_scc_store 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_creds *creds ));
 
 /* scc_skip.c */
-krb5_error_code krb5_scc_skip_principal PROTOTYPE((krb5_ccache id ));
+krb5_error_code krb5_scc_skip_principal 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id ));
 
 /* scc_sflags.c */
-krb5_error_code krb5_scc_set_flags PROTOTYPE((krb5_ccache id , krb5_flags flags ));
+krb5_error_code krb5_scc_set_flags 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_flags flags ));
 
 /* scc_ops.c */
 extern krb5_cc_ops krb5_scc_ops;
 
 /* scc_write.c */
-krb5_error_code krb5_scc_write PROTOTYPE((krb5_ccache id , krb5_pointer buf , int len ));
-krb5_error_code krb5_scc_store_principal PROTOTYPE((krb5_ccache id , krb5_principal princ ));
-krb5_error_code krb5_scc_store_keyblock PROTOTYPE((krb5_ccache id , krb5_keyblock *keyblock ));
-krb5_error_code krb5_scc_store_data PROTOTYPE((krb5_ccache id , krb5_data *data ));
-krb5_error_code krb5_scc_store_int32 PROTOTYPE((krb5_ccache id , krb5_int32 i ));
-krb5_error_code krb5_scc_store_ui_2 PROTOTYPE((krb5_ccache id , krb5_int32 i ));
-krb5_error_code krb5_scc_store_octet PROTOTYPE((krb5_ccache id , krb5_int32 i ));
-krb5_error_code krb5_scc_store_times PROTOTYPE((krb5_ccache id , krb5_ticket_times *t ));
-krb5_error_code krb5_scc_store_addrs PROTOTYPE((krb5_ccache , krb5_address ** ));
-krb5_error_code krb5_scc_store_addr PROTOTYPE((krb5_ccache , krb5_address * ));
-krb5_error_code krb5_scc_store_authdata PROTOTYPE((krb5_ccache, krb5_authdata **));
-krb5_error_code krb5_scc_store_authdatum PROTOTYPE((krb5_ccache, krb5_authdata *));
+krb5_error_code krb5_scc_write 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_pointer buf , 
+                  int len ));
+krb5_error_code krb5_scc_store_principal 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_principal princ ));
+krb5_error_code krb5_scc_store_keyblock 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_keyblock *keyblock ));
+krb5_error_code krb5_scc_store_data 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_data *data ));
+krb5_error_code krb5_scc_store_int32 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_int32 i ));
+krb5_error_code krb5_scc_store_ui_2 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_int32 i ));
+krb5_error_code krb5_scc_store_octet 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_int32 i ));
+krb5_error_code krb5_scc_store_times 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache id , 
+                  krb5_ticket_times *t ));
+krb5_error_code krb5_scc_store_addrs 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache , 
+                  krb5_address ** ));
+krb5_error_code krb5_scc_store_addr 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache , 
+                  krb5_address * ));
+krb5_error_code krb5_scc_store_authdata 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache, 
+                  krb5_authdata **));
+krb5_error_code krb5_scc_store_authdatum 
+       PROTOTYPE((krb5_context, 
+                  krb5_ccache, 
+                  krb5_authdata *));
 
 /* scc_errs.c */
-krb5_error_code krb5_scc_interpret PROTOTYPE((int ));
+krb5_error_code krb5_scc_interpret 
+       PROTOTYPE((krb5_context, 
+                  int ));
 
 #endif /* KRB5_SCC_PROTO__ */
index 203b316b52e9f671f1129787d9e53bb07d1cc4ae..0a7ae0159c5209b966e7c2b50bf123872e5d49cf 100644 (file)
@@ -79,16 +79,16 @@ typedef struct _krb5_scc_cursor {
     long pos;
 } krb5_scc_cursor;
 
-#define MAYBE_OPEN(ID, MODE) \
+#define MAYBE_OPEN(context, ID, MODE) \
 {                                                                      \
     if (OPENCLOSE (ID)) {                                              \
-       krb5_error_code maybe_open_ret = krb5_scc_open_file (ID,MODE);  \
+       krb5_error_code maybe_open_ret = krb5_scc_open_file (context, ID,MODE); \
        if (maybe_open_ret) return maybe_open_ret; } }
 
-#define MAYBE_CLOSE(ID, RET) \
+#define MAYBE_CLOSE(context, ID, RET) \
 {                                                                      \
     if (OPENCLOSE (ID)) {                                              \
-       krb5_error_code maybe_close_ret = krb5_scc_close_file (ID);     \
+       krb5_error_code maybe_close_ret = krb5_scc_close_file (context, ID);    \
        if (!(RET)) RET = maybe_close_ret; } }
 
 /* DO NOT ADD ANYTHING AFTER THIS #endif */
index 760aed313c5e048372ee30ec534dac25ac0977a7..77f6d6b2339321c633dd70d53549dd0e519de9dc 100644 (file)
@@ -37,7 +37,8 @@
  * associated with the cache.
  */
 krb5_error_code
-krb5_scc_close(id)
+krb5_scc_close(context, id)
+   krb5_context context;
    krb5_ccache id;
 {
      register int closeval = KRB5_OK;
@@ -47,7 +48,7 @@ krb5_scc_close(id)
         closeval = fclose (data->file);
         data->file = 0;
         if (closeval == -1) {
-            closeval = krb5_scc_interpret(errno);
+            closeval = krb5_scc_interpret(context, errno);
         } else
             closeval = KRB5_OK;
                 
index c62a59871e0ad4304706adcabe77f3bfdba6052b..bf4d15da5256f5bf81cdade25ebf275c52548a31 100644 (file)
@@ -49,7 +49,8 @@ static char krb5_default_name_string[KRB5_SCC_MAXLEN] = "";
  */
 
 char *
-krb5_scc_default_name ()
+krb5_scc_default_name (context)
+   krb5_context context;
 {
      char *krb5ccache, *getenv();
      int len;
index 88e261c7428c5bbd4a49b9b8b3225d428847ddc4..7b1db878d06bf971565bcc16a293a6deee4984fd 100644 (file)
@@ -39,7 +39,8 @@
  * Errors:
  * system errors
  */
-krb5_error_code krb5_scc_destroy(id)
+krb5_error_code krb5_scc_destroy(context, id)
+   krb5_context context;
    krb5_ccache id;
 {
 #if 0
@@ -56,7 +57,7 @@ krb5_error_code krb5_scc_destroy(id)
 
      ret = remove (data->filename);
      if (ret < 0) {
-        ret = krb5_scc_interpret(errno);
+        ret = krb5_scc_interpret(context, errno);
         if (OPENCLOSE(id)) {
             (void) fclose(data->file);
             data->file = 0;
@@ -72,7 +73,7 @@ krb5_error_code krb5_scc_destroy(id)
       */
      ret = fstat(fileno(data->file), &buf);
      if (ret < 0) {
-        ret = krb5_scc_interpret(errno);
+        ret = krb5_scc_interpret(context, errno);
         if (OPENCLOSE(id)) {
             (void) fclose(data->file);
             data->file = 0;
@@ -86,7 +87,7 @@ krb5_error_code krb5_scc_destroy(id)
      memset (zeros, 0, BUFSIZ);
      for (i=0; i < size / BUFSIZ; i++)
          if (fwrite(data->file, zeros, BUFSIZ) < 0) {
-             ret = krb5_scc_interpret(errno);
+             ret = krb5_scc_interpret(context, errno);
              if (OPENCLOSE(id)) {
                  (void) fclose(data->file);
                  data->file = 0;
@@ -95,7 +96,7 @@ krb5_error_code krb5_scc_destroy(id)
          }
 
      if (fwrite(data->file, zeros, size % BUFSIZ) < 0) {
-        ret = krb5_scc_interpret(errno);
+        ret = krb5_scc_interpret(context, errno);
         if (OPENCLOSE(id)) {
             (void) fclose(data->file);
             data->file = 0;
@@ -108,7 +109,7 @@ krb5_error_code krb5_scc_destroy(id)
 #endif
 
      if (ret)
-        ret = krb5_scc_interpret(errno);
+        ret = krb5_scc_interpret(context, errno);
 
   cleanup:
      krb5_xfree(data->filename);
index ad3c6450e90f01bd44e3c0d7b1348c6c5b337e65..77ad352af2b6f9b8d45b4781babbaabea30410a6 100644 (file)
@@ -29,7 +29,8 @@
 #include "scc.h"
 
 krb5_error_code
-krb5_scc_interpret(errnum)
+krb5_scc_interpret(context, errnum)
+   krb5_context context;
 int errnum;
 {
     register int retval;
index d49b7b821b93c72c01c814acb151882bdf50b5fe..f8cf9c0b6f6f7d15a94ac6b4bcb325bfce7ecfb0 100644 (file)
  */
 /* ARGSUSED */
 krb5_error_code
-krb5_scc_end_seq_get(id, cursor)
+krb5_scc_end_seq_get(context, id, cursor)
+   krb5_context context;
    krb5_ccache id;
    krb5_cc_cursor *cursor;
 {
     int ret = KRB5_OK;
-/*    MAYBE_CLOSE (id, ret);*/
+/*    MAYBE_CLOSE (context, id, ret);*/
 
     krb5_xfree((krb5_scc_cursor *) *cursor);
 
index 7775a6fb20c0d3528c497a6dfab5419be364f180..8851ddba764946120a53c390337990786a364a60 100644 (file)
@@ -52,7 +52,8 @@ extern krb5_cc_ops krb5_scc_ops;
  * system errors (from open)
  */
 krb5_error_code
-krb5_scc_generate_new (id)
+krb5_scc_generate_new (context, id)
+   krb5_context context;
    krb5_ccache *id;
 {
      krb5_ccache lid;
@@ -99,19 +100,19 @@ krb5_scc_generate_new (id)
      f = fopen (((krb5_scc_data *) lid->data)->filename, "w+");
 #endif
      if (!f) {
-            retcode = krb5_scc_interpret (errno);
+            retcode = krb5_scc_interpret (context, errno);
             goto err_out;
      } else {
         krb5_int16 scc_fvno = htons(KRB5_SCC_DEFAULT_FVNO);
 
         if (!fwrite((char *)&scc_fvno, sizeof(scc_fvno), 1, f)) {
-            retcode = krb5_scc_interpret(errno);
+            retcode = krb5_scc_interpret(context, errno);
             (void) fclose(f);
             (void) remove(((krb5_scc_data *) lid->data)->filename);
             goto err_out;
         }
         if (fclose(f) == EOF) {
-            retcode = krb5_scc_interpret(errno);
+            retcode = krb5_scc_interpret(context, errno);
             (void) remove(((krb5_scc_data *) lid->data)->filename);
             goto err_out;
         }
index 61f55d1d739fd03bf5ca12260e32b781fb934ddc..0303c1009cfdb9564e392b7b9702b8ca71409702 100644 (file)
@@ -36,7 +36,8 @@
  * The name of the file cred cache id.
  */
 char *
-krb5_scc_get_name (id)
+krb5_scc_get_name (context, id)
+   krb5_context context;
    krb5_ccache id;
 {
      return (char *) ((krb5_scc_data *) id->data)->filename;
index 2054fed0629779f48a5bae327368ca798fd3607b..3f6c90d5e682d4307ed129d9674db6b8f9255532 100644 (file)
  * KRB5_CC_NOMEM
  */
 krb5_error_code
-krb5_scc_get_principal(id, princ)
+krb5_scc_get_principal(context, id, princ)
+   krb5_context context;
    krb5_ccache id;
    krb5_principal *princ;
 {
      krb5_error_code kret;
 
-     MAYBE_OPEN (id, SCC_OPEN_RDONLY);
+     MAYBE_OPEN (context, id, SCC_OPEN_RDONLY);
      /* skip over vno at beginning of file */
      fseek(((krb5_scc_data *) id->data)->file, sizeof(krb5_int16), 0);
 
-     kret = krb5_scc_read_principal(id, princ);
+     kret = krb5_scc_read_principal(context, id, princ);
 
-     MAYBE_CLOSE (id, kret);
+     MAYBE_CLOSE (context, id, kret);
      return kret;
 }
index b3bde42dfa06308041a509c579f0e4e0941175a7..ff765f9fa1ce9b97ce67321ef48773b9c887ae7c 100644 (file)
  * permission errors
  */
 krb5_error_code
-krb5_scc_initialize(id, princ)
+krb5_scc_initialize(context, id, princ)
+   krb5_context context;
    krb5_ccache id;
    krb5_principal princ;
 {
      int ret;
 
-     ret = krb5_scc_open_file (id, SCC_OPEN_AND_ERASE);
+     ret = krb5_scc_open_file (context, id, SCC_OPEN_AND_ERASE);
      if (ret < 0)
-         return krb5_scc_interpret(errno);
+         return krb5_scc_interpret(context, errno);
 
 #if 0
      ret = fchmod(((krb5_scc_data *) id->data)->fd, S_IREAD | S_IWRITE);
      if (ret == -1) {
-        ret = krb5_scc_interpret(errno);
+        ret = krb5_scc_interpret(context, errno);
         if (OPENCLOSE(id)) {
             close(((krb5_scc_data *)id->data)->fd);
             ((krb5_scc_data *) id->data)->fd = -1;
@@ -62,9 +63,9 @@ krb5_scc_initialize(id, princ)
         return ret;
      }
 #endif
-     krb5_scc_store_principal(id, princ);
+     krb5_scc_store_principal(context, id, princ);
 
-     MAYBE_CLOSE (id, ret);
+     MAYBE_CLOSE (context, id, ret);
      return ret;
 }
 
index 410dc6b6c2238d07147e56e04649e58d56407cd6..e337fe54ab6a7eb8d7fcc0ddd806d67b54701beb 100644 (file)
@@ -40,7 +40,8 @@
 int krb5_scc_default_format = KRB5_SCC_DEFAULT_FVNO;
 
 krb5_error_code
-krb5_scc_close_file (id)
+krb5_scc_close_file (context, id)
+   krb5_context context;
     krb5_ccache id;
 {
      krb5_scc_data *data;
@@ -63,22 +64,23 @@ krb5_scc_close_file (id)
      memset (data->stdio_buffer, 0, sizeof (data->stdio_buffer));
      if (ret == EOF) {
          int errsave = errno;
-         (void) krb5_unlock_file(data->file, data->filename);
+         (void) krb5_unlock_file(context, data->file, data->filename);
          (void) fclose (data->file);
          data->file = 0;
-         return krb5_scc_interpret (errsave);
+         return krb5_scc_interpret (context, errsave);
      }
-     retval = krb5_unlock_file(data->file, data->filename);
+     retval = krb5_unlock_file(context, data->file, data->filename);
      ret = fclose (data->file);
      data->file = 0;
      if (retval)
         return retval;
      else
-     return ret ? krb5_scc_interpret (errno) : 0;
+     return ret ? krb5_scc_interpret (context, errno) : 0;
 }
 
 krb5_error_code
-krb5_scc_open_file (id, mode)
+krb5_scc_open_file (context, id, mode)
+   krb5_context context;
     krb5_ccache id;
     int mode;
 {
@@ -91,7 +93,7 @@ krb5_scc_open_file (id, mode)
      data = (krb5_scc_data *) id->data;
      if (data->file) {
          /* Don't know what state it's in; shut down and start anew.  */
-         (void) krb5_unlock_file(data->file, data->filename);
+         (void) krb5_unlock_file(context, data->file, data->filename);
          (void) fclose (data->file);
          data->file = 0;
      }
@@ -125,7 +127,7 @@ krb5_scc_open_file (id, mode)
 
      f = fopen (data->filename, open_flag);
      if (!f)
-         return krb5_scc_interpret (errno);
+         return krb5_scc_interpret (context, errno);
 #ifdef HAS_SETVBUF
      setvbuf(f, data->stdio_buffer, _IOFBF, sizeof (data->stdio_buffer));
 #else
@@ -133,14 +135,14 @@ krb5_scc_open_file (id, mode)
 #endif
      switch (mode) {
      case SCC_OPEN_RDONLY:
-        if (retval = krb5_lock_file(f, data->filename, KRB5_LOCKMODE_SHARED)) {
+        if (retval = krb5_lock_file(context, f, data->filename, KRB5_LOCKMODE_SHARED)) {
             (void) fclose(f);
             return retval;
         }
         break;
      case SCC_OPEN_RDWR:
      case SCC_OPEN_AND_ERASE:
-        if (retval = krb5_lock_file(f, data->filename,
+        if (retval = krb5_lock_file(context, f, data->filename,
                                     KRB5_LOCKMODE_EXCLUSIVE)) {
             (void) fclose(f);
             return retval;
@@ -155,21 +157,21 @@ krb5_scc_open_file (id, mode)
         data->version = krb5_scc_default_format;
         if (!fwrite((char *)&scc_fvno, sizeof(scc_fvno), 1, f)) {
             errsave = errno;
-            (void) krb5_unlock_file(f, data->filename);
+            (void) krb5_unlock_file(context, f, data->filename);
             (void) fclose(f);
-            return krb5_scc_interpret(errsave);
+            return krb5_scc_interpret(context, errsave);
         }
      } else {
         /* verify a valid version number is there */
         if (!fread((char *)&scc_fvno, sizeof(scc_fvno), 1, f)) {
-            (void) krb5_unlock_file(f, data->filename);
+            (void) krb5_unlock_file(context, f, data->filename);
             (void) fclose(f);
             return KRB5_CCACHE_BADVNO;
         }
         if ((scc_fvno != htons(KRB5_SCC_FVNO_1)) &&
             (scc_fvno != htons(KRB5_SCC_FVNO_2)) &&
             (scc_fvno != htons(KRB5_SCC_FVNO_3))) {
-            (void) krb5_unlock_file(f, data->filename);
+            (void) krb5_unlock_file(context, f, data->filename);
             (void) fclose(f);
             return KRB5_CCACHE_BADVNO;
         }
index 365f57330b3b7484a757c4d98c1b99e54d644a7d..49f9e255dfc6f46cb002c4237390306437b96d15 100644 (file)
@@ -49,7 +49,8 @@
  * system errors
  */
 krb5_error_code
-krb5_scc_next_cred(id, cursor, creds)
+krb5_scc_next_cred(context, id, cursor, creds)
+   krb5_context context;
    krb5_ccache id;
    krb5_cc_cursor *cursor;
    krb5_creds *creds;
@@ -71,37 +72,37 @@ krb5_scc_next_cred(id, cursor, creds)
      Z (addresses);
 #undef Z
 
-     MAYBE_OPEN (id, SCC_OPEN_RDONLY);
+     MAYBE_OPEN (context, id, SCC_OPEN_RDONLY);
 
      fcursor = (krb5_scc_cursor *) *cursor;
      ret = fseek(((krb5_scc_data *) id->data)->file, fcursor->pos, 0);
      if (ret < 0) {
-        ret = krb5_scc_interpret(errno);
-        MAYBE_CLOSE (id, ret);
+        ret = krb5_scc_interpret(context, errno);
+        MAYBE_CLOSE (context, id, ret);
         return ret;
      }
 
-     kret = krb5_scc_read_principal(id, &creds->client);
+     kret = krb5_scc_read_principal(context, id, &creds->client);
      TCHECK(kret);
-     kret = krb5_scc_read_principal(id, &creds->server);
+     kret = krb5_scc_read_principal(context, id, &creds->server);
      TCHECK(kret);
-     kret = krb5_scc_read_keyblock(id, &creds->keyblock);
+     kret = krb5_scc_read_keyblock(context, id, &creds->keyblock);
      TCHECK(kret);
-     kret = krb5_scc_read_times(id, &creds->times);
+     kret = krb5_scc_read_times(context, id, &creds->times);
      TCHECK(kret);
-     kret = krb5_scc_read_octet(id, &octet);
+     kret = krb5_scc_read_octet(context, id, &octet);
      TCHECK(kret);
      creds->is_skey = octet;
-     kret = krb5_scc_read_int32(id, &int32);
+     kret = krb5_scc_read_int32(context, id, &int32);
      TCHECK(kret);
      creds->ticket_flags = int32;
-     kret = krb5_scc_read_addrs(id, &creds->addresses);
+     kret = krb5_scc_read_addrs(context, id, &creds->addresses);
      TCHECK(kret);
-     kret = krb5_scc_read_authdata (id, &creds->authdata);
+     kret = krb5_scc_read_authdata (context, id, &creds->authdata);
      TCHECK (kret);
-     kret = krb5_scc_read_data(id, &creds->ticket);
+     kret = krb5_scc_read_data(context, id, &creds->ticket);
      TCHECK(kret);
-     kret = krb5_scc_read_data(id, &creds->second_ticket);
+     kret = krb5_scc_read_data(context, id, &creds->second_ticket);
      TCHECK(kret);
      
      fcursor->pos = ftell(((krb5_scc_data *) id->data)->file);
@@ -109,8 +110,8 @@ krb5_scc_next_cred(id, cursor, creds)
 
 lose:
      if (kret != KRB5_OK) {
-        krb5_free_cred_contents(creds);
+        krb5_free_cred_contents(context, creds);
      }
-     MAYBE_CLOSE (id, kret);
+     MAYBE_CLOSE (context, id, kret);
      return kret;
 }
index 1a7ee5a2dbc1d8e0be9d0187793dcc5840bcef92..29dbdb96697d8c9ed80cb56e3b56a5354b354d18 100644 (file)
@@ -39,7 +39,8 @@
  * system errors (read)
  */
 krb5_error_code
-krb5_scc_read(id, buf, len)
+krb5_scc_read(context, id, buf, len)
+   krb5_context context;
    krb5_ccache id;
    krb5_pointer buf;
    int len;
@@ -49,7 +50,7 @@ krb5_scc_read(id, buf, len)
      errno = 0;
      ret = fread((char *) buf, 1, len, ((krb5_scc_data *) id->data)->file);
      if ((ret == 0) && errno)
-         return krb5_scc_interpret(errno);
+         return krb5_scc_interpret(context, errno);
      else if (ret != len)
          return KRB5_CC_END;
      else
@@ -74,7 +75,8 @@ krb5_scc_read(id, buf, len)
  */
 
 krb5_error_code
-krb5_scc_read_principal(id, princ)
+krb5_scc_read_principal(context, id, princ)
+   krb5_context context;
    krb5_ccache id;
    krb5_principal *princ;
 {
@@ -88,13 +90,13 @@ krb5_scc_read_principal(id, princ)
        type = KRB5_NT_UNKNOWN;
     } else {
         /* Read principal type */
-        kret = krb5_scc_read_int32(id, &type);
+        kret = krb5_scc_read_int32(context, id, &type);
         if (kret != KRB5_OK)
            return kret;
     }
 
     /* Read the number of components */
-    kret = krb5_scc_read_int32(id, &length);
+    kret = krb5_scc_read_int32(context, id, &length);
     if (kret != KRB5_OK)
        return kret;
 
@@ -120,13 +122,13 @@ krb5_scc_read_principal(id, princ)
     tmpprinc->length = length;
     tmpprinc->type = type;
 
-    kret = krb5_scc_read_data(id, krb5_princ_realm(tmpprinc));
+    kret = krb5_scc_read_data(context, id, krb5_princ_realm(context, tmpprinc));
 
     i = 0;
     CHECK(kret);
 
     for (i=0; i < length; i++) {
-       kret = krb5_scc_read_data(id, krb5_princ_component(tmpprinc, i));
+       kret = krb5_scc_read_data(context, id, krb5_princ_component(context, tmpprinc, i));
        CHECK(kret);
     }
     *princ = tmpprinc;
@@ -134,14 +136,15 @@ krb5_scc_read_principal(id, princ)
 
  errout:
     while(--i >= 0)
-       free(krb5_princ_component(tmpprinc, i)->data);
+       free(krb5_princ_component(context, tmpprinc, i)->data);
     free((char *)tmpprinc->data);
     free((char *)tmpprinc);
     return kret;
 }
 
 krb5_error_code
-krb5_scc_read_addrs(id, addrs)
+krb5_scc_read_addrs(context, id, addrs)
+   krb5_context context;
    krb5_ccache id;
    krb5_address ***addrs;
 {
@@ -152,7 +155,7 @@ krb5_scc_read_addrs(id, addrs)
      *addrs = 0;
 
      /* Read the number of components */
-     kret = krb5_scc_read_int32(id, &length);
+     kret = krb5_scc_read_int32(context, id, &length);
      CHECK(kret);
 
      /* Make *addrs able to hold length pointers to krb5_address structs
@@ -165,22 +168,23 @@ krb5_scc_read_addrs(id, addrs)
      for (i=0; i < length; i++) {
          (*addrs)[i] = (krb5_address *) malloc(sizeof(krb5_address));
          if ((*addrs)[i] == NULL) {
-             krb5_free_addresses(*addrs);
+             krb5_free_addresses(context, *addrs);
              return KRB5_CC_NOMEM;
          }       
-         kret = krb5_scc_read_addr(id, (*addrs)[i]);
+         kret = krb5_scc_read_addr(context, id, (*addrs)[i]);
          CHECK(kret);
      }
 
      return KRB5_OK;
  errout:
      if (*addrs)
-        krb5_free_addresses(*addrs);
+        krb5_free_addresses(context, *addrs);
      return kret;
 }
 
 krb5_error_code
-krb5_scc_read_keyblock(id, keyblock)
+krb5_scc_read_keyblock(context, id, keyblock)
+   krb5_context context;
    krb5_ccache id;
    krb5_keyblock *keyblock;
 {
@@ -192,19 +196,19 @@ krb5_scc_read_keyblock(id, keyblock)
      keyblock->magic = KV5M_KEYBLOCK;
      keyblock->contents = 0;
 
-     kret = krb5_scc_read_ui_2(id, &ui2);
+     kret = krb5_scc_read_ui_2(context, id, &ui2);
      keyblock->keytype = ui2;
      CHECK(kret);
      if ((data->version == KRB5_SCC_FVNO_1) ||
         (data->version == KRB5_SCC_FVNO_2))
             keyblock->etype = ETYPE_UNKNOWN;
      else {
-            kret = krb5_scc_read_ui_2(id, &ui2);
+            kret = krb5_scc_read_ui_2(context, id, &ui2);
             keyblock->etype = ui2;
             CHECK(kret);
      }
 
-     kret = krb5_scc_read_int32(id, &int32);
+     kret = krb5_scc_read_int32(context, id, &int32);
      CHECK(kret);
      keyblock->length = int32;
      if ( keyblock->length == 0 )
@@ -214,7 +218,7 @@ krb5_scc_read_keyblock(id, keyblock)
      if (keyblock->contents == NULL)
          return KRB5_CC_NOMEM;
      
-     kret = krb5_scc_read(id, keyblock->contents, keyblock->length);
+     kret = krb5_scc_read(context, id, keyblock->contents, keyblock->length);
      if (kret)
         goto errout;
 
@@ -226,7 +230,8 @@ krb5_scc_read_keyblock(id, keyblock)
 }
 
 krb5_error_code
-krb5_scc_read_data(id, data)
+krb5_scc_read_data(context, id, data)
+   krb5_context context;
    krb5_ccache id;
    krb5_data *data;
 {
@@ -235,7 +240,7 @@ krb5_scc_read_data(id, data)
      data->magic = KV5M_DATA;
      data->data = 0;
 
-     kret = krb5_scc_read_int32(id, &data->length);
+     kret = krb5_scc_read_int32(context, id, &data->length);
      CHECK(kret);
 
      if (data->length == 0) {
@@ -247,7 +252,7 @@ krb5_scc_read_data(id, data)
      if (data->data == NULL)
          return KRB5_CC_NOMEM;
 
-     kret = krb5_scc_read(id, data->data, data->length);
+     kret = krb5_scc_read(context, id, data->data, data->length);
      CHECK(kret);
      
      data->data[data->length] = 0; /* Null terminate, just in case.... */
@@ -259,7 +264,8 @@ krb5_scc_read_data(id, data)
 }
 
 krb5_error_code
-krb5_scc_read_addr(id, addr)
+krb5_scc_read_addr(context, id, addr)
+   krb5_context context;
    krb5_ccache id;
    krb5_address *addr;
 {
@@ -270,11 +276,11 @@ krb5_scc_read_addr(id, addr)
      addr->magic = KV5M_ADDRESS;
      addr->contents = 0;
 
-     kret = krb5_scc_read_ui_2(id, &ui2);
+     kret = krb5_scc_read_ui_2(context, id, &ui2);
      CHECK(kret);
      addr->addrtype = ui2;
      
-     kret = krb5_scc_read_int32(id, &int32);
+     kret = krb5_scc_read_int32(context, id, &int32);
      CHECK(kret);
      addr->length = int32;
 
@@ -285,7 +291,7 @@ krb5_scc_read_addr(id, addr)
      if (addr->contents == NULL)
          return KRB5_CC_NOMEM;
 
-     kret = krb5_scc_read(id, addr->contents, addr->length);
+     kret = krb5_scc_read(context, id, addr->contents, addr->length);
      CHECK(kret);
 
      return KRB5_OK;
@@ -296,7 +302,8 @@ krb5_scc_read_addr(id, addr)
 }
 
 krb5_error_code
-krb5_scc_read_int32(id, i)
+krb5_scc_read_int32(context, id, i)
+   krb5_context context;
    krb5_ccache id;
    krb5_int32 *i;
 {
@@ -306,9 +313,9 @@ krb5_scc_read_int32(id, i)
 
     if ((data->version == KRB5_SCC_FVNO_1) ||
        (data->version == KRB5_SCC_FVNO_2)) 
-       return krb5_scc_read(id, (krb5_pointer) i, sizeof(krb5_int32));
+       return krb5_scc_read(context, id, (krb5_pointer) i, sizeof(krb5_int32));
     else {
-       retval = krb5_scc_read(id, buf, 4);
+       retval = krb5_scc_read(context, id, buf, 4);
        if (retval)
            return retval;
        *i = (((((buf[0] << 8) + buf[1]) << 8 ) + buf[2]) << 8) + buf[3];
@@ -317,7 +324,8 @@ krb5_scc_read_int32(id, i)
 }
 
 krb5_error_code
-krb5_scc_read_ui_2(id, i)
+krb5_scc_read_ui_2(context, id, i)
+   krb5_context context;
    krb5_ccache id;
    krb5_ui_2 *i;
 {
@@ -327,9 +335,9 @@ krb5_scc_read_ui_2(id, i)
     
     if ((data->version == KRB5_SCC_FVNO_1) ||
        (data->version == KRB5_SCC_FVNO_2))
-       return krb5_scc_read(id, (krb5_pointer) i, sizeof(krb5_ui_2));
+       return krb5_scc_read(context, id, (krb5_pointer) i, sizeof(krb5_ui_2));
     else {
-       retval = krb5_scc_read(id, buf, 2);
+       retval = krb5_scc_read(context, id, buf, 2);
        if (retval)
            return retval;
        *i = (buf[0] << 8) + buf[1];
@@ -338,16 +346,18 @@ krb5_scc_read_ui_2(id, i)
 }    
 
 krb5_error_code
-krb5_scc_read_octet(id, i)
+krb5_scc_read_octet(context, id, i)
+   krb5_context context;
    krb5_ccache id;
    krb5_octet *i;
 {
-    return krb5_scc_read(id, (krb5_pointer) i, 1);
+    return krb5_scc_read(context, id, (krb5_pointer) i, 1);
 }    
 
 
 krb5_error_code
-krb5_scc_read_times(id, t)
+krb5_scc_read_times(context, id, t)
+   krb5_context context;
    krb5_ccache id;
    krb5_ticket_times *t;
 {
@@ -357,21 +367,21 @@ krb5_scc_read_times(id, t)
     
     if ((data->version == KRB5_SCC_FVNO_1) ||
        (data->version == KRB5_SCC_FVNO_2))
-       return krb5_scc_read(id, (krb5_pointer) t, sizeof(krb5_ticket_times));
+       return krb5_scc_read(context, id, (krb5_pointer) t, sizeof(krb5_ticket_times));
     else {
-       retval = krb5_scc_read_int32(id, &i);
+       retval = krb5_scc_read_int32(context, id, &i);
        CHECK(retval);
        t->authtime = i;
        
-       retval = krb5_scc_read_int32(id, &i);
+       retval = krb5_scc_read_int32(context, id, &i);
        CHECK(retval);
        t->starttime = i;
 
-       retval = krb5_scc_read_int32(id, &i);
+       retval = krb5_scc_read_int32(context, id, &i);
        CHECK(retval);
        t->endtime = i;
 
-       retval = krb5_scc_read_int32(id, &i);
+       retval = krb5_scc_read_int32(context, id, &i);
        CHECK(retval);
        t->renew_till = i;
     }
@@ -381,7 +391,8 @@ errout:
 }
 
 krb5_error_code
-krb5_scc_read_authdata(id, a)
+krb5_scc_read_authdata(context, id, a)
+   krb5_context context;
     krb5_ccache id;
     krb5_authdata ***a;
 {
@@ -392,7 +403,7 @@ krb5_scc_read_authdata(id, a)
      *a = 0;
 
      /* Read the number of components */
-     kret = krb5_scc_read_int32(id, &length);
+     kret = krb5_scc_read_int32(context, id, &length);
      CHECK(kret);
 
      if (length == 0)
@@ -408,22 +419,23 @@ krb5_scc_read_authdata(id, a)
      for (i=0; i < length; i++) {
          (*a)[i] = (krb5_authdata *) malloc(sizeof(krb5_authdata));
          if ((*a)[i] == NULL) {
-             krb5_free_authdata(*a);
+             krb5_free_authdata(context, *a);
              return KRB5_CC_NOMEM;
          }       
-         kret = krb5_scc_read_authdatum(id, (*a)[i]);
+         kret = krb5_scc_read_authdatum(context, id, (*a)[i]);
          CHECK(kret);
      }
 
      return KRB5_OK;
  errout:
      if (*a)
-        krb5_free_authdata(*a);
+        krb5_free_authdata(context, *a);
      return kret;
 }
 
 krb5_error_code
-krb5_scc_read_authdatum(id, a)
+krb5_scc_read_authdatum(context, id, a)
+   krb5_context context;
     krb5_ccache id;
     krb5_authdata *a;
 {
@@ -434,9 +446,9 @@ krb5_scc_read_authdatum(id, a)
     a->magic = KV5M_AUTHDATA;
     a->contents = NULL;
 
-    kret = krb5_scc_read_ui_2(id, &a->ad_type);
+    kret = krb5_scc_read_ui_2(context, id, &a->ad_type);
     CHECK(kret);
-    kret = krb5_scc_read_int32(id, &int32);
+    kret = krb5_scc_read_int32(context, id, &int32);
     CHECK(kret);
     a->length = int32;
     
@@ -447,7 +459,7 @@ krb5_scc_read_authdatum(id, a)
     if (a->contents == NULL)
        return KRB5_CC_NOMEM;
 
-    kret = krb5_scc_read(id, a->contents, a->length);
+    kret = krb5_scc_read(context, id, a->contents, a->length);
     CHECK(kret);
     
      return KRB5_OK;
index 40c3e81dfccbfee466d7aa69c11b328f6e1799a1..1add343e63169260601cd59851b99296ed10862f 100644 (file)
@@ -50,7 +50,8 @@ extern krb5_cc_ops krb5_scc_ops;
  * permission errors
  */
 krb5_error_code
-krb5_scc_resolve (id, residual)
+krb5_scc_resolve (context, id, residual)
+   krb5_context context;
    krb5_ccache *id;
    char *residual;
 {
index 865bdcbbb906bdf31dc6aff1e5c866122a5a315d..5b20ad5620d2517e8c67c3aed6c282904c2a3f80 100644 (file)
@@ -57,23 +57,25 @@ times_match_exact (t1, t2)
 }
 
 static krb5_boolean
-standard_fields_match(mcreds, creds)
+standard_fields_match(context, mcreds, creds)
+   krb5_context context;
 register const krb5_creds *mcreds, *creds;
 {
-    return (krb5_principal_compare(mcreds->client,creds->client) &&
-           krb5_principal_compare(mcreds->server,creds->server));
+    return (krb5_principal_compare(context, mcreds->client,creds->client) &&
+           krb5_principal_compare(context, mcreds->server,creds->server));
 }
 
 /* only match the server name portion, not the server realm portion */
 
 static krb5_boolean
-srvname_match(mcreds, creds)
+srvname_match(context, mcreds, creds)
+   krb5_context context;
 register const krb5_creds *mcreds, *creds;
 {
     krb5_boolean retval;
     krb5_principal_data p1, p2;
     
-    retval = krb5_principal_compare(mcreds->client,creds->client);
+    retval = krb5_principal_compare(context, mcreds->client,creds->client);
     if (retval != TRUE)
        return retval;
     /*
@@ -82,7 +84,7 @@ register const krb5_creds *mcreds, *creds;
     p1 = *mcreds->server;
     p2 = *creds->server;
     p1.realm = p2.realm;
-    return krb5_principal_compare(&p1, &p2);
+    return krb5_principal_compare(context, &p1, &p2);
 }
 
 
@@ -153,7 +155,8 @@ register const krb5_data *data1, *data2;
  * KRB5_CC_NOMEM
  */
 krb5_error_code
-krb5_scc_retrieve(id, whichfields, mcreds, creds)
+krb5_scc_retrieve(context, id, whichfields, mcreds, creds)
+   krb5_context context;
    krb5_ccache id;
    krb5_flags whichfields;
    krb5_creds *mcreds;
@@ -166,11 +169,11 @@ krb5_scc_retrieve(id, whichfields, mcreds, creds)
      krb5_error_code kret;
      krb5_creds fetchcreds;
 
-     kret = krb5_scc_start_seq_get(id, &cursor);
+     kret = krb5_scc_start_seq_get(context, id, &cursor);
      if (kret != KRB5_OK)
          return kret;
 
-     while ((kret = krb5_scc_next_cred(id, &cursor, &fetchcreds)) == KRB5_OK) {
+     while ((kret = krb5_scc_next_cred(context, id, &cursor, &fetchcreds)) == KRB5_OK) {
          if (((set(KRB5_TC_MATCH_SRV_NAMEONLY) &&
                   srvname_match(mcreds, &fetchcreds)) ||
               standard_fields_match(mcreds, &fetchcreds))
@@ -197,16 +200,16 @@ krb5_scc_retrieve(id, whichfields, mcreds, creds)
               data_match (&mcreds->second_ticket, &fetchcreds.second_ticket))
              )
          {
-              krb5_scc_end_seq_get(id, &cursor);
+              krb5_scc_end_seq_get(context, id, &cursor);
               *creds = fetchcreds;
               return KRB5_OK;
          }
 
          /* This one doesn't match */
-         krb5_free_cred_contents(&fetchcreds);
+         krb5_free_cred_contents(context, &fetchcreds);
      }
 
      /* If we get here, a match wasn't found */
-     krb5_scc_end_seq_get(id, &cursor);
+     krb5_scc_end_seq_get(context, id, &cursor);
      return KRB5_CC_NOTFOUND;
 }
index f025898895267c71f30ebf7a8b222ff8d961ebe9..89ec826eb3275895c2ed839fe3ac303e31dd9d07 100644 (file)
@@ -40,7 +40,8 @@
  * Sets the operational flags of id to flags.
  */
 krb5_error_code
-krb5_scc_set_flags(id, flags)
+krb5_scc_set_flags(context, id, flags)
+   krb5_context context;
    krb5_ccache id;
    krb5_flags flags;
 {
@@ -50,12 +51,12 @@ krb5_scc_set_flags(id, flags)
     if (flags & KRB5_TC_OPENCLOSE) {
        /* asking to turn on OPENCLOSE mode */
        if (!OPENCLOSE(id))
-           ret = krb5_scc_close_file (id);
+           ret = krb5_scc_close_file (context, id);
     } else {
        /* asking to turn off OPENCLOSE mode, meaning it must be
           left open.  We open if it's not yet open */
        if (OPENCLOSE(id)) {
-           ret = krb5_scc_open_file (id, SCC_OPEN_RDWR);
+           ret = krb5_scc_open_file (context, id, SCC_OPEN_RDWR);
        }
     }
 
index 40ea25b12e3899779f65f34185f53cecc16aa902..01824026f6e1d39b514494277e3f572bf2729dbb 100644 (file)
 #include "scc.h"
 
 krb5_error_code
-krb5_scc_skip_principal(id)
+krb5_scc_skip_principal(context, id)
+   krb5_context context;
    krb5_ccache id;
 {
      krb5_error_code kret;
      krb5_principal princ;
 
-     kret = krb5_scc_read_principal(id, &princ);
+     kret = krb5_scc_read_principal(context, id, &princ);
      if (kret != KRB5_OK)
          return kret;
 
-     krb5_free_principal(princ);
+     krb5_free_principal(context, princ);
      return KRB5_OK;
 }
 
index 2aec05b9ffbdd4ba4319afa8285962290da0df69..f1971c5d26cf2e13ccaa53b3eb94da377f2e689a 100644 (file)
@@ -42,7 +42,8 @@
  * system errors
  */
 krb5_error_code
-krb5_scc_start_seq_get(id, cursor)
+krb5_scc_start_seq_get(context, id, cursor)
+   krb5_context context;
    krb5_ccache id;
    krb5_cc_cursor *cursor;
 {
@@ -54,14 +55,14 @@ krb5_scc_start_seq_get(id, cursor)
          return KRB5_CC_NOMEM;
 
      /* Make sure we start reading right after the primary principal */
-     MAYBE_OPEN (id, SCC_OPEN_RDONLY);
+     MAYBE_OPEN (context, id, SCC_OPEN_RDONLY);
      /* skip over vno at beginning of file */
      fseek(((krb5_scc_data *) id->data)->file, sizeof(krb5_int16), 0);
 
-     krb5_scc_skip_principal(id);
+     krb5_scc_skip_principal(context, id);
      fcursor->pos = ftell(((krb5_scc_data *) id->data)->file);
      *cursor = (krb5_cc_cursor) fcursor;
 
-     MAYBE_CLOSE (id, ret);
+     MAYBE_CLOSE (context, id, ret);
      return(ret);
 }
index f8bd0907eb68349d714f9ef94f4378342dc75665..71b06210db6de847f5e35933aba162440f4757c4 100644 (file)
@@ -40,7 +40,8 @@
  * storage failure errors
  */
 krb5_error_code
-krb5_scc_store(id, creds)
+krb5_scc_store(context, id, creds)
+   krb5_context context;
    krb5_ccache id;
    krb5_creds *creds;
 {
@@ -48,36 +49,36 @@ krb5_scc_store(id, creds)
      krb5_error_code ret;
 
      /* Make sure we are writing to the end of the file */
-     MAYBE_OPEN (id, SCC_OPEN_RDWR);
+     MAYBE_OPEN (context, id, SCC_OPEN_RDWR);
 
      ret = fseek(((krb5_scc_data *) id->data)->file, 0, 2);
      if (ret < 0)
-         return krb5_scc_interpret(errno);
+         return krb5_scc_interpret(context, errno);
 
-     ret = krb5_scc_store_principal(id, creds->client);
+     ret = krb5_scc_store_principal(context, id, creds->client);
      TCHECK(ret);
-     ret = krb5_scc_store_principal(id, creds->server);
+     ret = krb5_scc_store_principal(context, id, creds->server);
      TCHECK(ret);
-     ret = krb5_scc_store_keyblock(id, &creds->keyblock);
+     ret = krb5_scc_store_keyblock(context, id, &creds->keyblock);
      TCHECK(ret);
-     ret = krb5_scc_store_times(id, &creds->times);
+     ret = krb5_scc_store_times(context, id, &creds->times);
      TCHECK(ret);
-     ret = krb5_scc_store_octet(id, creds->is_skey);
+     ret = krb5_scc_store_octet(context, id, creds->is_skey);
      TCHECK(ret);
-     ret = krb5_scc_store_int32(id, creds->ticket_flags);
+     ret = krb5_scc_store_int32(context, id, creds->ticket_flags);
      TCHECK(ret);
-     ret = krb5_scc_store_addrs(id, creds->addresses);
+     ret = krb5_scc_store_addrs(context, id, creds->addresses);
      TCHECK(ret);
-     ret = krb5_scc_store_authdata(id, creds->authdata);
+     ret = krb5_scc_store_authdata(context, id, creds->authdata);
      TCHECK(ret);
-     ret = krb5_scc_store_data(id, &creds->ticket);
+     ret = krb5_scc_store_data(context, id, &creds->ticket);
      TCHECK(ret);
-     ret = krb5_scc_store_data(id, &creds->second_ticket);
+     ret = krb5_scc_store_data(context, id, &creds->second_ticket);
      TCHECK(ret);
 
 lose:
 
-     MAYBE_CLOSE (id, ret);
+     MAYBE_CLOSE (context, id, ret);
      return ret;
 #undef TCHECK
 }
index c76058ee5d7c30cae6d0f29019af53b7b82e09bb..d94829249016a5cc9e94651e24e5932f10f2acd7 100644 (file)
@@ -125,9 +125,9 @@ void scc_test()
 
      init_test_cred();
 
-     kret = krb5_scc_resolve(&id, "/tmp/tkt_test");
+     kret = krb5_scc_resolve(context, &id, "/tmp/tkt_test");
      CHECK(kret, "resolve");
-     kret = krb5_scc_initialize(id, test_creds.client);
+     kret = krb5_scc_initialize(context, id, test_creds.client);
      CHECK(kret, "initialize");
      kret = krb5_scc_store(id, &test_creds);
      CHECK(kret, "store");
index db6015dd54312a7218bb1f9f9cd18e950ff52d40..9226bb1f6e545c982377b3117a8b7250d23bf325 100644 (file)
@@ -41,7 +41,8 @@
  * system errors
  */
 krb5_error_code
-krb5_scc_write(id, buf, len)
+krb5_scc_write(context, id, buf, len)
+   krb5_context context;
    krb5_ccache id;
    krb5_pointer buf;
    int len;
@@ -51,7 +52,7 @@ krb5_scc_write(id, buf, len)
      errno = 0;
      ret = fwrite((char *) buf, 1, len, ((krb5_scc_data *)id->data)->file);
      if ((ret == 0) && errno) {
-         return krb5_scc_interpret (errno);
+         return krb5_scc_interpret (context, errno);
      } else if (ret != len)
         return KRB5_CC_END;
      return KRB5_OK;
@@ -72,7 +73,8 @@ krb5_scc_write(id, buf, len)
  */
 
 krb5_error_code
-krb5_scc_store_principal(id, princ)
+krb5_scc_store_principal(context, id, princ)
+   krb5_context context;
    krb5_ccache id;
    krb5_principal princ;
 {
@@ -80,8 +82,8 @@ krb5_scc_store_principal(id, princ)
     krb5_error_code ret;
     krb5_int32 i, length, tmp, type;
 
-    type = krb5_princ_type(princ);
-    tmp = length = krb5_princ_size(princ);
+    type = krb5_princ_type(context, princ);
+    tmp = length = krb5_princ_size(context, princ);
 
     if (data->version == KRB5_SCC_FVNO_1) {
        /*
@@ -91,18 +93,19 @@ krb5_scc_store_principal(id, princ)
         */
        tmp++;
     } else {
-       ret = krb5_scc_store_int32(id, type);
+       ret = krb5_scc_store_int32(context, id, type);
        CHECK(ret);
     }
     
-    ret = krb5_scc_store_int32(id, tmp);
+    ret = krb5_scc_store_int32(context, id, tmp);
     CHECK(ret);
 
-    ret = krb5_scc_store_data(id, krb5_princ_realm(princ));
+    ret = krb5_scc_store_data(context, id, krb5_princ_realm(context, princ));
     CHECK(ret);
 
     for (i=0; i < length; i++) {
-       ret = krb5_scc_store_data(id, krb5_princ_component(princ, i));
+       ret = krb5_scc_store_data(context, id, 
+      krb5_princ_component(context, princ, i));
        CHECK(ret);
     }
 
@@ -110,7 +113,8 @@ krb5_scc_store_principal(id, princ)
 }
 
 krb5_error_code
-krb5_scc_store_addrs(id, addrs)
+krb5_scc_store_addrs(context, id, addrs)
+   krb5_context context;
    krb5_ccache id;
    krb5_address ** addrs;
 {
@@ -125,10 +129,10 @@ krb5_scc_store_addrs(id, addrs)
             length += 1;
      }
 
-     ret = krb5_scc_store_int32(id, length);
+     ret = krb5_scc_store_int32(context, id, length);
      CHECK(ret);
      for (i=0; i < length; i++) {
-         ret = krb5_scc_store_addr(id, addrs[i]);
+         ret = krb5_scc_store_addr(context, id, addrs[i]);
          CHECK(ret);
      }
 
@@ -136,54 +140,58 @@ krb5_scc_store_addrs(id, addrs)
 }
 
 krb5_error_code
-krb5_scc_store_keyblock(id, keyblock)
+krb5_scc_store_keyblock(context, id, keyblock)
+   krb5_context context;
    krb5_ccache id;
    krb5_keyblock *keyblock;
 {
      krb5_scc_data *data = (krb5_scc_data *)id->data;
      krb5_error_code ret;
 
-     ret = krb5_scc_store_ui_2(id, keyblock->keytype);
+     ret = krb5_scc_store_ui_2(context, id, keyblock->keytype);
      CHECK(ret);
      if ((data->version != KRB5_SCC_FVNO_1) &&
         (data->version != KRB5_SCC_FVNO_2)) {
-        ret = krb5_scc_store_ui_2(id, keyblock->etype);
+        ret = krb5_scc_store_ui_2(context, id, keyblock->etype);
         CHECK(ret);
      }
-     ret = krb5_scc_store_int32(id, keyblock->length);
+     ret = krb5_scc_store_int32(context, id, keyblock->length);
      CHECK(ret);
-     return krb5_scc_write(id, (char *) keyblock->contents, keyblock->length);
+     return krb5_scc_write(context, id, (char *) keyblock->contents, keyblock->length);
 }
 
 krb5_error_code
-krb5_scc_store_addr(id, addr)
+krb5_scc_store_addr(context, id, addr)
+   krb5_context context;
    krb5_ccache id;
    krb5_address *addr;
 {
      krb5_error_code ret;
 
-     ret = krb5_scc_store_ui_2(id, addr->addrtype);
+     ret = krb5_scc_store_ui_2(context, id, addr->addrtype);
      CHECK(ret);
-     ret = krb5_scc_store_int32(id, addr->length);
+     ret = krb5_scc_store_int32(context, id, addr->length);
      CHECK(ret);
-     return krb5_scc_write(id, (char *) addr->contents, addr->length);
+     return krb5_scc_write(context, id, (char *) addr->contents, addr->length);
 }
 
 
 krb5_error_code
-krb5_scc_store_data(id, data)
+krb5_scc_store_data(context, id, data)
+   krb5_context context;
    krb5_ccache id;
    krb5_data *data;
 {
      krb5_error_code ret;
 
-     ret = krb5_scc_store_int32(id, data->length);
+     ret = krb5_scc_store_int32(context, id, data->length);
      CHECK(ret);
-     return krb5_scc_write(id, data->data, data->length);
+     return krb5_scc_write(context, id, data->data, data->length);
 }
 
 krb5_error_code
-krb5_scc_store_int32(id, i)
+krb5_scc_store_int32(context, id, i)
+   krb5_context context;
    krb5_ccache id;
    krb5_int32 i;
 {
@@ -192,7 +200,7 @@ krb5_scc_store_int32(id, i)
 
     if ((data->version == KRB5_SCC_FVNO_1) ||
        (data->version == KRB5_SCC_FVNO_2)) 
-       return krb5_scc_write(id, (char *) &i, sizeof(krb5_int32));
+       return krb5_scc_write(context, id, (char *) &i, sizeof(krb5_int32));
     else {
        buf[3] = i & 0xFF;
        i >>= 8;
@@ -202,12 +210,13 @@ krb5_scc_store_int32(id, i)
        i >>= 8;
        buf[0] = i & 0xFF;
        
-       return krb5_scc_write(id, buf, 4);
+       return krb5_scc_write(context, id, buf, 4);
     }
 }
 
 krb5_error_code
-krb5_scc_store_ui_2(id, i)
+krb5_scc_store_ui_2(context, id, i)
+   krb5_context context;
     krb5_ccache id;
     krb5_int32 i;
 {
@@ -218,29 +227,31 @@ krb5_scc_store_ui_2(id, i)
     if ((data->version == KRB5_SCC_FVNO_1) ||
        (data->version == KRB5_SCC_FVNO_2)) {
        ibuf = i;
-       return krb5_scc_write(id, (char *) &ibuf, sizeof(krb5_ui_2));
+       return krb5_scc_write(context, id, (char *) &ibuf, sizeof(krb5_ui_2));
     } else {
        buf[1] = i & 0xFF;
        i >>= 8;
        buf[0] = i & 0xFF;
        
-       return krb5_scc_write(id, buf, 2);
+       return krb5_scc_write(context, id, buf, 2);
     }
 }
    
 krb5_error_code
-krb5_scc_store_octet(id, i)
+krb5_scc_store_octet(context, id, i)
+   krb5_context context;
     krb5_ccache id;
     krb5_int32 i;
 {
     krb5_octet ibuf;
 
     ibuf = i;
-    return krb5_scc_write(id, (char *) &ibuf, 1);
+    return krb5_scc_write(context, id, (char *) &ibuf, 1);
 }
    
 krb5_error_code
-krb5_scc_store_times(id, t)
+krb5_scc_store_times(context, id, t)
+   krb5_context context;
    krb5_ccache id;
    krb5_ticket_times *t;
 {
@@ -249,22 +260,23 @@ krb5_scc_store_times(id, t)
 
     if ((data->version == KRB5_SCC_FVNO_1) ||
        (data->version == KRB5_SCC_FVNO_2))
-       return krb5_scc_write(id, (char *) t, sizeof(krb5_ticket_times));
+       return krb5_scc_write(context, id, (char *) t, sizeof(krb5_ticket_times));
     else {
-       retval = krb5_scc_store_int32(id, t->authtime);
+       retval = krb5_scc_store_int32(context, id, t->authtime);
        CHECK(retval);
-       retval = krb5_scc_store_int32(id, t->starttime);
+       retval = krb5_scc_store_int32(context, id, t->starttime);
        CHECK(retval);
-       retval = krb5_scc_store_int32(id, t->endtime);
+       retval = krb5_scc_store_int32(context, id, t->endtime);
        CHECK(retval);
-       retval = krb5_scc_store_int32(id, t->renew_till);
+       retval = krb5_scc_store_int32(context, id, t->renew_till);
        CHECK(retval);
        return 0;
     }
 }
    
 krb5_error_code
-krb5_scc_store_authdata(id, a)
+krb5_scc_store_authdata(context, id, a)
+   krb5_context context;
     krb5_ccache id;
     krb5_authdata **a;
 {
@@ -277,24 +289,25 @@ krb5_scc_store_authdata(id, a)
            length++;
     }
 
-    ret = krb5_scc_store_int32(id, length);
+    ret = krb5_scc_store_int32(context, id, length);
     CHECK(ret);
     for (i=0; i<length; i++) {
-       ret = krb5_scc_store_authdatum (id, a[i]);
+       ret = krb5_scc_store_authdatum (context, id, a[i]);
        CHECK(ret);
     }
     return KRB5_OK;
 }
 
 krb5_error_code
-krb5_scc_store_authdatum (id, a)
+krb5_scc_store_authdatum (context, id, a)
+   krb5_context context;
     krb5_ccache id;
     krb5_authdata *a;
 {
     krb5_error_code ret;
-    ret = krb5_scc_store_ui_2(id, a->ad_type);
+    ret = krb5_scc_store_ui_2(context, id, a->ad_type);
     CHECK(ret);
-    ret = krb5_scc_store_int32(id, a->length);
+    ret = krb5_scc_store_int32(context, id, a->length);
     CHECK(ret);
-    return krb5_scc_write(id, (krb5_pointer) a->contents, a->length);
+    return krb5_scc_write(context, id, (krb5_pointer) a->contents, a->length);
 }
index 88d18dffb90f5ec65a020e384c91c8dc0283d9f5..78b9ef1e78f2e1a18c41df7d1fe4acd221a6112e 100644 (file)
@@ -28,7 +28,7 @@
 #include <krb5/krb5.h>
 
 void
-krb5_init_ets PROTOTYPE((void))
+krb5_init_ets PROTOTYPE((krb5_context context))
 {
     static int initialized = 0;
 
index 39542e101dd57ee111c721d334ee1bec3474c53f..1ae5063a736b81efbc32397a34b0f6f83d8baba7 100644 (file)
@@ -1,3 +1,7 @@
+Fri Jan 13 15:23:47 1995  Chris Provenzano (proven@mit.edu)
+
+    * Added krb5_context to all krb5_routines
+
 Thu Oct 13 17:24:51 1994  Theodore Y. Ts'o  (tytso@maytag)
 
        * configure.in: Add ISODE_DEFS
index 95060d9192a30d5db63d9aec8b4aaca88c37a725..c141c74ce9923005e9c26d1ad2dc430b10ddd0fe 100644 (file)
@@ -29,8 +29,9 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_address(val)
-krb5_address *val;
+krb5_free_address(context, val)
+    krb5_context context;
+    krb5_address *val;
 {
     if (val->contents)
        krb5_xfree(val->contents);
index 238a37062f8e5389d5f5be9bb97e8af13dd21464..d4ead60aaf18eeb4321f1cc04c3bb110acdb2df3 100644 (file)
@@ -29,8 +29,9 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_addresses(val)
-krb5_address **val;
+krb5_free_addresses(context, val)
+    krb5_context context;
+    krb5_address **val;
 {
     register krb5_address **temp;
 
index 89b38e6be16eddabdb3c58b14fc43116f2b9e788..1fa5d8745be1a6c51e6766230215657e071845c2 100644 (file)
@@ -29,8 +29,9 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_ap_rep(val)
-register krb5_ap_rep *val;
+krb5_free_ap_rep(context, val)
+    krb5_context context;
+    register krb5_ap_rep *val;
 {
     if (val->enc_part.ciphertext.data)
        krb5_xfree(val->enc_part.ciphertext.data);
index 1d71ba0cfc6f96828fb460253a85515c5e0e08cb..3632f6432d6613425a736afdb0b85f426527ed6b 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_ap_req(val)
-register krb5_ap_req *val;
+krb5_free_ap_req(context, val)
+    krb5_context context;
+    register krb5_ap_req *val;
 {
     if (val->ticket)
-       krb5_free_ticket(val->ticket);
+       krb5_free_ticket(context, val->ticket);
     if (val->authenticator.ciphertext.data)
        krb5_xfree(val->authenticator.ciphertext.data);
     krb5_xfree(val);
index af3e444804cf1feb1a7b64b13ead2d29b96b6b95..16395944fe9db2e7a7d964bc877220f41d1b9669 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_ap_rep_enc_part(val)
-krb5_ap_rep_enc_part *val;
+krb5_free_ap_rep_enc_part(context, val)
+    krb5_context context;
+    krb5_ap_rep_enc_part *val;
 {
     if (val->subkey)
-       krb5_free_keyblock(val->subkey);
+       krb5_free_keyblock(context, val->subkey);
     krb5_xfree(val);
     return;
 }
index d4098f01a1d45e97b72d3adea70c28f52aedf304..3f4f03617c4c9874c9c0f67f97683ce141b6080c 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_authenticator_contents(val)
-krb5_authenticator *val;
+krb5_free_authenticator_contents(context, val)
+    krb5_context context;
+    krb5_authenticator *val;
 {
     if (val->checksum)
-       krb5_free_checksum(val->checksum);
+       krb5_free_checksum(context, val->checksum);
     if (val->client)
-       krb5_free_principal(val->client);
+       krb5_free_principal(context, val->client);
     if (val->subkey)
-       krb5_free_keyblock(val->subkey);
+       krb5_free_keyblock(context, val->subkey);
     if (val->authorization_data)        
-       krb5_free_authdata(val->authorization_data);
+       krb5_free_authdata(context, val->authorization_data);
     return;
 }
index 497a33be5e883272dc27b96828fa3dd5407bf774..cf22f672170703a17a5ceb816ef5c133a727ce99 100644 (file)
@@ -29,7 +29,8 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_authdata(val)
+krb5_free_authdata(context, val)
+    krb5_context context;
 krb5_authdata **val;
 {
     register krb5_authdata **temp;
index e98faa48df6d38c7b8897643eb9e0a6eea850326..86a6036b284e4bd9882948bb02bbe9b5420c6faa 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_authenticator(val)
-krb5_authenticator *val;
+krb5_free_authenticator(context, val)
+    krb5_context context;
+    krb5_authenticator *val;
 {
     if (val->checksum)
-       krb5_free_checksum(val->checksum);
+       krb5_free_checksum(context, val->checksum);
     if (val->client)
-       krb5_free_principal(val->client);
+       krb5_free_principal(context, val->client);
     if (val->subkey)
-       krb5_free_keyblock(val->subkey);
+       krb5_free_keyblock(context, val->subkey);
     if (val->authorization_data)        
-       krb5_free_authdata(val->authorization_data);
+       krb5_free_authdata(context, val->authorization_data);
     krb5_xfree(val);
     return;
 }
index 13272d6c75fa859258211935a85169e1407d2eed..40372fcd8a112a5f605bc62b57be15e7f683b364 100644 (file)
@@ -29,8 +29,9 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_checksum(val)
-register krb5_checksum *val;
+krb5_free_checksum(context, val)
+    krb5_context context;
+    register krb5_checksum *val;
 {
     if (val->contents)
        krb5_xfree(val->contents);
index 673af0616f6593dda99616642497a9f1943ef62f..2aaea23a67c6e32592d3bf42d77d4dd606fdc916 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_cred(val)
-register krb5_cred *val;
+krb5_free_cred(context, val)
+    krb5_context context;
+    register krb5_cred *val;
 {
     if (val->tickets)
-        krb5_free_tickets(val->tickets);
+        krb5_free_tickets(context, val->tickets);
     if (val->enc_part.ciphertext.data)
        krb5_xfree(val->enc_part.ciphertext.data);
     krb5_xfree(val);
index 56fb7bcdc941d890225e55fea4be9f4169db7277..672614d70c388360cf4a6805bc5343764b0da6e9 100644 (file)
  */
 
 void
-krb5_free_cred_contents(val)
-krb5_creds *val;
+krb5_free_cred_contents(context, val)
+    krb5_context context;
+    krb5_creds *val;
 {
     if (val->client)
-       krb5_free_principal(val->client);
+       krb5_free_principal(context, val->client);
     if (val->server)
-       krb5_free_principal(val->server);
+       krb5_free_principal(context, val->server);
     if (val->keyblock.contents) {
        memset((char *)val->keyblock.contents, 0, val->keyblock.length);
        krb5_xfree(val->keyblock.contents);
@@ -50,8 +51,8 @@ krb5_creds *val;
     if (val->second_ticket.data)
        krb5_xfree(val->second_ticket.data);
     if (val->addresses)
-       krb5_free_addresses(val->addresses);
+       krb5_free_addresses(context, val->addresses);
     if (val->authdata)
-       krb5_free_authdata(val->authdata);
+       krb5_free_authdata(context, val->authdata);
     return;
 }
index b23271879cf433efa226b5495a90738a1be8a5bb..92aa108d3b59ff2009bba2e3af0f0155b74b4ee9 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_cred_enc_part(val)
-register krb5_cred_enc_part *val;
+krb5_free_cred_enc_part(context, val)
+    krb5_context context;
+    register krb5_cred_enc_part *val;
 {
     register krb5_cred_info **temp;
     
     if (val->r_address)
-      krb5_free_address(val->r_address);
+      krb5_free_address(context, val->r_address);
     if (val->s_address)
-      krb5_free_address(val->s_address);
+      krb5_free_address(context, val->s_address);
 
     if (val->ticket_info) {
        for (temp = val->ticket_info; *temp; temp++) {
            if ((*temp)->session)
-               krb5_free_keyblock((*temp)->session);
+               krb5_free_keyblock(context, (*temp)->session);
            if ((*temp)->client)
-               krb5_free_principal((*temp)->client);
+               krb5_free_principal(context, (*temp)->client);
            if ((*temp)->server)
-               krb5_free_principal((*temp)->server);
+               krb5_free_principal(context, (*temp)->server);
            if ((*temp)->caddrs)
-               krb5_free_addresses((*temp)->caddrs);
+               krb5_free_addresses(context, (*temp)->caddrs);
            krb5_xfree((*temp));
        }
        krb5_xfree(val->ticket_info);
index 45f1c8ada13e26d5ae0d4fb3ee12eb58061463e0..e80875a4c9bb691ac98276b7cd2c87208e301bbc 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_creds(val)
-krb5_creds *val;
+krb5_free_creds(context, val)
+    krb5_context context;
+    krb5_creds *val;
 {
-    krb5_free_cred_contents(val);
+    krb5_free_cred_contents(context, val);
     krb5_xfree(val);
     return;
 }
index d683ae292194f1866612f8876a6a085d5709dca6..e489bb103cb80e58a20d1fdafe45600b598e1fbf 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_enc_kdc_rep_part(val)
-register krb5_enc_kdc_rep_part *val;
+krb5_free_enc_kdc_rep_part(context, val)
+    krb5_context context;
+    register krb5_enc_kdc_rep_part *val;
 {
     if (val->session)
-       krb5_free_keyblock(val->session);
+       krb5_free_keyblock(context, val->session);
     if (val->last_req)
-       krb5_free_last_req(val->last_req);
+       krb5_free_last_req(context, val->last_req);
     if (val->server)
-       krb5_free_principal(val->server);
+       krb5_free_principal(context, val->server);
     if (val->caddrs)
-       krb5_free_addresses(val->caddrs);
+       krb5_free_addresses(context, val->caddrs);
     krb5_xfree(val);
     return;
 }
index ece2693a951f7dbcc4fc3ddc159a53e4a4442c1e..d5dbad838364af97d8a5c9b22bf7bff137c6c912 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_enc_tkt_part(val)
-krb5_enc_tkt_part *val;
+krb5_free_enc_tkt_part(context, val)
+    krb5_context context;
+    krb5_enc_tkt_part *val;
 {
     if (val->session)
-       krb5_free_keyblock(val->session);
+       krb5_free_keyblock(context, val->session);
     if (val->client)
-       krb5_free_principal(val->client);
+       krb5_free_principal(context, val->client);
     if (val->transited.tr_contents.data)
        krb5_xfree(val->transited.tr_contents.data);
     if (val->caddrs)
-       krb5_free_addresses(val->caddrs);
+       krb5_free_addresses(context, val->caddrs);
     if (val->authorization_data)
-       krb5_free_authdata(val->authorization_data);
+       krb5_free_authdata(context, val->authorization_data);
     krb5_xfree(val);
     return;
 }
index 646b6b53156543782faeaa5f40bb2bdb000a8233..c51733b197c0088f399e11c2e7dd4b6451b57225 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_error(val)
-register krb5_error *val;
+krb5_free_error(context, val)
+    krb5_context context;
+    register krb5_error *val;
 {
     if (val->client)
-       krb5_free_principal(val->client);
+       krb5_free_principal(context, val->client);
     if (val->server)
-       krb5_free_principal(val->server);
+       krb5_free_principal(context, val->server);
     if (val->text.data)
        krb5_xfree(val->text.data);
     if (val->e_data.data)
index 2091d9e5c96c3c9e50169bf0cfa198ae1befe8a9..87e8209844b97668a8cdd5e6133c064687f33604 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_kdc_rep(val)
+krb5_free_kdc_rep(context, val)
+    krb5_context context;
 krb5_kdc_rep *val;
 {
     if (val->padata)
-       krb5_free_pa_data(val->padata);
+       krb5_free_pa_data(context, val->padata);
     if (val->client)
-       krb5_free_principal(val->client);
+       krb5_free_principal(context, val->client);
     if (val->ticket)
-       krb5_free_ticket(val->ticket);
+       krb5_free_ticket(context, val->ticket);
     if (val->enc_part.ciphertext.data)
        krb5_xfree(val->enc_part.ciphertext.data);
     if (val->enc_part2)
-       krb5_free_enc_kdc_rep_part(val->enc_part2);
+       krb5_free_enc_kdc_rep_part(context, val->enc_part2);
     krb5_xfree(val);
     return;
 }
index 0e6416e9130ff35addbc60bd3b28b9fd75395bd8..0d9dfffae19839d7df75625277c239863bf55658 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_kdc_req(val)
-krb5_kdc_req *val;
+krb5_free_kdc_req(context, val)
+    krb5_context context;
+    krb5_kdc_req *val;
 {
     if (val->padata)
-       krb5_free_pa_data(val->padata);
+       krb5_free_pa_data(context, val->padata);
     if (val->client)
-       krb5_free_principal(val->client);
+       krb5_free_principal(context, val->client);
     if (val->server)
-       krb5_free_principal(val->server);
+       krb5_free_principal(context, val->server);
     if (val->etype)
        krb5_xfree(val->etype);
     if (val->addresses)
-       krb5_free_addresses(val->addresses);
+       krb5_free_addresses(context, val->addresses);
     if (val->authorization_data.ciphertext.data)
        krb5_xfree(val->authorization_data.ciphertext.data);
     if (val->unenc_authdata)
-       krb5_free_authdata(val->unenc_authdata);
+       krb5_free_authdata(context, val->unenc_authdata);
     if (val->second_ticket)
-       krb5_free_tickets(val->second_ticket);
+       krb5_free_tickets(context, val->second_ticket);
     krb5_xfree(val);
     return;
 }
index a360531e8006345318b7756d341b6a042831f8fe..0117fbff5d6965484aa7eac335ab40cdd0eb55b8 100644 (file)
@@ -29,8 +29,9 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_keyblock(val)
-register krb5_keyblock *val;
+krb5_free_keyblock(context, val)
+    krb5_context context;
+    register krb5_keyblock *val;
 {
     if (val->contents) {
        memset((char *)val->contents, 0, val->length);
index 62e34760dcfacd3b5283eac759183c9685c459b9..d86c30fe37983fed77209b1401a4e1d072069271 100644 (file)
@@ -29,8 +29,9 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_last_req(val)
-krb5_last_req_entry **val;
+krb5_free_last_req(context, val)
+    krb5_context context;
+    krb5_last_req_entry **val;
 {
     register krb5_last_req_entry **temp;
 
index 365d9eb1b836909a41fef34ae0e9189ce2465b0c..7aef9af36bac13537f0c556477ac5c14bda2d609 100644 (file)
@@ -29,8 +29,9 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_pa_data(val)
-krb5_pa_data **val;
+krb5_free_pa_data(context, val)
+    krb5_context context;
+    krb5_pa_data **val;
 {
     register krb5_pa_data **temp;
 
index b424cdd5d28d5549e11e4531283a3aef8868b93e..60ad85a253ca016c3290157e04202b3803bee31b 100644 (file)
@@ -29,8 +29,9 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_principal(val)
-krb5_principal val;
+krb5_free_principal(context, val)
+    krb5_context context;
+    krb5_principal val;
 {
     register int i;
 
@@ -38,9 +39,9 @@ krb5_principal val;
        return;
     
     if (val->data) {
-       i = krb5_princ_size(val);
+       i = krb5_princ_size(context, val);
        while(--i >= 0)
-           free(krb5_princ_component(val, i)->data);
+           free(krb5_princ_component(context, val, i)->data);
        krb5_xfree(val->data);
     }
     if (val->realm.data)
index 78f7e6935aa2648d49609c5497a28d5d82544d84..61d684ec6c933b7c7a05f15af9f741b0f302e396 100644 (file)
@@ -29,7 +29,8 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_priv(val)
+krb5_free_priv(context, val)
+    krb5_context context;
 register krb5_priv *val;
 {
     if (val->enc_part.ciphertext.data)
index f2c1c3afabac69bb1a451def583963baf7ccedb4..46d31caef2df0bdee19f3c53f1a1f98448bbd459 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_priv_enc_part(val)
-register krb5_priv_enc_part *val;
+krb5_free_priv_enc_part(context, val)
+    krb5_context context;
+    register krb5_priv_enc_part *val;
 {
     if (val->user_data.data)
        krb5_xfree(val->user_data.data);
     if (val->r_address)
-       krb5_free_address(val->r_address);
+       krb5_free_address(context, val->r_address);
     if (val->s_address)
-       krb5_free_address(val->s_address);
+       krb5_free_address(context, val->s_address);
     krb5_xfree(val);
     return;
 }
index 2e423d3d11053234d88c0ffeae150f18b9963a56..9d69fb4d30d1c2daa657fe8ac1255964a085c06e 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_pwd_data(val)
+krb5_free_pwd_data(context, val)
+    krb5_context context;
 krb5_pwd_data *val;
 {
     if (val->element)
-       krb5_free_pwd_sequences(val->element);
+       krb5_free_pwd_sequences(context, val->element);
     krb5_xfree(val);
     return;
 }
index 25cb915e8b542c0f6e8b679f32a9df290b714dd1..fc0a1c5532b767d31a3d37c47f7c74ed990b7e34 100644 (file)
@@ -29,8 +29,9 @@
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_pwd_sequences(val)
-passwd_phrase_element **val;
+krb5_free_pwd_sequences(context, val)
+    krb5_context context;
+    passwd_phrase_element **val;
 {
     if ((*val)->passwd)
        krb5_xfree((*val)->passwd);
index 375a0b2dcd560e7a57a6f6beb190e7931bd6d667..df37add0fa45dd4e382bc4e5736621b2c9e0781a 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_safe(val)
-register krb5_safe *val;
+krb5_free_safe(context, val)
+    krb5_context context;
+    register krb5_safe *val;
 {
     if (val->user_data.data)
        krb5_xfree(val->user_data.data);
     if (val->r_address)
-       krb5_free_address(val->r_address);
+       krb5_free_address(context, val->r_address);
     if (val->s_address)
-       krb5_free_address(val->s_address);
+       krb5_free_address(context, val->s_address);
     if (val->checksum)
-       krb5_free_checksum(val->checksum);
+       krb5_free_checksum(context, val->checksum);
     krb5_xfree(val);
     return;
 }
index 832a68cb04ac994f546737ee03e4aa53ef897de6..6210d296d81a48ad323fdd1eeecb74ed3f37296c 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_tgt_creds(tgts)
-krb5_creds **tgts;
+krb5_free_tgt_creds(context, tgts)
+    krb5_context context;
+    krb5_creds **tgts;
 {
     register krb5_creds **tgtpp;
     for (tgtpp = tgts; *tgtpp; tgtpp++)
-       krb5_free_creds(*tgtpp);
+       krb5_free_creds(context, *tgtpp);
     krb5_xfree(tgts);
 }
index c6e30e5afb49f6d16f14e64046f737bd6774afc4..26e8ea0a4a75abbec4fb865e66ed435591a83fff 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_ticket(val)
-krb5_ticket *val;
+krb5_free_ticket(context, val)
+    krb5_context context;
+    krb5_ticket *val;
 {
     if (val->server)
-       krb5_free_principal(val->server);
+       krb5_free_principal(context, val->server);
     if (val->enc_part.ciphertext.data)
        krb5_xfree(val->enc_part.ciphertext.data);
     if (val->enc_part2)
-       krb5_free_enc_tkt_part(val->enc_part2);
+       krb5_free_enc_tkt_part(context, val->enc_part2);
     krb5_xfree(val);
     return;
 }
index 021fe0fa9557fdd6d004e833f353d56942366dea..df609757c8b2d7a3c98b6cffc3efbf560fc60c6f 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_tickets(val)
-krb5_ticket **val;
+krb5_free_tickets(context, val)
+    krb5_context context;
+    krb5_ticket **val;
 {
     register krb5_ticket **temp;
 
     for (temp = val; *temp; temp++)
-        krb5_free_ticket(*temp);
+        krb5_free_ticket(context, *temp);
     krb5_xfree(val);
     return;
 }
index 85f6d8664052d6d6d9cad0bef41340a771e39ae4..17b8e455f3a92d7d34ba8f8221dd3a08e231ce31 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_tkt_authent(val)
-krb5_tkt_authent *val;
+krb5_free_tkt_authent(context, val)
+    krb5_context context;
+    krb5_tkt_authent *val;
 {
     if (val->ticket)
-           krb5_free_ticket(val->ticket);
+           krb5_free_ticket(context, val->ticket);
     if (val->authenticator)
-           krb5_free_authenticator(val->authenticator);
+           krb5_free_authenticator(context, val->authenticator);
     krb5_xfree(val);
     return;
 }
index bde2e39e82de4b5faeda782661c7045e451c2a59..0cc1852f750429d8c07b947d369707e05c2ffce0 100644 (file)
@@ -1,3 +1,7 @@
+Fri Jan 13 15:23:47 1995  Chris Provenzano (proven@mit.edu)
+
+    * Added krb5_context to all krb5_routines
+
 Fri Oct 14 23:09:02 1994  Theodore Y. Ts'o  (tytso@dcl)
 
        * configure.in: Add ISODE_DEFS rule.
index eb69352430565f44c579d809525991ddcbefda30..8e9b1853e9f5b3a8342d68ecee0d62abde6069be 100644 (file)
 #include <krb5/krb5.h>
 
 krb5_error_code
-krb5_kt_add_entry (id, entry)
-krb5_keytab id;
-krb5_keytab_entry *entry;
+krb5_kt_add_entry (context, id, entry)
+    krb5_context context;
+    krb5_keytab id;
+    krb5_keytab_entry *entry;
 {
     if (id->ops->add)
-       return (*id->ops->add)(id, entry);
+       return (*id->ops->add)(context, id, entry);
     else
        return KRB5_KT_NOWRITE;
 }
index 189351c68a03219bd999cac7e5b4796e28f714fd..c359b0e268c6c1c83d73faca7641343d1a04d8fb 100644 (file)
@@ -42,8 +42,9 @@ static struct krb5_kt_typelist *kt_typehead = &krb5_kt_typelist_dfl;
  */
 
 krb5_error_code
-krb5_kt_register(ops)
-krb5_kt_ops *ops;
+krb5_kt_register(context, ops)
+    krb5_context context;
+    krb5_kt_ops *ops;
 {
     struct krb5_kt_typelist *t;
     for (t = kt_typehead;t && strcmp(t->ops->prefix,ops->prefix);t = t->next)
@@ -69,7 +70,8 @@ krb5_kt_ops *ops;
  * particular keytab type.
  */
 
-krb5_error_code krb5_kt_resolve (name, ktid)
+krb5_error_code krb5_kt_resolve (context, name, ktid)
+    krb5_context context;
     const char *name;
     krb5_keytab *ktid;
 {
@@ -79,7 +81,7 @@ krb5_error_code krb5_kt_resolve (name, ktid)
     
     cp = strchr (name, ':');
     if (!cp) {
-           return (*krb5_kt_dfl_ops.resolve)(name, ktid);
+           return (*krb5_kt_dfl_ops.resolve)(context, name, ktid);
     }
 
     pfxlen = cp - (char *)name;
@@ -97,7 +99,7 @@ krb5_error_code krb5_kt_resolve (name, ktid)
     for (tlist = kt_typehead; tlist; tlist = tlist->next) {
        if (strcmp (tlist->ops->prefix, pfx) == 0) {
            free(pfx);
-           return (*tlist->ops->resolve)(resid, ktid);
+           return (*tlist->ops->resolve)(context, resid, ktid);
        }
     }
     free(pfx);
index 071c2ab93ea4d4d56d04e6255af70e48d147312f..17bbf6d6bbb1b4803f8db98df6a0d748206d8c15 100644 (file)
 #include <krb5/krb5.h>
 #include <stdio.h>
 
-krb5_error_code krb5_kt_default(id)
-krb5_keytab *id;
+krb5_error_code krb5_kt_default(context, id)
+    krb5_context context;
+    krb5_keytab *id;
 {
     char defname[BUFSIZ];
     krb5_error_code retval;
 
-    if (retval = krb5_kt_default_name(defname, sizeof(defname)))
+    if (retval = krb5_kt_default_name(context, defname, sizeof(defname)))
        return retval;
-    return krb5_kt_resolve(defname, id);
+    return krb5_kt_resolve(context, defname, id);
 }
 
 
index 9204033a7f2d763e898123a9df0a4d6cc9326665..efe39329e41c9cce1da8c7c25fc1a7f2ef19c4ed 100644 (file)
 #include <krb5/ext-proto.h>
 
 krb5_error_code
-krb5_kt_free_entry (entry)
-krb5_keytab_entry *entry;
+krb5_kt_free_entry (context, entry)
+    krb5_context context;
+    krb5_keytab_entry *entry;
 {
     if (!entry)
        return 0;
     
-    krb5_free_principal(entry->principal);
+    krb5_free_principal(context, entry->principal);
     if (entry->key.contents) {
        memset((char *)entry->key.contents, 0, entry->key.length);
        krb5_xfree(entry->key.contents);
index f068d44580836b41d65c538f2e192a30ded42d7d..795ce742dc0e153bd30d28aa19857b62208c296c 100644 (file)
 #include <krb5/krb5.h>
 
 krb5_error_code
-krb5_kt_remove_entry (id, entry)
-krb5_keytab id;
-krb5_keytab_entry *entry;
+krb5_kt_remove_entry (context, id, entry)
+    krb5_context context;
+    krb5_keytab id;
+    krb5_keytab_entry *entry;
 {
     if (id->ops->remove)
-       return (*id->ops->remove)(id, entry);
+       return (*id->ops->remove)(context, id, entry);
     else
        return KRB5_KT_NOWRITE;
 }
index 39eb42e535c355b29927c73bacecec19f1ea6726..ff4890b127cbf0f8725adc82fc0bcacc3f405792 100644 (file)
 #define KSUCCESS 0
 
 krb5_error_code 
-krb5_kt_read_service_key(DECLARG(krb5_pointer, keyprocarg),
-                        DECLARG(krb5_principal, principal),
-                        DECLARG(krb5_kvno, vno),
-                        DECLARG(krb5_keyblock **, key))
-OLDDECLARG(krb5_pointer, keyprocarg)
-OLDDECLARG(krb5_principal, principal)
-OLDDECLARG(krb5_kvno, vno)
-OLDDECLARG(krb5_keyblock **, key)
+krb5_kt_read_service_key(context, keyprocarg, principal, vno, key)
+    krb5_context context;
+    krb5_pointer keyprocarg;
+    krb5_principal principal;
+    krb5_kvno vno;
+    krb5_keyblock ** key;
 /*
        effects: If keyprocarg is not NULL, it is taken to be 
                the name of a keytab.  Otherwise, the default
@@ -64,7 +62,7 @@ OLDDECLARG(krb5_keyblock **, key)
      * Get the name of the file that we should use. 
      */
     if (!keyprocarg) {
-       if ((kerror = krb5_kt_default_name((char *)keytabname, 
+       if ((kerror = krb5_kt_default_name(context, (char *)keytabname, 
                                           sizeof(keytabname) - 1))!= KSUCCESS)
            return (kerror);
     } else {
@@ -73,18 +71,18 @@ OLDDECLARG(krb5_keyblock **, key)
                       sizeof(keytabname) - 1);
     }
 
-    if (kerror = krb5_kt_resolve((char *)keytabname, &id))
+    if (kerror = krb5_kt_resolve(context, (char *)keytabname, &id))
        return (kerror);
 
-    kerror = krb5_kt_get_entry(id, principal, vno, &entry);
-    krb5_kt_close(id);
+    kerror = krb5_kt_get_entry(context, id, principal, vno, &entry);
+    krb5_kt_close(context, id);
 
     if (kerror)
        return(kerror);
 
-    krb5_copy_keyblock(&entry.key, key);
+    krb5_copy_keyblock(context, &entry.key, key);
 
-    krb5_kt_free_entry(&entry);
+    krb5_kt_free_entry(context, &entry);
 
     return (KSUCCESS);
 }
index bdeada42557f8453a49dab2ea0f66fc4c0ec63d0..ea7c50abeb829f4f9fc3e68b56e1a1e9d0c28208 100644 (file)
@@ -1,3 +1,7 @@
+Fri Jan 13 15:23:47 1995  Chris Provenzano (proven@mit.edu)
+
+    * Added krb5_context to all krb5_routines
+
 Mon Dec 19 21:55:44 1994  Theodore Y. Ts'o  (tytso@dcl)
 
        * init_ctx.c: New file.  Initializes and frees the krb5_context
index 84a9abb7c83104c49c89c21c2295f21ba5836a1d..211648f29d7fbbf317c4d7cf729db800167d2770 100644 (file)
  * If the two addresses are the same, return TRUE, else return FALSE
  */
 krb5_boolean
-krb5_address_compare(addr1, addr2)
-const krb5_address *addr1;
-const krb5_address *addr2;
+krb5_address_compare(context, addr1, addr2)
+    krb5_context context;
+    const krb5_address *addr1;
+    const krb5_address *addr2;
 {
     if (addr1->addrtype != addr2->addrtype)
        return(FALSE);
index 05059a5c6361b467a54eff3deb39e33b7c0297fb..6d9f3466951ce1d0593ff2034db3b900535e4b5d 100644 (file)
  * < 0 if first is less than 2nd, > 0 if first is greater than 2nd.
  */
 int
-krb5_address_order(addr1, addr2)
-register const krb5_address *addr1;
-register const krb5_address *addr2;
+krb5_address_order(context, addr1, addr2)
+    krb5_context context;
+    register const krb5_address *addr1;
+    register const krb5_address *addr2;
 {
     int dir;
     register int i;
index a1e66c98b249597b39bfcc87a862d6b72a5c3c43..cc9189f012ebd04e85c71627fc08af6172ac9964 100644 (file)
  * if not listed, return FALSE
  */
 krb5_boolean
-krb5_address_search(addr, addrlist)
-const krb5_address *addr;
-krb5_address * const * addrlist;
+krb5_address_search(context, addr, addrlist)
+    krb5_context context;
+    const krb5_address *addr;
+    krb5_address * const * addrlist;
 {
     if (!addrlist)
        return TRUE;
     for (; *addrlist; addrlist++) {
-       if (krb5_address_compare(addr, *addrlist))
+       if (krb5_address_compare(context, addr, *addrlist))
            return TRUE;
     }
     return FALSE;
index 4efabfdc0a3640a9793cce82bebbb5f2a5cbf03b..5d11e2b1924ffd62d36337a6f34b4faa01f976ec 100644 (file)
 
 krb5_error_code
 #if __STDC__ || defined(STDARG_PROTOTYPES)
-krb5_build_principal_ext(krb5_principal *princ, int rlen,
-                        const char *realm, ...)
+krb5_build_principal_ext(krb5_context context,  krb5_principal * princ, int rlen, const char * realm, ...)
 #else
-krb5_build_principal_ext(princ, rlen, realm, va_alist)
-krb5_principal *princ;
-int rlen;
-const char *realm;
-va_dcl
+krb5_build_principal_ext(context, princ, rlen, realm, va_alist)
+    krb5_context context;
+    krb5_principal *princ;
+    int rlen;
+    const char *realm;
+    va_dcl
 #endif
 {
     va_list ap;
@@ -84,8 +84,8 @@ va_dcl
        krb5_xfree(princ_ret);
        return ENOMEM;
     }  
-    krb5_princ_set_realm_length(princ_ret, rlen);
-    krb5_princ_set_realm_data(princ_ret, tmpdata);
+    krb5_princ_set_realm_length(context, princ_ret, rlen);
+    krb5_princ_set_realm_data(context, princ_ret, tmpdata);
     memcpy(tmpdata, realm, rlen);
     tmpdata[rlen] = 0;
 
@@ -107,7 +107,7 @@ va_dcl
     }
     va_end(ap);
     *princ = princ_ret;
-    krb5_princ_type(princ_ret) = KRB5_NT_UNKNOWN;
+    krb5_princ_type(context, princ_ret) = KRB5_NT_UNKNOWN;
     return 0;
 
 free_out:
index 8a93fe66cb3bcb813c5b026a435d1e9947ebaf3f..94dbb723d6cb1fe9d27a8b600bbe0e7b21f4010d 100644 (file)
 #include <krb5/ext-proto.h>
 
 krb5_error_code
-krb5_build_principal_va(princ, rlen, realm, ap)
-krb5_principal princ;
-int rlen;
-const char *realm;
-va_list ap;
+krb5_build_principal_va(context, princ, rlen, realm, ap)
+    krb5_context context;
+    krb5_principal princ;
+    int rlen;
+    const char *realm;
+    va_list ap;
 {
     register int i, count = 0;
     register char *next;
@@ -55,13 +56,13 @@ va_list ap;
     data = (krb5_data *) malloc(sizeof(krb5_data) * count);
     if (data == 0)
        return ENOMEM;
-    krb5_princ_set_realm_length(princ, rlen);
+    krb5_princ_set_realm_length(context, princ, rlen);
     tmpdata = malloc(rlen);
     if (!tmpdata) {
        free (data);
        return ENOMEM;
     }
-    krb5_princ_set_realm_data(princ, tmpdata);
+    krb5_princ_set_realm_data(context, princ, tmpdata);
     memcpy(tmpdata, realm, rlen);
 
     /* process rest of components */
@@ -100,13 +101,15 @@ va_list ap;
 
 krb5_error_code
 #if __STDC__ || defined(STDARG_PROTOTYPES)
-krb5_build_principal(krb5_principal *princ, int rlen, const char *realm, ...)
+krb5_build_principal(krb5_context context,  krb5_principal * princ, int rlen,
+    const char * realm, ...)
 #else
-krb5_build_principal(princ, rlen, realm, va_alist)
-krb5_principal *princ;
-int rlen;
-const char *realm;
-va_dcl
+krb5_build_principal(context, princ, rlen, realm, va_alist)
+    krb5_context context;
+    krb5_principal *princ;
+    int rlen;
+    const char *realm;
+    va_dcl
 #endif
 {
     va_list ap;
@@ -121,7 +124,7 @@ va_dcl
 #else
     va_start(ap);
 #endif
-    retval = krb5_build_principal_va(pr_ret, rlen, realm, ap);
+    retval = krb5_build_principal_va(context, pr_ret, rlen, realm, ap);
     va_end(ap);
     if (retval == 0)
        *princ = pr_ret;
index e4c06dd1db61c382b697100ca349fb14c22e9032..9b2d5b9cd0653b3eb01e84fa6754ce459f4448dd 100644 (file)
@@ -25,7 +25,8 @@
 
 #define MAX_REALM_LN 500
 
-krb5_error_code krb5_check_transited_list(trans, realm1, realm2)
+krb5_error_code krb5_check_transited_list(context, trans, realm1, realm2)
+    krb5_context context;
 krb5_data      *trans;
 krb5_data      *realm1;
 krb5_data      *realm2;
@@ -42,7 +43,7 @@ krb5_data      *realm2;
   trans_length = trans->data[trans->length-1] ?
                  trans->length : trans->length - 1;
 
-  if (retval = krb5_walk_realm_tree(realm1, realm2, &tgs_list,
+  if (retval = krb5_walk_realm_tree(context, realm1, realm2, &tgs_list,
                                     KRB5_REALM_BRANCH_CHAR)) {
     return(retval);
   }
@@ -64,8 +65,8 @@ krb5_data      *realm2;
         if (*(nextp-1) == '.')  strcat(next, prev);
         retval = KRB5KRB_AP_ERR_ILL_CR_TKT;
         for (j = 0; tgs_list[j]; j++) {
-          if (strlen(next) == krb5_princ_realm(tgs_list[j])->length &&
-              !memcmp(next, krb5_princ_realm(tgs_list[j])->data,
+          if (strlen(next) == krb5_princ_realm(context, tgs_list[j])->length &&
+              !memcmp(next, krb5_princ_realm(context, tgs_list[j])->data,
                       strlen(next))) {
             retval = 0;
             break; 
@@ -87,6 +88,6 @@ krb5_data      *realm2;
   }
 
 finish:
-  krb5_free_realm_tree(tgs_list);
+  krb5_free_realm_tree(context, tgs_list);
   return(retval);
 }
index e809d31fd5eaae5aedef87ad2f13f59d648e6a37..264a35adc2c5c8c5f8977fe9f2c74d7eebd095bf 100644 (file)
@@ -58,7 +58,8 @@ static int krb_v4_recvauth();
 #define KRB5_RECVAUTH_V5       5
 
 krb5_error_code
-krb5_compat_recvauth(/* IN */
+krb5_compat_recvauth(context, 
+                /* IN */
                     fdp, appl_version, server, sender_addr, fetch_from,
                     keyproc, keyprocarg, rc_type, flags,
                     v4_options, v4_service, v4_instance, v4_faddr, v4_laddr,
@@ -66,6 +67,7 @@ krb5_compat_recvauth(/* IN */
                     /* OUT */
                     auth_sys, seq_number, client, ticket, authent,
                     v4_kdata, v4_schedule, v4_version)
+    krb5_context context;
        krb5_pointer    fdp;
        char    *appl_version;
        krb5_principal  server;
@@ -105,7 +107,7 @@ krb5_compat_recvauth(/* IN */
        KTEXT           v4_ticket;       /* storage for client's ticket */
 #endif
                
-       if ((retval = krb5_net_read(fd, vers.vers, 4)) != 4)
+       if ((retval = krb5_net_read(context, fd, vers.vers, 4)) != 4)
                return((retval < 0) ? errno : ECONNABORTED);
 
 #ifdef KRB5_KRB4_COMPAT
@@ -114,7 +116,7 @@ krb5_compat_recvauth(/* IN */
                 * We must be talking to a V4 sendauth; read in the
                 * rest of the version string and make sure.
                 */
-               if ((retval = krb5_net_read(fd, vers.vers, 4)) != 4)
+               if ((retval = krb5_net_read(context, fd, vers.vers, 4)) != 4)
                        return((retval < 0) ? errno : ECONNABORTED);
                
                if (strncmp(vers.vers, KRB_V4_SENDAUTH_VERS+4, 4))
@@ -176,7 +178,7 @@ krb5_compat_recvauth(/* IN */
        if (!buf)
                return ENOMEM;
        
-       length = krb5_net_read(fd, buf, len);
+       length = krb5_net_read(context, fd, buf, len);
        if (len != length) {
                krb5_xfree(buf);
                if (len < 0)
@@ -193,7 +195,7 @@ krb5_compat_recvauth(/* IN */
 
        *auth_sys = KRB5_RECVAUTH_V5;
        
-       retval = krb5_recvauth(fdp, appl_version, server, sender_addr,
+       retval = krb5_recvauth(context, fdp, appl_version, server, sender_addr,
                               fetch_from,
                               keyproc, keyprocarg, rc_type,
                               flags | KRB5_RECVAUTH_SKIP_VERSION,
index 31aa1fe7f8441e05978e56295906ffcf704c9fd6..2ed3ccf0381607c1b496e1c54334cdae51cf5013 100644 (file)
@@ -99,21 +99,22 @@ static char *strnchr(s, c, n)
 /* XXX This calls for a new error code */
 #define KRB5_INVALID_PRINCIPAL KRB5_LNAME_BADFORMAT
 
-krb5_error_code krb5_524_conv_principal(princ, name, inst, realm)
-   const krb5_principal princ;
-   char *name;
-   char *inst;
-   char *realm;
+krb5_error_code krb5_524_conv_principal(context, princ, name, inst, realm)
+    krb5_context context;
+    const krb5_principal princ;
+    char *name;
+    char *inst;
+    char *realm;
 {
      struct krb_convert *p;
      krb5_data *comp;
      char *c;
 
      *name = *inst = '\0';
-     switch (krb5_princ_size(princ)) {
+     switch (krb5_princ_size(context, princ)) {
      case 2:
          /* Check if this principal is listed in the table */
-         comp = krb5_princ_component(princ, 0);
+         comp = krb5_princ_component(context, princ, 0);
          p = sconv_list;
          while (p->v4_str) {
               if (strncmp(p->v5_str, comp->data, comp->length) == 0) {
@@ -121,7 +122,7 @@ krb5_error_code krb5_524_conv_principal(princ, name, inst, realm)
                    /* instance's domain name if requested */
                    strcpy(name, p->v4_str);
                    if (p->flags & DO_REALM_CONVERSION) {
-                        comp = krb5_princ_component(princ, 1);
+                        comp = krb5_princ_component(context, princ, 1);
                         c = strnchr(comp->data, '.', comp->length);
                         if (!c || (c - comp->data) > INST_SZ - 1)
                              return KRB5_INVALID_PRINCIPAL;
@@ -135,7 +136,7 @@ krb5_error_code krb5_524_conv_principal(princ, name, inst, realm)
          /* If inst isn't set, the service isn't listed in the table, */
          /* so just copy it. */
          if (*inst == '\0') {
-              comp = krb5_princ_component(princ, 1);
+              comp = krb5_princ_component(context, princ, 1);
               if (comp->length >= INST_SZ - 1)
                    return KRB5_INVALID_PRINCIPAL;
               strncpy(inst, comp->data, comp->length);
@@ -145,7 +146,7 @@ krb5_error_code krb5_524_conv_principal(princ, name, inst, realm)
      case 1:
          /* name may have been set above; otherwise, just copy it */
          if (*name == '\0') {
-              comp = krb5_princ_component(princ, 0);
+              comp = krb5_princ_component(context, princ, 0);
               if (comp->length >= ANAME_SZ)
                    return KRB5_INVALID_PRINCIPAL;
               strncpy(name, comp->data, comp->length);
@@ -156,7 +157,7 @@ krb5_error_code krb5_524_conv_principal(princ, name, inst, realm)
          return KRB5_INVALID_PRINCIPAL;
      }
 
-     comp = krb5_princ_realm(princ);
+     comp = krb5_princ_realm(context, princ);
      if (comp->length > REALM_SZ - 1)
          return KRB5_INVALID_PRINCIPAL;
      strncpy(realm, comp->data, comp->length);
@@ -165,7 +166,8 @@ krb5_error_code krb5_524_conv_principal(princ, name, inst, realm)
      return 0;
 }
 
-krb5_error_code krb5_425_conv_principal(name, instance, realm, princ)
+krb5_error_code krb5_425_conv_principal(context, name, instance, realm, princ)
+   krb5_context context;
    const char  *name;
    const char  *instance;
    const char  *realm;
@@ -192,7 +194,7 @@ krb5_error_code krb5_425_conv_principal(name, instance, realm, princ)
          name = p->v5_str;
          if (p->flags & DO_REALM_CONVERSION) {
               strcpy(buf, instance);
-              retval = krb5_get_realm_domain(realm, &domain);
+              retval = krb5_get_realm_domain(context, realm, &domain);
               if (retval)
                   return retval;
               if (domain) {
@@ -207,6 +209,6 @@ krb5_error_code krb5_425_conv_principal(name, instance, realm, princ)
      }
      
 not_service:   
-     return(krb5_build_principal(princ, strlen(realm), realm, name,
+     return(krb5_build_principal(context, princ, strlen(realm), realm, name,
                                 instance, 0));
 }
index c04e2dbd4068f1a3c49df386ca60229ba9a51d2d..1bb0ba6829954167a641c1d825ac179079ed0659 100644 (file)
@@ -30,7 +30,8 @@
 #include <krb5/ext-proto.h>
 
 static krb5_error_code
-krb5_copy_addr(inad, outad)
+krb5_copy_addr(context, inad, outad)
+    krb5_context context;
 const krb5_address *inad;
 krb5_address **outad;
 {
@@ -52,9 +53,10 @@ krb5_address **outad;
  * Copy an address array, with fresh allocation.
  */
 krb5_error_code
-krb5_copy_addresses(inaddr, outaddr)
-krb5_address * const * inaddr;
-krb5_address ***outaddr;
+krb5_copy_addresses(context, inaddr, outaddr)
+    krb5_context context;
+    krb5_address * const * inaddr;
+    krb5_address ***outaddr;
 {
     krb5_error_code retval;
     krb5_address ** tempaddr;
@@ -72,9 +74,9 @@ krb5_address ***outaddr;
        return ENOMEM;
 
     for (nelems = 0; inaddr[nelems]; nelems++) {
-       retval = krb5_copy_addr(inaddr[nelems], &tempaddr[nelems]);
+       retval = krb5_copy_addr(context, inaddr[nelems], &tempaddr[nelems]);
         if (retval) {
-           krb5_free_addresses(tempaddr);
+           krb5_free_addresses(context, tempaddr);
            return retval;
        }
     }
@@ -89,9 +91,10 @@ krb5_address ***outaddr;
  * returns failure, but it will not change the contents of the list.
  */
 krb5_error_code
-krb5_append_addresses(inaddr, outaddr)
-krb5_address * const * inaddr;
-krb5_address ***outaddr;
+krb5_append_addresses(context, inaddr, outaddr)
+    krb5_context context;
+       krb5_address * const * inaddr;
+       krb5_address ***outaddr;
 {
     krb5_error_code retval;
     krb5_address ** tempaddr;
@@ -117,7 +120,7 @@ krb5_address ***outaddr;
 
 
     for (nelems = 0; inaddr[nelems]; nelems++) {
-       retval = krb5_copy_addr(inaddr[nelems],
+       retval = krb5_copy_addr(context, inaddr[nelems],
                                &tempaddr[norigelems + nelems]);
        if (retval)
            goto cleanup;
@@ -128,7 +131,7 @@ krb5_address ***outaddr;
 
   cleanup:
     while (--nelems >= 0)
-       krb5_free_address(tempaddr[norigelems + nelems]);
+       krb5_free_address(context, tempaddr[norigelems + nelems]);
 
     /* Try to allocate a smaller amount of memory for *outaddr.  */
     tempaddr = (krb5_address **) realloc((char *)tempaddr,
index fe4575b806523fcf0cf8af6f1efa33bbee08db84..82bb8d79fda09c533ace16bbaf010d0e8afa14c8 100644 (file)
@@ -30,7 +30,8 @@
 #include <krb5/ext-proto.h>
 
 krb5_error_code
-krb5_copy_authenticator(authfrom, authto)
+krb5_copy_authenticator(context, authfrom, authto)
+    krb5_context context;
 const krb5_authenticator *authfrom;
 krb5_authenticator **authto;
 {
@@ -41,38 +42,38 @@ krb5_authenticator **authto;
        return ENOMEM;
     *tempto = *authfrom;
 
-    retval = krb5_copy_principal(authfrom->client, &tempto->client);
+    retval = krb5_copy_principal(context, authfrom->client, &tempto->client);
     if (retval) {
        krb5_xfree(tempto);
        return retval;
     }
     
     if (authfrom->checksum &&
-       (retval = krb5_copy_checksum(authfrom->checksum, &tempto->checksum))) {
-           krb5_free_principal(tempto->client);    
+       (retval = krb5_copy_checksum(context, authfrom->checksum, &tempto->checksum))) {
+           krb5_free_principal(context, tempto->client);    
            krb5_xfree(tempto);
            return retval;
     }
     
     if (authfrom->subkey) {
-           retval = krb5_copy_keyblock(authfrom->subkey, &tempto->subkey);
+           retval = krb5_copy_keyblock(context, authfrom->subkey, &tempto->subkey);
            if (retval) {
                    krb5_xfree(tempto->subkey);
-                   krb5_free_checksum(tempto->checksum);
-                   krb5_free_principal(tempto->client);    
+                   krb5_free_checksum(context, tempto->checksum);
+                   krb5_free_principal(context, tempto->client);    
                    krb5_xfree(tempto);
                    return retval;
            }
     }
     
     if (authfrom->authorization_data) {
-               retval = krb5_copy_authdata(authfrom->authorization_data,
+               retval = krb5_copy_authdata(context, authfrom->authorization_data,
                                    &tempto->authorization_data);
                if (retval) {
                    krb5_xfree(tempto->subkey);
-                   krb5_free_checksum(tempto->checksum);
-                   krb5_free_principal(tempto->client);    
-                   krb5_free_authdata(tempto->authorization_data);
+                   krb5_free_checksum(context, tempto->checksum);
+                   krb5_free_principal(context, tempto->client);    
+                   krb5_free_authdata(context, tempto->authorization_data);
                    krb5_xfree(tempto);
                    return retval;
                }
index 39a6c83cb74a5387a281ac7dfb514a881bb4bda7..830af3a8a1f318575a87159e67ed5f953a8be3a4 100644 (file)
@@ -30,7 +30,8 @@
 #include <krb5/ext-proto.h>
 
 static krb5_error_code
-krb5_copy_authdatum(inad, outad)
+krb5_copy_authdatum(context, inad, outad)
+    krb5_context context;
 const krb5_authdata *inad;
 krb5_authdata **outad;
 {
@@ -52,7 +53,8 @@ krb5_authdata **outad;
  * Copy an authdata array, with fresh allocation.
  */
 krb5_error_code
-krb5_copy_authdata(inauthdat, outauthdat)
+krb5_copy_authdata(context, inauthdat, outauthdat)
+    krb5_context context;
 krb5_authdata * const * inauthdat;
 krb5_authdata ***outauthdat;
 {
@@ -73,10 +75,10 @@ krb5_authdata ***outauthdat;
        return ENOMEM;
 
     for (nelems = 0; inauthdat[nelems]; nelems++) {
-       retval = krb5_copy_authdatum(inauthdat[nelems],
+       retval = krb5_copy_authdatum(context, inauthdat[nelems],
                                     &tempauthdat[nelems]);
        if (retval) {
-           krb5_free_authdata(tempauthdat);
+           krb5_free_authdata(context, tempauthdat);
            return retval;
        }
     }
index 5f92c0b7c727acc9c700c28c7e2422555172d7e9..cf04f48408eaaeb70251b5238fd2853eb7b80197 100644 (file)
 #include <krb5/ext-proto.h>
 
 krb5_error_code
-krb5_copy_checksum(ckfrom, ckto)
-const krb5_checksum *ckfrom;
-krb5_checksum **ckto;
+krb5_copy_checksum(context, ckfrom, ckto)
+    krb5_context context;
+    const krb5_checksum *ckfrom;
+    krb5_checksum **ckto;
 {
     krb5_checksum *tempto;
 
index 0af3b263b46fc04826994fe47439c47af04c61c4..5c14be0754db5022b30ebe1e81c8862da4207681 100644 (file)
  */
 
 krb5_error_code
-krb5_copy_creds(incred, outcred)
-const krb5_creds *incred;
-krb5_creds **outcred;
+krb5_copy_creds(context, incred, outcred)
+    krb5_context context;
+    const krb5_creds *incred;
+    krb5_creds **outcred;
 {
     krb5_creds *tempcred;
     krb5_error_code retval;
@@ -46,32 +47,32 @@ krb5_creds **outcred;
        return ENOMEM;
 
     *tempcred = *incred;               /* copy everything quickly */
-    retval = krb5_copy_principal(incred->client, &tempcred->client);
+    retval = krb5_copy_principal(context, incred->client, &tempcred->client);
     if (retval)
        goto cleanlast;
-    retval = krb5_copy_principal(incred->server, &tempcred->server);
+    retval = krb5_copy_principal(context, incred->server, &tempcred->server);
     if (retval)
        goto cleanclient;
-    retval = krb5_copy_keyblock_contents(&incred->keyblock,
+    retval = krb5_copy_keyblock_contents(context, &incred->keyblock,
                                         &tempcred->keyblock);
     if (retval)
        goto cleanserver;
-    retval = krb5_copy_addresses(incred->addresses, &tempcred->addresses);
+    retval = krb5_copy_addresses(context, incred->addresses, &tempcred->addresses);
     if (retval)
        goto cleanblock;
-    retval = krb5_copy_data(&incred->ticket, &scratch);
+    retval = krb5_copy_data(context, &incred->ticket, &scratch);
     if (retval)
        goto cleanaddrs;
     tempcred->ticket = *scratch;
     krb5_xfree(scratch);
-    retval = krb5_copy_data(&incred->second_ticket, &scratch);
+    retval = krb5_copy_data(context, &incred->second_ticket, &scratch);
     if (retval)
        goto cleanticket;
 
     tempcred->second_ticket = *scratch;
     krb5_xfree(scratch);
 
-    retval = krb5_copy_authdata(incred->authdata,&tempcred->authdata);
+    retval = krb5_copy_authdata(context, incred->authdata,&tempcred->authdata);
     if (retval)
         goto clearticket;
 
@@ -83,13 +84,13 @@ krb5_creds **outcred;
  cleanticket:
     free(tempcred->ticket.data);
  cleanaddrs:
-    krb5_free_addresses(tempcred->addresses);
+    krb5_free_addresses(context, tempcred->addresses);
  cleanblock:
     krb5_xfree(tempcred->keyblock.contents);
  cleanserver:
-    krb5_free_principal(tempcred->server);
+    krb5_free_principal(context, tempcred->server);
  cleanclient:
-    krb5_free_principal(tempcred->client);
+    krb5_free_principal(context, tempcred->client);
  cleanlast:
     krb5_xfree(tempcred);
     return retval;
index aa7389e6a7cbf659689ca57ec4c7a5a63bd9684e..669ed3e8a9a4b35d4a875d8d69b6b832815c0faf 100644 (file)
  * Copy a data structure, with fresh allocation.
  */
 krb5_error_code
-krb5_copy_data(indata, outdata)
-const krb5_data *indata;
-krb5_data **outdata;
+krb5_copy_data(context, indata, outdata)
+    krb5_context context;
+    const krb5_data *indata;
+    krb5_data **outdata;
 {
     krb5_data *tempdata;
 
index 3f73a50bdd45a65d4e63e29da086cf596be23a3a..305d80d4057b0e015a33094322ab33f5e927bce9 100644 (file)
  * Copy a keyblock, including alloc'ed storage.
  */
 krb5_error_code
-krb5_copy_keyblock(from, to)
-const krb5_keyblock *from;
-krb5_keyblock **to;
+krb5_copy_keyblock(context, from, to)
+    krb5_context context;
+    const krb5_keyblock *from;
+    krb5_keyblock **to;
 {
        krb5_keyblock   *new_key;
 
index 61e178bedfcbbf850dec385257d86139d032dcfb..4ccfa2568cf878f89ba13c88f612e5e478306ae9 100644 (file)
  * Copy a principal structure, with fresh allocation.
  */
 krb5_error_code
-krb5_copy_principal(inprinc, outprinc)
-krb5_const_principal inprinc;
-krb5_principal *outprinc;
+krb5_copy_principal(context, inprinc, outprinc)
+    krb5_context context;
+    krb5_const_principal inprinc;
+    krb5_principal *outprinc;
 {
     register krb5_principal tempprinc;
     register int i, nelems;
@@ -47,7 +48,7 @@ krb5_principal *outprinc;
 
     *tempprinc = *inprinc;     /* Copy all of the non-allocated pieces */
 
-    nelems = krb5_princ_size(inprinc);
+    nelems = krb5_princ_size(context, inprinc);
     tempprinc->data = malloc(nelems * sizeof(krb5_data));
 
     if (tempprinc->data == 0) {
@@ -56,24 +57,24 @@ krb5_principal *outprinc;
     }
 
     for (i = 0; i < nelems; i++) {
-       int len = krb5_princ_component(inprinc, i)->length;
-       krb5_princ_component(tempprinc, i)->length = len;
-       if ((krb5_princ_component(tempprinc, i)->data = malloc(len)) == 0) {
+       int len = krb5_princ_component(context, inprinc, i)->length;
+       krb5_princ_component(context, tempprinc, i)->length = len;
+       if ((krb5_princ_component(context, tempprinc, i)->data = malloc(len)) == 0) {
            while (--i >= 0)
-               free(krb5_princ_component(tempprinc, i)->data);
+               free(krb5_princ_component(context, tempprinc, i)->data);
            free (tempprinc->data);
            free (tempprinc);
            return ENOMEM;
        }
-       memcpy(krb5_princ_component(tempprinc, i)->data,
-              krb5_princ_component(inprinc, i)->data, len);
+       memcpy(krb5_princ_component(context, tempprinc, i)->data,
+              krb5_princ_component(context, inprinc, i)->data, len);
     }
 
     tempprinc->realm.data =
            malloc(tempprinc->realm.length = inprinc->realm.length);
     if (!tempprinc->realm.data) {
            for (i = 0; i < nelems; i++)
-                   free(krb5_princ_component(tempprinc, i)->data);
+                   free(krb5_princ_component(context, tempprinc, i)->data);
            free(tempprinc->data);
            free(tempprinc);
            return ENOMEM;
index 00aea46df1713f814820c7b226e4d6a7103fba90..c4d512b84b1a5a4272a81c740a82df40a1df3023 100644 (file)
 #include <krb5/ext-proto.h>
 
 static krb5_error_code
-krb5_copy_enc_tkt_part(partfrom, partto)
-const krb5_enc_tkt_part *partfrom;
-krb5_enc_tkt_part **partto;
+krb5_copy_enc_tkt_part(context, partfrom, partto)
+    krb5_context context;
+    const krb5_enc_tkt_part *partfrom;
+    krb5_enc_tkt_part **partto;
 {
     krb5_error_code retval;
     krb5_enc_tkt_part *tempto;
@@ -40,15 +41,15 @@ krb5_enc_tkt_part **partto;
     if (!(tempto = (krb5_enc_tkt_part *)malloc(sizeof(*tempto))))
        return ENOMEM;
     *tempto = *partfrom;
-    retval = krb5_copy_keyblock(partfrom->session,
+    retval = krb5_copy_keyblock(context, partfrom->session,
                                &tempto->session);
     if (retval) {
        krb5_xfree(tempto);
        return retval;
     }
-    retval = krb5_copy_principal(partfrom->client, &tempto->client);
+    retval = krb5_copy_principal(context, partfrom->client, &tempto->client);
     if (retval) {
-       krb5_free_keyblock(tempto->session);
+       krb5_free_keyblock(context, tempto->session);
        krb5_xfree(tempto);
        return retval;
     }
@@ -59,8 +60,8 @@ krb5_enc_tkt_part **partto;
        tempto->transited.tr_contents.data =
          malloc(partfrom->transited.tr_contents.length);
        if (!tempto->transited.tr_contents.data) {
-           krb5_free_principal(tempto->client);
-           krb5_free_keyblock(tempto->session);
+           krb5_free_principal(context, tempto->client);
+           krb5_free_keyblock(context, tempto->session);
            krb5_xfree(tempto);
            return ENOMEM;
        }
@@ -69,22 +70,22 @@ krb5_enc_tkt_part **partto;
               partfrom->transited.tr_contents.length);
     }
 
-    retval = krb5_copy_addresses(partfrom->caddrs, &tempto->caddrs);
+    retval = krb5_copy_addresses(context, partfrom->caddrs, &tempto->caddrs);
     if (retval) {
        krb5_xfree(tempto->transited.tr_contents.data);
-       krb5_free_principal(tempto->client);
-       krb5_free_keyblock(tempto->session);
+       krb5_free_principal(context, tempto->client);
+       krb5_free_keyblock(context, tempto->session);
        krb5_xfree(tempto);
        return retval;
     }
     if (partfrom->authorization_data) {
-       retval = krb5_copy_authdata(partfrom->authorization_data,
+       retval = krb5_copy_authdata(context, partfrom->authorization_data,
                                    &tempto->authorization_data);
        if (retval) {
-           krb5_free_addresses(tempto->caddrs);
+           krb5_free_addresses(context, tempto->caddrs);
            krb5_xfree(tempto->transited.tr_contents.data);
-           krb5_free_principal(tempto->client);
-           krb5_free_keyblock(tempto->session);
+           krb5_free_principal(context, tempto->client);
+           krb5_free_keyblock(context, tempto->session);
            krb5_xfree(tempto);
            return retval;
        }
@@ -94,9 +95,10 @@ krb5_enc_tkt_part **partto;
 }
 
 krb5_error_code
-krb5_copy_ticket(from, pto)
-const krb5_ticket *from;
-krb5_ticket **pto;
+krb5_copy_ticket(context, from, pto)
+    krb5_context context;
+    const krb5_ticket *from;
+    krb5_ticket **pto;
 {
     krb5_error_code retval;
     krb5_ticket *tempto;
@@ -105,23 +107,23 @@ krb5_ticket **pto;
     if (!(tempto = (krb5_ticket *)malloc(sizeof(*tempto))))
        return ENOMEM;
     *tempto = *from;
-    retval = krb5_copy_principal(from->server, &tempto->server);
+    retval = krb5_copy_principal(context, from->server, &tempto->server);
     if (retval) {
        krb5_xfree(tempto);
        return retval;
     }
-    retval = krb5_copy_data(&from->enc_part.ciphertext, &scratch);
+    retval = krb5_copy_data(context, &from->enc_part.ciphertext, &scratch);
     if (retval) {
-       krb5_free_principal(tempto->server);
+       krb5_free_principal(context, tempto->server);
        krb5_xfree(tempto);
        return retval;
     }
     tempto->enc_part.ciphertext = *scratch;
     krb5_xfree(scratch);
-    retval = krb5_copy_enc_tkt_part(from->enc_part2, &tempto->enc_part2);
+    retval = krb5_copy_enc_tkt_part(context, from->enc_part2, &tempto->enc_part2);
     if (retval) {
        krb5_xfree(tempto->enc_part.ciphertext.data);
-       krb5_free_principal(tempto->server);
+       krb5_free_principal(context, tempto->server);
        krb5_xfree(tempto);
        return retval;
     }  
index 057857f7bd5a800c863a325de22007ce650cb3df..6b4db985d92eacc01837494d785b29fbf6e4a99c 100644 (file)
  * Copy a keyblock, including alloc'ed storage.
  */
 krb5_error_code
-krb5_copy_keyblock_contents(from, to)
-const krb5_keyblock *from;
-krb5_keyblock *to;
+krb5_copy_keyblock_contents(context, from, to)
+    krb5_context context;
+    const krb5_keyblock *from;
+    krb5_keyblock *to;
 {
     *to = *from;
     to->contents = (krb5_octet *)malloc(to->length);
index be54e6e19864feee2d32168b485ddf170c6432a0..dc24be99af9ee1e86a7c0eb0efab64dd71d609c8 100644 (file)
  */
 
 krb5_error_code
-krb5_decode_kdc_rep(DECLARG(krb5_data *, enc_rep),
-                   DECLARG(const krb5_keyblock *, key),
-                   DECLARG(const krb5_enctype, etype),
-                   DECLARG(krb5_kdc_rep **, dec_rep))
-OLDDECLARG(krb5_data *, enc_rep)
-OLDDECLARG(const krb5_keyblock *, key)
-OLDDECLARG(const krb5_enctype, etype)
-OLDDECLARG(krb5_kdc_rep **, dec_rep)
+krb5_decode_kdc_rep(context, enc_rep, key, etype, dec_rep)
+    krb5_context context;
+    krb5_data * enc_rep;
+    const krb5_keyblock * key;
+    const krb5_enctype etype;
+    krb5_kdc_rep ** dec_rep;
 {
     krb5_error_code retval;
     krb5_kdc_rep *local_dec_rep;
@@ -68,12 +66,12 @@ OLDDECLARG(krb5_kdc_rep **, dec_rep)
        return retval;
 
     if (local_dec_rep->enc_part.etype != etype) {
-       krb5_free_kdc_rep(local_dec_rep);
+       krb5_free_kdc_rep(context, local_dec_rep);
        return KRB5_WRONG_ETYPE;
     }
-    retval = krb5_kdc_rep_decrypt_proc(key, 0, local_dec_rep);
+    retval = krb5_kdc_rep_decrypt_proc(context, key, 0, local_dec_rep);
     if (retval) {
-       krb5_free_kdc_rep(local_dec_rep);
+       krb5_free_kdc_rep(context, local_dec_rep);
        return(retval);
     }
     *dec_rep = local_dec_rep;
index 41ddd301cf704c2248c92f3d71c61e1608818e2b..cd93328067eedb5ca06ed9980f0289a583922843 100644 (file)
 */
 
 krb5_error_code
-krb5_decrypt_tkt_part(srv_key, ticket)
-const krb5_keyblock *srv_key;
-register krb5_ticket *ticket;
+krb5_decrypt_tkt_part(context, srv_key, ticket)
+    krb5_context context;
+    const krb5_keyblock *srv_key;
+    register krb5_ticket *ticket;
 {
     krb5_enc_tkt_part *dec_tkt_part;
     krb5_encrypt_block eblock;
@@ -55,31 +56,31 @@ register krb5_ticket *ticket;
 
     /* put together an eblock for this encryption */
 
-    krb5_use_cstype(&eblock, ticket->enc_part.etype);
+    krb5_use_cstype(context, &eblock, ticket->enc_part.etype);
 
     scratch.length = ticket->enc_part.ciphertext.length;
     if (!(scratch.data = malloc(ticket->enc_part.ciphertext.length)))
        return(ENOMEM);
 
     /* do any necessary key pre-processing */
-    retval = krb5_process_key(&eblock, srv_key);
+    retval = krb5_process_key(context, &eblock, srv_key);
     if (retval) {
        free(scratch.data);
        return(retval);
     }
 
     /* call the encryption routine */
-    retval = krb5_decrypt((krb5_pointer) ticket->enc_part.ciphertext.data,
+    retval = krb5_decrypt(context, (krb5_pointer) ticket->enc_part.ciphertext.data,
                          (krb5_pointer) scratch.data,
                          scratch.length, &eblock, 0);
     if (retval) {
-       (void) krb5_finish_key(&eblock);
+       (void) krb5_finish_key(context, &eblock);
        free(scratch.data);
        return retval;
     }
 #define clean_scratch() {memset(scratch.data, 0, scratch.length); \
 free(scratch.data);}
-    retval = krb5_finish_key(&eblock);
+    retval = krb5_finish_key(context, &eblock);
     if (retval) {
 
        clean_scratch();
index 6b01b64d2dc02844bdce65af4bdfd567775316f3..0918c2c7c365fae53c4074f30b83516be797a825 100644 (file)
 /* due to argument promotion rules, we need to use the DECLARG/OLDDECLARG
    stuff... */
 krb5_error_code
-krb5_encode_kdc_rep(DECLARG(const krb5_msgtype, type),
-                   DECLARG(const krb5_enc_kdc_rep_part *, encpart),
-                   DECLARG(krb5_encrypt_block *, eblock),
-                   DECLARG(const krb5_keyblock *, client_key),
-                   DECLARG(krb5_kdc_rep *, dec_rep),
-                   DECLARG(krb5_data **, enc_rep))
-OLDDECLARG(const krb5_msgtype, type)
-OLDDECLARG(const krb5_enc_kdc_rep_part *, encpart)
-OLDDECLARG(krb5_encrypt_block *, eblock)
-OLDDECLARG(const krb5_keyblock *, client_key)
-OLDDECLARG(krb5_kdc_rep *, dec_rep)
-OLDDECLARG(krb5_data **, enc_rep)
+krb5_encode_kdc_rep(context, type, encpart, eblock, client_key, dec_rep, enc_rep)
+    krb5_context context;
+    const krb5_msgtype type;
+    const krb5_enc_kdc_rep_part * encpart;
+    krb5_encrypt_block * eblock;
+    const krb5_keyblock * client_key;
+    krb5_kdc_rep * dec_rep;
+    krb5_data ** enc_rep;
 {
     krb5_data *scratch;
     krb5_error_code retval;
@@ -94,7 +90,7 @@ OLDDECLARG(krb5_data **, enc_rep)
     memset(&tmp_encpart, 0, sizeof(tmp_encpart));
 
 #define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); \
-krb5_free_data(scratch); }
+krb5_free_data(context, scratch); }
 
     dec_rep->enc_part.ciphertext.length =
        krb5_encrypt_size(scratch->length, eblock->crypto_entry);
@@ -120,26 +116,26 @@ free(dec_rep->enc_part.ciphertext.data); \
 dec_rep->enc_part.ciphertext.length = 0; \
 dec_rep->enc_part.ciphertext.data = 0;}
 
-    retval = krb5_process_key(eblock, client_key);
+    retval = krb5_process_key(context, eblock, client_key);
     if (retval) {
        goto clean_encpart;
     }
 
-#define cleanup_prockey() {(void) krb5_finish_key(eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(context, eblock);}
 
-    retval = krb5_encrypt((krb5_pointer) scratch->data,
+    retval = krb5_encrypt(context, (krb5_pointer) scratch->data,
                              (krb5_pointer) dec_rep->enc_part.ciphertext.data,
                              scratch->length, eblock, 0);
     if (retval) {
        goto clean_prockey;
     }
 
-    dec_rep->enc_part.etype = krb5_eblock_enctype(eblock);
+    dec_rep->enc_part.etype = krb5_eblock_enctype(context, eblock);
 
     /* do some cleanup */
     cleanup_scratch();
 
-    retval = krb5_finish_key(eblock);
+    retval = krb5_finish_key(context, eblock);
     if (retval) {
        cleanup_encpart();
        return retval;
index bb263da00716ff2a8a4efd4f2ac99ff5313bc1a0..80095b4b45a7fa4dc3ec0a84a34b4d25ddbbc4ac 100644 (file)
 */
 
 krb5_error_code
-krb5_encrypt_tkt_part(eblock, srv_key, dec_ticket)
-krb5_encrypt_block *eblock;
-const krb5_keyblock *srv_key;
-register krb5_ticket *dec_ticket;
+krb5_encrypt_tkt_part(context, eblock, srv_key, dec_ticket)
+    krb5_context context;
+    krb5_encrypt_block *eblock;
+    const krb5_keyblock *srv_key;
+    register krb5_ticket *dec_ticket;
 {
     krb5_data *scratch;
     krb5_error_code retval;
@@ -59,7 +60,7 @@ register krb5_ticket *dec_ticket;
     }
 
 #define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); \
-krb5_free_data(scratch); }
+krb5_free_data(context, scratch); }
 
     dec_ticket->enc_part.ciphertext.length =
        krb5_encrypt_size(scratch->length, eblock->crypto_entry);
@@ -86,25 +87,25 @@ dec_ticket->enc_part.ciphertext.length = 0; \
 dec_ticket->enc_part.ciphertext.data = 0;}
 
     /* do any necessary key pre-processing */
-    if (retval = krb5_process_key(eblock, srv_key)) {
+    if (retval = krb5_process_key(context, eblock, srv_key)) {
        goto clean_encpart;
     }
 
-#define cleanup_prockey() {(void) krb5_finish_key(eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(context, eblock);}
 
     /* call the encryption routine */
-    if (retval = krb5_encrypt((krb5_pointer) scratch->data,
+    if (retval = krb5_encrypt(context, (krb5_pointer) scratch->data,
                              (krb5_pointer) dec_ticket->enc_part.ciphertext.data,
                              scratch->length, eblock, 0)) {
        goto clean_prockey;
     }
 
-    dec_ticket->enc_part.etype = krb5_eblock_enctype(eblock);
+    dec_ticket->enc_part.etype = krb5_eblock_enctype(context, eblock);
 
     /* ticket is now assembled-- do some cleanup */
     cleanup_scratch();
 
-    if (retval = krb5_finish_key(eblock)) {
+    if (retval = krb5_finish_key(context, eblock)) {
        cleanup_encpart();
        return retval;
     }
index 4e0487ce0fe2bfd87ba8afc5af9763731e066b1d..e6870d9bb34c9d7cf81aab7ab553e19450f45eb3 100644 (file)
  * < 0 if first is less than 2nd, > 0 if first is greater than 2nd.
  */
 int
-krb5_fulladdr_order(addr1, addr2)
-register const krb5_fulladdr *addr1;
-register const krb5_fulladdr *addr2;
+krb5_fulladdr_order(context, addr1, addr2)
+    krb5_context context;
+    register const krb5_fulladdr *addr1;
+    register const krb5_fulladdr *addr2;
 {
     int dir;
     const int minlen = min(addr1->address->length, addr2->address->length);
index 55888d86539899a803c971fc28dacfdd728213b4..fca10b034a7fc1e6a206117b8d66f7492c7ad094 100644 (file)
 #include <krb5/ext-proto.h>
 
 void
-krb5_free_realm_tree(realms)
-krb5_principal *realms;
+krb5_free_realm_tree(context, realms)
+    krb5_context context;
+    krb5_principal *realms;
 {
     register krb5_principal *nrealms = realms;
     while (*nrealms) {
-       krb5_free_principal(*nrealms);
+       krb5_free_principal(context, *nrealms);
        nrealms++;
     }
     krb5_xfree(realms);
index 639c942779e640b73f8e5e2c4d55bdaf9832b9c4..5b2c0e304844b591418502364037101db588d507 100644 (file)
 #include "int-proto.h"
 
 krb5_error_code
-#if defined(NARROW_PROTOTYPES)
-krb5_get_cred_via_2tgt (krb5_creds * tgt,
-                       const krb5_flags kdcoptions,
-                       const krb5_enctype etype,
-                       const krb5_cksumtype sumtype,
-                       register krb5_creds *cred)
-#else
-krb5_get_cred_via_2tgt (tgt, kdcoptions, etype, sumtype, cred)
-krb5_creds *tgt;
-const krb5_flags kdcoptions;
-const krb5_enctype etype;
-const krb5_cksumtype sumtype;
-register krb5_creds * cred;
-#endif
+krb5_get_cred_via_2tgt (context, tgt, kdcoptions, etype, sumtype, cred)
+    krb5_context context;
+    krb5_creds *tgt;
+    const krb5_flags kdcoptions;
+    const krb5_enctype etype;
+    const krb5_cksumtype sumtype;
+    register krb5_creds * cred;
 {
     krb5_error_code retval;
 #if 0
@@ -58,7 +51,7 @@ register krb5_creds * cred;
 
     /* tgt->client must be equal to cred->client */
     /* tgt->server must be equal to krbtgt/realmof(cred->client) */
-    if (!krb5_principal_compare(tgt->client, cred->client))
+    if (!krb5_principal_compare(context, tgt->client, cred->client))
        return KRB5_PRINC_NOMATCH;
 
     if (!tgt->ticket.length)
@@ -68,21 +61,21 @@ register krb5_creds * cred;
        return(KRB5_NO_2ND_TKT);
 
 #if 0  /* What does this do? */
-    if (retval = krb5_tgtname(krb5_princ_realm(cred->server),
-                             krb5_princ_realm(cred->client), &tempprinc))
+    if (retval = krb5_tgtname(context, krb5_princ_realm(cred->server),
+                             krb5_princ_realm(context, cred->client), &tempprinc))
        return(retval);
 
-    if (!krb5_principal_compare(tempprinc, tgt->server)) {
-       krb5_free_principal(tempprinc);
+    if (!krb5_principal_compare(context, tempprinc, tgt->server)) {
+       krb5_free_principal(context, tempprinc);
        return KRB5_PRINC_NOMATCH;
     }
-    krb5_free_principal(tempprinc);
+    krb5_free_principal(context, tempprinc);
 #endif
 
     if (!(kdcoptions & KDC_OPT_ENC_TKT_IN_SKEY))
        return KRB5_INVALID_FLAGS;
 
-    if (retval = krb5_send_tgs(kdcoptions, &cred->times, etype, sumtype,
+    if (retval = krb5_send_tgs(context, kdcoptions, &cred->times, etype, sumtype,
                               cred->server,
                               tgt->addresses,
                               cred->authdata,
@@ -104,11 +97,11 @@ register krb5_creds * cred;
        }
        retval = err_reply->error + ERROR_TABLE_BASE_krb5;
 
-       krb5_free_error(err_reply);
+       krb5_free_error(context, err_reply);
        free(tgsrep.response.data);
        return retval;
       }
-    retval = krb5_decode_kdc_rep(&tgsrep.response, &tgt->keyblock,
+    retval = krb5_decode_kdc_rep(context, &tgsrep.response, &tgt->keyblock,
                                 etype, &dec_rep);
     free(tgsrep.response.data);
     if (retval)
@@ -121,7 +114,7 @@ register krb5_creds * cred;
     
     /* now it's decrypted and ready for prime time */
 
-    if (!krb5_principal_compare(dec_rep->client, tgt->client)) {
+    if (!krb5_principal_compare(context, dec_rep->client, tgt->client)) {
        retval = KRB5_KDCREP_MODIFIED;
        goto errout;
     }
@@ -132,7 +125,7 @@ register krb5_creds * cred;
     }
     cred->keyblock.magic = KV5M_KEYBLOCK;
     cred->keyblock.etype = dec_rep->ticket->enc_part.etype;
-    if (retval = krb5_copy_keyblock_contents(dec_rep->enc_part2->session,
+    if (retval = krb5_copy_keyblock_contents(context, dec_rep->enc_part2->session,
                                             &cred->keyblock))
        goto errout;
 
@@ -141,19 +134,19 @@ register krb5_creds * cred;
     cred->ticket_flags = dec_rep->enc_part2->flags;
     cred->is_skey = TRUE;
     if (cred->addresses)
-       krb5_free_addresses(cred->addresses);
+       krb5_free_addresses(context, cred->addresses);
     if (dec_rep->enc_part2->caddrs)
-       retval = krb5_copy_addresses(dec_rep->enc_part2->caddrs,
+       retval = krb5_copy_addresses(context, dec_rep->enc_part2->caddrs,
                                     &cred->addresses);
     else
        /* no addresses in the list means we got what we had */
-       retval = krb5_copy_addresses(tgt->addresses, &cred->addresses);
+       retval = krb5_copy_addresses(context, tgt->addresses, &cred->addresses);
     if (retval)
            goto errout;
     
     if (cred->server)
-       krb5_free_principal(cred->server);
-    if (retval = krb5_copy_principal(dec_rep->enc_part2->server,
+       krb5_free_principal(context, cred->server);
+    if (retval = krb5_copy_principal(context, dec_rep->enc_part2->server,
                                     &cred->server))
        goto errout;
 
@@ -171,17 +164,17 @@ errout:
            cred->keyblock.contents = 0;
        }
        if (cred->addresses) {
-           krb5_free_addresses(cred->addresses);
+           krb5_free_addresses(context, cred->addresses);
            cred->addresses = 0;
        }
        if (cred->server) {
-           krb5_free_principal(cred->server);
+           krb5_free_principal(context, cred->server);
            cred->server = 0;
        }
     }
     memset((char *)dec_rep->enc_part2->session->contents, 0,
           dec_rep->enc_part2->session->length);
-    krb5_free_kdc_rep(dec_rep);
+    krb5_free_kdc_rep(context, dec_rep);
     return retval;
 }
 
index fcb04e5dcd950089e220dbdaca66282829c234f8..e18fcfdc36aa552233972d44c899a3b20273a26b 100644 (file)
@@ -65,19 +65,11 @@ extern krb5_cksumtype krb5_kdc_req_sumtype;
 #define TGT_ETYPE \
       krb5_keytype_array[tgt.keyblock.keytype]->system->proto_enctype;
 
-
-#ifdef __STDC__
-krb5_error_code krb5_get_cred_from_kdc(
-  krb5_ccache ccache,
-  krb5_creds  *cred,
-  krb5_creds  ***tgts
-)
-#else
-krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
-  krb5_ccache ccache;
-  krb5_creds  *cred;
-  krb5_creds  ***tgts;
-#endif
+krb5_error_code krb5_get_cred_from_kdc(context, ccache, cred, tgts)
+    krb5_context context;
+    krb5_ccache ccache;
+    krb5_creds  *cred;
+    krb5_creds  ***tgts;
 {
   krb5_creds      **ret_tgts = NULL;
   int             ntgts = 0;
@@ -115,21 +107,21 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
    * (the ticket may be issued by some other intermediate
    *  realm's KDC; so we use KRB5_TC_MATCH_SRV_NAMEONLY)
    */
-  if (retval = krb5_copy_principal(cred->client, &tgtq.client))
+  if (retval = krb5_copy_principal(context, cred->client, &tgtq.client))
       goto cleanup;
 
   /* get target tgt from cache */
-  if (retval = krb5_tgtname(krb5_princ_realm(cred->server),
-                            krb5_princ_realm(cred->client),
+  if (retval = krb5_tgtname(context, krb5_princ_realm(context, cred->server),
+                            krb5_princ_realm(context, cred->client),
                             &int_server)) {
       goto cleanup;
   }
 
-  if (retval = krb5_copy_principal(int_server, &tgtq.server)) {
+  if (retval = krb5_copy_principal(context, int_server, &tgtq.server)) {
       goto cleanup;
   }
 
-  if (retval = krb5_cc_retrieve_cred(ccache,
+  if (retval = krb5_cc_retrieve_cred(context, ccache,
                                      KRB5_TC_MATCH_SRV_NAMEONLY,
                                      &tgtq,
                                      &tgt)) {
@@ -150,22 +142,23 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
      * didn't find it in the cache so it is time to get a local
      * tgt and walk the realms tree.
      */
-    krb5_free_principal(int_server);
+    krb5_free_principal(context, int_server);
     int_server = NULL;
-    if (retval = krb5_tgtname(krb5_princ_realm(cred->client),
-                              krb5_princ_realm(cred->client),
+    if (retval = krb5_tgtname(context, 
+                             krb5_princ_realm(context, cred->client),
+                              krb5_princ_realm(context, cred->client),
                               &int_server)) {
        goto cleanup;
     }
   
-    krb5_free_cred_contents(&tgtq);
+    krb5_free_cred_contents(context, &tgtq);
     memset((char *)&tgtq, 0, sizeof(tgtq));
-    if(retval = krb5_copy_principal(cred->client, &tgtq.client))
+    if(retval = krb5_copy_principal(context, cred->client, &tgtq.client))
        goto cleanup;
-    if(retval = krb5_copy_principal(int_server, &tgtq.server))
+    if(retval = krb5_copy_principal(context, int_server, &tgtq.server))
        goto cleanup;
 
-    if (retval = krb5_cc_retrieve_cred(ccache,
+    if (retval = krb5_cc_retrieve_cred(context, ccache,
                                        KRB5_TC_MATCH_SRV_NAMEONLY,
                                        &tgtq,
                                        &tgt)) {
@@ -174,8 +167,9 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
   
     /* get a list of realms to consult */
   
-    if (retval = krb5_walk_realm_tree(krb5_princ_realm(cred->client),
-                                      krb5_princ_realm(cred->server),
+    if (retval = krb5_walk_realm_tree(context, 
+                                     krb5_princ_realm(context, cred->client),
+                                      krb5_princ_realm(context, cred->server),
                                       &tgs_list, 
                                       KRB5_REALM_BRANCH_CHAR)) {
        goto cleanup;
@@ -211,23 +205,24 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
     
       /* look in cache for a tgt for the destination */
     
-      krb5_free_cred_contents(&tgtq);
+      krb5_free_cred_contents(context, &tgtq);
       memset(&tgtq, 0, sizeof(tgtq));
-      if(retval = krb5_copy_principal(tgt.client, &tgtq.client))
+      if(retval = krb5_copy_principal(context, tgt.client, &tgtq.client))
          goto cleanup;
 
-      krb5_free_principal(int_server);
+      krb5_free_principal(context, int_server);
       int_server = NULL;
-      if (retval = krb5_tgtname(krb5_princ_realm(cred->server),
-                               krb5_princ_realm(*top_server),
+      if (retval = krb5_tgtname(context, 
+                               krb5_princ_realm(context, cred->server),
+                               krb5_princ_realm(context, *top_server),
                                &int_server)) {
          goto cleanup;
       }
     
-      if(retval = krb5_copy_principal(int_server, &tgtq.server))
+      if(retval = krb5_copy_principal(context, int_server, &tgtq.server))
          goto cleanup;
 
-      if (retval = krb5_cc_retrieve_cred(ccache,
+      if (retval = krb5_cc_retrieve_cred(context, ccache,
                                         KRB5_TC_MATCH_SRV_NAMEONLY,
                                         &tgtq,
                                         &tgt)) {
@@ -244,17 +239,17 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
            goto cleanup;
        }
     
-       krb5_free_cred_contents(&tgtq);
+       krb5_free_cred_contents(context, &tgtq);
        memset(&tgtq, 0, sizeof(tgtq));
        tgtq.times        = tgt.times;
-       if (retval = krb5_copy_principal(tgt.client, &tgtq.client))
+       if (retval = krb5_copy_principal(context, tgt.client, &tgtq.client))
            goto cleanup;
-       if(retval = krb5_copy_principal(int_server, &tgtq.server))
+       if(retval = krb5_copy_principal(context, int_server, &tgtq.server))
            goto cleanup;
        tgtq.is_skey      = FALSE;
        tgtq.ticket_flags = tgt.ticket_flags;
        etype             = TGT_ETYPE;
-       if(retval = krb5_get_cred_via_tgt(&tgt,
+       if(retval = krb5_get_cred_via_tgt(context, &tgt,
                                          FLAGS2OPTS(tgtq.ticket_flags),
                                          etype,
                                          krb5_kdc_req_sumtype,
@@ -270,23 +265,24 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
          for (next_server = tgs_list + nservers - 1;
               next_server > top_server;
               next_server--) {
-           krb5_free_cred_contents(&tgtq);
+           krb5_free_cred_contents(context, &tgtq);
            memset(&tgtq, 0, sizeof(tgtq));
-           if (retval = krb5_copy_principal(tgt.client, &tgtq.client))
+           if (retval = krb5_copy_principal(context, tgt.client, &tgtq.client))
                goto cleanup;
 
-           krb5_free_principal(int_server);
+           krb5_free_principal(context, int_server);
            int_server = NULL;
-           if (retval = krb5_tgtname(krb5_princ_realm(*next_server),
-                                     krb5_princ_realm(*top_server),
+           if (retval = krb5_tgtname(context, 
+                                     krb5_princ_realm(context, *next_server),
+                                     krb5_princ_realm(context, *top_server),
                                      &int_server)) {
                goto cleanup;
            }
     
-           if(retval = krb5_copy_principal(int_server, &tgtq.server))
+           if(retval = krb5_copy_principal(context, int_server, &tgtq.server))
                goto cleanup;
 
-           if(retval = krb5_cc_retrieve_cred(ccache,
+           if(retval = krb5_cc_retrieve_cred(context, ccache,
                                              KRB5_TC_MATCH_SRV_NAMEONLY,
                                              &tgtq,
                                              &tgt)) {
@@ -301,17 +297,17 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
                  goto cleanup;
              }
             
-             krb5_free_cred_contents(&tgtq);
+             krb5_free_cred_contents(context, &tgtq);
              memset(&tgtq, 0, sizeof(tgtq));
              tgtq.times        = tgt.times;
-             if (retval = krb5_copy_principal(tgt.client, &tgtq.client))
+             if (retval = krb5_copy_principal(context, tgt.client, &tgtq.client))
                  goto cleanup;
-             if(retval = krb5_copy_principal(int_server, &tgtq.server))
+             if(retval = krb5_copy_principal(context, int_server, &tgtq.server))
                  goto cleanup;
              tgtq.is_skey      = FALSE;
              tgtq.ticket_flags = tgt.ticket_flags;
              etype             = TGT_ETYPE;
-             if (retval = krb5_get_cred_via_tgt(&tgt,
+             if (retval = krb5_get_cred_via_tgt(context, &tgt,
                                                  FLAGS2OPTS(tgtq.ticket_flags),
                                                  etype,
                                                  krb5_kdc_req_sumtype,
@@ -320,7 +316,7 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
              }
              
              /* save tgt in return array */
-             if (retval = krb5_copy_creds(&tgtq, &ret_tgts[ntgts])) {
+             if (retval = krb5_copy_creds(context, &tgtq, &ret_tgts[ntgts])) {
                  goto cleanup;
              }
              
@@ -347,8 +343,8 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
         */
     
        for (next_server = top_server; *next_server; next_server++) {
-            krb5_data *realm_1 = krb5_princ_component(next_server[0], 1);
-            krb5_data *realm_2 = krb5_princ_component(tgtq.server, 1);
+            krb5_data *realm_1 = krb5_princ_component(context, next_server[0], 1);
+            krb5_data *realm_2 = krb5_princ_component(context, tgtq.server, 1);
             if (realm_1->length == realm_2->length &&
                 !memcmp(realm_1->data, realm_2->data, realm_1->length)) {
                break;
@@ -360,7 +356,7 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
            goto cleanup;
        }
 
-       if (retval = krb5_copy_creds(&tgtq, &ret_tgts[ntgts])) {
+       if (retval = krb5_copy_creds(context, &tgtq, &ret_tgts[ntgts])) {
            goto cleanup;
        }
     
@@ -382,7 +378,7 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
 
   etype = TGT_ETYPE;
   if (cred->second_ticket.length) {
-      retval = krb5_get_cred_via_2tgt(&tgt,
+      retval = krb5_get_cred_via_2tgt(context, &tgt,
                                      KDC_OPT_ENC_TKT_IN_SKEY |
                                      FLAGS2OPTS(tgt.ticket_flags),
                                      etype,
@@ -390,7 +386,7 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
                                      cred);
   }
   else {
-      retval = krb5_get_cred_via_tgt(&tgt,
+      retval = krb5_get_cred_via_tgt(context, &tgt,
                                    FLAGS2OPTS(tgt.ticket_flags), 
                                    etype,
                                    krb5_kdc_req_sumtype,
@@ -401,13 +397,13 @@ krb5_error_code krb5_get_cred_from_kdc(ccache, cred, tgts)
 
 cleanup:
 
-  if(tgs_list)  krb5_free_realm_tree(tgs_list);
-  krb5_free_cred_contents(&tgtq); 
-  if (int_server) krb5_free_principal(int_server); 
+  if(tgs_list)  krb5_free_realm_tree(context, tgs_list);
+  krb5_free_cred_contents(context, &tgtq); 
+  if (int_server) krb5_free_principal(context, int_server); 
   if (ntgts == 0) {
       *tgts = NULL;
       if (ret_tgts)  free(ret_tgts);
-      krb5_free_cred_contents(&tgt);
+      krb5_free_cred_contents(context, &tgt);
   }
   return(retval);
 }
index d2c565439f41e468ad2e35060b87bc2a4b7207ac..6aa3a11b8de0d4656e8a4592243cc43e69dcc86a 100644 (file)
 #include "int-proto.h"
 
 krb5_error_code
-krb5_get_cred_via_tgt (DECLARG(krb5_creds *, tgt),
-                      DECLARG(const krb5_flags, kdcoptions),
-                      DECLARG(const krb5_enctype, etype),
-                      DECLARG(const krb5_cksumtype, sumtype),
-                      DECLARG(krb5_creds *, cred))
-OLDDECLARG(krb5_creds *, tgt)
-OLDDECLARG(const krb5_flags, kdcoptions)
-OLDDECLARG(const krb5_enctype, etype)
-OLDDECLARG(const krb5_cksumtype, sumtype)
-OLDDECLARG(krb5_creds *, cred)
+krb5_get_cred_via_tgt (context, tgt, kdcoptions, etype, sumtype, cred)
+    krb5_context context;
+    krb5_creds * tgt;
+    const krb5_flags kdcoptions;
+    const krb5_enctype etype;
+    const krb5_cksumtype sumtype;
+    krb5_creds * cred;
 {
     krb5_error_code retval;
     krb5_principal tempprinc;
@@ -54,7 +51,7 @@ OLDDECLARG(krb5_creds *, cred)
 
     /* tgt->client must be equal to cred->client */
 
-    if (!krb5_principal_compare(tgt->client, cred->client))
+    if (!krb5_principal_compare(context, tgt->client, cred->client))
        return KRB5_PRINC_NOMATCH;
 
     if (!tgt->ticket.length)
@@ -64,17 +61,18 @@ OLDDECLARG(krb5_creds *, cred)
     /* tgt->server must be equal to                      */
     /* krbtgt/realmof(cred->server)@realmof(tgt->server) */
 
-    if(retval = krb5_tgtname(krb5_princ_realm(cred->server),
-                            krb5_princ_realm(tgt->server), &tempprinc))
+    if(retval = krb5_tgtname(context, 
+                    krb5_princ_realm(context, cred->server),
+                    krb5_princ_realm(context, tgt->server), &tempprinc))
        return(retval);
-    if (!krb5_principal_compare(tempprinc, tgt->server)) {
-       krb5_free_principal(tempprinc);
+    if (!krb5_principal_compare(context, tempprinc, tgt->server)) {
+       krb5_free_principal(context, tempprinc);
        return KRB5_PRINC_NOMATCH;
     }
-    krb5_free_principal(tempprinc);
+    krb5_free_principal(context, tempprinc);
 
 
-    if (retval = krb5_send_tgs(kdcoptions, &cred->times, etype, sumtype,
+    if (retval = krb5_send_tgs(context, kdcoptions, &cred->times, etype, sumtype,
                               cred->server,
                               tgt->addresses,
                               cred->authdata,
@@ -104,18 +102,18 @@ OLDDECLARG(krb5_creds *, cred)
        /* XXX need access to the actual assembled request...
           need a change to send_tgs */
        if ((err_reply->ctime != request.ctime) ||
-           !krb5_principal_compare(err_reply->server, request.server) ||
-           !krb5_principal_compare(err_reply->client, request.client))
+           !krb5_principal_compare(context, err_reply->server, request.server) ||
+           !krb5_principal_compare(context, err_reply->client, request.client))
            retval = KRB5_KDCREP_MODIFIED;
        else
 #endif
            retval = err_reply->error + ERROR_TABLE_BASE_krb5;
 
-       krb5_free_error(err_reply);
+       krb5_free_error(context, err_reply);
        cleanup();
        return retval;
     }
-    retval = krb5_decode_kdc_rep(&tgsrep.response,
+    retval = krb5_decode_kdc_rep(context, &tgsrep.response,
                                 &tgt->keyblock,
                                 etype, /* enctype */
                                 &dec_rep);
@@ -126,7 +124,7 @@ OLDDECLARG(krb5_creds *, cred)
 #define cleanup() {\
        memset((char *)dec_rep->enc_part2->session->contents, 0,\
              dec_rep->enc_part2->session->length);\
-                 krb5_free_kdc_rep(dec_rep); }
+                 krb5_free_kdc_rep(context, dec_rep); }
 
     if (dec_rep->msg_type != KRB5_TGS_REP) {
        retval = KRB5KRB_AP_ERR_MSG_TYPE;
@@ -136,7 +134,7 @@ OLDDECLARG(krb5_creds *, cred)
     
     /* now it's decrypted and ready for prime time */
 
-    if (!krb5_principal_compare(dec_rep->client, tgt->client)) {
+    if (!krb5_principal_compare(context, dec_rep->client, tgt->client)) {
        cleanup();
        return KRB5_KDCREP_MODIFIED;
     }
@@ -147,7 +145,7 @@ OLDDECLARG(krb5_creds *, cred)
     }
     cred->keyblock.magic = KV5M_KEYBLOCK;
     cred->keyblock.etype = dec_rep->ticket->enc_part.etype;
-    if (retval = krb5_copy_keyblock_contents(dec_rep->enc_part2->session,
+    if (retval = krb5_copy_keyblock_contents(context, dec_rep->enc_part2->session,
                                             &cred->keyblock)) {
        cleanup();
        return retval;
@@ -158,19 +156,19 @@ OLDDECLARG(krb5_creds *, cred)
 #undef cleanup
 #define cleanup() {\
        memset((char *)cred->keyblock.contents, 0, cred->keyblock.length);\
-                 krb5_free_kdc_rep(dec_rep); }
+                 krb5_free_kdc_rep(context, dec_rep); }
 
     cred->times = dec_rep->enc_part2->times;
 
 #if 0
     /* XXX probably need access to the request */
     /* check the contents for sanity: */
-    if (!krb5_principal_compare(dec_rep->client, request.client)
-       || !krb5_principal_compare(dec_rep->enc_part2->server, request.server)
-       || !krb5_principal_compare(dec_rep->ticket->server, request.server)
+    if (!krb5_principal_compare(context, dec_rep->client, request.client)
+       || !krb5_principal_compare(context, dec_rep->enc_part2->server, request.server)
+       || !krb5_principal_compare(context, dec_rep->ticket->server, request.server)
        || (request.nonce != dec_rep->enc_part2->nonce)
        /* XXX check for extraneous flags */
-       /* XXX || (!krb5_addresses_compare(addrs, dec_rep->enc_part2->caddrs)) */
+       /* XXX || (!krb5_addresses_compare(context, addrs, dec_rep->enc_part2->caddrs)) */
        || ((request.from != 0) &&
            (request.from != dec_rep->enc_part2->times.starttime))
        || ((request.till != 0) &&
@@ -199,17 +197,17 @@ OLDDECLARG(krb5_creds *, cred)
     cred->ticket_flags = dec_rep->enc_part2->flags;
     cred->is_skey = FALSE;
     if (cred->addresses) {
-       krb5_free_addresses(cred->addresses);
+       krb5_free_addresses(context, cred->addresses);
     }
     if (dec_rep->enc_part2->caddrs) {
-       if (retval = krb5_copy_addresses(dec_rep->enc_part2->caddrs,
+       if (retval = krb5_copy_addresses(context, dec_rep->enc_part2->caddrs,
                                         &cred->addresses)) {
            cleanup();
            return retval;
        }
     } else {
        /* no addresses in the list means we got what we had */
-       if (retval = krb5_copy_addresses(tgt->addresses,
+       if (retval = krb5_copy_addresses(context, tgt->addresses,
                                         &cred->addresses)) {
            cleanup();
            return retval;
@@ -219,8 +217,8 @@ OLDDECLARG(krb5_creds *, cred)
      * Free cred->server before overwriting it.
      */
     if (cred->server)
-       krb5_free_principal(cred->server);
-    if (retval = krb5_copy_principal(dec_rep->enc_part2->server,
+       krb5_free_principal(context, cred->server);
+    if (retval = krb5_copy_principal(context, dec_rep->enc_part2->server,
                                     &cred->server)) {
        cleanup();
        return retval;
@@ -228,13 +226,13 @@ OLDDECLARG(krb5_creds *, cred)
 
     if (retval = encode_krb5_ticket(dec_rep->ticket, &scratch)) {
        cleanup();
-       krb5_free_addresses(cred->addresses);
+       krb5_free_addresses(context, cred->addresses);
        return retval;
     }
 
     cred->ticket = *scratch;
     krb5_xfree(scratch);
 
-    krb5_free_kdc_rep(dec_rep);
+    krb5_free_kdc_rep(context, dec_rep);
     return retval;
 }
index 96d8c3f88225f4163de2559f103ffbe103b9c1f3..f5ead423acc28120c6425b7bba0437e0fccc9716 100644 (file)
 #endif
 
 krb5_error_code
-krb5_generate_seq_number(key, seqno)
-const krb5_keyblock *key;
-krb5_int32 *seqno;
+krb5_generate_seq_number(context, key, seqno)
+    krb5_context context;
+    const krb5_keyblock *key;
+    krb5_int32 *seqno;
 {
     krb5_pointer random_state;
     krb5_encrypt_block eblock;
@@ -54,18 +55,18 @@ krb5_int32 *seqno;
     if (!valid_keytype(key->keytype))
        return KRB5_PROG_KEYTYPE_NOSUPP;
 
-    krb5_use_keytype(&eblock, key->keytype);
+    krb5_use_keytype(context, &eblock, key->keytype);
 
-    if (retval = krb5_init_random_key(&eblock, key, &random_state))
+    if (retval = krb5_init_random_key(context, &eblock, key, &random_state))
        return(retval);
        
-    if (retval = krb5_random_key(&eblock, random_state, &subkey)) {
-       (void) krb5_finish_random_key(&eblock, &random_state);
+    if (retval = krb5_random_key(context, &eblock, random_state, &subkey)) {
+       (void) krb5_finish_random_key(context, &eblock, &random_state);
        return retval;
     }  
     /* ignore the error if any, since we've already gotten the key out */
-    if (retval = krb5_finish_random_key(&eblock, &random_state)) {
-       krb5_free_keyblock(subkey);
+    if (retval = krb5_finish_random_key(context, &eblock, &random_state)) {
+       krb5_free_keyblock(context, subkey);
        return retval;
     }
 
@@ -80,19 +81,19 @@ krb5_int32 *seqno;
            retval = ENOMEM;
            goto cleanup;
     }
-    if (retval = krb5_process_key(&eblock, subkey)) {
+    if (retval = krb5_process_key(context, &eblock, subkey)) {
        goto cleanup;
     }
 
-    if (retval = krb5_us_timeofday(&timenow.seconds,
+    if (retval = krb5_us_timeofday(context, &timenow.seconds,
                                   &timenow.microseconds)) {
        goto cleanup;
     }
     memcpy((char *)intmp, (char *)&timenow, sizeof(timenow));
 
-    retval = krb5_encrypt((krb5_pointer)intmp, (krb5_pointer)outtmp,
+    retval = krb5_encrypt(context, (krb5_pointer)intmp, (krb5_pointer)outtmp,
                          sizeof(timenow), &eblock, 0);
-    (void) krb5_finish_key(&eblock);
+    (void) krb5_finish_key(context, &eblock);
     if (retval)
            goto cleanup;
 
@@ -100,7 +101,7 @@ krb5_int32 *seqno;
     
 cleanup:
     if (subkey)
-           krb5_free_keyblock(subkey);
+           krb5_free_keyblock(context, subkey);
     if (intmp)
            krb5_xfree(intmp);
     if (outtmp)
index e1178abca6bcdc239d84c5761ecb1ef64cd2958a..68425b2c98e5ec37a2a6ab062852581e217dff10 100644 (file)
 #include <krb5/ext-proto.h>
 
 krb5_error_code
-krb5_generate_subkey(key, subkey)
-const krb5_keyblock *key;
-krb5_keyblock **subkey;
+krb5_generate_subkey(context, key, subkey)
+    krb5_context context;
+    const krb5_keyblock *key;
+    krb5_keyblock **subkey;
 {
     krb5_pointer random_state;
     krb5_encrypt_block eblock;
@@ -40,23 +41,23 @@ krb5_keyblock **subkey;
     if (!valid_keytype(key->keytype))
        return KRB5_PROG_KEYTYPE_NOSUPP;
 
-    krb5_use_keytype(&eblock, key->keytype);
+    krb5_use_keytype(context, &eblock, key->keytype);
 
-    if (retval = krb5_init_random_key(&eblock, key, &random_state))
+    if (retval = krb5_init_random_key(context, &eblock, key, &random_state))
        return(retval);
     *subkey = (krb5_keyblock *)malloc(sizeof(**subkey));
     if (!*subkey) {
-       (void) krb5_finish_random_key(&eblock, &random_state);
+       (void) krb5_finish_random_key(context, &eblock, &random_state);
        return ENOMEM;
     }
        
-    if (retval = krb5_random_key(&eblock, random_state, subkey)) {
-       (void) krb5_finish_random_key(&eblock, &random_state);
+    if (retval = krb5_random_key(context, &eblock, random_state, subkey)) {
+       (void) krb5_finish_random_key(context, &eblock, &random_state);
        krb5_xfree(*subkey);
        return retval;
     }  
     /* ignore the error if any, since we've already gotten the key out */
-    (void) krb5_finish_random_key(&eblock, &random_state);
+    (void) krb5_finish_random_key(context, &eblock, &random_state);
     return 0;
 }
 
index 0bcdbaeaccd055a4bad351b3082ffbc5d571735d..21f043e15285c069721af60991ce998b79c5f010 100644 (file)
 #include <krb5/ext-proto.h>
 
 krb5_error_code
-krb5_get_credentials(options, ccache, creds)
-const krb5_flags options;
-krb5_ccache ccache;
-krb5_creds *creds;
+krb5_get_credentials(context, options, ccache, creds)
+    krb5_context context;
+    const krb5_flags options;
+    krb5_ccache ccache;
+    krb5_creds *creds;
 {
     krb5_error_code retval, rv2;
     krb5_creds **tgts;
@@ -77,27 +78,27 @@ krb5_creds *creds;
            return KRB5_NO_2ND_TKT;
     }
 
-    retval = krb5_cc_retrieve_cred(ccache, fields, &mcreds, &ncreds);
+    retval = krb5_cc_retrieve_cred(context, ccache, fields, &mcreds, &ncreds);
     if (retval == 0) {
-           krb5_free_cred_contents(creds);
+           krb5_free_cred_contents(context, creds);
            *creds = ncreds;
     }
     if (retval != KRB5_CC_NOTFOUND || options & KRB5_GC_CACHED)
        return retval;
 
-    retval = krb5_get_cred_from_kdc(ccache, creds, &tgts);
+    retval = krb5_get_cred_from_kdc(context, ccache, creds, &tgts);
     if (tgts) {
        register int i = 0;
        while (tgts[i]) {
-           if (rv2 = krb5_cc_store_cred(ccache, tgts[i])) {
+           if (rv2 = krb5_cc_store_cred(context, ccache, tgts[i])) {
                retval = rv2;
                break;
            }
            i++;
        }
-       krb5_free_tgt_creds(tgts);
+       krb5_free_tgt_creds(context, tgts);
     }
     if (!retval)
-       retval = krb5_cc_store_cred(ccache, creds);
+       retval = krb5_cc_store_cred(context, ccache, creds);
     return retval;
 }
index b6cd2d820412f0537afe728fcc4be7c68355f8e2..a520e5aff424cf0485c265418b7e3d1e77171ef5 100644 (file)
@@ -46,7 +46,8 @@
 
 /* Get a TGT for use at the remote host */
 krb5_error_code
-krb5_get_for_creds(etype, sumtype, rhost, client, enc_key, forwardable, outbuf)
+krb5_get_for_creds(context, etype, sumtype, rhost, client, enc_key, forwardable, outbuf)
+    krb5_context context;
      const krb5_enctype etype;
      const krb5_cksumtype sumtype;
      char *rhost;
@@ -83,7 +84,7 @@ krb5_get_for_creds(etype, sumtype, rhost, client, enc_key, forwardable, outbuf)
     }  
     strcpy(remote_host, hp->h_name);
 
-    if (retval = krb5_get_host_realm(remote_host, &hrealms))
+    if (retval = krb5_get_host_realm(context, remote_host, &hrealms))
        goto errout;
     if (!hrealms[0]) {
        retval = KRB5_ERR_HOST_REALM_UNKNOWN;
@@ -118,10 +119,10 @@ krb5_get_for_creds(etype, sumtype, rhost, client, enc_key, forwardable, outbuf)
     }
     addrs[i] = 0;
 
-    if (retval = krb5_copy_principal(client, &creds.client))
+    if (retval = krb5_copy_principal(context, client, &creds.client))
        goto errout;
     
-    if (retval = krb5_build_principal_ext(&creds.server,
+    if (retval = krb5_build_principal_ext(context, &creds.server,
                                          strlen(hrealms[0]),
                                          hrealms[0],
                                          KRB5_TGS_NAME_SIZE,
@@ -132,26 +133,26 @@ krb5_get_for_creds(etype, sumtype, rhost, client, enc_key, forwardable, outbuf)
        goto errout;
        
     creds.times.starttime = 0;
-    if (retval = krb5_timeofday(&now))
+    if (retval = krb5_timeofday(context, &now))
        goto errout;
 
     creds.times.endtime = now + KRB5_DEFAULT_LIFE;
     creds.times.renew_till = 0;
     
-    if (retval = krb5_cc_default(&cc))
+    if (retval = krb5_cc_default(context, &cc))
        goto errout;
 
     /* fetch tgt directly from cache */
-    retval = krb5_cc_retrieve_cred (cc,
+    retval = krb5_cc_retrieve_cred (context, cc,
                                    KRB5_TC_MATCH_SRV_NAMEONLY,
                                    &creds,
                                    &tgt);
-    krb5_cc_close(cc);
+    krb5_cc_close(context, cc);
     if (retval)
        goto errout;
 
     /* tgt->client must be equal to creds.client */
-    if (!krb5_principal_compare(tgt.client, creds.client)) {
+    if (!krb5_principal_compare(context, tgt.client, creds.client)) {
        retval = KRB5_PRINC_NOMATCH;
        goto errout;
     }
@@ -166,7 +167,7 @@ krb5_get_for_creds(etype, sumtype, rhost, client, enc_key, forwardable, outbuf)
     if (!forwardable) /* Reset KDC_OPT_FORWARDABLE */
       kdcoptions &= ~(KDC_OPT_FORWARDABLE);
 
-    if (retval = krb5_send_tgs(kdcoptions, &creds.times, etype, sumtype,
+    if (retval = krb5_send_tgs(context, kdcoptions, &creds.times, etype, sumtype,
                               tgt.server,
                               addrs,
                               creds.authdata,
@@ -190,11 +191,11 @@ krb5_get_for_creds(etype, sumtype, rhost, client, enc_key, forwardable, outbuf)
 
        retval = err_reply->error + ERROR_TABLE_BASE_krb5;
 
-       krb5_free_error(err_reply);
+       krb5_free_error(context, err_reply);
        goto errout;
     }
     
-    if (retval = krb5_decode_kdc_rep(&tgsrep.response,
+    if (retval = krb5_decode_kdc_rep(context, &tgsrep.response,
                                     &tgt.keyblock,
                                     etype, /* enctype */
                                     &dec_rep))
@@ -207,12 +208,12 @@ krb5_get_for_creds(etype, sumtype, rhost, client, enc_key, forwardable, outbuf)
     
     /* now it's decrypted and ready for prime time */
 
-    if (!krb5_principal_compare(dec_rep->client, tgt.client)) {
+    if (!krb5_principal_compare(context, dec_rep->client, tgt.client)) {
        retval = KRB5_KDCREP_MODIFIED;
        goto errout;
     }
 
-    retval = krb5_mk_cred(dec_rep, etype, enc_key, 0, 0, outbuf);
+    retval = krb5_mk_cred(context, dec_rep, etype, enc_key, 0, 0, outbuf);
     
 errout:
     if (remote_host)
@@ -220,12 +221,12 @@ errout:
     if (hrealms)
        krb5_xfree(hrealms);
     if (addrs)
-       krb5_free_addresses(addrs);
-    krb5_free_cred_contents(&creds);
+       krb5_free_addresses(context, addrs);
+    krb5_free_cred_contents(context, &creds);
     if (tgsrep.response.data)
        free(tgsrep.response.data);
     if (dec_rep)
-       krb5_free_kdc_rep(dec_rep); 
+       krb5_free_kdc_rep(context, dec_rep); 
     return retval;
 }
 
index 90e200c76491599149bac0f7370e2924a062eca0..2cb128c8b5954fa114d70e739cd046fb9be7514b 100644 (file)
@@ -67,40 +67,34 @@ extern krb5_deltat krb5_clockskew;
 
 /* widen this prototype if need be */
 #include <krb5/widen.h>
-typedef krb5_error_code (*git_key_proc) PROTOTYPE((const krb5_keytype,
+typedef krb5_error_code (*git_key_proc) PROTOTYPE((krb5_context,
+                                                  const krb5_keytype,
                                                   krb5_keyblock **,
                                                   krb5_const_pointer,
                                                   krb5_pa_data **));
 #include <krb5/narrow.h>
 
-typedef krb5_error_code (*git_decrypt_proc) PROTOTYPE((const krb5_keyblock *,
+typedef krb5_error_code (*git_decrypt_proc) PROTOTYPE((krb5_context,
+                                                      const krb5_keyblock *,
                                                       krb5_const_pointer,
                                                       krb5_kdc_rep * ));
 krb5_error_code
-krb5_get_in_tkt(DECLARG(const krb5_flags, options),
-               DECLARG(krb5_address * const *, addrs),
-               DECLARG(const krb5_preauthtype, pre_auth_type),
-               DECLARG(const krb5_enctype, etype),
-               DECLARG(const krb5_keytype, keytype),
-               DECLARG(git_key_proc, key_proc),
-               DECLARG(krb5_const_pointer, keyseed),
-               DECLARG(git_decrypt_proc, decrypt_proc),
-               DECLARG(krb5_const_pointer, decryptarg),
-               DECLARG(krb5_creds *, creds),
-               DECLARG(krb5_ccache, ccache),
-               DECLARG(krb5_kdc_rep **, ret_as_reply))
-OLDDECLARG(const krb5_flags, options)
-OLDDECLARG(krb5_address * const *, addrs)
-OLDDECLARG(const krb5_preauthtype, pre_auth_type)
-OLDDECLARG(const krb5_enctype, etype)
-OLDDECLARG(const krb5_keytype, keytype)
-OLDDECLARG(git_key_proc, key_proc)
-OLDDECLARG(krb5_const_pointer, keyseed)
-OLDDECLARG(git_decrypt_proc, decrypt_proc)
-OLDDECLARG(krb5_const_pointer, decryptarg)
-OLDDECLARG(krb5_creds *, creds)
-OLDDECLARG(krb5_ccache, ccache)
-OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
+krb5_get_in_tkt(context, options, addrs, pre_auth_type, etype, keytype,
+               key_proc, keyseed, decrypt_proc, decryptarg, creds,
+               ccache, ret_as_reply)
+    krb5_context context;
+    const krb5_flags options;
+    krb5_address * const * addrs;
+    const krb5_preauthtype pre_auth_type;
+    const krb5_enctype etype;
+    const krb5_keytype keytype;
+    git_key_proc key_proc;
+    krb5_const_pointer keyseed;
+    git_decrypt_proc decrypt_proc;
+    krb5_const_pointer decryptarg;
+    krb5_creds * creds;
+    krb5_ccache ccache;
+    krb5_kdc_rep ** ret_as_reply;
 {
     krb5_kdc_req request;
     krb5_kdc_rep *as_reply = 0;
@@ -113,7 +107,7 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
     krb5_timestamp time_now;
     krb5_pa_data       *padata;
 
-    if (! krb5_realm_compare(creds->client, creds->server))
+    if (! krb5_realm_compare(context, creds->client, creds->server))
        return KRB5_IN_TKT_REALM_MISMATCH;
 
     if (ret_as_reply)
@@ -142,7 +136,7 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
             * default.  But if we're changing salts, because of a
             * realm renaming, or some such, this won't work.
             */
-           retval = (*key_proc)(keytype, &decrypt_key, keyseed, 0);
+           retval = (*key_proc)(context, keytype, &decrypt_key, keyseed, 0);
            if (retval)
                    return retval;
            request.padata = (krb5_pa_data **) malloc(sizeof(krb5_pa_data *)
@@ -152,7 +146,7 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
                goto cleanup;
            }
            
-           retval = krb5_obtain_padata(pre_auth_type, creds->client,
+           retval = krb5_obtain_padata(context, pre_auth_type, creds->client,
                                        request.addresses, decrypt_key,
                                        &padata);
            if (retval)
@@ -168,7 +162,7 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
     request.from = creds->times.starttime;
     request.till = creds->times.endtime;
     request.rtime = creds->times.renew_till;
-    if (retval = krb5_timeofday(&time_now))
+    if (retval = krb5_timeofday(context, &time_now))
        goto cleanup;
 
     /* XXX we know they are the same size... */
@@ -186,8 +180,9 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
     if (retval = encode_krb5_as_req(&request, &packet))
        goto cleanup;
 
-    retval = krb5_sendto_kdc(packet, krb5_princ_realm(creds->client), &reply);
-    krb5_free_data(packet);
+    retval = krb5_sendto_kdc(context, packet, 
+                            krb5_princ_realm(context, creds->client), &reply);
+    krb5_free_data(context, packet);
     if (retval)
        goto cleanup;
 
@@ -201,15 +196,15 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
        /* it was an error */
 
        if ((err_reply->ctime != request.nonce) ||
-           !krb5_principal_compare(err_reply->server, request.server) ||
-           !krb5_principal_compare(err_reply->client, request.client))
+           !krb5_principal_compare(context, err_reply->server, request.server) ||
+           !krb5_principal_compare(context, err_reply->client, request.client))
            retval = KRB5_KDCREP_MODIFIED;
        else
            retval = err_reply->error + ERROR_TABLE_BASE_krb5;
 
        /* XXX somehow make error msg text available to application? */
 
-       krb5_free_error(err_reply);
+       krb5_free_error(context, err_reply);
        goto cleanup;
     }
 
@@ -230,27 +225,27 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
 
      /* Generate the key, if we haven't done so already. */
     if (!decrypt_key) {
-           if (retval = (*key_proc)(keytype, &decrypt_key, keyseed,
+           if (retval = (*key_proc)(context, keytype, &decrypt_key, keyseed,
                                     as_reply->padata))
                goto cleanup;
     }
     
-    if (retval = (*decrypt_proc)(decrypt_key, decryptarg, as_reply))
+    if (retval = (*decrypt_proc)(context, decrypt_key, decryptarg, as_reply))
        goto cleanup;
 
-    krb5_free_keyblock(decrypt_key);
+    krb5_free_keyblock(context, decrypt_key);
     decrypt_key = 0;
     
     /* check the contents for sanity: */
     if (!as_reply->enc_part2->times.starttime)
        as_reply->enc_part2->times.starttime =
            as_reply->enc_part2->times.authtime;
-    if (!krb5_principal_compare(as_reply->client, request.client)
-       || !krb5_principal_compare(as_reply->enc_part2->server, request.server)
-       || !krb5_principal_compare(as_reply->ticket->server, request.server)
+    if (!krb5_principal_compare(context, as_reply->client, request.client)
+       || !krb5_principal_compare(context, as_reply->enc_part2->server, request.server)
+       || !krb5_principal_compare(context, as_reply->ticket->server, request.server)
        || (request.nonce != as_reply->enc_part2->nonce)
        /* XXX check for extraneous flags */
-       /* XXX || (!krb5_addresses_compare(addrs, as_reply->enc_part2->caddrs)) */
+       /* XXX || (!krb5_addresses_compare(context, addrs, as_reply->enc_part2->caddrs)) */
        || ((request.from != 0) &&
            (request.from != as_reply->enc_part2->times.starttime))
        || ((request.till != 0) &&
@@ -276,7 +271,8 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
     /* XXX issue warning if as_reply->enc_part2->key_exp is nearby */
        
     /* fill in the credentials */
-    if (retval = krb5_copy_keyblock_contents(as_reply->enc_part2->session,
+    if (retval = krb5_copy_keyblock_contents(context, 
+                                            as_reply->enc_part2->session,
                                             &creds->keyblock))
        goto cleanup;
     creds->keyblock.etype = as_reply->ticket->enc_part.etype;
@@ -285,7 +281,7 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
     creds->is_skey = FALSE;            /* this is an AS_REQ, so cannot
                                           be encrypted in skey */
     creds->ticket_flags = as_reply->enc_part2->flags;
-    if (retval = krb5_copy_addresses(as_reply->enc_part2->caddrs,
+    if (retval = krb5_copy_addresses(context, as_reply->enc_part2->caddrs,
                                     &creds->addresses))
        goto cred_cleanup;
 
@@ -299,7 +295,7 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
     krb5_xfree(packet);
 
     /* store it in the ccache! */
-    if (retval = krb5_cc_store_cred(ccache, creds))
+    if (retval = krb5_cc_store_cred(context, ccache, creds))
        goto cred_cleanup;
 
     if (ret_as_reply) {
@@ -311,15 +307,15 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
     
 cleanup:
     if (as_reply)
-       krb5_free_kdc_rep(as_reply);
+       krb5_free_kdc_rep(context, as_reply);
     if (reply.data)
        free(reply.data);
     if (decrypt_key)
-       krb5_free_keyblock(decrypt_key);
+       krb5_free_keyblock(context, decrypt_key);
     if (request.padata)
        free(request.padata);
     if (!addrs)
-       krb5_free_addresses(request.addresses);
+       krb5_free_addresses(context, request.addresses);
     return retval;
     
     /*
@@ -338,7 +334,7 @@ cred_cleanup:
        creds->ticket.data = 0;
     }
     if (creds->addresses) {
-       krb5_free_addresses(creds->addresses);
+       krb5_free_addresses(context, creds->addresses);
        creds->addresses = 0;
     }
     goto cleanup;
index 6d636d5c64e74532f6837f07f2d73493027b3c5e..2258f89ce1547059a6aa374d526afb4158780121 100644 (file)
@@ -42,14 +42,12 @@ extern char *krb5_default_pwd_prompt1;
 
 #include <krb5/widen.h>
 static krb5_error_code
-pwd_keyproc(DECLARG(const krb5_keytype, type),
-           DECLARG(krb5_keyblock **, key),
-            DECLARG(krb5_const_pointer, keyseed),
-            DECLARG(krb5_pa_data **,padata))
-OLDDECLARG(const krb5_keytype, type)
-OLDDECLARG(krb5_keyblock **, key)
-OLDDECLARG(krb5_const_pointer, keyseed)
-OLDDECLARG(krb5_pa_data **,padata)
+pwd_keyproc(context, type, key, keyseed, padata)
+    krb5_context context;
+    const krb5_keytype type;
+    krb5_keyblock ** key;
+    krb5_const_pointer keyseed;
+    krb5_pa_data ** padata;
 #include <krb5/narrow.h>
 {
     krb5_data salt;
@@ -64,7 +62,7 @@ OLDDECLARG(krb5_pa_data **,padata)
     if (!valid_keytype(type))
        return KRB5_PROG_KEYTYPE_NOSUPP;
 
-    krb5_use_keytype(&eblock, type);
+    krb5_use_keytype(context, &eblock, type);
     
     if (padata) {
         krb5_pa_data **ptr;
@@ -84,13 +82,13 @@ OLDDECLARG(krb5_pa_data **,padata)
     arg = (const struct pwd_keyproc_arg *)keyseed;
     if (!use_salt) {
        /* need to use flattened principal */
-       if (retval = krb5_principal2salt(arg->who, &salt))
+       if (retval = krb5_principal2salt(context, arg->who, &salt))
            return(retval);
        f_salt = 1;
     }
 
     if (!arg->password.length) {
-       if (retval = krb5_read_password(krb5_default_pwd_prompt1,
+       if (retval = krb5_read_password(context, krb5_default_pwd_prompt1,
                                        0,
                                        pwdbuf, &pwsize)) {
            if (f_salt) krb5_xfree(salt.data);
@@ -106,7 +104,7 @@ OLDDECLARG(krb5_pa_data **,padata)
        if (f_salt) krb5_xfree(salt.data);
        return ENOMEM;
     }
-    retval = krb5_string_to_key(&eblock, type, *key, &arg->password, &salt);
+    retval = krb5_string_to_key(context, &eblock, type, *key, &arg->password, &salt);
     if (retval) {
        krb5_xfree(*key);
        if (f_salt) krb5_xfree(salt.data);
@@ -137,24 +135,18 @@ OLDDECLARG(krb5_pa_data **,padata)
  returns system errors, encryption errors
  */
 krb5_error_code
-krb5_get_in_tkt_with_password(DECLARG(const krb5_flags, options),
-                             DECLARG(krb5_address * const *, addrs),
-                             DECLARG(const krb5_preauthtype, pre_auth_type),
-                             DECLARG(const krb5_enctype, etype),
-                             DECLARG(const krb5_keytype, keytype),
-                             DECLARG(const char *, password),
-                             DECLARG(krb5_ccache, ccache),
-                             DECLARG(krb5_creds *, creds), 
-                             DECLARG(krb5_kdc_rep **, ret_as_reply))
-OLDDECLARG(const krb5_flags, options)
-OLDDECLARG(krb5_address * const *, addrs)
-OLDDECLARG(const krb5_preauthtype, pre_auth_type)
-OLDDECLARG(const krb5_enctype, etype)
-OLDDECLARG(const krb5_keytype, keytype)
-OLDDECLARG(const char *, password)
-OLDDECLARG(krb5_ccache, ccache)
-OLDDECLARG(krb5_creds *, creds)
-OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
+krb5_get_in_tkt_with_password(context, options, addrs, pre_auth_type, etype,
+                             keytype, password, ccache, creds, ret_as_reply)
+    krb5_context context;
+    const krb5_flags options;
+    krb5_address * const * addrs;
+    const krb5_preauthtype pre_auth_type;
+    const krb5_enctype etype;
+    const krb5_keytype keytype;
+    const char * password;
+    krb5_ccache ccache;
+    krb5_creds * creds;
+    krb5_kdc_rep ** ret_as_reply;
 {
     krb5_error_code retval;
     struct pwd_keyproc_arg keyseed;
@@ -167,7 +159,7 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
        keyseed.password.length = 0;
     keyseed.who = creds->client;
 
-    retval = krb5_get_in_tkt(options, addrs, pre_auth_type, etype,
+    retval = krb5_get_in_tkt(context, options, addrs, pre_auth_type, etype,
                             keytype, pwd_keyproc, (krb5_pointer) &keyseed,
                             krb5_kdc_rep_decrypt_proc, 0,
                             creds, ccache, ret_as_reply);
index daae3774edb8151283f07b9c4b8b17543039756d..26b194723b61853da2734871c738d9374f049371 100644 (file)
@@ -42,14 +42,12 @@ struct skey_keyproc_arg {
  */
 #include <krb5/widen.h>
 static krb5_error_code
-skey_keyproc(DECLARG(const krb5_keytype, type),
-            DECLARG(krb5_keyblock **, key),
-            DECLARG(krb5_const_pointer, keyseed),
-            DECLARG(krb5_pa_data **, padata))
-OLDDECLARG(const krb5_keytype, type)
-OLDDECLARG(krb5_keyblock **, key)
-OLDDECLARG(krb5_const_pointer, keyseed)
-OLDDECLARG(krb5_pa_data **,padata)
+skey_keyproc(context, type, key, keyseed, padata)
+    krb5_context context;
+    const krb5_keytype type;
+    krb5_keyblock ** key;
+    krb5_const_pointer keyseed;
+    krb5_pa_data ** padata;
 #include <krb5/narrow.h>
 {
     krb5_keyblock *realkey;
@@ -66,26 +64,26 @@ OLDDECLARG(krb5_pa_data **,padata)
     if (arg->client) {
        /* do keytab stuff */
        /* else we need to fetch from system key place */
-       if (retval = krb5_kt_default(&kt_id))
+       if (retval = krb5_kt_default(context, &kt_id))
            return retval;
-       if (retval = krb5_kt_get_entry(kt_id, arg->client,
+       if (retval = krb5_kt_get_entry(context, kt_id, arg->client,
                                       0, /* don't have vno available */
                                       &kt_ent))
            return retval;
     }
-#define cleanup() {if (arg->client) (void) krb5_kt_free_entry(&kt_ent);}
+#define cleanup() {if (arg->client) (void) krb5_kt_free_entry(context, &kt_ent);}
 
     if (arg->key)
-       retval = krb5_copy_keyblock(arg->key, &realkey);
+       retval = krb5_copy_keyblock(context, arg->key, &realkey);
     else
-       retval = krb5_copy_keyblock(&kt_ent.key, &realkey);
+       retval = krb5_copy_keyblock(context, &kt_ent.key, &realkey);
     if (retval) {
        cleanup();
        return retval;
     }
        
     if (realkey->keytype != type) {
-       krb5_free_keyblock(realkey);
+       krb5_free_keyblock(context, realkey);
        cleanup();
        return KRB5_PROG_ETYPE_NOSUPP;
     }  
@@ -118,22 +116,17 @@ OLDDECLARG(krb5_pa_data **,padata)
 
  */
 krb5_error_code
-krb5_get_in_tkt_with_skey(DECLARG(const krb5_flags, options),
-                         DECLARG(krb5_address * const *, addrs),
-                         DECLARG(const krb5_preauthtype, pre_auth_type),
-                         DECLARG(const krb5_enctype, etype),
-                         DECLARG(const krb5_keyblock *,key),
-                         DECLARG(krb5_ccache, ccache),
-                         DECLARG(krb5_creds *,creds),
-                         DECLARG(krb5_kdc_rep **, ret_as_reply))
-OLDDECLARG(const krb5_flags, options)
-OLDDECLARG(krb5_address * const *, addrs)
-OLDDECLARG(const krb5_preauthtype, pre_auth_type)
-OLDDECLARG(const krb5_enctype, etype)
-OLDDECLARG(const krb5_keyblock *,key)
-OLDDECLARG(krb5_ccache, ccache)
-OLDDECLARG(krb5_creds *, creds)
-OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
+krb5_get_in_tkt_with_skey(context, options, addrs, pre_auth_type, etype,
+                         key, ccache, creds, ret_as_reply)
+    krb5_context context;
+    const krb5_flags options;
+    krb5_address * const * addrs;
+    const krb5_preauthtype pre_auth_type;
+    const krb5_enctype  etype;
+    const krb5_keyblock * key;
+    krb5_ccache ccache;
+    krb5_creds * creds;
+    krb5_kdc_rep ** ret_as_reply;
 
 {
     struct skey_keyproc_arg arg;
@@ -151,8 +144,8 @@ OLDDECLARG(krb5_kdc_rep **, ret_as_reply)
 
        keytype = krb5_csarray[etype]->system->proto_keytype;
     }
-    return (krb5_get_in_tkt(options, addrs, pre_auth_type, etype, keytype,
-                           skey_keyproc, (krb5_pointer) &arg,
+    return (krb5_get_in_tkt(context, options, addrs, pre_auth_type, etype, 
+                           keytype, skey_keyproc, (krb5_pointer) &arg,
                            krb5_kdc_rep_decrypt_proc, 0, creds,
                            ccache, ret_as_reply));
 }
index d05fc239cc5e6d93d4383a0c0626900a9583b098..9a264a3df45199c1b4a0711387a53267570b1684 100644 (file)
 #include <krb5/widen.h>
 
 krb5_error_code krb5_tgtname
-    PROTOTYPE((const krb5_data *,
+    PROTOTYPE((krb5_context context,
+              const krb5_data *,
               const krb5_data *,
               krb5_principal *));
 krb5_error_code krb5_get_cred_via_tgt
-    PROTOTYPE((krb5_creds *,
+    PROTOTYPE((krb5_context context,
+              krb5_creds *,
               const krb5_flags,
               const krb5_enctype,
               const krb5_cksumtype,
index ed2209249baf9080d422433d498f01f843267f54..569e08821b03073d23b1c535857f926453286881 100644 (file)
 
 /*ARGSUSED*/
 krb5_error_code
-krb5_kdc_rep_decrypt_proc(DECLARG(const krb5_keyblock *, key),
-                         DECLARG(krb5_const_pointer, decryptarg),
-                         DECLARG(krb5_kdc_rep *, dec_rep))
-OLDDECLARG(const krb5_keyblock *, key)
-OLDDECLARG(krb5_const_pointer, decryptarg)
-OLDDECLARG(krb5_kdc_rep *, dec_rep)
+krb5_kdc_rep_decrypt_proc(context, key, decryptarg, dec_rep)
+    krb5_context context;
+    const krb5_keyblock * key;
+    krb5_const_pointer decryptarg;
+    krb5_kdc_rep * dec_rep;
 {
     krb5_error_code retval;
     krb5_encrypt_block eblock;
@@ -61,25 +60,25 @@ OLDDECLARG(krb5_kdc_rep *, dec_rep)
 
     /* put together an eblock for this encryption */
 
-    krb5_use_cstype(&eblock, dec_rep->enc_part.etype);
+    krb5_use_cstype(context, &eblock, dec_rep->enc_part.etype);
 
     /* do any necessary key pre-processing */
-    if (retval = krb5_process_key(&eblock, key)) {
+    if (retval = krb5_process_key(context, &eblock, key)) {
        free(scratch.data);
        return(retval);
     }
 
     /* call the decryption routine */
-    if (retval = krb5_decrypt((krb5_pointer) dec_rep->enc_part.ciphertext.data,
+    if (retval = krb5_decrypt(context, (krb5_pointer) dec_rep->enc_part.ciphertext.data,
                              (krb5_pointer) scratch.data,
                              scratch.length, &eblock, 0)) {
-       (void) krb5_finish_key(&eblock);
+       (void) krb5_finish_key(context, &eblock);
        free(scratch.data);
        return retval;
     }
 #define clean_scratch() {memset(scratch.data, 0, scratch.length); \
 free(scratch.data);}
-    if (retval = krb5_finish_key(&eblock)) {
+    if (retval = krb5_finish_key(context, &eblock)) {
        clean_scratch();
        return retval;
     }
index d50cd8c5900b500d134a7471c00600547dbaa8ba..3e08defff1464f3c8f79956e9c9c4a079d9a38b7 100644 (file)
 
 /* Create asn.1 encoded KRB-CRED message from the kdc reply. */
 krb5_error_code
-krb5_mk_cred(dec_rep, etype, key, sender_addr, recv_addr, outbuf)
-krb5_kdc_rep *dec_rep;
-krb5_enctype etype;
-krb5_keyblock *key;
-krb5_address *sender_addr;
-krb5_address *recv_addr;
-krb5_data *outbuf;
+krb5_mk_cred(context, dec_rep, etype, key, sender_addr, recv_addr, outbuf)
+    krb5_context context;
+    krb5_kdc_rep *dec_rep;
+    krb5_enctype etype;
+    krb5_keyblock *key;
+    krb5_address *sender_addr;
+    krb5_address *recv_addr;
+    krb5_data *outbuf;
 {
     krb5_error_code retval;
     krb5_encrypt_block eblock;
@@ -64,19 +65,19 @@ krb5_data *outbuf;
     cred_enc_part.ticket_info = (krb5_cred_info **) 
       calloc(2, sizeof(*cred_enc_part.ticket_info));
     if (!cred_enc_part.ticket_info) {
-       krb5_free_tickets(ret_cred.tickets);
+       krb5_free_tickets(context, ret_cred.tickets);
        return ENOMEM;
     }
     cred_enc_part.ticket_info[0] = (krb5_cred_info *) 
       malloc(sizeof(*cred_enc_part.ticket_info[0]));
     if (!cred_enc_part.ticket_info[0]) {
-       krb5_free_tickets(ret_cred.tickets);
-       krb5_free_cred_enc_part(cred_enc_part);
+       krb5_free_tickets(context, ret_cred.tickets);
+       krb5_free_cred_enc_part(context, cred_enc_part);
        return ENOMEM;
     }
     cred_enc_part.nonce = 0;
 
-    if (retval = krb5_us_timeofday(&cred_enc_part.timestamp,
+    if (retval = krb5_us_timeofday(context, &cred_enc_part.timestamp,
                                   &cred_enc_part.usec))
       return retval;
 
@@ -97,11 +98,11 @@ krb5_data *outbuf;
     if (retval = encode_krb5_enc_cred_part(&cred_enc_part, &scratch))
       return retval;
 
-#define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); krb5_free_data(scratch); }
+#define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); krb5_free_data(context, scratch); }
 
     /* put together an eblock for this encryption */
 
-    krb5_use_cstype(&eblock, etype);
+    krb5_use_cstype(context, &eblock, etype);
     ret_cred.enc_part.ciphertext.length = krb5_encrypt_size(scratch->length,
                                                eblock.crypto_entry);
     /* add padding area, and zero it */
@@ -127,14 +128,14 @@ krb5_data *outbuf;
        ret_cred.enc_part.ciphertext.data = 0;}
 
     /* do any necessary key pre-processing */
-    if (retval = krb5_process_key(&eblock, key)) {
+    if (retval = krb5_process_key(context, &eblock, key)) {
         goto clean_encpart;
     }
 
-#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(context, &eblock);}
 
     /* call the encryption routine */
-    if (retval = krb5_encrypt((krb5_pointer) scratch->data,
+    if (retval = krb5_encrypt(context, (krb5_pointer) scratch->data,
                              (krb5_pointer)
                              ret_cred.enc_part.ciphertext.data, 
                              scratch->length, &eblock,
@@ -145,7 +146,7 @@ krb5_data *outbuf;
     /* private message is now assembled-- do some cleanup */
     cleanup_scratch();
 
-    if (retval = krb5_finish_key(&eblock)) {
+    if (retval = krb5_finish_key(context, &eblock)) {
         cleanup_encpart();
         return retval;
     }
index 0c27d511e953849be5f52c2043509e280273d057..5a92a16ecd5f5f1838d5810b0d4723b992ba9d3a 100644 (file)
  returns system errors
  */
 krb5_error_code
-krb5_mk_error(dec_err, enc_err)
-const krb5_error *dec_err;
-krb5_data *enc_err;
+krb5_mk_error(context, dec_err, enc_err)
+    krb5_context context;
+    const krb5_error *dec_err;
+    krb5_data *enc_err;
 {
     krb5_error_code retval;
     krb5_data *new_enc_err;
index 7b81eb49327f7a722e80f7f2d527d023316964d8..df762b27a62ec4da3497b7f5d7a2ddcb82cb5838 100644 (file)
  returns system errors
 */
 krb5_error_code
-krb5_mk_priv(DECLARG(const krb5_data *, userdata),
-            DECLARG(const krb5_enctype, etype),
-            DECLARG(const krb5_keyblock *, key),
-            DECLARG(const krb5_address *, sender_addr),
-            DECLARG(const krb5_address *, recv_addr),
-            DECLARG(krb5_int32, seq_number),
-            DECLARG(krb5_int32, priv_flags),
-            DECLARG(krb5_rcache, rcache),
-            DECLARG(krb5_pointer, i_vector),
-            DECLARG(krb5_data *, outbuf))
-OLDDECLARG(const krb5_data *, userdata)
-OLDDECLARG(const krb5_enctype, etype)
-OLDDECLARG(const krb5_keyblock *, key)
-OLDDECLARG(const krb5_address *, sender_addr)
-OLDDECLARG(const krb5_address *, recv_addr)
-OLDDECLARG(krb5_int32, seq_number)
-OLDDECLARG(krb5_int32, priv_flags)
-OLDDECLARG(krb5_rcache, rcache)
-OLDDECLARG(krb5_pointer, i_vector)
-OLDDECLARG(krb5_data *, outbuf)
+krb5_mk_priv(context, userdata, etype, key, sender_addr, recv_addr,
+            seq_number, priv_flags, rcache, i_vector, outbuf)
+    krb5_context context;
+    const krb5_data * userdata;
+    const krb5_enctype etype;
+    const krb5_keyblock * key;
+    const krb5_address * sender_addr;
+    const krb5_address * recv_addr;
+    krb5_int32 seq_number;
+    krb5_int32 priv_flags;
+    krb5_rcache rcache;
+    krb5_pointer i_vector;
+    krb5_data * outbuf;
 {
     krb5_error_code retval;
     krb5_encrypt_block eblock;
@@ -91,7 +84,7 @@ OLDDECLARG(krb5_data *, outbuf)
        if (!rcache)
            /* gotta provide an rcache in this case... */
            return KRB5_RC_REQUIRED;
-       if (retval = krb5_us_timeofday(&privmsg_enc_part.timestamp,
+       if (retval = krb5_us_timeofday(context, &privmsg_enc_part.timestamp,
                                       &privmsg_enc_part.usec))
            return retval;
     } else
@@ -106,11 +99,11 @@ OLDDECLARG(krb5_data *, outbuf)
     if (retval = encode_krb5_enc_priv_part(&privmsg_enc_part, &scratch))
        return retval;
 
-#define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); krb5_free_data(scratch); }
+#define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); krb5_free_data(context, scratch); }
 
     /* put together an eblock for this encryption */
 
-    krb5_use_cstype(&eblock, etype);
+    krb5_use_cstype(context, &eblock, etype);
     privmsg.enc_part.ciphertext.length = krb5_encrypt_size(scratch->length,
                                                eblock.crypto_entry);
     /* add padding area, and zero it */
@@ -136,14 +129,14 @@ OLDDECLARG(krb5_data *, outbuf)
        privmsg.enc_part.ciphertext.data = 0;}
 
     /* do any necessary key pre-processing */
-    if (retval = krb5_process_key(&eblock, key)) {
+    if (retval = krb5_process_key(context, &eblock, key)) {
         goto clean_encpart;
     }
 
-#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(context, &eblock);}
 
     /* call the encryption routine */
-    if (retval = krb5_encrypt((krb5_pointer) scratch->data,
+    if (retval = krb5_encrypt(context, (krb5_pointer) scratch->data,
                              (krb5_pointer) privmsg.enc_part.ciphertext.data,
                              scratch->length, &eblock,
                              i_vector)) {
@@ -162,7 +155,7 @@ OLDDECLARG(krb5_data *, outbuf)
     /* private message is now assembled-- do some cleanup */
     cleanup_scratch();
 
-    if (retval = krb5_finish_key(&eblock)) {
+    if (retval = krb5_finish_key(context, &eblock)) {
         cleanup_encpart();
         return retval;
     }
@@ -176,7 +169,7 @@ OLDDECLARG(krb5_data *, outbuf)
     if (!(priv_flags & KRB5_PRIV_NOTIME)) {
        krb5_donot_replay replay;
 
-       if (retval = krb5_gen_replay_name(sender_addr, "_priv",
+       if (retval = krb5_gen_replay_name(context, sender_addr, "_priv",
                                          &replay.client)) {
            cleanup_scratch();
            return retval;
@@ -185,7 +178,7 @@ OLDDECLARG(krb5_data *, outbuf)
        replay.server = "";             /* XXX */
        replay.cusec = privmsg_enc_part.usec;
        replay.ctime = privmsg_enc_part.timestamp;
-       if (retval = krb5_rc_store(rcache, &replay)) {
+       if (retval = krb5_rc_store(context, rcache, &replay)) {
            /* should we really error out here? XXX */
            cleanup_scratch();
            krb5_xfree(replay.client);
index a07b86494501602259a501ff75d5f3f10ca091ad..504d9ca4962398eb58c8e9237d28e09e07267f77 100644 (file)
 */
 
 krb5_error_code
-krb5_mk_rep(repl, kblock, outbuf)
-const krb5_ap_rep_enc_part *repl;
-const krb5_keyblock *kblock;
-krb5_data *outbuf;
+krb5_mk_rep(context, repl, kblock, outbuf)
+    krb5_context context;
+    const krb5_ap_rep_enc_part *repl;
+    const krb5_keyblock *kblock;
+    krb5_data *outbuf;
 {
     krb5_error_code retval;
     krb5_data *scratch;
@@ -72,11 +73,11 @@ krb5_data *outbuf;
        return retval;
 
 #define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); \
-krb5_free_data(scratch); }
+krb5_free_data(context, scratch); }
 
     /* put together an eblock for this encryption */
 
-    krb5_use_cstype(&eblock, etype);
+    krb5_use_cstype(context, &eblock, etype);
     reply.enc_part.etype = etype;
     reply.enc_part.kvno = 0;           /* XXX user set? */
 
@@ -104,14 +105,14 @@ free(reply.enc_part.ciphertext.data); \
 reply.enc_part.ciphertext.length = 0; reply.enc_part.ciphertext.data = 0;}
 
     /* do any necessary key pre-processing */
-    if (retval = krb5_process_key(&eblock, kblock)) {
+    if (retval = krb5_process_key(context, &eblock, kblock)) {
        goto clean_encpart;
     }
 
-#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(context, &eblock);}
 
     /* call the encryption routine */
-    if (retval = krb5_encrypt((krb5_pointer) scratch->data,
+    if (retval = krb5_encrypt(context, (krb5_pointer) scratch->data,
                              (krb5_pointer) reply.enc_part.ciphertext.data,
                              scratch->length, &eblock, 0)) {
        goto clean_prockey;
@@ -120,7 +121,7 @@ reply.enc_part.ciphertext.length = 0; reply.enc_part.ciphertext.data = 0;}
     /* encrypted part now assembled-- do some cleanup */
     cleanup_scratch();
 
-    if (retval = krb5_finish_key(&eblock)) {
+    if (retval = krb5_finish_key(context, &eblock)) {
        cleanup_encpart();
        return retval;
     }
index 84a6233427c6a783162642860a432a1f05fcd419..c99aa463b56bc3d1fbf35c5e7250b0e51f899941 100644 (file)
 extern krb5_flags krb5_kdc_default_options;
 
 krb5_error_code
-krb5_mk_req(server, ap_req_options, checksum, ccache, outbuf)
-krb5_const_principal server;
-const krb5_flags ap_req_options;
-const krb5_checksum *checksum;
-krb5_ccache ccache;
-krb5_data *outbuf;
+krb5_mk_req(context, server, ap_req_options, checksum, ccache, outbuf)
+    krb5_context context;
+    krb5_const_principal server;
+    const krb5_flags ap_req_options;
+    const krb5_checksum *checksum;
+    krb5_ccache ccache;
+    krb5_data *outbuf;
 {
     krb5_error_code retval;
     krb5_creds creds;
@@ -64,9 +65,9 @@ krb5_data *outbuf;
     /* obtain ticket & session key */
 
     memset((char *)&creds, 0, sizeof(creds));
-    if (retval = krb5_copy_principal(server, &creds.server))
+    if (retval = krb5_copy_principal(context, server, &creds.server))
        goto errout;
-    if (retval = krb5_cc_get_principal(ccache, &creds.client))
+    if (retval = krb5_cc_get_principal(context, ccache, &creds.client))
        goto errout;
     /* creds.times.endtime = 0; -- memset 0 takes care of this
                                   zero means "as long as possible" */
@@ -74,12 +75,12 @@ krb5_data *outbuf;
                                              zero means no session keytype
                                      preference */
 
-    if (retval = krb5_get_credentials(krb5_kdc_default_options,
+    if (retval = krb5_get_credentials(context, krb5_kdc_default_options,
                                      ccache,
                                      &creds))
        goto errout;
 
-    retval = krb5_mk_req_extended(ap_req_options,
+    retval = krb5_mk_req_extended(context, ap_req_options,
                                  checksum,
                                  krb5_kdc_default_options,
                                  0,    /* no sequence number */
@@ -90,6 +91,6 @@ krb5_data *outbuf;
                                  outbuf);
 
 errout:
-    krb5_free_cred_contents(&creds);
+    krb5_free_cred_contents(context, &creds);
     return retval;
 }
index d5639741fa04f7e57a93fd1a05bf4ffba2fec8b0..585ebde20a042abe1ce33a8113e8304ec17a8057 100644 (file)
 */
 
 static krb5_error_code 
-krb5_generate_authenticator PROTOTYPE(( krb5_authenticator *, krb5_principal,
+krb5_generate_authenticator PROTOTYPE((krb5_context,
+                                      krb5_authenticator *, krb5_principal,
                                       const krb5_checksum *, krb5_keyblock *,
                                       krb5_int32, krb5_authdata ** ));
 
 krb5_error_code
-krb5_mk_req_extended(ap_req_options, checksum, kdc_options,
+krb5_mk_req_extended(context, ap_req_options, checksum, kdc_options,
                     sequence, newkey, ccache, creds, authentp, outbuf)
-const krb5_flags ap_req_options;
-const krb5_checksum *checksum;
-const krb5_flags kdc_options;
-krb5_int32 sequence;
-krb5_keyblock **newkey;
-krb5_ccache ccache;
-krb5_creds *creds;
-krb5_authenticator *authentp;
-krb5_data *outbuf;
+    krb5_context context;
+    const krb5_flags ap_req_options;
+    const krb5_checksum *checksum;
+    const krb5_flags kdc_options;
+    krb5_int32 sequence;
+    krb5_keyblock **newkey;
+    krb5_ccache ccache;
+    krb5_creds *creds;
+    krb5_authenticator *authentp;
+    krb5_data *outbuf;
 {
     krb5_error_code retval;
     krb5_ap_req request;
@@ -105,7 +107,7 @@ krb5_data *outbuf;
 
     if (!creds->ticket.length) {
        /* go get creds */
-       if (retval = krb5_get_credentials(kdc_options,
+       if (retval = krb5_get_credentials(context, kdc_options,
                                          ccache,
                                          creds))
            return(retval);
@@ -125,11 +127,11 @@ krb5_data *outbuf;
 
     request.ap_options = ap_req_options;
     if (newkey) {
-       if (retval = krb5_generate_subkey(&creds->keyblock, newkey))
+       if (retval = krb5_generate_subkey(context, &creds->keyblock, newkey))
            goto cleanup;
     }
 
-    if (retval = krb5_generate_authenticator(&authent, creds->client, checksum,
+    if (retval = krb5_generate_authenticator(context, &authent, creds->client, checksum,
                                             newkey ? *newkey : 0,
                                             sequence, creds->authdata))
        goto cleanup;
@@ -148,11 +150,11 @@ krb5_data *outbuf;
     if (authentp)
            *authentp = authent;
     else
-           krb5_free_authenticator_contents(&authent);
+           krb5_free_authenticator_contents(context, &authent);
 
     /* put together an eblock for this encryption */
 
-    krb5_use_cstype(&eblock, etype);
+    krb5_use_cstype(context, &eblock, etype);
     request.authenticator.etype = etype;
     request.authenticator.kvno = 0;
     request.authenticator.ciphertext.length =
@@ -173,18 +175,18 @@ krb5_data *outbuf;
     }
 
     /* do any necessary key pre-processing */
-    if (retval = krb5_process_key(&eblock, &creds->keyblock))
+    if (retval = krb5_process_key(context, &eblock, &creds->keyblock))
        goto cleanup;
 
     cleanup_key++;
 
     /* call the encryption routine */
-    if (retval = krb5_encrypt((krb5_pointer) scratch->data,
+    if (retval = krb5_encrypt(context, (krb5_pointer) scratch->data,
                              (krb5_pointer) request.authenticator.ciphertext.data,
                              scratch->length, &eblock, 0))
        goto cleanup;
 
-    if (retval = krb5_finish_key(&eblock))
+    if (retval = krb5_finish_key(context, &eblock))
        goto cleanup;
     cleanup_key = 0;
     
@@ -197,40 +199,41 @@ krb5_data *outbuf;
 
 cleanup:
     if (request.ticket)
-       krb5_free_ticket(request.ticket);
+       krb5_free_ticket(context, request.ticket);
     if (request.authenticator.ciphertext.data) {
        (void) memset(request.authenticator.ciphertext.data, 0,
                      request.authenticator.ciphertext.length);
        free(request.authenticator.ciphertext.data);
     }
     if (newkey && *newkey)
-       krb5_free_keyblock(*newkey);
+       krb5_free_keyblock(context, *newkey);
     if (scratch) {
        memset(scratch->data, 0, scratch->length);
         krb5_xfree(scratch->data);
        krb5_xfree(scratch);
     }
     if (cleanup_key)
-       krb5_finish_key(&eblock);
+       krb5_finish_key(context, &eblock);
 
     return retval;
 }
 
 static krb5_error_code
-krb5_generate_authenticator(authent, client, cksum, key, seq_number, authorization)
-krb5_authenticator *authent;
-krb5_principal client;
-const krb5_checksum *cksum;
-krb5_keyblock *key;
-krb5_int32 seq_number;
-krb5_authdata **authorization;
+krb5_generate_authenticator(context, authent, client, cksum, key, seq_number, authorization)
+    krb5_context context;
+    krb5_authenticator *authent;
+    krb5_principal client;
+    const krb5_checksum *cksum;
+    krb5_keyblock *key;
+    krb5_int32 seq_number;
+    krb5_authdata **authorization;
 {
     krb5_error_code retval;
     
     authent->client = client;
     authent->checksum = (krb5_checksum *)cksum;
     if (key) {
-       retval = krb5_copy_keyblock(key, &authent->subkey);
+       retval = krb5_copy_keyblock(context, key, &authent->subkey);
        if (retval)
            return retval;
     } else
@@ -239,5 +242,5 @@ krb5_authdata **authorization;
     authent->seq_number = seq_number;
     authent->authorization_data = authorization;
 
-    return(krb5_us_timeofday(&authent->ctime, &authent->cusec));
+    return(krb5_us_timeofday(context, &authent->ctime, &authent->cusec));
 }
index f692d43320df381e73338e654018c23e26061384..e50d92477593ba9d81760c6443be75491ba36dbe 100644 (file)
  returns system errors
 */
 krb5_error_code
-krb5_mk_safe(DECLARG(const krb5_data *, userdata),
-            DECLARG(const krb5_cksumtype, sumtype),
-            DECLARG(const krb5_keyblock *, key),
-            DECLARG(const krb5_address *, sender_addr),
-            DECLARG(const krb5_address *, recv_addr),
-            DECLARG(krb5_int32, seq_number),
-            DECLARG(krb5_int32, safe_flags),
-            DECLARG(krb5_rcache, rcache),
-            DECLARG(krb5_data *, outbuf))
-OLDDECLARG(const krb5_data *, userdata)
-OLDDECLARG(const krb5_cksumtype, sumtype)
-OLDDECLARG(const krb5_keyblock *, key)
-OLDDECLARG(const krb5_address *, sender_addr)
-OLDDECLARG(const krb5_address *, recv_addr)
-OLDDECLARG(krb5_int32, seq_number)
-OLDDECLARG(krb5_int32, safe_flags)
-OLDDECLARG(krb5_rcache, rcache)
-OLDDECLARG(krb5_data *, outbuf)
+krb5_mk_safe(context, userdata, sumtype, key, sender_addr, recv_addr,
+            seq_number, safe_flags, rcache, outbuf)
+    krb5_context context;
+    const krb5_data * userdata;
+    const krb5_cksumtype sumtype;
+    const krb5_keyblock * key;
+    const krb5_address * sender_addr;
+    const krb5_address * recv_addr;
+    krb5_int32 seq_number;
+    krb5_int32 safe_flags;
+    krb5_rcache rcache;
+    krb5_data * outbuf;
 {
     krb5_error_code retval;
     krb5_safe safemsg;
@@ -87,7 +81,7 @@ OLDDECLARG(krb5_data *, outbuf)
        if (!rcache)
            /* gotta provide an rcache in this case... */
            return KRB5_RC_REQUIRED;
-       if (retval = krb5_us_timeofday(&safemsg.timestamp, &safemsg.usec))
+       if (retval = krb5_us_timeofday(context, &safemsg.timestamp, &safemsg.usec))
            return retval;
     } else
        safemsg.timestamp = 0, safemsg.usec = 0;
@@ -112,14 +106,14 @@ OLDDECLARG(krb5_data *, outbuf)
 
 #define clean_scratch() {(void) memset((char *)scratch->data, 0,\
                                       scratch->length); \
-                         krb5_free_data(scratch);}
+                         krb5_free_data(context, scratch);}
                         
     if (!(safe_checksum.contents =
-         (krb5_octet *) malloc(krb5_checksum_size(sumtype)))) {
+         (krb5_octet *) malloc(krb5_checksum_size(context, sumtype)))) {
        clean_scratch();
        return ENOMEM;
     }
-    if (retval = krb5_calculate_checksum(sumtype, scratch->data,
+    if (retval = krb5_calculate_checksum(context, sumtype, scratch->data,
                                         scratch->length,
                                         (krb5_pointer) key->contents,
                                         key->length, &safe_checksum)) {
@@ -137,7 +131,7 @@ OLDDECLARG(krb5_data *, outbuf)
     if (!(safe_flags & KRB5_SAFE_NOTIME)) {
        krb5_donot_replay replay;
 
-       if (retval = krb5_gen_replay_name(sender_addr, "_safe",
+       if (retval = krb5_gen_replay_name(context, sender_addr, "_safe",
                                          &replay.client)) {
            clean_scratch();
            return retval;
@@ -146,7 +140,7 @@ OLDDECLARG(krb5_data *, outbuf)
        replay.server = "";             /* XXX */
        replay.cusec = safemsg.usec;
        replay.ctime = safemsg.timestamp;
-       if (retval = krb5_rc_store(rcache, &replay)) {
+       if (retval = krb5_rc_store(context, rcache, &replay)) {
            /* should we really error out here? XXX */
            clean_scratch();
            krb5_xfree(replay.client);
index 3e5edfd6f1fe8670d8a98988f4d1da6336bfd030..fe051ae6836d3f37992900f9546b0feb7421e630 100644 (file)
@@ -65,7 +65,8 @@
  * that arbitrarily large multi-component names are a Good Thing.....
  */
 krb5_error_code
-krb5_parse_name(name, nprincipal)
+krb5_parse_name(context, name, nprincipal)
+       krb5_context context;
        const char      *name;
        krb5_principal  *nprincipal;
 {
@@ -149,7 +150,7 @@ krb5_parse_name(name, nprincipal)
         */
        if (!parsed_realm) {
            if (!default_realm) {
-               retval = krb5_get_default_realm(&default_realm);
+               retval = krb5_get_default_realm(context, &default_realm);
                if (retval) {
                    krb5_xfree(principal->data);
                    krb5_xfree((char *)principal);
@@ -157,7 +158,7 @@ krb5_parse_name(name, nprincipal)
                }
                default_realm_size = strlen(default_realm);
            }
-           krb5_princ_realm(principal)->length = default_realm_size;
+           krb5_princ_realm(context, principal)->length = default_realm_size;
            realmsize = default_realm_size;
        }
        /*
@@ -174,20 +175,20 @@ krb5_parse_name(name, nprincipal)
                                cp++;
                                size++;
                        } else if (c == COMPONENT_SEP) {
-                               krb5_princ_component(principal, i)->length = size;
+                               krb5_princ_component(context, principal, i)->length = size;
                                size = 0;
                                i++;
                        } else if (c == REALM_SEP) {
-                               krb5_princ_component(principal, i)->length = size;
+                               krb5_princ_component(context, principal, i)->length = size;
                                size = 0;
                                parsed_realm = cp+1;
                        } else
                                size++;
                }
                if (parsed_realm)
-                       krb5_princ_realm(principal)->length = size;
+                       krb5_princ_realm(context, principal)->length = size;
                else
-                       krb5_princ_component(principal, i)->length = size;
+                       krb5_princ_component(context, principal, i)->length = size;
                if (i + 1 != components) {
                        fprintf(stderr,
                                "Programming error in krb5_parse_name!");
@@ -200,8 +201,8 @@ krb5_parse_name(name, nprincipal)
                 * principal structure
                 */
                for (i=0; i < components; i++)
-                       krb5_princ_component(principal, i)->length = fcompsize[i];
-               krb5_princ_realm(principal)->length = realmsize;
+                       krb5_princ_component(context, principal, i)->length = fcompsize[i];
+               krb5_princ_realm(context, principal)->length = realmsize;
        }
        /*      
         * Now, we need to allocate the space for the strings themselves.....
@@ -212,19 +213,19 @@ krb5_parse_name(name, nprincipal)
                krb5_xfree(principal);
                return ENOMEM;
        }
-       krb5_princ_set_realm_data(principal, tmpdata);
+       krb5_princ_set_realm_data(context, principal, tmpdata);
        for (i=0; i < components; i++) {
                char *tmpdata =
-                 malloc(krb5_princ_component(principal, i)->length + 1);
+                 malloc(krb5_princ_component(context, principal, i)->length + 1);
                if (!tmpdata) {
                        for (i--; i >= 0; i--)
-                               krb5_xfree(krb5_princ_component(principal, i)->data);
-                       krb5_xfree(krb5_princ_realm(principal)->data);
+                               krb5_xfree(krb5_princ_component(context, principal, i)->data);
+                       krb5_xfree(krb5_princ_realm(context, principal)->data);
                        krb5_xfree(principal->data);
                        krb5_xfree(principal);
                        return(ENOMEM);
                }
-               krb5_princ_component(principal, i)->data = tmpdata;
+               krb5_princ_component(context, principal, i)->data = tmpdata;
        }
        
        /*
@@ -232,7 +233,7 @@ krb5_parse_name(name, nprincipal)
         * time filling in the krb5_principal structure which we just
         * allocated.
         */
-       q = krb5_princ_component(principal, 0)->data;
+       q = krb5_princ_component(context, principal, 0)->data;
        for (i=0,cp = name; c = *cp; cp++) {
                if (c == QUOTECHAR) {
                        cp++;
@@ -256,20 +257,20 @@ krb5_parse_name(name, nprincipal)
                        i++;
                        *q++ = '\0';
                        if (c == COMPONENT_SEP) 
-                               q = krb5_princ_component(principal, i)->data;
+                               q = krb5_princ_component(context, principal, i)->data;
                        else
-                               q = krb5_princ_realm(principal)->data;
+                               q = krb5_princ_realm(context, principal)->data;
                } else
                        *q++ = c;
        }
        *q++ = '\0';
        if (!parsed_realm)
-               strcpy(krb5_princ_realm(principal)->data, default_realm);
+               strcpy(krb5_princ_realm(context, principal)->data, default_realm);
        /*
         * Alright, we're done.  Now stuff a pointer to this monstrosity
         * into the return variable, and let's get out of here.
         */
-       krb5_princ_type(principal) = KRB5_NT_PRINCIPAL;
+       krb5_princ_type(context, principal) = KRB5_NT_PRINCIPAL;
        *nprincipal = principal;
        return(0);
 }
index a486cc91103bf6ad17ea5c64343634c8bc5e5019..f920621f0da341113994914a1f019dc3d3c7ccd5 100644 (file)
  * Convert a krb5_principal into the default salt for that principal.
  */
 krb5_error_code
-krb5_principal2salt_internal(pr, ret, use_realm)
-register krb5_const_principal pr;
-krb5_data *ret;
-int use_realm;
+krb5_principal2salt_internal(context, pr, ret, use_realm)
+    krb5_context context;
+    register krb5_const_principal pr;
+    krb5_data *ret;
+    int use_realm;
 {
     int size = 0, offset = 0;
     int nelem;
@@ -48,43 +49,45 @@ int use_realm;
        return 0;
     }
 
-    nelem = krb5_princ_size(pr);
+    nelem = krb5_princ_size(context, pr);
 
     if (use_realm)
-           size += krb5_princ_realm(pr)->length;
+           size += krb5_princ_realm(context, pr)->length;
 
     for (i = 0; i < nelem; i++)
-       size += krb5_princ_component(pr, i)->length;
+       size += krb5_princ_component(context, pr, i)->length;
 
     ret->length = size;
     if (!(ret->data = malloc (size)))
        return ENOMEM;
 
     if (use_realm) {
-           offset = krb5_princ_realm(pr)->length;
-           memcpy(ret->data, krb5_princ_realm(pr)->data, offset);
+           offset = krb5_princ_realm(context, pr)->length;
+           memcpy(ret->data, krb5_princ_realm(context, pr)->data, offset);
     }
 
     for (i = 0; i < nelem; i++) {
-       memcpy(&ret->data[offset], krb5_princ_component(pr, i)->data,
-              krb5_princ_component(pr, i)->length);
-       offset += krb5_princ_component(pr, i)->length;
+       memcpy(&ret->data[offset], krb5_princ_component(context, pr, i)->data,
+              krb5_princ_component(context, pr, i)->length);
+       offset += krb5_princ_component(context, pr, i)->length;
     }
     return 0;
 }
 
 krb5_error_code
-krb5_principal2salt(pr, ret)
-register krb5_const_principal pr;
-krb5_data *ret;
+krb5_principal2salt(context, pr, ret)
+    krb5_context context;
+    register krb5_const_principal pr;
+    krb5_data *ret;
 {
-       return krb5_principal2salt_internal(pr, ret, 1);
+       return krb5_principal2salt_internal(context, pr, ret, 1);
 }
 
 krb5_error_code
-krb5_principal2salt_norealm(pr, ret)
-register krb5_const_principal pr;
-krb5_data *ret;
+krb5_principal2salt_norealm(context, pr, ret)
+    krb5_context context;
+    register krb5_const_principal pr;
+    krb5_data *ret;
 {
-       return krb5_principal2salt_internal(pr, ret, 0);
+       return krb5_principal2salt_internal(context, pr, ret, 0);
 }
index 05badcae3fa64e855e8db5893475c8c035e56a59..e03d24cedf092e02c3a9530c39f68ef7acf0707a 100644 (file)
@@ -77,7 +77,8 @@ static krb5_error_code find_preauthenticator
  *   Note: This is a first crack at what any preauthentication will need...
  */
 krb5_error_code 
-krb5_obtain_padata(type, client, src_addr, encrypt_key, ret_data)
+krb5_obtain_padata(context, type, client, src_addr, encrypt_key, ret_data)
+    krb5_context context;
     int type;                          /*IN:  Preauth type */
     krb5_principal client;             /*IN:  requestor */
     krb5_address **src_addr;            /*IN:  array of ptrs to addresses */
@@ -110,7 +111,7 @@ krb5_obtain_padata(type, client, src_addr, encrypt_key, ret_data)
     if (retval)
        goto error_out;
 
-    retval = (*p_system->obtain)( client, src_addr, data );
+    retval = (*p_system->obtain)(context, client, src_addr, data );
     if (retval)
        goto error_out;
 
@@ -121,10 +122,10 @@ krb5_obtain_padata(type, client, src_addr, encrypt_key, ret_data)
            retval = KRB5_PREAUTH_NO_KEY;
            goto error_out;
        }
-        krb5_use_keytype(&eblock, encrypt_key->keytype);
+        krb5_use_keytype(context, &eblock, encrypt_key->keytype);
 
        /* do any necessay key pre-processing */
-       retval = krb5_process_key(&eblock, encrypt_key);
+       retval = krb5_process_key(context, &eblock, encrypt_key);
        if (retval)
            goto error_out;
        
@@ -137,7 +138,7 @@ krb5_obtain_padata(type, client, src_addr, encrypt_key, ret_data)
                                           eblock.crypto_entry) + 4;
        
        if(!(scratch.data = malloc(scratch.length))){
-           (void) krb5_finish_key(&eblock);
+           (void) krb5_finish_key(context, &eblock);
            retval = ENOMEM;
            goto error_out;
        }
@@ -148,14 +149,14 @@ krb5_obtain_padata(type, client, src_addr, encrypt_key, ret_data)
        scratch.data[3] = data->length;
 
        /* Encrypt preauth data in encryption key */
-       if (retval = krb5_encrypt((krb5_pointer) data->contents,
+       if (retval = krb5_encrypt(context, (krb5_pointer) data->contents,
                                  (char *) scratch.data + 4,
                                  data->length, &eblock, 0)) {
-           (void) krb5_finish_key(&eblock);
+           (void) krb5_finish_key(context, &eblock);
            free(scratch.data);
            goto error_out;
        }
-       (void) krb5_finish_key(&eblock);
+       (void) krb5_finish_key(context, &eblock);
            
        free(data->contents);
        data->length = scratch.length;
@@ -182,7 +183,8 @@ error_out:
  */
 
 krb5_error_code
-krb5_verify_padata(data,client,src_addr, decrypt_key, req_id, flags)
+krb5_verify_padata(context, data,client,src_addr, decrypt_key, req_id, flags)
+    krb5_context context;
     krb5_pa_data *data;                 /*IN: padata */
     krb5_principal client;              /*IN: requestor */
     krb5_address **src_addr;            /*IN: array of ptrs to addresses */
@@ -212,7 +214,7 @@ krb5_verify_padata(data,client,src_addr, decrypt_key, req_id, flags)
        if (!decrypt_key)
            return(EINVAL);
 
-        krb5_use_keytype(&eblock, decrypt_key->keytype);
+        krb5_use_keytype(context, &eblock, decrypt_key->keytype);
 
         scratch.length = data->length;
         if (!(scratch.data = (char *)malloc(scratch.length))) {
@@ -220,18 +222,18 @@ krb5_verify_padata(data,client,src_addr, decrypt_key, req_id, flags)
         }
 
        /* do any necessay key pre-processing */
-       retval = krb5_process_key(&eblock,decrypt_key);
+       retval = krb5_process_key(context, &eblock,decrypt_key);
        if (retval) {
            free(scratch.data);
            return(retval);
         }
 
        /* Decrypt data */
-       retval = krb5_decrypt((char *) data->contents + 4,
+       retval = krb5_decrypt(context, (char *) data->contents + 4,
                              (krb5_pointer) scratch.data,
                              scratch.length - 4, &eblock, 0);
        if (retval) {
-           (void) krb5_finish_key(&eblock);
+           (void) krb5_finish_key(context, &eblock);
            free(scratch.data);
            return(retval);
        }
@@ -246,7 +248,7 @@ krb5_verify_padata(data,client,src_addr, decrypt_key, req_id, flags)
        scratch.length = data->length;
     }
 
-    retval = (*p_system->verify)(client, src_addr, &scratch);
+    retval = (*p_system->verify)(context, client, src_addr, &scratch);
     if (free_scratch)
        free(scratch.data);
     if (retval)
@@ -260,10 +262,10 @@ krb5_verify_padata(data,client,src_addr, decrypt_key, req_id, flags)
              replay detection. */
     /* MUST malloc cksum.contents */
     cksum.contents = (krb5_octet *)calloc(1,
-                               krb5_checksum_size(CKSUMTYPE_CRC32));
+                               krb5_checksum_size(context, CKSUMTYPE_CRC32));
     if (!cksum.contents) return(1);
 
-    if (krb5_calculate_checksum(CKSUMTYPE_CRC32,
+    if (krb5_calculate_checksum(context, CKSUMTYPE_CRC32,
                        data->contents,
                        data->length,
                         0, /* seed is ignored */
@@ -306,7 +308,8 @@ find_preauthenticator(type, preauth)
 int seeded = 0 ; /* Used by srand below */
 
 krb5_error_code
-get_unixtime_padata(client, src_addr, pa_data)
+get_unixtime_padata(context, client, src_addr, pa_data)
+    krb5_context context;
     krb5_principal client;
     krb5_address **src_addr;
     krb5_pa_data *pa_data;
@@ -321,7 +324,7 @@ get_unixtime_padata(client, src_addr, pa_data)
     if (!tmp) 
         return(ENOMEM);
 
-    retval = krb5_timeofday(&kdc_time);
+    retval = krb5_timeofday(context, &kdc_time);
     if (retval)
         return retval;
     if ( !seeded) {
@@ -342,7 +345,8 @@ get_unixtime_padata(client, src_addr, pa_data)
 }
 
 krb5_error_code
-verify_unixtime_padata(client, src_addr, data)
+verify_unixtime_padata(context, client, src_addr, data)
+    krb5_context context;
     krb5_principal client;
     krb5_address **src_addr;
     krb5_data *data;
@@ -361,7 +365,7 @@ verify_unixtime_padata(client, src_addr, data)
     patime += (int) tmp[11] << 8;
     patime += tmp[12];
 
-    retval = krb5_timeofday(&currenttime);
+    retval = krb5_timeofday(context, &currenttime);
     if (retval)
         return retval;
 
@@ -390,18 +394,18 @@ verify_securid_padata(client, src_addr, data)
 
        memset((char *)&sd,0, sizeof (sd));
        memset((char *) username, 0, sizeof(username));
-        memcpy((char *) username, krb5_princ_component(client,0)->data,
-                                 krb5_princ_component(client,0)->length);
+        memcpy((char *) username, krb5_princ_component(context, client,0)->data,
+                                 krb5_princ_component(context, client,0)->length);
         /* If Instance then Append */
-       if (krb5_princ_size(client) > 1 ) {
-           if (strncmp(krb5_princ_realm(client)->data,
-                       krb5_princ_component(client,1)->data,
-                       krb5_princ_component(client,1)->length) ||
-                       krb5_princ_realm(client)->length != 
-                       krb5_princ_component(client,1)->length) {
+       if (krb5_princ_size(context, client) > 1 ) {
+           if (strncmp(krb5_princ_realm(context, client)->data,
+                       krb5_princ_component(context, client,1)->data,
+                       krb5_princ_component(context, client,1)->length) ||
+                       krb5_princ_realm(context, client)->length != 
+                       krb5_princ_component(context, client,1)->length) {
                strncat(username,"/",1);
-               strncat(username,krb5_princ_component(client,1)->data,
-                                krb5_princ_component(client,1)->length);
+               strncat(username,krb5_princ_component(context, client,1)->data,
+                                krb5_princ_component(context, client,1)->length);
            }
        }
         if (retval = sd_check(data->data,username,&sd) != ACM_OK) {
@@ -414,7 +418,7 @@ verify_securid_padata(client, src_addr, data)
     } else {
         char *username = 0;
 
-       krb5_unparse_name(client,&username);
+       krb5_unparse_name(context, client,&username);
        syslog(LOG_INFO, 
            "%s Provided Securid but this KDC does not support Securid",
                username);
@@ -424,13 +428,14 @@ verify_securid_padata(client, src_addr, data)
 }
 #else
 krb5_error_code
-verify_securid_padata(client, src_addr, data)
+verify_securid_padata(context, client, src_addr, data)
+    krb5_context context;
     krb5_principal client;
     krb5_address **src_addr;
     krb5_data *data;
 {
  char *username = 0;
-       krb5_unparse_name(client,&username);
+       krb5_unparse_name(context, client,&username);
        syslog(LOG_INFO, 
            "%s Provided Securid but this KDC does not support Securid",
                username);
@@ -447,7 +452,8 @@ static char *krb5_SecureId_prompt = "\nEnter Your SecurId Access Code Prepended
 static char *krb5_SecureId_prompt = "\nEnter Your SecurId Access Code Prepended with Your PIN\n (or a \'#\'if Your PIN is entered on the card keypad): ";
 
 krb5_error_code
-get_securid_padata(client,src_addr,pa_data)
+get_securid_padata(context, client,src_addr,pa_data)
+    krb5_context context;
     krb5_principal client;
     krb5_address **src_addr;
     krb5_pa_data *pa_data;
@@ -458,7 +464,7 @@ get_securid_padata(client,src_addr,pa_data)
  int retval = 0;
 
     tempsize = sizeof(temp) - 1;
-    if (krb5_read_password(krb5_SecureId_prompt, 0, temp, &tempsize))
+    if (krb5_read_password(context, krb5_SecureId_prompt, 0, temp, &tempsize))
         return(KRB5_PARSE_ILLCHAR);
     temp[tempsize] = '\0';
 
index f1eedad1467f28cb64fac4155e64e7c563fd7da8..7697707f38014e24eaa8a16a6537b05d056d1d5d 100644 (file)
 #include <krb5/ext-proto.h>
 
 krb5_boolean
-krb5_realm_compare(princ1, princ2)
-krb5_const_principal princ1;
-krb5_const_principal princ2;
+krb5_realm_compare(context, princ1, princ2)
+    krb5_context context;
+    krb5_const_principal princ1;
+    krb5_const_principal princ2;
 {
-    if (krb5_princ_realm(princ1)->length != krb5_princ_realm(princ2)->length ||
-       memcmp (krb5_princ_realm(princ1)->data, krb5_princ_realm(princ2)->data,
-               krb5_princ_realm(princ2)->length))
+    if (krb5_princ_realm(context, princ1)->length != 
+       krb5_princ_realm(context, princ2)->length ||
+       memcmp (krb5_princ_realm(context, princ1)->data, 
+               krb5_princ_realm(context, princ2)->data,
+               krb5_princ_realm(context, princ2)->length))
        return FALSE;
 
     return TRUE;
 }
 
 krb5_boolean
-krb5_principal_compare(princ1, princ2)
-krb5_const_principal princ1;
-krb5_const_principal princ2;
+krb5_principal_compare(context, princ1, princ2)
+    krb5_context context;
+    krb5_const_principal princ1;
+    krb5_const_principal princ2;
 {
     register int i, nelem;
 
-    nelem = krb5_princ_size(princ1);
-    if (nelem != krb5_princ_size(princ2))
+    nelem = krb5_princ_size(context, princ1);
+    if (nelem != krb5_princ_size(context, princ2))
        return FALSE;
 
-    if (! krb5_realm_compare(princ1, princ2))
+    if (! krb5_realm_compare(context, princ1, princ2))
        return FALSE;
 
     for (i = 0; i < nelem; i++) {
-       register const krb5_data *p1 = krb5_princ_component(princ1, i);
-       register const krb5_data *p2 = krb5_princ_component(princ2, i);
+       register const krb5_data *p1 = krb5_princ_component(context, princ1, i);
+       register const krb5_data *p2 = krb5_princ_component(context, princ2, i);
        if (p1->length != p2->length ||
            memcmp(p1->data, p2->data, p1->length))
            return FALSE;
index 3c8dc6afdead9ee95538575486a027e41f6ebf99..dd7b3a629c2043b8728e0b17ca70bedce97818b0 100644 (file)
@@ -37,12 +37,13 @@ extern krb5_deltat krb5_clockskew;
 
 /* Decode the KRB-CRED message, and return creds */
 krb5_error_code
-krb5_rd_cred(inbuf, key, creds, sender_addr, recv_addr)
-const krb5_data *inbuf;
-const krb5_keyblock *key;
-krb5_creds *creds;                /* Filled in */
-const krb5_address *sender_addr;  /* optional */
-const krb5_address *recv_addr;    /* optional */
+krb5_rd_cred(context, inbuf, key, creds, sender_addr, recv_addr)
+    krb5_context context;
+    const krb5_data *inbuf;
+    const krb5_keyblock *key;
+    krb5_creds *creds;                /* Filled in */
+    const krb5_address *sender_addr;  /* optional */
+    const krb5_address *recv_addr;    /* optional */
 {
     krb5_error_code retval;
     krb5_encrypt_block eblock;
@@ -90,7 +91,7 @@ const krb5_address *recv_addr;    /* optional */
 
     /* put together an eblock for this decryption */
 
-    krb5_use_cstype(&eblock, credmsg->enc_part.etype);
+    krb5_use_cstype(context, &eblock, credmsg->enc_part.etype);
     scratch->length = credmsg->enc_part.ciphertext.length;
     
     if (!(scratch->data = malloc(scratch->length))) {
@@ -99,16 +100,16 @@ const krb5_address *recv_addr;    /* optional */
     }
 
     /* do any necessary key pre-processing */
-    if (retval = krb5_process_key(&eblock, key)) {
+    if (retval = krb5_process_key(context, &eblock, key)) {
         cleanup_credmsg();
        cleanup_scratch();
        return retval;
     }
     
-#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(context, &eblock);}
     
     /* call the decryption routine */
-    if (retval = krb5_decrypt((krb5_pointer) credmsg->enc_part.ciphertext.data,
+    if (retval = krb5_decrypt(context, (krb5_pointer) credmsg->enc_part.ciphertext.data,
                              (krb5_pointer) scratch->data,
                              scratch->length, &eblock,
                              0)) {
@@ -122,7 +123,7 @@ const krb5_address *recv_addr;    /* optional */
 
     cleanup_credmsg();
 
-    if (retval = krb5_finish_key(&eblock)) {
+    if (retval = krb5_finish_key(context, &eblock)) {
         cleanup_scratch();
         return retval;
     }
@@ -136,7 +137,7 @@ const krb5_address *recv_addr;    /* optional */
 
 #define cleanup_mesg() {(void)krb5_xfree(credmsg_enc_part);}
 
-    if (retval = krb5_timeofday(&currenttime)) {
+    if (retval = krb5_timeofday(context, &currenttime)) {
        cleanup_mesg();
        return retval;
     }
@@ -146,13 +147,13 @@ const krb5_address *recv_addr;    /* optional */
     }
 
     if (sender_addr && credmsg_enc_part->s_address &&
-       !krb5_address_compare(sender_addr, 
+       !krb5_address_compare(context, sender_addr, 
                              credmsg_enc_part->s_address)) {
        cleanup_mesg();
        return KRB5KRB_AP_ERR_BADADDR;
     }
     if (recv_addr && credmsg_enc_part->r_address &&
-       !krb5_address_compare(recv_addr, 
+       !krb5_address_compare(context, recv_addr, 
                              credmsg_enc_part->r_address)) {
        cleanup_mesg();
        return KRB5KRB_AP_ERR_BADADDR;
@@ -165,27 +166,27 @@ const krb5_address *recv_addr;    /* optional */
            cleanup_mesg();
            return retval;
        }
-       if (!krb5_address_search(credmsg_enc_part->r_address, 
+       if (!krb5_address_search(context, credmsg_enc_part->r_address, 
                                 our_addrs)) {
-           krb5_free_addresses(our_addrs);
+           krb5_free_addresses(context, our_addrs);
            cleanup_mesg();
            return KRB5KRB_AP_ERR_BADADDR;
        }
-       krb5_free_addresses(our_addrs);
+       krb5_free_addresses(context, our_addrs);
     }
 
-    if (retval = krb5_copy_principal(credmsg_enc_part->ticket_info[0]->client,
+    if (retval = krb5_copy_principal(context, credmsg_enc_part->ticket_info[0]->client,
                                     &creds->client)) {
        return(retval);
     }
 
-    if (retval = krb5_copy_principal(credmsg_enc_part->ticket_info[0]->server,
+    if (retval = krb5_copy_principal(context, credmsg_enc_part->ticket_info[0]->server,
                                     &creds->server)) {
        return(retval);
     }  
 
     if (retval =
-       krb5_copy_keyblock_contents(credmsg_enc_part->ticket_info[0]->session, 
+       krb5_copy_keyblock_contents(context, credmsg_enc_part->ticket_info[0]->session, 
                                    &creds->keyblock)) {
        return(retval);
     }
@@ -200,7 +201,7 @@ const krb5_address *recv_addr;    /* optional */
     creds->is_skey = FALSE;
     creds->ticket_flags = credmsg_enc_part->ticket_info[0]->flags;
 
-    if (retval = krb5_copy_addresses(credmsg_enc_part->ticket_info[0]->caddrs,
+    if (retval = krb5_copy_addresses(context, credmsg_enc_part->ticket_info[0]->caddrs,
                                     &creds->addresses)) {
        clean();
        return(retval);
index 70c31a27554fe208827454c33567daaeb3a15895..c30310d94886d84c79ebad7758e08d768d635d78 100644 (file)
  */
 
 krb5_error_code
-krb5_rd_error( enc_errbuf, dec_error)
-const krb5_data *enc_errbuf;
-krb5_error **dec_error;
+krb5_rd_error(context,  enc_errbuf, dec_error)
+    krb5_context context;
+    const krb5_data *enc_errbuf;
+    krb5_error **dec_error;
 {
     if (!krb5_is_krb_error(enc_errbuf))
        return KRB5KRB_AP_ERR_MSG_TYPE;
index 78da0553f1906ba12e0c67306e7ce5f0b0175301..08cda457e46bfa72f28cd38fedc3039b5c3f2317 100644 (file)
@@ -56,24 +56,18 @@ Returns system errors, integrity errors.
 */
 
 krb5_error_code
-krb5_rd_priv(DECLARG(const krb5_data *, inbuf),
-            DECLARG(const krb5_keyblock *, key),
-            DECLARG(const krb5_address *, sender_addr),
-            DECLARG(const krb5_address *, recv_addr),
-            DECLARG(krb5_int32, seq_number),
-            DECLARG(krb5_int32, priv_flags),
-            DECLARG(krb5_pointer, i_vector),
-            DECLARG(krb5_rcache, rcache),
-            DECLARG(krb5_data *, outbuf))
-OLDDECLARG(const krb5_data *, inbuf)
-OLDDECLARG(const krb5_keyblock *, key)
-OLDDECLARG(const krb5_address *, sender_addr)
-OLDDECLARG(const krb5_address *, recv_addr)
-OLDDECLARG(krb5_int32, seq_number)
-OLDDECLARG(krb5_int32, priv_flags)
-OLDDECLARG(krb5_pointer, i_vector)
-OLDDECLARG(krb5_rcache, rcache)
-OLDDECLARG(krb5_data *, outbuf)
+krb5_rd_priv(context, inbuf, key, sender_addr, recv_addr, seq_number,
+            priv_flags, i_vector, rcache, outbuf)
+    krb5_context context;
+    const krb5_data * inbuf;
+    const krb5_keyblock * key;
+    const krb5_address * sender_addr;
+    const krb5_address * recv_addr;
+    krb5_int32 seq_number;
+    krb5_int32 priv_flags;
+    krb5_pointer i_vector;
+    krb5_rcache rcache;
+    krb5_data * outbuf;
 {
     krb5_error_code retval;
     krb5_encrypt_block eblock;
@@ -97,7 +91,7 @@ OLDDECLARG(krb5_data *, outbuf)
                           
     /* put together an eblock for this decryption */
 
-    krb5_use_cstype(&eblock, privmsg->enc_part.etype);
+    krb5_use_cstype(context, &eblock, privmsg->enc_part.etype);
     scratch.length = privmsg->enc_part.ciphertext.length;
     
     if (!(scratch.data = malloc(scratch.length))) {
@@ -108,16 +102,16 @@ OLDDECLARG(krb5_data *, outbuf)
 #define cleanup_scratch() {(void)memset(scratch.data, 0, scratch.length); (void)krb5_xfree(scratch.data);}
 
     /* do any necessary key pre-processing */
-    if (retval = krb5_process_key(&eblock, key)) {
+    if (retval = krb5_process_key(context, &eblock, key)) {
         cleanup_privmsg();
        cleanup_scratch();
        return retval;
     }
 
-#define cleanup_prockey() {(void) krb5_finish_key(&eblock);}
+#define cleanup_prockey() {(void) krb5_finish_key(context, &eblock);}
 
     /* call the decryption routine */
-    if (retval = krb5_decrypt((krb5_pointer) privmsg->enc_part.ciphertext.data,
+    if (retval = krb5_decrypt(context, (krb5_pointer) privmsg->enc_part.ciphertext.data,
                              (krb5_pointer) scratch.data,
                              scratch.length, &eblock,
                              i_vector)) {
@@ -141,7 +135,7 @@ OLDDECLARG(krb5_data *, outbuf)
 
     cleanup_privmsg();
 
-    if (retval = krb5_finish_key(&eblock)) {
+    if (retval = krb5_finish_key(context, &eblock)) {
         cleanup_scratch();
         return retval;
     }
@@ -159,7 +153,7 @@ OLDDECLARG(krb5_data *, outbuf)
     if (!(priv_flags & KRB5_PRIV_NOTIME)) {
        krb5_donot_replay replay;
 
-       if (retval = krb5_timeofday(&currenttime)) {
+       if (retval = krb5_timeofday(context, &currenttime)) {
            cleanup_data();
            cleanup_mesg();
            return retval;
@@ -175,7 +169,7 @@ OLDDECLARG(krb5_data *, outbuf)
            cleanup_mesg();  
            return KRB5_RC_REQUIRED;
        }
-       if (retval = krb5_gen_replay_name(sender_addr, "_priv",
+       if (retval = krb5_gen_replay_name(context, sender_addr, "_priv",
                                          &replay.client)) {
            cleanup_data();
            cleanup_mesg();  
@@ -184,7 +178,7 @@ OLDDECLARG(krb5_data *, outbuf)
        replay.server = "";             /* XXX */
        replay.cusec = privmsg_enc_part->usec;
        replay.ctime = privmsg_enc_part->timestamp;
-       if (retval = krb5_rc_store(rcache, &replay)) {
+       if (retval = krb5_rc_store(context, rcache, &replay)) {
            krb5_xfree(replay.client);
            cleanup_data();
            cleanup_mesg();  
@@ -200,7 +194,7 @@ OLDDECLARG(krb5_data *, outbuf)
            return KRB5KRB_AP_ERR_BADORDER;
        }
 
-    if (!krb5_address_compare(sender_addr, privmsg_enc_part->s_address)) {
+    if (!krb5_address_compare(context, sender_addr, privmsg_enc_part->s_address)) {
        cleanup_data();
        cleanup_mesg();
        return KRB5KRB_AP_ERR_BADADDR;
@@ -208,7 +202,7 @@ OLDDECLARG(krb5_data *, outbuf)
     
     if (privmsg_enc_part->r_address) {
        if (recv_addr) {
-           if (!krb5_address_compare(recv_addr,
+           if (!krb5_address_compare(context, recv_addr,
                                      privmsg_enc_part->r_address)) {
                cleanup_data();
                cleanup_mesg();
@@ -222,13 +216,13 @@ OLDDECLARG(krb5_data *, outbuf)
                cleanup_mesg();
                return retval;
            }
-           if (!krb5_address_search(privmsg_enc_part->r_address, our_addrs)) {
-               krb5_free_addresses(our_addrs);
+           if (!krb5_address_search(context, privmsg_enc_part->r_address, our_addrs)) {
+               krb5_free_addresses(context, our_addrs);
                cleanup_data();
                cleanup_mesg();
                return KRB5KRB_AP_ERR_BADADDR;
            }
-           krb5_free_addresses(our_addrs);
+           krb5_free_addresses(context, our_addrs);
        }
     }
 
index bbd84809012fe786a962032e1e0295fa86a260bc..13a49c7409514b17af7ab6e34f115c82c577f36a 100644 (file)
  */
 
 krb5_error_code
-krb5_rd_rep(inbuf, kblock, repl)
-const krb5_data *inbuf;
-const krb5_keyblock *kblock;
-krb5_ap_rep_enc_part **repl;
+krb5_rd_rep(context, inbuf, kblock, repl)
+    krb5_context context;
+    const krb5_data *inbuf;
+    const krb5_keyblock *kblock;
+    krb5_ap_rep_enc_part **repl;
 {
     krb5_error_code retval;
     krb5_ap_rep *reply;
@@ -66,37 +67,37 @@ krb5_ap_rep_enc_part **repl;
     /* put together an eblock for this encryption */
 
     if (!valid_etype(reply->enc_part.etype)) {
-       krb5_free_ap_rep(reply);
+       krb5_free_ap_rep(context, reply);
        return KRB5_PROG_ETYPE_NOSUPP;
     }
-    krb5_use_cstype(&eblock, reply->enc_part.etype);
+    krb5_use_cstype(context, &eblock, reply->enc_part.etype);
 
     scratch.length = reply->enc_part.ciphertext.length;
     if (!(scratch.data = malloc(scratch.length))) {
-       krb5_free_ap_rep(reply);
+       krb5_free_ap_rep(context, reply);
        return(ENOMEM);
     }
 
     /* do any necessary key pre-processing */
-    if (retval = krb5_process_key(&eblock, kblock)) {
+    if (retval = krb5_process_key(context, &eblock, kblock)) {
     errout:
        free(scratch.data);
-       krb5_free_ap_rep(reply);
+       krb5_free_ap_rep(context, reply);
        return(retval);
     }
 
     /* call the encryption routine */
-    if (retval = krb5_decrypt((krb5_pointer) reply->enc_part.ciphertext.data,
+    if (retval = krb5_decrypt(context, (krb5_pointer) reply->enc_part.ciphertext.data,
                              (krb5_pointer) scratch.data,
                              scratch.length, &eblock, 0)) {
-       (void) krb5_finish_key(&eblock);
+       (void) krb5_finish_key(context, &eblock);
        goto errout;
     }
 #define clean_scratch() {memset(scratch.data, 0, scratch.length); \
 free(scratch.data);}
     /* finished with the top-level encoding of the ap_rep */
-    krb5_free_ap_rep(reply);
-    if (retval = krb5_finish_key(&eblock)) {
+    krb5_free_ap_rep(context, reply);
+    if (retval = krb5_finish_key(context, &eblock)) {
 
        clean_scratch();
        return retval;
index 97fd82bcb3f063572029e516b652b3828b3194ee..5ec3758cfc349962a3d633bb899afcaf27722a23 100644 (file)
@@ -64,16 +64,17 @@ typedef krb5_error_code (*rdreq_key_proc) PROTOTYPE((krb5_pointer,
 #include <krb5/narrow.h>
 
 krb5_error_code
-krb5_rd_req(inbuf, server, sender_addr, fetchfrom, keyproc, keyprocarg,
-           rcache, authdat)
-const krb5_data *inbuf;
-krb5_const_principal server;
-const krb5_address *sender_addr;
-const char * fetchfrom;
-rdreq_key_proc keyproc;
-krb5_pointer keyprocarg;
-krb5_rcache rcache;
-krb5_tkt_authent **authdat;
+krb5_rd_req(context, inbuf, server, sender_addr, fetchfrom, keyproc, 
+           keyprocarg, rcache, authdat)
+    krb5_context context;
+    const krb5_data *inbuf;
+    krb5_const_principal server;
+    const krb5_address *sender_addr;
+    const char * fetchfrom;
+    krb5_rdreq_key_proc keyproc;
+    krb5_pointer keyprocarg;
+    krb5_rcache rcache;
+    krb5_tkt_authent **authdat;
 {
     krb5_error_code retval;
     krb5_ap_req *request;
@@ -94,9 +95,10 @@ krb5_tkt_authent **authdat;
 
     }
 
-    retval = krb5_rd_req_decoded(request, server, sender_addr, fetchfrom,
-                                keyproc, keyprocarg, rcache, authdat);
-    krb5_free_ap_req(request);
+    retval = krb5_rd_req_decoded(context, request, server, sender_addr, 
+                                fetchfrom, keyproc, keyprocarg, rcache, 
+                                authdat);
+    krb5_free_ap_req(context, request);
     return retval;
 }
 
index fc3a0f801bd9e6b58e90cdc6917e24d9e6993a1e..463970763cf412108210ddf00213a0ba34a423f0 100644 (file)
 #include <krb5/widen.h>
 
 static krb5_error_code decrypt_authenticator
-       PROTOTYPE((const krb5_ap_req *, krb5_authenticator **));
+       PROTOTYPE((krb5_context, const krb5_ap_req *, krb5_authenticator **));
 typedef krb5_error_code (*rdreq_key_proc)
-       PROTOTYPE((krb5_pointer, krb5_principal, krb5_kvno, krb5_keyblock **));
+       PROTOTYPE((krb5_context, krb5_pointer, krb5_principal,
+                  krb5_kvno, krb5_keyblock **));
 
 /* and back to normal... */
 #include <krb5/narrow.h>
@@ -77,23 +78,24 @@ extern krb5_deltat krb5_clockskew;
 #define in_clock_skew(date) (abs((date)-currenttime) < krb5_clockskew)
 
 krb5_error_code
-krb5_rd_req_decoded(req, server, sender_addr, fetchfrom, keyproc, keyprocarg,
-                   rcache, authdat)
-const krb5_ap_req *req;
-krb5_const_principal server;
-const krb5_address *sender_addr;
-const char * fetchfrom;
-rdreq_key_proc keyproc;
-krb5_pointer keyprocarg;
-krb5_rcache rcache;
-krb5_tkt_authent **authdat;
+krb5_rd_req_decoded(context, req, server, sender_addr, fetchfrom, keyproc,
+                   keyprocarg, rcache, authdat)
+    krb5_context context;
+    const krb5_ap_req *req;
+    krb5_const_principal server;
+    const krb5_address *sender_addr;
+    const char * fetchfrom;
+    rdreq_key_proc keyproc;
+    krb5_pointer keyprocarg;
+    krb5_rcache rcache;
+    krb5_tkt_authent **authdat;
 {
     krb5_error_code retval = 0;
     krb5_keyblock *tkt_key = NULL;
     krb5_timestamp currenttime, starttime;
     krb5_tkt_authent   *tktauthent = NULL;
 
-    if (server && !krb5_principal_compare(server, req->ticket->server))
+    if (server && !krb5_principal_compare(context, server, req->ticket->server))
        return KRB5KRB_AP_WRONG_PRINC;
 
     /* if (req->ap_options & AP_OPTS_USE_SESSION_KEY)
@@ -101,7 +103,7 @@ krb5_tkt_authent **authdat;
     
     /* fetch a server key */
     if (keyproc) {
-       retval = (*keyproc)(keyprocarg, req->ticket->server,
+       retval = (*keyproc)(context, keyprocarg, req->ticket->server,
                            req->ticket->enc_part.kvno, &tkt_key);
     } else {
        krb5_keytab keytabid;
@@ -109,18 +111,18 @@ krb5_tkt_authent **authdat;
 
        if (fetchfrom) {
            /* use the named keytab */
-           retval = krb5_kt_resolve(fetchfrom, &keytabid);
+           retval = krb5_kt_resolve(context, fetchfrom, &keytabid);
        } else {
            /* use default keytab */
-           retval = krb5_kt_default(&keytabid);
+           retval = krb5_kt_default(context, &keytabid);
        }
        if (!retval) {
-           retval = krb5_kt_get_entry(keytabid, req->ticket->server,
+           retval = krb5_kt_get_entry(context, keytabid, req->ticket->server,
                                       req->ticket->enc_part.kvno, &ktentry);
-           (void) krb5_kt_close(keytabid);
+           (void) krb5_kt_close(context, keytabid);
            if (!retval) {
-               retval = krb5_copy_keyblock(&ktentry.key, &tkt_key);
-               (void) krb5_kt_free_entry(&ktentry);
+               retval = krb5_copy_keyblock(context, &ktentry.key, &tkt_key);
+               (void) krb5_kt_free_entry(context, &ktentry);
            }
        }
     }
@@ -128,8 +130,8 @@ krb5_tkt_authent **authdat;
        return retval;                  /* some error in getting the key */
 
     /* decrypt the ticket */
-    if (retval = krb5_decrypt_tkt_part(tkt_key, req->ticket)) {
-       krb5_free_keyblock(tkt_key);
+    if (retval = krb5_decrypt_tkt_part(context, tkt_key, req->ticket)) {
+       krb5_free_keyblock(context, tkt_key);
        return(retval);
     }
 
@@ -145,21 +147,22 @@ krb5_tkt_authent **authdat;
     
     memset((char *)tktauthent, 0, sizeof(*tktauthent));
 
-    if (retval = decrypt_authenticator(req, &tktauthent->authenticator))
+    if (retval = decrypt_authenticator(context, req, &tktauthent->authenticator))
        goto cleanup;
     *authdat = NULL;           /* Set authdat to tktauthent when we finish */
 
-    if (!krb5_principal_compare(tktauthent->authenticator->client,
+    if (!krb5_principal_compare(context, tktauthent->authenticator->client,
                                req->ticket->enc_part2->client)) {
        retval = KRB5KRB_AP_ERR_BADMATCH;
        goto cleanup;
     }
-    if (sender_addr && !krb5_address_search(sender_addr, req->ticket->enc_part2->caddrs)) {
+    if (sender_addr && !krb5_address_search(context, sender_addr, req->ticket->enc_part2->caddrs)) {
        retval = KRB5KRB_AP_ERR_BADADDR;
        goto cleanup;
     }
 
-    if (retval = krb5_timeofday(&currenttime))
+    
+    if (retval = krb5_timeofday(context, &currenttime))
        goto cleanup;
     if (!in_clock_skew(tktauthent->authenticator->ctime)) {
        retval = KRB5KRB_AP_ERR_SKEW;
@@ -186,13 +189,13 @@ krb5_tkt_authent **authdat;
     /* No cross-realm tickets */
 
     { char           *lrealm;
-      krb5_data      *realm = krb5_princ_realm(req->ticket->enc_part2->client);
+      krb5_data      *realm = krb5_princ_realm(context, req->ticket->enc_part2->client);
       krb5_transited *trans = &(req->ticket->enc_part2->transited);
 
       /* If the transited list is empty, then we have at most one hop      */
       /* So we also have to check that the client's realm is the local one */
 
-      krb5_get_default_realm(&lrealm);
+      krb5_get_default_realm(context, &lrealm);
       if ((trans->tr_contents.data && trans->tr_contents.data[0]) ||
           strlen(lrealm) != realm->length ||
           memcmp(lrealm, realm->data, strlen(lrealm))) {
@@ -207,7 +210,7 @@ krb5_tkt_authent **authdat;
   
     { int            i;
       krb5_data      lrealm;
-      krb5_data      *realm = krb5_princ_realm(req->ticket->enc_part2->client);
+      krb5_data      *realm = krb5_princ_realm(context, req->ticket->enc_part2->client);
       krb5_transited *trans = &(req->ticket->enc_part2->transited);
   
       /* If the transited list is not empty, then check that all realms */
@@ -215,9 +218,9 @@ krb5_tkt_authent **authdat;
       /* and the local realm.                                           */
   
       if (trans->tr_contents.data && trans->tr_contents.data[0]) {
-        krb5_get_default_realm(&(lrealm.data));
+        krb5_get_default_realm(context, &(lrealm.data));
         lrealm.length = strlen(lrealm.data);
-        retval = krb5_check_transited_list(&(trans->tr_contents), realm,
+        retval = krb5_check_transited_list(context, &(trans->tr_contents), realm,
                                            &lrealm);
         free(lrealm.data);
       }
@@ -233,12 +236,12 @@ krb5_tkt_authent **authdat;
        krb5_donot_replay rep;
 
        tktauthent->ticket = req->ticket;       /* Temporary; allocated below */
-       retval = krb5_auth_to_rep(tktauthent, &rep);
+       retval = krb5_auth_to_rep(context, tktauthent, &rep);
        tktauthent->ticket = 0;                 /* Don't allow cleanup to free
                                                   original ticket.  */
        if (retval)
            goto cleanup;
-       retval = krb5_rc_store(rcache, &rep);
+       retval = krb5_rc_store(context, rcache, &rep);
        krb5_xfree(rep.server);
        krb5_xfree(rep.client);
        if (retval)
@@ -263,12 +266,12 @@ krb5_tkt_authent **authdat;
        retval = KRB5KRB_AP_ERR_TKT_INVALID;
        goto cleanup;
     }
-    retval = krb5_copy_ticket(req->ticket, &tktauthent->ticket);
+    retval = krb5_copy_ticket(context, req->ticket, &tktauthent->ticket);
     
 cleanup:
     if (tktauthent) {
         if (retval) {
-           krb5_free_tkt_authent(tktauthent);
+           krb5_free_tkt_authent(context, tktauthent);
         } else {
            tktauthent->ap_options = req->ap_options;
            *authdat = tktauthent;
@@ -277,18 +280,19 @@ cleanup:
     if (retval && req->ticket->enc_part2) {
        /* only free if we're erroring out...otherwise some
           applications will need the output. */
-        krb5_free_enc_tkt_part(req->ticket->enc_part2);
+        krb5_free_enc_tkt_part(context, req->ticket->enc_part2);
        req->ticket->enc_part2 = NULL;
     }
     if (tkt_key)
-       krb5_free_keyblock(tkt_key);
+       krb5_free_keyblock(context, tkt_key);
     return retval;
 }
 
 static krb5_error_code
-decrypt_authenticator(request, authpp)
-const krb5_ap_req *request;
-krb5_authenticator **authpp;
+decrypt_authenticator(context, request, authpp)
+    krb5_context context;
+    const krb5_ap_req *request;
+    krb5_authenticator **authpp;
 {
     krb5_authenticator *local_auth;
     krb5_error_code retval;
@@ -306,29 +310,29 @@ krb5_authenticator **authpp;
     if (!valid_etype(request->authenticator.etype))
        return KRB5_PROG_ETYPE_NOSUPP;
 
-    krb5_use_cstype(&eblock, request->authenticator.etype);
+    krb5_use_cstype(context, &eblock, request->authenticator.etype);
 
     scratch.length = request->authenticator.ciphertext.length;
     if (!(scratch.data = malloc(scratch.length)))
        return(ENOMEM);
 
     /* do any necessary key pre-processing */
-    if (retval = krb5_process_key(&eblock, sesskey)) {
+    if (retval = krb5_process_key(context, &eblock, sesskey)) {
        free(scratch.data);
        return(retval);
     }
 
     /* call the encryption routine */
-    if (retval = krb5_decrypt((krb5_pointer) request->authenticator.ciphertext.data,
+    if (retval = krb5_decrypt(context, (krb5_pointer) request->authenticator.ciphertext.data,
                              (krb5_pointer) scratch.data,
                              scratch.length, &eblock, 0)) {
-       (void) krb5_finish_key(&eblock);
+       (void) krb5_finish_key(context, &eblock);
        free(scratch.data);
        return retval;
     }
 #define clean_scratch() {memset(scratch.data, 0, scratch.length); \
 free(scratch.data);}
-    if (retval = krb5_finish_key(&eblock)) {
+    if (retval = krb5_finish_key(context, &eblock)) {
 
        clean_scratch();
        return retval;
index e0c110247b238d67dce5ef406f82e28e9313eeb9..24a2515c78bb5752fe098121849e9b2dcd175ea1 100644 (file)
  */
 
 krb5_error_code
-krb5_rd_req_simple(inbuf, server, sender_addr, authdat)
-const krb5_data *inbuf;
-krb5_const_principal server;
-const krb5_address *sender_addr;
-krb5_tkt_authent **authdat;
+krb5_rd_req_simple(context, inbuf, server, sender_addr, authdat)
+    krb5_context context;
+    const krb5_data *inbuf;
+    krb5_const_principal server;
+    const krb5_address *sender_addr;
+    krb5_tkt_authent **authdat;
 {
     krb5_error_code retval;
     krb5_rcache rcache = 0;
 
     if (server) {
-       retval = krb5_get_server_rcache(krb5_princ_component(server, 0),
+       retval = krb5_get_server_rcache(context, 
+                               krb5_princ_component(context, server, 0),
                                        &rcache);
        if (retval)
            goto cleanup;
     }
 
-    retval = krb5_rd_req(inbuf, server, sender_addr, 0, 0, 0,
+    retval = krb5_rd_req(context, inbuf, server, sender_addr, 0, 0, 0,
                         rcache, authdat);
 cleanup:
     if (rcache)
-       krb5_rc_close(rcache);
+       krb5_rc_close(context, rcache);
     return retval;
 }
 
index 33d557227b361bdbc2ea701228e2560c6c7a06cb..1844a6735efe15c0d15d8dd1382978f63f286876 100644 (file)
@@ -47,16 +47,17 @@ extern krb5_deltat krb5_clockskew;
  returns system errors, integrity errors
  */
 krb5_error_code
-krb5_rd_safe(inbuf, key, sender_addr, recv_addr, seq_number, safe_flags,
-            rcache, outbuf)
-const krb5_data *inbuf;
-const krb5_keyblock *key;
-const krb5_address *sender_addr;
-const krb5_address *recv_addr;
-krb5_int32 seq_number;
-krb5_int32 safe_flags;
-krb5_rcache rcache;
-krb5_data *outbuf;
+krb5_rd_safe(context, inbuf, key, sender_addr, recv_addr, seq_number, 
+            safe_flags, rcache, outbuf)
+    krb5_context context;
+    const krb5_data *inbuf;
+    const krb5_keyblock *key;
+    const krb5_address *sender_addr;
+    const krb5_address *recv_addr;
+    krb5_int32 seq_number;
+    krb5_int32 safe_flags;
+    krb5_rcache rcache;
+    krb5_data *outbuf;
 {
     krb5_error_code retval;
     krb5_safe *message;
@@ -71,7 +72,7 @@ krb5_data *outbuf;
     if (retval = decode_krb5_safe(inbuf, &message))
        return retval;
 
-#define cleanup() krb5_free_safe(message)
+#define cleanup() krb5_free_safe(context, message)
 
     if (!valid_cksumtype(message->checksum->checksum_type)) {
        cleanup();
@@ -86,7 +87,7 @@ krb5_data *outbuf;
     if (!(safe_flags & KRB5_SAFE_NOTIME)) {
        krb5_donot_replay replay;
 
-       if (retval = krb5_timeofday(&currenttime)) {
+       if (retval = krb5_timeofday(context, &currenttime)) {
            cleanup();
            return retval;
        }
@@ -100,7 +101,7 @@ krb5_data *outbuf;
            cleanup();
            return KRB5_RC_REQUIRED;
        }
-       if (retval = krb5_gen_replay_name(sender_addr, "_safe",
+       if (retval = krb5_gen_replay_name(context, sender_addr, "_safe",
                                          &replay.client)) {
            cleanup();
            return retval;
@@ -108,7 +109,7 @@ krb5_data *outbuf;
        replay.server = "";             /* XXX */
        replay.cusec = message->usec;
        replay.ctime = message->timestamp;
-       if (retval = krb5_rc_store(rcache, &replay)) {
+       if (retval = krb5_rc_store(context, rcache, &replay)) {
            krb5_xfree(replay.client);
            cleanup();
            return retval;
@@ -122,30 +123,30 @@ krb5_data *outbuf;
            return KRB5KRB_AP_ERR_BADORDER;
        }
 
-    if (!krb5_address_compare(sender_addr, message->s_address)) {
+    if (!krb5_address_compare(context, sender_addr, message->s_address)) {
        cleanup();
        return KRB5KRB_AP_ERR_BADADDR;
     }
 
     if (message->r_address) {
        if (recv_addr) {
-           if (!krb5_address_compare(recv_addr, message->r_address)) {
+           if (!krb5_address_compare(context, recv_addr, message->r_address)) {
                cleanup();
                return KRB5KRB_AP_ERR_BADADDR;
            }
        } else {
            krb5_address **our_addrs;
        
-           if (retval = krb5_os_localaddr(&our_addrs)) {
+           if (retval = krb5_os_localaddr( &our_addrs)) {
                cleanup();
                return retval;
            }
-           if (!krb5_address_search(message->r_address, our_addrs)) {
-               krb5_free_addresses(our_addrs);
+           if (!krb5_address_search(context, message->r_address, our_addrs)) {
+               krb5_free_addresses(context, our_addrs);
                cleanup();
                return KRB5KRB_AP_ERR_BADADDR;
            }
-           krb5_free_addresses(our_addrs);
+           krb5_free_addresses(context, our_addrs);
        }
     }
 
@@ -169,20 +170,20 @@ krb5_data *outbuf;
     message->checksum = his_cksum;
                         
     if (!(our_cksum.contents = (krb5_octet *)
-         malloc(krb5_checksum_size(his_cksum->checksum_type)))) {
+         malloc(krb5_checksum_size(context, his_cksum->checksum_type)))) {
        cleanup();
        return ENOMEM;
     }
 
 #undef cleanup
-#define cleanup() {krb5_free_safe(message); krb5_xfree(our_cksum.contents);}
+#define cleanup() {krb5_free_safe(context, message); krb5_xfree(our_cksum.contents);}
 
-    retval = krb5_calculate_checksum(his_cksum->checksum_type,
+    retval = krb5_calculate_checksum(context, his_cksum->checksum_type,
                                     scratch->data, scratch->length,
                                     (krb5_pointer) key->contents,
                                     key->length, &our_cksum);
     (void) memset((char *)scratch->data, 0, scratch->length);
-    krb5_free_data(scratch);
+    krb5_free_data(context, scratch);
     
     if (retval) {
        cleanup();
@@ -200,10 +201,10 @@ krb5_data *outbuf;
 
     krb5_xfree(our_cksum.contents);
     if (message->s_address)
-       krb5_free_address(message->s_address);
+       krb5_free_address(context, message->s_address);
     if (message->r_address)
-       krb5_free_address(message->r_address);
-    krb5_free_checksum(his_cksum);
+       krb5_free_address(context, message->r_address);
+    krb5_free_checksum(context, his_cksum);
     krb5_xfree(message);
 
     return 0;
index d8fb01eac5372de1a9926af15268d65821402580..3f682d36cc9915c39357e78d20497692de6df95a 100644 (file)
@@ -43,11 +43,13 @@ extern krb5_flags   krb5_kdc_default_options;
 static char *sendauth_version = "KRB5_SENDAUTH_V1.0";
 
 krb5_error_code
-krb5_recvauth(/* IN */
+krb5_recvauth(context, 
+             /* IN */
              fd, appl_version, server, sender_addr, fetch_from,
              keyproc, keyprocarg, rc_type, flags,
              /* OUT */
              seq_number, client, ticket, authent)
+       krb5_context context;
        krb5_pointer    fd;
        char    *appl_version;
        krb5_principal  server;
@@ -85,7 +87,7 @@ krb5_recvauth(/* IN */
            /*
             * First read the sendauth version string and check it.
             */
-           if (retval = krb5_read_message(fd, &inbuf))
+           if (retval = krb5_read_message(context, fd, &inbuf))
                return(retval);
            if (strcmp(inbuf.data, sendauth_version)) {
                krb5_xfree(inbuf.data);
@@ -99,7 +101,7 @@ krb5_recvauth(/* IN */
        /*
         * Do the same thing for the application version string.
         */
-       if (retval = krb5_read_message(fd, &inbuf))
+       if (retval = krb5_read_message(context, fd, &inbuf))
                return(retval);
        if (strcmp(inbuf.data, appl_version)) {
                krb5_xfree(inbuf.data);
@@ -138,7 +140,7 @@ krb5_recvauth(/* IN */
         * Now we actually write the response.  If the response is non-zero,
         * exit with a return value of problem
         */
-       if ((krb5_net_write(*((int *) fd), (char *)&response, 1)) < 0) {
+       if ((krb5_net_write(context, *((int *) fd), (char *)&response, 1)) < 0) {
                return(problem); /* We'll return the top-level problem */
        }
        if (problem)
@@ -150,11 +152,11 @@ krb5_recvauth(/* IN */
        if (!(rcache = (krb5_rcache) malloc(sizeof(*rcache)))) 
                problem = ENOMEM;
        if (!problem) 
-               problem = krb5_rc_resolve_type(&rcache,
+               problem = krb5_rc_resolve_type(context, &rcache,
                                               rc_type ? rc_type : "dfl");
        cachename = NULL;
        if (server) {
-           server_name = krb5_princ_component(server, 0);
+           server_name = krb5_princ_component(context, server, 0);
        } else {
            null_server.data = "default";
            null_server.length = 7;
@@ -167,17 +169,17 @@ krb5_recvauth(/* IN */
            strcpy(cachename, rc_base ? rc_base : "rc_");
            strncat(cachename, server_name->data, server_name->length);
            cachename[server_name->length+strlen(rc_base)] = '\0';
-           problem = krb5_rc_resolve(rcache, cachename);
+           problem = krb5_rc_resolve(context, rcache, cachename);
        }
        if (!problem) {
-               if (krb5_rc_recover(rcache))
+               if (krb5_rc_recover(context, rcache))
                        /*
                         * If the rc_recover didn't work, then try
                         * initializing the replay cache.
                         */
-                       problem = krb5_rc_initialize(rcache, krb5_clockskew);
+                       problem = krb5_rc_initialize(context, rcache, krb5_clockskew);
                if (problem) {
-                       krb5_rc_close(rcache);
+                       krb5_rc_close(context, rcache);
                        rcache = NULL;
                }
        }
@@ -185,8 +187,8 @@ krb5_recvauth(/* IN */
        /*
         * Now, let's read the AP_REQ message and decode it
         */
-       if (retval = krb5_read_message(fd, &inbuf)) {
-               (void) krb5_rc_close(rcache);
+       if (retval = krb5_read_message(context, fd, &inbuf)) {
+               (void) krb5_rc_close(context, rcache);
                if (cachename)
                        free(cachename);
                return(retval);
@@ -194,11 +196,11 @@ krb5_recvauth(/* IN */
        authdat = 0;                    /* so we can tell if we need to
                                           free it later... */
        if (!problem)
-               problem = krb5_rd_req(&inbuf, server, sender_addr, fetch_from,
+               problem = krb5_rd_req(context, &inbuf, server, sender_addr, fetch_from,
                                      keyproc, keyprocarg, rcache, &authdat);
        krb5_xfree(inbuf.data);
        if (rcache)
-           retval = krb5_rc_close(rcache);
+           retval = krb5_rc_close(context, rcache);
        if (!problem && retval)
                problem = retval;
        if (cachename)
@@ -214,7 +216,7 @@ krb5_recvauth(/* IN */
                const   char *message;
 
                memset((char *)&error, 0, sizeof(error));
-               krb5_us_timeofday(&error.stime, &error.susec);
+               krb5_us_timeofday(context, &error.stime, &error.susec);
                error.server = server;
                error.error = problem - ERROR_TABLE_BASE_krb5;
                if (error.error > 127)
@@ -224,7 +226,7 @@ krb5_recvauth(/* IN */
                if (!(error.text.data = malloc(error.text.length)))
                        return(ENOMEM);
                strcpy(error.text.data, message);
-               if (retval = krb5_mk_error(&error, &outbuf)) {
+               if (retval = krb5_mk_error(context, &error, &outbuf)) {
                        free(error.text.data);
                        return(retval);
                }
@@ -233,18 +235,18 @@ krb5_recvauth(/* IN */
                outbuf.length = 0;
                outbuf.data = 0;
        }
-       if (retval = krb5_write_message(fd, &outbuf)) {
+       if (retval = krb5_write_message(context, fd, &outbuf)) {
                if (outbuf.data)
                        krb5_xfree(outbuf.data);
                if (!problem)
-                       krb5_free_tkt_authent(authdat);
+                       krb5_free_tkt_authent(context, authdat);
                return(retval);
        }
        if (problem) {
                /*
                 * We sent back an error, we need to return
                 */
-               if (authdat) krb5_free_tkt_authent(authdat);
+               if (authdat) krb5_free_tkt_authent(context, authdat);
                return(problem);
        }
        /*
@@ -259,9 +261,9 @@ krb5_recvauth(/* IN */
                 * Generate a random sequence number
                 */
                if (seq_number &&
-                   (retval = krb5_generate_seq_number(authdat->ticket->enc_part2->session,
-                                                     seq_number))) {
-                   krb5_free_tkt_authent(authdat);
+                   (retval = krb5_generate_seq_number(context,
+                       authdat->ticket->enc_part2->session, seq_number))) {
+                   krb5_free_tkt_authent(context, authdat);
                    return(retval);
                }
 
@@ -273,15 +275,15 @@ krb5_recvauth(/* IN */
                else
                    repl.seq_number = 0;
 
-               if (retval = krb5_mk_rep(&repl,
+               if (retval = krb5_mk_rep(context, &repl,
                                         authdat->ticket->enc_part2->session,
                                         &outbuf)) {
-                       krb5_free_tkt_authent(authdat);
+                       krb5_free_tkt_authent(context, authdat);
                        return(retval);
                }
-               if (retval = krb5_write_message(fd, &outbuf)) {
+               if (retval = krb5_write_message(context, fd, &outbuf)) {
                        krb5_xfree(outbuf.data);
-                       krb5_free_tkt_authent(authdat);
+                       krb5_free_tkt_authent(context, authdat);
                        return(retval);
                }
                krb5_xfree(outbuf.data);
@@ -293,9 +295,9 @@ krb5_recvauth(/* IN */
         */
        if (client)
            if (retval =
-               krb5_copy_principal(authdat->ticket->enc_part2->client,
+               krb5_copy_principal(context, authdat->ticket->enc_part2->client,
                                    client)) {
-               krb5_free_tkt_authent(authdat);
+               krb5_free_tkt_authent(context, authdat);
                return(retval);
            }
        /*
@@ -311,11 +313,11 @@ krb5_recvauth(/* IN */
        if (ticket)
                *ticket = authdat->ticket;
        else
-               krb5_free_ticket(authdat->ticket);
+               krb5_free_ticket(context, authdat->ticket);
        if (authent)
                *authent = authdat->authenticator;
        else
-               krb5_free_authenticator(authdat->authenticator);
+               krb5_free_authenticator(context, authdat->authenticator);
        krb5_xfree(authdat);
        return 0;
 }
index f2abf2093d7c2c04c17846d333b1f1b3dda4a17d..bc15f66596d10bc5f0a9bf81bc6acd55a4d404ac 100644 (file)
  returns system errors
  */
 krb5_error_code
-krb5_send_tgs(DECLARG(const krb5_flags, kdcoptions),
-             DECLARG(const krb5_ticket_times *,timestruct),
-             DECLARG(const krb5_enctype, etype),
-             DECLARG(const krb5_cksumtype, sumtype),
-             DECLARG(krb5_const_principal, sname),
-             DECLARG(krb5_address * const *, addrs),
-             DECLARG(krb5_authdata * const *,authorization_data),
-             DECLARG(krb5_pa_data * const *, padata),
-             DECLARG(const krb5_data *,second_ticket),
-             DECLARG(krb5_creds *,usecred),
-             DECLARG(krb5_response *,rep))
-OLDDECLARG(const krb5_flags, kdcoptions)
-OLDDECLARG(const krb5_ticket_times *,timestruct)
-OLDDECLARG(const krb5_enctype, etype)
-OLDDECLARG(const krb5_cksumtype, sumtype)
-OLDDECLARG(krb5_const_principal, sname)
-OLDDECLARG(krb5_address * const *, addrs)
-OLDDECLARG(krb5_authdata * const *,authorization_data)
-OLDDECLARG(krb5_pa_data * const *, padata)
-OLDDECLARG(const krb5_data *,second_ticket)
-OLDDECLARG(krb5_creds *,usecred)
-OLDDECLARG(krb5_response *,rep)
+krb5_send_tgs(context, kdcoptions, timestruct, etype, sumtype, sname, addrs,
+             authorization_data, padata, second_ticket, usecred, rep)
+    krb5_context context;
+    const krb5_flags kdcoptions;
+    const krb5_ticket_times * timestruct;
+    const krb5_enctype etype;
+    const krb5_cksumtype sumtype;
+    krb5_const_principal sname;
+    krb5_address * const * addrs;
+    krb5_authdata * const * authorization_data;
+    krb5_pa_data * const * padata;
+    const krb5_data * second_ticket;
+    krb5_creds * usecred;
+    krb5_response * rep;
 {
     krb5_error_code retval;
     krb5_kdc_req tgsreq;
@@ -94,7 +86,7 @@ OLDDECLARG(krb5_response *,rep)
     tgsreq.from = timestruct->starttime;
     tgsreq.till = timestruct->endtime;
     tgsreq.rtime = timestruct->renew_till;
-    if (retval = krb5_timeofday(&time_now))
+    if (retval = krb5_timeofday(context, &time_now))
        return(retval);
     /* XXX we know they are the same size... */
     tgsreq.nonce = (krb5_int32) time_now;
@@ -112,13 +104,12 @@ OLDDECLARG(krb5_response *,rep)
 
        if (retval = encode_krb5_authdata(authorization_data, &scratch))
            return(retval);
-       krb5_use_cstype(&eblock, etype);
+       krb5_use_cstype(context, &eblock, etype);
        tgsreq.authorization_data.etype = etype;
        tgsreq.authorization_data.kvno = 0; /* ticket session key has */
                                            /* no version */
        tgsreq.authorization_data.ciphertext.length =
-           krb5_encrypt_size(scratch->length,
-                             eblock.crypto_entry);
+           krb5_encrypt_size(scratch->length, eblock.crypto_entry);
        /* add padding area, and zero it */
        if (!(scratch->data = realloc(scratch->data,
                                      tgsreq.authorization_data.ciphertext.length))) {
@@ -130,24 +121,24 @@ OLDDECLARG(krb5_response *,rep)
               tgsreq.authorization_data.ciphertext.length - scratch->length);
        if (!(tgsreq.authorization_data.ciphertext.data =
              malloc(tgsreq.authorization_data.ciphertext.length))) {
-           krb5_free_data(scratch);
+           krb5_free_data(context, scratch);
            return ENOMEM;
        }
-       if (retval = krb5_process_key(&eblock, &usecred->keyblock)) {
-           krb5_free_data(scratch);
+       if (retval = krb5_process_key(context, &eblock, &usecred->keyblock)) {
+           krb5_free_data(context, scratch);
            return retval;
        }
        /* call the encryption routine */
-       if (retval = krb5_encrypt((krb5_pointer) scratch->data,
+       if (retval = krb5_encrypt(context, (krb5_pointer) scratch->data,
                                  (krb5_pointer) tgsreq.authorization_data.ciphertext.data,
                                  scratch->length, &eblock, 0)) {
-           (void) krb5_finish_key(&eblock);
+           (void) krb5_finish_key(context, &eblock);
            krb5_xfree(tgsreq.authorization_data.ciphertext.data);
-           krb5_free_data(scratch);
+           krb5_free_data(context, scratch);
            return retval;
        }           
-       krb5_free_data(scratch);
-       if (retval = krb5_finish_key(&eblock)) {
+       krb5_free_data(context, scratch);
+       if (retval = krb5_finish_key(context, &eblock)) {
            krb5_xfree(tgsreq.authorization_data.ciphertext.data);
            return retval;
        }
@@ -176,44 +167,45 @@ OLDDECLARG(krb5_response *,rep)
     retval = encode_krb5_kdc_req_body(&tgsreq, &scratch);
     if (retval) {
        if (sec_ticket)
-           krb5_free_ticket(sec_ticket);
+           krb5_free_ticket(context, sec_ticket);
        cleanup_authdata();
        return(retval);
     }
 
     if (!(ap_checksum.contents = (krb5_octet *)
-         malloc(krb5_checksum_size(sumtype)))) {
+         malloc(krb5_checksum_size(context, sumtype)))) {
        if (sec_ticket)
-           krb5_free_ticket(sec_ticket);
-       krb5_free_data(scratch);
+           krb5_free_ticket(context, sec_ticket);
+       krb5_free_data(context, scratch);
        cleanup_authdata();
        return ENOMEM;
     }
 
-    if (retval = krb5_calculate_checksum(sumtype,
+    if (retval = krb5_calculate_checksum(context, sumtype,
                                         scratch->data,
                                         scratch->length,
                                         (krb5_pointer) usecred->keyblock.contents,
                                         usecred->keyblock.length,
                                         &ap_checksum)) {
        if (sec_ticket)
-           krb5_free_ticket(sec_ticket);
+           krb5_free_ticket(context, sec_ticket);
        krb5_xfree(ap_checksum.contents);
-       krb5_free_data(scratch);
+       krb5_free_data(context, scratch);
        cleanup_authdata();
        return retval;
     }
     /* done with body */
-    krb5_free_data(scratch);
+    krb5_free_data(context, scratch);
 
 #define cleanup() {krb5_xfree(ap_checksum.contents);\
-                  if (sec_ticket) krb5_free_ticket(sec_ticket);}
+                  if (sec_ticket) krb5_free_ticket(context, sec_ticket);}
     /* attach ap_req to the tgsreq */
 
     /*
      * Get an ap_req.
      */
-    if (retval = krb5_mk_req_extended (0L /* no ap options */,
+    if (retval = krb5_mk_req_extended (context,
+                                      0L /* no ap options */,
                                       &ap_checksum,
                                       0L, /* don't need kdc_options for this */
                                       0, /* no initial sequence */
@@ -269,7 +261,7 @@ OLDDECLARG(krb5_response *,rep)
        return(retval);
     }
     if (sec_ticket)
-       krb5_free_ticket(sec_ticket);
+       krb5_free_ticket(context, sec_ticket);
     cleanup_authdata();
     krb5_xfree(combined_padata);
     krb5_xfree(ap_req_padata.contents);
@@ -278,9 +270,10 @@ OLDDECLARG(krb5_response *,rep)
 #define cleanup() {krb5_xfree(ap_checksum.contents);}
 
     /* now send request & get response from KDC */
-    retval = krb5_sendto_kdc(scratch, krb5_princ_realm(sname),
+    retval = krb5_sendto_kdc(context, scratch, 
+                            krb5_princ_realm(context, sname),
                             &rep->response);
-    krb5_free_data(scratch);
+    krb5_free_data(context, scratch);
     cleanup();
     if (retval) {
        return retval;
index 244563e4c705c54fca6445783a37f5a4e95fe97c..ec320698e6eef06d083fbb34d7bfe56aa76f5621 100644 (file)
@@ -45,7 +45,8 @@ extern krb5_flags     krb5_kdc_default_options;
 static char *sendauth_version = "KRB5_SENDAUTH_V1.0";
 
 krb5_error_code
-krb5_sendauth(/* IN */
+krb5_sendauth(context,
+             /* IN */
              fd, appl_version, client, server, ap_req_options,
              checksump,
              /* IN/OUT */
@@ -53,6 +54,7 @@ krb5_sendauth(/* IN */
              /* OUT */
              sequence, newkey,
              error, rep_result)
+       krb5_context context;
        krb5_pointer    fd;
        char    *appl_version;
        krb5_principal  client;
@@ -83,17 +85,17 @@ krb5_sendauth(/* IN */
         */
        outbuf.length = strlen(sendauth_version) + 1;
        outbuf.data = sendauth_version;
-       if (retval = krb5_write_message(fd, &outbuf))
+       if (retval = krb5_write_message(context, fd, &outbuf))
                return(retval);
        outbuf.length = strlen(appl_version) + 1;
        outbuf.data = appl_version;
-       if (retval = krb5_write_message(fd, &outbuf))
+       if (retval = krb5_write_message(context, fd, &outbuf))
                return(retval);
        /*
         * Now, read back a byte: 0 means no error, 1 means bad sendauth
         * version, 2 means bad application version
         */
-       if ((len = krb5_net_read(*((int *) fd), (char *)&result, 1)) != 1)
+       if ((len = krb5_net_read(context, *((int *) fd), (char *)&result, 1)) != 1)
                return((len < 0) ? errno : ECONNABORTED);
        if (result == 1)
                return(KRB5_SENDAUTH_BADAUTHVERS);
@@ -119,19 +121,19 @@ krb5_sendauth(/* IN */
        if (!credsp || !credsp->ticket.length) {
                if (ccache)
                        use_ccache = ccache;
-               else if (retval = krb5_cc_default(&use_ccache))
+               else if (retval = krb5_cc_default(context, &use_ccache))
                        goto error_return;
        }
        if (!credsp) {
-               if (retval = krb5_copy_principal(server, &creds.server))
+               if (retval = krb5_copy_principal(context, server, &creds.server))
                        goto error_return;
                if (client)
-                       retval = krb5_copy_principal(client, &creds.client);
+                       retval = krb5_copy_principal(context, client, &creds.client);
                else
-                       retval = krb5_cc_get_principal(use_ccache,
+                       retval = krb5_cc_get_principal(context, use_ccache,
                                                       &creds.client);
                if (retval) {
-                       krb5_free_principal(creds.server);
+                       krb5_free_principal(context, creds.server);
                        goto error_return;
                }
                /* creds.times.endtime = 0; -- memset 0 takes care of this
@@ -142,7 +144,7 @@ krb5_sendauth(/* IN */
                credsp = &creds;
        }
        if (!credsp->ticket.length) {
-               if (retval = krb5_get_credentials(kdc_options,
+               if (retval = krb5_get_credentials(context, kdc_options,
                                                  use_ccache,
                                                  credsp))
                    goto error_return;
@@ -152,13 +154,13 @@ krb5_sendauth(/* IN */
         * Generate a random sequence number
         */
        if (sequence &&
-           (retval = krb5_generate_seq_number(&credsp->keyblock, sequence))) 
+           (retval = krb5_generate_seq_number(context, &credsp->keyblock, sequence))) 
            goto error_return;
 
        /*
         * OK, get the authentication header!
         */
-       if (retval = krb5_mk_req_extended(ap_req_options, checksump,
+       if (retval = krb5_mk_req_extended(context, ap_req_options, checksump,
                                          kdc_options,
                                          sequence ? *sequence : 0, newkey,
                                          use_ccache, credsp, &authent,
@@ -169,7 +171,7 @@ krb5_sendauth(/* IN */
         * First write the length of the AP_REQ message, then write
         * the message itself.
         */
-       retval = krb5_write_message(fd, &outbuf);
+       retval = krb5_write_message(context, fd, &outbuf);
        free(outbuf.data);
        if (retval)
            goto error_return;
@@ -180,12 +182,12 @@ krb5_sendauth(/* IN */
         * authentication was rejected, and we need to return the
         * error structure.
         */
-       if (retval = krb5_read_message(fd, &inbuf))
+       if (retval = krb5_read_message(context, fd, &inbuf))
            goto error_return;
 
        if (inbuf.length) {
                if (error) {
-                   if (retval = krb5_rd_error(&inbuf, error)) {
+                   if (retval = krb5_rd_error(context, &inbuf, error)) {
                        krb5_xfree(inbuf.data);
                        goto error_return;
                    }
@@ -202,17 +204,17 @@ krb5_sendauth(/* IN */
        if ((ap_req_options & AP_OPTS_MUTUAL_REQUIRED)) {
            krb5_ap_rep_enc_part        *repl = 0;
                
-           if (retval = krb5_read_message(fd, &inbuf))
+           if (retval = krb5_read_message(context, fd, &inbuf))
                goto error_return;
 
-           retval = krb5_rd_rep(&inbuf, &credsp->keyblock, &repl);
+           retval = krb5_rd_rep(context, &inbuf, &credsp->keyblock, &repl);
            krb5_xfree(inbuf.data);
            if (retval || ((repl->ctime != authent.ctime) ||
                           (repl->cusec != authent.cusec)))
                retval = KRB5_SENDAUTH_MUTUAL_FAILED;
            if (retval) {
                if (repl)
-                   krb5_free_ap_rep_enc_part(repl);
+                   krb5_free_ap_rep_enc_part(context, repl);
                goto error_return;
            }
            /*
@@ -222,14 +224,14 @@ krb5_sendauth(/* IN */
            if (rep_result) 
                *rep_result = repl;
            else
-               krb5_free_ap_rep_enc_part(repl);
+               krb5_free_ap_rep_enc_part(context, repl);
        }
        retval = 0;             /* Normal return */
 error_return:
        if (!ccache && use_ccache)
-               krb5_cc_close(use_ccache);
-       krb5_free_cred_contents(&creds);
-       krb5_free_authenticator_contents(&authent);
+               krb5_cc_close(context, use_ccache);
+       krb5_free_cred_contents(context, &creds);
+       krb5_free_authenticator_contents(context, &authent);
        return(retval);
        
 }
index cc397c46439ac0efe050e65c73e94e35d7b9a971..63f5478658abc2b8e2c6cbf8bb62aa43c4eaec88 100644 (file)
 #include <stdio.h>
 
 krb5_error_code
-krb5_get_server_rcache(piece, rcptr)
-const krb5_data *piece;
-krb5_rcache *rcptr;
+krb5_get_server_rcache(context, piece, rcptr)
+    krb5_context context;
+    const krb5_data *piece;
+    krb5_rcache *rcptr;
 {
     krb5_rcache rcache = 0;
     char *cachename = 0;
@@ -46,7 +47,7 @@ krb5_rcache *rcptr;
     if (!rcache)
        return ENOMEM;
     
-    retval = krb5_rc_resolve_type(&rcache, "dfl");
+    retval = krb5_rc_resolve_type(context, &rcache, "dfl");
     if (retval) goto cleanup;
 
     len = piece->length + 3 + 1;
@@ -81,16 +82,16 @@ krb5_rcache *rcptr;
     }
     cachename[p++] = '\0';
 
-    if (retval = krb5_rc_resolve(rcache, cachename))
+    if (retval = krb5_rc_resolve(context, rcache, cachename))
        goto cleanup;
     
     /*
      * First try to recover the replay cache; if that doesn't work,
      * initialize it.
      */
-    if (krb5_rc_recover(rcache)) {
-       if (retval = krb5_rc_initialize(rcache, krb5_clockskew)) {
-           krb5_rc_close(rcache);
+    if (krb5_rc_recover(context, rcache)) {
+       if (retval = krb5_rc_initialize(context, rcache, krb5_clockskew)) {
+           krb5_rc_close(context, rcache);
            rcache = 0;
            goto cleanup;
        }
index b033b36cbf48ee09eb73c233567d340b0c36faf1..e1ced303c56dea45a5dabd0f0112d7a8e269ba29 100644 (file)
@@ -17,7 +17,7 @@ main(argc, argv)
        char *name;
        krb5_error_code retval;
        
-       krb5_init_ets();
+       krb5_init_ets(context);
        
        if (argc < 3 && argc > 4) {
                fprintf(stderr,
@@ -34,7 +34,7 @@ main(argc, argv)
        if (argc == 4)
                realm_branch_char = argv[3][0];
 
-       retval = krb5_walk_realm_tree(&client, &server, &tree,
+       retval = krb5_walk_realm_tree(context, &client, &server, &tree,
                                      realm_branch_char);
        if (retval) {
                com_err("krb5_walk_realm_tree", retval, "");
@@ -42,7 +42,7 @@ main(argc, argv)
        }
 
        for (p = tree; *p; p++) {
-               retval = krb5_unparse_name(*p, &name);
+               retval = krb5_unparse_name(context, *p, &name);
                if (retval) {
                        com_err("krb5_unprase_name", retval, "");
                        exit(2);
@@ -51,7 +51,7 @@ main(argc, argv)
                free(name);
        }
 
-       krb5_free_realm_tree(tree);
+       krb5_free_realm_tree(context, tree);
 
        exit(0);
 }
index b0a2b56d13c89f6a1f4e960bcc297ce0bc04309b..7b342a1b861de05e6a8c26468e58105f8131c75f 100644 (file)
 /* This is an internal-only function, used by krb5_get_cred_from_kdc() */
 
 krb5_error_code
-krb5_tgtname(server, client, tgtprinc)
-const krb5_data *server, *client;
-krb5_principal *tgtprinc;
+krb5_tgtname(context, server, client, tgtprinc)
+    krb5_context context;
+    const krb5_data *server, *client;
+    krb5_principal *tgtprinc;
 {
-    return krb5_build_principal_ext(tgtprinc, client->length, client->data,
+    return krb5_build_principal_ext(context, tgtprinc, client->length, client->data,
                                    KRB5_TGS_NAME_SIZE, KRB5_TGS_NAME, 
                                    server->length, server->data,
                                    0);
index 39380ef201c85331b53eb87274cf399e6eddd7ba..7c29f84bada069a665503d54a3592aed6d47af33 100644 (file)
 #define        COMPONENT_SEP   '/'
 
 krb5_error_code
-krb5_unparse_name_ext(principal, name, size)
-krb5_const_principal principal;
-register char **name;
-int    *size;
+krb5_unparse_name_ext(context, principal, name, size)
+    krb5_context context;
+    krb5_const_principal principal;
+    register char **name;
+    int        *size;
 {
        register char *cp, *q;
        register int i,j;
        int     length, nelem;
        register int totalsize = 0;
 
-       cp = krb5_princ_realm(principal)->data;
-       length = krb5_princ_realm(principal)->length;
+       cp = krb5_princ_realm(context, principal)->data;
+       length = krb5_princ_realm(context, principal)->length;
        totalsize += length;
        for (j = 0; j < length; j++,cp++)
                if (*cp == REALM_SEP  || *cp == COMPONENT_SEP ||
@@ -76,10 +77,10 @@ int *size;
                        totalsize++;
        totalsize++;            /* This is for the separator */
 
-       nelem = krb5_princ_size(principal);
+       nelem = krb5_princ_size(context, principal);
        for (i = 0; i < nelem; i++) {
-               cp = krb5_princ_component(principal, i)->data;
-               length = krb5_princ_component(principal, i)->length;
+               cp = krb5_princ_component(context, principal, i)->data;
+               length = krb5_princ_component(context, principal, i)->length;
                totalsize += length;
                for (j=0; j < length; j++,cp++)
                        if (*cp == REALM_SEP || *cp == COMPONENT_SEP ||
@@ -113,8 +114,8 @@ int *size;
        q = *name;
        
        for (i = 0; i < nelem; i++) {
-               cp = krb5_princ_component(principal, i)->data;
-               length = krb5_princ_component(principal, i)->length;
+               cp = krb5_princ_component(context, principal, i)->data;
+               length = krb5_princ_component(context, principal, i)->length;
                for (j=0; j < length; j++,cp++) {
                    switch (*cp) {
                    case COMPONENT_SEP:
@@ -149,8 +150,8 @@ int *size;
        q--;                    /* Back up last component separator */
        *q++ = REALM_SEP;
        
-       cp = krb5_princ_realm(principal)->data;
-       length = krb5_princ_realm(principal)->length;
+       cp = krb5_princ_realm(context, principal)->data;
+       length = krb5_princ_realm(context, principal)->length;
        for (j=0; j < length; j++,cp++) {
                switch (*cp) {
                case COMPONENT_SEP:
@@ -174,12 +175,13 @@ int       *size;
 }
 
 krb5_error_code
-krb5_unparse_name(principal, name)
-krb5_const_principal principal;
-register char **name;
+krb5_unparse_name(context, principal, name)
+    krb5_context context;
+    krb5_const_principal principal;
+    register char **name;
 {
        *name = NULL;
-       return(krb5_unparse_name_ext(principal, name, NULL));
+       return(krb5_unparse_name_ext(context, principal, name, NULL));
 }
 
 
index 0890f94d8d4b2343068593f90116a8c2eca86ca0..c3170d200161d2099db32036b9c81b3035c5fb33 100644 (file)
 #endif
 
 krb5_error_code
-#ifdef NARROW_PROTOTYPES
-krb5_walk_realm_tree(const krb5_data *client, const krb5_data *server,
-                    krb5_principal **tree, char realm_branch_char)
-#else
-krb5_walk_realm_tree(client, server, tree, realm_branch_char)
-const krb5_data *client, *server;
-krb5_principal **tree;
-char realm_branch_char;
-#endif
+krb5_walk_realm_tree(context, client, server, tree, realm_branch_char)
+    krb5_context context;
+    const krb5_data *client, *server;
+    krb5_principal **tree;
 {
     krb5_error_code retval;
     krb5_principal *rettree;
@@ -135,7 +130,7 @@ char realm_branch_char;
        return ENOMEM;
     }
     i = 1;
-    if (retval = krb5_tgtname(client,
+    if (retval = krb5_tgtname(context, client,
                              client, &rettree[0])) {
        krb5_xfree(rettree);
        return retval;
@@ -152,9 +147,9 @@ char realm_branch_char;
        tmpsrealm.data = ccp;
        tmpsrealm.length = client->length -
            (ccp - client->data);
-       if (retval = krb5_tgtname(&tmpsrealm, &tmpcrealm, &rettree[i])) {
+       if (retval = krb5_tgtname(context, &tmpsrealm, &tmpcrealm, &rettree[i])) {
            while (i) {
-               krb5_free_principal(rettree[i-1]);
+               krb5_free_principal(context, rettree[i-1]);
                i--;
            }
            krb5_xfree(rettree);
@@ -170,9 +165,9 @@ char realm_branch_char;
        tmpsrealm.data = com_sdot + 1;
        tmpsrealm.length = server->length -
            (com_sdot + 1 - server->data);
-       if (retval = krb5_tgtname(&tmpsrealm, &tmpcrealm, &rettree[i])) {
+       if (retval = krb5_tgtname(context, &tmpsrealm, &tmpcrealm, &rettree[i])) {
            while (i) {
-               krb5_free_principal(rettree[i-1]);
+               krb5_free_principal(context, rettree[i-1]);
                i--;
            }
            krb5_xfree(rettree);
@@ -194,9 +189,9 @@ char realm_branch_char;
        tmpsrealm.data = scp + 1;
        tmpsrealm.length = server->length -
            (scp + 1 - server->data);
-       if (retval = krb5_tgtname(&tmpsrealm, &tmpcrealm, &rettree[i])) {
+       if (retval = krb5_tgtname(context, &tmpsrealm, &tmpcrealm, &rettree[i])) {
            while (i) {
-               krb5_free_principal(rettree[i-1]);
+               krb5_free_principal(context, rettree[i-1]);
                i--;
            }
            krb5_xfree(rettree);
@@ -213,10 +208,10 @@ char realm_branch_char;
        tmpcrealm.data = prevscp;
        tmpcrealm.length = server->length -
            (prevscp - server->data);
-       if (retval = krb5_tgtname(server, &tmpcrealm,
+       if (retval = krb5_tgtname(context, server, &tmpcrealm,
                                  &rettree[i])) {
            while (i) {
-               krb5_free_principal(rettree[i-1]);
+               krb5_free_principal(context, rettree[i-1]);
                i--;
            }
            krb5_xfree(rettree);