Skip to content

Commit d1d950e

Browse files
authored
Merge branch 'sssd-2-11' into SSSD-sssd-backport-pr8161-to-sssd-2-11
2 parents d43b6a1 + 3a4d469 commit d1d950e

File tree

16 files changed

+757
-2200
lines changed

16 files changed

+757
-2200
lines changed

.github/workflows/analyze-target.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: "Analyze (target)"
22
on:
33
pull_request_target:
4-
branches: [master]
4+
branches: [sssd-2-11]
55
concurrency:
66
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
77
cancel-in-progress: true

.github/workflows/build.yml

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -56,68 +56,3 @@ jobs:
5656
x86_64/config.h
5757
x86_64/test-suite.log
5858
if-no-files-found: ignore
59-
60-
freebsd:
61-
if: github.event_name == 'push' || !contains(github.event.pull_request.labels.*.name, 'Accepted')
62-
runs-on: ubuntu-latest
63-
steps:
64-
- name: Repository checkout
65-
uses: actions/checkout@v4
66-
- uses: cross-platform-actions/action@v0.29.0
67-
with:
68-
operating_system: 'freebsd'
69-
version: '14.3'
70-
architecture: 'x86_64'
71-
run: |
72-
# Use latest package set
73-
sudo mkdir -p /usr/local/etc/pkg/repos/
74-
sudo cp /etc/pkg/FreeBSD.conf /usr/local/etc/pkg/repos/FreeBSD.conf
75-
sudo sed -i.bak -e 's|/quarterly|/latest|' /usr/local/etc/pkg/repos/FreeBSD.conf
76-
77-
# Trick SSSD into believing that nsupdate supports 'realm' clause
78-
# until FreeBSD switches to MIT Kerberos by default
79-
# Can be removed with FreeBSD 15
80-
sed -i.bak -e 's|echo realm|echo class IN|g' src/external/nsupdate.m4
81-
82-
# Patch out "timezone" variable usage - it is a legacy function in FreeBSD
83-
# Can be removed with FreeBSD 15
84-
sed -i.bak -e 's|timezone;|0;|g' src/util/util.c
85-
sed -i.bak -e 's|daylight,|0,|g' src/providers/ldap/ldap_auth.c \
86-
src/providers/ldap/sdap_access.c
87-
88-
echo "::group::Dependencies installation"
89-
sudo -E pkg install -y \
90-
autoconf automake gettext-tools gmake libtool pkgconf \
91-
ldb25 popt samba416 talloc tdb tevent \
92-
bind-tools c-ares ding-libs git jose libinotify libuuid libxml2 \
93-
libxslt krb5 pcre2 python3 xmlcatmgr docbook-xsl \
94-
py311-setuptools \
95-
check cmocka cwrap softhsm2
96-
echo "::endgroup::"
97-
98-
echo "::group::Build configuration"
99-
autoreconf -f -i
100-
101-
env CFLAGS=-isystem/usr/local/include \
102-
CPPFLAGS=-isystem/usr/local/include \
103-
LDFLAGS=-L/usr/local/lib \
104-
KRB5_CONFIG=/usr/local/bin/krb5-config \
105-
SOFTHSM2_PATH=/usr/local/lib/softhsm/libsofthsm2.so \
106-
MAKE=gmake \
107-
LIBS=-lintl \
108-
./configure --disable-cifs-idmap-plugin \
109-
--disable-linux-caps \
110-
--without-selinux \
111-
--without-nfsv4-idmapd-plugin \
112-
--with-smb-idmap-interface-version=6 \
113-
--with-xml-catalog-path=/usr/local/share/xml/catalog
114-
echo "::endgroup::"
115-
116-
echo "::group::Building"
117-
gmake
118-
echo "::endgroup::"
119-
120-
echo "::group::Testing"
121-
# Tests don't work yet
122-
#gmake check
123-
echo "::endgroup::"

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: "ci"
22
on:
33
push:
4-
branches: [master]
4+
branches: [sssd-2-11]
55
pull_request:
6-
branches: [master]
6+
branches: [sssd-2-11]
77
concurrency:
88
group: ${{ github.workflow }}-${{ github.ref }}
99
cancel-in-progress: true

.github/workflows/static-code-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: "Static code analysis"
22
on:
33
push:
4-
branches: [master]
4+
branches: [sssd-2-11]
55
pull_request:
6-
branches: [master]
6+
branches: [sssd-2-11]
77
schedule:
88
# Everyday at midnight
99
- cron: '0 0 * * *'

src/providers/krb5/krb5_child.c

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ static krb5_error_code tokeninfo_matches(TALLOC_CTX *mem_ctx,
553553
"Unsupported authtok type %d\n", sss_authtok_get_type(auth_tok));
554554
}
555555

556-
return EAGAIN;
556+
return ERR_CHECK_NEXT_AUTH_TYPE;
557557
}
558558

559559
static krb5_error_code answer_otp(krb5_context ctx,
@@ -603,7 +603,7 @@ static krb5_error_code answer_otp(krb5_context ctx,
603603
/* Allocation errors are ignored on purpose */
604604

605605
DEBUG(SSSDBG_TRACE_INTERNAL, "Exit answer_otp during pre-auth.\n");
606-
return EAGAIN;
606+
return ERR_CHECK_NEXT_AUTH_TYPE;
607607
}
608608

609609
/* Find the first supported tokeninfo which matches our authtoken. */
@@ -773,14 +773,14 @@ static krb5_error_code answer_pkinit(krb5_context ctx,
773773
DEBUG(SSSDBG_MINOR_FAILURE,
774774
"Unexpected authentication token type [%s]\n",
775775
sss_authtok_type_to_str(sss_authtok_get_type(kr->pd->authtok)));
776-
kerr = EAGAIN;
776+
kerr = ERR_CHECK_NEXT_AUTH_TYPE;
777777
goto done;
778778
}
779779
} else {
780780
/* We only expect SSS_PAM_PREAUTH here, but also for all other
781781
* commands the graceful solution would be to let the caller
782782
* check other authentication methods as well. */
783-
kerr = EAGAIN;
783+
kerr = ERR_CHECK_NEXT_AUTH_TYPE;
784784
}
785785

786786
done:
@@ -910,7 +910,7 @@ static krb5_error_code answer_idp_oauth2(krb5_context kctx,
910910
if (type != SSS_AUTHTOK_TYPE_OAUTH2) {
911911
DEBUG(SSSDBG_MINOR_FAILURE, "Unexpected authentication token type [%s]\n",
912912
sss_authtok_type_to_str(type));
913-
kerr = EAGAIN;
913+
kerr = ERR_CHECK_NEXT_AUTH_TYPE;
914914
goto done;
915915
}
916916

@@ -1137,7 +1137,7 @@ static krb5_error_code answer_passkey(krb5_context kctx,
11371137
if (type != SSS_AUTHTOK_TYPE_PASSKEY_REPLY) {
11381138
DEBUG(SSSDBG_MINOR_FAILURE, "Unexpected authentication token type [%s]\n",
11391139
sss_authtok_type_to_str(type));
1140-
kerr = EAGAIN;
1140+
kerr = ERR_CHECK_NEXT_AUTH_TYPE;
11411141
goto done;
11421142
}
11431143

@@ -1228,7 +1228,7 @@ static krb5_error_code answer_password(krb5_context kctx,
12281228

12291229
/* For SSS_PAM_PREAUTH and the other remaining commands the caller should
12301230
* continue to iterate over the available authentication methods. */
1231-
return EAGAIN;
1231+
return ERR_CHECK_NEXT_AUTH_TYPE;
12321232
}
12331233

12341234
static krb5_error_code sss_krb5_responder(krb5_context ctx,
@@ -1253,12 +1253,12 @@ static krb5_error_code sss_krb5_responder(krb5_context ctx,
12531253
/* It is expected that the answer_*() functions only return EOK
12541254
* (success) if the authentication was successful, i.e. during
12551255
* SSS_PAM_AUTHENTICATE. In all other cases, e.g. during
1256-
* SSS_PAM_PREAUTH either EAGAIN should be returned to indicate
1257-
* that the other available authentication methods should be
1258-
* checked as well. Or some other error code to indicate a fatal
1259-
* error where no other methods should be tried.
1260-
* Especially if setting the answer failed neither EOK nor EAGAIN
1261-
* should be returned. */
1256+
* SSS_PAM_PREAUTH either ERR_CHECK_NEXT_AUTH_TYPE should be
1257+
* returned to indicate that the other available authentication
1258+
* methods should be checked as well. Or some other error code to
1259+
* indicate a fatal error where no other methods should be tried.
1260+
* Especially if setting the answer failed neither EOK nor
1261+
* ERR_CHECK_NEXT_AUTH_TYPE should be returned. */
12621262
if (strcmp(question_list[c],
12631263
KRB5_RESPONDER_QUESTION_PASSWORD) == 0) {
12641264
kerr = answer_password(ctx, kr, rctx);
@@ -1288,7 +1288,7 @@ static krb5_error_code sss_krb5_responder(krb5_context ctx,
12881288
/* Continue to the next question when the given authtype cannot be
12891289
* handled by the answer_* function. This allows fallback between auth
12901290
* types, such as passkey -> password. */
1291-
if (kerr == EAGAIN) {
1291+
if (kerr == ERR_CHECK_NEXT_AUTH_TYPE) {
12921292
/* During pre-auth iterating over all authentication methods
12931293
* is expected and no message will be displayed. */
12941294
if (kr->pd->cmd == SSS_PAM_AUTHENTICATE) {
@@ -1306,17 +1306,18 @@ static krb5_error_code sss_krb5_responder(krb5_context ctx,
13061306
kerr = answer_password(ctx, kr, rctx);
13071307
}
13081308

1309-
/* During SSS_PAM_PREAUTH 'EAGAIN' is expected because we will run
1310-
* through all offered authentication methods and all are expect to return
1311-
* 'EAGAIN' in the positive case to indicate that the other methods should
1312-
* be checked as well. If all methods are checked we are done and should
1313-
* return success.
1314-
* In the other steps, especially SSS_PAM_AUTHENTICATE, having 'EAGAIN' at
1315-
* this stage would mean that no method feels responsible for the provided
1316-
* credentials i.e. authentication failed and we should return an error.
1309+
/* During SSS_PAM_PREAUTH 'ERR_CHECK_NEXT_AUTH_TYPE' is expected because we
1310+
* will run through all offered authentication methods and all are expect to
1311+
* return 'ERR_CHECK_NEXT_AUTH_TYPE' in the positive case to indicate that
1312+
* the other methods should be checked as well. If all methods are checked
1313+
* we are done and should return success.
1314+
* In the other steps, especially SSS_PAM_AUTHENTICATE, having
1315+
* 'ERR_CHECK_NEXT_AUTH_TYPE' at this stage would mean that no method feels
1316+
* responsible for the provided credentials i.e. authentication failed and
1317+
* we should return an error.
13171318
*/
13181319
if (kr->pd->cmd == SSS_PAM_PREAUTH) {
1319-
return kerr == EAGAIN ? 0 : kerr;
1320+
return kerr == ERR_CHECK_NEXT_AUTH_TYPE ? 0 : kerr;
13201321
} else {
13211322
return kerr;
13221323
}
@@ -2322,6 +2323,11 @@ static krb5_error_code get_and_save_tgt(struct krb5_req *kr,
23222323
KRB5_CHILD_DEBUG(SSSDBG_CRIT_FAILURE, kerr);
23232324

23242325
if (kerr == EAGAIN) {
2326+
/* The most probable reason for krb5_get_init_creds_password()
2327+
* to return EAGAIN is a temporary failure getaddrinfo() i.e.
2328+
* DNS currently does not work reliable. In this case it makes
2329+
* sense to return KRB5_KDC_UNREACH to tell the backend to try
2330+
* other KDCs or switch into offline mode. */
23252331
kerr = KRB5_KDC_UNREACH;
23262332
}
23272333

src/tests/intg/Makefile.am

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ dist_noinst_DATA = \
1818
test_enumeration.py \
1919
test_ldap.py \
2020
test_memory_cache.py \
21-
test_session_recording.py \
2221
test_netgroup.py \
23-
test_sssctl.py \
2422
files_ops.py \
2523
kdc.py \
2624
krb5utils.py \

0 commit comments

Comments
 (0)