artanis
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: session invalidation not working


From: Mortimer Cladwell
Subject: Re: session invalidation not working
Date: Wed, 17 Feb 2021 03:12:07 -0500

Thanks Nala.  I have not tested yet but just looking at sessions.scm I see:


(define (backend:session-restore/db sb sid)
  (let* ((mt (map-table-from-DB (session-backend-meta sb)))
         (cnd (where #:sid sid #:valid "1"))
         (valid (mt 'get 'Sessions #:condition cnd #:ret 'top)))
    (DEBUG "[backend:session-restore/db] ~a~%" valid)
    (and (not (null? valid)) (apply make-session valid))))

(define (backend:session-set/db sb sid k v)
  (define-syntax-rule (-> x) (and x (call-with-input-string x read)))
  (let* ((mt (map-table-from-DB (session-backend-meta sb)))
         (cnd (where #:sid sid #:valid "1"))
         (data (-> (mt 'ref 'Sessions #:columns '(data) #:condition cnd))))
    (and data
         (mt 'set 'Sessions
             #:data (object->string (assoc-set! data k v))
             #:condition cnd))))

(define (backend:session-ref/db sb sid k)
  (define-syntax-rule (-> x) (and x (call-with-input-string x read)))
  (let* ((mt (map-table-from-DB (session-backend-meta sb)))
         (cnd (where #:sid sid #:valid "1"))
         (data (-> (mt 'ref 'Sessions #:columns '(data) #:condition cnd))))
    (and data (assoc-ref data k))))

Should all those #:valid "1" be #:valid 1 ?
Thanks
Mortimer

On Tue, Feb 16, 2021 at 11:17 PM Nala Ginrut <mulei@gnu.org> wrote:

Hi Mortimer!

Mortimer Cladwell writes:

>  (define (backend:session-destory/db sb sid)
>   (let ((mt (map-table-from-DB (session-backend-meta sb))))
>     (mt 'set 'Sessions #:valid "0")))
>
> In my table valid is an integer, and you have a note  " (valid integer))))
> ; 1 for valid, 0 for expired"  at line 178 confirming integer.
> For postgres the update needs to look like:
>
>  UPDATE sessions SET valid=0 WHERE sid='df4f759814491a9b85e40202c29fe11a';

Yes, it should be interger 0. I missed it.
BTW, the previeous ssql will treat integer as string may cause the same
problem, I've fixed in 0.5.

> Note no quotes around 0. Is that the problem?
>
> In session.scm and oht.scm I see a lot of "destory".  Should that be
> "destroy"?

Fixed.

Please try master branch.
If everthing is OK, I'll trigger the docker image building.

Best regards.

--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058

reply via email to

[Prev in Thread] Current Thread [Next in Thread]