mORMot and Open Source friends
Check-in [e50f14f798]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fix AV when aborting a session initialization via OnSessionCreate() callback (+ add log)
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e50f14f79870d3fd66b38adbb67f0b775d4d564d
User & Date: abouchez 2013-12-04 13:45:04
Context
2013-12-04
17:01
force release for an incorrect statement, when Oracle server-side statement caching is enabled check-in: 06814d1585 user: abouchez tags: trunk
13:45
fix AV when aborting a session initialization via OnSessionCreate() callback (+ add log) check-in: e50f14f798 user: abouchez tags: trunk
13:44
get rid of compilation warning in Delphi XE2+ check-in: 16744790b6 user: abouchez tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SQLite3/mORMot.pas.

25119
25120
25121
25122
25123
25124
25125





25126
25127
25128
25129
25130
25131
25132
        exit; // user already connected -> error 404
      end;
  if fSessions=nil then
    fSessions := TObjectList.Create;
  Session := fSessionClass.Create(Ctxt,User);
  if Assigned(OnSessionCreate) then
    if OnSessionCreate(self,Session,Ctxt) then begin





      FreeAndNil(Session); // returning TRUE aborts the session creation
      exit;
    end;
  User := nil; // will be freed by TAuthSession.Destroy
  fSessions.Add(Session);
  fStats.ClientConnect;
end;






>
>
>
>
>







25119
25120
25121
25122
25123
25124
25125
25126
25127
25128
25129
25130
25131
25132
25133
25134
25135
25136
25137
        exit; // user already connected -> error 404
      end;
  if fSessions=nil then
    fSessions := TObjectList.Create;
  Session := fSessionClass.Create(Ctxt,User);
  if Assigned(OnSessionCreate) then
    if OnSessionCreate(self,Session,Ctxt) then begin
      {$ifdef WITHLOG}
      Ctxt.Log.Log(sllUserAuth,'Session aborted by OnSessionCreate() callback for User.LogonName=% (connected from "%/%")',
        [User.LogonName,Session.RemoteIP,Session.ConnectionID],self);
      {$endif}
      User := nil;
      FreeAndNil(Session); // returning TRUE aborts the session creation
      exit;
    end;
  User := nil; // will be freed by TAuthSession.Destroy
  fSessions.Add(Session);
  fStats.ClientConnect;
end;