For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

RobC's avatar
RobC
Icon for Nimbostratus rankNimbostratus
Oct 25, 2016

Regex for parsing LDAP attribute string value

I'm trying to pull a specific variable from an LDAP string attribute. The attribute is proxyAddresses, I need the value of "SMTP:" (case sensitive). I'm using the variable assign option in the VPE. Here is the crappy expression I'm using to create the session.custom.sso.smtp session variable.

 

session.custom.sso.smtp = expr { [lindex [split [mcget {session.ad.last.attr.proxyAddresses}] "SMTP:"] 1] }

 

I'm only getting 3 character of the attribute. Here is a sample of the proxyAddress attribute contents;

 

| sip:ROCKKI@rockservices.com | smtp:ROCKKI@rockservices.appacheonline.com | smtp:Kid_Rock@rockservices.com | smtp:Kid.Rock@rockservices.com | SMTP:ROCKKI@rockservices.com |

 

Thx

 

1 Reply

  • Hi,

    in APM variable,

    |
    character is the list delimiter....

    you can try the following expression:

    foreach address [mcget {session.ad.last.attr.proxyAddresses}] {
        if { [scan $address {SMTP:%s} mail] } {
            return $mail
        }
    }