[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kinit.c patch



This patch (I think) lets kinit read its default ticket type out of
/etc/krb5.conf, reading the same config key that the MIT kinit uses.  At
least, by setting
[libdefaults]
  default_tkt_etypes = des-cbc-crc
it lets me kinit -4 without having to say -e des-cbc-crc

Comments?

-- 

..ooOO chris@chiappa.net              | My opinions are my own  OOoo..
..ooOO Chris.Chiappa@oracle.com       | and certainly not those OOoo..
..ooOO http://www.chiappa.net/~chris/ | of my employer          OOoo..
--- kinit.c.orig	Sat Feb 24 10:54:07 2001
+++ kinit.c	Thu Mar  1 22:15:01 2001
@@ -466,6 +466,26 @@
 	}
 	krb5_get_init_creds_opt_set_etype_list(&opt, enctype, 
 					       etype_str.num_strings);
+    } else {
+        char **adr, **a;
+        krb5_enctype *enctype;
+        int numenc = 0;
+
+        adr = krb5_config_get_strings(context, NULL, "libdefaults",
+                                      "default_tkt_enctypes", NULL);
+        for(a = adr; a && *a; a++)
+            numenc++;
+
+        if(numenc) {
+            enctype = malloc(numenc * sizeof(krb5_enctype));
+            for(numenc = 0, a = adr; a && *a; a++) {
+                ret = krb5_string_to_enctype(context, *a, &enctype[numenc]);
+                if(ret)
+                    errx(1, "unrecognizes enctype: %s", *a);
+                numenc++;
+            }
+            krb5_get_init_creds_opt_set_etype_list(&opt, enctype, numenc);
+        }
     }
 
 #ifdef KRB4