340 Commits

Author SHA1 Message Date
Taylor R Campbell
0f998cdbc2 ktutil: Avoid even doing arithmetic on res after realloc(res, ...).
Under C99, Sec 6.2.4, paragraph 2:

    The value of a pointer becomes indeterminate when the object it
    points to reaches the end of its lifetime.

`Indeterminate' (3.17.2) includes a trap representation, and any
reference to a trap representation is undefined behaviour.  Thus,
after realloc(res, ...) succeeds, any reference to res (or p) is
undefined behaviour.

So, instead of using `p - res` after res has been freed, use the
existing name for the value we know it has now: len.  (We could also
use alloced because p == end in this branch, and end = res + alloced,
and p = res + len.  Of course, we would have to move it up a line to
before we update alloced to have a different value.)

fix https://github.com/heimdal/heimdal/issues/1164
2023-11-07 14:20:40 -06:00
Nicolas Williams
b220338e80 admin: Document KRB5_KTNAME env var 2023-05-26 13:23:47 -05:00
Nicolas Williams
8c23a706f3 admin: Fix double-free in keytab JSON listing 2023-01-04 01:36:03 -06:00
Nicolas Williams
914cd2f31c ktutil: Fix leak 2023-01-04 01:36:02 -06:00
Jeffrey Altman
603e673130 Windows: link against LIBHEIMBASE for json functionality
Change-Id: Ib5ab20ec08b54fd00a6392f7de97a35591a3053b
2022-11-16 22:19:16 -05:00
Nicolas Williams
ceec364ed4 ktutil: Add import command and other improvements
- Add an import command that imports JSON as output by
   `ktutil list --json --keys`.

   This is enables one to filter/edit keytabs with jq!

 - Add a `merge` alias for the `copy` command, since that's effectively
   what it does.

 - Add a `--copy-duplicates` option to the `copy`/`merge` command.

 - Add a `--no-create` option to the `get` command.

 - Add a `--no-change-keys` option to the `get` command.

 - Make `add` complain if it can't finish writing to the keytab.
2022-10-03 09:44:22 -05:00
Nicolas Williams
69dc89b39a ktutil: Add list --json option 2022-10-03 09:44:22 -05:00
Nicolas Williams
060b831c4d ktutil: Fix a warning 2022-01-14 17:59:49 -06:00
Nicolas Williams
717a399bbd Fix ktutil weak password for principal creation
Now that we always enforce password quality policies, ktutil get fails
because it uses "x" as a password when creating a principal.

Of course, it's probably a misfeature that ktutil get creates principals when
they don't exist...
2019-01-09 00:14:11 -06:00
Nicolas Williams
c2b106def5 Fix wrong keepold default in kadmin and ktutil 2019-01-09 00:14:11 -06:00
Jeffrey Altman
9119136967 fix memory leaks
Change-Id: I18ad15dc802842324b3712f3f7833953434b1cf1
2019-01-04 01:22:20 -05:00
Nicolas Williams
d8394c65b7 Add new kadmin/ktutil --keep* and --enctypes opts
- Add --keepold/keepallold/pruneall options to various kadmin/ktutil
   commands.  Default behavior to "prune old keys".

 - When setting keys for a service, we need to specify enctypes for it:

    - Always use kadm5_randkey_principal_3() instead of the older
      kadm5_randkey_principal().

    - Add krb5_string_to_keysalts2(), like MIT's krb5_string_to_keysalts(),
      but with a context, and simpler.

    - Add --enctypes options to various kadmin/ktutil commands.

    - Add [libdefaults] supported_enctypes param with enctype[:salttype]
      list.

    - Add [realms] realm supported_enctypes param with enctype[:salttype]
      list.

      Default to aes128-cts-hmac-sha1-96:normal.
2019-01-02 17:29:08 -06:00
Luke Howard
014f16883c libhcrypto: UI_UTIL_FLAG_VERIFY_SILENT 2018-12-30 15:39:49 -06:00
Nicolas Williams
f38089257b Misc fixes (coverity) 2016-11-20 17:43:51 -06:00
Jeffrey Altman
d8e7027c9d admin: do_list do not shadow local variables
Remove second declaration of 's' which shadows an existing variable.

Change-Id: I2277663ab051fb4ed10823fb43489cee06bb502b
2016-11-19 02:04:07 -05:00
Nicolas Williams
52a562a3a4 Misc fixes (coverity) 2016-11-18 22:21:45 -06:00
Nicolas Williams
490337f4f9 Make OpenSSL an hcrypto backend proper
This adds a new backend for libhcrypto: the OpenSSL backend.

Now libhcrypto has these backends:

 - hcrypto itself (i.e., the algorithms coded in lib/hcrypto)
 - Common Crypto (OS X)
 - PKCS#11 (specifically for Solaris, but not Solaris-specific)
 - Windows CNG (Windows)
 - OpenSSL (generic)

The ./configure --with-openssl=... option no longer disables the use of
hcrypto.  Instead it enables the use of OpenSSL as a (and the default)
backend in libhcrypto.  The libhcrypto framework is now always used.

OpenSSL should no longer be used directly within Heimdal, except in the
OpenSSL hcrypto backend itself, and files where elliptic curve (EC)
crypto is needed.

Because libhcrypto's EC support is incomplete, we can only use OpenSSL
for EC.  Currently that means separating all EC-using code so that it
does not use hcrypto, thus the libhx509/hxtool and PKINIT EC code has
been moved out of the files it used to be in.
2016-04-15 00:16:17 -05:00
Love Hörnquist Åstrand
5aca37ae55 revert 31be932fe8 2014-09-09 18:50:22 +02:00
Jelmer Vernooij
31be932fe8 Install compatibility symlinks for kadmin and ktutil. 2014-06-11 03:44:28 +02:00
Jelmer Vernooij
63e2f30fd5 Move kadmin and ktutil to /usr/bin. 2014-06-09 23:36:23 +02:00
Viktor Dukhovni
6c4764fbc7 Fix incorrect usage message in ktutil del
Usage: remove [-h] [--principal=principal] [-p principal] [--kvno=enctype]
   [-V enctype] [--enctype=enctype] [-e enctype] [--help]
-p principal, --principal=principal principal to remove
-V enctype, --kvno=enctype          key version to remove
-e enctype, --enctype=enctype       enctype to remove
2012-05-03 15:03:07 +01:00
Love Hörnquist Åstrand
12403a31ce sprinkle more windows files 2011-07-23 11:18:21 -07:00
Love Hörnquist Åstrand
7aaba443bc add NTMakefile and windows directories 2011-07-17 12:16:59 -07:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Thomas Klausner
db8e287e41 Use "Fl Fl" for long options.
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2011-05-21 11:54:14 -07:00
Love Hornquist Astrand
b1909b2daa Fixes from NetBSD via Thomas Klausner and Roland C. Dowdeswell 2011-05-04 21:31:10 -07:00
Love Hornquist Astrand
f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
Asanka C. Herath
f40fe926ad Windows: Comprehensive clean target 2010-11-24 15:32:13 -05:00
Asanka Herath
cdcdc5cad5 Windows: Version information for binaries 2010-08-20 13:06:54 -04:00
Asanka Herath
d83611238a Windows: Build a single heimdal.dll
Heimdal.dll is a combination of libasn1, libwind, libhcrypto, libhx509
and libkrb5.
2010-08-20 13:06:54 -04:00
Russ Allbery
811d9003c1 Remove remnants of srvtab support
Support for manipulating srvtabs was previously removed, but there
were still remnants in command documentation in the ktutil man page
and some declared and exported variables for the keytab ops
definitions for srvtab manipulation.  Remove these additional
remnants.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2010-08-03 09:09:32 -07:00
Love Hornquist Astrand
c6bbdb545b First drop of Windows build infrastructure from Secure Endpoints 2009-11-24 12:12:53 -08:00
Love Hornquist Astrand
dc4e8669ea Abstract out asn1_compile and slc 2009-09-16 00:12:13 -07:00
Love Hörnquist Åstrand
f86b5b7320 don't set unused variables
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24871 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-27 03:33:47 +00:00
Love Hörnquist Åstrand
8f8f65ffe9 don't set unused variables
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24870 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-27 03:33:35 +00:00
Love Hörnquist Åstrand
76b62ca2a9 don't set unused variables
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24868 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-02-27 03:33:04 +00:00
Love Hörnquist Åstrand
2055b9e023 drop HAVE_CONFIG_H
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24547 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-30 16:48:36 +00:00
Love Hörnquist Åstrand
0df93f13a4 fix warning
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24476 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 20:48:54 +00:00
Love Hörnquist Åstrand
ffc8491b49 print aliases if there is any
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24471 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 01:01:46 +00:00
Love Hörnquist Åstrand
da9ee300c1 add destroy
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24455 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:46:54 +00:00
Love Hörnquist Åstrand
52bbc6705b remove krb4 functions
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24454 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:46:44 +00:00
Love Hörnquist Åstrand
a514d896cf add kt_destroy
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24453 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:46:34 +00:00
Love Hörnquist Åstrand
cbbc3abeb4 add destroy, remove krb4 functions
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24452 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:46:25 +00:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
9b79cebe84 add --no-delete flags
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23682 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-25 11:11:49 +00:00
Love Hörnquist Åstrand
cf5743dd42 add --no-delete flags
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23681 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-25 11:11:43 +00:00
Love Hörnquist Åstrand
7fcd266fdd use krb5_set_error_message
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23316 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-06-23 04:32:32 +00:00
Love Hörnquist Åstrand
8d40c2994b check return value of alloc functions, from Charles Longeau
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21745 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-07-31 16:11:25 +00:00
Love Hörnquist Åstrand
cc4333b758 remove cvs ignore files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21026 ec53bebd-3082-4978-b11e-865c3cabbd6b
2007-06-09 03:09:59 +00:00