Have cURL extension look for certificates in directory set by "openssl.capath"
Personne n'a encore pris cette issue.
- Langage dominant
- C
- Étoiles
- 40.4k
- Forks
- 8.2k
- Merge moyen
- 2 j 13 h
- PR mergées (30 j)
- 96
Description
Description
I'm on Windows using openssl.cafile and a cacert.pem from curl.se . I also got a local CA certificate that I use. So far I've been just editing any new cacert.pem file to add my certificate. Been working great, but wanted to test if cURL would use openssl.capath to look for it. However, it was just ignoring even with the correct filname (<certificate hash>.0), not even making any access to the directory I set. Only using CURLOPT_CAPATH in the PHP script made it look for the certificate.
Checked out branch "PHP-8.1.22" and looked into ext/curl/interface.c and did the following:
@@ -1817,6 +1817,7 @@ static void create_certinfo(struct curl_certinfo *ci, zval *listcode)
static void _php_curl_set_default_options(php_curl *ch)
{
char *cainfo;
+ char *capath;
curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
@@ -1840,6 +1841,11 @@ static void _php_curl_set_default_options(php_curl *ch)
if (cainfo && cainfo[0] != '\0') {
curl_easy_setopt(ch->cp, CURLOPT_CAINFO, cainfo);
}
+
+ capath = INI_STR("openssl.capath");
+ if (capath && capath[0] != '\0') {
+ curl_easy_setopt(ch->cp, CURLOPT_CAPATH, capath);
+ }
#ifdef ZTS
curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1);
Compiled and tested to be working.
Could also consider adding curl.capath as a setting.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez dans ext/curl/interface.c, à _php_curl_set_default_options, et comparez la gestion existante de openssl.cafile avec la modification proposée pour openssl.capath. Compilez et testez l’extension cURL sous Windows avec un certificat haché dans le répertoire configuré ; le travail est terminé lorsque cURL utilise openssl.capath sans nécessiter CURLOPT_CAPATH dans le script PHP.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- c, php
- Domaine
- networking, security
- Type d'issue
- Fonctionnalité
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100