annotate extensions/app_radgw/rgwx_auth.c @ 1521:996823ef481c

Rename 3GPP MBMS-Flag (931) to MBMS-Flags Note: 3GPP TS 29.061 table 20.5a.1 row MBMS-Flag (931) has incorrect name and should be "MBMS-Flags" per clause 20.5a.9. Fix: MBMS-Flag (931) renamed to MBMS-Flags (931).
author Luke Mewburn <luke@mewburn.net>
date Fri, 17 Apr 2020 14:21:19 +1000
parents 79dd22145f52
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1 /*********************************************************************************************************
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
2 * Software License Agreement (BSD License) *
740
4a9f08d6b6ba Updated my mail address
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 706
diff changeset
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> *
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
4 * *
928
5053f1abcf5d Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents: 924
diff changeset
5 * Copyright (c) 2013, WIDE Project and NICT *
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
6 * All rights reserved. *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
7 * *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
8 * Redistribution and use of this software in source and binary forms, with or without modification, are *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
9 * permitted provided that the following conditions are met: *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
10 * *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
11 * * Redistributions of source code must retain the above *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
12 * copyright notice, this list of conditions and the *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
13 * following disclaimer. *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
14 * *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
15 * * Redistributions in binary form must reproduce the above *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
16 * copyright notice, this list of conditions and the *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
17 * following disclaimer in the documentation and/or other *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
18 * materials provided with the distribution. *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
19 * *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
20 * * Neither the name of the WIDE Project or NICT nor the *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
21 * names of its contributors may be used to endorse or *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
22 * promote products derived from this software without *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
23 * specific prior written permission of WIDE Project and *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
24 * NICT. *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
25 * *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
34 *********************************************************************************************************/
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
35
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
36 /* RADIUS Access-Request messages translation plugin */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
37
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
38 #include "rgw_common.h"
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
39
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
40 /* Attributes missing from radius.h */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
41 #define RADIUS_ATTR_CHAP_PASSWORD 3
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
42 #define RADIUS_ATTR_ARAP_PASSWORD 70
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
43
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
44 /* Other constants we use */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
45 #define AI_NASREQ 1 /* Diameter NASREQ */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
46 #define AI_EAP 5 /* Diameter EAP application */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
47 #define CC_AA 265 /* AAR */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
48 #define CC_DIAMETER_EAP 268 /* DER */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
49 #define ACV_ART_AUTHORIZE_AUTHENTICATE 3 /* AUTHORIZE_AUTHENTICATE */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
50 #define ACV_OAP_RADIUS 1 /* RADIUS */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
51 #define ACV_ASS_STATE_MAINTAINED 0 /* STATE_MAINTAINED */
296
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
52 #define ACV_ASS_NO_STATE_MAINTAINED 1 /* NO_STATE_MAINTAINED */
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
53
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
54 /* The state we keep for this plugin */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
55 struct rgwp_config {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
56 struct {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
57 struct dict_object * ARAP_Password; /* ARAP-Password */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
58 struct dict_object * ARAP_Security; /* ARAP-Security */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
59 struct dict_object * ARAP_Security_Data; /* ARAP-Security-Data */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
60 struct dict_object * Auth_Application_Id; /* Auth-Application-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
61 struct dict_object * Auth_Request_Type; /* Auth-Request-Type */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
62 struct dict_object * Authorization_Lifetime; /* Authorization-Lifetime */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
63 struct dict_object * Callback_Number; /* Callback-Number */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
64 struct dict_object * Called_Station_Id; /* Called-Station-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
65 struct dict_object * Calling_Station_Id; /* Calling-Station-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
66 struct dict_object * CHAP_Algorithm; /* CHAP-Algorithm */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
67 struct dict_object * CHAP_Auth; /* CHAP-Auth */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
68 struct dict_object * CHAP_Challenge; /* CHAP-Challenge */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
69 struct dict_object * CHAP_Ident; /* CHAP-Ident */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
70 struct dict_object * CHAP_Response; /* CHAP-Response */
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
71 struct dict_object * Destination_Host; /* Destination-Host */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
72 struct dict_object * Destination_Realm; /* Destination-Realm */
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
73 struct dict_object * Connect_Info; /* Connect-Info */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
74 struct dict_object * EAP_Payload; /* EAP-Payload */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
75 struct dict_object * Error_Message; /* Error-Message */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
76 struct dict_object * Error_Reporting_Host; /* Error-Reporting-Host */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
77 struct dict_object * Failed_AVP; /* Failed-AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
78 struct dict_object * Framed_Compression; /* Framed-Compression */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
79 struct dict_object * Framed_IP_Address; /* Framed-IP-Address */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
80 struct dict_object * Framed_IP_Netmask; /* Framed-IP-Netmask */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
81 struct dict_object * Framed_Interface_Id; /* Framed-Interface-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
82 struct dict_object * Framed_IPv6_Prefix; /* Framed-IPv6-Prefix */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
83 struct dict_object * Framed_MTU; /* Framed-MTU */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
84 struct dict_object * Framed_Protocol; /* Framed-Protocol */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
85 struct dict_object * Login_IP_Host; /* Login-IP-Host */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
86 struct dict_object * Login_IPv6_Host; /* Login-IPv6-Host */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
87 struct dict_object * Login_LAT_Group; /* Login-LAT-Group */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
88 struct dict_object * Login_LAT_Node; /* Login-LAT-Node */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
89 struct dict_object * Login_LAT_Port; /* Login-LAT-Port */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
90 struct dict_object * Login_LAT_Service; /* Login-LAT-Service */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
91 struct dict_object * NAS_Identifier; /* NAS-Identifier */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
92 struct dict_object * NAS_IP_Address; /* NAS-IP-Address */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
93 struct dict_object * NAS_IPv6_Address; /* NAS-IPv6-Address */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
94 struct dict_object * NAS_Port; /* NAS-Port */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
95 struct dict_object * NAS_Port_Id; /* NAS-Port-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
96 struct dict_object * NAS_Port_Type; /* NAS-Port-Type */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
97 struct dict_object * Origin_AAA_Protocol; /* Origin-AAA-Protocol */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
98 struct dict_object * Origin_Host; /* Origin-Host */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
99 struct dict_object * Origin_Realm; /* Origin-Realm */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
100 struct dict_object * Originating_Line_Info; /* Originating-Line-Info */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
101 struct dict_object * Port_Limit; /* Port-Limit */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
102 struct dict_object * Re_Auth_Request_Type; /* Re-Auth-Request-Type */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
103 struct dict_object * Result_Code; /* Result-Code */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
104 struct dict_object * Service_Type; /* Service-Type */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
105 struct dict_object * Session_Id; /* Session-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
106 struct dict_object * Session_Timeout; /* Session-Timeout */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
107 struct dict_object * State; /* State */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
108 struct dict_object * Tunneling; /* Tunneling */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
109 struct dict_object * Tunnel_Type; /* Tunnel-Type */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
110 struct dict_object * Tunnel_Medium_Type; /* Tunnel-Medium-Type */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
111 struct dict_object * Tunnel_Client_Endpoint; /* Tunnel-Client-Endpoint */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
112 struct dict_object * Tunnel_Server_Endpoint; /* Tunnel-Server-Endpoint */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
113 struct dict_object * Tunnel_Private_Group_Id; /* Tunnel-Private-Group-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
114 struct dict_object * Tunnel_Preference; /* Tunnel-Preference */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
115 struct dict_object * Tunnel_Client_Auth_Id; /* Tunnel-Client-Auth-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
116 struct dict_object * Tunnel_Server_Auth_Id; /* Tunnel-Server-Auth-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
117 struct dict_object * User_Name; /* User-Name */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
118 struct dict_object * User_Password; /* User-Password */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
119
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
120 } dict; /* cache of the dictionary objects we use */
271
411314907b43 Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 264
diff changeset
121 struct session_handler * sess_hdl; /* We store RADIUS request authenticator information in the session */
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
122 char * confstr;
526
6fe3e5cf9fb2 Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 405
diff changeset
123
6fe3e5cf9fb2 Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 405
diff changeset
124 int ignore_nai;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
125 };
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
126
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
127 struct sess_state {
1119
79dd22145f52 Fix a number of compilation warnings
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1088
diff changeset
128 uint8_t req_auth[16];
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
129 };
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
130
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
131
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
132 /* Initialize the plugin */
526
6fe3e5cf9fb2 Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 405
diff changeset
133 static int auth_conf_parse(char * confstr, struct rgwp_config ** state)
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
134 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
135 struct rgwp_config * new;
264
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
136 struct dict_object * app;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
137
526
6fe3e5cf9fb2 Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 405
diff changeset
138 TRACE_ENTRY("%p %p", confstr, state);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
139 CHECK_PARAMS( state );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
140
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
141 CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
142 memset(new, 0, sizeof(struct rgwp_config));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
143
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
144 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, (void *)free, NULL, NULL ) );
526
6fe3e5cf9fb2 Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 405
diff changeset
145 new->confstr = confstr;
6fe3e5cf9fb2 Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 405
diff changeset
146
532
4cb8f63a0f67 Fix segfault when no configuration string is given to the plugins
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 526
diff changeset
147 if (confstr && strstr(confstr, "nonai"))
526
6fe3e5cf9fb2 Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 405
diff changeset
148 new->ignore_nai = 1;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
149
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
150 /* Resolve all dictionary objects we use */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
151 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Password", &new->dict.ARAP_Password, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
152 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Security", &new->dict.ARAP_Security, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
153 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "ARAP-Security-Data", &new->dict.ARAP_Security_Data, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
154 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Auth-Application-Id", &new->dict.Auth_Application_Id, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
155 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Auth-Request-Type", &new->dict.Auth_Request_Type, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
156 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Authorization-Lifetime", &new->dict.Authorization_Lifetime, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
157 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Callback-Number", &new->dict.Callback_Number, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
158 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Called-Station-Id", &new->dict.Called_Station_Id, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
159 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Calling-Station-Id", &new->dict.Calling_Station_Id, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
160 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "CHAP-Algorithm", &new->dict.CHAP_Algorithm, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
161 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "CHAP-Auth", &new->dict.CHAP_Auth, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
162 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "CHAP-Challenge", &new->dict.CHAP_Challenge, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
163 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "CHAP-Ident", &new->dict.CHAP_Ident, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
164 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "CHAP-Response", &new->dict.CHAP_Response, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
165 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Connect-Info", &new->dict.Connect_Info, ENOENT) );
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
166 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Host", &new->dict.Destination_Host, ENOENT) );
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
167 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &new->dict.Destination_Realm, ENOENT) );
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
168 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "EAP-Payload", &new->dict.EAP_Payload, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
169 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Error-Message", &new->dict.Error_Message, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
170 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Error-Reporting-Host", &new->dict.Error_Reporting_Host, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
171 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Failed-AVP", &new->dict.Failed_AVP, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
172 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-Compression", &new->dict.Framed_Compression, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
173 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-IP-Address", &new->dict.Framed_IP_Address, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
174 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-IP-Netmask", &new->dict.Framed_IP_Netmask, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
175 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-Interface-Id", &new->dict.Framed_Interface_Id, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
176 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-IPv6-Prefix", &new->dict.Framed_IPv6_Prefix, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
177 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-MTU", &new->dict.Framed_MTU, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
178 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Framed-Protocol", &new->dict.Framed_Protocol, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
179 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-IP-Host", &new->dict.Login_IP_Host, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
180 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-IPv6-Host", &new->dict.Login_IPv6_Host, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
181 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-LAT-Group", &new->dict.Login_LAT_Group, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
182 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-LAT-Node", &new->dict.Login_LAT_Node, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
183 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-LAT-Port", &new->dict.Login_LAT_Port, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
184 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Login-LAT-Service", &new->dict.Login_LAT_Service, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
185 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-Identifier", &new->dict.NAS_Identifier, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
186 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-IP-Address", &new->dict.NAS_IP_Address, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
187 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-IPv6-Address", &new->dict.NAS_IPv6_Address, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
188 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-Port", &new->dict.NAS_Port, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
189 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-Port-Id", &new->dict.NAS_Port_Id, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
190 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "NAS-Port-Type", &new->dict.NAS_Port_Type, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
191 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-AAA-Protocol", &new->dict.Origin_AAA_Protocol, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
192 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Host", &new->dict.Origin_Host, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
193 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Origin-Realm", &new->dict.Origin_Realm, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
194 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Originating-Line-Info", &new->dict.Originating_Line_Info, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
195 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Port-Limit", &new->dict.Port_Limit, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
196 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Re-Auth-Request-Type", &new->dict.Re_Auth_Request_Type, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
197 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Result-Code", &new->dict.Result_Code, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
198 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Service-Type", &new->dict.Service_Type, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
199 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Id", &new->dict.Session_Id, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
200 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Timeout", &new->dict.Session_Timeout, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
201 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "State", &new->dict.State, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
202 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunneling", &new->dict.Tunneling, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
203 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Type", &new->dict.Tunnel_Type, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
204 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Medium-Type", &new->dict.Tunnel_Medium_Type, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
205 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Client-Endpoint", &new->dict.Tunnel_Client_Endpoint, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
206 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Server-Endpoint", &new->dict.Tunnel_Server_Endpoint, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
207 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Private-Group-Id", &new->dict.Tunnel_Private_Group_Id, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
208 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Preference", &new->dict.Tunnel_Preference, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
209 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Client-Auth-Id", &new->dict.Tunnel_Client_Auth_Id, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
210 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Tunnel-Server-Auth-Id", &new->dict.Tunnel_Server_Auth_Id, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
211 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "User-Name", &new->dict.User_Name, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
212 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "User-Password", &new->dict.User_Password, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
213
264
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
214 /* This plugin provides the following Diameter authentication applications support: */
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
215 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_APPLICATION, APPLICATION_BY_NAME, "Diameter Network Access Server Application", &app, ENOENT) );
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
216 CHECK_FCT( fd_disp_app_support ( app, NULL, 1, 0 ) );
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
217
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
218 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_APPLICATION, APPLICATION_BY_NAME, "Diameter Extensible Authentication Protocol (EAP) Application", &app, ENOENT) );
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
219 CHECK_FCT( fd_disp_app_support ( app, NULL, 1, 0 ) );
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
220
262
cc2c568ef319 Missing affectation
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
221 *state = new;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
222 return 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
223 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
224
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
225 /* deinitialize */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
226 static void auth_conf_free(struct rgwp_config * state)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
227 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
228 TRACE_ENTRY("%p", state);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
229 CHECK_PARAMS_DO( state, return );
639
95a784729cac Added new opaque pointer to fd_sess_handler_create and fd_disp_register for usability. Bumped API version number.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 532
diff changeset
230 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl, NULL ), );
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
231 free(state);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
232 return;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
233 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
234
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
235 /* Handle an incoming RADIUS request */
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
236 static int auth_rad_req( struct rgwp_config * cs, struct radius_msg * rad_req, struct radius_msg ** rad_ans, struct msg ** diam_fw, struct rgw_client * cli )
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
237 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
238 int idx;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
239 int got_id = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
240 int got_mac = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
241 int got_passwd = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
242 int got_eap = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
243 int got_empty_eap = 0;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
244 const char * prefix = "Diameter/";
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
245 size_t pref_len;
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
246 os0_t dh = NULL;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
247 size_t dh_len = 0;
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
248 os0_t dr = NULL;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
249 size_t dr_len = 0;
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
250 os0_t si = NULL;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
251 size_t si_len = 0;
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
252 os0_t un = NULL;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
253 size_t un_len = 0;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
254 size_t nattr_used = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
255 struct avp ** avp_tun = NULL, *avp = NULL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
256 union avp_value value;
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
257 struct session * sess;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
258
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
259 TRACE_ENTRY("%p %p %p %p %p", cs, rad_req, rad_ans, diam_fw, cli);
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
260 CHECK_PARAMS(cs && rad_req && (rad_req->hdr->code == RADIUS_CODE_ACCESS_REQUEST) && rad_ans && diam_fw && *diam_fw);
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
261
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
262 pref_len = strlen(prefix);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
263
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
264 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
265 Guidelines:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
266 http://tools.ietf.org/html/rfc4005#section-9.1
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
267 http://tools.ietf.org/html/rfc4072#section-6.1
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
268
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
269 When a Translation Agent receives a RADIUS message, the following
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
270 steps should be taken:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
271
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
272 - If a Message-Authenticator attribute is present, the value MUST
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
273 be checked but not included in the Diameter message. If it is
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
274 incorrect, the RADIUS message should be silently discarded.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
275 The gateway system SHOULD generate and include a Message-
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
276 Authenticator in returned RADIUS responses.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
277 -> done in rgw_msg_auth_check
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
278
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
279 - The transport address of the sender MUST be checked against the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
280 NAS identifying attributes. See the description of NAS-
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
281 Identifier and NAS-IP-Address below.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
282 -> done in rgw_clients_check_origin
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
283
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
284 - The Translation Agent must maintain transaction state
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
285 information relevant to the RADIUS request, such as the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
286 Identifier field in the RADIUS header, any existing RADIUS
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
287 Proxy-State attribute, and the source IP address and port
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
288 number of the UDP packet. These may be maintained locally in a
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
289 state table or saved in a Proxy-Info AVP group. A Diameter
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
290 Session-Id AVP value must be created using a session state
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
291 mapping mechanism.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
292 -> Identifier, source and port are saved along with the request,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
293 and associated with the session state.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
294 -> sub_echo_drop should handle the Proxy-State attribute (conf issue)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
295
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
296 - The Diameter Origin-Host and Origin-Realm AVPs MUST be created
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
297 and added by using the information from an FQDN corresponding
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
298 to the NAS-IP-Address attribute (preferred if available),
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
299 and/or to the NAS-Identifier attribute. (Note that the RADIUS
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
300 NAS-Identifier is not required to be an FQDN.)
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
301 -> done in rgw_clients_create_origin.
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
302
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
303 - The response MUST have an Origin-AAA-Protocol AVP added,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
304 indicating the protocol of origin of the message.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
305 -> what "response" ??? Added to the AAR / DER in this function.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
306
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
307 - The Proxy-Info group SHOULD be added, with the local server's
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
308 identity specified in the Proxy-Host AVP. This should ensure
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
309 that the response is returned to this system.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
310 -> We don't need this, answer is always routed here anyway.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
311
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
312 For EAP:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
313
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
314 o RADIUS EAP-Message attribute(s) are translated to a Diameter
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
315 EAP-Payload AVP. If multiple RADIUS EAP-Message attributes are
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
316 present, they are concatenated and translated to a single Diameter
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
317 EAP-Payload AVP.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
318 -> concatenation done by radius_msg_get_eap
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
319
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
320 -> the remaining is specific conversion rules
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
321 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
322
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
323 /* Check basic information is there, and also retrieve some attribute information */
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
324 for (idx = 0; idx < rad_req->attr_used; idx++) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
325 struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(rad_req->buf + rad_req->attr_pos[idx]);
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
326 uint8_t * attr_val = (uint8_t *)(attr + 1);
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
327 size_t attr_len = attr->length - sizeof(struct radius_attr_hdr);
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
328
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
329 switch (attr->type) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
330 case RADIUS_ATTR_NAS_IP_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
331 case RADIUS_ATTR_NAS_IDENTIFIER:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
332 case RADIUS_ATTR_NAS_IPV6_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
333 got_id = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
334 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
335 case RADIUS_ATTR_MESSAGE_AUTHENTICATOR:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
336 got_mac = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
337 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
338 case RADIUS_ATTR_EAP_MESSAGE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
339 got_eap = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
340 if (attr->length == 2)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
341 got_empty_eap = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
342 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
343 case RADIUS_ATTR_USER_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
344 case RADIUS_ATTR_CHAP_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
345 case RADIUS_ATTR_ARAP_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
346 got_passwd += 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
347 break;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
348
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
349 /* Is there a State attribute with prefix "Diameter/" in the message? (in that case: Diameter/Destination-Host/Destination-Realm/Session-Id) */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
350 /* NOTE: RFC4005 says "Origin-Host" here, but it's not coherent with the rules for answers. Destination-Host makes more sense */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
351 case RADIUS_ATTR_STATE:
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
352 if ((attr_len > pref_len + 5 /* for the '/'s and non empty strings */ )
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
353 && ! memcmp(attr_val, prefix, pref_len)) {
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
354 int i, start;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
355
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
356 TRACE_DEBUG(ANNOYING, "Found a State attribute with '%s' prefix (attr #%d).", prefix, idx);
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
357
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
358 /* Now parse the value and check its content is valid. Unfortunately we cannot use strchr here since strings are not \0-terminated */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
359
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
360 i = start = pref_len;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
361 dh = attr_val + i;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
362 for (; (i < attr_len - 2) && (attr_val[i] != '/'); i++) /* loop */;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
363 if ( i >= attr_len - 2 ) continue; /* the attribute format is not good */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
364 dh_len = i - start;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
365
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
366 start = ++i;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
367 dr = attr_val + i;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
368 for (; (i < attr_len - 1) && (attr_val[i] != '/'); i++) /* loop */;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
369 if ( i >= attr_len - 1 ) continue; /* the attribute format is not good */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
370 dr_len = i - start;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
371
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
372 i++;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
373 si = attr_val + i;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
374 si_len = attr_len - i;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
375
1027
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
376 TRACE_DEBUG(ANNOYING, "Attribute parsed successfully: DH:'%.*s' DR:'%.*s' SI:'%.*s'.", (int)dh_len, dh, (int)dr_len, dr, (int)si_len, si);
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
377 /* Remove from the message */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
378 for (i = idx + 1; i < rad_req->attr_used; i++)
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
379 rad_req->attr_pos[i - 1] = rad_req->attr_pos[i];
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
380 rad_req->attr_used -= 1;
384
75009e72a0ed Fix small bug
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 356
diff changeset
381 idx--;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
382 }
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
383 break;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
384
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
385 case RADIUS_ATTR_USER_NAME:
1027
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
386 TRACE_DEBUG(ANNOYING, "Found a User-Name attribute: '%.*s'", (int)attr_len, attr_len ? (char *)attr_val : "");
386
ce8d20725308 Allow empty User-Name RADIUS attributes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 385
diff changeset
387 un = attr_val;
ce8d20725308 Allow empty User-Name RADIUS attributes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 385
diff changeset
388 un_len = attr_len;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
389 break;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
390
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
391 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
392 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
393 if (!got_id) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
394 TRACE_DEBUG(INFO, "RADIUS Access-Request did not contain a NAS IP or Identifier attribute, reject.");
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
395 return EINVAL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
396 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
397 /* [Note 1] An Access-Request that contains either a User-Password or
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
398 CHAP-Password or ARAP-Password or one or more EAP-Message attributes
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
399 MUST NOT contain more than one type of those four attributes. If it
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
400 does not contain any of those four attributes, it SHOULD contain a
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
401 Message-Authenticator. If any packet type contains an EAP-Message
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
402 attribute it MUST also contain a Message-Authenticator. A RADIUS
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
403 server receiving an Access-Request not containing any of those four
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
404 attributes and also not containing a Message-Authenticator attribute
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
405 SHOULD silently discard it. */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
406 if (((got_eap + got_passwd) > 1) || (got_eap && !got_mac) || (!got_eap && !got_passwd && !got_mac)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
407 TRACE_DEBUG(INFO, "RADIUS Access-Request not conform to RFC3579 sec 3.3 note 1, discard.");
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
408 return EINVAL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
409 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
410
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
411
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
412
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
413 /*
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
414 - If the RADIUS request contained a State attribute and the
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
415 prefix of the data is "Diameter/", the data following the
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
416 prefix contains the Diameter Origin-Host/Origin-Realm/Session-
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
417 Id. If no such attributes are present and the RADIUS command
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
418 is an Access-Request, a new Session-Id is created. The
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
419 Session-Id is included in the Session-Id AVP.
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
420 */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
421
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
422 /* Add the Destination-Realm AVP */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
423 CHECK_FCT( fd_msg_avp_new ( cs->dict.Destination_Realm, 0, &avp ) );
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
424 if (dr) {
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
425 value.os.data = (unsigned char *)dr;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
426 value.os.len = dr_len;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
427 } else {
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
428 int i = 0;
526
6fe3e5cf9fb2 Added a flag to disable NAI routing in RADIUS/Diameter gw
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 405
diff changeset
429 if (un && ! cs->ignore_nai) {
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
430 /* Is there an '@' in the user name? We don't care for decorated NAI here */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
431 for (i = un_len - 2; i > 0; i--) {
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
432 if (un[i] == '@') {
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
433 i++;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
434 break;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
435 }
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
436 }
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
437 }
388
554fe1d67acc Fix small issue in the gateway
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 386
diff changeset
438 if (i <= 0) {
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
439 /* Not found in the User-Name => we use the local domain of this gateway */
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
440 value.os.data = (uint8_t *)fd_g_config->cnf_diamrlm;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
441 value.os.len = fd_g_config->cnf_diamrlm_len;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
442 } else {
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
443 value.os.data = un + i;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
444 value.os.len = un_len - i;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
445 }
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
446 }
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
447 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
448 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_FIRST_CHILD, avp) );
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
449
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
450 /* Add the Destination-Host if found */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
451 if (dh) {
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
452 CHECK_FCT( fd_msg_avp_new ( cs->dict.Destination_Host, 0, &avp ) );
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
453 value.os.data = (unsigned char *)dh;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
454 value.os.len = dh_len;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
455 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
456 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_FIRST_CHILD, avp) );
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
457 }
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
458
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
459 /* Create the session if it is not already done */
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
460 {
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
461 os0_t sess_str = NULL;
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
462 size_t sess_strlen;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
463
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
464 if (si_len) {
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
465 /* We already have the Session-Id, just use it */
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
466 CHECK_FCT( fd_sess_fromsid_msg ( si, si_len, &sess, NULL) );
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
467 } else {
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
468 /* Create a new Session-Id string */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
469
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
470 DiamId_t fqdn;
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
471 size_t fqdnlen;
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
472 DiamId_t realm;
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
473 size_t realmlen;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
474
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
475 /* Get information on the RADIUS client */
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
476 CHECK_FCT( rgw_clients_get_origin(cli, &fqdn, &fqdnlen, &realm, &realmlen) );
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
477
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
478 /* If we have a user name, create the new session with it */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
479 if (un) {
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
480 int len;
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
481 /* If not found, create a new Session-Id. Our format is: {fqdn;hi32;lo32;username;diamid} */
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
482 CHECK_MALLOC( sess_str = malloc(un_len + 1 /* ';' */ + fd_g_config->cnf_diamid_len + 1 /* '\0' */) );
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
483 len = sprintf((char *)sess_str, "%.*s;%s", (int)un_len, un, fd_g_config->cnf_diamid);
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
484 CHECK_FCT( fd_sess_new(&sess, fqdn, fqdnlen, sess_str, len) );
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
485 free(sess_str);
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
486 } else {
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
487 /* We don't have enough information to create the Session-Id, the RADIUS message is probably invalid */
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
488 TRACE_DEBUG(INFO, "RADIUS Access-Request does not contain a User-Name attribute, rejecting.");
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
489 return EINVAL;
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
490 }
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
491 }
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
492
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
493 /* Now, add the Session-Id AVP at beginning of Diameter message */
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
494 CHECK_FCT( fd_sess_getsid(sess, &sess_str, &sess_strlen) );
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
495 TRACE_DEBUG(FULL, "[auth.rgwx] Translating new message for session '%s'...", sess_str);
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
496
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
497 /* Now add this session in the message */
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
498 CHECK_FCT( fd_msg_avp_new ( cs->dict.Session_Id, 0, &avp ) );
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
499 value.os.data = sess_str;
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
500 value.os.len = sess_strlen;
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
501 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
502 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_FIRST_CHILD, avp) );
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
503 CHECK_FCT( fd_msg_sess_set(*diam_fw, sess) );
356
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
504 }
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
505
e203fc0c95e3 Updated the app_radgw extension to allow more souple management of sessions, and stateful gateway features.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 296
diff changeset
506
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
507 /* Add the appropriate command code & Auth-Application-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
508 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
509 struct msg_hdr * header = NULL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
510 CHECK_FCT( fd_msg_hdr ( *diam_fw, &header ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
511 header->msg_flags = CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
512 if (got_eap) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
513 header->msg_code = CC_DIAMETER_EAP;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
514 header->msg_appl = AI_EAP;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
515 } else {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
516 header->msg_code = CC_AA;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
517 header->msg_appl = AI_NASREQ;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
518 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
519
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
520 /* Add the Auth-Application-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
521 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
522 CHECK_FCT( fd_msg_avp_new ( cs->dict.Auth_Application_Id, 0, &avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
523 value.i32 = header->msg_appl;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
524 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
525 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
526 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
527 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
528
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
529 /* The type of request is identified through the Auth-Request-Type AVP
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
530 [BASE]. The recommended value for most RADIUS interoperabily
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
531 situations is AUTHORIZE_AUTHENTICATE. */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
532
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
533 /* Add Auth-Request-Type AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
534 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
535 CHECK_FCT( fd_msg_avp_new ( cs->dict.Auth_Request_Type, 0, &avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
536 value.i32 = ACV_ART_AUTHORIZE_AUTHENTICATE;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
537 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
538 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
539 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
540
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
541 /* Add Origin-AAA-Protocol AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
542 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
543 CHECK_FCT( fd_msg_avp_new ( cs->dict.Origin_AAA_Protocol, 0, &avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
544 value.i32 = ACV_OAP_RADIUS;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
545 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
546 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
547 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
548
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
549 /* Convert the EAP payload (concat RADIUS attributes) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
550 if (got_eap) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
551 CHECK_FCT( fd_msg_avp_new ( cs->dict.EAP_Payload, 0, &avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
552
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
553 /* o An empty RADIUS EAP-Message attribute (with length 2) signifies
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
554 EAP-Start, and it is translated to an empty EAP-Payload AVP. */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
555 if (got_empty_eap) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
556 value.os.len = 0;
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
557 value.os.data = (uint8_t *)"";
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
558 } else {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
559 CHECK_MALLOC( value.os.data = radius_msg_get_eap(rad_req, &value.os.len) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
560 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
561
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
562 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
563 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
564 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
565
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
566 /* Tunnel AVPs need some preparation */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
567 /* Convert the attributes one by one */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
568 for (idx = 0; idx < rad_req->attr_used; idx++) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
569 struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(rad_req->buf + rad_req->attr_pos[idx]);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
570
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
571 switch (attr->type) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
572
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
573 /* This macro converts a RADIUS attribute to a Diameter AVP of type OctetString */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
574 #define CONV2DIAM_STR( _dictobj_ ) \
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
575 CHECK_PARAMS( attr->length >= sizeof(struct radius_attr_hdr) ); \
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
576 /* Create the AVP with the specified dictionary model */ \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
577 CHECK_FCT( fd_msg_avp_new ( cs->dict._dictobj_, 0, &avp ) ); \
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
578 value.os.len = attr->length - sizeof(struct radius_attr_hdr); \
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
579 value.os.data = (os0_t)(attr + 1); \
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
580 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
581 /* Add the AVP in the Diameter message. */ \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
582 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
583
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
584 /* Same thing, for scalar AVPs of 32 bits */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
585 #define CONV2DIAM_32B( _dictobj_ ) \
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
586 CHECK_PARAMS( attr->length == sizeof(struct radius_attr_hdr)+sizeof(uint32_t) );\
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
587 CHECK_FCT( fd_msg_avp_new ( cs->dict._dictobj_, 0, &avp ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
588 { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
589 uint8_t * v = (uint8_t *)(attr + 1); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
590 value.u32 = (v[0] << 24) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
591 | (v[1] << 16) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
592 | (v[2] << 8) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
593 | v[3] ; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
594 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
595 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
596 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
597
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
598 /* And the 64b version */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
599 #define CONV2DIAM_64B( _dictobj_ ) \
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
600 CHECK_PARAMS( attr->length == sizeof(struct radius_attr_hdr)+sizeof(uint64_t) );\
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
601 CHECK_FCT( fd_msg_avp_new ( cs->dict._dictobj_, 0, &avp ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
602 { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
603 uint8_t * v = (uint8_t *)(attr + 1); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
604 value.u64 = ((uint64_t)(v[0]) << 56) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
605 | ((uint64_t)(v[1]) << 48) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
606 | ((uint64_t)(v[2]) << 40) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
607 | ((uint64_t)(v[3]) << 32) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
608 | ((uint64_t)(v[4]) << 24) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
609 | ((uint64_t)(v[5]) << 16) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
610 | ((uint64_t)(v[6]) << 8) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
611 | (uint64_t)(v[7]) ; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
612 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
613 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
614 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
615
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
616 /* RFC 2865 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
617 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
618 - The Destination-Realm AVP is created from the information found
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
619 in the RADIUS User-Name attribute.
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 705
diff changeset
620 -> done in rgw_clients_create_origin
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
621 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
622 case RADIUS_ATTR_USER_NAME:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
623 CONV2DIAM_STR( User_Name );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
624 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
625
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
626 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
627 - If the RADIUS User-Password attribute is present, the password
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
628 must be unencrypted by using the link's RADIUS shared secret.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
629 The unencrypted value must be forwarded in a User-Password AVP
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
630 using Diameter security.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
631 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
632 case RADIUS_ATTR_USER_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
633 if ((attr->length - 2) % 16) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
634 TRACE_DEBUG(INFO, "Invalid length of User-Password attribute: %hhd", attr->length);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
635 return EINVAL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
636 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
637 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
638 /* Decipher following this logic (refers to rfc2865#section-5.2 )
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
639 b1 = MD5(S + RA) p1 = c(1) xor b1
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
640 b2 = MD5(S + c(1)) p2 = c(2) xor b2
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
641 ...
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
642 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
643
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
644 uint8_t *ciph = (uint8_t *)(attr+1); /* c(i) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
645 size_t ciph_len = attr->length - 2;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
646 uint8_t deciph[128]; /* pi */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
647 size_t deciph_len = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
648 uint8_t * secret; /* S */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
649 size_t secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
650 uint8_t hash[16]; /* b(i) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
651 const uint8_t *addr[2];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
652 size_t len[2];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
653
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
654 /* Retrieve the shared secret */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
655 CHECK_FCT(rgw_clients_getkey(cli, &secret, &secret_len));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
656
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
657 /* Initial b1 = MD5(S + RA) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
658 addr[0] = secret;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
659 len[0] = secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
660 addr[1] = rad_req->hdr->authenticator;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
661 len[1] = 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
662 md5_vector(2, addr, len, hash);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
663
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
664 /* loop */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
665 while (deciph_len < ciph_len) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
666 int i;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
667 /* pi = c(i) xor bi */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
668 for (i = 0; i < 16; i++)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
669 deciph[deciph_len + i] = ciph[deciph_len + i] ^ hash[i];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
670 /* do we have to remove the padding '\0's ? */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
671
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
672 /* b(i+1) = MD5(S + c(i) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
673 addr[1] = ciph + deciph_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
674 md5_vector(2, addr, len, hash);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
675
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
676 deciph_len += 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
677 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
678
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
679 /* Now save this value in the AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
680 CHECK_FCT( fd_msg_avp_new ( cs->dict.User_Password, 0, &avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
681 value.os.data = &deciph[0];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
682 value.os.len = deciph_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
683 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
684 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
685 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
686 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
687
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
688
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
689 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
690 - If the RADIUS CHAP-Password attribute is present, the Ident and
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
691 Data portion of the attribute are used to create the CHAP-Auth
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
692 grouped AVP.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
693 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
694 case RADIUS_ATTR_CHAP_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
695 CHECK_PARAMS( attr->length == 19 /* RFC 2865 */);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
696 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
697 uint8_t * c = (uint8_t *)(attr + 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
698 struct avp * chap_auth;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
699 CHECK_FCT( fd_msg_avp_new ( cs->dict.CHAP_Auth, 0, &chap_auth ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
700 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, chap_auth) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
701
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
702 CHECK_FCT( fd_msg_avp_new ( cs->dict.CHAP_Algorithm, 0, &avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
703 value.u32 = 5; /* The only value defined currently... */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
704 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
705 CHECK_FCT( fd_msg_avp_add ( chap_auth, MSG_BRW_LAST_CHILD, avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
706
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
707 CHECK_FCT( fd_msg_avp_new ( cs->dict.CHAP_Ident, 0, &avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
708 value.os.data = c;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
709 value.os.len = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
710 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
711 CHECK_FCT( fd_msg_avp_add ( chap_auth, MSG_BRW_LAST_CHILD, avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
712
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
713 c++;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
714
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
715 CHECK_FCT( fd_msg_avp_new ( cs->dict.CHAP_Response, 0, &avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
716 value.os.data = c;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
717 value.os.len = attr->length - 3;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
718 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
719 CHECK_FCT( fd_msg_avp_add ( chap_auth, MSG_BRW_LAST_CHILD, avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
720 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
721 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
722
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
723 case RADIUS_ATTR_NAS_IP_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
724 CONV2DIAM_STR( NAS_IP_Address );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
725 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
726
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
727 case RADIUS_ATTR_NAS_PORT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
728 CONV2DIAM_32B( NAS_Port );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
729 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
730
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
731 case RADIUS_ATTR_SERVICE_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
732 CONV2DIAM_32B( Service_Type );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
733 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
734
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
735 case RADIUS_ATTR_FRAMED_PROTOCOL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
736 CONV2DIAM_32B( Framed_Protocol );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
737 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
738
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
739 case RADIUS_ATTR_FRAMED_IP_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
740 CONV2DIAM_STR( Framed_IP_Address );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
741 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
742
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
743 case RADIUS_ATTR_FRAMED_IP_NETMASK:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
744 CONV2DIAM_STR( Framed_IP_Netmask );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
745 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
746
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
747 /* Framed-Routing never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
748 /* Filter-Id never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
749
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
750 case RADIUS_ATTR_FRAMED_MTU:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
751 CONV2DIAM_32B( Framed_MTU );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
752 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
753
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
754 case RADIUS_ATTR_FRAMED_COMPRESSION:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
755 CONV2DIAM_32B( Framed_Compression );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
756 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
757
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
758 case RADIUS_ATTR_LOGIN_IP_HOST:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
759 CONV2DIAM_STR( Login_IP_Host );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
760 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
761
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
762 /* Login-Service never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
763 /* Login-TCP-Port never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
764 /* Reply-Message never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
765
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
766 case RADIUS_ATTR_CALLBACK_NUMBER:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
767 CONV2DIAM_STR( Callback_Number );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
768 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
769
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
770 /* Callback-Id never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
771 /* Framed-Route never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
772 /* Framed-IPX-Network never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
773
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
774 case RADIUS_ATTR_STATE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
775 CONV2DIAM_STR( State );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
776 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
777
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
778 /* Class never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
779
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
780 case RADIUS_ATTR_VENDOR_SPECIFIC:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
781 /* RFC 4005, Section 9.6 :
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
782 Systems that don't have vendor format knowledge MAY discard such
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
783 attributes without knowing a suitable translation.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
784
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
785 [conversion rule in 9.6.2]
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
786 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
787 if (attr->length >= 6) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
788 uint32_t vendor_id;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
789 uint8_t * c = (uint8_t *)(attr + 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
790
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
791 vendor_id = c[0] << 24 | c[1] << 16 | c[2] << 8 | c[3];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
792 c += 4;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
793
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
794 switch (vendor_id) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
795
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
796 /* For the vendors we KNOW they follow the VSA recommended format, we convert following the rules of RFC4005 (9.6.2) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
797 case RADIUS_VENDOR_ID_MICROSOFT : /* RFC 2548 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
798 /* other vendors ? */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
799 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
800 size_t left;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
801 struct radius_attr_vendor *vtlv;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
802
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
803 left = attr->length - 6;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
804 vtlv = (struct radius_attr_vendor *)c;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
805
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
806 while ((left >= 2) && (vtlv->vendor_length <= left)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
807 /* Search our dictionary for corresponding Vendor's AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
808 struct dict_avp_request req;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
809 struct dict_object * avp_model = NULL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
810 memset(&req, 0, sizeof(struct dict_avp_request));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
811 req.avp_vendor = vendor_id;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
812 req.avp_code = vtlv->vendor_type;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
813
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
814 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_CODE_AND_VENDOR, &req, &avp_model, 0) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
815 if (!avp_model) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
816 TRACE_DEBUG(FULL, "Unknown attribute (vendor 0x%x, code 0x%x) ignored.", req.avp_vendor, req.avp_code);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
817 } else {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
818 CHECK_FCT( fd_msg_avp_new ( avp_model, 0, &avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
819 value.os.len = vtlv->vendor_length - 2;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
820 value.os.data = (unsigned char *)(vtlv + 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
821 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
822 CHECK_FCT( fd_msg_avp_add ( *diam_fw, MSG_BRW_LAST_CHILD, avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
823 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
824 c += vtlv->vendor_length;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
825 left -= vtlv->vendor_length;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
826 vtlv = (struct radius_attr_vendor *)c;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
827 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
828 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
829 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
830
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
831 /* Other vendors we KNOw how to convert the attributes would be added here... */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
832 /* case RADIUS_VENDOR_ID_CISCO :
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
833 break; */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
834 /* case RADIUS_VENDOR_ID_IETF : (extended RADIUS attributes)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
835 break; */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
836
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
837 /* When we don't know, just discard the attribute... VSA are optional with regards to RADIUS anyway */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
838 default:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
839 /* do nothing */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
840 TRACE_DEBUG(FULL, "VSA attribute from vendor %d discarded", vendor_id);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
841
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
842 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
843 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
844 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
845
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
846 /* Session-Timeout never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
847 /* Idle-Timeout never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
848 /* Termination-Action never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
849
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
850 case RADIUS_ATTR_CALLED_STATION_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
851 CONV2DIAM_STR( Called_Station_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
852 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
853
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
854 case RADIUS_ATTR_CALLING_STATION_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
855 CONV2DIAM_STR( Calling_Station_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
856 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
857
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
858 case RADIUS_ATTR_NAS_IDENTIFIER:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
859 CONV2DIAM_STR( NAS_Identifier );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
860 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
861
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
862 /* Proxy-State is handled by echo_drop.rgwx plugin, we ignore it here */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
863
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
864 case RADIUS_ATTR_LOGIN_LAT_SERVICE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
865 CONV2DIAM_STR( Login_LAT_Service );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
866 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
867
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
868 case RADIUS_ATTR_LOGIN_LAT_NODE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
869 CONV2DIAM_STR( Login_LAT_Node );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
870 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
871
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
872 case RADIUS_ATTR_LOGIN_LAT_GROUP:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
873 CONV2DIAM_STR( Login_LAT_Group );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
874 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
875
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
876 /* Framed-AppleTalk-Link never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
877 /* Framed-AppleTalk-Network never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
878 /* Framed-AppleTalk-Zone never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
879
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
880 case RADIUS_ATTR_CHAP_CHALLENGE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
881 CONV2DIAM_STR( CHAP_Challenge );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
882 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
883
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
884 case RADIUS_ATTR_NAS_PORT_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
885 CONV2DIAM_32B( NAS_Port_Type );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
886 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
887
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
888 case RADIUS_ATTR_PORT_LIMIT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
889 CONV2DIAM_32B( Port_Limit );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
890 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
891
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
892 case RADIUS_ATTR_LOGIN_LAT_PORT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
893 CONV2DIAM_STR( Login_LAT_Port );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
894 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
895
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
896
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
897 /* RFC 3162 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
898 case RADIUS_ATTR_NAS_IPV6_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
899 CONV2DIAM_STR( NAS_IPv6_Address );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
900 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
901
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
902 case RADIUS_ATTR_FRAMED_INTERFACE_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
903 CONV2DIAM_64B( Framed_Interface_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
904 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
905
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
906 case RADIUS_ATTR_FRAMED_IPV6_PREFIX:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
907 CONV2DIAM_STR( Framed_IPv6_Prefix );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
908 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
909
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
910 case RADIUS_ATTR_LOGIN_IPV6_HOST:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
911 CONV2DIAM_STR( Login_IPv6_Host );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
912 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
913
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
914 /* Framed-IPv6-Route never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
915 /* Framed-IPv6-Pool never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
916
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
917
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
918 /* RFC 2868 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
919 /* Prepare the top-level Tunneling AVP for each tag values, as needed, and add to the Diameter message.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
920 This macro is called when an AVP is added inside the group, so we will not have empty grouped AVPs */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
921 #define AVP_TUN_PREPARE() { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
922 if (avp_tun == NULL) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
923 CHECK_MALLOC( avp_tun = calloc(sizeof(struct avp *), 32 ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
924 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
925 tag = *(uint8_t *)(attr + 1); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
926 if (tag > 0x1F) tag = 0; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
927 if (avp_tun[tag] == NULL) { \
271
411314907b43 Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 264
diff changeset
928 CHECK_FCT( fd_msg_avp_new ( cs->dict.Tunneling, 0, &avp_tun[tag] ) ); \
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
929 CHECK_FCT( fd_msg_avp_add (*diam_fw, MSG_BRW_LAST_CHILD, avp_tun[tag]));\
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
930 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
931 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
932
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
933 /* Convert an attribute to an OctetString AVP and add inside the Tunneling AVP corresponding to the tag */
271
411314907b43 Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 264
diff changeset
934 #define CONV2DIAM_TUN_STR( _dictobj_ ) { \
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
935 uint8_t tag; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
936 CHECK_PARAMS( attr->length >= 3); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
937 AVP_TUN_PREPARE(); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
938 CHECK_FCT( fd_msg_avp_new ( cs->dict._dictobj_, 0, &avp ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
939 value.os.len = attr->length - (tag ? 3 : 2); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
940 value.os.data = ((unsigned char *)(attr + 1)) + (tag ? 1 : 0); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
941 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
942 CHECK_FCT( fd_msg_avp_add ( avp_tun[tag], MSG_BRW_LAST_CHILD, avp) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
943 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
944
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
945 /* Convert an attribute to a scalar AVP and add inside the Tunneling AVP corresponding to the tag */
271
411314907b43 Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 264
diff changeset
946 #define CONV2DIAM_TUN_24B( _dictobj_ ) { \
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
947 uint8_t tag; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
948 CHECK_PARAMS( attr->length == 6); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
949 AVP_TUN_PREPARE(); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
950 CHECK_FCT( fd_msg_avp_new ( cs->dict._dictobj_, 0, &avp ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
951 { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
952 uint8_t * v = (uint8_t *)(attr + 1); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
953 value.u32 = (v[1] << 16) | (v[2] <<8) | v[3] ; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
954 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
955 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
956 CHECK_FCT( fd_msg_avp_add ( avp_tun[tag], MSG_BRW_LAST_CHILD, avp) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
957 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
958
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
959 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
960 - If the RADIUS message contains Tunnel information [RADTunnels],
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
961 the attributes or tagged groups should each be converted to a
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
962 Diameter Tunneling Grouped AVP set. If the tunnel information
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
963 contains a Tunnel-Password attribute, the RADIUS encryption
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
964 must be resolved, and the password forwarded, by using Diameter
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
965 security methods.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
966 -> If the RADIUS message does not use properly the Tag info, result is unpredictable here..
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
967 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
968 case RADIUS_ATTR_TUNNEL_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
969 CONV2DIAM_TUN_24B( Tunnel_Type );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
970 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
971
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
972 case RADIUS_ATTR_TUNNEL_MEDIUM_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
973 CONV2DIAM_TUN_24B( Tunnel_Medium_Type );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
974 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
975
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
976 case RADIUS_ATTR_TUNNEL_CLIENT_ENDPOINT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
977 CONV2DIAM_TUN_STR( Tunnel_Client_Endpoint );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
978 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
979
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
980 case RADIUS_ATTR_TUNNEL_SERVER_ENDPOINT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
981 CONV2DIAM_TUN_STR( Tunnel_Server_Endpoint );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
982 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
983
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
984 /* Tunnel-Password never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
985
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
986 case RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
987 CONV2DIAM_TUN_STR( Tunnel_Private_Group_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
988 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
989
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
990 /* Tunnel-Assignment-ID never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
991
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
992 case RADIUS_ATTR_TUNNEL_PREFERENCE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
993 CONV2DIAM_TUN_24B( Tunnel_Preference );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
994 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
995
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
996 case RADIUS_ATTR_TUNNEL_CLIENT_AUTH_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
997 CONV2DIAM_TUN_STR( Tunnel_Client_Auth_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
998 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
999
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1000 case RADIUS_ATTR_TUNNEL_SERVER_AUTH_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1001 CONV2DIAM_TUN_STR( Tunnel_Server_Auth_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1002 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1003
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1004
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1005 /* RFC 2869 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1006 case RADIUS_ATTR_ARAP_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1007 CONV2DIAM_STR( ARAP_Password );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1008 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1009
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1010 /* ARAP-Features never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1011 /* ARAP-Zone-Access never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1012
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1013 case RADIUS_ATTR_ARAP_SECURITY:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1014 CONV2DIAM_32B( ARAP_Security );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1015 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1016
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1017 case RADIUS_ATTR_ARAP_SECURITY_DATA:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1018 CONV2DIAM_STR( ARAP_Security_Data );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1019 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1020
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1021 /* Password-Retry never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1022 /* Prompt never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1023
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1024 case RADIUS_ATTR_CONNECT_INFO:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1025 CONV2DIAM_STR( Connect_Info );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1026 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1027
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1028 /* Configuration-Token never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1029 /* ARAP-Challenge-Response never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1030 /* Acct-Interim-Interval never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1031
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1032 case RADIUS_ATTR_NAS_PORT_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1033 CONV2DIAM_STR( NAS_Port_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1034 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1035
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1036 /* Framed-Pool never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1037
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1038
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1039 /* RFC 2869 / 3579 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1040 case RADIUS_ATTR_ORIGINATING_LINE_INFO:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1041 CONV2DIAM_STR( Originating_Line_Info );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1042 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1043
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1044 case RADIUS_ATTR_MESSAGE_AUTHENTICATOR:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1045 case RADIUS_ATTR_EAP_MESSAGE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1046 /* It was already handled, just remove the attribute */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1047 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1048
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1049 /* Default */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1050 default: /* unknown attribute */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1051 /* We just keep the attribute in the RADIUS message */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1052 rad_req->attr_pos[nattr_used++] = rad_req->attr_pos[idx];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1053 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1054 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1055
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1056 /* Destroy tunnel pointers (if we used it) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1057 free(avp_tun);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1058
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1059 /* Update the radius message to remove all handled attributes */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1060 rad_req->attr_used = nattr_used;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1061
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1062 /* Store the request identifier in the session (if provided) */
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1063 {
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1064 struct sess_state *st;
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1065 CHECK_MALLOC(st = malloc(sizeof(struct sess_state)));
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1066 memcpy(st->req_auth, &rad_req->hdr->authenticator[0], 16);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1067
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1068 CHECK_FCT( fd_sess_state_store( cs->sess_hdl, sess, &st ) );
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1069 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1070
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1071 return 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1072 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1073
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1074 static int auth_diam_ans( struct rgwp_config * cs, struct msg ** diam_ans, struct radius_msg ** rad_fw, struct rgw_client * cli )
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1075 {
273
bce8e5b7bf78 Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 271
diff changeset
1076 struct msg_hdr * hdr;
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1077 struct avp *avp, *next, *avp_x, *avp_y, *aoh;
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1078 struct avp_hdr *ahdr, *oh;
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1079 uint8_t buf[254]; /* to store some attributes values (with final '\0') */
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1080 size_t sz;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1081 int ta_set = 0;
296
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1082 int no_str = 0; /* indicate if an STR is required for this server */
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1083 uint8_t tuntag = 0;
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1084 struct sess_state *st;
705
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1085 int error_cause = 0;
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1086 struct session * sess;
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1087 os0_t sid = NULL;
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1088 size_t sidlen;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1089
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1090 TRACE_ENTRY("%p %p %p %p", cs, diam_ans, rad_fw, cli);
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1091 CHECK_PARAMS(cs && diam_ans && *diam_ans && rad_fw && *rad_fw);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1092
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1093 /* Retrieve the request identified which was stored in the session */
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1094 CHECK_FCT( fd_msg_sess_get(fd_g_config->cnf_dict, *diam_ans, &sess, NULL) );
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1095 if (sess) {
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1096 CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, sess, &st ) );
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1097 CHECK_FCT( fd_sess_getsid(sess, &sid, &sidlen) );
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1098 } /* else ? */
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1099
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1100 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1101 - If the Diameter Command-Code is set to AA-Answer and the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1102 Result-Code AVP is set to DIAMETER_MULTI_ROUND_AUTH, the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1103 gateway must send a RADIUS Access-Challenge. This must have
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1104 the Origin-Host, Origin-Realm, and Diameter Session-Id AVPs
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1105 encapsulated in the RADIUS State attribute, with the prefix
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1106 "Diameter/", concatenated in the above order separated with "/"
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1107 characters, in UTF-8 [UTF-8]. This is necessary to ensure that
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1108 the Translation Agent receiving the subsequent RADIUS Access-
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1109 Request will have access to the Session Identifier and be able
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1110 to set the Destination-Host to the correct value.
972
ce3cacbbccc9 Fix some typos.
Thomas Klausner <tk@giga.or.at>
parents: 928
diff changeset
1111 -> done here below
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1112
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1113 - If the Command-Code is set to AA-Answer, the Diameter Session-
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1114 Id AVP is saved in a new RADIUS Class attribute whose format
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1115 consists of the string "Diameter/" followed by the Diameter
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1116 Session Identifier. This will ensure that the subsequent
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1117 Accounting messages, which could be received by any Translation
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1118 Agent, would have access to the original Diameter Session
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1119 Identifier.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1120 -> done here but only for Access-Accept messages (Result-Code = success)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1121 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1122
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1123 /* MACROS to help in the process: convert AVP data to RADIUS attributes. */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1124 /* Control large attributes: _trunc_ = 0 => error; _trunc_ = 1 => truncate; _trunc = 2 => create several attributes */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1125 #define CONV2RAD_STR( _attr_, _data_, _len_, _trunc_) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1126 size_t __l = (size_t)(_len_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1127 size_t __off = 0; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1128 TRACE_DEBUG(FULL, "Converting AVP to "#_attr_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1129 if ((_trunc_) == 0) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1130 CHECK_PARAMS( __l <= 253 ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1131 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1132 if ((__l > 253) && (_trunc_ == 1)) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1133 TRACE_DEBUG(INFO, "[auth.rgwx] AVP truncated in "#_attr_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1134 __l = 253; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1135 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1136 do { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1137 size_t __w = (__l > 253) ? 253 : __l; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1138 CHECK_MALLOC(radius_msg_add_attr(*rad_fw, (_attr_), (_data_) + __off, __w)); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1139 __off += __w; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1140 __l -= __w; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1141 } while (__l); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1142 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1143
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1144 #define CONV2RAD_32B( _attr_, _data_) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1145 uint32_t __v = htonl((uint32_t)(_data_)); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1146 TRACE_DEBUG(FULL, "Converting AVP to "#_attr_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1147 CHECK_MALLOC(radius_msg_add_attr(*rad_fw, (_attr_), (uint8_t *)&__v, sizeof(__v))); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1148 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1149
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1150 #define CONV2RAD_64B( _attr_, _data_) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1151 uint64_t __v = htonll((uint64_t)(_data_)); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1152 TRACE_DEBUG(FULL, "Converting AVP to "#_attr_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1153 CHECK_MALLOC(radius_msg_add_attr(*rad_fw, (_attr_), (uint8_t *)&__v, sizeof(__v))); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1154 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1155
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1156 /* Search the different AVPs we handle here */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1157 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Origin_Host, &aoh) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1158 CHECK_FCT( fd_msg_avp_hdr ( aoh, &oh ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1159
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1160 /* Check the Diameter error code */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1161 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Result_Code, &avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1162 ASSERT( avp ); /* otherwise the message should have been discarded a lot earlier because of ABNF */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1163 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1164 switch (ahdr->avp_value->u32) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1165 case ER_DIAMETER_MULTI_ROUND_AUTH:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1166 (*rad_fw)->hdr->code = RADIUS_CODE_ACCESS_CHALLENGE;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1167 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1168 case ER_DIAMETER_SUCCESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1169 case ER_DIAMETER_LIMITED_SUCCESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1170 (*rad_fw)->hdr->code = RADIUS_CODE_ACCESS_ACCEPT;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1171 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1172
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1173 default:
705
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1174 /* Can we convert the value to a natural Error-Cause ? */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1175 switch (ahdr->avp_value->u32) {
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1176 case ER_DIAMETER_AVP_UNSUPPORTED:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1177 error_cause = 401; /* Unsupported Attribute */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1178 break;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1179
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1180 case ER_DIAMETER_MISSING_AVP:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1181 error_cause = 402; /* Missing Attribute */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1182 break;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1183
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1184 case ER_DIAMETER_UNABLE_TO_COMPLY:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1185 error_cause = 404; /* Invalid Request */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1186 break;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1187
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1188 case ER_DIAMETER_APPLICATION_UNSUPPORTED:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1189 error_cause = 405; /* Unsupported Service */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1190 break;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1191
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1192 case ER_DIAMETER_COMMAND_UNSUPPORTED:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1193 error_cause = 406; /* Unsupported Extension */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1194 break;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1195
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1196 case ER_DIAMETER_INVALID_AVP_VALUE:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1197 error_cause = 407; /* Invalid Attribute Value */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1198 break;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1199
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1200 case ER_DIAMETER_AVP_NOT_ALLOWED:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1201 error_cause = 501; /* Administratively Prohibited */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1202 break;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1203
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1204 case ER_DIAMETER_REALM_NOT_SERVED:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1205 case ER_DIAMETER_LOOP_DETECTED:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1206 case ER_DIAMETER_UNKNOWN_PEER:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1207 case ER_DIAMETER_UNABLE_TO_DELIVER:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1208 error_cause = 502; /* Request Not Routable (Proxy) */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1209 break;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1210
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1211 case ER_DIAMETER_UNKNOWN_SESSION_ID:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1212 error_cause = 503; /* Session Context Not Found */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1213 break;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1214
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1215 case ER_DIAMETER_TOO_BUSY:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1216 case ER_DIAMETER_OUT_OF_SPACE:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1217 error_cause = 506; /* Resources Unavailable */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1218 break;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1219
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1220 #if 0
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1221 /* remaining Diameter Result-Code & RADIUS Error-Cause */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1222 case ER_DIAMETER_REDIRECT_INDICATION:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1223 case ER_DIAMETER_INVALID_HDR_BITS:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1224 case ER_DIAMETER_INVALID_AVP_BITS:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1225 case ER_DIAMETER_AUTHENTICATION_REJECTED:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1226 case ER_ELECTION_LOST:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1227 case ER_DIAMETER_AUTHORIZATION_REJECTED:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1228 case ER_DIAMETER_RESOURCES_EXCEEDED:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1229 case ER_DIAMETER_CONTRADICTING_AVPS:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1230 case ER_DIAMETER_AVP_OCCURS_TOO_MANY_TIMES
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1231 case ER_DIAMETER_NO_COMMON_APPLICATION:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1232 case ER_DIAMETER_UNSUPPORTED_VERSION:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1233 case ER_DIAMETER_INVALID_BIT_IN_HEADER:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1234 case ER_DIAMETER_INVALID_AVP_LENGTH:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1235 case ER_DIAMETER_INVALID_MESSAGE_LENGTH:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1236 case ER_DIAMETER_INVALID_AVP_BIT_COMBO:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1237 case ER_DIAMETER_NO_COMMON_SECURITY:
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1238 error_cause = 403; /* NAS Identification Mismatch */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1239 error_cause = 504; /* Session Context Not Removable */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1240 error_cause = 505; /* Other Proxy Processing Error */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1241 error_cause = 507; /* Request Initiated */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1242 error_cause = 508; /* Multiple Session Selection Unsupported */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1243 #endif /* 0 */
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1244 }
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1245 /* In any case, the following is processed: */
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1246 (*rad_fw)->hdr->code = RADIUS_CODE_ACCESS_REJECT;
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 972
diff changeset
1247 fd_log_debug("[auth.rgwx] Received Diameter answer with error code '%d' from server '%.*s', session %.*s, translating into Access-Reject",
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1248 ahdr->avp_value->u32,
1027
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1249 (int)oh->avp_value->os.len, oh->avp_value->os.data,
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1250 (int)sidlen, sid);
680
63a57bc7dc12 Fix segfault
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 679
diff changeset
1251 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Error_Message, &avp_x) );
63a57bc7dc12 Fix segfault
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 679
diff changeset
1252 if (avp_x) {
63a57bc7dc12 Fix segfault
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 679
diff changeset
1253 CHECK_FCT( fd_msg_avp_hdr ( avp_x, &ahdr ) );
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 972
diff changeset
1254 fd_log_debug("[auth.rgwx] Error-Message content: '%.*s'",
1027
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1255 (int)ahdr->avp_value->os.len, ahdr->avp_value->os.data);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1256 }
680
63a57bc7dc12 Fix segfault
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 679
diff changeset
1257 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Error_Reporting_Host, &avp_x) );
63a57bc7dc12 Fix segfault
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 679
diff changeset
1258 if (avp_x) {
63a57bc7dc12 Fix segfault
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 679
diff changeset
1259 CHECK_FCT( fd_msg_avp_hdr ( avp_x, &ahdr ) );
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 972
diff changeset
1260 fd_log_debug("[auth.rgwx] Error-Reporting-Host: '%.*s'",
1027
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1261 (int)ahdr->avp_value->os.len, ahdr->avp_value->os.data);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1262 }
680
63a57bc7dc12 Fix segfault
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 679
diff changeset
1263 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Failed_AVP, &avp_x) );
63a57bc7dc12 Fix segfault
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 679
diff changeset
1264 if (avp_x) {
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 972
diff changeset
1265 fd_log_debug("[auth.rgwx] Failed-AVP was included in the message.");
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1266 /* Dump its content ? */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1267 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1268 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1269 /* Remove this Result-Code avp */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1270 CHECK_FCT( fd_msg_free( avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1271
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1272 /* Creation of the State or Class attribute with session information */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1273 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Origin_Realm, &avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1274 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1275
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1276 /* Now, save the session-id and eventually server info in a STATE or CLASS attribute */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1277 if ((*rad_fw)->hdr->code == RADIUS_CODE_ACCESS_CHALLENGE) {
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1278 if (sizeof(buf) < (sz = snprintf((char *)buf, sizeof(buf), "Diameter/%.*s/%.*s/%.*s",
405
ddbcd21af4e0 Fix a few warnings on 64bits arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 403
diff changeset
1279 (int)oh->avp_value->os.len, (char *)oh->avp_value->os.data,
ddbcd21af4e0 Fix a few warnings on 64bits arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 403
diff changeset
1280 (int)ahdr->avp_value->os.len, (char *)ahdr->avp_value->os.data,
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1281 (int)sidlen, (char *)sid))) {
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1282 TRACE_DEBUG(INFO, "Data truncated in State attribute: %s", buf);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1283 }
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1284 CONV2RAD_STR(RADIUS_ATTR_STATE, buf, sz, 0);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1285 }
296
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1286
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1287 if ((*rad_fw)->hdr->code == RADIUS_CODE_ACCESS_ACCEPT) {
273
bce8e5b7bf78 Added code to send an STR after a STOP accounting record in RADIUS
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 271
diff changeset
1288 /* Add the Session-Id */
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1289 if (sizeof(buf) < (sz = snprintf((char *)buf, sizeof(buf), "Diameter/%.*s",
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1290 (int)sidlen, sid))) {
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1291 TRACE_DEBUG(INFO, "Data truncated in Class attribute: %s", buf);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1292 }
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1293 CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, sz, 0);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1294 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1295
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1296 /* Unlink the Origin-Realm now; the others are unlinked at the end of this function */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1297 CHECK_FCT( fd_msg_free( avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1298
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1299 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Session_Timeout, &avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1300 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Authorization_Lifetime, &avp_x) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1301 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Re_Auth_Request_Type, &avp_y) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1302 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1303 When translating a Diameter AA-Answer (with successful result code)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1304 to RADIUS Access-Accept that contains a Session-Timeout or
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1305 Authorization-Lifetime AVP, take the following steps:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1306
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1307 - If the Diameter message contains a Session-Timeout AVP but no
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1308 Authorization-Lifetime AVP, translate it to a Session-Timeout
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1309 attribute (not a Termination-Action).
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1310 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1311 if ((avp != NULL) && (avp_x == NULL)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1312 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1313 CONV2RAD_32B( RADIUS_ATTR_SESSION_TIMEOUT, ahdr->avp_value->u32 );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1314 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1315
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1316 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1317 - If the Diameter message contains an Authorization-Lifetime AVP
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1318 but no Session-Timeout AVP, translate it to a Session-Timeout
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1319 attribute and a Termination-Action set to AA-REQUEST. (Remove
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1320 Authorization-Lifetime and Re-Auth-Request-Type.)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1321 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1322 if ((avp == NULL) && (avp_x != NULL)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1323 CHECK_FCT( fd_msg_avp_hdr ( avp_x, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1324 CONV2RAD_32B( RADIUS_ATTR_SESSION_TIMEOUT, ahdr->avp_value->u32 );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1325 CONV2RAD_32B( RADIUS_ATTR_TERMINATION_ACTION, RADIUS_TERMINATION_ACTION_RADIUS_REQUEST );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1326 ta_set = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1327 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1328
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1329 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1330 - If the Diameter message has both, the Session-Timeout must be
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1331 greater than or equal to the Authorization-Lifetime (required
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1332 by [BASE]). Translate it to a Session-Timeout value (with
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1333 value from Authorization-Lifetime AVP, the smaller one) and
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1334 with the Termination-Action set to AA-REQUEST. (Remove the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1335 Authorization-Lifetime and Re-Auth-Request-Type.)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1336 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1337 if ((avp != NULL) && (avp_x != NULL)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1338 CHECK_FCT( fd_msg_avp_hdr ( avp_x, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1339 CONV2RAD_32B( RADIUS_ATTR_SESSION_TIMEOUT, ahdr->avp_value->u32 );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1340 CONV2RAD_32B( RADIUS_ATTR_TERMINATION_ACTION, RADIUS_TERMINATION_ACTION_RADIUS_REQUEST );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1341 ta_set = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1342 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1343
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1344 /* -> Not too sure about Auth-Grace-Period... we'll just discard it for now */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1345
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1346 if (avp) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1347 CHECK_FCT( fd_msg_free( avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1348 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1349 if (avp_x) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1350 CHECK_FCT( fd_msg_free( avp_x ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1351 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1352 if (avp_y) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1353 CHECK_FCT( fd_msg_free( avp_y ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1354 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1355
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1356
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1357 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1358 - If a Proxy-State attribute was present in the RADIUS request,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1359 the same attribute is added in the response. This information
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1360 may be found in the Proxy-Info AVP group, or in a local state
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1361 table.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1362 -> handled by sub_echo_drop
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1363
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1364 - If state information regarding the RADIUS request was saved in
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1365 a Proxy-Info AVP or local state table, the RADIUS Identifier
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1366 and UDP IP Address and port number are extracted and used in
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1367 issuing the RADIUS reply.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1368 -> was saved with the full request
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1369 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1370
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1371
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1372 /* Now loop in the list of AVPs and convert those that we know how */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1373 CHECK_FCT( fd_msg_browse(*diam_ans, MSG_BRW_FIRST_CHILD, &next, NULL) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1374
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1375 while (next) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1376 int handled = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1377 avp = next;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1378 CHECK_FCT( fd_msg_browse(avp, MSG_BRW_NEXT, &next, NULL) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1379
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1380 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1381
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1382 if (!(ahdr->avp_flags & AVP_FLAG_VENDOR)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1383 switch (ahdr->avp_code) {
679
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1384 /* In case of Diameter error, include the Reply-Message attribute */
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1385 case DIAM_ATTR_ERROR_MESSAGE:
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1386 CONV2RAD_STR(RADIUS_ATTR_REPLY_MESSAGE, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 2);
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1387 break;
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1388
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1389 case DIAM_ATTR_ERROR_REPORTING_HOST:
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1390 {
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1391 char buf[254];
685
a0209539c044 Fixed compilation warning on 64b
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 680
diff changeset
1392 int bsz = snprintf(buf, sizeof(buf), "Error-Reporting-Host: %*s", (int)(ahdr->avp_value->os.len), ahdr->avp_value->os.data);
679
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1393 CONV2RAD_STR(RADIUS_ATTR_REPLY_MESSAGE, (uint8_t *)buf, bsz, 2);
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1394 }
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1395 break;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1396
679
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1397 case DIAM_ATTR_FAILED_AVP:
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1398 {
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1399 struct avp * favp;
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1400 CHECK_FCT( fd_msg_browse(avp, MSG_BRW_FIRST_CHILD, &favp, NULL) );
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1401 if (favp) {
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1402 char buf[254];
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1403 int bsz;
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1404 struct dict_object * favp_model;
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1405
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1406 CHECK_FCT( fd_msg_model(favp, &favp_model) );
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1407 if (favp_model) {
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1408 struct dict_avp_data fadata;
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1409 CHECK_FCT( fd_dict_getval(favp_model, &fadata) );
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1410 bsz = snprintf(buf, sizeof(buf), "Failed-AVP: %s", fadata.avp_name);
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1411 } else {
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1412 struct avp_hdr * favp_hdr;
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1413 CHECK_FCT( fd_msg_avp_hdr ( favp, &favp_hdr ) );
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1414 bsz = snprintf(buf, sizeof(buf), "Failed-AVP: code %u, vendor %u", favp_hdr->avp_code, favp_hdr->avp_vendor);
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1415 }
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1416 CONV2RAD_STR(RADIUS_ATTR_REPLY_MESSAGE, (uint8_t *)buf, bsz, 2);
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1417 }
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1418 }
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1419 break;
c517666b59ca Convert the errors AVP to Reply-Message also
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 678
diff changeset
1420
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1421 /* RFC 4005 (AVP in the order of the AA-Request/Answer AVP Table) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1422 case DIAM_ATTR_ACCT_INTERIM_INTERVAL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1423 CONV2RAD_32B(RADIUS_ATTR_ACCT_INTERIM_INTERVAL, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1424 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1425
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1426 case DIAM_ATTR_ARAP_CHALLENGE_RESPONSE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1427 CONV2RAD_STR(RADIUS_ATTR_ARAP_CHALLENGE_RESPONSE, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 0);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1428 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1429
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1430 case DIAM_ATTR_ARAP_FEATURES:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1431 CONV2RAD_STR(RADIUS_ATTR_ARAP_FEATURES, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 0);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1432 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1433
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1434 /* ARAP-Password is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1435
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1436 case DIAM_ATTR_ARAP_SECURITY:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1437 CONV2RAD_32B(RADIUS_ATTR_ARAP_SECURITY, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1438 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1439
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1440 case DIAM_ATTR_ARAP_SECURITY_DATA:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1441 CONV2RAD_STR(RADIUS_ATTR_ARAP_SECURITY_DATA, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 2);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1442 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1443
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1444 case DIAM_ATTR_ARAP_ZONE_ACCESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1445 CONV2RAD_32B(RADIUS_ATTR_ARAP_ZONE_ACCESS, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1446 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1447
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1448 case DIAM_ATTR_AUTH_APPLICATION_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1449 /* We just remove this AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1450 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1451
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1452 case DIAM_ATTR_AUTH_GRACE_PERIOD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1453 /* We just remove this AVP (?) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1454 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1455
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1456 case DIAM_ATTR_AUTH_REQUEST_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1457 /* We only check the value */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1458 if (ahdr->avp_value->u32 != 3) {
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 972
diff changeset
1459 fd_log_debug("[auth.rgwx] Received Diameter answer with Auth-Request-Type set to %d (%s) from server %.*s, session %.*s."
979
b90cb4c07160 Remove more newlines.
Thomas Klausner <tk@giga.or.at>
parents: 974
diff changeset
1460 " This may cause interoperability problems with RADIUS.",
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1461 ahdr->avp_value->u32,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1462 (ahdr->avp_value->u32 == 1) ? "AUTHENTICATE_ONLY" :
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1463 ((ahdr->avp_value->u32 == 2) ? "AUTHORIZE_ONLY" : "???"),
1027
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1464 (int)oh->avp_value->os.len, oh->avp_value->os.data,
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1465 (int)sidlen, sid);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1466 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1467 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1468
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1469 case DIAM_ATTR_AUTH_SESSION_STATE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1470 if ((!ta_set) && (ahdr->avp_value->u32 == ACV_ASS_STATE_MAINTAINED)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1471 CONV2RAD_32B( RADIUS_ATTR_TERMINATION_ACTION, RADIUS_TERMINATION_ACTION_RADIUS_REQUEST );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1472 }
296
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1473
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1474 if (ahdr->avp_value->u32 == ACV_ASS_NO_STATE_MAINTAINED) {
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1475 no_str = 1;
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1476 }
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1477 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1478
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1479 /* Authorization-Lifetime already handled */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1480
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1481 case DIAM_ATTR_CALLBACK_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1482 CONV2RAD_STR(RADIUS_ATTR_CALLBACK_ID, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1483 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1484
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1485 case DIAM_ATTR_CALLBACK_NUMBER:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1486 CONV2RAD_STR(RADIUS_ATTR_CALLBACK_NUMBER, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1487 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1488
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1489 /* Called-Station-Id is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1490 /* Calling-Station-Id is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1491 /* CHAP-Auth is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1492 /* CHAP-Challenge is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1493
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1494 case DIAM_ATTR_CLASS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1495 CONV2RAD_STR(RADIUS_ATTR_CLASS, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 2);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1496 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1497
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1498 case DIAM_ATTR_CONFIGURATION_TOKEN:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1499 /* We might as well remove it since it's not supposed to be sent to the NAS... */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1500 CONV2RAD_STR(RADIUS_ATTR_CONFIGURATION_TOKEN, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 2);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1501 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1502
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1503 /* Connect-Info is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1504
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1505 case DIAM_ATTR_FILTER_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1506 CONV2RAD_STR(RADIUS_ATTR_FILTER_ID, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 2);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1507 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1508
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1509 case DIAM_ATTR_FRAMED_APPLETALK_LINK:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1510 CONV2RAD_32B(RADIUS_ATTR_FRAMED_APPLETALK_LINK, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1511 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1512
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1513 case DIAM_ATTR_FRAMED_APPLETALK_NETWORK:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1514 CONV2RAD_32B(RADIUS_ATTR_FRAMED_APPLETALK_NETWORK, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1515 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1516
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1517 case DIAM_ATTR_FRAMED_APPLETALK_ZONE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1518 CONV2RAD_STR(RADIUS_ATTR_FRAMED_APPLETALK_ZONE, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1519 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1520
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1521 case DIAM_ATTR_FRAMED_COMPRESSION:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1522 CONV2RAD_32B(RADIUS_ATTR_FRAMED_COMPRESSION, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1523 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1524
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1525 case DIAM_ATTR_FRAMED_INTERFACE_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1526 CONV2RAD_64B(RADIUS_ATTR_FRAMED_INTERFACE_ID, ahdr->avp_value->u64);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1527 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1528
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1529 case DIAM_ATTR_FRAMED_IP_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1530 CONV2RAD_STR(RADIUS_ATTR_FRAMED_IP_ADDRESS, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 0);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1531 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1532
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1533 case DIAM_ATTR_FRAMED_IP_NETMASK:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1534 CONV2RAD_STR(RADIUS_ATTR_FRAMED_IP_NETMASK, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 0);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1535 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1536
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1537 case DIAM_ATTR_FRAMED_IPV6_PREFIX:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1538 CONV2RAD_STR(RADIUS_ATTR_FRAMED_IPV6_PREFIX, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 0);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1539 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1540
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1541 case DIAM_ATTR_FRAMED_IPV6_POOL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1542 CONV2RAD_STR(RADIUS_ATTR_FRAMED_IPV6_POOL, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1543 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1544
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1545 case DIAM_ATTR_FRAMED_IPV6_ROUTE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1546 CONV2RAD_STR(RADIUS_ATTR_FRAMED_IPV6_ROUTE, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1547 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1548
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1549 case DIAM_ATTR_FRAMED_IPX_NETWORK:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1550 CONV2RAD_32B(RADIUS_ATTR_FRAMED_IPX_NETWORK, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1551 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1552
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1553 case DIAM_ATTR_FRAMED_MTU:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1554 CONV2RAD_32B(RADIUS_ATTR_FRAMED_MTU, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1555 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1556
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1557 case DIAM_ATTR_FRAMED_POOL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1558 CONV2RAD_STR(RADIUS_ATTR_FRAMED_POOL, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1559 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1560
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1561 case DIAM_ATTR_FRAMED_PROTOCOL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1562 CONV2RAD_32B(RADIUS_ATTR_FRAMED_PROTOCOL, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1563 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1564
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1565 case DIAM_ATTR_FRAMED_ROUTE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1566 CONV2RAD_STR(RADIUS_ATTR_FRAMED_ROUTE, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1567 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1568
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1569 case DIAM_ATTR_FRAMED_ROUTING:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1570 CONV2RAD_32B(RADIUS_ATTR_FRAMED_ROUTING, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1571 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1572
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1573 case DIAM_ATTR_IDLE_TIMEOUT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1574 CONV2RAD_32B(RADIUS_ATTR_IDLE_TIMEOUT, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1575 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1576
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1577 case DIAM_ATTR_LOGIN_IP_HOST:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1578 CONV2RAD_STR(RADIUS_ATTR_LOGIN_IP_HOST, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 0);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1579 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1580
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1581 case DIAM_ATTR_LOGIN_IPV6_HOST:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1582 CONV2RAD_STR(RADIUS_ATTR_LOGIN_IPV6_HOST, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 0);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1583 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1584
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1585 case DIAM_ATTR_LOGIN_LAT_GROUP:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1586 CONV2RAD_STR(RADIUS_ATTR_LOGIN_LAT_GROUP, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1587 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1588
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1589 case DIAM_ATTR_LOGIN_LAT_NODE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1590 CONV2RAD_STR(RADIUS_ATTR_LOGIN_LAT_NODE, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1591 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1592
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1593 case DIAM_ATTR_LOGIN_LAT_PORT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1594 CONV2RAD_STR(RADIUS_ATTR_LOGIN_LAT_PORT, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1595 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1596
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1597 case DIAM_ATTR_LOGIN_LAT_SERVICE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1598 CONV2RAD_STR(RADIUS_ATTR_LOGIN_LAT_SERVICE, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1599 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1600
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1601 case DIAM_ATTR_LOGIN_SERVICE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1602 CONV2RAD_32B(RADIUS_ATTR_LOGIN_SERVICE, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1603 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1604
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1605 case DIAM_ATTR_LOGIN_TCP_PORT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1606 CONV2RAD_32B(RADIUS_ATTR_LOGIN_TCP_PORT, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1607 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1608
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1609 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1610 - If the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1611 Multi-Round-Time-Out AVP is present, the value of the AVP MUST
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1612 be inserted in the RADIUS Session-Timeout AVP.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1613
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1614 o As described in [NASREQ], if the Result-Code AVP set to
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1615 DIAMETER_MULTI_ROUND_AUTH and the Multi-Round-Time-Out AVP is
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1616 present, it is translated to the RADIUS Session-Timeout attribute.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1617 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1618 case DIAM_ATTR_MULTI_ROUND_TIMEOUT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1619 CONV2RAD_32B(RADIUS_ATTR_SESSION_TIMEOUT, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1620 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1621
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1622 case DIAM_ATTR_NAS_FILTER_RULE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1623 /* This is not translatable to RADIUS */
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 972
diff changeset
1624 fd_log_debug("[auth.rgwx] Received Diameter answer with non-translatable NAS-Filter-Rule AVP from '%.*s' (session: '%.*s'), ignoring.",
1027
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1625 (int)oh->avp_value->os.len, oh->avp_value->os.data,
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1626 (int)sidlen, sid);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1627 handled = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1628 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1629
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1630 /* NAS-Identifier is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1631 /* NAS-IP-Address is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1632 /* NAS-IPv6-Address is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1633 /* NAS-Port is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1634 /* NAS-Port-Id is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1635 /* NAS-Port-Type is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1636
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1637 case DIAM_ATTR_ORIGIN_AAA_PROTOCOL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1638 /* We just remove this AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1639 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1640
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1641 /* Originating-Line-Info is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1642
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1643 case DIAM_ATTR_PASSWORD_RETRY:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1644 CONV2RAD_32B(RADIUS_ATTR_PASSWORD_RETRY, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1645 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1646
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1647 case DIAM_ATTR_PORT_LIMIT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1648 CONV2RAD_32B(RADIUS_ATTR_PORT_LIMIT, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1649 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1650
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1651 case DIAM_ATTR_PROMPT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1652 CONV2RAD_32B(RADIUS_ATTR_PROMPT, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1653 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1654
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1655 case DIAM_ATTR_QOS_FILTER_RULE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1656 /* This is not translatable to RADIUS */
974
2091bf698fb1 Remove newlines from fd_log_debug, TRACE_DEBUG, TRACE_ERROR, and TRACE_DEBUG_ERROR
Thomas Klausner <tk@giga.or.at>
parents: 972
diff changeset
1657 fd_log_debug("[auth.rgwx] Received Diameter answer with non-translatable QoS-Filter-Rule AVP from '%.*s' (session: '%.*s'), ignoring.",
1027
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1658 (int)oh->avp_value->os.len, oh->avp_value->os.data,
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1659 (int)sidlen, sid);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1660 handled = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1661 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1662
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1663 /* Re-Auth-Request-Type already handled */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1664
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1665 case DIAM_ATTR_REPLY_MESSAGE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1666 CONV2RAD_STR(RADIUS_ATTR_REPLY_MESSAGE, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 2);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1667 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1668
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1669 case DIAM_ATTR_SERVICE_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1670 CONV2RAD_32B(RADIUS_ATTR_SERVICE_TYPE, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1671 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1672
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1673 case DIAM_ATTR_STATE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1674 CONV2RAD_STR(RADIUS_ATTR_STATE, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 2);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1675 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1676
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1677 case DIAM_ATTR_TUNNELING:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1678 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1679 #define CONV2RAD_TUN_STR( _attr_, _data_, _len_, _trunc_) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1680 size_t __l = (size_t)(_len_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1681 size_t __w = (__l > 252) ? 252 : __l; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1682 size_t __off = 0; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1683 if ((_trunc_) == 0) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1684 CHECK_PARAMS( __l <= 252 ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1685 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1686 if ((__l > 252) && (_trunc_ == 1)) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1687 TRACE_DEBUG(FULL, "Attribute truncated!"); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1688 __l = 252; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1689 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1690 buf[0] = tuntag; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1691 memcpy(&buf[1], (_data_), __w); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1692 CHECK_MALLOC(radius_msg_add_attr(*rad_fw, (_attr_), &buf[0], __w + 1)); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1693 while (__l -= __w) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1694 __off += __w; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1695 __w = (__l > 253) ? 253 : __l; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1696 CHECK_MALLOC(radius_msg_add_attr(*rad_fw, (_attr_), (_data_) + __off, __w)); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1697 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1698 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1699
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1700 #define CONV2RAD_TUN_32B( _attr_, _data_) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1701 uint32_t __v = htonl((uint32_t)(_data_) | (tuntag << 24)); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1702 CHECK_MALLOC(radius_msg_add_attr(*rad_fw, (_attr_), (uint8_t *)&__v, sizeof(__v))); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1703 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1704 struct avp *inavp, *innext;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1705 tuntag++;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1706 CHECK_FCT( fd_msg_browse(avp, MSG_BRW_FIRST_CHILD, &innext, NULL) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1707 while (innext) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1708 inavp = innext;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1709 CHECK_FCT( fd_msg_browse(inavp, MSG_BRW_NEXT, &innext, NULL) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1710 CHECK_FCT( fd_msg_avp_hdr ( inavp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1711
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1712 if ( ! (ahdr->avp_flags & AVP_FLAG_VENDOR)) {
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1713 switch (ahdr->avp_code) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1714 case DIAM_ATTR_TUNNEL_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1715 CONV2RAD_TUN_32B( RADIUS_ATTR_TUNNEL_TYPE, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1716 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1717
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1718 case DIAM_ATTR_TUNNEL_MEDIUM_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1719 CONV2RAD_TUN_32B( RADIUS_ATTR_TUNNEL_MEDIUM_TYPE, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1720 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1721
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1722 case DIAM_ATTR_TUNNEL_CLIENT_ENDPOINT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1723 CONV2RAD_TUN_STR(RADIUS_ATTR_TUNNEL_CLIENT_ENDPOINT, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1724 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1725
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1726 case DIAM_ATTR_TUNNEL_SERVER_ENDPOINT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1727 CONV2RAD_TUN_STR(RADIUS_ATTR_TUNNEL_SERVER_ENDPOINT, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1728 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1729
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1730 case DIAM_ATTR_TUNNEL_PREFERENCE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1731 CONV2RAD_TUN_32B( RADIUS_ATTR_TUNNEL_PREFERENCE, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1732 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1733
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1734 case DIAM_ATTR_TUNNEL_CLIENT_AUTH_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1735 CONV2RAD_TUN_STR(RADIUS_ATTR_TUNNEL_CLIENT_AUTH_ID, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1736 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1737
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1738 case DIAM_ATTR_TUNNEL_SERVER_AUTH_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1739 CONV2RAD_TUN_STR(RADIUS_ATTR_TUNNEL_SERVER_AUTH_ID, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1740 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1741
271
411314907b43 Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 264
diff changeset
1742 case DIAM_ATTR_TUNNEL_ASSIGNMENT_ID:
411314907b43 Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 264
diff changeset
1743 CONV2RAD_TUN_STR(RADIUS_ATTR_TUNNEL_ASSIGNMENT_ID, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1744 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1745
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1746 case DIAM_ATTR_TUNNEL_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1747 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1748 /* This AVP must be encoded for RADIUS (similar to radius_msg_add_attr_user_password)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1749 0 1 2 3
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1750 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1751 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1752 | Type | Length | Tag | Salt
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1753 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1754 Salt (cont) | String ...
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1755 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1756 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1757 size_t pos;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1758 int i;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1759 uint8_t * secret; /* S */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1760 size_t secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1761 uint8_t hash[16]; /* b(i) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1762 const uint8_t *addr[3];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1763 size_t len[3];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1764
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1765 /* We need the request authenticator */
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1766 CHECK_PARAMS(st);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1767
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1768 /* Retrieve the shared secret */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1769 CHECK_FCT(rgw_clients_getkey(cli, &secret, &secret_len));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1770
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1771 /* Beginning of the buffer */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1772 buf[0] = tuntag;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1773 buf[1] = (uint8_t)(lrand48()); /* A (hi bits) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1774 buf[2] = (uint8_t)(lrand48()); /* A (low bits) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1775
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1776 /* The plain text string P */
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1777 CHECK_PARAMS(ahdr->avp_value->os.len < 240);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1778 buf[3] = ahdr->avp_value->os.len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1779 memcpy(&buf[4], ahdr->avp_value->os.data, ahdr->avp_value->os.len);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1780 memset(&buf[4 + ahdr->avp_value->os.len], 0, sizeof(buf) - 4 - ahdr->avp_value->os.len);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1781
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1782 /* Initial b1 = MD5(S + R + A) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1783 addr[0] = secret;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1784 len[0] = secret_len;
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1785 addr[1] = st->req_auth;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1786 len[1] = 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1787 addr[2] = &buf[1];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1788 len[2] = 2;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1789 md5_vector(3, addr, len, hash);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1790
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1791 /* Initial c(1) = p(1) xor b(1) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1792 for (i = 0; i < 16; i++) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1793 buf[i + 3] ^= hash[i];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1794 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1795 pos = 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1796
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1797 /* loop */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1798 while (pos < ahdr->avp_value->os.len + 1) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1799 addr[0] = secret;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1800 len[0] = secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1801 addr[1] = &buf[pos - 13];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1802 len[1] = 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1803 /* b(i) = MD5( S + c(i-1) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1804 md5_vector(2, addr, len, hash);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1805
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1806 /* c(i) = p(i) xor b(i) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1807 for (i = 0; i < 16; i++)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1808 buf[pos + i + 3] ^= hash[i];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1809
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1810 pos += 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1811 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1812
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1813 CONV2RAD_STR(RADIUS_ATTR_TUNNEL_PASSWORD, &buf[0], pos + 3, 0);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1814 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1815 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1816
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1817 case DIAM_ATTR_TUNNEL_PRIVATE_GROUP_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1818 CONV2RAD_TUN_STR(RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1819 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1820
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1821 default:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1822 TRACE_DEBUG(FULL, "Ignored unknown AVP inside Tunneling AVP (%d)", ahdr->avp_code);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1823 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1824 } else {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1825 TRACE_DEBUG(FULL, "Ignored unknown Vendor AVP inside Tunneling AVP (%d, %d)", ahdr->avp_vendor, ahdr->avp_code);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1826 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1827 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1828 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1829 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1830
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1831 case DIAM_ATTR_USER_NAME:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1832 CONV2RAD_STR(RADIUS_ATTR_USER_NAME, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1833 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1834
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1835 /* User-Password never present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1836
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1837 /* RFC 4072 (AVP in the order of the EAP Command AVP Table) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1838 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1839 o Diameter Accounting-EAP-Auth-Method AVPs, if present, are
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1840 discarded.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1841 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1842 case DIAM_ATTR_ACCOUNTING_EAP_AUTH_METHOD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1843 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1844
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1845 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1846 o Diameter EAP-Master-Session-Key AVP can be translated to the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1847 vendor-specific RADIUS MS-MPPE-Recv-Key and MS-MPPE-Send-Key
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1848 attributes [RFC2548]. The first up to 32 octets of the key is
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1849 stored into MS-MPPE-Recv-Key, and the next up to 32 octets (if
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1850 present) are stored into MS-MPPE-Send-Key. The encryption of this
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1851 attribute is described in [RFC2548].
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1852 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1853 case DIAM_ATTR_EAP_MASTER_SESSION_KEY:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1854 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1855 uint8_t * secret; /* S */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1856 size_t secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1857 size_t recv_len, send_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1858
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1859 /* We need the request authenticator */
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1860 CHECK_PARAMS(st);
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1861
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1862 /* Retrieve the shared secret */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1863 CHECK_FCT(rgw_clients_getkey(cli, &secret, &secret_len));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1864
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1865 if (ahdr->avp_value->os.len != 64) {
1027
0117a7746b21 Fix a number of errors and warnings introduced/highlighted by recent commits
Sebastien Decugis <sdecugis@freediameter.net>
parents: 996
diff changeset
1866 TRACE_DEBUG(INFO, "Received EAP-Master-Session-Key attribute with length %zd != 64.", ahdr->avp_value->os.len)
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1867 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1868
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1869 CHECK_PARAMS(ahdr->avp_value->os.len <= 64);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1870 recv_len = ahdr->avp_value->os.len >= 32 ? 32 : ahdr->avp_value->os.len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1871 send_len = ahdr->avp_value->os.len - recv_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1872
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1873 if ( ! radius_msg_add_mppe_keys(*rad_fw, st->req_auth, secret, secret_len,
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1874 ahdr->avp_value->os.data + recv_len, send_len,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1875 ahdr->avp_value->os.data, recv_len) ) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1876 TRACE_DEBUG(INFO, "Error while converting EAP-Master-Session-Key to RADIUS message");
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1877 return ENOMEM;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1878 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1879 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1880 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1881
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1882 case DIAM_ATTR_EAP_KEY_NAME:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1883 CONV2RAD_STR(RADIUS_ATTR_EAP_KEY_NAME, ahdr->avp_value->os.data, ahdr->avp_value->os.len, 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1884 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1885
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1886 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1887 o Diameter EAP-Payload AVP is translated to RADIUS EAP-Message
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1888 attribute(s). If necessary, the value is split into multiple
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1889 RADIUS EAP-Message attributes.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1890 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1891 case DIAM_ATTR_EAP_PAYLOAD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1892 if ( ! radius_msg_add_eap(*rad_fw, ahdr->avp_value->os.data, ahdr->avp_value->os.len) ) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1893 TRACE_DEBUG(INFO, "Error while converting EAP payload to RADIUS message");
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1894 return ENOMEM;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1895 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1896 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1897
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1898 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1899 o Diameter EAP-Reissued-Payload AVP is translated to a message that
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1900 contains RADIUS EAP-Message attribute(s), and a RADIUS Error-Cause
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1901 attribute [RFC3576] with value 202 (decimal), "Invalid EAP Packet
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1902 (Ignored)" [RFC3579].
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1903 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1904 case DIAM_ATTR_EAP_REISSUED_PAYLOAD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1905 if ( ! radius_msg_add_eap(*rad_fw, ahdr->avp_value->os.data, ahdr->avp_value->os.len) ) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1906 TRACE_DEBUG(INFO, "Error while converting EAP reissued payload to RADIUS message");
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1907 return ENOMEM;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1908 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1909
705
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1910 error_cause = 202; /* Invalid EAP Packet */
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1911 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1912
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1913 default:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1914 /* Leave the AVP in the message for further treatment */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1915 handled = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1916 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1917 } else {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1918 /* Vendor-specific AVPs */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1919 switch (ahdr->avp_vendor) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1920
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1921 default: /* unknown vendor */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1922 handled = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1923 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1924 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1925
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1926 if (handled) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1927 CHECK_FCT( fd_msg_free( avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1928 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1929 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1930
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1931 CHECK_FCT( fd_msg_free( aoh ) );
1088
1d1a20a0779d Second part of changeset 1083, now the code compiles again. Still missing some functions implementation, though
Sebastien Decugis <sdecugis@freediameter.net>
parents: 1027
diff changeset
1932 free(st);
705
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1933
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1934 if (error_cause) {
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1935 if ( ! radius_msg_add_attr_int32(*rad_fw, RADIUS_ATTR_ERROR_CAUSE, error_cause) ) {
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1936 TRACE_DEBUG(INFO, "Error while adding Error-Cause attribute in RADIUS message");
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1937 return ENOMEM;
f0cb8f465763 Added standard Result-Code values in header.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 703
diff changeset
1938 }
996
cf09fde3d7f5 Fix management of sessions in app_radgw: sessions are simply associated with messages, that is sufficient
Sebastien Decugis <sdecugis@freediameter.net>
parents: 979
diff changeset
1939 }
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1940
296
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1941 if ((*rad_fw)->hdr->code == RADIUS_CODE_ACCESS_ACCEPT) {
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1942 /* Add the auth-application-id required for STR, or 0 if no STR is required */
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1943 CHECK_FCT( fd_msg_hdr( *diam_ans, &hdr ) );
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1944 if (sizeof(buf) < (sz = snprintf((char *)buf, sizeof(buf), CLASS_AAI_PREFIX "%u",
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1945 no_str ? 0 : hdr->msg_appl))) {
296
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1946 TRACE_DEBUG(INFO, "Data truncated in Class attribute: %s", buf);
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1947 }
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 388
diff changeset
1948 CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, sz, 0);
296
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1949 }
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1950
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1951 return 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1952 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1953
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1954 /* The exported symbol */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1955 struct rgw_api rgwp_descriptor = {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1956 .rgwp_name = "auth",
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1957 .rgwp_conf_parse = auth_conf_parse,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1958 .rgwp_conf_free = auth_conf_free,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1959 .rgwp_rad_req = auth_rad_req,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1960 .rgwp_diam_ans = auth_diam_ans
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1961 };
"Welcome to our mercurial repository"