Avoid a crash when attempting to change password

In some cases we could keep stack garbage in a local pointer
variable until the cleanup at the end of the function wherein
krb5_free_context() would choke on the invalid non-NULL value.
Initialize to zero to avoid the issue (should be written as NULL
but stick to the prevailing style).

(cherry picked from commit 023aac4a5d682ffeacc5121deaa771e08a5c9013)

ticket: 7329
status: resolved
Update KfW installer graphics

Replace dogheads with the new 'K'.

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>

(cherry picked from commit 175b84fb43e48862a512765113d753b180e67aa7)

ticket: 7330
status: resolved
Refresh ticket display immediately after renew

Set the CLeashApp::m_bUpdateDisplay flag to cause the display to
update on the next WM_IDLE message to the main thread.

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>

(cherry picked from commit c5c528f955e4f6348e8e278cc7f6f65fc3a1a516)

ticket: 7331
status: resolved
KfW version update for kfw-4.0-beta5

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>
Fix window close issues

Stop filtering out SC_CLOSE. 'X' button works more reliably, also alt-F4.
Remove minimize box from style.

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>

(cherry picked from commit 1b977a4e768b1a54ebffcecdf356e54e6fa86ce6)

ticket: 7332
status: resolved
KfW version update for kfw-4.0-beta6

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>
Fix kfw message box titles

"MIT Kerberos", not "Leash32"

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>

(cherry picked from commit 12147e84b98422aec0f34abf6be254d11fe8729a)

ticket: 7333
status: resolved
Upgrade from KfW betas, too

Instead of using 3.9.9 as a conditional for the maximum version to
upgrade from, just use the current version.
This seems to pick up beta tags properly (so we can upgrade
from, e.g., beta 6 to beta 7 using the installer's upgrade tools),
and is future-proof.

Note that a 64-bit installer will not pick up an existing 32-bit
install (or vice versa), but there does not seem to be infrastructure
to deal with this situation easily.
Also, "downgrading" by running an older installer with a newer version
already installed will cause both versions to be simultaneously
installed; only do this if you know what you're doing.

(cherry picked from commit 343c3c44dd96e7f8f58208b05b6074c140e193ba)

ticket: 7334
status: resolved
Upgrade 64-bit KfW installations

We use separate UpgradeCodes for 32- and 64-bit installers, so
we must check for both of them when seeing if we are upgrading an
old/existing installation.

(cherry picked from commit 9470259dcd30c564af0eb30b9afbc9e0c492f79c)

ticket: 7335
status: resolved
KfW version update for kfw-4.0-beta7
Add version info for ccapi dll

Without version info, this library would not get installed during
an upgrade scenario, causing the MIT Kerberos application to crash
on startup.

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>

[kaduk@mit.edu: add motivation to commit message]

(cherry picked from commit 69d4743dc83a2050e4e2c2fd60929abccfef498b)

ticket: 7336
status: resolved
Make finding 32-bit libs easier

Our 64-bit installer provides 32-bit libraries as well as 64-bit
libraries, but not all 32-bit applications (e.g., PuTTY, Pidgin)
are able to locate them in C:\Program Files\MIT\Kerberos .
Including an InstallDir key under the Wow6432Node tree lets them
work out-of-the-box; while here set all the registry keys in this
component in the compatibility tree, for consistency.

(cherry picked from commit 356f0c238e02812d30d04b0cc6e22b0dab2b6c0a)

ticket: 7337
status: resolved
Kill running processes on upgrades/uninstalls

The InstallValidate action of the windows installer will bring up
a dialog informing us that some currently running processes must
be terminated before installation may proceed, and offers to do so,
but does not actually kill the processes.  We have our own code to
kill running processes which did not execute, for two reasons:
it was sequenced after InstallValidate, and we did not have a current
list of processes to look for.

Add the right processes to look for and kill, and use our own
process-killing code since it actually works.

(cherry picked from commit 79e5540860d077693e70b340db4d69d5e15107b7)

ticket: 7343
status: resolved
Replace NIM with "MIT Kerberos" in installer text

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>

(cherry picked from commit 7b3773358f2876d0f36ef2659824d6accc93c82c)

ticket: 7338
status: resolved
Improve error translation for CCAPIv3 routines

We can't mix the KRB5 and CC error constants; standardize on the CC ones
and translate appropriately.

(cherry picked from commit c326061409d6e48e68808e6f37b243e4f7356935)

ticket: 7339
version_fixed: 1.10.4
status: resolved
Fix KfW thread-local storage allocation issues

Allocate thread-local storage on demand; don't rely on
the DLL_THREAD_ATTACH case in DllMain() since pre-existing
threads will never execute that code.

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>

(cherry picked from commit a4418f619be053c7429e307f78d9694b2f798c65)

ticket: 7340
version_fixed: 1.10.4
status: resolved
Clean out dead code from ccapi

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>

(cherry picked from commit 602a3572b5c79a9ecacc1145e0a611e4f5198ebe)

ticket: 7237
version_fixed: 1.10.4
status: resolved
Fix KfW startup shortcut installation

Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>

(cherry picked from commit 626c4055d65e5f0089b634c9fe4a4f6cad21dece)

ticket: 7341
status: resolved
KfW version update for kfw-4.0-beta8

Also bump the build level, since beta 7 has started to escape into
the wild, and we want to ensure that the file version numbers
are strictly increasing.
Do not emit debug printfs under NODEBUG

These printfs spew to the console when command-line utilities
such as 'klist' and 'aklog' are run, reducing usability.

These printfs can also cause application hangs.
On a multiprocessor machine, when PuTTY and the ccapiserver are
running on different CPUs, PuTTY appears to deadlock with three
concurrent threads inside cci_debug_printf().

(cherry picked from commit 932866ad41edf830123bdfef927f1314f3100be9)

ticket: 7342
version_fixed: 1.10.4
status: resolved