From: Theodore Tso Date: Thu, 7 Nov 1996 17:07:03 +0000 (+0000) Subject: login.c (destroy_tickets): Just use global kcontext instead X-Git-Tag: krb5-1.0-freeze1~108 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=123472187d20d8c45070c789f26a968747a64319;p=krb5.git login.c (destroy_tickets): Just use global kcontext instead of creating a new krb5 context for no good reason. krshd.c (main): krsh.c (main): krlogind.c (main): krlogin.c (main): krcp.c(main): Check the error return from krb5_init_context(), and print an error message if necessary. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9317 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 1cf3eb8c7..dd7acc02c 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,15 @@ +Wed Nov 6 11:32:36 1996 Theodore Ts'o + + * login.c (destroy_tickets): Just use global kcontext instead + of creating a new krb5 context for no good reason. + + * krshd.c (main): + * krsh.c (main): + * krlogind.c (main): + * krlogin.c (main): + * krcp.c(main): Check the error return from krb5_init_context(), + and print an error message if necessary. + Fri Nov 1 23:11:21 1996 Sam Hartman * login.c: print out system error if -1 returns. diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c index 88b2b76b6..a353e55a0 100644 --- a/src/appl/bsd/krcp.c +++ b/src/appl/bsd/krcp.c @@ -162,8 +162,11 @@ int main(argc, argv) int euid; char **orig_argv = save_argv(argc, argv); - krb5_init_context(&bsd_context); - krb5_init_ets(bsd_context); + status = krb5_init_context(&bsd_context); + if (status) { + com_err(argv[0], status, "while initializing krb5"); + exit(1); + } desinbuf.data = des_inbuf; desoutbuf.data = des_outbuf; /* Set up des buffers */ #endif diff --git a/src/appl/bsd/krlogin.c b/src/appl/bsd/krlogin.c index 2f0c34889..0e51620ff 100644 --- a/src/appl/bsd/krlogin.c +++ b/src/appl/bsd/krlogin.c @@ -472,8 +472,11 @@ main(argc, argv) exit(1); } #ifdef KERBEROS - krb5_init_context(&bsd_context); - krb5_init_ets(bsd_context); + status = krb5_init_context(&bsd_context); + if (status) { + com_err(argv[0], status, "while initializing krb5"); + exit(1); + } desinbuf.data = des_inbuf; desoutbuf.data = des_outpkt+4; /* Set up des buffers */ #endif diff --git a/src/appl/bsd/krlogind.c b/src/appl/bsd/krlogind.c index 2df7c8070..7773de517 100644 --- a/src/appl/bsd/krlogind.c +++ b/src/appl/bsd/krlogind.c @@ -337,17 +337,21 @@ int main(argc, argv) #define LOG_NDELAY 0 #endif -#ifdef KERBEROS - krb5_init_context(&bsd_context); - krb5_init_ets(bsd_context); -#endif - #ifndef LOG_AUTH /* 4.2 syslog */ openlog(progname, LOG_PID | LOG_NDELAY); #else openlog(progname, LOG_PID | LOG_NDELAY, LOG_AUTH); #endif /* 4.2 syslog */ +#ifdef KERBEROS + status = krb5_init_context(&bsd_context); + if (status) { + syslog(LOG_ERR, "Error initializing krb5: %s", + error_message(status)); + exit(1); + } +#endif + /* Analyse parameters. */ opterr = 0; while ((ch = getopt(argc, argv, ARGSTR)) != EOF) diff --git a/src/appl/bsd/krsh.c b/src/appl/bsd/krsh.c index a1cca9c60..a7fabc432 100644 --- a/src/appl/bsd/krsh.c +++ b/src/appl/bsd/krsh.c @@ -333,8 +333,11 @@ main(argc, argv0) } #ifdef KERBEROS - krb5_init_context(&bsd_context); - krb5_init_ets(bsd_context); + status = krb5_init_context(&bsd_context); + if (status) { + com_err(argv[0], status, "while initializing krb5"); + exit(1); + } authopts = AP_OPTS_MUTUAL_REQUIRED; /* Piggy-back forwarding flags on top of authopts; */ diff --git a/src/appl/bsd/krshd.c b/src/appl/bsd/krshd.c index 4f064e9ee..fdbaba8dc 100644 --- a/src/appl/bsd/krshd.c +++ b/src/appl/bsd/krshd.c @@ -270,11 +270,14 @@ int main(argc, argv) #endif /* 4.2 syslog */ #ifdef KERBEROS - krb5_init_context(&bsd_context); - krb5_init_ets(bsd_context); + status = krb5_init_context(&bsd_context); + if (status) { + syslog(LOG_ERR, "Error initializing krb5: %s", + error_message(status)); + exit(1); + } #endif - /* Analyze parameters. */ opterr = 0; while ((ch = getopt(argc, argv, ARGSTR)) != EOF) diff --git a/src/appl/bsd/login.c b/src/appl/bsd/login.c index 26d56348b..dfcecc217 100644 --- a/src/appl/bsd/login.c +++ b/src/appl/bsd/login.c @@ -470,9 +470,14 @@ char realm[REALM_SZ]; void k_init (ttyn) char *ttyn; { - krb5_init_context(&kcontext); - krb5_init_ets(kcontext); -krb5_secure_config_files (kcontext); + krb5_error_code retval; + + retval = krb5_init_context(&kcontext); + if (retval) { + com_err("login", retval, "while initializing krb5"); + exit(1); + } + krb5_secure_config_files (kcontext); login_get_kconf(kcontext); /* Set up the credential cache environment variable */ @@ -990,13 +995,14 @@ destroy_tickets() { krb5_context c; krb5_ccache cache; + krb5_error_code retval; +#ifdef KRB5_GET_TICKETS if (login_krb5_get_tickets) { - krb5_init_context(&c); - krb5_secure_config_files (c); - if(!krb5_cc_default(c, &cache)) - krb5_cc_destroy (c, cache); + if(!krb5_cc_default(kcontext, &cache)) + krb5_cc_destroy (kcontext, cache); } +#endif #ifdef KRB4_GET_TICKETS if (login_krb4_get_tickets||login_krb4_convert) dest_tkt();