"Fossies" - the Fresh Open Source Software Archive

Member "freeradius-server-3.0.23/raddb/mods-config/sql/main/mssql/queries.conf" (10 Jun 2021, 19054 Bytes) of package /linux/misc/freeradius-server-3.0.23.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Generic config files source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # -*- text -*-
    2 #
    3 #  main/mssql/queries.conf -- MSSQL configuration for default schema (schema.sql)
    4 #
    5 #  $Id: a69e6022a9d8fae1eab8004f25d6057401a0147e $
    6 
    7 # Safe characters list for sql queries. Everything else is replaced
    8 # with their mime-encoded equivalents.
    9 # The default list should be ok
   10 #safe_characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
   11 
   12 #######################################################################
   13 #  Query config:  Username
   14 #######################################################################
   15 # This is the username that will get substituted, escaped, and added
   16 # as attribute 'SQL-User-Name'.  '%{SQL-User-Name}' should be used
   17 # below everywhere a username substitution is needed so you you can
   18 # be sure the username passed from the client is escaped properly.
   19 #
   20 # Uncomment the next line, if you want the sql_user_name to mean:
   21 #
   22 #    Use Stripped-User-Name, if it's there.
   23 #    Else use User-Name, if it's there,
   24 #    Else use hard-coded string "none" as the user name.
   25 #sql_user_name = "%{%{Stripped-User-Name}:-%{%{User-Name}:-none}}"
   26 #
   27 sql_user_name = "%{User-Name}"
   28 
   29 #######################################################################
   30 #  Query config:  Event-Timestamp
   31 #######################################################################
   32 # event_timestamp_epoch is the basis for the time inserted into
   33 # accounting records. Typically this will be the Event-Timestamp of the
   34 # accounting request, which is usually provided by a NAS.
   35 #
   36 # Uncomment the next line, if you want the timestamp to be based on the
   37 # request reception time recorded by this server, for example if you
   38 # distrust the provided Event-Timestamp.
   39 #event_timestamp_epoch = "%l"
   40 
   41 event_timestamp_epoch = "%{%{integer:Event-Timestamp}:-%l}"
   42 
   43 # event_timestamp is the SQL snippet for converting an epoch timestamp
   44 # to an SQL date.
   45 
   46 event_timestamp = "DATEADD(SS, ${event_timestamp_epoch}, '19700101')"
   47 
   48 #######################################################################
   49 #  Query config:  Class attribute
   50 #######################################################################
   51 #
   52 #  3.0.22 and later have a "class" column in the accounting table.
   53 #
   54 #  However, we do NOT want to break existing configurations by adding
   55 #  the Class attribute to the default queries.  If we did that, then
   56 #  systems using newer versions of the server would fail, because
   57 #  there is no "class" column in their accounting tables.
   58 #
   59 #  The solution to that is the following "class" subsection.  If your
   60 #  database has a "class" column for the various tables, then you can
   61 #  uncomment the configuration items here.  The queries below will
   62 #  then automatically insert the Class attribute into radacct,
   63 #  radpostauth, etc.
   64 #
   65 class {
   66     #
   67     #  Delete the '#' character from each of the configuration
   68     #  items in this section.  This change puts the Class
   69     #  attribute into the various tables.  Leave the double-quoted
   70     #  string there, as the value for the configuration item.
   71     #
   72     #  See also policy.d/accounting, and the "insert_acct_class"
   73     #  policy.  You will need to list (or uncomment)
   74     #  "insert_acct_class" in the "post-auth" section in order to
   75     #  create a Class attribute.
   76     #
   77     column_name =   # ", class"
   78     packet_xlat =   # ", '%{Class}'"
   79     reply_xlat =    # ", '%{Reply:Class}'"
   80 }
   81 
   82 #######################################################################
   83 #  Authorization Queries
   84 #######################################################################
   85 #  These queries compare the check items for the user
   86 #  in ${authcheck_table} and setup the reply items in
   87 #  ${authreply_table}.  You can use any query/tables
   88 #  you want, but the return data for each row MUST
   89 #  be in the  following order:
   90 #
   91 #  0. Row ID (currently unused)
   92 #  1. UserName/GroupName
   93 #  2. Item Attr Name
   94 #  3. Item Attr Value
   95 #  4. Item Attr Operation
   96 #######################################################################
   97 # Query for case sensitive usernames was removed. Please contact with me,
   98 # if you know analog of STRCMP functions for MS SQL.
   99 
  100 authorize_check_query = "\
  101     SELECT id, UserName, Attribute, Value, op \
  102     FROM ${authcheck_table} \
  103     WHERE Username = '%{SQL-User-Name}' \
  104     ORDER BY id"
  105 
  106 authorize_reply_query = "\
  107     SELECT id, UserName, Attribute, Value, op \
  108     FROM ${authreply_table} \
  109     WHERE Username = '%{SQL-User-Name}' \
  110     ORDER BY id"
  111 
  112 authorize_group_check_query = "\
  113     SELECT \
  114         ${groupcheck_table}.id,${groupcheck_table}.GroupName, \
  115         ${groupcheck_table}.Attribute,${groupcheck_table}.Value, \
  116         ${groupcheck_table}.op \
  117     FROM ${groupcheck_table},${usergroup_table} \
  118     WHERE ${usergroup_table}.Username = '%{SQL-User-Name}' \
  119     AND ${usergroup_table}.GroupName = ${groupcheck_table}.GroupName \
  120     ORDER BY ${groupcheck_table}.id"
  121 
  122 authorize_group_reply_query = "\
  123     SELECT \
  124         ${groupreply_table}.id, ${groupreply_table}.GroupName, \
  125         ${groupreply_table}.Attribute,${groupreply_table}.Value, \
  126         ${groupreply_table}.op \
  127     FROM ${groupreply_table},${usergroup_table} \
  128     WHERE ${usergroup_table}.Username = '%{SQL-User-Name}' \
  129     AND ${usergroup_table}.GroupName = ${groupreply_table}.GroupName \
  130     ORDER BY ${groupreply_table}.id"
  131 
  132 group_membership_query = "\
  133     SELECT groupname \
  134     FROM ${usergroup_table} \
  135     WHERE username = '%{SQL-User-Name}' \
  136     ORDER BY priority"
  137 
  138 #######################################################################
  139 # Accounting and Post-Auth Queries
  140 #######################################################################
  141 # These queries insert/update accounting and authentication records.
  142 # The query to use is determined by the value of 'reference'.
  143 # This value is used as a configuration path and should resolve to one
  144 # or more 'query's. If reference points to multiple queries, and a query
  145 # fails, the next query is executed.
  146 #
  147 # Behaviour is identical to the old 1.x/2.x module, except we can now
  148 # fail between N queries, and query selection can be based on any
  149 # combination of attributes, or custom 'Acct-Status-Type' values.
  150 #######################################################################
  151 accounting {
  152     reference = "%{tolower:type.%{%{Acct-Status-Type}:-%{Request-Processing-Stage}}.query}"
  153 
  154     # Write SQL queries to a logfile. This is potentially useful for bulk inserts
  155     # when used with the rlm_sql_null driver.
  156 #   logfile = ${logdir}/accounting.sql
  157 
  158     type {
  159         accounting-on {
  160             query = "\
  161                 UPDATE ${....acct_table1} \
  162                 SET \
  163                     AcctStopTime=${....event_timestamp}, \
  164                     AcctSessionTime=${....event_timestamp_epoch} - \
  165                         DATEDIFF(SS, '1970-01-01', AcctStartTime), \
  166                     AcctTerminateCause='%{%{Acct-Terminate-Cause}:-NAS-Reboot}', \
  167                     AcctStopDelay = %{%{Acct-Delay-Time}:-0} \
  168                 WHERE AcctStopTime = 0 \
  169                 AND NASIPAddress = '%{NAS-IP-Address}' \
  170                 AND AcctStartTime <= ${....event_timestamp}"
  171         }
  172 
  173         accounting-off {
  174             query = "${..accounting-on.query}"
  175         }
  176 
  177         #
  178         #  Implement the "sql_session_start" policy.
  179         #  See raddb/policy.d/accounting for more details.
  180         #
  181         #  You also need to fix the other queries as
  182         #  documented below.  Look for "sql_session_start".
  183         #
  184         post-auth {
  185             query = "\
  186             INSERT INTO ${....acct_table1} \
  187                 INSERT INTO ${....acct_table1} ( \
  188                     AcctSessionId, \
  189                     AcctUniqueId, \
  190                     UserName, \
  191                     Realm, \
  192                     NASIPAddress, \
  193                     NASPort, \
  194                     NASPortType, \
  195                     AcctStartTime, \
  196                     AcctSessionTime, \
  197                     AcctAuthentic, \
  198                     ConnectInfo_start, \
  199                     ConnectInfo_stop, \
  200                     AcctInputOctets, \
  201                     AcctOutputOctets, \
  202                     CalledStationId, \
  203                     CallingStationId, \
  204                     AcctTerminateCause, \
  205                     ServiceType, \
  206                     FramedProtocol, \
  207                     FramedIPAddress, \
  208                     FramedIPv6Address, \
  209                     FramedIPv6Prefix, \
  210                     FramedInterfaceId, \
  211                     DelegatedIPv6Prefix \
  212                     ${..class.column_name}) \
  213             VALUES(\
  214                 '%{Acct-Session-Id}', \
  215                 '%{Acct-Unique-Session-Id}', \
  216                 '%{SQL-User-Name}', \
  217                 '%{Realm}', \
  218                 '%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}}', \
  219                 '%{%{NAS-Port-ID}:-%{NAS-Port}}', \
  220                 '%{NAS-Port-Type}', \
  221                 '%S', \
  222                 0, \
  223                 '', \
  224                 '%{Connect-Info}', \
  225                 '', \
  226                 0, \
  227                 0, \
  228                 '%{Called-Station-Id}', \
  229                 '%{Calling-Station-Id}', \
  230                 '', \
  231                 '%{Service-Type}', \
  232                 '', \
  233                 '', \
  234                 '', \
  235                 '', \
  236                 '', \
  237                 '' \
  238                 ${....class.packet_xlat})"
  239 
  240             query = "\
  241                 UPDATE ${....acct_table1} SET \
  242                     AcctStartTime = '%S', \
  243                     ConnectInfo_start = '%{Connect-Info}', \
  244                     AcctSessionId = '%{Acct-Session-Id}' \
  245                 WHERE UserName = '%{SQL-User-Name}' \
  246                     AND NASIPAddress = '%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}}' \
  247                     AND NASPortId = '%{%{NAS-Port-ID}:-%{NAS-Port}}' \
  248                     AND NASPortType = '%{NAS-Port-Type}' \
  249                     AND AcctStopTime IS NULL"
  250         }
  251 
  252         start {
  253             query = "\
  254                 INSERT INTO ${....acct_table1} ( \
  255                     AcctSessionId, \
  256                     AcctUniqueId, \
  257                     UserName, \
  258                     Realm, \
  259                     NASIPAddress, \
  260                     NASPort, \
  261                     NASPortType, \
  262                     AcctStartTime, \
  263                     AcctSessionTime, \
  264                     AcctAuthentic, \
  265                     ConnectInfo_start, \
  266                     ConnectInfo_stop, \
  267                     AcctInputOctets, \
  268                     AcctOutputOctets, \
  269                     CalledStationId, \
  270                     CallingStationId, \
  271                     AcctTerminateCause, \
  272                     ServiceType, \
  273                     FramedProtocol, \
  274                     FramedIPAddress, \
  275                     FramedIPv6Address, \
  276                     FramedIPv6Prefix, \
  277                     FramedInterfaceId, \
  278                     DelegatedIPv6Prefix, \
  279                     AcctStartDelay, \
  280                     AcctStopDelay, \
  281                     XAscendSessionSvrKey \
  282                     ${..class.column_name}) \
  283                 VALUES(\
  284                     '%{Acct-Session-Id}', \
  285                     '%{Acct-Unique-Session-Id}', \
  286                     '%{SQL-User-Name}', \
  287                     '%{Realm}', \
  288                     '%{NAS-IP-Address}', \
  289                     '%{%{NAS-Port-ID}:-%{NAS-Port}}', \
  290                     '%{NAS-Port-Type}', \
  291                     ${....event_timestamp}, \
  292                     '0', \
  293                     '%{Acct-Authentic}', \
  294                     '%{Connect-Info}', \
  295                     '', \
  296                     '0', \
  297                     '0', \
  298                     '%{Called-Station-Id}', \
  299                     '%{Calling-Station-Id}', \
  300                     '', \
  301                     '%{Service-Type}', \
  302                     '%{Framed-Protocol}', \
  303                     '%{Framed-IP-Address}', \
  304                     '%{Framed-IPv6-Address}', \
  305                     '%{Framed-IPv6-Prefix}', \
  306                     '%{Framed-Interface-Id}', \
  307                     '%{Delegated-IPv6-Prefix}', \
  308                     '%{Acct-Delay-Time}', \
  309                     '0', \
  310                     '%{X-Ascend-Session-Svr-Key}' \
  311                     ${....class.packet_xlat})"
  312 
  313             #
  314             #  When using "sql_session_start", you should comment out
  315             #  the previous query, and enable this one.
  316             #
  317             #  Just change the previous query to "-query",
  318             #  and this one to "query".  The previous one
  319             #  will be ignored, and this one will be
  320             #  enabled.
  321             #
  322             -query = "\
  323                 UPDATE ${....acct_table1} \
  324                 SET \
  325                     AcctSessionId = '%{Acct-Session-Id}', \
  326                     AcctUniqueId = '%{Acct-Unique-Session-Id}', \
  327                     AcctAuthentic = '%{Acct-Authentic}', \
  328                     ConnectInfo_start = '%{Connect-Info}', \
  329                     ServiceType = '%{Service-Type}', \
  330                     FramedProtocol = '%{Framed-Protocol}', \
  331                     FramedIpAddress = '%{Framed-IP-Address}', \
  332                     FramedIpv6Address = '%{Framed-IPv6-Address}', \
  333                     FramedIpv6Prefix = '%{Framed-IPv6-Prefix}', \
  334                     FramedInterfaceId = '%{Framed-Interface-Id}', \
  335                     DelegatedIpv6Prefix = '%{Delegated-IPv6-Prefix}', \
  336                     AcctStartTime = '%S' \
  337                 WHERE UserName = '%{SQL-User-Name}' \
  338                     AND NASIPAddress = '%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}}' \
  339                     AND NASPortId = '%{%{NAS-Port-ID}:-%{NAS-Port}}' \
  340                     AND NASPortType = '%{NAS-Port-Type}' \
  341                     AND AcctStopTime IS NULL"
  342 
  343             query = "\
  344                 UPDATE ${....acct_table1} \
  345                 SET \
  346                     AcctStartTime = ${....event_timestamp}, \
  347                     AcctStartDelay = '%{%{Acct-Delay-Time}:-0}', \
  348                     ConnectInfo_start = '%{Connect-Info}' \
  349                 WHERE AcctUniqueId = '%{Acct-Unique-Session-ID}' \
  350                 AND AcctStopTime = 0"
  351         }
  352 
  353         interim-update {
  354             query = "\
  355                 UPDATE ${....acct_table1} \
  356                 SET \
  357                     FramedIPAddress = '%{Framed-IP-Address}', \
  358                     FramedIPv6Address = '%{Framed-IPv6-Address}', \
  359                     FramedIPv6Prefix = '%{Framed-IPv6-Prefix}', \
  360                     FramedInterfaceId = '%{Framed-Interface-Id}', \
  361                     DelegatedIPv6Prefix = '%{Delegated-IPv6-Prefix}' \
  362                 WHERE AcctUniqueId = '%{Acct-Unique-Session-ID}' \
  363                 AND AcctStopTime = 0"
  364 
  365             query = "\
  366                 INSERT INTO ${....acct_table1} ( \
  367                     AcctSessionId, \
  368                     AcctUniqueId, \
  369                     UserName, \
  370                     Realm, \
  371                     NASIPAddress, \
  372                     NASPort, \
  373                     NASPortType, \
  374                     AcctSessionTime, \
  375                     AcctAuthentic, \
  376                     ConnectInfo_start, \
  377                     AcctInputOctets, \
  378                     AcctOutputOctets, \
  379                     CalledStationId, \
  380                     CallingStationId, \
  381                     ServiceType, \
  382                     FramedProtocol, \
  383                     FramedIPAddress, \
  384                     FramedIPv6Address, \
  385                     FramedIPv6Prefix, \
  386                     FramedInterfaceId, \
  387                     DelegatedIPv6Prefix, \
  388                     AcctStartDelay, \
  389                     XAscendSessionSvrKey \
  390                     ${..class.column_name}) \
  391                 VALUES(\
  392                     '%{Acct-Session-Id}', \
  393                     '%{Acct-Unique-Session-Id}', \
  394                     '%{SQL-User-Name}', \
  395                     '%{Realm}', \
  396                     '%{NAS-IP-Address}', \
  397                     '%{%{NAS-Port-ID}:-%{NAS-Port}}', \
  398                     '%{NAS-Port-Type}', \
  399                     '%{Acct-Session-Time}', \
  400                     '%{Acct-Authentic}', \
  401                     '', \
  402                     '%{Acct-Input-Octets}', \
  403                     '%{Acct-Output-Octets}', \
  404                     '%{Called-Station-Id}', \
  405                     '%{Calling-Station-Id}', \
  406                     '%{Service-Type}', \
  407                     '%{Framed-Protocol}', \
  408                     '%{Framed-IP-Address}', \
  409                     '%{Framed-IPv6-Address}', \
  410                     '%{Framed-IPv6-Prefix}', \
  411                     '%{Framed-Interface-Id}', \
  412                     '%{Delegated-IPv6-Prefix}', \
  413                     '0', \
  414                     '%{X-Ascend-Session-Svr-Key}' \
  415                     ${....class.packet_xlat})"
  416 
  417             #
  418             #  When using "sql_session_start", you should comment out
  419             #  the previous query, and enable this one.
  420             #
  421             #  Just change the previous query to "-query",
  422             #  and this one to "query".  The previous one
  423             #  will be ignored, and this one will be
  424             #  enabled.
  425             #
  426             -query = "\
  427                 UPDATE ${....acct_table1} \
  428                 SET \
  429                     AcctSessionId = '%{Acct-Session-Id}', \
  430                     AcctUniqueId = '%{Acct-Unique-Session-Id}', \
  431                     AcctAuthentic = '%{Acct-Authentic}', \
  432                     ConnectInfo_start = '%{Connect-Info}', \
  433                     ServiceType = '%{Service-Type}', \
  434                     FramedProtocol = '%{Framed-Protocol}', \
  435                     FramedIPAddress = '%{Framed-IP-Address}', \
  436                     FramedIPv6Address = '%{Framed-IPv6-Address}', \
  437                     FramedIPv6Prefix = '%{Framed-IPv6-Prefix}', \
  438                     FramedInterfaceId = '%{Framed-Interface-Id}', \
  439                     DelegatedIPv6Prefix = '%{Delegated-IPv6-Prefix}', \
  440                     AcctInputOctets = convert(bigint, '%{%{Acct-Input-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Input-Octets}:-0}', \
  441                     AcctOutputOctets = convert(bigint, '%{%{Acct-Output-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Output-Octets}:-0}' \
  442                 WHERE UserName = '%{SQL-User-Name}' \
  443                     AND NASIPAddress = '%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}}' \
  444                     AND NASPortId = '%{%{NAS-Port-ID}:-%{NAS-Port}}' \
  445                     AND NASPortType = '%{NAS-Port-Type}' \
  446                     AND AcctStopTime IS NULL"
  447         }
  448 
  449         stop {
  450             query = "\
  451                 UPDATE ${....acct_table2} \
  452                 SET \
  453                     AcctStopTime = ${....event_timestamp}, \
  454                     AcctSessionTime = '%{Acct-Session-Time}', \
  455                     AcctInputOctets = convert(bigint, '%{%{Acct-Input-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Input-Octets}:-0}', \
  456                     AcctOutputOctets = convert(bigint, '%{%{Acct-Output-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Output-Octets}:-0}', \
  457                     AcctTerminateCause = '%{Acct-Terminate-Cause}', \
  458                     AcctStopDelay = '%{%{Acct-Delay-Time}:-0}', \
  459                     ConnectInfo_stop = '%{Connect-Info}' \
  460                 WHERE AcctUniqueId = '%{Acct-Unique-Session-ID}' \
  461                 AND AcctStopTime = 0"
  462 
  463             query = "\
  464                 INSERT into ${....acct_table2} (\
  465                     AcctSessionId, \
  466                     AcctUniqueId, \
  467                     UserName, \
  468                     Realm, \
  469                     NASIPAddress, \
  470                     NASPort, \
  471                     NASPortType, \
  472                     AcctStopTime, \
  473                     AcctSessionTime, \
  474                     AcctAuthentic, \
  475                     ConnectInfo_start, \
  476                     ConnectInfo_stop, \
  477                     AcctInputOctets, \
  478                     AcctOutputOctets, \
  479                     CalledStationId, \
  480                     CallingStationId, \
  481                     AcctTerminateCause, \
  482                     ServiceType, \
  483                     FramedProtocol, \
  484                     FramedIPAddress, \
  485                     FramedIPv6Address, \
  486                     FramedIPv6Prefix, \
  487                     FramedInterfaceId, \
  488                     DelegatedIPv6Prefix, \
  489                     AcctStartDelay, \
  490                     AcctStopDelay \
  491                     ${..class.column_name}) \
  492                 VALUES(\
  493                     '%{Acct-Session-Id}', \
  494                     '%{Acct-Unique-Session-Id}', \
  495                     '%{SQL-User-Name}', \
  496                     '%{Realm}', \
  497                     '%{NAS-IP-Address}', \
  498                     '%{%{NAS-Port-ID}:-%{NAS-Port}}', \
  499                     '%{NAS-Port-Type}', \
  500                     ${....event_timestamp}, \
  501                     '%{Acct-Session-Time}', \
  502                     '%{Acct-Authentic}', \
  503                     '', \
  504                     '%{Connect-Info}', \
  505                     NULL, \
  506                     convert(bigint, '%{%{Acct-Input-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Input-Octets}:-0}', \
  507                     convert(bigint, '%{%{Acct-Output-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Output-Octets}:-0}', \
  508                     '%{Called-Station-Id}', \
  509                     '%{Calling-Station-Id}', \
  510                     '%{Acct-Terminate-Cause}', \
  511                     '%{Service-Type}', \
  512                     '%{Framed-Protocol}', \
  513                     '%{Framed-IP-Address}', \
  514                     '%{Framed-IPv6-Address}', \
  515                     '%{Framed-IPv6-Prefix}', \
  516                     '%{Framed-Interface-Id}', \
  517                     '%{Delegated-IPv6-Prefix}', \
  518                     '0', \
  519                     '%{%{Acct-Delay-Time}:-0}' \
  520                     ${....class.packet_xlat})"
  521 
  522             #
  523             #  When using "sql_session_start", you should comment out
  524             #  the previous query, and enable this one.
  525             #
  526             #  Just change the previous query to "-query",
  527             #  and this one to "query".  The previous one
  528             #  will be ignored, and this one will be
  529             #  enabled.
  530             #
  531             -query = "\
  532                 UPDATE ${....acct_table1} \
  533                 SET \
  534                     AcctSessionId = '%{Acct-Session-Id}', \
  535                     AcctUniqueId = '%{Acct-Unique-Session-Id}', \
  536                     AcctAuthentic = '%{Acct-Authentic}', \
  537                     ConnectInfo_start = '%{Connect-Info}', \
  538                     ServiceType = '%{Service-Type}', \
  539                     FramedProtocol = '%{Framed-Protocol}', \
  540                     FramedIPAddress = '%{Framed-IP-Address}', \
  541                     FramedIPv6Address = '%{Framed-IPv6-Address}', \
  542                     FramedIPv6Prefix = '%{Framed-IPv6-Prefix}', \
  543                     FramedInterfaceId = '%{Framed-Interface-Id}', \
  544                     DelegatedIPv6Prefix = '%{Delegated-IPv6-Prefix}', \
  545                     AcctStopTime = '%S', \
  546                     AcctSessionTime = %{Acct-Session-Time}, \
  547                     AcctInputOctets = convert(bigint, '%{%{Acct-Input-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Input-Octets}:-0}', \
  548                     AcctOutputOctets = convert(bigint, '%{%{Acct-Output-Gigawords}:-0}' * POWER(2.0, 32)) | '%{%{Acct-Output-Octets}:-0}', \
  549                     AcctTerminateCause = '%{Acct-Terminate-Cause}', \
  550                     ConnectInfo_stop = '%{Connect-Info}' \
  551                 WHERE UserName = '%{SQL-User-Name}' \
  552                 AND NASIPAddress = '%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}}' \
  553                 AND NASPortId = '%{%{NAS-Port-ID}:-%{NAS-Port}}' \
  554                 AND NASPortType = '%{NAS-Port-Type}' \
  555                 AND AcctStopTime IS NULL"
  556         }
  557 
  558         #
  559         #  No Acct-Status-Type == ignore the packet
  560         #
  561         accounting {
  562             query = "SELECT true"
  563         }
  564     }
  565 }
  566 
  567 post-auth {
  568     # Write SQL queries to a logfile. This is potentially useful for bulk inserts
  569     # when used with the rlm_sql_null driver.
  570 #   logfile = ${logdir}/post-auth.sql
  571 
  572     query = "\
  573         INSERT INTO ${..postauth_table} \
  574             (userName, pass, reply, authdate ${..class.column_name}) \
  575         VALUES(\
  576             '%{User-Name}', \
  577             '%{%{User-Password}:-CHAP-PASSWORD}', \
  578             '%{reply:Packet-Type}', \
  579             '%S.%{expr:%M / 1000}' \
  580             ${..class.reply_xlat})"
  581 }