]> git.ipfire.org Git - thirdparty/krb5.git/log
thirdparty/krb5.git
9 years agoFix kadmin min_life check with nonexistent policy 464/head
Greg Hudson [Wed, 8 Jun 2016 04:00:55 +0000 (00:00 -0400)] 
Fix kadmin min_life check with nonexistent policy

In kadmind, self-service key changes require a check against the
policy's min_life field.  If the policy does not exist, this check
should succeed according to the semantics introduced by ticket #7385.
Fix check_min_life() to return 0 if kadm5_get_policy() returns
KADM5_UNK_POLICY.  Reported by John Devitofranceschi.

ticket: 8427
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

9 years agoFix test_check_allowed_to_delegate() leak for real 462/head
Greg Hudson [Thu, 2 Jun 2016 22:21:41 +0000 (18:21 -0400)] 
Fix test_check_allowed_to_delegate() leak for real

Remove the conditional return from so that sprinc and tprinc are
always freed.  Reported by Will Fiveash.

ticket: 8426

9 years agoFix bugs in recent locate_kdc.c change 461/head
Greg Hudson [Thu, 2 Jun 2016 15:58:35 +0000 (11:58 -0400)] 
Fix bugs in recent locate_kdc.c change

The most recent change to locate_srv_conf_1() introduced a possible
double-free bug (detected by Coverity), and also broke MS-KKDCP
support.  Separate the three uses of the "host" variable: the C string
copy of the realm name (now "realmstr"), the pointer to the hostname
or hostname:port specification in the profile values array (now
"hostspec"), and the hostname result of k5_parse_host_string() (still
"host").  Pass the correct pointer to k5_parse_host_string() if the
profile value is a URI.

9 years agoFix leak in test_check_allowed_to_delegate() 460/head
Greg Hudson [Thu, 2 Jun 2016 04:51:11 +0000 (00:51 -0400)] 
Fix leak in test_check_allowed_to_delegate()

sprinc and tprinc must be freed.  Reported by Will Fiveash.

ticket: 8426

9 years agoUse k5_parse_host_string() in locate_kdc.c 459/head
Sarah Day [Tue, 19 Jan 2016 14:47:10 +0000 (09:47 -0500)] 
Use k5_parse_host_string() in locate_kdc.c

[ghudson@mit.edu: made locate_srv_conf_1() error out on port string
with no hostname; split into two commits]

9 years agoAdd k5_parse_host_string()
Sarah Day [Tue, 19 Jan 2016 14:47:10 +0000 (09:47 -0500)] 
Add k5_parse_host_string()

Add a helper function k5_parse_host_string() containing the
hostname-and-port parsing logic currently inlined into
locate_srv_conf_1().  The new function will also accept a port number
without hostname, for parsing listener addresses.

[ghudson@mit.edu: simplified parsing code and better handle edge
cases; split into two commits]

9 years agoFix unlikely pointer error in get_in_tkt.c 450/head
Greg Hudson [Mon, 9 May 2016 17:45:06 +0000 (13:45 -0400)] 
Fix unlikely pointer error in get_in_tkt.c

In add_padata(), reset the caller's pointer and ensure the list is
terminated as soon as realloc() succeeds; otherwise, the old pointer
could be left behind if a later allocation fails.

ticket: 8413 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

9 years agoFix typo in doc/user/tkt_mgmt.rst 458/head
Tom Yu [Tue, 31 May 2016 19:01:21 +0000 (15:01 -0400)] 
Fix typo in doc/user/tkt_mgmt.rst

ticket: 8417
tags: pullup
target_version: 1.14-next
target_version: 1.13-next

9 years agoRelax t_sn2princ.py reverse resolution test 457/head
Tom Yu [Fri, 27 May 2016 19:19:43 +0000 (15:19 -0400)] 
Relax t_sn2princ.py reverse resolution test

Relax t_sn2princ.py check of the reverse resolution of the test
hostname.  The new requirement is that it be different from the
forward resolved hostname.  (There is also an existing implicit
requirement that it be in the mit.edu domain.)  This makes
t_sn2princ.py more robust against changes in the reverse resolution of
the test hostname.

ticket: 8422 (new)
tags: pullup
target_version: 1.14-next
target_version: 1.13-next

9 years agoFix memory leak in LDAP rename 454/head
Greg Hudson [Thu, 26 May 2016 15:18:24 +0000 (11:18 -0400)] 
Fix memory leak in LDAP rename

krb5_ldap_rename_principal() must free bersecretkey.

ticket: 8065

9 years agoAdd SPNEGO special case for NTLMSSP+MechListMIC
Simo Sorce [Wed, 30 Mar 2016 17:00:19 +0000 (13:00 -0400)] 
Add SPNEGO special case for NTLMSSP+MechListMIC

MS-SPNG section 3.3.5.1 documents an odd behavior the SPNEGO layer
needs to implement specifically for the NTLMSSP mechanism.  This is
required for compatibility with Windows services.

ticket: 8423 (new)

9 years agoAvoid setting AS key when OTP preauth fails
Nathaniel McCallum [Thu, 26 May 2016 20:54:29 +0000 (16:54 -0400)] 
Avoid setting AS key when OTP preauth fails

In otp_client_process(), call cb->set_as_key() later in the function
after the OTP request has been created.  The previous position of this
call caused the AS key to be replaced even when later code in the
function failed, preventing other preauth mechanisms from retrieving
the correct AS key.

ticket: 8421 (new)
target_version: 1.14-new
target_version: 1.13-new
tags: pullup

9 years agoClean t_sname_match in lib/krb5/krb 455/head
Tom Yu [Thu, 26 May 2016 20:10:49 +0000 (16:10 -0400)] 
Clean t_sname_match in lib/krb5/krb

Add a missing "$" to t_sname_match$(EXEEXT) in the clean rule in
lib/krb5/krb/Makefile.in.

ticket: 8415

9 years agoDo not indicate deprecated GSS mechanisms
Robbie Harwood [Fri, 20 May 2016 00:31:38 +0000 (20:31 -0400)] 
Do not indicate deprecated GSS mechanisms

The mechanisms themeselves will continue to work if requested, but will
not be included in the gss_indicate_mech() list.  This works around a
bug in some legacy applications that cannot cope with deprecated mechs
being returned.

ticket: 8419 (new)

9 years agoAdd tests for krb5_sname_match() 452/head
Greg Hudson [Thu, 12 May 2016 20:05:46 +0000 (16:05 -0400)] 
Add tests for krb5_sname_match()

ticket: 8415

9 years agoCheck princ length in krb5_sname_match()
Greg Hudson [Thu, 12 May 2016 20:03:06 +0000 (16:03 -0400)] 
Check princ length in krb5_sname_match()

krb5_sname_match() can read past the end of princ's component array in
some circumstances (typically when a keytab contains both "x" and
"x/y" principals).  Add a length check.  Reported by Spencer Jackson.

ticket: 8415
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

9 years agoSimplify principal and policy manipulation code 453/head
Greg Hudson [Tue, 17 May 2016 23:28:25 +0000 (19:28 -0400)] 
Simplify principal and policy manipulation code

Now that principal entry and policy fields are allocated using the
malloc visible to the krb5 libraries, we don't need to use
krb5_db_alloc() and krb5_db_free() when modifying them within our
code.

ticket: 8414

9 years agoUse library malloc for principal, policy entries
Greg Hudson [Tue, 17 May 2016 02:54:06 +0000 (22:54 -0400)] 
Use library malloc for principal, policy entries

Alter the KDB module contract to require that KDB modules use an
allocator compatible with the malloc() seen by libkrb5 and libkdb5.
Change krb5_db_alloc() and krb5_db_free() to provide access to this
allocator.  Remove free_principal, free_policy, alloc, and free from
the KDB interface and from all in-tree KDB modules.

ticket: 8414 (new)

9 years agoImplement principal renaming in LDAP
Sarah Day [Fri, 29 Apr 2016 14:26:31 +0000 (10:26 -0400)] 
Implement principal renaming in LDAP

The generic method of renaming principals (by adding a new entry and
deleting the old one) does not work in LDAP.  Add an LDAP
implementation of rename that properly renames the DN and attributes
when necessary.

[ghudson@mit.edu: minor naming changes and code simplifications]

ticket: 8065

9 years agoAdd new DAL function for renaming principals
Sarah Day [Thu, 31 Mar 2016 21:49:55 +0000 (17:49 -0400)] 
Add new DAL function for renaming principals

Previously libkadm5srv renamed principals by getting the principal
entry, renaming the entry, putting it in the DB, then deleting the old
one.  This does not work in certain KDB modules such as LDAP.  A new
DAL function is necessary to support all KDB modules.  Add a new DAL
function to support custom renames in all KDB modules, with a default
implementation that performs the previous functionality of adding and
deleting the principal entry.

NOTE: if the default rename function isn't used and iprop logging is
enabled, iprop would fail since it doesn't formally support renaming.
In that case, the call to krb5_db_rename_principal() will fail with
the code KRB5_PLUGIN_OP_NOTSUPP.

ticket: 8065

9 years agoAdd libkdb function to specialize principal's salt
Sarah Day [Mon, 2 May 2016 21:06:35 +0000 (17:06 -0400)] 
Add libkdb function to specialize principal's salt

Add a function krb5_dbe_specialize_salt() to libkdb5 which transforms
a principal entry's salt to KRB5_KDB_SALTTYPE_SPECIAL.

ticket: 8418 (new)

9 years agoLink correct VS2015 C libraries for debug builds 449/head
Greg Hudson [Sun, 8 May 2016 15:11:22 +0000 (11:11 -0400)] 
Link correct VS2015 C libraries for debug builds

When building with VS2015 and NODEBUG is not set, link with the
debugging versions of ucrt.lib and vcruntime.lib.  Based on work by
Chris Kingsley.

ticket: 8412 (new)

9 years agoWork around python-ldap bug in kerberos.ldif
Shawn M. Emery [Wed, 27 Apr 2016 05:38:18 +0000 (23:38 -0600)] 
Work around python-ldap bug in kerberos.ldif

Current python-ldap does not correctly tokenize LDIF text if there is
no space before a close parenthesis.

[ghudson@mit.edu: rewrote commit message]

ticket: 8405 (new)

9 years agoRemove non-DFSG documentation 448/head
Tom Yu [Thu, 5 May 2016 00:34:39 +0000 (20:34 -0400)] 
Remove non-DFSG documentation

Also remove obsolete kadmin and kpasswd documentation.

ticket: 8404 (new)

9 years agoFix cstyle-file.py when emacs is not installed 445/head
Greg Hudson [Mon, 2 May 2016 16:51:03 +0000 (12:51 -0400)] 
Fix cstyle-file.py when emacs is not installed

emacs_reindent() is intended to fail gracefully when emacs is not
installed, but instead subprocess.call() throws an OSError.  Check for
this error and return normally.

9 years agoAdd indentation checking to cstyle-file.py 433/head
Greg Hudson [Sun, 3 Apr 2016 16:14:07 +0000 (12:14 -0400)] 
Add indentation checking to cstyle-file.py

For each file we check in cstyle-file.py, try to use emacs to
batch-reindent a copy of the file, and compare the resulting lines to
the input to detect indentation errors.

9 years agoAdd debug message filtering to krb5_klog_syslog 439/head
Greg Hudson [Fri, 22 Apr 2016 18:14:14 +0000 (14:14 -0400)] 
Add debug message filtering to krb5_klog_syslog

Support a new profile relation "debug" in the [logging] section to
indicate whether debugging messages should be included, defaulting to
false.

ticket: 8394 (new)

9 years agoRemove logger.c compile-time syslog conditionals
Greg Hudson [Fri, 22 Apr 2016 15:30:27 +0000 (11:30 -0400)] 
Remove logger.c compile-time syslog conditionals

In logger.c, remove conditionals around uses of syslog.h, syslog(),
openlog(), closelog(), and syslog priority constants.  This header and
these symbols are used unconditionally in other non-Windows parts of
the tree.  Leave the conditionals around facility constants for now,
as not all of the facility constants are specified in POSIX.

9 years agoImprove errors when DB2 database cannot be opened 431/head
Greg Hudson [Mon, 28 Mar 2016 17:48:52 +0000 (13:48 -0400)] 
Improve errors when DB2 database cannot be opened

When we cannot open a DB2 database, set a useful error message.
Change the signature of open_db() to to allow it to return an error
code with a message set.

ticket: 8378
target_version: 1.14-next
tags: pullup

9 years agoSimplify EFTYPE checking in db2 KDB module
Greg Hudson [Mon, 28 Mar 2016 17:29:26 +0000 (13:29 -0400)] 
Simplify EFTYPE checking in db2 KDB module

Create a new macro IS_EFTYPE in policy_db.h, and use it to avoid
preprocessor conditionals in open_db() and osa_adb_open_and_lock().

ticket: 8378

9 years agoUnconstify some krb5 GSS OIDs 444/head
Tom Yu [Thu, 28 Apr 2016 20:44:21 +0000 (16:44 -0400)] 
Unconstify some krb5 GSS OIDs

gssapi_krb5.h declared some well-known OID constants as pointers to
const gss_OID_desc, which can't be assigned to application-declared
gss_OID variables or passed to GSSAPI functions without causing
warnings.

Declare these OID constants without the const qualifier on
gss_OID_desc, at the expense of some type safety.  (Fixing this
"correctly" probably requires some standards revision.)

ticket: 8399 (new)

9 years agoTest KDB authdata and kinit pac options
Greg Hudson [Tue, 5 Apr 2016 04:23:20 +0000 (00:23 -0400)] 
Test KDB authdata and kinit pac options

Add a sign_authdata method to the test KDB module.  Add tests to
t_authdata.py for KDB module authdata and the kinit --request-pac and
--no-request-pac options.

ticket: 7985

9 years agoAdd kinit PAC request options
Andreas Schneider [Thu, 17 Dec 2015 17:54:19 +0000 (18:54 +0100)] 
Add kinit PAC request options

Add --request-pac and --no-request-pac options to kinit, to explicitly
request inclusion or exclusion of PAC authorization data.

ticket: 7985

9 years agoAdd missing newline in kinit usage message
Andreas Schneider [Fri, 1 Apr 2016 07:07:29 +0000 (09:07 +0200)] 
Add missing newline in kinit usage message

There should be a newline after "options:" so that the verbose option
is aligned with other options.

ticket: 8392 (new)
target_version: 1.14-next
tags: pullup

9 years agoAdd krb5_get_init_creds_opt_set_pac_request()
Andreas Schneider [Tue, 1 Dec 2015 17:42:03 +0000 (18:42 +0100)] 
Add krb5_get_init_creds_opt_set_pac_request()

Add a new public function to set a PAC request option for an AS
request.

[ghudson@mit.edu: simplified code; made signature conform to Heimdal
function; expanded on doxygen comment; added new function to API
reference; changed code to send encoded KERB-PA-PAC-REQUEST instead
of a single octet]

ticket: 7985

9 years agoGeneralize request_enc_pa_rep() in get_in_tkt.c
Andreas Schneider [Tue, 1 Dec 2015 17:41:17 +0000 (18:41 +0100)] 
Generalize request_enc_pa_rep() in get_in_tkt.c

In get_in_tkt.c, rename request_enc_pa_rep() to add_padata() and add
pa_type, octets, and length parameters.

[ghudson@mit.edu: used a shorter function name and added a comment;
rewrote commit message]

9 years agoSkip password prompt when running ksu as root
Matt Rogers [Tue, 26 Apr 2016 18:36:55 +0000 (14:36 -0400)] 
Skip password prompt when running ksu as root

A change introduced in 5fd5a67 resulted in root always being prompted for
the target user password when running ksu.  Restore the previous behavior
which is to only prompt if the principal is provided with -n.

ticket: 8396 (new)
target_version: 1.14-next
target_version: 1.13-next

9 years agoAdd tests for kadmin interval parsing and output 438/head
Greg Hudson [Mon, 25 Apr 2016 18:05:34 +0000 (14:05 -0400)] 
Add tests for kadmin interval parsing and output

ticket: 8393

9 years agoImprove kadmin time interval output consistency
Greg Hudson [Mon, 25 Apr 2016 15:40:47 +0000 (11:40 -0400)] 
Improve kadmin time interval output consistency

Use strdur() to output the maximum and minimum password life for
policies, and output "[never]" instead of "[none]" for a zero password
expiration date for consistency with other dates.

ticket: 8393

9 years agoFix minor race in kadmin time interval parsing
Greg Hudson [Fri, 22 Apr 2016 19:23:04 +0000 (15:23 -0400)] 
Fix minor race in kadmin time interval parsing

When parsing kadmin time intervals using getdate.y relative time
formats, make sure the same timestamp is added to and substracted from
the relative value.  To accomplish this, rename get_date() to
get_date_rel() with a second parameter for the current time, and make
get_date() a wrapper with the current signature for the benefit of
kdb5_util and kdb5_ldap_util.

ticket: 8393

9 years agoImprove kadmin parsing of time intervals
Greg Hudson [Tue, 19 Apr 2016 15:33:37 +0000 (11:33 -0400)] 
Improve kadmin parsing of time intervals

When parsing time intervals in kadmin commands, try
krb5_string_to_deltat() first, then fall back to subtracting the
current time from get_date().  If we do fall back, treat "never" as a
zero interval, and error out rather than yield a huge interval if
get_date() returns a time in the past.

Notable behavior differences: bare numbers of seconds and suffixed
numbers (e.g. "5m" or "6h") are now supported for all intervals;
HH:MM:SS and HH:MM are now treated as intervals rather than absolute
times with the current time subtracted.

ticket: 8393

9 years agoAdd test for empty K/M key data handling
Matt Rogers [Fri, 22 Apr 2016 16:53:41 +0000 (12:53 -0400)] 
Add test for empty K/M key data handling

ticket: 8395

9 years agoFix krb5_def_fetch_mkey_list() segfault
Matt Rogers [Fri, 15 Apr 2016 21:27:36 +0000 (17:27 -0400)] 
Fix krb5_def_fetch_mkey_list() segfault

Return KRB5_KDB_NOMASTERKEY if K/M contains no key data, instead of
blindly dereferencing the first key data element.

ticket: 8395 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

9 years agoUpdate copyright years
Tom Yu [Mon, 11 Apr 2016 19:59:56 +0000 (15:59 -0400)] 
Update copyright years

9 years agoDon't fall back to master on password read error 424/head
Greg Hudson [Mon, 14 Mar 2016 15:06:49 +0000 (11:06 -0400)] 
Don't fall back to master on password read error

If a password or other prompted value cannot be read, retrying with
the master KDC is confusing because it prompts again for the same
input.

ticket: 8381 (new)

9 years agoExit quietly from k5test scripts on interrupt
Greg Hudson [Sun, 13 Mar 2016 16:20:43 +0000 (12:20 -0400)] 
Exit quietly from k5test scripts on interrupt

Set up a SIGINT handler in k5test.py to avoid printing a stack trace
or debugging instructions on control-C.

9 years agoSkip unnecessary mech calls in gss_inquire_cred() 418/head
Greg Hudson [Mon, 29 Feb 2016 21:51:22 +0000 (16:51 -0500)] 
Skip unnecessary mech calls in gss_inquire_cred()

If the caller does not request a name, lifetime, or cred_usage when
calling gss_inquire_cred(), service the call by copying the mechanism
list (if requested) but do not call into the mech.

This change alleviates an issue (reported by Adam Bernstein) where
SPNEGO can fail in the presence of expired krb5 credentials rather
than proceeding with a different mechanism, or can resolve a krb5
credential without the benefit of the target name.

ticket: 8373
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

9 years agoAmend KDC hook documentation 430/head
Greg Hudson [Wed, 23 Mar 2016 17:15:58 +0000 (13:15 -0400)] 
Amend KDC hook documentation

In the Doxygen comments for the new APIs and types, include @version
tags indicating that they are new in 1.15, and put @param declarations
just after the brief message for consistency with other comments.

ticket: 8386

9 years agoFix kdb5_ldap_util stashsrvpw password file logic 369/head
Greg Hudson [Wed, 16 Dec 2015 17:51:36 +0000 (12:51 -0500)] 
Fix kdb5_ldap_util stashsrvpw password file logic

kdb5_ldap_util stashsrvpw has several inconsistencies with the
password file determination in libkdb_ldap, and could try to fopen() a
NULL filename in some cases.  Factor out the determination of the
configured password file and make it consistent with libkdb_ldap.
DEF_SERVICE_PASSWD_FILE is no longer used after these changes, as it
is not respected by libkdb_ldap.

Reported by Will Fiveash.

ticket: 8295

9 years agoUse APPVEYOR_BUILD_FOLDER 434/head
Tom Yu [Tue, 5 Apr 2016 20:27:02 +0000 (16:27 -0400)] 
Use APPVEYOR_BUILD_FOLDER

The directory that AppVeyor does checkouts into can vary.  Use the
documented APPVEYOR_BUILD_FOLDER environment variable instead of
hardcoding a value.

9 years agoIntegrate with appveyor for Windows CI 432/head
Greg Hudson [Tue, 29 Mar 2016 22:32:56 +0000 (18:32 -0400)] 
Integrate with appveyor for Windows CI

appveyor.com is a hosted continuous integration service for Windows.
Add an appveyor.yml file containing build instructions.  The appveyor
virtual machines do not include the MFC libraries, so change
util/wshelper/resource.rc to avoid including <afxres.h> (which it does
not need) and add a build conditional for leash.

Right now we do not build the installers; the appveyor VMs do not
appear to have the version of the WiX toolkit we need, and we would
also have problems with the missing leash executable.

9 years agoMove the util/windows getopt to libkrb5support
Matt Rogers [Wed, 24 Feb 2016 21:06:53 +0000 (16:06 -0500)] 
Move the util/windows getopt to libkrb5support

Relocate the internal getopt() and getopt_long() code to util/support,
and build conditionally.  Put declarations in k5-platform.h.  Adjust
Windows build directives for src/clients.  Remove getopt-related #defines
from kinit.c, allowing kinit to use getopt_long() on all platforms.

[ghudson@mit.edu: fix some Windows build issues]

ticket: 8391

9 years agoDefault to LSA when TGT in LSA is inaccessible
Sarah Day [Thu, 18 Feb 2016 21:54:27 +0000 (16:54 -0500)] 
Default to LSA when TGT in LSA is inaccessible

When UAC is enabled and a domain user with Administrator privileges
logs in, the TGT is inaccessible.  Access to the TGT in a
UAC-restricted session may allow a non-elevated user to bypass the
UAC.  In a UAC-restricted session, ms2mit copies the current tickets
from the LSA ccache to the API ccache except the TGT, effectively
preventing a user session from getting additional service tickets
while appearing, for some purposes, to have a usable ccache.

Another bug is that ms2mit always copies from the LSA ccache to the
default ccache, even if the default ccache is itself the LSA ccache.

New behavior:

* If the TGT is accessible in the LSA ccache, copy the LSA ccache to
  the API ccache.

* Set the registry key for the default ccname to "API:" if the copy
  occurred, or to "MSLSA:" if it didn't occur.

[tlyu@mit.edu: edit commit message]

ticket: 8390

9 years agoAdd cleanup label in ms2mit
Sarah Day [Thu, 3 Mar 2016 21:49:06 +0000 (16:49 -0500)] 
Add cleanup label in ms2mit

ticket: 8390 (new)
tags: pullup
target_version: 1.13-next
target_version: 1.14-next

9 years agoFix calling conventions
Tom Yu [Mon, 28 Mar 2016 18:57:10 +0000 (14:57 -0400)] 
Fix calling conventions

Commit fb4d426ddeb9d4802a53dfbd74189ef8eacbe65e added two new APIs but
didn't make the KRB5_CALLCONV decorations consistent between
declarations and definitions.  This broke the build on Windows.

ticket: 8386

9 years agoMake profile includedir accept all *.conf files
Peter Jones [Fri, 26 Feb 2016 14:49:58 +0000 (09:49 -0500)] 
Make profile includedir accept all *.conf files

Since the main config file is krb5.conf, it is intuitive to name
included files with a ".conf" extension; currently such files are
silently ignored.  Accept filenames ending in ".conf" as well as files
with no special characters.

[ghudson@mit.edu: shorten commit message and comment; accept the
filename ".conf" itself for simplicity; add a test; adjust
documentation change to note that allowing .conf is new in 1.15]

ticket: 8389 (new)

9 years agoRemove port 750 from the KDC default ports
Sarah Day [Thu, 14 Jan 2016 18:11:21 +0000 (13:11 -0500)] 
Remove port 750 from the KDC default ports

The KDC was still listening on port 750 despite the fact that
this functionality was supposed to have been removed in the
past.  Remove port 750 from the list of UDP ports that the KDC
listens on.  Also remove port 750 from the default ports that
the client connects to, and from example config fragments.

ticket: 8388 (new)

9 years agoAdd documentation for krb5_error_code
Sarah Day [Fri, 11 Dec 2015 16:46:04 +0000 (11:46 -0500)] 
Add documentation for krb5_error_code

ticket: 8387 (new)
target_version: 1.14-next
tags: pullup

9 years agoFix typo in account lockout error message
Abhijeet Kasurde [Wed, 23 Mar 2016 06:35:17 +0000 (12:05 +0530)] 
Fix typo in account lockout error message

9 years agoAdd tests for send and receive sendto_kdc hooks
Andreas Schneider [Mon, 7 Mar 2016 16:59:07 +0000 (17:59 +0100)] 
Add tests for send and receive sendto_kdc hooks

[ghudson@mit.edu: style changes]

ticket: 8386

9 years agoAdd KDC pre-send and post-receive KDC hooks
Andreas Schneider [Thu, 3 Mar 2016 17:53:31 +0000 (18:53 +0100)] 
Add KDC pre-send and post-receive KDC hooks

Add two new APIs, krb5_set_kdc_send_hook() and
krb5_set_kdc_recv_hook(), which can be used to inspect and override
messages sent to KDCs.

[ghudson@mit.edu: style and documentation changes]

ticket: 8386 (new)

9 years agoFix keytab file format description 427/head
Greg Hudson [Fri, 18 Mar 2016 21:50:02 +0000 (17:50 -0400)] 
Fix keytab file format description

The key length and count of principal components are 16-bit fields.

ticket: 8385 (new)
target_version: 1.14-next
tags: pullup

9 years agoFix LDAP null deref on empty arg [CVE-2016-3119]
Greg Hudson [Mon, 14 Mar 2016 21:26:34 +0000 (17:26 -0400)] 
Fix LDAP null deref on empty arg [CVE-2016-3119]

In the LDAP KDB module's process_db_args(), strtok_r() may return NULL
if there is an empty string in the db_args array.  Check for this case
and avoid dereferencing a null pointer.

CVE-2016-3119:

In MIT krb5 1.6 and later, an authenticated attacker with permission
to modify a principal entry can cause kadmind to dereference a null
pointer by supplying an empty DB argument to the modify_principal
command, if kadmind is configured to use the LDAP KDB module.

    CVSSv2 Vector: AV:N/AC:H/Au:S/C:N/I:N/A:C/E:H/RL:OF/RC:ND

ticket: 8383 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

9 years agoRevisit inquire_attrs_for_mech on old mechs 426/head
Greg Hudson [Tue, 15 Mar 2016 21:45:26 +0000 (17:45 -0400)] 
Revisit inquire_attrs_for_mech on old mechs

In gss_inquire_attrs_for_mech(), if the mech does not implement RFC
5587, return success with empty mech_attrs and known_mech_attrs sets
to indicate a lack of knowledge for all attributes.  The previous
behavior of returning an error caused gss_indicate_mechs_by_attr() to
fail out in the presence of an old mechanism, in turn causing
gss_acquire_cred() and SPNEGO to break.

ticket: 8358

9 years agoAdd auth indicator LDAP KDB tests
Matt Rogers [Mon, 29 Feb 2016 21:41:01 +0000 (16:41 -0500)] 
Add auth indicator LDAP KDB tests

Check the setstr results with an ldapsearch, then verify the getstrs
output.

ticket: 8379

9 years agoAdd auth indicator handling to libkdb_ldap
Matt Rogers [Thu, 25 Feb 2016 19:55:44 +0000 (14:55 -0500)] 
Add auth indicator handling to libkdb_ldap

Have krb5_ldap_put_principal() store individual auth indicator values
in the new krbPrincipalAuthInd attribute, in addition to krbExtraData.
krb5_ldap_get_principal() retrieves auth indicator values from
krbPrincipalAuthInd, which takes precedence over any krbExtraData
entries.

ticket: 8379 (new)

9 years agoRemove hdb KDB module 414/head
Greg Hudson [Thu, 25 Feb 2016 19:41:48 +0000 (14:41 -0500)] 
Remove hdb KDB module

The hdb module has bitrotted, both against our internal interfaces and
against Heimdal's database layer.  It is now possible to dump Heimdal
databases in the MIT krb5 dump format, which is a better option than
bridging between the database layers.

ticket: 8368 (new)

9 years agoAllow zero cksumtype in krb5_k_verify_checksum() 422/head
Greg Hudson [Fri, 4 Mar 2016 18:25:28 +0000 (13:25 -0500)] 
Allow zero cksumtype in krb5_k_verify_checksum()

A checksum type of 0 means to use the mandatory checksum type in
krb5_k_make_checksum(), krb5_k_make_checksum_iov(), and
krb5_k_verify_checksum_iov().  Extend this meaning to
krb5_k_verify_checksum() for the checksum type in the krb5_checksum
argument.  This change also applies to krb5_c_verify_checksum().

Add code to t_cksums.c to test checksum verification, including with
checksum type 0 for applicable test cases.

ticket: 8375 (new)

9 years agoFix assert hygiene in crypto tests
Greg Hudson [Fri, 4 Mar 2016 18:57:19 +0000 (13:57 -0500)] 
Fix assert hygiene in crypto tests

assert() should not be used with expressions with side-effects, as it
can be compiled out with the NDEBUG flag.  Fix all uses of
side-effecting asserts in lib/crypto test programs.

9 years agoUse k5_bcmp() in krb5_k_verify_checksum() 421/head
Greg Hudson [Fri, 4 Mar 2016 18:11:18 +0000 (13:11 -0500)] 
Use k5_bcmp() in krb5_k_verify_checksum()

9 years agoFix Makefiles for VS2010 KfW build 415/head
Tom Yu [Thu, 25 Feb 2016 23:01:36 +0000 (18:01 -0500)] 
Fix Makefiles for VS2010 KfW build

The new Makefile conditionals in commit
4552159e97007a45370dd49fa6b9fb963bb7d160 don't behave properly if
VISUALSTUDIOVERSION isn't set, probably due to the way nmake orders
macro expansion and boolean short circuiting.  Use nested conditionals
instead.

9 years agoFix KDC memory leak on failed S4U2Proxy requests 413/head
Greg Hudson [Thu, 25 Feb 2016 16:27:40 +0000 (11:27 -0500)] 
Fix KDC memory leak on failed S4U2Proxy requests

Make sure to release stkt_server in process_tgs_req() if we fail
before its disposition is determined.  Reported by Will Fiveash.

ticket: 8363
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

9 years agoFix memory leak on error in KDC decrypt_2ndtkt()
Greg Hudson [Thu, 25 Feb 2016 16:19:17 +0000 (11:19 -0500)] 
Fix memory leak on error in KDC decrypt_2ndtkt()

Make sure to release the server principal entry in the cleanup handler
if it is not assigned to the output parameter.  Reported by Will
Fiveash.

ticket: 8362
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

9 years agoInteroperate with incomplete SPNEGO responses
Simo Sorce [Thu, 25 Feb 2016 21:31:09 +0000 (16:31 -0500)] 
Interoperate with incomplete SPNEGO responses

We have found at least one HTTP/Negotiate implementation in Java that
does not set anything but the responseToken field in the first SPNEGO
acceptor response token.  This is technically a violation of RFC 4178
section 4.2.2, but it is harmless to support; we know the mechanism we
were trying to negotiate, and can use that mechanism to process the
token.

These implementations are probably not supporting any real
negotiation, as the missing negState precludes any mechanism
negotiation on failure.  If a supportedMech is included that differs
from the opportunistic one but no negState is provided,
init_ctx_reselect() will fail with GSS_S_DEFECIVE_TOKEN as it should.

[ghudson@mit.edu: edit comments and commit message]

ticket: 8374 (new)

9 years agoFix and adjust t_kprop.py 403/head
Greg Hudson [Wed, 10 Feb 2016 16:50:54 +0000 (11:50 -0500)] 
Fix and adjust t_kprop.py

The listprincs check was at the wrong indentation level and had the
wrong argument grouping; fix it so we actually verify the propagation.

Stop using the -t (runonce) flag to kpropd, so that kpropd continues
to run until k5test.py terminates it.  Quit out of the read loop when
we see that the load process is completed, instead of looking for end
of input.  This change is needed in order to add hooks in k5test.py
for checking daemons for memory leaks before terminating them.

9 years agoUse cached S4U2Proxy tickets in GSSAPI
Isaac Boukris [Mon, 1 Feb 2016 16:08:24 +0000 (18:08 +0200)] 
Use cached S4U2Proxy tickets in GSSAPI

Ticket #7047 allowed credentials obtain using S4U2Proxy through GSSAPI
to be cached, but doesn't actually use the cached credentials.  Modify
get_credentials() to check the cache for the desired client name
first, then to make an S4U2Proxy request if we don't find it.

Test this change by adding code to t_s4u.c to repeat the constrained
delegation request and verify that only three tickets are present in
the cache.

[ghudson@mit.edu: squash commits; commit message rewrite; minor style
edits; changed test code to use gss_store_cred_into() to avoid the
need to pick a principal to initialize the ccache with]

ticket: 8372 (new)

9 years agoImprove libkadm5 server stubs
Simo Sorce [Sun, 20 Dec 2015 22:01:50 +0000 (17:01 -0500)] 
Improve libkadm5 server stubs

Change the server_stubs.c functions to use thread-safe signatures (as
would be output by rpcgen -M).  This change has no immediate impact
since kadmind is single-threaded, but is cleaner because it avoids the
use of static variables.  Factor out some of the common initialization
and cleanup code from the server functions.

[ghudson@mit.edu: rename stub helper functions and reorder/rename
output arguments; error out in stub setup if princ is unexpectedly
null]

9 years agoImprove libkadm5 client RPC thread safety
Simo Sorce [Sun, 20 Dec 2015 22:03:07 +0000 (17:03 -0500)] 
Improve libkadm5 client RPC thread safety

Change the stubs in client_rpc.c to use thread-safe signatures (as
would be output by rpcgen -M), and adjust callers accordingly.

[ghudson@mit.edu: simplify library wrappers; rewrite commit message]

ticket: 8371 (new)

9 years agoUpdate README
Tom Yu [Fri, 8 Jan 2016 23:17:36 +0000 (18:17 -0500)] 
Update README

Add Sarah Day to the list of Kerberos Team members in the README file.

Update lists of Consortium Sponsors and contributors.

[ci skip]

9 years agoUse blocking lock when creating db2 KDB 411/head
Greg Hudson [Tue, 23 Feb 2016 22:15:18 +0000 (17:15 -0500)] 
Use blocking lock when creating db2 KDB

In 1.11 we switched from non-blocking to blocking locks in the DB2
module, but we missed one call to krb5_lock_file() in ctx_create_db().
This non-blocking lock can cause krb5_db_promote() to fail if the
database is locked when we try to promote the DB, in turn causing
kdb5_util load to fail.  Correct this call to make krb5_db_promote()
more robust.

ticket: 8367 (new)
target_version: 1.14-next
target_version: 1.13-next
tags: pullup

9 years agoUpdate man pages
Tom Yu [Tue, 23 Feb 2016 19:49:06 +0000 (14:49 -0500)] 
Update man pages

[ci skip]

9 years agoIncrease initial DNS buffer size 409/head
Greg Hudson [Mon, 22 Feb 2016 21:33:07 +0000 (16:33 -0500)] 
Increase initial DNS buffer size

In dnsglue.c (which is used to look up SRV and TXT records), increase
the initial buffer size guess from 2048 to 4096 to accomodate DNSSEC
signatures.  Suggested by Daniel Colascione.

ticket: 8366 (new)

9 years agoAdd documentation for new kadmin features
Simo Sorce [Sun, 20 Dec 2015 18:56:28 +0000 (13:56 -0500)] 
Add documentation for new kadmin features

Add docs for the new 'extract' acl and for the new 'lockdown_keys'
principal attribute.

ticket: 8365

9 years agoAdd the ability to lock down principal keys
Simo Sorce [Fri, 18 Dec 2015 23:13:29 +0000 (18:13 -0500)] 
Add the ability to lock down principal keys

A new attribute named KRB5_KDC_LOCKDOWN_KEYS can be set on principals.
This flag prevents keys for the principal from being extracted or set
to a known value by the kadmin protocol.  Principals with this flag
cannot be deleted or renamed, and cannot have keys set by setkey or
chpass.  chrand operations are allowed, but keys are not returned.
This attribute can be set via the modify operation but cannot be
reset; an authorization error is resturned if an attempt to reset it
is performed.

When creating a KDB, set the lockdown flag on the krbtgt and kadmin
principals.

[ghudson@mit.edu: squash with t_kadmin_acl.py commit; condense commit
message]

ticket: 8365 (new)

9 years agoAdd get_principal_keys RPC to kadmin
Simo Sorce [Thu, 17 Dec 2015 22:46:16 +0000 (17:46 -0500)] 
Add get_principal_keys RPC to kadmin

Change the prototype of kadm5_get_principal_keys() to report kvno and
salt information along with each key.  Add an RPC for extracting keys,
requiring a new permission bit (which is not implied by 'x' or '*' in
kadm5.acl).  Add kadm5_free_kadm5_key_data().

In kadmin, deconditionalize "kadmin ktadd -norandkey".  Use the new
information from kadm5_get_principal_keys() to correctly set the kvno
for each key when existing keys are extracted, fixing issue #7852.

Add tests to t_keytab.py for the #7852 fix.  Add tests to
lib/kadm5/unit-test for the get_principal_keys RPC.

[ghudson@mit.edu: factor out fetch_new_keys() from add_principal();
rewrite commit message to describe new RPC; add #7852 test cases;
squash with lib/kadm5/unit-test commit]

ticket: 8364 (new)

9 years agoFix and use kadm5 setkey test program
Simo Sorce [Thu, 17 Dec 2015 16:03:53 +0000 (11:03 -0500)] 
Fix and use kadm5 setkey test program

Fix build errors in setkey-test.c and add Makefile rules to build and
run it.  Adjust the kadmin test environment to create the principal
"testkeys" for use by the test-setkey-client rule, and to set
allow_weak_crypto as setkey-test.c sets DES keys.

ticket: 8355

9 years agoRefactor kadm5_setkey_principal_3
Simo Sorce [Thu, 17 Dec 2015 03:56:32 +0000 (22:56 -0500)] 
Refactor kadm5_setkey_principal_3

Reimplement it as a wrapper around kadm5_setkey_principal_4 so that
there are no parallel paths.

ticket: 8355

9 years agoAdd kadm5_setkey_principal_4 RPC to kadmin
Simo Sorce [Tue, 15 Dec 2015 19:49:22 +0000 (14:49 -0500)] 
Add kadm5_setkey_principal_4 RPC to kadmin

This new version of the RPC allows a user to set not only the
keyblocks but also the kvno and the salts of a key.

ticket: 8355 (new)

9 years agoUse DB allocators for default key data encryption
Simo Sorce [Wed, 16 Dec 2015 18:19:27 +0000 (13:19 -0500)] 
Use DB allocators for default key data encryption

krb5_dbe_def_encrypt_key_data() is used by KDB modules as the default
encryption functions.  It deals with structures allocated or freed by
the KDB module, so it needs to use the module's memory allocation
functions.

9 years agoFix compilation issues in udppktinfo.c 408/head
Greg Hudson [Thu, 18 Feb 2016 20:00:04 +0000 (15:00 -0500)] 
Fix compilation issues in udppktinfo.c

Move is_socket_bound_to_wildcard() into an #if block so it doesn't get
built when it isn't used.  Avoid using the identifier "socket" as it
can produce shadowed declaration warnings.  Make the definition of the
fallback send_to_from() conform to the declaration.

9 years agoHarmonize struct packing for gic_opt.c 407/head
Tom Yu [Wed, 17 Feb 2016 20:58:24 +0000 (15:58 -0500)] 
Harmonize struct packing for gic_opt.c

struct extended_options in gic_opt.c extends krb5_get_init_creds_opt.
On Mac OS X, for historical reasons, we define krb5_get_init_creds_opt
with an alignment/packing of 2, conflicting with the compiler default.
This results in alignment change warnings from clang on Mac OS X.
Ensure that extended_options has the same packing.

9 years agoAdd support for IP_SENDSRCADDR for UDP pktinfo
Sarah Day [Thu, 11 Feb 2016 20:39:04 +0000 (15:39 -0500)] 
Add support for IP_SENDSRCADDR for UDP pktinfo

FreeBSD uses IP_RECVDSTADDR and IP_SENDSRCADDR instead of IP_PKTINFO
for IPv4 pktinfo functionality.  Add support for using this when
IP_PKTINFO is not available.

9 years agoRefactor pktinfo code
Sarah Day [Wed, 10 Feb 2016 19:48:44 +0000 (14:48 -0500)] 
Refactor pktinfo code

Move preprocessor conditionals outside of functions and simplify
preprocessor statements in udppktinfo.c.

9 years agoMove pktinfo functions into a new file
Sarah Day [Wed, 10 Feb 2016 17:42:47 +0000 (12:42 -0500)] 
Move pktinfo functions into a new file

Move the functions set_pktinfo(), recv_from_to(), and send_to_from()
out of net_server.c into a new file udppktinfo.c.  The function
setup_udp_pktinfo_ports() will now always try to set the pktinfo
option for the socket on UDP wildcard sockets, and will fallback to
binding to the individual addresses at runtime when pktinfo isn't
supported.

9 years agoUse public OID for interposing several functions
Robbie Harwood [Tue, 12 Jan 2016 20:59:49 +0000 (15:59 -0500)] 
Use public OID for interposing several functions

This resolves an issue where an interposer would receive the private
OID, and be unable to call back into krb5 in the expected manner in
gss_inquire_names_for_mech(), gss_inquire_cred_by_mech(),
gss_localname(), gss_store_cred(), and gss_store_cred_into().

Also change the return code of gss_localname() to GSS_S_BAD_MECH
instead of GSS_S_UNAVAILABLE on mech lookup failure, for consistency
with other functions.

ticket: 8360 (new)

9 years agoEnable interposing gss_inquire_saslname_for_mech
Robbie Harwood [Tue, 12 Jan 2016 16:13:09 +0000 (11:13 -0500)] 
Enable interposing gss_inquire_saslname_for_mech

The behavior of gss_inquire_saslname_for_mech() changes slightly, to
report GSS_S_BAD_MECH when an unsupported mech oid is given.  Also
call map_error() on the minor code resulting from the mech.

Note that gss_inquire_mech_for_saslname() cannot be interposed, as
mech_type is specified as output-only in RFC 5801.

ticket: 8359 (new)

9 years agoReport inquire_attrs_for_mech mech failures
Robbie Harwood [Wed, 27 Jan 2016 23:48:04 +0000 (18:48 -0500)] 
Report inquire_attrs_for_mech mech failures

Previously, gss_inquire_attrs_for_mech() would return a list of mech
attributes that it knew about when given a bad mech oid or a mechanism
which did not provide a gss_inquire_attrs_for_mech() method.  It seems
more useful to just report the failure to the application rather than
allowing it to continue with a faulty mechanism.

ticket: 8358 (new)

9 years agoEnable interposing gss_inquire_attrs_for_mech()
Robbie Harwood [Mon, 11 Jan 2016 22:50:39 +0000 (17:50 -0500)] 
Enable interposing gss_inquire_attrs_for_mech()

Use gssint_select_mech_type() to locate an interposer mechanism, and
pass the public mech OID to the mech.  Also call map_error() on the
resulting minor code.

ticket: 8330 (new)

9 years agoRemove form feed characters 405/head
Greg Hudson [Fri, 12 Feb 2016 16:19:44 +0000 (11:19 -0500)] 
Remove form feed characters

Some older code in the tree uses form feed characters.  kdevelop does
not appear to preserve them, and it is not our current practice to use
them, so get rid of them in almost all files under src.  Leave alone
lib/gssapi/krb5/3des.txt, which is a formatted internet draft.

9 years agoFix populate_krb5_db_entry() princ_ent init 401/head
Greg Hudson [Thu, 4 Feb 2016 22:36:16 +0000 (17:36 -0500)] 
Fix populate_krb5_db_entry() princ_ent init

The most recent commit introduced a new variable princ_ent in
populate_krb5_db_entry().  princ_ent is cleaned up by the function's
cleanup label, so it must be initialized before any "goto cleanup"
statements.

ticket: 5889