Browse Source

* Fix getpeername, patch by BaldZhang for issue ID #38677

git-svn-id: trunk@49156 -
michael 4 years ago
parent
commit
f43a32315f
1 changed files with 5 additions and 3 deletions
  1. 5 3
      packages/openssl/src/fpopenssl.pp

+ 5 - 3
packages/openssl/src/fpopenssl.pp

@@ -657,14 +657,16 @@ var
 begin
 begin
   Result:='';
   Result:='';
   S:=PeerSubject;
   S:=PeerSubject;
-  P:=Pos(S,'/CN=');
+  P:=Pos('/CN=', S);
   if (P>0) then
   if (P>0) then
     begin
     begin
     Delete(S,1,P+3);
     Delete(S,1,P+3);
     P:=Pos('/',S);
     P:=Pos('/',S);
     if (P>0) then
     if (P>0) then
-      Result:=Copy(S,1,P-1);
-    end;
+      Result:=Copy(S,1,P-1)
+    else
+      Result := S;
+    end
 end;
 end;
 
 
 function TSSL.PeerNameHash: cardinal;
 function TSSL.PeerNameHash: cardinal;