Skip to content

Commit 1a0bf42

Browse files
authored
Merge pull request #7781 from julek-wolfssl/sssd
init sssd support
2 parents 2505a59 + 305a699 commit 1a0bf42

35 files changed

Lines changed: 3066 additions & 792 deletions

.github/workflows/sssd.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: sssd Tests
2+
3+
# START OF COMMON SECTION
4+
on:
5+
push:
6+
branches: [ 'master', 'main', 'release/**' ]
7+
pull_request:
8+
branches: [ '*' ]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
# END OF COMMON SECTION
14+
15+
jobs:
16+
build_wolfssl:
17+
name: Build wolfSSL
18+
# Just to keep it the same as the testing target
19+
runs-on: ubuntu-latest
20+
# This should be a safe limit for the tests to run.
21+
timeout-minutes: 4
22+
steps:
23+
- name: Build wolfSSL
24+
uses: wolfSSL/actions-build-autotools-project@v1
25+
with:
26+
path: wolfssl
27+
configure: --enable-all CFLAGS=-DWOLFSSL_NO_ASN_STRICT
28+
install: true
29+
check: false
30+
31+
- name: tar build-dir
32+
run: tar -zcf build-dir.tgz build-dir
33+
34+
- name: Upload built lib
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: wolf-install-sssd
38+
path: build-dir.tgz
39+
retention-days: 5
40+
41+
sssd_check:
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
# List of releases to test
46+
ref: [ 2.9.1 ]
47+
name: ${{ matrix.ref }}
48+
runs-on: ubuntu-latest
49+
container:
50+
image: quay.io/sssd/ci-client-devel:ubuntu-latest
51+
env:
52+
LD_LIBRARY_PATH: /usr/local/lib
53+
# This should be a safe limit for the tests to run.
54+
timeout-minutes: 20
55+
needs: build_wolfssl
56+
steps:
57+
- name: Install dependencies
58+
run: |
59+
# Don't prompt for anything
60+
export DEBIAN_FRONTEND=noninteractive
61+
sudo apt-get update
62+
sudo apt-get install -y build-essential autoconf libldb-dev libldb2 python3-ldb bc
63+
64+
- name: Setup env
65+
run: |
66+
ln -s samba-4.0/ldb.h /usr/include/ldb.h
67+
ln -s samba-4.0/ldb_errors.h /usr/include/ldb_errors.h
68+
ln -s samba-4.0/ldb_handlers.h /usr/include/ldb_handlers.h
69+
ln -s samba-4.0/ldb_module.h /usr/include/ldb_module.h
70+
ln -s samba-4.0/ldb_version.h /usr/include/ldb_version.h
71+
72+
- name: Download lib
73+
uses: actions/download-artifact@v4
74+
with:
75+
name: wolf-install-sssd
76+
77+
- name: untar build-dir
78+
run: tar -xf build-dir.tgz
79+
80+
- name: Checkout OSP
81+
uses: actions/checkout@v4
82+
with:
83+
repository: wolfssl/osp
84+
path: osp
85+
86+
- name: Build and test sssd
87+
uses: wolfSSL/actions-build-autotools-project@v1
88+
with:
89+
repository: SSSD/sssd
90+
ref: ${{ matrix.ref }}
91+
path: sssd
92+
patch-file: $GITHUB_WORKSPACE/osp/sssd/${{ matrix.ref }}.patch
93+
configure: >-
94+
--without-samba --without-nfsv4-idmapd-plugin --with-oidc-child=no
95+
--without-manpages WOLFSSL_INSTALL_DIR=$GITHUB_WORKSPACE/build-dir
96+
check: true
97+

src/bio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,13 +1702,13 @@ int wolfSSL_BIO_reset(WOLFSSL_BIO *bio)
17021702
if (XFSEEK(bio->ptr.fh, 0, XSEEK_SET) != 0)
17031703
return WOLFSSL_BIO_ERROR;
17041704
else
1705-
return 0;
1705+
return WOLFSSL_SUCCESS;
17061706
#endif
17071707

17081708
case WOLFSSL_BIO_BIO:
17091709
bio->rdIdx = 0;
17101710
bio->wrIdx = 0;
1711-
return 0;
1711+
return WOLFSSL_SUCCESS;
17121712

17131713
case WOLFSSL_BIO_MEMORY:
17141714
bio->rdIdx = 0;
@@ -1727,7 +1727,7 @@ int wolfSSL_BIO_reset(WOLFSSL_BIO *bio)
17271727
bio->mem_buf->max = 0;
17281728
}
17291729
}
1730-
return 0;
1730+
return WOLFSSL_SUCCESS;
17311731

17321732
#ifndef WOLFCRYPT_ONLY
17331733
case WOLFSSL_BIO_MD:
@@ -1738,7 +1738,7 @@ int wolfSSL_BIO_reset(WOLFSSL_BIO *bio)
17381738
wolfSSL_EVP_MD_CTX_init(bio->ptr.md_ctx);
17391739
wolfSSL_EVP_DigestInit(bio->ptr.md_ctx, md);
17401740
}
1741-
return 0;
1741+
return WOLFSSL_SUCCESS;
17421742
#endif /* WOLFCRYPT_ONLY */
17431743

17441744
default:

src/conf.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ WOLFSSL_TXT_DB *wolfSSL_TXT_DB_read(WOLFSSL_BIO *in, int num)
133133
XFREE(strBuf, NULL, DYNAMIC_TYPE_OPENSSL);
134134
goto error;
135135
}
136-
if (wolfSSL_sk_push(ret->data, strBuf) != WOLFSSL_SUCCESS) {
136+
if (wolfSSL_sk_push(ret->data, strBuf) <= 0) {
137137
WOLFSSL_MSG("wolfSSL_sk_push error");
138138
XFREE(strBuf, NULL, DYNAMIC_TYPE_OPENSSL);
139139
goto error;
@@ -226,7 +226,7 @@ int wolfSSL_TXT_DB_insert(WOLFSSL_TXT_DB *db, WOLFSSL_STRING *row)
226226
return WOLFSSL_FAILURE;
227227
}
228228

229-
if (wolfSSL_sk_push(db->data, row) != WOLFSSL_SUCCESS) {
229+
if (wolfSSL_sk_push(db->data, row) <= 0) {
230230
WOLFSSL_MSG("wolfSSL_sk_push error");
231231
return WOLFSSL_FAILURE;
232232
}
@@ -450,11 +450,11 @@ int wolfSSL_CONF_add_string(WOLFSSL_CONF *conf,
450450
sk = (WOLF_STACK_OF(WOLFSSL_CONF_VALUE) *)section->value;
451451
value->section = section->section;
452452

453-
if (wolfSSL_sk_CONF_VALUE_push(sk, value) != WOLFSSL_SUCCESS) {
453+
if (wolfSSL_sk_CONF_VALUE_push(sk, value) <= 0) {
454454
WOLFSSL_MSG("wolfSSL_sk_CONF_VALUE_push error");
455455
return WOLFSSL_FAILURE;
456456
}
457-
if (wolfSSL_sk_CONF_VALUE_push(conf->data, value) != WOLFSSL_SUCCESS) {
457+
if (wolfSSL_sk_CONF_VALUE_push(conf->data, value) <= 0) {
458458
WOLFSSL_MSG("wolfSSL_sk_CONF_VALUE_push error");
459459
wolfssl_sk_pop_type(sk, STACK_TYPE_CONF_VALUE);
460460
return WOLFSSL_FAILURE;
@@ -497,7 +497,7 @@ WOLFSSL_CONF_VALUE *wolfSSL_CONF_new_section(WOLFSSL_CONF *conf,
497497

498498
ret->value = (char*)sk;
499499

500-
if (wolfSSL_sk_CONF_VALUE_push(conf->data, ret) != WOLFSSL_SUCCESS) {
500+
if (wolfSSL_sk_CONF_VALUE_push(conf->data, ret) <= 0) {
501501
WOLFSSL_MSG("wolfSSL_sk_CONF_VALUE_push error");
502502
goto error;
503503
}

src/crl.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ static int CheckCertCRLList(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
437437
break;
438438
}
439439
else if (foundEntry == 0) {
440-
ret = ASN_AFTER_DATE_E;
440+
ret = CRL_CERT_DATE_ERR;
441441
}
442442
}
443443
}
@@ -478,8 +478,9 @@ int CheckCertCRL_ex(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
478478
if (foundEntry == 0) {
479479
/* perform embedded lookup */
480480
if (crl->crlIOCb) {
481-
ret = crl->crlIOCb(crl, (const char*)extCrlInfo, extCrlInfoSz);
482-
if (ret == WOLFSSL_CBIO_ERR_WANT_READ) {
481+
int cbRet = crl->crlIOCb(crl, (const char*)extCrlInfo,
482+
extCrlInfoSz);
483+
if (cbRet == WOLFSSL_CBIO_ERR_WANT_READ) {
483484
ret = OCSP_WANT_READ;
484485
}
485486
else if (ret >= 0) {
@@ -502,9 +503,9 @@ int CheckCertCRL_ex(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
502503
/* When not set the folder or not use hash_dir, do nothing. */
503504
if ((foundEntry == 0) && (ret != WC_NO_ERR_TRACE(OCSP_WANT_READ))) {
504505
if (crl->cm != NULL && crl->cm->x509_store_p != NULL) {
505-
ret = LoadCertByIssuer(crl->cm->x509_store_p,
506+
int loadRet = LoadCertByIssuer(crl->cm->x509_store_p,
506507
(WOLFSSL_X509_NAME*)issuerName, X509_LU_CRL);
507-
if (ret == WOLFSSL_SUCCESS) {
508+
if (loadRet == WOLFSSL_SUCCESS) {
508509
/* try again */
509510
ret = CheckCertCRLList(crl, issuerHash, serial, serialSz,
510511
serialHash, &foundEntry);

src/internal.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4570,6 +4570,8 @@ void FreeX509(WOLFSSL_X509* x509)
45704570
x509->authKeyId = NULL;
45714571
XFREE(x509->subjKeyId, x509->heap, DYNAMIC_TYPE_X509_EXT);
45724572
x509->subjKeyId = NULL;
4573+
wolfSSL_ASN1_STRING_free(x509->subjKeyIdStr);
4574+
x509->subjKeyIdStr = NULL;
45734575
XFREE(x509->authInfo, x509->heap, DYNAMIC_TYPE_X509_EXT);
45744576
x509->authInfo = NULL;
45754577
XFREE(x509->rawCRLInfo, x509->heap, DYNAMIC_TYPE_X509_EXT);
@@ -6941,12 +6943,12 @@ int SetSSL_CTX(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup)
69416943
#endif
69426944
#if defined(OPENSSL_EXTRA) && !defined(NO_BIO)
69436945
/* Don't change recv callback if currently using BIO's */
6944-
if (ssl->CBIORecv != BioReceive)
6946+
if (ssl->CBIORecv != SslBioReceive)
69456947
#endif
69466948
ssl->CBIORecv = ctx->CBIORecv;
69476949
#if defined(OPENSSL_EXTRA) && !defined(NO_BIO)
69486950
/* Don't change send callback if currently using BIO's */
6949-
if (ssl->CBIOSend != BioSend)
6951+
if (ssl->CBIOSend != SslBioSend)
69506952
#endif
69516953
ssl->CBIOSend = ctx->CBIOSend;
69526954
ssl->verifyDepth = ctx->verifyDepth;
@@ -14028,7 +14030,8 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
1402814030
ph->hash_value = hash;
1402914031
ph->last_suffix = suffix;
1403014032

14031-
ret = wolfSSL_sk_BY_DIR_HASH_push(entry->hashes, ph);
14033+
ret = wolfSSL_sk_BY_DIR_HASH_push(entry->hashes, ph) > 0
14034+
? WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
1403214035
}
1403314036
}
1403414037
wc_UnLockMutex(&lookup->dirs->lock);
@@ -30320,7 +30323,7 @@ static int HashSkeData(WOLFSSL* ssl, enum wc_HashType hashType,
3032030323

3032130324
if (ret == 0) {
3032230325
if (wolfSSL_sk_X509_NAME_push(ssl->client_ca_names, name)
30323-
== WOLFSSL_FAILURE)
30326+
<= 0)
3032430327
{
3032530328
ret = MEMORY_ERROR;
3032630329
}

0 commit comments

Comments
 (0)