Commit Graph

17873 Commits

Author SHA1 Message Date
Jeffrey Altman
38536d7313 lib/asn1: set *size output to zero at start of der funcs
Assign zero to the output size parameter at the start so that
callers that use the value when an error occurs do not see
garbage that might be misinterpreted.

Change-Id: Iccfcf4f6944b1bf72789c83919901d9b9d6f9153
2022-01-23 00:10:14 -05:00
Roland C. Dowdeswell
8dcd05ed4d _gss_ntlm_init_sec_context() mem leaks 2022-01-22 21:54:20 -05:00
Roland C. Dowdeswell
e87fca8091 _gss_ntlm_delete_sec_context() mem leaks 2022-01-22 21:54:20 -05:00
Roland C. Dowdeswell
8526b4c627 fix memory leak near NTLM type2 response 2022-01-22 21:54:20 -05:00
Nicolas Williams
d64076dfd9 asn1: Update commentary on grammar 2022-01-22 03:48:27 -06:00
Nicolas Williams
dfc26ae8c1 asn1: Fix last remaining shift/reduce conflict 2022-01-22 03:48:27 -06:00
Nicolas Williams
563964ce96 hx509: Use %left for ! instead of %precedence 2022-01-21 23:34:40 -06:00
Nicolas Williams
88e31d2da8 sl: Add missing sel-gram.h target 2022-01-21 23:15:21 -06:00
Nicolas Williams
cb9b1842ea sl: Fix bison/byacc invocation 2022-01-21 23:01:44 -06:00
Nicolas Williams
20497ed2d4 com_err: Fix bison/byacc invocation 2022-01-21 23:01:44 -06:00
Nicolas Williams
664b749399 hx509: Fix sel-gram.y shift/reduce conflicts
AND and OR are now binary operators, left-associative, with AND having
higher precedence than OR.

The not operator is now higher-precedence than the AND and OR operators.
2022-01-21 22:58:22 -06:00
Nicolas Williams
e1fa08a4d6 asn1: Fix 5 shift/reduce conflicts
There remains one tough shift/reduce conflict, the warning for which is
quieted with an `%expect 1` directive.

The remaining conflict has to do with whether a constraint attaches to
the inner type that some other outer type is a SET OF or SEQUENCE OF or
tagged-type of, or whether it attaches to the outer type.  The two are
really the same thing.  The latter is the reduce side, so it's not used,
but if it were we could grab the constraint in the action and attach it
to the inner type anyways.
2022-01-21 22:37:05 -06:00
Nicolas Williams
f0f6bb03f4 hdb: Lower-case HDB_DB_FORMAT to make it valid ASN.1
In order to resolve some shift/reduce conflicts in the ASn.1 compiler's
grammar we need to be strict about value names starting with lower case
and type names starting with upper-case.
2022-01-21 22:37:05 -06:00
Jeffrey Altman
04527412e3 Follow the Linux kernel's lead on "fallthrough"
The pseudo keyword 'fallthrough' is defined such that case statement
blocks must end with any of these keywords:
 * break;
 * fallthrough;
 * continue;
 * goto <label>;
 * return [expression];
 *
 *  gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes

The macro is defined either as

  __attribute__((__fallthrough__))

or as

  do {} while (0)  /* fallthrough */

not including the semicolon.

This change implements the Linux kernel style and updates several locations
where "/*fallthrough*/ and /* FALLTHROUGH */ were not previously replaced.

Externally imported code such as libedit, libtommath and sqlite are
restored to their unaltered state.

Change-Id: I69db8167b0d5884f55d96d72de3059a0235a1ba3
2022-01-21 10:39:47 -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
Nicolas Williams
681708f416 gsskrb5: Fix coverity issue 2022-01-20 13:28:57 -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
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
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
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
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
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
8c5030bcf7 gss: test_context: Fix leak 2022-01-19 12:35:08 -06:00
Nicolas Williams
26054d835c gss: Fix leak in gss-token 2022-01-19 12:33:11 -06:00
Nicolas Williams
fb4632edb1 krb5: Fix leak in test_ap-req.c 2022-01-18 15:40:54 -06:00
Nicolas Williams
3b0b9f2dfe krb5: Constify _krb5_principal2principalname() 2022-01-18 15:12:56 -06:00
Nicolas Williams
f26bc69ded gss: Fix name attr leak in test_context 2022-01-18 12:35:26 -06:00
Nicolas Williams
0b137e3287 gss: Workaround valgrind "lifetime not equal" issue 2022-01-18 12:35:26 -06:00
Nicolas Williams
4ed4f2159c krb5: Check errors in krb5_auth_con_getauthenticator() 2022-01-18 00:32:51 -06:00
Joseph Sutton
ef059b8831 heimdal:base: Don't perform arithmetic on a NULL pointer
Doing so is undefined behaviour.

Change-Id: Ic57baac0fc5fb06945c0dfbd5d4eb913a12fc13d
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2022-01-18 00:31:45 -05:00
Joseph Sutton
1c93a6ff26 heimdal: Avoid overflow when performing bitwise shift operations
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2022-01-18 00:31:45 -05:00