Commit Graph

215 Commits

Author SHA1 Message Date
Nicolas Williams
bbaae5f43c Fix 32-bit time_t regression (#220) 2016-12-06 22:44:23 -06:00
Nicolas Williams
7fa85e6d6d Round #3 of scan-build warnings cleanup 2016-11-16 23:27:27 -06:00
Jeffrey Altman
a013e93e95 default life/renewlife time to KDC policy
Instead of imposing a default 10 hour ticket lifetime and 1 month renew
lifetime when requesting tickets, increase the default lifetime and
renew lifetime to 2147483647 seconds.  This ensures that in the absence
of any other configuration or command line parameters that the KDC will
determine the ticket lifetime and renew lifetime.

Change-Id: I52b6eeac1ee830a9bf4d0130e8f4ec7b70bc8694
Signed-off-by: Nicolas Williams <nico@twosigma.com>
2016-11-10 16:13:10 -06:00
Nicolas Williams
b4cf4de807 Fix warnings (clang 3.6) 2016-02-26 01:04:31 -06:00
Nicolas Williams
a449b7ef5e Store default NTLM domain cc config
This is needed so that the NTLM GSS mechanism can have a meaningful
concept of default credential (the NTLM key for the default domain found
in the ccache).
2015-04-17 10:51:51 -05:00
Nicolas Williams
333c6fe95d Fix leak in kinit 2015-03-24 11:50:03 -05:00
Love Hörnquist Åstrand
a84b572747 resurrect password change support again 2014-08-22 20:19:36 -07:00
Viktor Dukhovni
6501ba7e95 Avoid appearance of if if else ambiguity 2014-07-22 18:03:04 -04:00
Viktor Dukhovni
d75e74b2d7 Avoid kinit NPE when default cred not in keytab 2014-07-22 17:57:17 -04:00
Jeffrey Altman
69c2872dbd kinit: get_switched_ccache
Provide a new internal function called get_switched() to encapsulate
the algorithm for selecting a credential cache when the selected
ccache type supports switching.  There is no change in behavior for
UNIX which always calls krb5_cc_new_unique().  However, on Windows
alternate behavior is provided when the ccache type is API or MSLSA.

For the API ccache the default ccache name is stored in the Windows
registry which is shared across all logon sessions belonging to a
user.  For users that are members of the Administrators group this
includes both the UAC restricted and elevated sessions sharing the
same desktop.  It is very disconcerting when the elevated session obtains
credentials for the same client principal as the restricted session
and then all apps in the restricted session lose access to their
credential cache.   For Windows, the API credential caches are named
after the principal that is stored within them.  It provides for a
better end user experience.

For the MSLSA ccache tickets belonging to multiple principals are
all stored within the MSLSA ccache.  As a result, all attempts to
switch ccache names default back to the one and only one name.

Change-Id: I7865cd044cff01ff38ab107ec0961e42788fa073
2014-05-14 21:52:35 -04:00
Viktor Dukhovni
b09e1a137b Use defrealm in last-resort parse of kt principal 2013-10-11 20:54:46 -04:00
Love Hornquist Astrand
1b39c562d5 use STDERR_FILENO instead of 2 2013-09-27 08:24:51 -07:00
Viktor Dukhovni
2ccdebdacc Fix kinit renew vs. new strategy.
The previous code never obtained a new TGT when -l was not used.
2013-09-23 11:02:08 -04:00
Nicolas Williams
129b4f3720 Fix warning in ! NO_AFS case 2013-09-12 12:14:42 -05:00
Nicolas Williams
c9d390acac Don't use "if (!ret)" 2013-09-12 12:14:41 -05:00
Nicolas Williams
8696739102 Add SIGINFO support for kinit cmd
Use SIGUSR1 if there's no SIGINFO, so the code isn't dead.
2013-09-12 12:14:41 -05:00
Nicolas Williams
6d5741d03b kinit cmd: back-off more slowly and warn
Also refactor AFS klog code so we do it only once on renew.
2013-09-12 12:14:41 -05:00
Nicolas Williams
79ca0dfe75 kinit should save cc configs if it krb5_cc_move()s
Also, renew_validate() should krb5_cc_new_unique() and krb5_cc_move() it
into place.
2013-09-12 12:14:41 -05:00
Nicolas Williams
8ce9a1d686 Allow batch mode in kinit with password file 2013-09-12 12:14:41 -05:00
Nicolas Williams
13c8a2c212 Make kinit cmd not exit on transient errors 2013-09-12 12:14:40 -05:00
Viktor Dukhovni
2433496ea6 Simplify user_realm support by removing krb5_parse_name_flags_realm()
and setting the realm as necessary in the caller.
2013-05-16 23:15:00 -04:00
Viktor Dukhovni
3f3bcc2731 When user_realm is used by PAM, do likewise in kinit.
When PAM is configured to use a user_realm that is different from the
default realm, do likewise in kinit with bare user names or the default
principal computed from the login name.

Similarly, when using a keytab, if no realm is specified find the most
suitable match in the keytab file.
2013-05-16 00:32:08 -04:00
Viktor Dukhovni
39516c2fc5 Normalize kinit.c whitespace in preparation for user_realm support patch. 2013-05-02 01:39:22 -04:00
Roland C. Dowdeswell
a952dc2c52 Add -F to kinit for compatibility with MIT Kerberos. 2013-02-02 05:42:05 +08:00
Roland C. Dowdeswell
3ea8da179a Fix renewal/refresh logic when kinit is provided with a command.
1.  in ticket_lifetime() calculate the remaining lifetime
	    of the ticket rather than the requested lifetime.

	2.  in renew_func(), attempt to renew if the tickets are
	    renewable rather than only if --renewable is specified.

	3.  fix the call to renew_validate() in renew_func() to
	    specify renewable tickets if the original tickets are
	    renewable rather than only if --renewable is specified.

	4.  stop printing constant warnings to the terminal about
	    how tickets cannot be obtained if they expire, cannot
	    be renewed and we can't non-interactively obtain fresh
	    ones.  We limit it to a single warning.

	5.  after the tickets expire, we backoff the requests to
	    obtain fresh tickets exponentially.
2012-10-17 01:32:43 +08:00
Roland C. Dowdeswell
635f5ef5b4 Make kinit print ``Password incorrect'' if it gets KRB5_GET_IN_TKT_LOOP. 2012-03-06 09:28:31 +00:00
Roland C. Dowdeswell
cc47c8fa7b Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
We turn on a few extra warnings and fix the fallout that occurs
when building with --enable-developer.  Note that we get different
warnings on different machines and so this will be a work in
progress.  So far, we have built on NetBSD/amd64 5.99.64 (which
uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3).

Notably, we fixed

	1.  a lot of missing structure initialisers,

	2.  unchecked return values for functions that glibc
	    marks as __attribute__((warn-unused-result)),

	3.  made minor modifications to slc and asn1_compile
	    which can generate code which generates warnings,
	    and

	4.  a few stragglers here and there.

We turned off the extended warnings for many programs in appl/ as
they are nearing the end of their useful lifetime, e.g.  rsh, rcp,
popper, ftp and telnet.

Interestingly, glibc's strncmp() macro needed to be worked around
whereas the function calls did not.

We have not yet tried this on 32 bit platforms, so there will be
a few more warnings when we do.
2012-02-20 19:45:41 +00:00
Roland C. Dowdeswell
df73c96b74 Populate creds in get_new_tickets before actually using it.
Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2012-01-29 20:58:12 -08:00
Love Hörnquist Åstrand
1a1bd736c0 merge support for FAST in as-req codepath 2011-10-28 19:25:48 -07:00
Stefan Metzmacher
57300e1482 kuser/kinit: make it possible to use --windows option on its own
metze

Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2011-07-30 11:56:46 -07:00
Love Hornquist Astrand
8a5c96e680 process last request and pass in server name 2011-07-24 20:24:38 -07:00
Love Hornquist Astrand
3f0a3c4795 Add fast armor bits 2011-07-24 20:24:37 -07:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Love Hornquist Astrand
f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
Love Hornquist Astrand
8f2e0a7010 export internal functions so we dont need private headers 2010-11-20 14:05:54 -08:00
Love Hornquist Astrand
ae948e9932 better help for --no-forward 2010-11-04 18:47:44 -07:00
Love Hornquist Astrand
7d710765b6 make -f mean forwardable 2010-11-04 10:21:33 -07:00
Love Hornquist Astrand
a6f9dfc5ad drop krb4 2010-03-16 20:43:24 -07:00
Love Hornquist Astrand
b48abe2e0d default to forwardable, use keychain password, handle krb5_cc_switch 2009-11-22 09:54:22 -08:00
Love Hornquist Astrand
2a369fc7fe Capture failures from krb5_cc_get_principal()
Reported by Guillaume Rousse
2009-10-08 08:19:05 -07:00
Love Hornquist Astrand
ba8b14ebbc use krb5_make_principal 2009-10-04 11:29:29 -07:00
Love Hornquist Astrand
175111efd7 Make renewstr const char * to avoid const warning
Based on a report from Matthias Dieter Wallnöfer.
2009-10-03 11:37:38 -07:00
Love Hornquist Astrand
16cb4ae495 make --pk-enterprise work again 2009-09-29 13:14:50 -07:00
Love Hornquist Astrand
a49d9f3376 use _krb5_get_init_creds_opt_set_pkinit_user_certs 2009-09-29 10:49:08 -07:00
Love Hörnquist Åstrand
abd00160ec use krb5_principal_get_realm
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25113 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-16 08:04:59 +00:00
Love Hörnquist Åstrand
2de7c28777 use krb5_cc_new_unique, use constants for cache types
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25064 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-03 04:08:19 +00:00
Love Hörnquist Åstrand
72f134d145 add change-defaults
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24934 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-03-25 15:35:31 +00:00
Love Hörnquist Åstrand
1403866cae add struct _krb5_krb_auth_data;
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24798 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-22 23:28:47 +00:00
Love Hörnquist Åstrand
c1f55e1376 fix --pk-enterprise to not alias -C
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24634 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-07 04:06:02 +00:00
Love Hörnquist Åstrand
be5c7fd7b0 use _krb5_pk_enterprise_cert
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24617 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-04 22:10:41 +00:00