#1 2014-08-28 09:12:06

DigDiver
Member
Registered: 2013-04-29
Posts: 137

AV in procedure TSQLRestServer.SessionDelete;

Ctxt  = nil

procedure TSQLRestServer.SessionDelete(aSessionIndex: integer;
  Ctxt: TSQLRestServerURIContext);
...
    {$ifdef WITHLOG}
    if Assigned(User) then
     Ctxt.Log.Log(sllUserAuth,'Deleted session %/% from %/%',  <---------------------------------------------- Ctxt = nil 
      [User.LogonName,IDCardinal,RemoteIP,ConnectionID],self);
    {$endif}

When SessionDelete function is called from TSQLRestServer.SessionAccess, the Ctxt - is nil

function TSQLRestServer.SessionAccess(Ctxt: TSQLRestServerURIContext): TAuthSession;
var i: integer;
    Tix64: Int64;
begin // caller shall be locked via fSessionCriticalSection
  if (self<>nil) and (fSessions<>nil) then begin
    // first check for outdated sessions to be deleted
    Tix64 := GetTickCount64;
    for i := fSessions.Count-1 downto 0 do
      with TAuthSession(fSessions.List[i]) do
        if Tix64>LastAccess64+TimeOutMS then  
          SessionDelete(i,nil); <------------------------------------------------------------------ Ctxt - nil
    // retrieve session
    for i := 0 to fSessions.Count-1 do begin
      result := TAuthSession(fSessions.List[i]);
      if result.IDCardinal=Ctxt.Session then begin
        result.fLastAccess64 := Tix64; // refresh session access timestamp
        Ctxt.SessionUser := result.User.fID;
        Ctxt.SessionGroup := result.User.GroupRights.fID;
        Ctxt.SessionUserName := result.User.LogonName;
        Ctxt.SessionRemoteIP := result.RemoteIP;
        Ctxt.SessionConnectionID := result.ConnectionID;
        exit;
      end;
    end;
  end;
  result := nil;
end;

Offline

#2 2014-08-28 11:20:42

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,205
Website

Re: AV in procedure TSQLRestServer.SessionDelete;

Should be fixed by http://synopse.info/fossil/info/18756fee3e

Thanks for the feedback!

Offline

#3 2015-03-31 09:14:34

DigDiver
Member
Registered: 2013-04-29
Posts: 137

Re: AV in procedure TSQLRestServer.SessionDelete;

This error still occurs:

procedure TSQLRestServer.SessionDelete(aSessionIndex: integer;
  Ctxt: TSQLRestServerURIContext);
begin
  if (self<>nil) and (cardinal(aSessionIndex)<cardinal(fSessions.Count)) then
  with TAuthSession(fSessions.List[aSessionIndex]) do begin
    if Services is TServiceContainerServer then
      TServiceContainerServer(Services).OnCloseSession(IDCardinal);
    {$ifdef WITHLOG}
    fLogFamily.SynLog.Log(sllUserAuth,'Deleted session %/% from %/%',
      [User.LogonName,IDCardinal,RemoteIP,Ctxt.Call^.LowLevelConnectionID],self); //<------ Ctxt = nil -> SessionDelete(i,nil); in function TSQLRestServer.SessionAccess(Ctxt: TSQLRestServerURIContext): TAuthSession;
    {$endif}
    if Assigned(OnSessionClosed) then
      OnSessionClosed(self,fSessions.List[aSessionIndex],Ctxt);
    fSessions.Delete(aSessionIndex);
    fStats.ClientDisconnect;
  end;
end;

Offline

#4 2015-03-31 11:09:12

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,205
Website

Re: AV in procedure TSQLRestServer.SessionDelete;

Yes the issue has been reintroduced by another in-between commit.

Should be fixed by http://synopse.info/fossil/info/a2636421a5

Thanks for the feedback.

Offline

Board footer

Powered by FluxBB