e_capi patch

Daniel Sahlberg via TortoiseSVN-dev <[email protected]> Sun, 15 Jun 2025 23:51:22 -0700 (PDT)
Newsgroups gmane.comp.version-control.subversion.tortoisesvn.devel
Message-ID <[email protected]>
------=_Part_4576_1769981171.1750056682202
Content-Type: multipart/alternative; 
	boundary="----=_Part_4577_802607963.1750056682202"

------=_Part_4577_802607963.1750056682202
Content-Type: text/plain; charset="UTF-8"

Hi,

I was reviewing the e_capi patch 
(https://sourceforge.net/p/tortoisesvn/code/HEAD/tree/trunk/ext/build/openssl.patch) 
and spotted the below section:

[[[
@@ -1786,9 +1906,22 @@
         return 0;
 
     /* Select the appropriate certificate */
+    TSVN_GetSHA1HashFromX509(ca_dn, hash);
+    strcpy(lastUsedAuthCacheHash, hash);
+    client_cert_idx = TSVN_GetSavedIndexForHash(hash);
+    if ((client_cert_idx < 0) || (client_cert_idx >= sk_X509_num(certs)))
+    {
+        client_cert_idx = ctx->client_cert_select(e, ssl, certs);
+        if (client_cert_idx >= 0)
+        {
+            TSVN_SaveIndexForHash(hash, client_cert_idx);
+        }
+    }
+    else if (client_cert_idx >= sk_X509_num(certs))
+    {
+        TSVN_ClearLastUsedAuthCache();
+    }
 ]]]

To me it looks like the else if branch can't ever be executed since the 
same condition is also in the if branch. Am I missing something?

Cheers,
Daniel

-- 
You received this message because you are subscribed to the Google Groups "TortoiseSVN-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/tortoisesvn-dev/ac5cca75-645b-4bcd-b270-9cf40dffbb72n%40googlegroups.com.

------=_Part_4577_802607963.1750056682202
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,<div><br /></div><div>I was reviewing the e_capi patch (https://sourcefo=
rge.net/p/tortoisesvn/code/HEAD/tree/trunk/ext/build/openssl.patch) and spo=
tted the below section:</div><div><br /></div><div>[[[</div><div>@@ -1786,9=
 +1906,22 @@<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<br />=C2=A0<b=
r />=C2=A0 =C2=A0 =C2=A0/* Select the appropriate certificate */<br />+ =C2=
=A0 =C2=A0TSVN_GetSHA1HashFromX509(ca_dn, hash);<br />+ =C2=A0 =C2=A0strcpy=
(lastUsedAuthCacheHash, hash);<br />+ =C2=A0 =C2=A0client_cert_idx =3D TSVN=
_GetSavedIndexForHash(hash);<br />+ =C2=A0 =C2=A0if ((client_cert_idx &lt; =
0) || (client_cert_idx &gt;=3D sk_X509_num(certs)))<br />+ =C2=A0 =C2=A0{<b=
r />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0client_cert_idx =3D ctx-&gt;client_cert_se=
lect(e, ssl, certs);<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0if (client_cert_idx =
&gt;=3D 0)<br />+ =C2=A0 =C2=A0 =C2=A0 =C2=A0{<br />+ =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0TSVN_SaveIndexForHash(hash, client_cert_idx);<br />+ =
=C2=A0 =C2=A0 =C2=A0 =C2=A0}<br />+ =C2=A0 =C2=A0}<br />+ =C2=A0 =C2=A0else=
 if (client_cert_idx &gt;=3D sk_X509_num(certs))<br />+ =C2=A0 =C2=A0{<br /=
>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0TSVN_ClearLastUsedAuthCache();<br />+ =C2=A0 =
=C2=A0}<br />=C2=A0]]]</div><div><br /></div><div>To me it looks like the e=
lse if branch can't ever be executed since the same condition is also in th=
e if branch. Am I missing something?</div><div><br /></div><div>Cheers,</di=
v><div>Daniel</div><div><br /></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;TortoiseSVN-dev&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">tor=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
tortoisesvn-dev/ac5cca75-645b-4bcd-b270-9cf40dffbb72n%40googlegroups.com?ut=
m_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/tor=
toisesvn-dev/ac5cca75-645b-4bcd-b270-9cf40dffbb72n%40googlegroups.com</a>.<=
br />

------=_Part_4577_802607963.1750056682202--

------=_Part_4576_1769981171.1750056682202--