Commit Graph

30873 Commits

Author SHA1 Message Date
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
Jeffrey Altman
adde2e5b4b roken: snprintf properly account for char widths
If a char width is specified the number of output buffer bytes
consumed might be greater than one.   Update append_char() to
return the number of bytes consumed and use that value in xyzprintf()
instead of one.
2023-06-06 09:32:33 -04:00
Jeffrey Altman
c64d4ce968 krb5: krb5_enctype_to_keytype cast krb5_enctype to krb5_keytype
The struct _krb5_key_type.type is krb5_enctype.   Cast it to
krb5_keytype before assigning to the 'krb5_keytype *keytype'
output variable to avoid a warning from Clang 1500 on Darwin.
2023-06-06 09:11:29 -04:00
Nicolas Williams
692187e5d6 ipropd-slave: Fetch new credentials more often
If the master is unreachable for a while we can end up with expired
tickets that don't get refreshed, then ipropd-slave gets stuck until
it's manually restarted.
2023-05-31 13:57:32 -05:00
Nicolas Williams
658db1c2c2 kinit: Translate context init error codes (fix #1126) 2023-05-27 16:30:46 -05:00
Nicolas Williams
3e2c1c83b4 base: Translate context init error codes 2023-05-27 16:30:25 -05:00
Nicolas Williams
bc4e6591af base: Do support /dev/null as a config file 2023-05-27 16:30:25 -05:00
Nicolas Williams
9cbafd7320 kadmin: Add missing options to kadmin(1) page (fix #1118) 2023-05-26 23:52:24 -05:00
Taylor R Campbell
a142767598 Fix ctype.h misuse.
Excluded: libtomath and libedit files, most of which appear to be
testing or example code not involved in production, and which are
derived from an upstream that should perhaps have patches submitted
upstream instead.

fix https://github.com/heimdal/heimdal/issues/1111
2023-05-26 14:10:11 -05:00
Nicolas Williams
39f24c4cd4 krb5: Fix crash in resolving "DIR" as a ccache name (Fix #1108) 2023-05-26 13:47:26 -05:00
Nicolas Williams
7812c17f95 doc: Document KRB5CCNAME and KRB5_KTNAME 2023-05-26 13:24:06 -05:00
Nicolas Williams
b220338e80 admin: Document KRB5_KTNAME env var 2023-05-26 13:23:47 -05:00
Nicolas Williams
04933966e6 wind: Fix build (snprintf overflow warning in test) 2023-05-26 13:07:45 -05:00
Nicolas Williams
a12fd81f13 GHA: Upgrade to Python 3 2023-05-26 12:42:22 -05:00
Nicolas Williams
e8cc209bfa GHA: Upgrade to Ubuntu 22.04 (fix #1114) 2023-05-26 12:35:15 -05:00
Nicolas Williams
5f075feff4 kinit: Document KRB5CCNAME value syntax 2023-05-26 12:35:15 -05:00
Dan McGregor
442664d94f cf: Honour OpenSSL library and include paths
Check for OpenSSL features while LDFLAGS and CFLAGS are set with
the paths provided in the configure command line. This allows
detecting a non-default OpenSSL's version correctly, such as
on FreeBSD with one of the OpenSSL 3.0 ports.
2023-05-19 11:39:19 -05:00
Jeffrey Altman
61dc4ff8df krb5: fixup crypto.c avoid realloc to trim memory allocation
1b1ff8fdd5 ("krb5: crypto.c avoid realloc
to trim memory allocation") removed the realloc() but failed to assign
'p' to 'result->data'.
2023-05-03 17:18:01 -04:00
Jeffrey Altman
1b1ff8fdd5 krb5: crypto.c avoid realloc to trim memory allocation
decrypt_internal_derived(), decrypt_internal_enc_then_cksum(),
decrypt_internal(), and decrypt_internal_special() execute the
following pattern where 'p' is an allocation of size 'len'

  l = len - n
  memmove(p, p + n, l);
  result->data = realloc(p, l);
  if (result->data == NULL && l != 0) {
      free(p);
      return krb5_enomem(context);
  }
  result->length = l;

which when compiled by gcc 13.0.1-0.12.fc38 or gcc-13.0.1-0.13.fc39
generates the following warning

  warning: pointer 'p' may be used after 'realloc' [-Wuse-after-free]

The C language specification indicates that it is only safe to free()
the pointer passed to realloc() if errno is set to ENOMEM.  Yet the
warning is generated by the following pattern

  l = len - n
  memmove(p, p + n, l);
  errno = 0;
  result->data = realloc(p, l);
  if (result->data == NULL && l != 0) {
      if (errno == ENOMEM)
          free(p);
      return krb5_enomem(context);
  }
  result->length = l;

The value of performing the realloc() is questionable.  realloc()
in many cases will need to perform a second allocation of the
smaller size and then perform a memcpy() which will slow down
the operation without saving much memory.  The allocation is already
very small.

This change avoids the warning by removing the realloc() entirely.
2023-05-03 17:02:34 -04:00
Nicolas Williams
d280a83ebe kinit: w/ command ignore SIGINT/SIGQUIT (fix #1077) 2023-03-28 13:53:58 -05:00
Robert Manner
bcbe816962 spnego/context_storage: undef sc_flags (for hpux)
On hpux this is seems to be a define from sys/signal.h:

which renders the variable name invalid.
2023-02-06 18:17:48 -06:00
Norbert Bokor
14aca7a831 heimdal/asn1: do not throw error when trying to allocate 0 bytes of memory 2023-02-06 18:17:48 -06:00
Robert Manner
6dc36f99c0 heimbase-atomics.h: replace heim_base_atomic_barrier with syntax valid noop
in case there is no implementation available.
2023-02-06 18:17:48 -06:00
Nicolas Williams
48382936e5 hcrypto: Fix performance regression 2023-01-27 11:00:23 -06:00
Luke Howard
dffa545f81 gss: colaesce DCE_STYLE padding/trailer buffer check 2023-01-17 17:57:30 +11:00
Luke Howard
dc682769c4 gss: use mechglue instead of gssntlm encoders
Replace calls to {en,de}code...() with mechglue equivalents.
2023-01-16 19:11:03 +11:00
Luke Howard
363e7d1e0f gss: don't truncate authtime in gsskrb5_extract_authtime_from_sec_context()
The interface between the krb5 mechanism and the mechglue API
gsskrb5_extract_authtime_from_sec_context() assumed the authtime would fit into
an uint32_t, which is not the case on platforms where time_t is 64-bit.

Fixes: #1073
2023-01-16 09:16:39 +11:00
Luke Howard
98858aa215 gss: add 64-bit int {en,de}coders to mechglue 2023-01-16 09:16:39 +11:00
Luke Howard
fbd091d65e gss: use mechglue instead of gsskrb5 encoders
Replace calls to _gsskrb5_{en,de}code...() with mechglue equivalents.
2023-01-16 09:16:39 +11:00
ChristianBoehm
f7e6ac6e6c Update krb5.conf
proposal adding include or include.d in krb5.conf as comment
2023-01-12 10:19:35 -06:00
Nicolas Williams
1fbe5236b1 test: Add minimal interop test with MIT Kerberos 2023-01-11 12:59:12 -06:00
Nicolas Williams
efdd6c589d base: Fix fallback atomics 2023-01-11 12:59:12 -06:00
Nicolas Williams
08c48c10c8 base: Add atomic CAS macros/functions 2023-01-10 23:28:33 -06:00
Nicolas Williams
33f90a6604 krb5: Document pkinit_revoke (fix #991) 2023-01-09 23:00:08 -06:00
Nicolas Williams
cb5262014a Revert "kdc: Quiet warning in FAST unwrap"
This reverts commit a9c0b8f264.

From Joseph Sutton:

> I found that this commit would result in `KRB5KRB_AP_ERR_BAD_INTEGRITY`
> errors in Samba whenever explicit FAST armor was present. Reverting the
> commit made FAST work again.

> It should be safe to use `tgs_ac` here, since it will always be non-NULL if
> `r->explicit_armor_present` is true. Maybe a local variable
> `explicit_armor_present` (which would be assigned to
> `r->explicit_armor_present` before the function returns successfully) would
> help a static analyser to deduce that its value doesn't change within the
> function, and that `tgs_ac != NULL` still holds.

a9c0b8f264 (commitcomment-95581208)
2023-01-09 22:30:10 -06:00