Commit Graph

30251 Commits

Author SHA1 Message Date
Jeffrey Altman
cd91a3a03e appl/afsutil: expand_cell_name return NULL if not found
In function ‘afslog_cell.isra’:
  afslog.c:144:13: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
  144 |            warnx("No cell matching \"%s\" found.", cell);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

caused by expand_cell_name() returning the input pointer.
Alter the behavior of expand_cell_name() to match its usage.

Change-Id: I3b15c4b3e59b597af5351e5e62f5d7751be50feb
2022-01-21 08:51:28 -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
Jeffrey Altman
912b20c4d7 kadmin: refactor set_random_password
Obtain the unparsed principal name early so that there is no
risk of memory allocation failure after kadm5_chpass_principal_3()
succeeds.

Change-Id: I389281004826da5752081c2f26127d55e3dc3989
2022-01-21 00:31:56 -05:00
Jeffrey Altman
fb52fd1c53 kadmin: kadmind_dispatch do not write to 'out' on error
1b213c1082 ("kadmind: Add missing
error checks") altered the behavior of kadmin_dispatch() such that
it unconditionally called

  krb5_storage_to_data(rsp, out);

Previously kadmin_dispatch() only wrote to 'out' on success.
Doing so is important because 'rsp' might be NULL on error.

Change-Id: I2688a5c47db0f94d955971e785037c578d3f3fa4
2022-01-21 00:25:15 -05:00
Jeffrey Altman
4ffd190b08 kadmin: kadmind_dispatch fix handling of HEIM_ERR_EOF error
1b213c1082 ("kadmind: Add missing
error checks") altered the scope of the

   if (ret == HEIM_ERR_EOF)
      ret = 0;

treatment of HEIM_ERR_EOF as a success code.  Prior to that
commit HEIM_ERR_EOF meant success only when reading the 'keepold'
value.  It indicated a premature failure if returned when reading
'princ' or 'n_key_data'.

This change corrects the scope of HEIM_ERR_EOF indicating success.

Change-Id: If5463b47dc3eabee6fa2f8e717147f02adc1586c
2022-01-20 23:43:06 -05:00
Jeffrey Altman
81f3a0b804 lib/hdb: ndbm correct asprintf error handling
asprintf() return code must be checked because in case of failure
the value of the output buffer variable is undefined.

Change-Id: I75e06fffe2330ec10dbe4f678479ded479ab5931
2022-01-20 23:33:11 -05:00
Jeffrey Altman
2e54dc7aae lib/hcrypto: DES_cfb64_encrypt init buffer in decrypt path 2022-01-20 21:29:11 -05:00
Luke Howard
8946f0de9d gss_preauth: remove dead code
The intent was to map KRB5KRB_AP_ERR_BAD_INTEGRITY and HNTLM_ERR_AUTH to
KRB5KRB_AP_ERR_BAD_INTEGRITY, but this code was never reached.
2022-01-21 10:09:44 +11:00
Luke Howard
fce4d19953 kdc: declare calling/linkage conventions for accessors
Decorate generated accessors with KDC_LIB_FUNCTION/KDC_LIB_CALL for correct
linkage on Windows.
2022-01-21 08:22:07 +11:00
Nicolas Williams
fea2ce1831 GitHub: OSX: what's running on port 49188 anyways? 2022-01-20 15:10:54 -06:00
Nicolas Williams
06ba7b1597 test: When kdc fails to start, show the log
This is an attempt to find out why the GitHub Actions OS X build is
failing.
2022-01-20 14:32:17 -06:00
Nicolas Williams
7e67437594 GitHub: Add optional coverity build 2022-01-20 13:54:51 -06:00
Nicolas Williams
588e49a1bc kdc: Fix copy_Principal_ptr() bug (plugin acc.) 2022-01-20 13:32:31 -06:00
Nicolas Williams
681708f416 gsskrb5: Fix coverity issue 2022-01-20 13:28:57 -06:00
Nicolas Williams
62176f07d9 kuser: Fix coverity issues 2022-01-20 13:28:39 -06:00
Nicolas Williams
be6305b601 kadm5: Fix ENOMEM path leak 2022-01-20 12:41:39 -06:00
Nicolas Williams
b0fa256521 krb5: Fix coverity warning in krcache.c 2022-01-20 12:41:39 -06:00
Nicolas Williams
b991c4b2b3 hdb: Fix coverity warnings
This is a fix for a false positive that we can avoid by changing the
internal API in question.  Might as well.
2022-01-20 12:41:39 -06:00
Nicolas Williams
d1564ce6e9 kcm: Fix coverity issues 2022-01-20 12:41:39 -06:00
Jeffrey Altman
7ab7fdd269 update .gitignore 2022-01-20 12:49:19 -05:00
Jeffrey Altman
34e918f210 lib/krb5: unparse_name_fixed ERANGE if zero buffer len
The tests depend upon an ERANGE error for buffer length zero.
They broken due to 8324a2af1d
("lib/krb5: unparse_name_fixed error if invalid name buffer or length")
which returned EINVAL.

Change-Id: I81693f9d3f5fdc1838c11ffbfe0dafc742d9b207
2022-01-20 11:09:04 -05:00
Jeffrey Altman
d55abd8f50 lib/krb5: make_local_fast_ap_fxarmor requires a ccache
If make_local_fast_ap_fxarmor() is called without a ccache
it will segmentation fault.  Set a krb5 error message in the
context and fail with EINVAL.

Change-Id: I8a72a026dbae931e41498f55cd634ad2fee26772
2022-01-20 10:22:51 -05:00
Jeffrey Altman
966e98d50b lib/krb5: fcc_remove_cred return krb5_cc_end_seq_get failure
krb5_cc_end_seq_get() is not expected to fail because it is a
cleanup routine.  If it fails it indicates something wrong with
the cache or the system.  Return the failure if there is one.

Otherwise, the failure from krb5_cc_next_cred() should be
returned UNLESS it is KRB5_CC_END in which case return success.

Change-Id: I80e07103e2fb38aa40418a436fa5351fb89549d3
2022-01-20 10:06:11 -05:00
Jeffrey Altman
29940dd22c lib/krb5: krb5_init_creds_set_service fail if set_realm fails
Calls to krb5_principal_set_realm() can fail due to memory
allocation failures.  If the client realm cannot be set in
the generated principal the wrong realm will be used.
Check for the result of krb5_principal_set_realm() and if
there is a failure, clean up and return the error code to
the caller.

Change-Id: Icadd04c858e88c1ba1d4344c60a784885a6a1344
2022-01-20 09:44:43 -05:00
Jeffrey Altman
8324a2af1d lib/krb5: unparse_name_fixed error if invalid name buffer or length
If the output 'name' buffer is NULL or length is zero, there is
no place to unparse the principal name to.  Fail with EINVAL and
if possible set an error message on the krb5_context.

This avoids potential NULL pointer dereferences.

Change-Id: Ie38d284f1867be883a2f2e31103ea50cd130a0fe
2022-01-20 09:27:59 -05:00
Jeffrey Altman
8836e6a39d lib/krb5: krb5_vset_error_message is no-op if no krb5_context
Refactor krb5_vset_error_message() to remove the many conditional
tests on the existence of krb5_context.  If there is no krb5_context
then _krb5_debug() is a no-op.  Therefore, there is no point in
performing any of the other work.

Change-Id: Ib88b592a542a195f27e352a80ced0a98a6f85300
2022-01-20 09:09:27 -05:00
Luke Howard
e32f7a4387 kdc: add _nocopy setter for use by mssfu
Add an internal-use setter accessor for use by mssfu.c when principal names are
replaced. This also fixes a leak where r->client_princ was not freed before
being replaced with the impersonated client name.
2022-01-20 17:23:24 +11:00
Luke Howard
ec24edf700 kdc: add accessor functions for KDC request structure
Add accessor functions for use by Samba and other plugin developers.
Documentation is in kdc/kdc-accessors.h.
2022-01-20 17:23:24 +11:00
Luke Howard
ed4fe65794 base: change ret fieldname to error_code in request struct 2022-01-20 17:23:24 +11:00
Luke Howard
f4e936c893 include: fix token_validator_plugin.h typo
token_validator_plugin.h was also missing in Makefile.am:CLEANFILES.
2022-01-20 17:23:11 +11:00
Nicolas Williams
302250026c kdc: Do not announce via Bonjour when testing
Let's see if this fixes the GitHub Actions OS X CI.
2022-01-20 00:20:30 -06:00
Luke Howard
0c26edd468 include: add more generated files to CLEANFILES
take #2, fix build breakage.

Recently added features for Heimdal 8 did not update
include/Makefile.am:CLEANFILES appropriately.
2022-01-20 17:17:58 +11:00
Luke Howard
d74b411f12 Revert "include: add more generated files to CLEANFILES"
This reverts commit 622527d9ca.
2022-01-20 17:17:09 +11:00
Luke Howard
622527d9ca include: add more generated files to CLEANFILES
Recently added features for Heimdal 8 did not update
include/Makefile.am:CLEANFILES appropriately.
2022-01-20 17:15:51 +11:00
Nicolas Williams
9d0149d2f2 krb5: Context has to be opt. in for path tok. exp. 2022-01-19 23:49:06 -06:00
Nicolas Williams
1eda4920c8 krb5: Fix coverity warnings 2022-01-19 23:38:27 -06:00
Nicolas Williams
9203c4a3f4 ipropd: Ignore setsockopt() result 2022-01-19 23:37:32 -06:00
Nicolas Williams
4eec82dc52 ipc: Ignore setsockopt result 2022-01-19 23:37:01 -06:00
Nicolas Williams
dd2ad50fbf hdb: Make HDB-as-keytab get function match API
krb5_kt_get_entry() allows a NULL principal to be given ("match all").

The get method of the HDB-as-keytab keytab did not know this, and could
dereference a NULL as a result.
2022-01-19 23:35:19 -06:00
Nicolas Williams
cf19a0f8e3 krb5: Context must be optional for error functions
We pass a NULL context to error functions in CCAPI (lib/krb5/acache.c)
code paths.
2022-01-19 23:33:44 -06:00
Nicolas Williams
1e634df8a5 base: Context has to be optional in for path tok. exp.
We call path token expansion functions with a NULL context in CCAPI
(lib/krb5/acache.c).  We only need the context for errors.
2022-01-19 23:32:22 -06:00
Nicolas Williams
82e00128a2 base: Context has to be opt. in for error functions
This is needed so that it can be optional for path token expansion,
which has to have the context be optional for ccapi (lib/krb5/acache.c),
which in some cases calls path token expansion functions w/ a NULL
context.
2022-01-19 23:30:55 -06:00
Nicolas Williams
c650e37321 kdc: Fix leak caused by a1481f1f0 2022-01-19 17:32:16 -06:00
Nicolas Williams
03c69ffe1c GitHub: Use -Wnonnull for GCC build 2022-01-19 17:00:11 -06:00
Nicolas Williams
4a0e01f9ed kadm5: Add missing error checks 2022-01-19 16:57:06 -06:00
Nicolas Williams
97cef99f54 iprop: Fix coverity warnings 2022-01-19 16:53:45 -06:00
Nicolas Williams
1b213c1082 kadmind: Add missing error checks 2022-01-19 16:33:37 -06:00
Nicolas Williams
655c057769 kadm5: Add missing error checks 2022-01-19 16:33:17 -06:00
Nicolas Williams
9d6dd21256 iprop-log: Add missing error checks 2022-01-19 13:59:04 -06:00
Nicolas Williams
ff4c82cd47 kpasswdd: Fix leak of keytab on exit 2022-01-19 13:41:29 -06:00