Forum Discussion

Leszek_Majewsk1's avatar
Leszek_Majewsk1
Icon for Nimbostratus rankNimbostratus
Nov 19, 2007

how to pass variables

why I cannot read stored variables from the previous context ?

 

example:

 

 

when CLIENTSSL_CLIENTCERT {

 

set cert [SSL::cert 0]

 

set status [X509::verify_cert_error_string [SSL::verify_result]]

 

set subject [X509::subject $cert]

 

set serial [X509::serial_number $cert]

 

set issuer [X509::issuer $cert]

 

set values [list $cert $status $subject $serial]

 

set locality "Warszawa"

 

set count [SSL::cert count]

 

session add ssl [SSL::sessionid] $values 3600

 

log "Client handshake status: $status, serial number: $serial"

 

log "subject: $subject"

 

log "issuer: $issuer"

 

log "count: $count"

 

HTTP::release

 

}

 

 

In this section I store subject and issuer variables (I can see them in the log file)

 

the next context in my script is:

 

 

when HTTP_REQUEST {

 

if {[HTTP::uri] starts_with "/pattern/" } {

 

set cert [SSL::cert 1]

 

set status [X509::verify_cert_error_string [SSL::verify_result]]

 

log "status jest: $status"

 

set subject [X509::subject $cert]

 

set serial [X509::serial_number $cert]

 

set issuer [X509::issuer $cert]

 

set values [list $cert $status $subject $serial]

 

set locality "Warszawa"

 

set count [SSL::cert count]

 

session add ssl [SSL::sessionid] $values 3600

 

log "Client handshake status: $status, serial number: $serial"

 

log "subject: $subject"

 

log "issuer: $issuer"

 

log "count: $count" ..... (!)

 

 

I have an error related to the line set subject [X509::subject $cert] and I cannot read previously stored variables such as subject. I thought that the script is running line by line.. what is wrong? hot to use the variables stored in the previous context ???