Commit Graph

58 Commits

Author SHA1 Message Date
Nicolas Williams
95a458adbd kadmin: Add missing error check in ank 2023-01-04 01:36:03 -06:00
Jeffrey Altman
dafbfa666f kadmin: add_one_principal avoid shadow warning
8dcc5e617b
("kadmin: add_one_principal refactor") made 'princ_name' a
top-level variable.  This precludes the need to declare
subsequent block-level variables with the same name.

Change-Id: I4bf9e54b49a0e366ed4cd39920d3fe58439beb33
2022-01-21 10:39:57 -05:00
Jeffrey Altman
8dcc5e617b kadmin: add_one_principal refactor
If rand_password is true, allocate princ_name early to prevent
memory allocation errors after the principal was added.

Use memset_s to clear the 'password' so that it will not be
optimized away.

Change-Id: I80d11546166d2350e6a79c5a376cb9e8cb191fa3
2022-01-21 00:44:10 -05:00
Nicolas Williams
d974c37a90 kadmin: Remove dead code in add_one_namespace() 2022-01-16 23:08:32 -06:00
Jeffrey Altman
231aa68895 kadmin: add_one_namespace do not leak princ_ent
princ_ent must be saved to princ.principal early in order to
ensure that it is not leaked.

Change-Id: Ic74b48f434c727401c00e6fdcaecead988fe4263
2022-01-16 23:42:21 -05:00
Nicolas Williams
b7bf5ca6e8 kadmin: Fix warnings 2022-01-14 14:59:02 -06:00
Nicolas Williams
5447b81fb1 hdb: Move virtual principals into HDB layer
This is a large commit that adds several features:

 - Revamps and moves virtual host-based service principal functionality
   from kdc/ to lib/hdb/ so that it may be automatically visible to
   lib/kadm5/, as well as kadmin(1)/kadmind(8) and ktutil(1).

   The changes are backwards-incompatible.

 - Completes support for documenting a service principal's supported
   enctypes in its HDB entry independently of its long-term keys.  This
   will reduce HDB bloat by not requiring that service principals have
   more long-term keys than they need just to document the service's
   supported enctypes.

 - Adds support for storing krb5.conf content in principals' HDB
   entries.  This may eventually be used for causing Heimdal KDC
   services to reconfigure primary/secondary roles automatically by
   discovering the configured primary in an HDB entry for the realm.

   For now this will be used to help reduce the amount of configuration
   needed by clients of an upcoming HTTP binding of the kadmin service.
2020-09-08 00:25:36 -05: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
Luke Howard
def6e4fc79 kadmin: honour pw-expiration-time when adding principal (#360)
Adding a principal with a random key or password did not respect non-default
password expiration times, because the act of setting the key or password would
clobber it with the default. As we update the principal anyway after setting
the keys, use this opportunity to restore the requested password expiration
time. (There are other ways to solve this, but this is the least intrusive.)
2018-12-23 17:34:42 +11:00
Nicolas Williams
3d54f93bed Fix leak in kadmin ank 2015-03-24 11:50:03 -05:00
Roland C. Dowdeswell
cc47c8fa7b Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
We turn on a few extra warnings and fix the fallout that occurs
when building with --enable-developer.  Note that we get different
warnings on different machines and so this will be a work in
progress.  So far, we have built on NetBSD/amd64 5.99.64 (which
uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3).

Notably, we fixed

	1.  a lot of missing structure initialisers,

	2.  unchecked return values for functions that glibc
	    marks as __attribute__((warn-unused-result)),

	3.  made minor modifications to slc and asn1_compile
	    which can generate code which generates warnings,
	    and

	4.  a few stragglers here and there.

We turned off the extended warnings for many programs in appl/ as
they are nearing the end of their useful lifetime, e.g.  rsh, rcp,
popper, ftp and telnet.

Interestingly, glibc's strncmp() macro needed to be worked around
whereas the function calls did not.

We have not yet tried this on 32 bit platforms, so there will be
a few more warnings when we do.
2012-02-20 19:45:41 +00:00
Nicolas Williams
e23a1efdc9 Fixes for updates of KADM5_KVNO but not KEY_DATA and vice-versa.
It turns out that updates of kvno but not key data and vice-versa are
both, allowed and actually done (e.g, in kadmin's ank).  Doing the right
thing in these cases turns out to be a bit tricky, but this commit ought
to do it.
2011-07-22 16:07:10 -05:00
Nicolas Williams
e020dc25b8 Fix a double free in ank.c. 2011-07-22 16:07:08 -05:00
Nicolas Williams
1f349a6aba kadmin support for policies. 2011-07-22 16:05:21 -05: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
Love Hornquist Astrand
433b1d5073 drop RCSID 2010-03-16 12:52:58 -07:00
Love Hörnquist Åstrand
0c6e235109 use krb5_principal_get_realm
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25119 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-04-16 08:15:44 +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
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
091fba8a25 return 1 on failure, update (c)
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16658 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-01-25 12:29:46 +00:00
Love Hörnquist Åstrand
d12920441b (add_new_key): return 1 on failure.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16654 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-01-25 12:18:41 +00:00
Love Hörnquist Åstrand
192b125577 (add_one_principal): catch error from UI_UTIL_read_pw_string
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14332 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-11-01 08:41:00 +00:00
Johan Danielsson
5836537f76 argument number checks are now done by slc
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14026 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-07-05 11:41:22 +00:00
Johan Danielsson
d970c48c81 print error messages to stderr; change all in-string quoting to use "
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14021 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-07-04 15:09:42 +00:00
Love Hörnquist Åstrand
429fc15b79 fix slc lossage
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14016 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-07-02 13:38:45 +00:00
Johan Danielsson
9929f779ec move kadmin-commands.h from kadmin_locl.h so kadmind does not depend on it
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14000 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-06-27 15:04:07 +00:00
Johan Danielsson
d7f9fac88e convert to use slc; also add stash subcommand
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13970 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-06-21 19:19:45 +00:00
Love Hörnquist Åstrand
5095f7bbc3 (add_one_principal): even though the principal is disabled (creation
of random key/keydata), create it with a random password


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13447 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-03-07 14:31:26 +00:00
Love Hörnquist Åstrand
a0714dedc6 (add_one_principal): pass right argument to kadm5_free_principal_ent
From Panasas, Inc


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13200 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-12-07 19:26:26 +00:00
Love Hörnquist Åstrand
8b66e46474 s/des_read_pw_string/UI_UTIL_read_pw_string/
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12759 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-09-03 11:47:30 +00:00
Johan Danielsson
4fcac6e9be (add_one_principal): check return value from edit_entry
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11556 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-12-03 14:11:24 +00:00
Johan Danielsson
5807150c8b (add_one_principal): don't continue if create_principal fails
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11555 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-12-03 14:10:30 +00:00
Jacques A. Vidrine
29538a775a Do not attempt to free uninitialized pointer when
kadm5_randkey_principal fails.  This would most likely
be encountered when one does not have change-password
rights, but uses one of the `--random-key' or `--random-password'
options of the ank command.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11036 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-06-07 19:05:38 +00:00
Johan Danielsson
bd603d56fa add a --use-defaults option to just use default values without questions
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10459 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-08-10 08:08:22 +00:00
Johan Danielsson
3e24852f6d calling the command `add' make more sense from an english pov
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9042 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-09-10 19:16:39 +00:00
Assar Westerlund
4bfe69645d add --key
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8052 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-03-23 15:20:43 +00:00
Johan Danielsson
c5b916ca6f remove advertising clause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7464 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-02 17:05:13 +00:00
Assar Westerlund
6f070d95ce (add_one_principal): `password' can cactually be NULL in the overwrite
code, check for it.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7070 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-10-01 15:16:41 +00:00
Assar Westerlund
d3f5d79294 strc{py,at}_truncate -> strlc{py,at}
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6985 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-09-16 21:39:11 +00:00
Assar Westerlund
269432f82f (add_one_principal): initialize `default_ent'
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6863 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-08-24 23:26:17 +00:00
Assar Westerlund
c22bb92415 add support for --random-password
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6853 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-08-21 12:38:58 +00:00
Assar Westerlund
82218a6ea7 add setting of expiration and password expiration
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6846 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-08-19 20:30:44 +00:00
Assar Westerlund
be29622761 (add_one_principal): allow setting expiration times
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6500 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-07-23 22:09:33 +00:00
Assar Westerlund
2faa266a21 make ank use the values of the default principal for prompting
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6352 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-06-23 12:37:05 +00:00
Assar Westerlund
2db8ae77eb (add_new_key): initialize more variables
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6147 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-07 19:02:49 +00:00
Assar Westerlund
a6b7e36937 (add_new_key): new options for setting max-ticket-life,
max-renewable-life, and attributes


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6125 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-05-04 18:39:50 +00:00
Johan Danielsson
aaae186ab9 merge new-crypto branch
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5332 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-02-11 21:03:59 +00:00