]> git.ipfire.org Git - thirdparty/krb5.git/log
thirdparty/krb5.git
12 years agoRemove unused build system variables
Greg Hudson [Wed, 15 May 2013 18:30:26 +0000 (14:30 -0400)] 
Remove unused build system variables

12 years agoFix windows build
Ben Kaduk [Thu, 16 May 2013 20:06:51 +0000 (16:06 -0400)] 
Fix windows build

Catch a few stragglers that missed the memo that k5_mutex_lock
cannot fail, and sprinkle some cc-int.h as needed.

12 years agoFix NSS crypto back end for mutex changes
Greg Hudson [Thu, 16 May 2013 06:52:40 +0000 (02:52 -0400)] 
Fix NSS crypto back end for mutex changes

Adjust a stray k5_mutex_lock invocation in the NSS crypto back end
after 6350fd0c909d84c00200885e722cc902049ada05.

12 years agoAssume mutex locking cannot fail
Greg Hudson [Fri, 10 May 2013 18:01:48 +0000 (14:01 -0400)] 
Assume mutex locking cannot fail

Locking and unlocking a non-recursive mutex is a simple memory
operation and should not fail on any reasonable platform with correct
usage.  A pthread mutex can return EDEADLK on lock or EPERM on unlock,
or EINVAL if the mutex is uninitialized, but all of these conditions
would reflect serious bugs in the calling code.

Change the k5_mutex_lock and k5_mutex_unlock wrappers to return void
and adjust all call sites.  Propagate this change through
k5_cc_mutex_lock and k5_cc_mutex_unlock as well.

12 years agoDon't use "bool" for ASN.1 boolean macros
Nate Rosenblum [Tue, 14 May 2013 03:26:31 +0000 (20:26 -0700)] 
Don't use "bool" for ASN.1 boolean macros

When building for IOS targets with clang, the stdbool.h header is
included by default. This header includes the following C99
definition:

    #define bool _Bool

which wrecks havoc with the DEFBOOLTYPE macro.

ticket: 7525

12 years agoRename internal Camellia symbols
Greg Hudson [Tue, 14 May 2013 02:59:35 +0000 (22:59 -0400)] 
Rename internal Camellia symbols

Symbols from the NTT Camellia sources, used in the builtin crypto
provider, could conflict with symbols from other libraries such as
OpenSSL's libcrypto.  Rename those like we rename the Gladman AES
symbols.

ticket: 7626
target_version: 1.11.3
tags: pullup

12 years agoFix kpasswd UDP ping-pong [CVE-2002-2443]
Tom Yu [Fri, 3 May 2013 20:26:46 +0000 (16:26 -0400)] 
Fix kpasswd UDP ping-pong [CVE-2002-2443]

The kpasswd service provided by kadmind was vulnerable to a UDP
"ping-pong" attack [CVE-2002-2443].  Don't respond to packets unless
they pass some basic validation, and don't respond to our own error
packets.

Some authors use CVE-1999-0103 to refer to the kpasswd UDP ping-pong
attack or UDP ping-pong attacks in general, but there is discussion
leading toward narrowing the definition of CVE-1999-0103 to the echo,
chargen, or other similar built-in inetd services.

Thanks to Vincent Danen for alerting us to this issue.

CVSSv2: AV:N/AC:L/Au:N/C:N/I:N/A:P/E:P/RL:O/RC:C

ticket: 7637 (new)
target_version: 1.11.3
tags: pullup

12 years agoFixes for leaking of refcounted resources
Nalin Dahyabhai [Thu, 25 Apr 2013 22:10:40 +0000 (18:10 -0400)] 
Fixes for leaking of refcounted resources

Some fixes, some use of different APIs which seem to clean things up
better, with the goal of being able to cleanly shut down NSS when we're
done using it.

* Use PK11_FreeSlot() instead of SECMOD_CloseUserDB() to close a
  database opened with SECMOD_OpenUserDB().
* Fix a typo and use PK11_DestroyGenericObject() instead of
  PK11_DestroyGenericObjects() to destroy one object.
* Use SECMOD_DestroyModule() instead of SECMOD_UnloadUserModule()
  to close a module loaded with SECMOD_LoadUserModule().
* crypto_check_for_revocation_information(): don't leak a reference
  to the CRL, or to intermediate issuers.
* Don't leak a reference to a PEM private key.

12 years agoIn PKINIT NSS crypto, support encrypted PEM keys
Nalin Dahyabhai [Wed, 24 Apr 2013 19:29:27 +0000 (15:29 -0400)] 
In PKINIT NSS crypto, support encrypted PEM keys

When the PEM module is given an encrypted key, it changes its token
flags to indicate that a password is required (by setting needs-login)
to signal the application that we need to supply a password to decrypt
it.  Attempts to load any other items will fail until the flag is
cleared.

If we detect that the flag is set after we've attempted to load a
private key, attempt to "log in" to the "token" using a password.  Even
if we fail, the token will reset its needs-login flag, which is
necessary before we can import anything else.

12 years agoGet better at locating the just-loaded certificate
Nalin Dahyabhai [Wed, 24 Apr 2013 19:22:05 +0000 (15:22 -0400)] 
Get better at locating the just-loaded certificate

When loading certificates using the PEM module, use a better method for
finding the just-loaded certificate that will still work if we've
already got a copy of the certificate loaded somewhere else.

12 years agoIn PKINIT NSS crypto code, load certificates first
Nalin Dahyabhai [Wed, 24 Apr 2013 18:43:59 +0000 (14:43 -0400)] 
In PKINIT NSS crypto code, load certificates first

When using NSS's CMS API to generate signed-data messages, we identify
the key that we want to use for signing by specifying a certificate.
The library then looks up the corresponding private key when it needs to
generate the signature.  This lookup fails if a certificate and a its
corresponding private key were loaded key-first, but succeeds if they
were loaded certificate-first (RHBZ#859535).  To work around this,
switch to loading the certificate first.  (We switch to using different
_pkinit_identity_crypto_file pointers for each instead of reusing just
one, so the diff is messier than it might have been.)

12 years agoWhen DEBUG=1, log why we fail to log in to a token
Nalin Dahyabhai [Wed, 24 Apr 2013 17:52:23 +0000 (13:52 -0400)] 
When DEBUG=1, log why we fail to log in to a token

Use PORT_ErrorToName() to let us print an error name instead of an error
code in a couple of debug messages, since in practice we just end up
looking up the code in <secerr.h> anyway.

12 years agoTraverse tokens like we do with OpenSSL for NSS
Nalin Dahyabhai [Thu, 10 Jan 2013 20:39:15 +0000 (15:39 -0500)] 
Traverse tokens like we do with OpenSSL for NSS

When PKINIT is built with NSS, change how it traverses tokens to match
the way it's done when built using OpenSSL: ignore slot names (we used
to treat the token label as a possible slot label, too), and either only
look at the token with the specified label, or the first token if a no
token label was specified.

12 years agoOnly call SEC_PKCS12DecoderFinish() once
Nalin Dahyabhai [Thu, 20 Dec 2012 18:51:12 +0000 (13:51 -0500)] 
Only call SEC_PKCS12DecoderFinish() once

We already call SEC_PKCS12DecoderFinish() before entering the switch()
statement, so don't call it again.

12 years agoMake the text of NSS's prompts look like OpenSSL's
Nalin Dahyabhai [Tue, 18 Dec 2012 22:41:11 +0000 (17:41 -0500)] 
Make the text of NSS's prompts look like OpenSSL's

When PKINIT is built with NSS, make the text of prompts that we issue to
the user better match the text we use when we build with OpenSSL: ask
for a pass phrase when we're asking about a hardware token, ask for a
password the rest of the time, and take advantage of translations for
requests for a password.

12 years agoDon't fail if a candidate certificate has no SANs
Nalin Dahyabhai [Mon, 14 Jan 2013 18:57:54 +0000 (13:57 -0500)] 
Don't fail if a candidate certificate has no SANs

When we're doing certificate matching and we're asked for the list of
SAN values for a certifiate, and it contains none, don't return an
error, as that will eventually cause the module to just return an error.
Instead, just return an empty list of SAN values so that processing will
continue on to check if other certificates match.

12 years agoFix type mismatch in db2_exp.c
Greg Hudson [Fri, 10 May 2013 19:03:25 +0000 (15:03 -0400)] 
Fix type mismatch in db2_exp.c

The locking wrapper for audit_as_req used the wrong function
signature, which was harmless but produced a couple of warnings.  Fix
it.

12 years agoFix check for KDB: prefix in kinit
Richard Basch [Fri, 10 May 2013 16:24:21 +0000 (12:24 -0400)] 
Fix check for KDB: prefix in kinit

The string "KDB:" has four characters, not three; check for all four
of them.

[ghudson@mit.edu: commit message]

ticket: 7636

12 years agoAdd test case for CVE-2013-1416
Tom Yu [Thu, 9 May 2013 20:51:31 +0000 (16:51 -0400)] 
Add test case for CVE-2013-1416

ticket: 7635 (new)

12 years agofix crypto openssl hmac warning
Gilles Espinasse [Thu, 9 May 2013 15:58:14 +0000 (11:58 -0400)] 
fix crypto openssl hmac warning

ticket: 7634

12 years agoImprove LDAP password file error messages
Greg Hudson [Wed, 8 May 2013 19:55:58 +0000 (15:55 -0400)] 
Improve LDAP password file error messages

If we cannot open the LDAP password file or cannot find the bind DN in
it, include the filename and DN in the error message.

ticket: 7632

12 years agoMake reassembled PKCS11 names parseable
Nalin Dahyabhai [Tue, 26 Feb 2013 22:59:01 +0000 (17:59 -0500)] 
Make reassembled PKCS11 names parseable

The reassembled names used "," as a separator between attributes, when
passed-in values use ":".  This was due to the original submitter being
confused - they weren't intended to be different.

12 years agoFix a typo that caused us to not skip removing "."
Nalin Dahyabhai [Tue, 30 Apr 2013 21:37:22 +0000 (17:37 -0400)] 
Fix a typo that caused us to not skip removing "."

When attempting to clean the files out from our temporary directory,
correct the test which was supposed to let us skip over "." and ".." so
that we actually don't try to remove them with remove().

12 years agoFix checking unencrypted PKCS12: twice
Nalin Dahyabhai [Tue, 30 Apr 2013 21:07:23 +0000 (17:07 -0400)] 
Fix checking unencrypted PKCS12: twice

The test, as submitted, included a copy/paste error which caused it to
test PKINIT using unencrypted PKCS12 bundles twice, and to not test a
DIR: location containing unencrypted PEM-formatted keys at all.

12 years agoRemove some apparently-accidental debug whitespace
Nalin Dahyabhai [Wed, 13 Feb 2013 23:45:22 +0000 (18:45 -0500)] 
Remove some apparently-accidental debug whitespace

12 years agoRemove dangling reference to $with_edirectory
Nalin Dahyabhai [Thu, 20 Dec 2012 21:47:50 +0000 (16:47 -0500)] 
Remove dangling reference to $with_edirectory

Remove a reference to eDirectory that persisted after support for
eDirectory was removed.  Almost certainly harmless anyway.

[ghudson@mit.edu: also quote $with_ldap]

12 years agoMake AS requests work with no client key
Greg Hudson [Thu, 2 May 2013 20:15:32 +0000 (16:15 -0400)] 
Make AS requests work with no client key

If we cannot find a client key while preparing an AS reply, give
preauth mechanisms a chance to replace the reply key before erroring
out.

ticket: 7630

12 years agoDon't send empty etype info from KDC
Greg Hudson [Mon, 29 Apr 2013 18:55:31 +0000 (14:55 -0400)] 
Don't send empty etype info from KDC

RFC 4120 prohibits empty ETYPE-INFO2 sequences (though not ETYPE-INFO
sequences), and our client errors out if it sees an empty sequence of
either.

ticket: 7630

12 years agoCheck for keys in encrypted timestamp/challenge
Greg Hudson [Fri, 26 Apr 2013 19:51:05 +0000 (15:51 -0400)] 
Check for keys in encrypted timestamp/challenge

Encrypted timestamp and encrypted challenge cannot succeed if the
client has no long-term key matching the request enctypes, so do not
offer them in that case.

ticket: 7630

12 years agoAdd kdcpreauth callback to check for client keys
Greg Hudson [Fri, 26 Apr 2013 19:50:05 +0000 (15:50 -0400)] 
Add kdcpreauth callback to check for client keys

Add a new have_client_keys callback to the kdcpreauth interface,
allowing modules to efficiently check whether the client DB entry has
any keys matching the request enctypes.

ticket: 7630

12 years agoFix mismatched spnego_mech.c declarations
Greg Hudson [Fri, 3 May 2013 17:09:08 +0000 (13:09 -0400)] 
Fix mismatched spnego_mech.c declarations

The mechglue definitions of gssint_get_der_length and friends use
unsigned int for the buffer length, not OM_uint32.

12 years agoAdd missing plugins.c to SRCS in util/support
Greg Hudson [Thu, 2 May 2013 06:23:15 +0000 (02:23 -0400)] 
Add missing plugins.c to SRCS in util/support

Reported by Arlene Berry.

ticket: 7629

12 years agoFix link line for t_fortuna
Gilles Espinasse [Wed, 1 May 2013 23:57:02 +0000 (19:57 -0400)] 
Fix link line for t_fortuna

ticket: 7628

12 years agoDon't use portmapper in RPC tests
Greg Hudson [Wed, 1 May 2013 17:07:36 +0000 (13:07 -0400)] 
Don't use portmapper in RPC tests

On many Linux systems, due to what is arguably a bug in rpcbind, the
portmapper doesn't allow service registration from non-root processes.
This causes the RPC tests to be frequently skipped.  Modify the tests
so that they don't need the portmapper, by grabbing the port number
from the server process and passing it to the client.

12 years agoDisable UDP pass of gssrpc tests on all platforms
Greg Hudson [Wed, 1 May 2013 18:40:31 +0000 (14:40 -0400)] 
Disable UDP pass of gssrpc tests on all platforms

The AUTH_GSSAPI flavor of rpc authentication uses IP address channel
bindings.  These are broken over UDP, because svcudp_recv() fails to
get the destination address of incoming packets (it tries to use the
recvmsg() msg_name field to get the destination IP address, which
instead gets the source address; see ticket #5540).

There is no simple or comprehensive way to fix this; using IP_PKTINFO
is a fair amount of code and only works on some platforms.  It's also
not very important--nobody should be using AUTH_GSSAPI except perhaps
for compatibility with really old kadmin, and kadmin only runs over
TCP.  Since the gssrpc tests are closely wedded to AUTH_GSSAPI, the
simplest fix is to only run the TCP pass.

12 years agoDisable the gssrpc expired-cred test
Greg Hudson [Wed, 1 May 2013 19:52:40 +0000 (15:52 -0400)] 
Disable the gssrpc expired-cred test

The "expired" test in expire.exp tries to authenticate to the server
process with an expired TGT (obtained using kinit -l -1m).  Using an
expired TGT to get an expired service cred no longer works after
#6948.  We could use kinit -S to get an expired service cred, but
krb5_get_credentials won't return expired service cred from the cache
(even before #6948).  We could use time offsets to simulate clock skew
between the client and server process, but that would be difficult
because the test programs don't have access to the krb5_context
objects used by the client or server process.  Since we don't have a
simple workaround, disable the test.

12 years agoAdd gssrpc to pkg-config
Günther Deschner [Mon, 15 Apr 2013 12:30:03 +0000 (14:30 +0200)] 
Add gssrpc to pkg-config

ticket: 7620

12 years agoAdd gssrpc to krb5-config
Günther Deschner [Mon, 15 Apr 2013 10:58:03 +0000 (12:58 +0200)] 
Add gssrpc to krb5-config

ticket: 7620

12 years agoAdd internal KDC_DIR macro
Greg Hudson [Tue, 15 Jan 2013 16:11:27 +0000 (11:11 -0500)] 
Add internal KDC_DIR macro

Define KDC_DIR in osconf.hin and use it for paths within the KDC
directory.

12 years agoBetter fix for not using expired TGTs in TGS-REQs
Greg Hudson [Mon, 29 Apr 2013 15:52:55 +0000 (11:52 -0400)] 
Better fix for not using expired TGTs in TGS-REQs

We want to generate a KRB5_AP_ERR_TKT_EXPIRED code when the TGT is
expired, like we would if we tried the TGT against the KCD.  To make
this work, separate the helpers for getting local and crossrealm
cached TGTs.  For a crossrealm TGT, match against the endtime, as
there could be multiple entries.  For a local TGT, find any match, but
check if it's expired.  The cache_code field is no longer needed after
this change, so get rid of it.

ticket: 6948

12 years agoDon't use expired TGTs in TGS-REQs
Nicolas Williams [Fri, 26 Apr 2013 19:37:01 +0000 (14:37 -0500)] 
Don't use expired TGTs in TGS-REQs

ticket: 6948

12 years agoAdd various client-authenticating PKINIT tests
Nalin Dahyabhai [Thu, 10 Jan 2013 23:30:04 +0000 (18:30 -0500)] 
Add various client-authenticating PKINIT tests

Add tests for non-anonymous PKINIT:
* FILE: with no password
* FILE: with a password
* DIR: with no password
* DIR: with a password
* PKCS12: with no password
* PKCS12: with a password
* PKCS11: with a password, if soft-pkcs11.so is found via ctypes

[ghudson@mit.edu: reformatted to 79 columns; removed intermediate
success() calls]

12 years agoAdd a script for [re]generating test PKI creds
Nalin Dahyabhai [Wed, 13 Feb 2013 19:37:36 +0000 (14:37 -0500)] 
Add a script for [re]generating test PKI creds

[ghudson@mit.edu: reformatted to limit lines to 79 columns]

12 years agoInclude default DIR::file ccache in collection
Greg Hudson [Mon, 22 Apr 2013 21:00:35 +0000 (17:00 -0400)] 
Include default DIR::file ccache in collection

If the context's default ccache name is a subsidiary file of a
directory collection, include that single cache in the cursor walk
over the DIR type.

ticket: 7172

12 years agoFix doc build
Ben Kaduk [Thu, 18 Apr 2013 22:18:57 +0000 (18:18 -0400)] 
Fix doc build

The addition of the KRB5_PADATA_AS_CHECKSUM macro in d7d74867952f caused
the doxygen bridge to emit a new RST file.  This file was not included in
the API reference toctree, causing a build failure in maintainer-mode.

12 years agoAdd a few comments to `PADATA types` in krb5.hin
Zhanna Tsitkov [Thu, 18 Apr 2013 19:21:51 +0000 (15:21 -0400)] 
Add a few comments to `PADATA types` in krb5.hin

Mostly, based on
http://www.iana.org/assignments/kerberos-parameters/kerberos-parameters.xml

12 years agoUse macro for IANA assigned PA-AS-CHECKSUM number
Zhanna Tsitkov [Thu, 18 Apr 2013 18:56:39 +0000 (14:56 -0400)] 
Use macro for IANA assigned PA-AS-CHECKSUM number

Replace numeric value '132' by the macro KRB5_PADATA_AS_CHECKSUM
in preauth plugin.

12 years agoSet msg_type when decoding FAST requests
Greg Hudson [Fri, 12 Apr 2013 20:28:14 +0000 (16:28 -0400)] 
Set msg_type when decoding FAST requests

An RFC 6113 KrbFastReq contains a padata sequence and a KDC-REQ-BODY,
neither of which contain the msg-type field found in a KDC-REQ.  So
when we decode the FAST request, the resulting krb5_kdc_req structure
has a msg_type of 0.  Copy msg_type from the outer body, since we make
use of it in further KDC processing.

ticket: 7605 (new)
target_version: 1.11.3
tags: pullup

12 years agoAllow config of dh_min_bits < 2048
Tom Yu [Wed, 10 Apr 2013 03:47:54 +0000 (23:47 -0400)] 
Allow config of dh_min_bits < 2048

Allow configuration to override the default dh_min_bits of 2048 to
1024.  Disallow configuration of dh_min_bits < 1024, but continue to
default to 2048.

ticket: 7602
target_version: 1.11.3
tags: pullup

12 years agoSimplify pkinit_check_dh_params
Tom Yu [Fri, 29 Mar 2013 02:57:55 +0000 (22:57 -0400)] 
Simplify pkinit_check_dh_params

Change pkinit_check_dh_params() to take two DH* parameters, and only
compare p and g, because q is fully determined by them and might be
missing.

Also refactor some parameter checks into check_dh_wellknown() that
were previously done separately in the pkinit_process_td_dh_params()
and server_check_dh().

12 years agoIgnore missing Q in dh_params
Tom Yu [Thu, 28 Mar 2013 23:09:04 +0000 (19:09 -0400)] 
Ignore missing Q in dh_params

Some implementations don't send the required Q value in dh_params, so
allow it to be absent.

ticket: 7596
target_version: 1.11.3
tags: pullup

12 years agoSimplify sendto_kdc exception handling
Greg Hudson [Fri, 12 Apr 2013 18:25:51 +0000 (14:25 -0400)] 
Simplify sendto_kdc exception handling

12 years agoRemove sendto_kdc debugging code
Greg Hudson [Fri, 12 Apr 2013 17:56:38 +0000 (13:56 -0400)] 
Remove sendto_kdc debugging code

It's a lot of code, and trace logging should cover most of the cases
where it's useful.

12 years agoDynamically expand timeout when TCP connects
Nathaniel McCallum [Tue, 9 Apr 2013 17:32:20 +0000 (13:32 -0400)] 
Dynamically expand timeout when TCP connects

Wait ten seconds for a TCP connection to succeed or fail before moving
on.  During this wait time, other TCP connections will be serviced if
we already initiated them, but no new TCP connections will be created
and no UDP packets will be retransmitted.

[ghudson@mit.edu: minor adjustments; commit message]

ticket: 7604 (new)

12 years agoUse millisecond timeouts in sendto_kdc.c
Nathaniel McCallum [Tue, 9 Apr 2013 17:23:39 +0000 (13:23 -0400)] 
Use millisecond timeouts in sendto_kdc.c

Replace the end_time field of struct select_state with an endtime
argument to cm_select_or_poll, expressed in milliseconds since the
epoch.  Add a helper function to get the current time in that format.
Use a millisecond interval argument to service_fds for consistency.

[ghudson@mit.edu: fix overflow issue in get_curtime_ms; service_fds
interval argument change; log message]

12 years agoGet rid of cm.c and cm.h
Greg Hudson [Wed, 10 Apr 2013 22:36:08 +0000 (18:36 -0400)] 
Get rid of cm.c and cm.h

Since net-server.c now uses libverto, only sendto_kdc.c consumes cm.c.
Move stuff out of cm.c and cm.h into sendto_kdc.c and get rid of them.
Change the sendto_kdc callback (used by chpw.c) to receive the socket
descriptor instead of the entire conn_state structure, and move the
declarations into os-proto.h.  struct remote_address also needs to be
in os-proto.h so that trace.c and t_trace.c can use it.  k5_curtime
isn't needed since k5-platform.h now guarantees the presence of
gettimeofday().

12 years agoTrace log with a subset of struct conn_state
Greg Hudson [Wed, 10 Apr 2013 22:10:52 +0000 (18:10 -0400)] 
Trace log with a subset of struct conn_state

In struct conn_state, collect together the fields for the remote
address and put them in a substructure.  Pass this substructure to
trace logging macros instead of the entire conn_state structure, so
that trace.c doesn't have to know about the whole structure.

12 years agoTighten up fixed buffer usage in hst_realm.c
Greg Hudson [Tue, 9 Apr 2013 18:48:23 +0000 (14:48 -0400)] 
Tighten up fixed buffer usage in hst_realm.c

Avoid or notice truncations, rather than letting them happen silently.

12 years agoAllow numeric addresses as service hostnames
Greg Hudson [Tue, 9 Apr 2013 18:35:28 +0000 (14:35 -0400)] 
Allow numeric addresses as service hostnames

Since krb5 1.3, krb5_get_host_realm (and therefore
krb5_sname_to_principal) has refused hostnames which appear to be
numeric addresses--with the exception of 1.6, which was ignoring
errors from clean_hostname.  In specialized environments, it may be
desirable to use IP addresses in service principal names, and there's
no compelling reason for us to get in the way of that.

Move the numeric address check out of k5_clean_hostname into a new
helper function, and simply skip the domain-based mechanisms if it
returns true.  Factor out the [domain_realm] search into a second new
helper function to make it easier to skip.

ticket: 7603 (new)

12 years agoUpdate hst_realm.c coding style
Greg Hudson [Tue, 9 Apr 2013 18:00:04 +0000 (14:00 -0400)] 
Update hst_realm.c coding style

Bring this file up to date with current coding style.  No functional
changes, except some trace logs were removed.

12 years agoInitialize outpos in krb5int_utf8_normalize
Greg Hudson [Tue, 9 Apr 2013 15:43:54 +0000 (11:43 -0400)] 
Initialize outpos in krb5int_utf8_normalize

After k5memdup0 was slightly modified in
31124ffb81e8c0935403a9fdc169dead5ecaa777, some older versions of gcc
complain about outpos being possibly used before it is initialized.
This can't actually happen, but we can silence the error and also
simplify how outpos is initialized.

12 years agoAvoid passing null pointers to memcpy/memcmp
Greg Hudson [Mon, 8 Apr 2013 19:32:31 +0000 (15:32 -0400)] 
Avoid passing null pointers to memcpy/memcmp

By a strict reading of the C standard, memcpy and memcmp have
undefined behavior if their pointer arguments aren't valid object
pointers, even if the length argument is 0.  Compilers are becoming
more aggressive about breaking code with undefined behavior, so we
should try to avoid it when possible.

In a krb5_data object, we frequently use NULL as the data value when
the length is 0.  Accordingly, we should avoid copying from or
comparing the data field of a length-0 krb5_data object.  Add checks
to our wrapper functions (like data_eq and k5_memdup) and to code
which works with possibly-empty krb5_data objects.  In a few places,
use wrapper functions to simplify the code rather than adding checks.

12 years agoSimplify principal access within libkrb5
Greg Hudson [Sat, 6 Apr 2013 05:23:40 +0000 (01:23 -0400)] 
Simplify principal access within libkrb5

For conciseness, directly use fields of krb5_principal objects instead
of using the accessor macros.

12 years agoInstall krb5-config man page
Ben Kaduk [Wed, 3 Apr 2013 22:46:25 +0000 (18:46 -0400)] 
Install krb5-config man page

Don't just build it.

ticket: 7601

12 years agoRegen man pages to pick up krb5-config
Ben Kaduk [Wed, 3 Apr 2013 04:06:51 +0000 (00:06 -0400)] 
Regen man pages to pick up krb5-config

Also some other small changes and the copyright date range.

12 years agoAdd a krb5-config man page
Ben Kaduk [Wed, 3 Apr 2013 04:06:45 +0000 (00:06 -0400)] 
Add a krb5-config man page

Missed when converting the old nroff man pages.

12 years agoClean up python bytecode from doc build
Ben Kaduk [Tue, 2 Apr 2013 16:03:40 +0000 (12:03 -0400)] 
Clean up python bytecode from doc build

Otherwise they escape into the release tarball.

12 years agoFix typo in t_credstore.c
Greg Hudson [Tue, 2 Apr 2013 16:42:05 +0000 (12:42 -0400)] 
Fix typo in t_credstore.c

Correctly check whether the next argument is NULL in the while loop
which parses store elements.

12 years agoAdd krb5_kt_dup API and use it in two places
Greg Hudson [Mon, 1 Apr 2013 17:25:33 +0000 (13:25 -0400)] 
Add krb5_kt_dup API and use it in two places

Add an API to duplicate keytab handles, mirroring krb5_cc_dup.  Use it
to simplify the krb5 GSS acquire_cred code.

ticket: 7599 (new)

12 years agoAdd gss_import_cred_from client keytab test
Greg Hudson [Mon, 1 Apr 2013 16:34:14 +0000 (12:34 -0400)] 
Add gss_import_cred_from client keytab test

Modify t_credstore.c to be more flexible and adjust t_gssapi.py
accordingly.  Add a test to t_client_keytab.py which acquire creds
using a programmatically specified client keytab.

ticket: 7598

12 years agoAdd support for client keytab from cred store
Simo Sorce [Thu, 28 Mar 2013 16:53:01 +0000 (12:53 -0400)] 
Add support for client keytab from cred store

The new credential store extensions added support for specifying a
specific ccache name and also a specific keytab to be used for accepting
security contexts, but did not add a way to specify a client keytab
to be used in conjunction with the Keytab initiation support added also
in 1.11

This patch introduces a new URN named client_keytab through which a
specific client_keytab can be set when calling gss_acquire_cred_from()
and Keytab Initiation will use that keytab to initialize credentials.

[ghudson@mit.edu: minor C style fix]

ticket: 7598 (new)

12 years agoFix copy/pasto in ksu error message
Ben Kaduk [Fri, 29 Mar 2013 21:32:25 +0000 (17:32 -0400)] 
Fix copy/pasto in ksu error message

Obtained from Debian.

12 years agoFix warnings in tests/gss-threads
Greg Hudson [Fri, 29 Mar 2013 14:26:32 +0000 (10:26 -0400)] 
Fix warnings in tests/gss-threads

12 years agoReformat tests/gss-threads
Greg Hudson [Fri, 29 Mar 2013 14:18:25 +0000 (10:18 -0400)] 
Reformat tests/gss-threads

12 years agoFree unconditionally in plugins.c
Greg Hudson [Fri, 29 Mar 2013 06:53:27 +0000 (02:53 -0400)] 
Free unconditionally in plugins.c

Get rid of unnecessary null checks before freeing values in
libkrb5support's plugin code.

12 years agoFix zap size in confounder checksum mk_xorkey
Greg Hudson [Fri, 29 Mar 2013 06:47:09 +0000 (02:47 -0400)] 
Fix zap size in confounder checksum mk_xorkey

12 years agoFix typo in ktest_make_sample_auth_pack
Greg Hudson [Fri, 29 Mar 2013 06:39:44 +0000 (02:39 -0400)] 
Fix typo in ktest_make_sample_auth_pack

12 years agoFix errno hygiene in kadmind write_pid_file
Greg Hudson [Fri, 29 Mar 2013 06:22:12 +0000 (02:22 -0400)] 
Fix errno hygiene in kadmind write_pid_file

fclose() might overwrite the errno value from fprintf, causing us to
return success when we shouldn't.  Record the errno value at the time
of the fprintf failure.

12 years agoSimplify krb5_ldap_readpassword
Greg Hudson [Fri, 29 Mar 2013 06:13:04 +0000 (02:13 -0400)] 
Simplify krb5_ldap_readpassword

There's no need to check whether the file exists and is readable
before opening it, and setting an extended error message which is just
strerror_r() of the errno value isn't useful.

12 years agoUsing k5-int.h data helpers for some functions
Greg Hudson [Thu, 28 Mar 2013 20:43:30 +0000 (16:43 -0400)] 
Using k5-int.h data helpers for some functions

Use empty_data(), alloc_data(), and make_data() in some appropriate
places.  This has the side effect of initializing the krb5_data magic
field, which can placate debugging tools.

12 years agoClean up cksum handling in CMAC token functions
Greg Hudson [Fri, 29 Mar 2013 05:57:31 +0000 (01:57 -0400)] 
Clean up cksum handling in CMAC token functions

In krb5int_dk_cmac_encrypt, cksum wasn't used.  In
krb5int_dk_cmac_decrypt, cksum needs to be initialized since we clean
it up.

12 years agoFix kdb_ldap_create_principal cleanup
Greg Hudson [Thu, 28 Mar 2013 19:59:07 +0000 (15:59 -0400)] 
Fix kdb_ldap_create_principal cleanup

entry must be initialized before all code which can jump to cleanup.

12 years agoFix more password_policy cleanup code
Greg Hudson [Thu, 28 Mar 2013 19:57:32 +0000 (15:57 -0400)] 
Fix more password_policy cleanup code

Initialize policy_dn in krb5_ldap_create_password_policy; free values
unconditionally in all ldap_pwd_policy.c cleanup handlers.

12 years agoGet rid of krb5_xfree
Greg Hudson [Thu, 28 Mar 2013 19:51:43 +0000 (15:51 -0400)] 
Get rid of krb5_xfree

12 years agoFix krb5_ldap_put_password_policy cleanup
Greg Hudson [Thu, 28 Mar 2013 19:21:10 +0000 (15:21 -0400)] 
Fix krb5_ldap_put_password_policy cleanup

Initialize policy_dn since we clean it up.  Also free it
unconditionally.

12 years agoInit output parameter of krb5_decode_princ_entry
Greg Hudson [Thu, 28 Mar 2013 06:46:05 +0000 (02:46 -0400)] 
Init output parameter of krb5_decode_princ_entry

For easier static analysis, make sure that krb5_decode_princ_entry
always sets *entry_ptr to a valid entry or NULL.

12 years agoFix unused assignment in mechglue loadConfigFile
Greg Hudson [Thu, 28 Mar 2013 06:24:05 +0000 (02:24 -0400)] 
Fix unused assignment in mechglue loadConfigFile

12 years agoFix an error case in krb5int_fcc_new_unique
Greg Hudson [Thu, 28 Mar 2013 06:13:00 +0000 (02:13 -0400)] 
Fix an error case in krb5int_fcc_new_unique

If we fail to allocate setptr, don't close ret, since we've already
done so.

12 years agoFix an error case in krb5_sendauth
Greg Hudson [Thu, 28 Mar 2013 06:08:45 +0000 (02:08 -0400)] 
Fix an error case in krb5_sendauth

If we fail to get the client principal when constructing the
stack-allocated creds structure, don't double-free creds.server.

12 years agoFix minor KDC memory leaks
Greg Hudson [Mon, 25 Mar 2013 23:17:34 +0000 (19:17 -0400)] 
Fix minor KDC memory leaks

Fix some small memory leaks which happen only in rare failure
conditions.  Reported by Will Fiveash <will.fiveash@oracle.com>.

12 years agoFix a trivial file leak writing kadmind pid file
Greg Hudson [Mon, 25 Mar 2013 21:38:41 +0000 (17:38 -0400)] 
Fix a trivial file leak writing kadmind pid file

If we fail to write the pid to the pid file, we should still close the
file before returning from write_pid_file().  The consequences of this
bug are trivial because kadmin is just going to exit regardless.
Reported by Will Fiveash <will.fiveash@oracle.com>.

12 years agoExport verto_set_flags from libverto
Greg Hudson [Mon, 25 Mar 2013 16:42:49 +0000 (12:42 -0400)] 
Export verto_set_flags from libverto

When the bundled libverto was updated from 0.2.2 to 0.2.5,
verto_set_flags should have been added to libverto.exports along with
the other new functions.

ticket: 7594 (new)
target_version: 1.11.2
tags: pullup

12 years agoReplace "First introduced" with concise "New"
Zhanna Tsitkov [Mon, 25 Mar 2013 19:18:53 +0000 (15:18 -0400)] 
Replace "First introduced" with concise "New"

12 years agoFix import_sec_context with interposers
Simo Sorce [Sat, 16 Mar 2013 19:23:03 +0000 (15:23 -0400)] 
Fix import_sec_context with interposers

The code was correctly selecting the mechanism to execute, but it was
improperly setting the mechanism type of the internal context when the
selected mechanism was that of an interposer and vice versa.

When an interposer is involved the internal context is that of the
interposer, so the mechanism type of the context needs to be the
interposer oid.  Conversely, when an interposer re-enters gssapi and
presents a token with a special oid, the mechanism called is the real
mechanism, and the context returned is a real mechanism context.  In
this case the mechanism type of the context needs to be that of the
real mechanism.

ticket: 7592
target_version: 1.11.2
tags: pullup

12 years agomake depend
Greg Hudson [Sun, 24 Mar 2013 05:30:33 +0000 (01:30 -0400)] 
make depend

12 years agoMove a bunch of stuff out of k5-int.h
Greg Hudson [Sun, 24 Mar 2013 05:28:13 +0000 (01:28 -0400)] 
Move a bunch of stuff out of k5-int.h

Move internal declarations from k5-int.h to more localized headers
(like int-proto.h) where appropriate.  Rename many symbols whose
prototypes were moved to use the k5_ prefix instead of krb5int_.
Remove some unused declarations or move them to the single source file
they were needed in.  Remove krb5_creds_compare since it isn't used
any more.

12 years agoGet rid of krb5_{get,free}_krbhst
Greg Hudson [Fri, 22 Mar 2013 20:00:48 +0000 (16:00 -0400)] 
Get rid of krb5_{get,free}_krbhst

These functions were always internal.  They haven't been used since
v5passwdd was eliminated in krb5 1.4.

12 years agoGet rid of osconfig.c
Greg Hudson [Fri, 22 Mar 2013 16:59:48 +0000 (12:59 -0400)] 
Get rid of osconfig.c

These variables were marked as internal in 1996.  Two are unused and
the other is easily replaced with the macro it is initialized from.

12 years agoRebuild NOTICE for 2013
Ben Kaduk [Thu, 21 Mar 2013 15:49:49 +0000 (11:49 -0400)] 
Rebuild NOTICE for 2013

Also exclude copyright.rst from the notice.txt build, as maintainer-mode
builds error out due to the "document isn't included in any toctree"
warning otherwise produced.

12 years agoClean up getclhoststr in ipropd_svc.c
Greg Hudson [Thu, 21 Mar 2013 05:48:22 +0000 (01:48 -0400)] 
Clean up getclhoststr in ipropd_svc.c

Based on a patch from Xi Wang <xi@mit.edu>.