Using configuration items in strings
Hi I'm trying to make some of my configuration dependent on whether I've configured SQL, so I can create an easy way to turn off all use of SQL by our servers (we don't have a cluster, and we don't use the SQL server for authentication, so if it went down, we could do without it for a bit). I've used an "if" statement testing "%{config:modules.sql.server}", which I expected to give me the value "NPS" if I had set the value and null otherwise. That way I thought I could just comment out the "$INCLUDE mssql.conf" in radius.conf, and the "sql" in the "instantiate" section (we are only using SQL in "xlat" expressions) and avoid the "xlat" expressions being evaluated. However, it looks like whether I include "mssql.conf" or not, that expression always evaluates to "localhost". I'm baffled. Should this work? I got this expression format from https://github.com/FreeRADIUS/www.freeradius.org/blob/master/radiusd/doc/var.... This is the debug log, including a query that uses the expression: Script started on Fri Feb 14 15:49:49 2014 ccuh-old# /usr/local/sbin/radiusd -X FreeRADIUS Version 2.2.0, for host sparc-sun-solaris2.8, built on Apr 28 2013 at 13:14:32 Copyright (C) 1999-2012 The FreeRADIUS server project and contributors. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You may redistribute copies of FreeRADIUS under the terms of the GNU General Public License v2. Starting - reading configuration files ... including configuration file /usr/local/etc/raddb/radiusd.conf including configuration file /usr/local/etc/raddb/proxy.conf including configuration file /usr/local/etc/raddb/eduroam.conf including configuration file /usr/local/etc/raddb/clients.conf including files in directory /usr/local/etc/raddb/modules/ including configuration file /usr/local/etc/raddb/modules/realm including configuration file /usr/local/etc/raddb/modules/acct_unique including configuration file /usr/local/etc/raddb/modules/always including configuration file /usr/local/etc/raddb/modules/attr_filter including configuration file /usr/local/etc/raddb/modules/attr_rewrite including configuration file /usr/local/etc/raddb/modules/chap including configuration file /usr/local/etc/raddb/modules/checkval including configuration file /usr/local/etc/raddb/modules/counter including configuration file /usr/local/etc/raddb/modules/cui including configuration file /usr/local/etc/raddb/modules/detail including configuration file /usr/local/etc/raddb/modules/detail.example.com including configuration file /usr/local/etc/raddb/modules/detail.log including configuration file /usr/local/etc/raddb/modules/digest including configuration file /usr/local/etc/raddb/modules/dynamic_clients including configuration file /usr/local/etc/raddb/modules/echo including configuration file /usr/local/etc/raddb/modules/etc_group including configuration file /usr/local/etc/raddb/modules/exec including configuration file /usr/local/etc/raddb/modules/expiration including configuration file /usr/local/etc/raddb/modules/expr including configuration file /usr/local/etc/raddb/modules/files including configuration file /usr/local/etc/raddb/modules/inner-eap including configuration file /usr/local/etc/raddb/modules/ippool including configuration file /usr/local/etc/raddb/modules/krb5 including configuration file /usr/local/etc/raddb/modules/ldap including configuration file /usr/local/etc/raddb/modules/linelog including configuration file /usr/local/etc/raddb/modules/logintime including configuration file /usr/local/etc/raddb/modules/mac2ip including configuration file /usr/local/etc/raddb/modules/mschap including configuration file /usr/local/etc/raddb/modules/mac2vlan including configuration file /usr/local/etc/raddb/modules/ntlm_auth including configuration file /usr/local/etc/raddb/modules/opendirectory including configuration file /usr/local/etc/raddb/modules/otp including configuration file /usr/local/etc/raddb/modules/pam including configuration file /usr/local/etc/raddb/modules/pap including configuration file /usr/local/etc/raddb/modules/passwd including configuration file /usr/local/etc/raddb/modules/perl including configuration file /usr/local/etc/raddb/modules/policy including configuration file /usr/local/etc/raddb/modules/preprocess including configuration file /usr/local/etc/raddb/modules/radutmp including configuration file /usr/local/etc/raddb/modules/cache including configuration file /usr/local/etc/raddb/modules/smbpasswd including configuration file /usr/local/etc/raddb/modules/smsotp including configuration file /usr/local/etc/raddb/modules/sql_log including configuration file /usr/local/etc/raddb/modules/sqlcounter_expire_on_login including configuration file /usr/local/etc/raddb/modules/sradutmp including configuration file /usr/local/etc/raddb/modules/unix including configuration file /usr/local/etc/raddb/modules/wimax including configuration file /usr/local/etc/raddb/modules/redis including configuration file /usr/local/etc/raddb/modules/rediswho including configuration file /usr/local/etc/raddb/modules/replicate including configuration file /usr/local/etc/raddb/modules/soh including configuration file /usr/local/etc/raddb/modules/dhcp_sqlippool including configuration file /usr/local/etc/raddb/sql/mysql/ippool-dhcp.conf including configuration file /usr/local/etc/raddb/modules/radrelay including configuration file /usr/local/etc/raddb/eap.conf including configuration file /usr/local/etc/raddb/mssql.conf including configuration file /usr/local/etc/raddb/policy.conf including files in directory /usr/local/etc/raddb/sites-enabled/ including configuration file /usr/local/etc/raddb/sites-enabled/default including configuration file /usr/local/etc/raddb/sites-enabled/inner-tunnel including configuration file /usr/local/etc/raddb/sites-enabled/control-socket including configuration file /usr/local/etc/raddb/sites-enabled/vmps main { user = "radius" group = "radius" allow_core_dumps = no } including dictionary file /usr/local/etc/raddb/dictionary main { name = "radiusd" prefix = "/usr/local" localstatedir = "/usr/local/var" sbindir = "/usr/local/sbin" logdir = "/usr/local/var/log/radius" run_dir = "/usr/local/var/run/radiusd" libdir = "/usr/local/lib" radacctdir = "/usr/local/var/log/radius/radacct" hostname_lookups = no max_request_time = 30 cleanup_delay = 5 max_requests = 1024 pidfile = "/usr/local/var/run/radiusd/radiusd.pid" checkrad = "/usr/local/sbin/checkrad" debug_level = 0 proxy_requests = yes log { stripped_names = no auth = yes auth_badpass = no auth_goodpass = no } security { max_attributes = 200 reject_delay = 0 status_server = yes } } radiusd: #### Loading Realms and Home Servers #### proxy server { retry_delay = 5 retry_count = 3 default_fallback = no dead_time = 120 wake_all_if_all_dead = no } home_server nap1 { ipaddr = 134.220.1.125 port = 1812 type = "auth+acct" response_window = 20 max_outstanding = 65536 require_message_authenticator = yes zombie_period = 40 status_check = "none" ping_interval = 30 check_interval = 30 num_answers_to_alive = 3 num_pings_to_alive = 3 revive_interval = 120 status_check_timeout = 4 } home_server nap2 { ipaddr = 134.220.1.120 port = 1812 type = "auth+acct" response_window = 20 max_outstanding = 65536 require_message_authenticator = yes zombie_period = 40 status_check = "none" ping_interval = 30 check_interval = 30 num_answers_to_alive = 3 num_pings_to_alive = 3 revive_interval = 120 status_check_timeout = 4 } home_server eduroam0 { ipaddr = roaming0.ja.net IP address [194.82.174.185] port = 1812 type = "auth+acct" response_window = 30 max_outstanding = 65536 require_message_authenticator = yes zombie_period = 40 status_check = "status-server" ping_interval = 30 check_interval = 30 num_answers_to_alive = 3 num_pings_to_alive = 3 revive_interval = 300 status_check_timeout = 4 } home_server eduroam1 { ipaddr = roaming1.ja.net IP address [194.83.56.233] port = 1812 type = "auth+acct" response_window = 30 max_outstanding = 65536 require_message_authenticator = yes zombie_period = 40 status_check = "status-server" ping_interval = 30 check_interval = 30 num_answers_to_alive = 3 num_pings_to_alive = 3 revive_interval = 300 status_check_timeout = 4 } home_server eduroam2 { ipaddr = roaming2.ja.net IP address [194.83.56.249] port = 1812 type = "auth+acct" response_window = 30 max_outstanding = 65536 require_message_authenticator = yes zombie_period = 40 status_check = "status-server" ping_interval = 30 check_interval = 30 num_answers_to_alive = 3 num_pings_to_alive = 3 revive_interval = 300 status_check_timeout = 4 } home_server_pool nap_pool { type = fail-over home_server = nap2 home_server = nap1 } realm ~(.*)\.wlv\.ac\.uk$ { pool = nap_pool } realm wlv.ac.uk { pool = nap_pool nostrip } realm NULL { pool = nap_pool } home_server_pool eduroam_pool { type = client-port-balance home_server = eduroam0 home_server = eduroam1 home_server = eduroam2 } realm DEFAULT { pool = eduroam_pool nostrip } realm LOCAL { } radiusd: #### Loading Clients #### client localhost { ipaddr = 127.0.0.1 require_message_authenticator = no nastype = "other" } client max { ipaddr = 134.220.193.4 require_message_authenticator = no nastype = "other" } client Wism1 { ipaddr = 10.4.0.2 require_message_authenticator = no nastype = "cisco" } client Wism2 { ipaddr = 10.4.0.4 require_message_authenticator = no nastype = "cisco" } client Wism3 { ipaddr = 10.4.0.6 require_message_authenticator = no nastype = "cisco" } client roaming0.ja.net { ipaddr = roaming0.ja.net IP address [194.82.174.185] require_message_authenticator = no shortname = "roaming0.ja.net" nastype = "other" } client roaming1.ja.net { ipaddr = roaming1.ja.net IP address [194.83.56.233] require_message_authenticator = no shortname = "roaming1.ja.net" nastype = "other" } client roaming2.ja.net { ipaddr = roaming2.ja.net IP address [194.83.56.249] require_message_authenticator = no shortname = "roaming2.ja.net" nastype = "other" } radiusd: #### Instantiating modules #### instantiate { Module: Linked to module rlm_exec Module: Instantiating module "exec" from file /usr/local/etc/raddb/modules/exec exec { wait = no input_pairs = "request" shell_escape = yes } Module: Linked to module rlm_expr Module: Instantiating module "expr" from file /usr/local/etc/raddb/modules/expr Module: Linked to module rlm_expiration Module: Instantiating module "expiration" from file /usr/local/etc/raddb/modules/expiration expiration { reply-message = "Password Has Expired " } Module: Linked to module rlm_logintime Module: Instantiating module "logintime" from file /usr/local/etc/raddb/modules/logintime logintime { reply-message = "You are calling outside your allowed timespan " minimum-timeout = 60 } Module: Linked to module rlm_sql Module: Instantiating module "sql" from file /usr/local/etc/raddb/mssql.conf sql { driver = "rlm_sql_unixodbc" server = "NPS" port = "" login = "NPS" password = "il*Gw&._" radius_db = "radius" read_groups = yes sqltrace = no sqltracefile = "/usr/local/var/log/radius/sqltrace.log" readclients = no deletestalesessions = yes num_sql_socks = 4 lifetime = 0 max_queries = 0 sql_user_name = "" default_user_profile = "" nas_query = "SELECT id,nasname,shortname,type,secret FROM nas" authorize_check_query = "" authorize_group_check_query = "" authorize_group_reply_query = "" accounting_onoff_query = "" accounting_update_query = "" accounting_update_query_alt = "" accounting_start_query = "" accounting_start_query_alt = "" accounting_stop_query = "" accounting_stop_query_alt = "" connect_failure_retry_delay = 60 simul_count_query = "" simul_verify_query = "" postauth_query = "" safe-characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /" } rlm_sql (sql): Driver rlm_sql_unixodbc (module rlm_sql_unixodbc) loaded and linked rlm_sql (sql): Attempting to connect to NPS@NPS:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_unixodbc #0 rlm_sql (sql): Connected new DB handle, #0 rlm_sql (sql): starting 1 rlm_sql (sql): Attempting to connect rlm_sql_unixodbc #1 rlm_sql (sql): Connected new DB handle, #1 rlm_sql (sql): starting 2 rlm_sql (sql): Attempting to connect rlm_sql_unixodbc #2 rlm_sql (sql): Connected new DB handle, #2 rlm_sql (sql): starting 3 rlm_sql (sql): Attempting to connect rlm_sql_unixodbc #3 rlm_sql (sql): Connected new DB handle, #3 Module: Linked to module rlm_ldap Module: Instantiating module "ldap" from file /usr/local/etc/raddb/modules/ldap ldap { server = "dc2.unv.wlv.ac.uk" port = 389 password = "ax2013" identity = "cn=UNIX,cn=Users,dc=unv,dc=wlv,dc=ac,dc=uk" net_timeout = 1 timeout = 4 timelimit = 3 max_uses = 0 tls_mode = no start_tls = no tls_require_cert = "allow" tls { start_tls = no require_cert = "allow" } basedn = "ou=2kusers,dc=unv,dc=wlv,dc=ac,dc=uk" filter = "(uid=%u)" base_filter = "(objectclass=radiusprofile)" auto_header = no access_attr_used_for_allow = yes groupname_attribute = "cn" groupmembership_filter = "(|(&(objectClass=GroupOfNames)(member=%{Ldap-UserDn}))(&(objectClass=GroupOfUniqueNames)(uniquemember=%{Ldap-UserDn})))" dictionary_mapping = "/usr/local/etc/raddb/ldap.attrmap" ldap_debug = 0 ldap_connections_number = 5 compare_check_items = no do_xlat = yes set_auth_type = no } rlm_ldap: Registering ldap_groupcmp for Ldap-Group rlm_ldap: Registering ldap_xlat with xlat_name ldap rlm_ldap: reading ldap<->radius mappings from file /usr/local/etc/raddb/ldap.attrmap rlm_ldap: LDAP radiusCheckItem mapped to RADIUS $GENERIC$ rlm_ldap: LDAP radiusReplyItem mapped to RADIUS $GENERIC$ rlm_ldap: LDAP radiusAuthType mapped to RADIUS Auth-Type rlm_ldap: LDAP radiusSimultaneousUse mapped to RADIUS Simultaneous-Use rlm_ldap: LDAP radiusCalledStationId mapped to RADIUS Called-Station-Id rlm_ldap: LDAP radiusCallingStationId mapped to RADIUS Calling-Station-Id rlm_ldap: LDAP lmPassword mapped to RADIUS LM-Password rlm_ldap: LDAP ntPassword mapped to RADIUS NT-Password rlm_ldap: LDAP sambaLmPassword mapped to RADIUS LM-Password rlm_ldap: LDAP sambaNtPassword mapped to RADIUS NT-Password rlm_ldap: LDAP dBCSPwd mapped to RADIUS LM-Password rlm_ldap: LDAP userPassword mapped to RADIUS Password-With-Header rlm_ldap: LDAP acctFlags mapped to RADIUS SMB-Account-CTRL-TEXT rlm_ldap: LDAP radiusExpiration mapped to RADIUS Expiration rlm_ldap: LDAP radiusNASIpAddress mapped to RADIUS NAS-IP-Address rlm_ldap: LDAP radiusServiceType mapped to RADIUS Service-Type rlm_ldap: LDAP radiusFramedProtocol mapped to RADIUS Framed-Protocol rlm_ldap: LDAP radiusFramedIPAddress mapped to RADIUS Framed-IP-Address rlm_ldap: LDAP radiusFramedIPNetmask mapped to RADIUS Framed-IP-Netmask rlm_ldap: LDAP radiusFramedRoute mapped to RADIUS Framed-Route rlm_ldap: LDAP radiusFramedRouting mapped to RADIUS Framed-Routing rlm_ldap: LDAP radiusFilterId mapped to RADIUS Filter-Id rlm_ldap: LDAP radiusFramedMTU mapped to RADIUS Framed-MTU rlm_ldap: LDAP radiusFramedCompression mapped to RADIUS Framed-Compression rlm_ldap: LDAP radiusLoginIPHost mapped to RADIUS Login-IP-Host rlm_ldap: LDAP radiusLoginService mapped to RADIUS Login-Service rlm_ldap: LDAP radiusLoginTCPPort mapped to RADIUS Login-TCP-Port rlm_ldap: LDAP radiusCallbackNumber mapped to RADIUS Callback-Number rlm_ldap: LDAP radiusCallbackId mapped to RADIUS Callback-Id rlm_ldap: LDAP radiusFramedIPXNetwork mapped to RADIUS Framed-IPX-Network rlm_ldap: LDAP radiusClass mapped to RADIUS Class rlm_ldap: LDAP radiusSessionTimeout mapped to RADIUS Session-Timeout rlm_ldap: LDAP radiusIdleTimeout mapped to RADIUS Idle-Timeout rlm_ldap: LDAP radiusTerminationAction mapped to RADIUS Termination-Action rlm_ldap: LDAP radiusLoginLATService mapped to RADIUS Login-LAT-Service rlm_ldap: LDAP radiusLoginLATNode mapped to RADIUS Login-LAT-Node rlm_ldap: LDAP radiusLoginLATGroup mapped to RADIUS Login-LAT-Group rlm_ldap: LDAP radiusFramedAppleTalkLink mapped to RADIUS Framed-AppleTalk-Link rlm_ldap: LDAP radiusFramedAppleTalkNetwork mapped to RADIUS Framed-AppleTalk-Network rlm_ldap: LDAP radiusFramedAppleTalkZone mapped to RADIUS Framed-AppleTalk-Zone rlm_ldap: LDAP radiusPortLimit mapped to RADIUS Port-Limit rlm_ldap: LDAP radiusLoginLATPort mapped to RADIUS Login-LAT-Port rlm_ldap: LDAP radiusReplyMessage mapped to RADIUS Reply-Message rlm_ldap: LDAP radiusTunnelType mapped to RADIUS Tunnel-Type rlm_ldap: LDAP radiusTunnelMediumType mapped to RADIUS Tunnel-Medium-Type rlm_ldap: LDAP radiusTunnelPrivateGroupId mapped to RADIUS Tunnel-Private-Group-Id conns: 1ee8f8 } radiusd: #### Loading Virtual Servers #### server { # from file /usr/local/etc/raddb/radiusd.conf modules { Module: Creating Post-Auth-Type = REJECT Module: Checking authenticate {...} for more modules to load Module: Linked to module rlm_pap Module: Instantiating module "pap" from file /usr/local/etc/raddb/modules/pap pap { encryption_scheme = "auto" auto_header = no } Module: Linked to module rlm_chap Module: Instantiating module "chap" from file /usr/local/etc/raddb/modules/chap Module: Linked to module rlm_mschap Module: Instantiating module "mschap" from file /usr/local/etc/raddb/modules/mschap mschap { use_mppe = yes require_encryption = no require_strong = no with_ntdomain_hack = no allow_retry = yes } Module: Checking authorize {...} for more modules to load Module: Linked to module rlm_preprocess Module: Instantiating module "preprocess" from file /usr/local/etc/raddb/modules/preprocess preprocess { huntgroups = "/usr/local/etc/raddb/huntgroups" hints = "/usr/local/etc/raddb/hints" with_ascend_hack = no ascend_channels_per_line = 23 with_ntdomain_hack = no with_specialix_jetstream_hack = no with_cisco_vsa_hack = no with_alvarion_vsa_hack = no } reading pairlist file /usr/local/etc/raddb/huntgroups reading pairlist file /usr/local/etc/raddb/hints Module: Loading virtual module filter_username Module: Linked to module rlm_always Module: Instantiating module "reject" from file /usr/local/etc/raddb/modules/always always reject { rcode = "reject" simulcount = 0 mpp = no } Module: Linked to module rlm_realm Module: Instantiating module "suffix" from file /usr/local/etc/raddb/modules/realm realm suffix { format = "suffix" delimiter = "@" ignore_default = no ignore_null = no } Module: Loading virtual module rewrite_calling_station_id Module: Instantiating module "noop" from file /usr/local/etc/raddb/modules/always always noop { rcode = "noop" simulcount = 0 mpp = no } Module: Instantiating module "ok" from file /usr/local/etc/raddb/modules/always always ok { rcode = "ok" simulcount = 0 mpp = no } Module: Checking preacct {...} for more modules to load Module: Linked to module rlm_acct_unique Module: Instantiating module "acct_unique" from file /usr/local/etc/raddb/modules/acct_unique acct_unique { key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address, NAS-Port" } Module: Loading virtual module rewrite_calling_station_id Module: Linked to module rlm_perl Module: Instantiating module "perl" from file /usr/local/etc/raddb/modules/perl perl { module = "/usr/local/etc/raddb/paloalto.pl" func_authorize = "authorize" func_authenticate = "authenticate" func_accounting = "accounting" func_preacct = "preacct" func_checksimul = "checksimul" func_detach = "detach" func_xlat = "xlat" func_pre_proxy = "pre_proxy" func_post_proxy = "post_proxy" func_post_auth = "post_auth" func_recv_coa = "recv_coa" func_send_coa = "send_coa" } Module: Checking accounting {...} for more modules to load Module: Checking session {...} for more modules to load Module: Linked to module rlm_radutmp Module: Instantiating module "radutmp" from file /usr/local/etc/raddb/modules/radutmp radutmp { filename = "/usr/local/var/log/radius/radutmp" username = "%{User-Name}" case_sensitive = yes check_with_nas = yes perm = 384 callerid = yes } Module: Checking post-auth {...} for more modules to load Module: Loading virtual module rewrite_calling_station_id Module: Linked to module rlm_attr_filter Module: Instantiating module "attr_filter.access_reject" from file /usr/local/etc/raddb/modules/attr_filter attr_filter attr_filter.access_reject { attrsfile = "/usr/local/etc/raddb/attrs.access_reject" key = "%{User-Name}" relaxed = no } reading pairlist file /usr/local/etc/raddb/attrs.access_reject } # modules } # server server inner-tunnel { # from file /usr/local/etc/raddb/sites-enabled/inner-tunnel modules { Module: Checking authenticate {...} for more modules to load Module: Linked to module rlm_unix Module: Instantiating module "unix" from file /usr/local/etc/raddb/modules/unix unix { radwtmp = "/usr/local/var/log/radius/radwtmp" } Module: Linked to module rlm_eap Module: Instantiating module "eap" from file /usr/local/etc/raddb/eap.conf eap { default_eap_type = "md5" timer_expire = 60 ignore_unknown_eap_types = no cisco_accounting_username_bug = no max_sessions = 4096 } Module: Linked to sub-module rlm_eap_md5 Module: Instantiating eap-md5 Module: Linked to sub-module rlm_eap_leap Module: Instantiating eap-leap Module: Linked to sub-module rlm_eap_gtc Module: Instantiating eap-gtc gtc { challenge = "Password: " auth_type = "PAP" } Module: Linked to sub-module rlm_eap_tls Module: Instantiating eap-tls tls { rsa_key_exchange = no dh_key_exchange = yes rsa_key_length = 512 dh_key_length = 512 verify_depth = 0 CA_path = "/usr/local/etc/raddb/certs" pem_file_type = yes private_key_file = "/usr/local/etc/raddb/certs/server.pvk" certificate_file = "/usr/local/etc/raddb/certs/server.pem" CA_file = "/usr/local/etc/raddb/certs/ca.pem" dh_file = "/usr/local/etc/raddb/certs/dh" random_file = "/usr/local/etc/raddb/certs/random" fragment_size = 1024 include_length = yes check_crl = no cipher_list = "DEFAULT" ecdh_curve = "prime256v1" cache { enable = no lifetime = 24 max_entries = 255 } verify { } } Module: Linked to sub-module rlm_eap_ttls Module: Instantiating eap-ttls ttls { default_eap_type = "md5" copy_request_to_tunnel = no use_tunneled_reply = no virtual_server = "inner-tunnel" include_length = yes } Module: Linked to sub-module rlm_eap_peap Module: Instantiating eap-peap peap { default_eap_type = "mschapv2" copy_request_to_tunnel = no use_tunneled_reply = no proxy_tunneled_request_as_eap = yes virtual_server = "inner-tunnel" soh = no } Module: Linked to sub-module rlm_eap_mschapv2 Module: Instantiating eap-mschapv2 mschapv2 { with_ntdomain_hack = no send_error = no } Module: Checking authorize {...} for more modules to load Module: Linked to module rlm_files Module: Instantiating module "files" from file /usr/local/etc/raddb/modules/files files { usersfile = "/usr/local/etc/raddb/users" acctusersfile = "/usr/local/etc/raddb/acct_users" preproxy_usersfile = "/usr/local/etc/raddb/preproxy_users" compat = "no" } reading pairlist file /usr/local/etc/raddb/users reading pairlist file /usr/local/etc/raddb/acct_users reading pairlist file /usr/local/etc/raddb/preproxy_users Module: Checking session {...} for more modules to load Module: Checking post-proxy {...} for more modules to load Module: Checking post-auth {...} for more modules to load } # modules } # server server vmps { # from file /usr/local/etc/raddb/sites-enabled/vmps modules { Module: Checking vmps {...} for more modules to load Module: Linked to module rlm_linelog Module: Instantiating module "linelog.vmps" from file /usr/local/etc/raddb/modules/linelog linelog linelog.vmps { filename = "syslog" permissions = 384 format = "Wired access by %{VMPS-Mac} -> VLAN %{VMPS-Vlan-Name}" } } # modules } # server radiusd: #### Opening IP addresses and Ports #### listen { type = "auth" ipaddr = * port = 0 } listen { type = "acct" ipaddr = * port = 0 } listen { type = "control" listen { socket = "/usr/local/var/run/radiusd/radiusd.sock" } } listen { type = "auth" ipaddr = 127.0.0.1 port = 18120 } listen { type = "vmps" ipaddr = * port = 1589 client switches { ipaddr = 134.220.128.0 netmask = 21 require_message_authenticator = no shortname = "switches" nastype = "other" } } ... adding new socket proxy address * port 34971 ... adding new socket proxy address * port 34972 ... adding new socket proxy address * port 34973 ... adding new socket proxy address * port 34974 ... adding new socket proxy address * port 34975 ... adding new socket proxy address * port 34976 ... adding new socket proxy address * port 34977 ... adding new socket proxy address * port 34978 ... adding new socket proxy address * port 34979 ... adding new socket proxy address * port 34980 Listening on authentication address * port 1812 Listening on accounting address * port 1813 Listening on command file /usr/local/var/run/radiusd/radiusd.sock Listening on authentication address 127.0.0.1 port 18120 as server inner-tunnel Listening on vmps address * port 1589 as server vmps Listening on proxy address * port 1814 Ready to process requests. rad_recv: Access-Request packet from host 134.220.193.4 port 57295, id=21, length=59 User-Name = "S.Maxtest@wlv.ac.uk" User-Password = "bq9383bq" # Executing section authorize from file /usr/local/etc/raddb/sites-enabled/default +- entering group authorize {...} ++[preprocess] returns ok ++- entering policy filter_username {...} +++? if (User-Name =~ / /) ? Evaluating (User-Name =~ / /) -> FALSE +++? if (User-Name =~ / /) -> FALSE +++? if (User-Name =~ /@(.+)?@/i ) ? Evaluating (User-Name =~ /@(.+)?@/i) -> FALSE +++? if (User-Name =~ /@(.+)?@/i ) -> FALSE +++? if (User-Name =~ /\\.\\./ ) ? Evaluating (User-Name =~ /\\.\\./) -> FALSE +++? if (User-Name =~ /\\.\\./ ) -> FALSE +++? if (User-Name =~ /\\.$/) ? Evaluating (User-Name =~ /\\.$/) -> FALSE +++? if (User-Name =~ /\\.$/) -> FALSE +++? if (User-Name =~ /@\\./) ? Evaluating (User-Name =~ /@\\./) -> FALSE +++? if (User-Name =~ /@\\./) -> FALSE +++? if (User-Name =~ /@.*(3gppnetwork\\.org|myabc\\.com|hotmail\\.com|uniwlv\\ac\\.uk|\\.a[^c]\\.uk)$/i) ? Evaluating (User-Name =~ /@.*(3gppnetwork\\.org|myabc\\.com|hotmail\\.com|uniwlv\\ac\\.uk|\\.a[^c]\\.uk)$/i) -> FALSE +++? if (User-Name =~ /@.*(3gppnetwork\\.org|myabc\\.com|hotmail\\.com|uniwlv\\ac\\.uk|\\.a[^c]\\.uk)$/i) -> FALSE +++? if (User-Name =~ /\\\\/ && User-Name !~ /^unv\\\\.+/i) ? Evaluating (User-Name =~ /\\\\/) -> FALSE ? Skipping (User-Name !~ /^unv\\\\.+/i) +++? if (User-Name =~ /\\\\/ && User-Name !~ /^unv\\\\.+/i) -> FALSE ++- policy filter_username returns ok [suffix] Looking up realm "wlv.ac.uk" for User-Name = "S.Maxtest@wlv.ac.uk" [suffix] Found realm "wlv.ac.uk" [suffix] Adding Realm = "wlv.ac.uk" [suffix] Proxying request from user S.Maxtest to realm wlv.ac.uk [suffix] Preparing to proxy authentication request to realm "wlv.ac.uk" ++[suffix] returns updated ++? if (Service-Type == 'Call-Check') (Attribute Service-Type was not found) ? Evaluating (Service-Type == 'Call-Check') -> FALSE ++? if (Service-Type == 'Call-Check') -> FALSE ++[pap] returns noop WARNING: Empty pre-proxy section. Using default return values. Sending Access-Request of id 115 to 134.220.1.120 port 1812 User-Name = "S.Maxtest@wlv.ac.uk" NAS-IP-Address = 134.220.193.4 Message-Authenticator := 0x00000000000000000000000000000000 Proxy-State = 0x3231 Proxying request 0 to home server 134.220.1.120 port 1812 Sending Access-Request of id 115 to 134.220.1.120 port 1812 User-Name = "S.Maxtest@wlv.ac.uk" NAS-IP-Address = 134.220.193.4 Message-Authenticator := 0x00000000000000000000000000000000 Proxy-State = 0x3231 Going to the next request Waking up in 0.9 seconds. rad_recv: Access-Accept packet from host 134.220.1.120 port 1812, id=115, length=82 Proxy-State = 0x3231 Framed-Protocol = PPP Service-Type = Framed-User Class = 0x78260890000001370001020086dc017800000000000000000000000001cf1c14d4e8eea90000000000bae884 WARNING: Empty post-proxy section. Using default return values. Found Auth-Type = Accept Auth-Type = Accept, accepting the user Login OK: [S.Maxtest@wlv.ac.uk] (from client max port 0) # Executing section post-auth from file /usr/local/etc/raddb/sites-enabled/default +- entering group post-auth {...} ++- entering policy rewrite_calling_station_id {...} +++? if (Calling-Station-Id =~ /([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})/i) (Attribute Calling-Station-Id was not found) ? Evaluating (Calling-Station-Id =~ /([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})/i) -> FALSE +++? if (Calling-Station-Id =~ /([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})[-:\.]?([0-9a-f]{2})/i) -> FALSE +++- entering else else {...} ++++[noop] returns noop +++- else else returns noop ++- policy rewrite_calling_station_id returns noop ++? if ("%{config:modules.sql.server}" == 'NPS' && !(User-Password && Service-Type == Login-User) && "%{sql:SELECT COUNT(*) FROM identifications WHERE macaddr = '%{Calling-Station-ID}' AND blocked = 1}" >= 1) expand: modules.sql.server -> modules.sql.server expand: %{config:modules.sql.server} -> localhost ? Evaluating ("%{config:modules.sql.server}" == 'NPS' ) -> FALSE ?? Skipping (User-Password ) ?? Skipping (Service-Type == Login-User) ? Skipping ("%{sql:SELECT COUNT(*) FROM identifications WHERE macaddr = '%{Calling-Station-ID}' AND blocked = 1}" >= 1) ++? if ("%{config:modules.sql.server}" == 'NPS' && !(User-Password && Service-Type == Login-User) && "%{sql:SELECT COUNT(*) FROM identifications WHERE macaddr = '%{Calling-Station-ID}' AND blocked = 1}" >= 1) -> FALSE ++? if (control:Proxy-To-Realm == DEFAULT) ? Evaluating (control:Proxy-To-Realm == DEFAULT) -> FALSE ++? if (control:Proxy-To-Realm == DEFAULT) -> FALSE ++[exec] returns noop Sending Access-Accept of id 21 to 134.220.193.4 port 57295 Framed-Protocol = PPP Service-Type = Framed-User Class = 0x78260890000001370001020086dc017800000000000000000000000001cf1c14d4e8eea90000000000bae884 Finished request 0. Going to the next request Waking up in 4.9 seconds. ^C ccuh-old# script done on Fri Feb 14 15:50:01 2014 -- Scanned by iCritical.
On 14 Feb 2014, at 16:06, Caines, Max <Max.Caines@WLV.AC.UK> wrote:
Hi
I'm trying to make some of my configuration dependent on whether I've configured SQL, so I can create an easy way to turn off all use of SQL by our servers (we don't have a cluster, and we don't use the SQL server for authentication, so if it went down, we could do without it for a bit). I've used an "if" statement testing "%{config:modules.sql.server}", which I expected to give me the value "NPS" if I had set the value and null otherwise. That way I thought I could just comment out the "$INCLUDE mssql.conf" in radius.conf, and the "sql" in the "instantiate" section (we are only using SQL in "xlat" expressions) and avoid the "xlat" expressions being evaluated. However, it looks like whether I include "mssql.conf" or not, that expression always evaluates to "localhost". I'm baffled. Should this work? I got this expression format from https://github.com/FreeRADIUS/www.freeradius.org/blob/master/radiusd/doc/var....
Yes that should work. Weird. Could you see if if ("${modules.sql.server}" == 'NPS') { } Is any better? -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
Hi Arran I'm afraid not. It doesn't even tell me what that evaluates to: ++? if ("${modules.sql.server}" == 'NPS' && !(User-Password && Service-Type == Login-User) && "%{sql:SELECT COUNT(*) FROM identifications WHERE macaddr = '%{Calling-Station-ID}' AND blocked = 1}" >= 1) ? Evaluating ("${modules.sql.server}" == 'NPS' ) -> FALSE Max -----Original Message----- From: freeradius-users-bounces+max.caines=wlv.ac.uk@lists.freeradius.org [mailto:freeradius-users-bounces+max.caines=wlv.ac.uk@lists.freeradius.org] On Behalf Of Arran Cudbard-Bell Sent: 14 February 2014 16:30 To: FreeRadius users mailing list Subject: Re: Using configuration items in strings On 14 Feb 2014, at 16:06, Caines, Max <Max.Caines@WLV.AC.UK> wrote:
Hi
I'm trying to make some of my configuration dependent on whether I've configured SQL, so I can create an easy way to turn off all use of SQL by our servers (we don't have a cluster, and we don't use the SQL server for authentication, so if it went down, we could do without it for a bit). I've used an "if" statement testing "%{config:modules.sql.server}", which I expected to give me the value "NPS" if I had set the value and null otherwise. That way I thought I could just comment out the "$INCLUDE mssql.conf" in radius.conf, and the "sql" in the "instantiate" section (we are only using SQL in "xlat" expressions) and avoid the "xlat" expressions being evaluated. However, it looks like whether I include "mssql.conf" or not, that expression always evaluates to "localhost". I'm baffled. Should this work? I got this expression format from https://github.com/FreeRADIUS/www.freeradius.org/blob/master/radiusd/doc/var....
Yes that should work. Weird. Could you see if if ("${modules.sql.server}" == 'NPS') { } Is any better? -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2 -- Scanned by iCritical.
On 14 Feb 2014, at 16:45, Caines, Max <Max.Caines@wlv.ac.uk> wrote:
Hi Arran
I'm afraid not. It doesn't even tell me what that evaluates to:
++? if ("${modules.sql.server}" == 'NPS' && !(User-Password && Service-Type == Login-User) && "%{sql:SELECT COUNT(*) FROM identifications WHERE macaddr = '%{Calling-Station-ID}' AND blocked = 1}" >= 1) ? Evaluating ("${modules.sql.server}" == 'NPS' ) -> FALSE
Ah, I think that was only fixed in 3.x.x. Ok localhost is the default for that section, but doesn't explain why it's being used in preference to the real value. Could you open an issue on GitHub? (bugs.freeradius.org) -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
Hi Arran OK, done that. Thanks Max -----Original Message----- From: freeradius-users-bounces+max.caines=wlv.ac.uk@lists.freeradius.org [mailto:freeradius-users-bounces+max.caines=wlv.ac.uk@lists.freeradius.org] On Behalf Of Arran Cudbard-Bell Sent: 14 February 2014 16:57 To: FreeRadius users mailing list Subject: Re: Using configuration items in strings On 14 Feb 2014, at 16:45, Caines, Max <Max.Caines@wlv.ac.uk> wrote:
Hi Arran
I'm afraid not. It doesn't even tell me what that evaluates to:
++? if ("${modules.sql.server}" == 'NPS' && !(User-Password && Service-Type == Login-User) && "%{sql:SELECT COUNT(*) FROM identifications WHERE macaddr = '%{Calling-Station-ID}' AND blocked = 1}" >= 1) ? Evaluating ("${modules.sql.server}" == 'NPS' ) -> FALSE
Ah, I think that was only fixed in 3.x.x. Ok localhost is the default for that section, but doesn't explain why it's being used in preference to the real value. Could you open an issue on GitHub? (bugs.freeradius.org) -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2 -- Scanned by iCritical.
Caines, Max wrote:
I'm trying to make some of my configuration dependent on whether I've configured SQL, so I can create an easy way to turn off all use of SQL by our servers (we don't have a cluster, and we don't use the SQL server for authentication, so if it went down, we could do without it for a bit). I've used an "if" statement testing "%{config:modules.sql.server}", which I expected to give me the value "NPS" if I had set the value and null otherwise.
No. You are mixing up run-time variables and configuration variables. $[...} are configuration variables. They are expanded when the server reads the configuration files, and are *static* after that. %{...} are run-time variables. They exist ONLY when the server processes a request. So %{config:...} is only expanded when the server is processing a request, and NEVER otherwise. I'm really not clear what you're trying to do here. You've posted a long explanation, and a big debug output. But there's no simple example: I tried "X" and I expected to see "Y". Instead I saw "Z". My guess is that you're trying to conditionally disable parts of the configuration when the server loads. This is not possible in 2.x. You will need to run version 3 for that. In version 3, you can do: if (condition) { blah } If the condition statically evaluates to zero, the following block is ignored. If the condition statically evaluates to non-zero, then the block is used, and the "if" statement acts like it's not there. e.g. foo = 0 ... authorize { ... if (${foo}) { sql } ... } Will cause the "sql" reference to be ignored. Note that you CANNOT do: if ("${foo}") { } The use of a double-quoted string tells the server that the string is expanded dynamically at run-time, and therefore the text is used as-is when the server starts up Alan DeKok.
}
Will cause the "sql" reference to be ignored.
Note that you CANNOT do:
if ("${foo}") {
}
Hm, no. Using RFC terms, and assuming were going for optimum efficiency: if (${foo}) MUST NOT be optimised away, it is a attribute or rcode check with the value of the CONF_PAIR ${foo} if ('${foo}') MUST be optmised away, it is a string literal. Where ${foo} -> 'bar' if ("${foo}") SHOULD be optimised away, it is an XLAT expansion only containing string literals. Where ${foo} -> '%{User-Name}' MUST NOT be optimised away, it is an XLAT expansion containing an attribute reference. However, actually testing the code it seems optimisation isn't working as expected... Where ${foo} -> 'User-Name' authorize { if (!'${foo}') { ok } if (!"${foo}") { ok } if (!${foo}) { ok } if (!('${foo}' == 'bar')) { ok } } Ready to process requests. rad_recv: Access-Request packet from host 127.0.0.1 port 51784, id=52, length=38 User-Password = 'foo' (0) # Executing section authorize from file /usr/local/freeradius-3.0.x/etc/raddb/sites-enabled/default (0) authorize { (0) ? if (!'User-Name') (0) ? if (!'User-Name') -> FALSE (0) ? if (!"User-Name") (0) expand: "User-Name" -> 'User-Name' (0) ? if (!"User-Name") -> FALSE (0) ? if (!User-Name) (0) ? if (!User-Name) -> TRUE (0) if (!User-Name) { (0) [ok] = ok (0) } # if (!User-Name) = ok (0) ? if (!('User-Name' == 'bar')) (0) ? if (!('User-Name' == 'bar')) -> TRUE (0) if (!('User-Name' == 'bar')) { (0) [ok] = ok (0) } # if (!('User-Name' == 'bar')) = ok But I may be miss-understanding on how it's meant to operate. Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
Arran Cudbard-Bell wrote:
Hm, no. Using RFC terms, and assuming were going for optimum efficiency:
if (${foo})
MUST NOT be optimised away, it is a attribute or rcode check with the value of the CONF_PAIR ${foo}
I'm not sure what you mean by "optimized away". ${foo} gets replaced with the value of configuration item 'foo', by the configuration file reader. This happens *before* any analysis is done of the condition. e.g. foo = 0 if (${foo}) { ... and if (0) { ... are identical. It sounds like your analysis is mixing up the two passes. 1) string substitution ${foo} --> value of configuration item "foo" 2) compilation to string xlat, attribute reference, etc.
if ("${foo}")
SHOULD be optimised away, it is an XLAT expansion only containing string literals.
Only if the string inside of the double quotes contains a % character.
Where ${foo} -> '%{User-Name}'
MUST NOT be optimised away, it is an XLAT expansion containing an attribute reference.
Be careful with the single quotes. %{User-Name} is an xlat saying "the value of the User-Name attribute". '%{User-Name}' is a single-quoted string with contents %{User-Name}. The contents are a *static* string, and aren't dynamically expanded.
However, actually testing the code it seems optimisation isn't working as expected...
Where ${foo} -> 'User-Name'
Remember, this is *dumb* string substitution.
authorize { if (!'${foo}') { ok }
That's a single quoted string with static contents User-Name. Note that the ${foo} expansion is done inside of single quoted strings. Note also that when the configuration file code parses: foo = 'User-Name' Then foo has a data type of "literal string", and a value of User-Name. *Without* the quotes. The configuration file string expansion is done by copying the values, not by printing the CONF_PAIRs. Otherwise, it would do: foo = 'User-Name' if (!'${foo}') { expands ${foo} to 'User-Name', and gets if (!''User-Name'') { which would be a parse error. The single / double-quotes for configuration items are intended to let the configuration file parser correctly parse the values. Once the values are parsed, the strings are static. They don't need escaping, and they don't need quotes added.
if (!"${foo}") { ok }
That's a double-quoted string, with static contents User-Name (WITHOUT the single quotes!). Since there's no % in the string, the dynamic expansion is just a string copy.
if (!${foo}) { ok }
That's an attribute reference of User-Name.
if (!('${foo}' == 'bar')) { ok } }
That's again a static string comparison of 'User-Name' to 'bar'. They're different, and will always be different.
Ready to process requests. rad_recv: Access-Request packet from host 127.0.0.1 port 51784, id=52, length=38 User-Password = 'foo' (0) # Executing section authorize from file /usr/local/freeradius-3.0.x/etc/raddb/sites-enabled/default (0) authorize { (0) ? if (!'User-Name') (0) ? if (!'User-Name') -> FALSE
Yes. 'User-Name' is a non-NULL string, so it's always TRUE. !TRUE is FALSE.
(0) ? if (!"User-Name") -> FALSE
The same applies here.
(0) ? if (!User-Name) -> TRUE
Here, User-Name is an attribute reference. The packet you sent didn't include a User-Name. So the check for existence of User-Name is FALSE, and !FALSE is TRUE.
(0) ? if (!('User-Name' == 'bar')) -> TRUE
That's correct. The string 'User-Name' is not the same as the string 'bar'. So that evaluates to FALSE. And !FALSE is TRUE.
But I may be miss-understanding on how it's meant to operate.
The string substitution for ${var} is very simple, and is *completely* independent of the step which parses conditions. The "parse condition" step just sees text strings. All of the ${foo} magic has gone away. Alan DeKok.
On 15 Feb 2014, at 15:26, Alan DeKok <aland@deployingradius.com> wrote:
Arran Cudbard-Bell wrote:
Hm, no. Using RFC terms, and assuming were going for optimum efficiency:
if (${foo})
MUST NOT be optimised away, it is a attribute or rcode check with the value of the CONF_PAIR ${foo}
I'm not sure what you mean by "optimized away".
If the result of the condition cannot change during the processing of a request the condition is not evaluated during the processing of a request. if ('foo' == 'foo') { } Will always be true, so there's no need to strcmp foo and foo on every request.
${foo} gets replaced with the value of configuration item 'foo', by the configuration file reader. This happens *before* any analysis is done of the condition.
Yep.
e.g.
foo = 0 if (${foo}) { ...
and
if (0) { ...
are identical.
It sounds like your analysis is mixing up the two passes.
No, I'm aware they're different steps and ${} substitutions are done before everything else, my examples just weren't clear enough.
1) string substitution ${foo} --> value of configuration item "foo"
2) compilation to string xlat, attribute reference, etc.
if ("${foo}")
SHOULD be optimised away, it is an XLAT expansion only containing string literals.
Only if the string inside of the double quotes contains a % character.
Doesn't contain a % surely?
Where ${foo} -> '%{User-Name}'
MUST NOT be optimised away, it is an XLAT expansion containing an attribute reference.
Be careful with the single quotes. %{User-Name} is an xlat saying "the value of the User-Name attribute". '%{User-Name}' is a single-quoted string with contents %{User-Name}. The contents are a *static* string, and aren't dynamically expanded.
Sorry I wasn't being clear with the examples. I meant: ${foo} -> %{User-Name}
Ready to process requests. rad_recv: Access-Request packet from host 127.0.0.1 port 51784, id=52, length=38 User-Password = 'foo' (0) # Executing section authorize from file /usr/local/freeradius-3.0.x/etc/raddb/sites-enabled/default (0) authorize { (0) ? if (!'User-Name') (0) ? if (!'User-Name') -> FALSE
Yes. 'User-Name' is a non-NULL string, so it's always TRUE. !TRUE is FALSE.
Sure there was just no indication to show whether the evaluation was actually being skipped, it looked like it was still being performed, when as you say 'User-Name' is always true.
(0) ? if (!"User-Name") -> FALSE
The same applies here.
Same.
(0) ? if (!User-Name) -> TRUE
Here, User-Name is an attribute reference. The packet you sent didn't include a User-Name. So the check for existence of User-Name is FALSE, and !FALSE is TRUE.
Yep, that's correct, i'm not questioning the results of the evaluations they're all as I would expect. I was just pointing out that it's not clear that the condition isn't actually being evaluated.
(0) ? if (!('User-Name' == 'bar')) -> TRUE
That's correct. The string 'User-Name' is not the same as the string 'bar'. So that evaluates to FALSE. And !FALSE is TRUE.
Yep.
But I may be miss-understanding on how it's meant to operate.
The string substitution for ${var} is very simple, and is *completely* independent of the step which parses conditions. The "parse condition" step just sees text strings. All of the ${foo} magic has gone away.
I'm aware of that. It makes it much easier to comprehend what's going on when you think of ${} expansions as doing something to C preprocessor macros. It's just the output didn't look any different for conditions I expected to be pre-evaluated. If it's all happening transparently behind the scenes then that's fine. Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
Arran Cudbard-Bell wrote:
If the result of the condition cannot change during the processing of a request the condition is not evaluated during the processing of a request.
if ('foo' == 'foo') {
}
Will always be true, so there's no need to strcmp foo and foo on every request.
I just pushed a fix for that. Including unit tests. <woo>!
Doesn't contain a % surely?
Yes.
I meant:
${foo} -> %{User-Name}
That should just be a string substitution.
Sure there was just no indication to show whether the evaluation was actually being skipped, it looked like it was still being performed, when as you say 'User-Name' is always true.
The evalaution wasn't being skipped (until my recent patch). It was always being done.
Yep, that's correct, i'm not questioning the results of the evaluations they're all as I would expect. I was just pointing out that it's not clear that the condition isn't actually being evaluated.
The conditions *are* being evaluated. But not any more.
I'm aware of that. It makes it much easier to comprehend what's going on when you think of ${} expansions as doing something to C preprocessor macros.
Yes.
It's just the output didn't look any different for conditions I expected to be pre-evaluated.
Because they weren't.
If it's all happening transparently behind the scenes then that's fine.
With the changes I pushed, if you have: if ('foo' == 'bar') { ... } The entire block *disappears* from the run-time configuration. You will *never* see the "if" section being evaluated. The "if" condition is evaluated when the server loads, and the block is skipped. i.e. not even compiled. Which means you can do: if ('never' == 'always') { # FALSE! roses_are_red violets_are_blue freeradius_is_great and_so_are_you } And the server will start up correctly, and run. Even though there's no module called "roses_are_red". The server notices that the block is useless, and ignores it completely. Alan DeKok
participants (3)
-
Alan DeKok -
Arran Cudbard-Bell -
Caines, Max