Commit Graph

30857 Commits

Author SHA1 Message Date
Taylor R Campbell
ca0e53b64f Pass -d to yacc(1) so it generates the header file.
Bison must generate this unsolicited, but BSD yacc does not.

The makefiles for lib/com_err and lib/sl already did this; this
change just adds it to lib/asn1 and lib/hx509 too.

fix https://github.com/heimdal/heimdal/issues/1100
2023-06-21 16:07:16 -05:00
Taylor R Campbell
9569ee1a3b kinit: Update SecKeychainFindGenericPassword to SecItemCopyMatching.
Tested on macOS Venture 13.4.  Not sure if this requires some
compatibility ifdefs for older macOS.

fix https://github.com/heimdal/heimdal/issues/1168
2023-06-21 13:10:15 -05:00
Taylor R Campbell
e3e271ff70 hdb/hdb-mitdb: Nix unused variable key_data in mdb_seq.
key_data is unused.  Presumably this was copypasta from DB_seq in
hdb/db.c, where it is used for the Heimdal database format in which
the value may be missing a principal but it can be recovered from the
key.  In contrast, the mit-krb5 format appears to always store the
principal in the value and _hdb_mdb_value2entry always retrieves it,
with no need for a key2principal fallback.

fix https://github.com/heimdal/heimdal/issues/1102
2023-06-20 23:18:08 -05:00
Taylor R Campbell
1d2233f907 gssmask: Use asprintf to avoid having to think about max uname.
This way there is no truncation and no build failure due to
-Werror=format-truncation as is the default in some compilers, such
as gcc7.4 with -Wall -Werror.

This is presumably not space-constrained or performance-critical; the
very next thing it does is another asprintf and frees it immediately.
And uname is not usually under any adversary's control.

fix https://github.com/heimdal/heimdal/issues/1105
2023-06-20 23:18:08 -05:00
Joseph Sutton
da9cad2047 kdc: Overwrite ‘error_code’ only if we have an actual error
‘r->error_code’ might have been set earlier, and we don’t want to
overwrite it with a successful error code.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-20 18:02:15 -05:00
Joseph Sutton
243207f10a kdc: Ensure that we emit a non-zero error code
If ‘r->error_code’ was zero, we would turn it into an ERR_GENERIC error
and return that to the client. Now we return the actual error code
instead.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-20 18:02:15 -05:00
Joseph Sutton
af0b70fcc2 kdc: Fix discarded qualifiers warning
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-20 18:02:15 -05:00
Joseph Sutton
043b0d02c1 kdc: Don’t abort if krb5_generate_random_keyblock() fails
There are a few reasons that this function could fail (e.g., failure to
allocate memory) besides random number generation being unavailable. No
other caller abort()s on failure like this.

Furthermore, krb5_generate_random_block(), which is called by
krb5_generate_random_keyblock(), already aborts if random generation
fails.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-20 18:02:15 -05:00
Joseph Sutton
43a4c01126 kdc: Fix missing space in log messages
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-20 18:02:15 -05:00
Joseph Sutton
4a699f2450 kdc: Remove trailing space from log message
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-20 18:02:15 -05:00
Joseph Sutton
cb69ce4382 kdc: Remove trailing space from log message
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-20 18:02:15 -05:00
Joseph Sutton
8640c7c168 krb5: Return appropriate error code 2023-06-20 18:02:15 -05:00
Joseph Sutton
d83802e2d4 kdc: Fix log message typo 2023-06-20 18:02:15 -05:00
Joseph Sutton
c1bd7772ed third_party/heimdal: Fix deprecation messages
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-20 18:02:15 -05:00
Siva Mahadevan
a7019d4b88 kadmin/check: move error messages to stderr
This helps with certain automation tools, such as ansible, that usually
expect failure to be visible in stderr.

Other minor changes:
* replace "doesn't" with "does not" to keep messages consistent and
  avoid escaping quotes in grep, etc.
* add newlines
2023-06-20 13:16:19 -05:00
Robert Manner
e8e8b78d65 hx509/hxtool.c: ensure parse_bytes() result does not overflow 2023-06-20 12:57:28 -05:00
Robert Manner
37cd2c16b8 asn1/check-gen.c: disable some non working bignum tests on 32 bit systems 2023-06-20 12:57:28 -05:00
Robert Manner
56d97563f0 kcm,kdc/config.c: detect too big max_request sizes (>= 64 MB) 2023-06-20 12:57:28 -05:00
Robert Manner
65e5b0ab79 roken/parse_bytes: fix test for >= terabyte units on 32 bit systems
On 32 bit systems, sizeof(ssize_t) and sizeof(unsigned long aka UL) is
32 bits which is not able to hold the value of a terabyte.
2023-06-20 12:57:28 -05:00
Taylor R Campbell
997916e3f6 krb5: Make heimdal_version and heimdal_long_version const.
Pretty sure it is not useful for applications to be able to write to
this.

However, caveat: this could break programs that expect to pass around
&heimdal_version or &heimdal_long_version to functions that expect
pointers to non-const objects even if they don't modify them.
2023-06-20 12:19:48 -05:00
Taylor R Campbell
426eb46441 com_err: Constify xyz_error_strings arrays.
Note: This changes the types of public symbols.  It is unlikely that
any applications would rightly _write_ to these arrays, but it is
possible they might require some UNCONST in order to pass the
pointers to other functions that are missing const qualifiers.
2023-06-20 12:19:48 -05:00
Taylor R Campbell
c69ce29a31 krb5/constants.c: Make some constants constant.
This changes the public header file but I doubt it was ever intended
that applications could change these by writing to them.  (Not sure
why they're not declared as const arrays in any case.)
2023-06-20 12:19:48 -05:00
Taylor R Campbell
fdbf355be0 ipc/client.c: Make never-modified global ipcstable const. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
29b1faaef6 krb5/send_to_kdc.c: Constify plugin stuff. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
c644d051d8 krb5/pcache.c: Constify plugin stuff. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
1f870603a4 krb5/kuserok.c: Constify plugin stuff. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
2e3dada6fd krb5/krbhst.c: Constify plugin stuff. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
084d638906 krb5/db_plugin.c: Constify plugin stuff. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
da5730a4b0 krb5/aname_to_localname.c: Constify plugin stuff. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
6630cf5889 krb5/plugin.c: Constify. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
eb0d98ba34 base/plugin.c: Constify.
As a bonus, eliminate an unnecessary rk_UNCONST.
2023-06-20 12:19:48 -05:00
Taylor R Campbell
b67a083a3c krb5/send_to_kdc.c: Sprinkle const on global data never changed. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
796e420c11 libkrb5, libkdc: Constify salted s2k default iterator counts.
These externs should really be in a .h file shared by definition and
usage sites so the C compiler can verify that they match.
2023-06-20 12:19:48 -05:00
Taylor R Campbell
8f2f159f7f krb/pac.c: Sprinkle const on global data never changed. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
c2c47aec6c krb5/init_creds_pw.c: Sprinkle const on global data not changed. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
35688d030f krb5/get_in_tkt.c: Sprinkle const on global data never changed. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
cf0418d6fc krb5/get_host_realm.c: Sprinkle const on global data never changed. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
5d9723d52d krb5/context.c: Sprinkle const for global data never changed. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
9b61e64c3d krb5/changepw.c: Sprinkle const for global data never changed. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
043bb8f27d krb5/addr_families.c: Sprinkle const for global data never changed. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
72606cb95e libheimbase: Allow static const heim types. 2023-06-20 12:19:48 -05:00
Taylor R Campbell
2db6c29a3e krb5/mk_error.c: Constify and rk_UNCONST a static buffer.
This is almost certainly intended never to be written to, so let's
let the operating system detect that mistake for us by mapping it in
a .rodata segment mapped read-only that will cause SIGSEGV on write.

fix https://github.com/heimdal/heimdal/issues/1136
2023-06-20 12:19:48 -05:00
Taylor R Campbell
ca1200df03 krb5_decrypt_iov_ivec: Make sure const zero IV is actually const.
This way if anything _does_ write to it, it has the opportunity to be
caught by SIGSEGV, by having zero_ivec in a .rodata segment mapped
read-only.

fix https://github.com/heimdal/heimdal/issues/1135
2023-06-20 12:19:48 -05:00
Joseph Sutton
1b954faeeb kdc: Pass in HDB_F_ARMOR_PRINCIPAL when fetching armor ticket client principal
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-13 17:41:21 -05:00
Joseph Sutton
79f47ab3f3 hdb: Add flag to indicate a fetch for the client of an armor ticket
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-13 17:41:21 -05:00
Joseph Sutton
cf6b216868 kdc: Have caller pass HDB_F_FOR_TGS_REQ into _kdc_fast_check_armor_pac()
We shall soon want to use this function for AS-REQs as well as TGS-REQs.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-06-13 17:41:21 -05:00
Stefan Metzmacher
df848bfd97 kdc: don't announce KRB5_PADATA_GSS unless gss_preauth is enabled
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15273

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2023-06-12 12:41:02 -05:00
Stefan Metzmacher
eb388539ec kdc: don't announce KRB5_PADATA_PKINIT_KX unless anonymous is allowed
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15273

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2023-06-12 12:41:02 -05:00
Stefan Metzmacher
67a6eb3218 kdc: don't announce KRB5_PADATA_FX_FAST unless fast is enabled
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15273

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2023-06-12 12:41:02 -05:00
Jeffrey Altman
93454c885c roken: qsort provide ANSI C prototype for swapfunc()
K&R is no longer acceptable.
2023-06-06 09:55:27 -04:00