krb5.git
15 years agoCopy the sequence key rather than the subkey for lucid contexts in RFC
Sam Hartman [Mon, 18 May 2009 19:08:48 +0000 (19:08 +0000)]
Copy the sequence key rather than the subkey for lucid contexts in RFC
1964 mode, so that we map to raw des enctypes rather than say
des-cbc-crc.

ticket: 6488
target_version: 1.7
tags: pullup

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

15 years agoDocument use of key fields in GSS context
Sam Hartman [Mon, 18 May 2009 19:08:29 +0000 (19:08 +0000)]
Document use of key fields in GSS context

The addition of etype negotiation has made the meanings of the various
keys in the GSS-API context structure more complicated.  Document them
to aid in code understanding.

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

15 years agoAdd IOV_SHIM_EXERCISE_WRAP and IOV_SHIM_EXERCISE_UNWRAP conditionals
Tom Yu [Thu, 14 May 2009 21:04:57 +0000 (21:04 +0000)]
Add IOV_SHIM_EXERCISE_WRAP and IOV_SHIM_EXERCISE_UNWRAP conditionals
to allow finer-grained testing.

ticket: 6487
status: open

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

15 years agogss_krb5int_export_lucid_sec_context was erroneously copying the first
Greg Hudson [Thu, 14 May 2009 16:50:52 +0000 (16:50 +0000)]
gss_krb5int_export_lucid_sec_context was erroneously copying the first
sizeof(void *) bytes of the context into data_set, instead of the
pointer to the context.

ticket: 6488
status: open
tags: pullup
target_version: 1.7

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

15 years agoUCS2 support doesn't handle upper half of BMP
Greg Hudson [Thu, 14 May 2009 16:16:32 +0000 (16:16 +0000)]
UCS2 support doesn't handle upper half of BMP

Make krb5_ucs2 an unsigned type.  Eliminate the need for distinguished
values for ucs2 and ucs4 characters by changing the API of the single-
character conversion routines.

ticket: 6489
tags: pullup
target_version: 1.7

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

15 years agoremove some old code for debugging the debugging code
Ken Raeburn [Thu, 14 May 2009 01:18:43 +0000 (01:18 +0000)]
remove some old code for debugging the debugging code

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

15 years agoIn util/support/utf8_conv.c, the SWAP16 macro is invoked with an
Tom Yu [Wed, 13 May 2009 20:41:37 +0000 (20:41 +0000)]
In util/support/utf8_conv.c, the SWAP16 macro is invoked with an
argument that has side effects.  On platforms where SWAP16 can
evaluate its argument twice (including platforms where utf8_conv.c
creates a fallback definition for the SWAP16 macro), this can cause a
read overrun by a factor of two.

Rearrange the data flow to avoid calling SWAP16 with an argument that
has side effects.

ticket: 6486
tags: pullup
target_version: 1.7

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

15 years agoreduce character-class table entry size (40%) based on limited data ranges; make...
Ken Raeburn [Mon, 11 May 2009 23:34:56 +0000 (23:34 +0000)]
reduce character-class table entry size (40%) based on limited data ranges; make table const

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

15 years agoIn recvauth_common, convert a use of strcpy to strdup
Greg Hudson [Mon, 11 May 2009 22:46:56 +0000 (22:46 +0000)]
In recvauth_common, convert a use of strcpy to strdup

ticket: 6200
status: open

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

15 years agoRefactor rule_an_to_ln, creating a new helper function to handle the
Greg Hudson [Mon, 11 May 2009 16:57:45 +0000 (16:57 +0000)]
Refactor rule_an_to_ln, creating a new helper function to handle the
selection string specifier.  Eliminate two (safe) uses of sscanf in
the process.  Add a test case including literal text in the selection
string specifier.

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

15 years agoTry decrypting using session key if subkey fails in tgs rep handling
Sam Hartman [Thu, 7 May 2009 20:35:28 +0000 (20:35 +0000)]
Try decrypting using session key if subkey fails in tgs rep handling

Heimdal at least up through 1.2 incorrectly encrypts the TGS response
in the session key not the subkey when a subkey is supplied.  See RFC
4120 page 35.  Work around this by trying decryption using the session
key after the subkey fails.

* decode_kdc_rep.c: rename to krb5int_decode_tgs_rep; only used for
  TGS and now needs to take keyusage
* gc_via_tkt: pass in session key and appropriate usage if subkey
  fails.

Note that the dead code to process AS responses in decode_kdc_rep is
not removed by this commit.  That will be removed as FAST TGS client
support is integrated post 1.7.

ticket: 6484
Tags: pullup
Target_Version: 1.7

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

15 years agoman1 in title header for man1 manpages
Sam Hartman [Thu, 7 May 2009 20:35:19 +0000 (20:35 +0000)]
man1 in title header for man1 manpages

A previous ticket moved kadmin, kadmin.local, ktutil and k5srvutil man
pages to man1 from man8.  This updates the section within the man
page.

ticket: 6483
Target_Version: 1.7
Tags: pullup

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

15 years agoAllow more than 10 past keys to be stored by a policy
Greg Hudson [Thu, 7 May 2009 19:51:46 +0000 (19:51 +0000)]
Allow more than 10 past keys to be stored by a policy

Remove the arbitrary limit of 10 past keys in policies.  We were not
taking advantage of that limit in any other code.

ticket: 6482
target_version: 1.7
tags: pullup

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

15 years agoAfter consultation with kenh, remove a comment and if statement which
Greg Hudson [Thu, 7 May 2009 19:42:57 +0000 (19:42 +0000)]
After consultation with kenh, remove a comment and if statement which
should no longer apply to the pa_sam_2 code, fixing a memory leak.

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

15 years agoFix yet another memory leak in pa_sam
Greg Hudson [Wed, 6 May 2009 18:54:47 +0000 (18:54 +0000)]
Fix yet another memory leak in pa_sam

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

15 years agoFix multiple memory leaks in obtain_sam_padata
Greg Hudson [Wed, 6 May 2009 18:53:03 +0000 (18:53 +0000)]
Fix multiple memory leaks in obtain_sam_padata

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

15 years agoIn pa_sam, use the correct function to free sam_challenge in the
Greg Hudson [Wed, 6 May 2009 18:52:44 +0000 (18:52 +0000)]
In pa_sam, use the correct function to free sam_challenge in the
success path.

ticket: 6210

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

15 years agoFix a memory leak in pa_sam_2 where an outer data structure wasn't
Greg Hudson [Wed, 6 May 2009 15:56:21 +0000 (15:56 +0000)]
Fix a memory leak in pa_sam_2 where an outer data structure wasn't
freed after the contents are coopted.

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

15 years agoFix a memory leak in pa_sam
Greg Hudson [Tue, 5 May 2009 17:11:48 +0000 (17:11 +0000)]
Fix a memory leak in pa_sam

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

15 years agoFix a memory leak in krb5_obtain_padata
Greg Hudson [Tue, 5 May 2009 17:08:54 +0000 (17:08 +0000)]
Fix a memory leak in krb5_obtain_padata

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

15 years agoIn pa_sam_2, free sc2 in an error-handling case where it was leaked
Greg Hudson [Tue, 5 May 2009 16:57:42 +0000 (16:57 +0000)]
In pa_sam_2, free sc2 in an error-handling case where it was leaked

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

15 years agoIn pa_sam_2, free scratch in a couple of error-handling blocks where
Greg Hudson [Tue, 5 May 2009 16:55:58 +0000 (16:55 +0000)]
In pa_sam_2, free scratch in a couple of error-handling blocks where
it was live and not freed.  The function should be reorganized to use
a cleanup handler, but (I believe) is not covered by the test suite
and should not undergo such major surgery until it is.

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

15 years agoIn krb5int_rd_setpw_rep, if we get an error result, set ap_rep.length
Greg Hudson [Tue, 5 May 2009 16:46:29 +0000 (16:46 +0000)]
In krb5int_rd_setpw_rep, if we get an error result, set ap_rep.length
to 0 so that it is initialized for a check later in the function.

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

15 years agoRemove some unnecessary null checks in krb5_get_in_tkt_with_password
Greg Hudson [Tue, 5 May 2009 16:39:54 +0000 (16:39 +0000)]
Remove some unnecessary null checks in krb5_get_in_tkt_with_password

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

15 years agoRemove some unnecessary null checks in krb5_get_in_tkt_with_keytab
Greg Hudson [Tue, 5 May 2009 16:35:31 +0000 (16:35 +0000)]
Remove some unnecessary null checks in krb5_get_in_tkt_with_keytab

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

15 years agoIn krb5_get_in_tkt, free the whole encoded request (since the
Greg Hudson [Tue, 5 May 2009 16:30:19 +0000 (16:30 +0000)]
In krb5_get_in_tkt, free the whole encoded request (since the
structure was allocated by encode_krb5_as_req), not just the contents.

ticket: 6401

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

15 years agoFix a case in the krb5_rd_rep error handler (introduced in the last
Greg Hudson [Tue, 5 May 2009 16:00:40 +0000 (16:00 +0000)]
Fix a case in the krb5_rd_rep error handler (introduced in the last
commit) where scratch.data could be indirected through even if it
wasn't allocated successfully.

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

15 years agoSimplify cleanup in obtain_sam_padata slightly
Greg Hudson [Mon, 4 May 2009 19:43:36 +0000 (19:43 +0000)]
Simplify cleanup in obtain_sam_padata slightly

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

15 years agoFix an error message memory leak in krb5_preauth_supply_preauth_data
Greg Hudson [Mon, 4 May 2009 17:16:38 +0000 (17:16 +0000)]
Fix an error message memory leak in krb5_preauth_supply_preauth_data

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

15 years agoFix some direct returns in krb5_get_cred_from_kdc_opt which would leak
Greg Hudson [Mon, 4 May 2009 17:06:43 +0000 (17:06 +0000)]
Fix some direct returns in krb5_get_cred_from_kdc_opt which would leak
memory.

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

15 years agokrb5_rd_rep could leak memory through its output parameter on error.
Greg Hudson [Mon, 4 May 2009 16:08:03 +0000 (16:08 +0000)]
krb5_rd_rep could leak memory through its output parameter on error.
Adjust the flow control so that *repl is NULL on error and the memory
allocated by decode_krb5_ap_rep_enc_part is freed.

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

15 years agoFix formatting of ok_as_delegate documentation in admin guide
Greg Hudson [Sun, 3 May 2009 18:47:27 +0000 (18:47 +0000)]
Fix formatting of ok_as_delegate documentation in admin guide

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

15 years agoFix a memory leak in krb5int_rd_chpw_rep in a block of code handling
Greg Hudson [Sat, 2 May 2009 04:58:19 +0000 (04:58 +0000)]
Fix a memory leak in krb5int_rd_chpw_rep in a block of code handling
buggy MS KDC behavior.  It's not entirely clear what should happen in
the case where memory was leaked (error packet received containing
e_data) so pick a conservative option.

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

15 years agoFix a memory leak by reorganizing krb5_principal_internalize to use
Greg Hudson [Fri, 1 May 2009 20:19:43 +0000 (20:19 +0000)]
Fix a memory leak by reorganizing krb5_principal_internalize to use
the recommended flow control for error handling.  Also initialize the
output parameter so that it is set in case of error.

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

15 years agoCheck return value of ftell() in krb5_ktfileint_find_slot
Greg Hudson [Fri, 1 May 2009 20:11:01 +0000 (20:11 +0000)]
Check return value of ftell() in krb5_ktfileint_find_slot

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

15 years agoMove an error check to an earlier location in krb5_524_conv_principal
Greg Hudson [Fri, 1 May 2009 20:07:13 +0000 (20:07 +0000)]
Move an error check to an earlier location in krb5_524_conv_principal
to fix a memory leak.

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

15 years agomake depend
Sam Hartman [Thu, 30 Apr 2009 20:48:36 +0000 (20:48 +0000)]
make depend

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

15 years agoImplement DES and 3DES PRF. Patch fromKAMADA Ken'ichi
Sam Hartman [Thu, 30 Apr 2009 20:17:42 +0000 (20:17 +0000)]
Implement DES and 3DES PRF. Patch fromKAMADA Ken'ichi

Currently the DES and 3DES PRF output 16-byte results.  This is
consistent with RFC 3961, but we need to confirm it is consistent with
Heimdal and WG decisions.  See IETF 74 minutes for some discussion of
the concern as it applies to AES and thus possibly all simplified
profile enctypes.

ticket: 5587
Tags: pullup

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

15 years agoIn krb5_kt_resolve, ensure that the output parameter is set to NULL on
Greg Hudson [Thu, 30 Apr 2009 17:49:28 +0000 (17:49 +0000)]
In krb5_kt_resolve, ensure that the output parameter is set to NULL on
failure even if the underlying resolver doesn't do that properly.

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

15 years agoIn ktfile_common_resolve, set the output pointer to NULL on error, and
Greg Hudson [Thu, 30 Apr 2009 17:28:55 +0000 (17:28 +0000)]
In ktfile_common_resolve, set the output pointer to NULL on error, and
use a cleanup label instead of freeing the same resources in multiple
error handling blocks.

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

15 years agoFix a memory leak by reorganizing krb5_ktf_keytab_internalize to use
Greg Hudson [Thu, 30 Apr 2009 17:16:20 +0000 (17:16 +0000)]
Fix a memory leak by reorganizing krb5_ktf_keytab_internalize to use
the recommended exception-handling flow control.  Eliminate the check
for ktdata being null after resolution because that's not possible.
Add a check for the resolved keytab being of a different type, since
that would result in data structure corruption.

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

15 years agoUninitialized variable may cause unpredictable behavior in kdc_verify_preauth
Zhanna Tsitkov [Thu, 30 Apr 2009 16:27:08 +0000 (16:27 +0000)]
Uninitialized variable may cause unpredictable behavior in kdc_verify_preauth

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

15 years agoDocument ok_as_delegate in the admin guide
Greg Hudson [Thu, 30 Apr 2009 15:08:50 +0000 (15:08 +0000)]
Document ok_as_delegate in the admin guide

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

15 years agoDo not return PREAUTH_FAILED on unknown preauth
Sam Hartman [Thu, 30 Apr 2009 00:38:48 +0000 (00:38 +0000)]
Do not return PREAUTH_FAILED on unknown preauth

If the KDC receives unknown pre-authentication data then ignore it.
Do not get into a case where PREAUTH_FAILED is returned because of
unknown pre-authentication.  The main AS loop will cause
PREAUTH_REQUIRED to be returned if the preauth_required flag is set
and no valid preauth is found.

ticket: 6480
Target_Version: 1.7
Tags: pullup

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

15 years agoAdd DEBUG_ERROR_LOCATIONS support
Greg Hudson [Wed, 29 Apr 2009 23:21:21 +0000 (23:21 +0000)]
Add DEBUG_ERROR_LOCATIONS support

If DEBUG_ERROR_LOCATIONS is defined, replace uses of
krb5_set_error_message and krb5int_set_error with calls to the new
_fl variants of those functions, and include filename and line number
information in the calls.  Requires C99-style variadic macros if
defined.

ticket: 6479

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

15 years agoFix typo in error message reported by Marek Mahut (Red Hat)
Tom Yu [Wed, 29 Apr 2009 00:31:50 +0000 (00:31 +0000)]
Fix typo in error message reported by Marek Mahut (Red Hat)

ticket: 6472
target_version: 1.7
tags: pullup

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

15 years agoFix handling of RET_SEQUENCE flag in mk_priv/mk_ncred
Greg Hudson [Tue, 28 Apr 2009 18:00:13 +0000 (18:00 +0000)]
Fix handling of RET_SEQUENCE flag in mk_priv/mk_ncred

Regularize the handling of KRB5_AUTH_CONTEXT_RET_SEQUENCE in
krb5_mk_safe, krb5_mk_priv, and krb5_mk_ncred, using krb5_mk_safe as
a baseline.  RET_SEQUENCE now implies DO_SEQUENCE for all three
functions, the sequence number is always incremented if it is used,
and outdata->seq is always set if RET_SEQUENCE is passed.

Note that in the corresponding rd_ functions, RET_SEQUENCE and
DO_SEQUENCE are independent flags, which is not consistent with the
above.  This compromise is intended to preserve compatibility with
any working code which might exist using the RET_SEQUENCE flag.

ticket: 6478

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

15 years agoFix typo
Greg Hudson [Tue, 28 Apr 2009 17:54:13 +0000 (17:54 +0000)]
Fix typo

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

15 years agoFix a couple of memory leaks in krb5int_sendto, reworking the error
Greg Hudson [Tue, 28 Apr 2009 15:45:31 +0000 (15:45 +0000)]
Fix a couple of memory leaks in krb5int_sendto, reworking the error
handling a bit for cleanliness in the process.

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

15 years agoFix a memory leak in aname_replacer using the recommended flow control
Greg Hudson [Tue, 28 Apr 2009 04:46:10 +0000 (04:46 +0000)]
Fix a memory leak in aname_replacer using the recommended flow control
for exception handling.

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

15 years agoFix a memory leak in module_locate_server
Greg Hudson [Tue, 28 Apr 2009 04:30:03 +0000 (04:30 +0000)]
Fix a memory leak in module_locate_server

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

15 years agoFix a few memory leaks in krb5_mk_ncred. Also tighten up the error
Greg Hudson [Mon, 27 Apr 2009 23:48:22 +0000 (23:48 +0000)]
Fix a few memory leaks in krb5_mk_ncred.  Also tighten up the error
handling of the sequence number, only decreasing it if it was
increased.  The handling of DO_SEQUENCE and RET_SEQUENCE may still be
flawed in some cases.

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

15 years agoFix an unchecked use of fwrite in krb5_ktfileint_delete_entry
Greg Hudson [Mon, 27 Apr 2009 23:01:08 +0000 (23:01 +0000)]
Fix an unchecked use of fwrite in krb5_ktfileint_delete_entry

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

15 years agoMove KRB5_KDB_OK_AS_DELEGATE from kdb_ext.h to kdb.h. Add kadmin
Greg Hudson [Mon, 27 Apr 2009 15:42:23 +0000 (15:42 +0000)]
Move KRB5_KDB_OK_AS_DELEGATE from kdb_ext.h to kdb.h.  Add kadmin
support for the flag.  In the KDC, remove the restriction on returning
the flag on cross-realm TGTs since there is now a defined meaning for
that (it allows ok-as-delegate to be honored on the foreign realm's
service tickets).

ticket: 5596

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

15 years agomake installed headers C++-safe
Ken Raeburn [Sat, 25 Apr 2009 09:36:11 +0000 (09:36 +0000)]
make installed headers C++-safe

Now that we're installing the kadm5 headers, they should be C++-safe
like the others.  Wrap the content in 'extern "C"' if compiling as
C++.  New test program to verify.

ticket: 6477
target_version: 1.7
tags: pullup

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

15 years agoSimplify and shorten krb5_ktfileint_find_slot, and properly handle the
Greg Hudson [Fri, 24 Apr 2009 21:15:04 +0000 (21:15 +0000)]
Simplify and shorten krb5_ktfileint_find_slot, and properly handle the
commit_point output parameter.

ticket: 6475

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

15 years agoIn krb5_ktfileint_find_slot, don't continue the loop when we find a
Greg Hudson [Fri, 24 Apr 2009 19:49:54 +0000 (19:49 +0000)]
In krb5_ktfileint_find_slot, don't continue the loop when we find a
final zero-length buffer.  This is a minimal fix intended to be pulled
up to the 1.7 branch; a code cleanup commit will follow.

ticket: 6475
status: open
tags: pullup
target_version: 1.7

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

15 years agoIn krb5_principal_compare_flags, improve clarity slightly by using a
Greg Hudson [Thu, 23 Apr 2009 23:37:42 +0000 (23:37 +0000)]
In krb5_principal_compare_flags, improve clarity slightly by using a
boolean temporary instead of an ordering temporary in the loop over
the elements, since we only care about the boolean result.

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

15 years agoIn krb5_rcache_externalize, remove a pointless null check of a pointer
Greg Hudson [Thu, 23 Apr 2009 15:15:22 +0000 (15:15 +0000)]
In krb5_rcache_externalize, remove a pointless null check of a pointer
 we just dereferenced.
Rewrite krb5_rcache_internalize to use the recommended cleanup flow
 control, closing a memory leak in the process.

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

15 years agoClose a memory leak in asn1_decode_etype_info2_entry_1_3
Greg Hudson [Thu, 23 Apr 2009 14:55:42 +0000 (14:55 +0000)]
Close a memory leak in asn1_decode_etype_info2_entry_1_3

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

15 years agoIn krb5_fcc_read, remove an assert which could never trigger (because
Greg Hudson [Thu, 23 Apr 2009 14:52:25 +0000 (14:52 +0000)]
In krb5_fcc_read, remove an assert which could never trigger (because
len is unsigned and cannot be less than zero).

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

15 years agoFix an error-handling block in sendto_kdc.c's setup_connection() which
Greg Hudson [Thu, 23 Apr 2009 14:50:06 +0000 (14:50 +0000)]
Fix an error-handling block in sendto_kdc.c's setup_connection() which
would always attempt to close -1.

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

15 years agoIn krb5_get_cred_via_tkt, strip the ok-as-delegate flag from
Greg Hudson [Thu, 23 Apr 2009 08:42:40 +0000 (08:42 +0000)]
In krb5_get_cred_via_tkt, strip the ok-as-delegate flag from
credentials obtained using a foreign TGT, unless the TGT also has
ok-as-delegate set.

ticket: 6473
tags: pullup

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

15 years agomove kadmin, ktutil, k5srvutil man pages to man1
Sam Hartman [Wed, 22 Apr 2009 13:30:00 +0000 (13:30 +0000)]
move kadmin, ktutil, k5srvutil man pages to man1

These binaries have been moved to /usr/bin so their manpages should
move from man8 to man1.

Ticket: 6474
Target_Version: 1.7
Tags: pullup

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

15 years agoIn the cross-realm setup example in the admin documentation, use
Greg Hudson [Wed, 22 Apr 2009 08:26:17 +0000 (08:26 +0000)]
In the cross-realm setup example in the admin documentation, use
"addprinc" instead of "add_princ" since the latter is not a recognized
alias for add_principal.

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

15 years agoSend explicit salt for SALTTYPE_NORMAL keys
Greg Hudson [Thu, 16 Apr 2009 16:46:33 +0000 (16:46 +0000)]
Send explicit salt for SALTTYPE_NORMAL keys

Change the signature of _make_etype_info_entry to take the canonical
client principal instead of the request structure.  Also fixes the salt
we compute for SALTTYPE_NOREALM keys.

Sending an explicit salt for SALTTYPE_NORMAL keys is believed to be
necessary for some preauth scenarios involving aliases.

ticket: 6470
target_version: 1.7
tags: pullup

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

15 years agoRequire fast_req checksum to be keyed
Sam Hartman [Tue, 14 Apr 2009 15:35:12 +0000 (15:35 +0000)]
Require fast_req checksum to be keyed

Since the fast_req checksum is unencrypted, a keyed checksum type needs to be used.

ticket: 6461
Target_Version: 1.7
Tags: pullup

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

15 years agoImplement kinit option for FAST armor ccache
Sam Hartman [Tue, 14 Apr 2009 15:05:21 +0000 (15:05 +0000)]
Implement kinit option for FAST armor ccache

Implement the -T option to kinit to specify the FAST armor ccache.

ticket: 6460
Target_version: 1.7
tags: pullup

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

15 years agoUpdate kdb5_util man page with missing purge_mkeys command
Will Fiveash [Mon, 13 Apr 2009 22:15:05 +0000 (22:15 +0000)]
Update kdb5_util man page with missing purge_mkeys command

While previously updating the kdb5_util command man page to include
documentation on new subcommands added as a result of the Master Key
Migration project I missed the purge_mkeys command.  I've added that
with this commit.

Ticket: 6459
Version_Reported: 1.7
Target_Version: 1.7
Tags: pullup

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

15 years agokrb5_fcc_generate_new was destroying a locked mutex in the err_out
Greg Hudson [Mon, 13 Apr 2009 19:29:14 +0000 (19:29 +0000)]
krb5_fcc_generate_new was destroying a locked mutex in the err_out
label, which is used for I/O failures.  Unlock the mutex first.

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

15 years agoIn pa_sam, remove a gratuitous null check for etype which was
Greg Hudson [Mon, 13 Apr 2009 18:43:29 +0000 (18:43 +0000)]
In pa_sam, remove a gratuitous null check for etype which was
immediately followed by dereferencing etype.

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

15 years agoMake krb5_mkt_resolve error handling work
Greg Hudson [Mon, 13 Apr 2009 18:36:42 +0000 (18:36 +0000)]
Make krb5_mkt_resolve error handling work

Very little is likely to go wrong inside krb5_mkt_resolve (it just
allocates memory and plays with mutexes), but if anything did, the
handling was almost always wrong.  Reorganize the function to handle
errors properly, using a helper create_list_node function to simplify
the task.

ticket: 6454

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

15 years agoIn krb5int_dns_init, fix a malloc-returning-null check which could let
Greg Hudson [Mon, 13 Apr 2009 17:16:35 +0000 (17:16 +0000)]
In krb5int_dns_init, fix a malloc-returning-null check which could let
a null result slip past.

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

15 years agoMore dead code elimination. When asprintf was used the varaible namelen was
Ezra Peisach [Sun, 12 Apr 2009 15:40:41 +0000 (15:40 +0000)]
More dead code elimination.  When asprintf was used the varaible namelen was
no longer necessary.

ticket: 6453
status: open

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

15 years agoremove dead code
Ezra Peisach [Sun, 12 Apr 2009 14:59:08 +0000 (14:59 +0000)]
remove dead code

Remove some more dead code assignment - where the variable is
immediately assigned in the next statement - or not used at all.

ticket: 6453

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

15 years agoRemove dead assignment of variables that are never used
Ezra Peisach [Sun, 12 Apr 2009 14:09:29 +0000 (14:09 +0000)]
Remove dead assignment of variables that are never used

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

15 years agoIn krb5_get_in_tkt, r7002 introduced an unused local variable
Greg Hudson [Fri, 10 Apr 2009 21:17:03 +0000 (21:17 +0000)]
In krb5_get_in_tkt, r7002 introduced an unused local variable
"padata".  It was accidentally used in r18641 instead of
preauth_to_use when sorting the received padata sequence, causing the
sort to be a no-op.  Sort the correct sequence and eliminate the
unused local variable.

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

15 years agoSimplify the coupling of problem to response code in recvauth_common,
Greg Hudson [Fri, 10 Apr 2009 20:17:38 +0000 (20:17 +0000)]
Simplify the coupling of problem to response code in recvauth_common,
eliminating a big switch statement with a dead-code default block.

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

15 years agoRemove an unnecessary cleanup in krb5_cc_set_default_name
Greg Hudson [Fri, 10 Apr 2009 19:54:35 +0000 (19:54 +0000)]
Remove an unnecessary cleanup in krb5_cc_set_default_name

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

15 years agoCheck the return value of krb5_timeofday in krb5int_populate_gic_opt.
Greg Hudson [Fri, 10 Apr 2009 19:51:53 +0000 (19:51 +0000)]
Check the return value of krb5_timeofday in krb5int_populate_gic_opt.
Also initialize krb5int_populate_gic_opt's output variable.

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

15 years agoCheck return value of krb5int_copy_data_contents in preauth2.c's
Greg Hudson [Fri, 10 Apr 2009 19:50:55 +0000 (19:50 +0000)]
Check return value of krb5int_copy_data_contents in preauth2.c's
pa_salt.

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

15 years agoDocument allow_weak_crypto
Greg Hudson [Fri, 10 Apr 2009 16:09:19 +0000 (16:09 +0000)]
Document allow_weak_crypto

Also document which cryptosystems are defined to be weak, and add some
enctype entries which weren't in the documentation.

ticket: 6452
tags: pullup
target_version: 1.7

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

15 years agoUpdate defaults in documentation
Greg Hudson [Thu, 9 Apr 2009 17:57:03 +0000 (17:57 +0000)]
Update defaults in documentation

doc/definitions.texinfo had, predictably, fallen out of date with
respect to the code.  Update a few of the out of date comments and
defaults, particularly the default enctype lists.

ticket: 6451
tags: pullup
target_version: 1.7

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

15 years agokdc: handle_referral_params does not return ENOMEM errors
Ezra Peisach [Thu, 9 Apr 2009 11:53:27 +0000 (11:53 +0000)]
kdc: handle_referral_params does not return ENOMEM errors

retval was set but never returned.

ticket: 6450
tags: pullup

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

15 years agoUsing a patch from Apple, add support for GSS_C_DELEG_POLICY_FLAG,
Greg Hudson [Wed, 8 Apr 2009 16:39:33 +0000 (16:39 +0000)]
Using a patch from Apple, add support for GSS_C_DELEG_POLICY_FLAG,
which requests delegation only if the ok-as-delegate ticket flag is
set.

ticket: 6203
tags: pullup
target_version: 1.7

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

15 years agomk_safe and mk_priv require the local address to be set in the auth
Greg Hudson [Wed, 8 Apr 2009 15:58:24 +0000 (15:58 +0000)]
mk_safe and mk_priv require the local address to be set in the auth
context; rd_safe and rd_priv require the remote address to be set.
Create error codes for both kinds of missing addresses and stop trying
futilely to handle the cases where they are not set.

ticket: 1165

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

15 years agoFall through on error return
Ezra Peisach [Wed, 8 Apr 2009 15:25:43 +0000 (15:25 +0000)]
Fall through on error return

If decoding the encoded_req_body fails, proceed goto errout instead of falling
through to fast handling.

Looks like a merge error.

Reindented code.

ticket: 6449

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

15 years agoWhen getting initial credentials with a password, try the master if
Greg Hudson [Wed, 8 Apr 2009 15:22:17 +0000 (15:22 +0000)]
When getting initial credentials with a password, try the master if
preauth fails on a slave, since preauth can fail due to an out-of-date
key.  This removes a snippet added in r14939 which was considering
only hardware preauth.

ticket: 6108
tags: pullup
target_version: 1.7

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

15 years agoSubject k5_utf8s_to_ucs2s could deref NULL pointer..
Ezra Peisach [Tue, 7 Apr 2009 23:59:25 +0000 (23:59 +0000)]
Subject k5_utf8s_to_ucs2s could deref NULL pointer..

Based on usage of this static function, this will never happen as
results are always malloced (and checked) by caller.  However, the
function is already coded to handle the first argument being null - so
be consistent throughout.

ticket:

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

15 years agoCVE-2009-0846 asn1_decode_generaltime can free uninitialized pointer
Tom Yu [Tue, 7 Apr 2009 21:22:23 +0000 (21:22 +0000)]
CVE-2009-0846 asn1_decode_generaltime can free uninitialized pointer

The asn1_decode_generaltime() function can free an uninitialized
pointer if asn1buf_remove_charstring() fails.

ticket: 6445
tags: pullup
target_version: 1.7

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

15 years agoCVE-2009-0847 asn1buf_imbed incorrect length validation
Tom Yu [Tue, 7 Apr 2009 21:22:20 +0000 (21:22 +0000)]
CVE-2009-0847 asn1buf_imbed incorrect length validation

asn1buf_imbed() can perform pointer arithmetic that causes the "bound"
pointer of the subbuffer to be less than the "next" pointer.  This can
lead to malloc() failure or crash.

In asn1buf_imbed(), check the length before doing arithmetic to set
subbuf->bound.  In asn1buf_remove_octetstring() and
asn1buf_remove_charstring(), check for invalid buffer pointers before
executing an unsigned length check against a (casted to size_t)
negative number.

ticket: 6444
tags: pullup
target_version: 1.7

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

15 years agoCVE-2009-0844 SPNEGO can read beyond buffer end
Tom Yu [Tue, 7 Apr 2009 21:22:17 +0000 (21:22 +0000)]
CVE-2009-0844 SPNEGO can read beyond buffer end

SPNEGO can read beyond the end of a buffer if the claimed DER length
exceeds the number of bytes in the input buffer. This can lead to
crash or information disclosure.

Thanks to Apple for reporting this vulnerability and providing
patches.

ticket: 6443
tags: pullup
target_version: 1.7

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

15 years agoApply revised patch from Apple that ensures that a REJECT token is
Tom Yu [Tue, 7 Apr 2009 21:22:13 +0000 (21:22 +0000)]
Apply revised patch from Apple that ensures that a REJECT token is
sent on error.

ticket: 6417

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

15 years agoNull pointer defref in adding info
Ezra Peisach [Tue, 7 Apr 2009 17:57:56 +0000 (17:57 +0000)]
Null pointer defref in adding info

Clearly the code is broken - and we either never use it - or callers never pass
NULL...

Detected by clang static checker.

ticket: 6442

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

15 years agoImplement KDC side of TGS FAST
Sam Hartman [Sun, 5 Apr 2009 21:11:26 +0000 (21:11 +0000)]
Implement KDC side of TGS FAST

Most of the KDC side of TGS FAST was already present.  This adds
correct generation of the reply key.

ticket: 6439
target_version: 1.7
tags: pullup

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

15 years agofix logic errors
Sam Hartman [Sat, 4 Apr 2009 03:03:04 +0000 (03:03 +0000)]
fix logic errors

ticket: 6436

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

15 years agoAdjust the logic in rule_an_to_ln to avoid a "can't happen" case of
Greg Hudson [Fri, 3 Apr 2009 18:14:40 +0000 (18:14 +0000)]
Adjust the logic in rule_an_to_ln to avoid a "can't happen" case of
strchr returning null when searching for a character we know is there.
Also properly return ENOMEM if we fail to allocate selstring.

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

15 years agoHandle authdata encrypted in subkey
Sam Hartman [Fri, 3 Apr 2009 05:36:25 +0000 (05:36 +0000)]
Handle authdata encrypted in subkey

RFC 4120 requires that if a subkey is present in the TGS request that
authorization data be encrypted in the subkey.  Our KDC did not handle
this correctly.

ticket: 6438
target_version: 1.7
tags: pullup

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

15 years agoMerge fast branch at 22166 onto trunk
Sam Hartman [Fri, 3 Apr 2009 04:03:45 +0000 (04:03 +0000)]
Merge fast branch at 22166 onto trunk

ticket: 6436

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

15 years agoUnfortunately, pre-1.7 krshd fails to support keyed checksums because
Sam Hartman [Fri, 3 Apr 2009 03:33:01 +0000 (03:33 +0000)]
Unfortunately, pre-1.7 krshd fails to support keyed checksums because
it uses the wrong API and wrong key usage.  So, if the auth_context
has an explicit checksum type set, then respect that.  kcmd sets such
a checksum type.  Also, because other applications may have the same
problem, allow the config file variable if set to override the default
checksum.

* kcmd.c: Force use of rsa_md5
* init_ctx.c: do not default  to md5
* mk_req_ext.c: allow auth_context to override

ticket: 1624

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