annotate extensions/app_radgw/rgwx_auth.c @ 296:e11a9f90a65a

Do not send STR if the auth server sent NO_STATE_MAINTAINED
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 10 May 2010 16:04:42 +0900
parents bce8e5b7bf78
children e203fc0c95e3
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) *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
3 * Author: Sebastien Decugis <sdecugis@nict.go.jp> *
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
4 * *
258
5df55136361b Updated copyright information
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 256
diff changeset
5 * Copyright (c) 2010, 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 #define ER_DIAMETER_MULTI_ROUND_AUTH 1001
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
54 #define ER_DIAMETER_LIMITED_SUCCESS 2002
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
55
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
56 /* The state we keep for this plugin */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
57 struct rgwp_config {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
58 struct {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
59 struct dict_object * ARAP_Password; /* ARAP-Password */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
60 struct dict_object * ARAP_Security; /* ARAP-Security */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
61 struct dict_object * ARAP_Security_Data; /* ARAP-Security-Data */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
62 struct dict_object * Auth_Application_Id; /* Auth-Application-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
63 struct dict_object * Auth_Request_Type; /* Auth-Request-Type */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
64 struct dict_object * Authorization_Lifetime; /* Authorization-Lifetime */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
65 struct dict_object * Callback_Number; /* Callback-Number */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
66 struct dict_object * Called_Station_Id; /* Called-Station-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
67 struct dict_object * Calling_Station_Id; /* Calling-Station-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
68 struct dict_object * CHAP_Algorithm; /* CHAP-Algorithm */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
69 struct dict_object * CHAP_Auth; /* CHAP-Auth */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
70 struct dict_object * CHAP_Challenge; /* CHAP-Challenge */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
71 struct dict_object * CHAP_Ident; /* CHAP-Ident */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
72 struct dict_object * CHAP_Response; /* CHAP-Response */
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;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
123 };
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
124
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
125 /* Initialize the plugin */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
126 static int auth_conf_parse(char * conffile, struct rgwp_config ** state)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
127 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
128 struct rgwp_config * new;
264
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
129 struct dict_object * app;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
130
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
131 TRACE_ENTRY("%p %p", conffile, state);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
132 CHECK_PARAMS( state );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
133
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
134 CHECK_MALLOC( new = malloc(sizeof(struct rgwp_config)) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
135 memset(new, 0, sizeof(struct rgwp_config));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
136
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
137 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
138 new->confstr = conffile;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
139
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
140 /* Resolve all dictionary objects we use */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
141 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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149 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
150 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
151 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
152 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
153 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
154 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
155 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Connect-Info", &new->dict.Connect_Info, 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, "EAP-Payload", &new->dict.EAP_Payload, 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, "Error-Message", &new->dict.Error_Message, 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, "Error-Reporting-Host", &new->dict.Error_Reporting_Host, 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, "Failed-AVP", &new->dict.Failed_AVP, 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, "Framed-Compression", &new->dict.Framed_Compression, 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, "Framed-IP-Address", &new->dict.Framed_IP_Address, 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, "Framed-IP-Netmask", &new->dict.Framed_IP_Netmask, 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, "Framed-Interface-Id", &new->dict.Framed_Interface_Id, 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, "Framed-IPv6-Prefix", &new->dict.Framed_IPv6_Prefix, 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, "Framed-MTU", &new->dict.Framed_MTU, ENOENT) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
166 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
167 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
168 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
169 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
170 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
171 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
172 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
173 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
174 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
175 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
176 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
177 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
178 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
179 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
180 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
181 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
182 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
183 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
184 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
185 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
186 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
187 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
188 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
189 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
190 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
191 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
192 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
193 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
194 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
195 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
196 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
197 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
198 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
199 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
200 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
201
264
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
202 /* 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
203 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
204 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
205
a3b2cde34f7b Advertize support for translated applications
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 262
diff changeset
206 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
207 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
208
262
cc2c568ef319 Missing affectation
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
209 *state = new;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
210 return 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
211 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
212
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
213 /* deinitialize */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
214 static void auth_conf_free(struct rgwp_config * state)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
215 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
216 TRACE_ENTRY("%p", state);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
217 CHECK_PARAMS_DO( state, return );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
218 CHECK_FCT_DO( fd_sess_handler_destroy( &state->sess_hdl ), );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
219 free(state);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
220 return;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
221 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
222
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
223 /* Handle an incoming RADIUS request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
224 static int auth_rad_req( struct rgwp_config * cs, struct session * session, struct radius_msg * rad_req, struct radius_msg ** rad_ans, struct msg ** diam_fw, struct rgw_client * cli )
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
225 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
226 int idx;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
227 int got_id = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
228 int got_mac = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
229 int got_passwd = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
230 int got_eap = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
231 int got_empty_eap = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
232 uint32_t status_type;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
233 size_t nattr_used = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
234 struct avp ** avp_tun = NULL, *avp = NULL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
235 union avp_value value;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
236
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
237 TRACE_ENTRY("%p %p %p %p %p %p", cs, session, rad_req, rad_ans, diam_fw, cli);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
238 CHECK_PARAMS(rad_req && (rad_req->hdr->code == RADIUS_CODE_ACCESS_REQUEST) && rad_ans && diam_fw && *diam_fw);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
239
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
240 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
241 Guidelines:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
242 http://tools.ietf.org/html/rfc4005#section-9.1
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
243 http://tools.ietf.org/html/rfc4072#section-6.1
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
244
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
245 When a Translation Agent receives a RADIUS message, the following
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
246 steps should be taken:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
247
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
248 - If a Message-Authenticator attribute is present, the value MUST
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
249 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
250 incorrect, the RADIUS message should be silently discarded.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
251 The gateway system SHOULD generate and include a Message-
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
252 Authenticator in returned RADIUS responses.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
253 -> done in rgw_msg_auth_check
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
254
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
255 - 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
256 NAS identifying attributes. See the description of NAS-
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
257 Identifier and NAS-IP-Address below.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
258 -> done in rgw_clients_check_origin
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
259
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
260 - The Translation Agent must maintain transaction state
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
261 information relevant to the RADIUS request, such as the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
262 Identifier field in the RADIUS header, any existing RADIUS
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
263 Proxy-State attribute, and the source IP address and port
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
264 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
265 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
266 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
267 mapping mechanism.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
268 -> Identifier, source and port are saved along with the request,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
269 and associated with the session state.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
270 -> 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
271
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
272 - If the RADIUS request contained a State attribute and the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
273 prefix of the data is "Diameter/", the data following the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
274 prefix contains the Diameter Origin-Host/Origin-Realm/Session-
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
275 Id. If no such attributes are present and the RADIUS command
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
276 is an Access-Request, a new Session-Id is created. The
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
277 Session-Id is included in the Session-Id AVP.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
278 -> done in rgw_msg_create_base.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
279
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
280 - 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
281 and added by using the information from an FQDN corresponding
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
282 to the NAS-IP-Address attribute (preferred if available),
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
283 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
284 NAS-Identifier is not required to be an FQDN.)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
285 -> done in rgw_msg_create_base.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
286
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
287 - The response MUST have an Origin-AAA-Protocol AVP added,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
288 indicating the protocol of origin of the message.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
289 -> what "response" ??? Added to the AAR / DER in this function.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
290
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
291 - 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
292 identity specified in the Proxy-Host AVP. This should ensure
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
293 that the response is returned to this system.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
294 -> 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
295
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
296 For EAP:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
297
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
298 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
299 EAP-Payload AVP. If multiple RADIUS EAP-Message attributes are
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
300 present, they are concatenated and translated to a single Diameter
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
301 EAP-Payload AVP.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
302 -> concatenation done by radius_msg_get_eap
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
303
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
304 -> the remaining is specific conversion rules
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
305 */
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 /* Check basic information is there */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
308 for (idx = 0; idx < rad_req->attr_used; idx++) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
309 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
310 switch (attr->type) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
311 case RADIUS_ATTR_NAS_IP_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
312 case RADIUS_ATTR_NAS_IDENTIFIER:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
313 case RADIUS_ATTR_NAS_IPV6_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
314 got_id = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
315 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
316 case RADIUS_ATTR_MESSAGE_AUTHENTICATOR:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
317 got_mac = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
318 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
319 case RADIUS_ATTR_EAP_MESSAGE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
320 got_eap = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
321 if (attr->length == 2)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
322 got_empty_eap = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
323 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
324 case RADIUS_ATTR_USER_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
325 case RADIUS_ATTR_CHAP_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
326 case RADIUS_ATTR_ARAP_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
327 got_passwd += 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
328 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
329 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
330 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
331 if (!got_id) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
332 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
333 return EINVAL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
334 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
335 /* [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
336 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
337 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
338 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
339 Message-Authenticator. If any packet type contains an EAP-Message
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
340 attribute it MUST also contain a Message-Authenticator. A RADIUS
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
341 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
342 attributes and also not containing a Message-Authenticator attribute
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
343 SHOULD silently discard it. */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
344 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
345 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
346 return EINVAL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
347 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
348
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
349 /* Add the appropriate command code & Auth-Application-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
350 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
351 struct msg_hdr * header = NULL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
352 CHECK_FCT( fd_msg_hdr ( *diam_fw, &header ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
353 header->msg_flags = CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
354 if (got_eap) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
355 header->msg_code = CC_DIAMETER_EAP;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
356 header->msg_appl = AI_EAP;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
357 } else {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
358 header->msg_code = CC_AA;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
359 header->msg_appl = AI_NASREQ;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
360 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
361
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
362 /* Add the Auth-Application-Id */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
363 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
364 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
365 value.i32 = header->msg_appl;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
366 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
367 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
368 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
369 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
370
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
371 /* 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
372 [BASE]. The recommended value for most RADIUS interoperabily
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
373 situations is AUTHORIZE_AUTHENTICATE. */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
374
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
375 /* Add Auth-Request-Type AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
376 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
377 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
378 value.i32 = ACV_ART_AUTHORIZE_AUTHENTICATE;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
379 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
380 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
381 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
382
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
383 /* Add Origin-AAA-Protocol AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
384 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
385 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
386 value.i32 = ACV_OAP_RADIUS;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
387 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
388 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
389 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
390
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
391 /* Convert the EAP payload (concat RADIUS attributes) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
392 if (got_eap) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
393 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
394
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
395 /* 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
396 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
397 if (got_empty_eap) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
398 value.os.len = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
399 value.os.data = "";
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
400 } else {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
401 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
402 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
403
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
404 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
405 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
406 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
407
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
408 /* Tunnel AVPs need some preparation */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
409 /* Convert the attributes one by one */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
410 for (idx = 0; idx < rad_req->attr_used; idx++) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
411 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
412
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
413 switch (attr->type) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
414
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
415 /* 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
416 #define CONV2DIAM_STR( _dictobj_ ) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
417 CHECK_PARAMS( attr->length >= 2 ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
418 /* Create the AVP with the specified dictionary model */ \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
419 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
420 value.os.len = attr->length - 2; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
421 value.os.data = (unsigned char *)(attr + 1); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
422 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
423 /* Add the AVP in the Diameter message. */ \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
424 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
425
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
426 /* Same thing, for scalar AVPs of 32 bits */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
427 #define CONV2DIAM_32B( _dictobj_ ) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
428 CHECK_PARAMS( attr->length == 6 ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
429 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
430 { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
431 uint8_t * v = (uint8_t *)(attr + 1); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
432 value.u32 = (v[0] << 24) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
433 | (v[1] << 16) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
434 | (v[2] << 8) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
435 | v[3] ; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
436 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
437 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
438 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
439
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
440 /* And the 64b version */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
441 #define CONV2DIAM_64B( _dictobj_ ) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
442 CHECK_PARAMS( attr->length == 10); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
443 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
444 { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
445 uint8_t * v = (uint8_t *)(attr + 1); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
446 value.u64 = ((uint64_t)(v[0]) << 56) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
447 | ((uint64_t)(v[1]) << 48) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
448 | ((uint64_t)(v[2]) << 40) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
449 | ((uint64_t)(v[3]) << 32) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
450 | ((uint64_t)(v[4]) << 24) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
451 | ((uint64_t)(v[5]) << 16) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
452 | ((uint64_t)(v[6]) << 8) \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
453 | (uint64_t)(v[7]) ; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
454 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
455 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
456 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
457
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
458 /* RFC 2865 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
459 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
460 - The Destination-Realm AVP is created from the information found
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
461 in the RADIUS User-Name attribute.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
462 -> done in rgw_msg_create_base
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
463 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
464 case RADIUS_ATTR_USER_NAME:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
465 CONV2DIAM_STR( User_Name );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
466 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
467
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
468 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
469 - If the RADIUS User-Password attribute is present, the password
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
470 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
471 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
472 using Diameter security.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
473 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
474 case RADIUS_ATTR_USER_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
475 if ((attr->length - 2) % 16) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
476 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
477 return EINVAL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
478 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
479 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
480 /* Decipher following this logic (refers to rfc2865#section-5.2 )
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
481 b1 = MD5(S + RA) p1 = c(1) xor b1
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
482 b2 = MD5(S + c(1)) p2 = c(2) xor b2
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
483 ...
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
484 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
485
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
486 uint8_t *ciph = (uint8_t *)(attr+1); /* c(i) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
487 size_t ciph_len = attr->length - 2;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
488 uint8_t deciph[128]; /* pi */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
489 size_t deciph_len = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
490 uint8_t * secret; /* S */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
491 size_t secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
492 uint8_t hash[16]; /* b(i) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
493 const uint8_t *addr[2];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
494 size_t len[2];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
495
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
496 /* Retrieve the shared secret */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
497 CHECK_FCT(rgw_clients_getkey(cli, &secret, &secret_len));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
498
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
499 /* Initial b1 = MD5(S + RA) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
500 addr[0] = secret;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
501 len[0] = secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
502 addr[1] = rad_req->hdr->authenticator;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
503 len[1] = 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
504 md5_vector(2, addr, len, hash);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
505
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
506 /* loop */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
507 while (deciph_len < ciph_len) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
508 int i;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
509 /* pi = c(i) xor bi */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
510 for (i = 0; i < 16; i++)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
511 deciph[deciph_len + i] = ciph[deciph_len + i] ^ hash[i];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
512 /* do we have to remove the padding '\0's ? */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
513
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
514 /* b(i+1) = MD5(S + c(i) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
515 addr[1] = ciph + deciph_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
516 md5_vector(2, addr, len, hash);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
517
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
518 deciph_len += 16;
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
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
521 /* Now save this value in the AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
522 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
523 value.os.data = &deciph[0];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
524 value.os.len = deciph_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
525 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
526 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
527 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
528 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
529
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
530
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
531 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
532 - 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
533 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
534 grouped AVP.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
535 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
536 case RADIUS_ATTR_CHAP_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
537 CHECK_PARAMS( attr->length == 19 /* RFC 2865 */);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
538 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
539 uint8_t * c = (uint8_t *)(attr + 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
540 struct avp * chap_auth;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
541 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
542 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
543
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
544 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
545 value.u32 = 5; /* The only value defined currently... */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
546 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
547 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
548
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
549 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
550 value.os.data = c;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
551 value.os.len = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
552 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
553 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
554
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
555 c++;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
556
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
557 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
558 value.os.data = c;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
559 value.os.len = attr->length - 3;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
560 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
561 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
562 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
563 break;
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 case RADIUS_ATTR_NAS_IP_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
566 CONV2DIAM_STR( NAS_IP_Address );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
567 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
568
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
569 case RADIUS_ATTR_NAS_PORT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
570 CONV2DIAM_32B( NAS_Port );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
571 break;
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 case RADIUS_ATTR_SERVICE_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
574 CONV2DIAM_32B( Service_Type );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
575 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
576
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
577 case RADIUS_ATTR_FRAMED_PROTOCOL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
578 CONV2DIAM_32B( Framed_Protocol );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
579 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
580
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
581 case RADIUS_ATTR_FRAMED_IP_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
582 CONV2DIAM_STR( Framed_IP_Address );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
583 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
584
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
585 case RADIUS_ATTR_FRAMED_IP_NETMASK:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
586 CONV2DIAM_STR( Framed_IP_Netmask );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
587 break;
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 /* Framed-Routing never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
590 /* Filter-Id never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
591
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
592 case RADIUS_ATTR_FRAMED_MTU:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
593 CONV2DIAM_32B( Framed_MTU );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
594 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
595
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
596 case RADIUS_ATTR_FRAMED_COMPRESSION:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
597 CONV2DIAM_32B( Framed_Compression );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
598 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
599
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
600 case RADIUS_ATTR_LOGIN_IP_HOST:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
601 CONV2DIAM_STR( Login_IP_Host );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
602 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
603
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
604 /* Login-Service never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
605 /* Login-TCP-Port never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
606 /* Reply-Message never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
607
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
608 case RADIUS_ATTR_CALLBACK_NUMBER:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
609 CONV2DIAM_STR( Callback_Number );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
610 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
611
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
612 /* Callback-Id never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
613 /* Framed-Route never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
614 /* Framed-IPX-Network never present in an Access-Request */
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 case RADIUS_ATTR_STATE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
617 CONV2DIAM_STR( State );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
618 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
619
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
620 /* Class never present in an Access-Request */
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_VENDOR_SPECIFIC:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
623 /* RFC 4005, Section 9.6 :
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
624 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
625 attributes without knowing a suitable translation.
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 [conversion rule in 9.6.2]
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
628 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
629 if (attr->length >= 6) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
630 uint32_t vendor_id;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
631 uint8_t * c = (uint8_t *)(attr + 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
632
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
633 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
634 c += 4;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
635
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
636 switch (vendor_id) {
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 /* 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
639 case RADIUS_VENDOR_ID_MICROSOFT : /* RFC 2548 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
640 /* other vendors ? */
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 size_t left;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
643 struct radius_attr_vendor *vtlv;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
644
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
645 left = attr->length - 6;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
646 vtlv = (struct radius_attr_vendor *)c;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
647
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
648 while ((left >= 2) && (vtlv->vendor_length <= left)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
649 /* Search our dictionary for corresponding Vendor's AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
650 struct dict_avp_request req;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
651 struct dict_object * avp_model = NULL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
652 memset(&req, 0, sizeof(struct dict_avp_request));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
653 req.avp_vendor = vendor_id;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
654 req.avp_code = vtlv->vendor_type;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
655
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
656 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
657 if (!avp_model) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
658 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
659 } else {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
660 CHECK_FCT( fd_msg_avp_new ( avp_model, 0, &avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
661 value.os.len = vtlv->vendor_length - 2;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
662 value.os.data = (unsigned char *)(vtlv + 1);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
663 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
664 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
665 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
666 c += vtlv->vendor_length;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
667 left -= vtlv->vendor_length;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
668 vtlv = (struct radius_attr_vendor *)c;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
669 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
670 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
671 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
672
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
673 /* 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
674 /* case RADIUS_VENDOR_ID_CISCO :
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
675 break; */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
676 /* case RADIUS_VENDOR_ID_IETF : (extended RADIUS attributes)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
677 break; */
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 /* 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
680 default:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
681 /* do nothing */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
682 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
683
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
684 }
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 /* Session-Timeout never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
689 /* Idle-Timeout never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
690 /* Termination-Action never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
691
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
692 case RADIUS_ATTR_CALLED_STATION_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
693 CONV2DIAM_STR( Called_Station_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
694 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
695
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
696 case RADIUS_ATTR_CALLING_STATION_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
697 CONV2DIAM_STR( Calling_Station_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
698 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
699
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
700 case RADIUS_ATTR_NAS_IDENTIFIER:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
701 CONV2DIAM_STR( NAS_Identifier );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
702 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
703
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
704 /* 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
705
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
706 case RADIUS_ATTR_LOGIN_LAT_SERVICE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
707 CONV2DIAM_STR( Login_LAT_Service );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
708 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
709
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
710 case RADIUS_ATTR_LOGIN_LAT_NODE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
711 CONV2DIAM_STR( Login_LAT_Node );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
712 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
713
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
714 case RADIUS_ATTR_LOGIN_LAT_GROUP:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
715 CONV2DIAM_STR( Login_LAT_Group );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
716 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
717
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
718 /* Framed-AppleTalk-Link never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
719 /* Framed-AppleTalk-Network never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
720 /* Framed-AppleTalk-Zone never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
721
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
722 case RADIUS_ATTR_CHAP_CHALLENGE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
723 CONV2DIAM_STR( CHAP_Challenge );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
724 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
725
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
726 case RADIUS_ATTR_NAS_PORT_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
727 CONV2DIAM_32B( NAS_Port_Type );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
728 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
729
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
730 case RADIUS_ATTR_PORT_LIMIT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
731 CONV2DIAM_32B( Port_Limit );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
732 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
733
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
734 case RADIUS_ATTR_LOGIN_LAT_PORT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
735 CONV2DIAM_STR( Login_LAT_Port );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
736 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
737
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 /* RFC 3162 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
740 case RADIUS_ATTR_NAS_IPV6_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
741 CONV2DIAM_STR( NAS_IPv6_Address );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
742 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
743
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
744 case RADIUS_ATTR_FRAMED_INTERFACE_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
745 CONV2DIAM_64B( Framed_Interface_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
746 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
747
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
748 case RADIUS_ATTR_FRAMED_IPV6_PREFIX:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
749 CONV2DIAM_STR( Framed_IPv6_Prefix );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
750 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
751
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
752 case RADIUS_ATTR_LOGIN_IPV6_HOST:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
753 CONV2DIAM_STR( Login_IPv6_Host );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
754 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
755
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
756 /* Framed-IPv6-Route never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
757 /* Framed-IPv6-Pool never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
758
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
759
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
760 /* RFC 2868 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
761 /* 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
762 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
763 #define AVP_TUN_PREPARE() { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
764 if (avp_tun == NULL) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
765 CHECK_MALLOC( avp_tun = calloc(sizeof(struct avp *), 32 ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
766 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
767 tag = *(uint8_t *)(attr + 1); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
768 if (tag > 0x1F) tag = 0; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
769 if (avp_tun[tag] == NULL) { \
271
411314907b43 Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 264
diff changeset
770 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
771 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
772 } \
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
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
775 /* 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
776 #define CONV2DIAM_TUN_STR( _dictobj_ ) { \
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
777 uint8_t tag; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
778 CHECK_PARAMS( attr->length >= 3); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
779 AVP_TUN_PREPARE(); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
780 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
781 value.os.len = attr->length - (tag ? 3 : 2); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
782 value.os.data = ((unsigned char *)(attr + 1)) + (tag ? 1 : 0); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
783 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
784 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
785 }
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 /* 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
788 #define CONV2DIAM_TUN_24B( _dictobj_ ) { \
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
789 uint8_t tag; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
790 CHECK_PARAMS( attr->length == 6); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
791 AVP_TUN_PREPARE(); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
792 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
793 { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
794 uint8_t * v = (uint8_t *)(attr + 1); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
795 value.u32 = (v[1] << 16) | (v[2] <<8) | v[3] ; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
796 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
797 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
798 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
799 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
800
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
801 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
802 - If the RADIUS message contains Tunnel information [RADTunnels],
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
803 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
804 Diameter Tunneling Grouped AVP set. If the tunnel information
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
805 contains a Tunnel-Password attribute, the RADIUS encryption
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
806 must be resolved, and the password forwarded, by using Diameter
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
807 security methods.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
808 -> 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
809 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
810 case RADIUS_ATTR_TUNNEL_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
811 CONV2DIAM_TUN_24B( Tunnel_Type );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
812 break;
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 case RADIUS_ATTR_TUNNEL_MEDIUM_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
815 CONV2DIAM_TUN_24B( Tunnel_Medium_Type );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
816 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
817
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
818 case RADIUS_ATTR_TUNNEL_CLIENT_ENDPOINT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
819 CONV2DIAM_TUN_STR( Tunnel_Client_Endpoint );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
820 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
821
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
822 case RADIUS_ATTR_TUNNEL_SERVER_ENDPOINT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
823 CONV2DIAM_TUN_STR( Tunnel_Server_Endpoint );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
824 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
825
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
826 /* Tunnel-Password never present in an Access-Request */
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 case RADIUS_ATTR_TUNNEL_PRIVATE_GROUP_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
829 CONV2DIAM_TUN_STR( Tunnel_Private_Group_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
830 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
831
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
832 /* Tunnel-Assignment-ID never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
833
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
834 case RADIUS_ATTR_TUNNEL_PREFERENCE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
835 CONV2DIAM_TUN_24B( Tunnel_Preference );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
836 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
837
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
838 case RADIUS_ATTR_TUNNEL_CLIENT_AUTH_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
839 CONV2DIAM_TUN_STR( Tunnel_Client_Auth_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
840 break;
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 case RADIUS_ATTR_TUNNEL_SERVER_AUTH_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
843 CONV2DIAM_TUN_STR( Tunnel_Server_Auth_Id );
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
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
847 /* RFC 2869 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
848 case RADIUS_ATTR_ARAP_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
849 CONV2DIAM_STR( ARAP_Password );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
850 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
851
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
852 /* ARAP-Features never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
853 /* ARAP-Zone-Access never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
854
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
855 case RADIUS_ATTR_ARAP_SECURITY:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
856 CONV2DIAM_32B( ARAP_Security );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
857 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
858
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
859 case RADIUS_ATTR_ARAP_SECURITY_DATA:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
860 CONV2DIAM_STR( ARAP_Security_Data );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
861 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
862
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
863 /* Password-Retry never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
864 /* Prompt never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
865
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
866 case RADIUS_ATTR_CONNECT_INFO:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
867 CONV2DIAM_STR( Connect_Info );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
868 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
869
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
870 /* Configuration-Token never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
871 /* ARAP-Challenge-Response never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
872 /* Acct-Interim-Interval never present in an Access-Request */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
873
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
874 case RADIUS_ATTR_NAS_PORT_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
875 CONV2DIAM_STR( NAS_Port_Id );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
876 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
877
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
878 /* Framed-Pool 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
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
881 /* RFC 2869 / 3579 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
882 case RADIUS_ATTR_ORIGINATING_LINE_INFO:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
883 CONV2DIAM_STR( Originating_Line_Info );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
884 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
885
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
886 case RADIUS_ATTR_MESSAGE_AUTHENTICATOR:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
887 case RADIUS_ATTR_EAP_MESSAGE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
888 /* It was already handled, just remove the attribute */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
889 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
890
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
891 /* Default */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
892 default: /* unknown attribute */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
893 /* We just keep the attribute in the RADIUS message */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
894 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
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
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
898 /* Destroy tunnel pointers (if we used it) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
899 free(avp_tun);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
900
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
901 /* Update the radius message to remove all handled attributes */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
902 rad_req->attr_used = nattr_used;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
903
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
904 /* Store the request identifier in the session (if provided) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
905 if (session) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
906 unsigned char * req_auth;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
907 CHECK_MALLOC(req_auth = malloc(16));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
908 memcpy(req_auth, &rad_req->hdr->authenticator[0], 16);
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 CHECK_FCT( fd_sess_state_store( cs->sess_hdl, session, &req_auth ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
911 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
912
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
913 return 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
914 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
915
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
916 static int auth_diam_ans( struct rgwp_config * cs, struct session * session, struct msg ** diam_ans, struct radius_msg ** rad_fw, struct rgw_client * cli )
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
917 {
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
918 struct msg_hdr * hdr;
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
919 struct avp *avp, *next, *avp_x, *avp_y, *asid, *aoh;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
920 struct avp_hdr *ahdr, *sid, *oh;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
921 char buf[254]; /* to store some attributes values (with final '\0') */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
922 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
923 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
924 uint8_t tuntag = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
925 unsigned char * req_auth = NULL;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
926
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
927 TRACE_ENTRY("%p %p %p %p %p", cs, session, diam_ans, rad_fw, cli);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
928 CHECK_PARAMS(cs && session && diam_ans && *diam_ans && rad_fw && *rad_fw);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
929
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
930 /* Retrieve the request identified which was stored in the session */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
931 if (session) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
932 CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, session, &req_auth ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
933 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
934
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
935 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
936 - 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
937 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
938 gateway must send a RADIUS Access-Challenge. This must have
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
939 the Origin-Host, Origin-Realm, and Diameter Session-Id AVPs
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
940 encapsulated in the RADIUS State attribute, with the prefix
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
941 "Diameter/", concatenated in the above order separated with "/"
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
942 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
943 the Translation Agent receiving the subsequent RADIUS Access-
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
944 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
945 to set the Destination-Host to the correct value.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
946 -> done here bellow
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
947
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
948 - 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
949 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
950 consists of the string "Diameter/" followed by the Diameter
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
951 Session Identifier. This will ensure that the subsequent
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
952 Accounting messages, which could be received by any Translation
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
953 Agent, would have access to the original Diameter Session
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
954 Identifier.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
955 -> 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
956 */
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 /* 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
959 /* 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
960 #define CONV2RAD_STR( _attr_, _data_, _len_, _trunc_) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
961 size_t __l = (size_t)(_len_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
962 size_t __off = 0; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
963 TRACE_DEBUG(FULL, "Converting AVP to "#_attr_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
964 if ((_trunc_) == 0) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
965 CHECK_PARAMS( __l <= 253 ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
966 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
967 if ((__l > 253) && (_trunc_ == 1)) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
968 TRACE_DEBUG(INFO, "[auth.rgwx] AVP truncated in "#_attr_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
969 __l = 253; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
970 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
971 do { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
972 size_t __w = (__l > 253) ? 253 : __l; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
973 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
974 __off += __w; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
975 __l -= __w; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
976 } while (__l); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
977 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
978
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
979 #define CONV2RAD_32B( _attr_, _data_) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
980 uint32_t __v = htonl((uint32_t)(_data_)); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
981 TRACE_DEBUG(FULL, "Converting AVP to "#_attr_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
982 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
983 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
984
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
985 #define CONV2RAD_64B( _attr_, _data_) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
986 uint64_t __v = htonll((uint64_t)(_data_)); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
987 TRACE_DEBUG(FULL, "Converting AVP to "#_attr_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
988 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
989 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
990
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
991 /* Search the different AVPs we handle here */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
992 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Session_Id, &asid) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
993 CHECK_FCT( fd_msg_avp_hdr ( asid, &sid ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
994 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
995 CHECK_FCT( fd_msg_avp_hdr ( aoh, &oh ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
996
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
997 /* Check the Diameter error code */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
998 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
999 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
1000 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1001 switch (ahdr->avp_value->u32) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1002 case ER_DIAMETER_MULTI_ROUND_AUTH:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1003 (*rad_fw)->hdr->code = RADIUS_CODE_ACCESS_CHALLENGE;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1004 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1005 case ER_DIAMETER_SUCCESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1006 case ER_DIAMETER_LIMITED_SUCCESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1007 (*rad_fw)->hdr->code = RADIUS_CODE_ACCESS_ACCEPT;
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 default:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1011 (*rad_fw)->hdr->code = RADIUS_CODE_ACCESS_REJECT;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1012 fd_log_debug("[auth.rgwx] Received Diameter answer with error code '%d' from server '%.*s', session %.*s, translating into Access-Reject\n",
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1013 ahdr->avp_value->u32,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1014 oh->avp_value->os.len, oh->avp_value->os.data,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1015 sid->avp_value->os.len, sid->avp_value->os.data);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1016 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Error_Message, &avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1017 if (avp) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1018 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1019 fd_log_debug("[auth.rgwx] Error-Message content: '%.*s'\n",
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1020 ahdr->avp_value->os.len, ahdr->avp_value->os.data);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1021 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1022 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Error_Reporting_Host, &avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1023 if (avp) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1024 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1025 fd_log_debug("[auth.rgwx] Error-Reporting-Host: '%.*s'\n",
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1026 ahdr->avp_value->os.len, ahdr->avp_value->os.data);
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 CHECK_FCT( fd_msg_search_avp (*diam_ans, cs->dict.Failed_AVP, &avp) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1029 if (avp) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1030 fd_log_debug("[auth.rgwx] Failed-AVP was included in the message.\n");
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1031 /* Dump its content ? */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1032 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1033 return 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1034 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1035 /* Remove this Result-Code avp */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1036 CHECK_FCT( fd_msg_free( avp ) );
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 /* Creation of the State or Class attribute with session information */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1039 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
1040 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1041
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1042 /* 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
1043 if ((*rad_fw)->hdr->code == RADIUS_CODE_ACCESS_CHALLENGE) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1044 if (sizeof(buf) < snprintf(buf, sizeof(buf), "Diameter/%.*s/%.*s/%.*s",
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1045 oh->avp_value->os.len, oh->avp_value->os.data,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1046 ahdr->avp_value->os.len, ahdr->avp_value->os.data,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1047 sid->avp_value->os.len, sid->avp_value->os.data)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1048 TRACE_DEBUG(INFO, "Data truncated in State attribute: %s", buf);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1049 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1050 CONV2RAD_STR(RADIUS_ATTR_STATE, buf, strlen(buf), 0);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1051 }
296
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1052
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1053 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
1054 /* Add the Session-Id */
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1055 if (sizeof(buf) < snprintf(buf, sizeof(buf), "Diameter/%.*s",
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1056 sid->avp_value->os.len, sid->avp_value->os.data)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1057 TRACE_DEBUG(INFO, "Data truncated in Class attribute: %s", buf);
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 CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, strlen(buf), 0);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1060 }
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 /* 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
1063 CHECK_FCT( fd_msg_free( avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1064
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1065 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
1066 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
1067 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
1068 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1069 When translating a Diameter AA-Answer (with successful result code)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1070 to RADIUS Access-Accept that contains a Session-Timeout or
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1071 Authorization-Lifetime AVP, take the following steps:
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 - 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
1074 Authorization-Lifetime AVP, translate it to a Session-Timeout
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1075 attribute (not a Termination-Action).
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1076 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1077 if ((avp != NULL) && (avp_x == NULL)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1078 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1079 CONV2RAD_32B( RADIUS_ATTR_SESSION_TIMEOUT, ahdr->avp_value->u32 );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1080 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1081
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1082 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1083 - If the Diameter message contains an Authorization-Lifetime AVP
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1084 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
1085 attribute and a Termination-Action set to AA-REQUEST. (Remove
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1086 Authorization-Lifetime and Re-Auth-Request-Type.)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1087 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1088 if ((avp == NULL) && (avp_x != NULL)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1089 CHECK_FCT( fd_msg_avp_hdr ( avp_x, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1090 CONV2RAD_32B( RADIUS_ATTR_SESSION_TIMEOUT, ahdr->avp_value->u32 );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1091 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
1092 ta_set = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1093 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1094
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1095 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1096 - 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
1097 greater than or equal to the Authorization-Lifetime (required
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1098 by [BASE]). Translate it to a Session-Timeout value (with
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1099 value from Authorization-Lifetime AVP, the smaller one) and
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1100 with the Termination-Action set to AA-REQUEST. (Remove the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1101 Authorization-Lifetime and Re-Auth-Request-Type.)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1102 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1103 if ((avp != NULL) && (avp_x != NULL)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1104 CHECK_FCT( fd_msg_avp_hdr ( avp_x, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1105 CONV2RAD_32B( RADIUS_ATTR_SESSION_TIMEOUT, ahdr->avp_value->u32 );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1106 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
1107 ta_set = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1108 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1109
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1110 /* -> 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
1111
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1112 if (avp) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1113 CHECK_FCT( fd_msg_free( avp ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1114 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1115 if (avp_x) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1116 CHECK_FCT( fd_msg_free( avp_x ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1117 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1118 if (avp_y) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1119 CHECK_FCT( fd_msg_free( avp_y ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1120 }
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 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1124 - 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
1125 the same attribute is added in the response. This information
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1126 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
1127 table.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1128 -> handled by sub_echo_drop
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1129
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1130 - If state information regarding the RADIUS request was saved in
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1131 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
1132 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
1133 issuing the RADIUS reply.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1134 -> was saved with the full request
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
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1137
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1138 /* 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
1139 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
1140
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1141 while (next) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1142 int handled = 1;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1143 avp = next;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1144 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
1145
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1146 CHECK_FCT( fd_msg_avp_hdr ( avp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1147
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1148 if (!(ahdr->avp_flags & AVP_FLAG_VENDOR)) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1149 switch (ahdr->avp_code) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1150
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1151 /* 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
1152 case DIAM_ATTR_ACCT_INTERIM_INTERVAL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1153 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
1154 break;
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 case DIAM_ATTR_ARAP_CHALLENGE_RESPONSE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1157 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
1158 break;
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 case DIAM_ATTR_ARAP_FEATURES:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1161 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
1162 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1163
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1164 /* ARAP-Password is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1165
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1166 case DIAM_ATTR_ARAP_SECURITY:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1167 CONV2RAD_32B(RADIUS_ATTR_ARAP_SECURITY, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1168 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1169
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1170 case DIAM_ATTR_ARAP_SECURITY_DATA:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1171 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
1172 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1173
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1174 case DIAM_ATTR_ARAP_ZONE_ACCESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1175 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
1176 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1177
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1178 case DIAM_ATTR_AUTH_APPLICATION_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1179 /* We just remove this AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1180 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1181
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1182 case DIAM_ATTR_AUTH_GRACE_PERIOD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1183 /* We just remove this AVP (?) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1184 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1185
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1186 case DIAM_ATTR_AUTH_REQUEST_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1187 /* We only check the value */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1188 if (ahdr->avp_value->u32 != 3) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1189 fd_log_debug("[auth.rgwx] Received Diameter answer with Auth-Request-Type set to %d (%s) from server %.*s, session %.*s.\n"
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1190 " This may cause interoperability problems with RADIUS.\n",
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1191 ahdr->avp_value->u32,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1192 (ahdr->avp_value->u32 == 1) ? "AUTHENTICATE_ONLY" :
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1193 ((ahdr->avp_value->u32 == 2) ? "AUTHORIZE_ONLY" : "???"),
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1194 oh->avp_value->os.len, oh->avp_value->os.data,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1195 sid->avp_value->os.len, sid->avp_value->os.len);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1196 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1197 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1198
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1199 case DIAM_ATTR_AUTH_SESSION_STATE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1200 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
1201 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
1202 }
296
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1203
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1204 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
1205 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
1206 }
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1207 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1208
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1209 /* Authorization-Lifetime already handled */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1210
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1211 case DIAM_ATTR_CALLBACK_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1212 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
1213 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1214
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1215 case DIAM_ATTR_CALLBACK_NUMBER:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1216 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
1217 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1218
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1219 /* Called-Station-Id is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1220 /* Calling-Station-Id is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1221 /* CHAP-Auth is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1222 /* CHAP-Challenge is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1223
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1224 case DIAM_ATTR_CLASS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1225 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
1226 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1227
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1228 case DIAM_ATTR_CONFIGURATION_TOKEN:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1229 /* 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
1230 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
1231 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1232
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1233 /* Connect-Info is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1234
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1235 case DIAM_ATTR_FILTER_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1236 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
1237 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1238
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1239 case DIAM_ATTR_FRAMED_APPLETALK_LINK:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1240 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
1241 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1242
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1243 case DIAM_ATTR_FRAMED_APPLETALK_NETWORK:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1244 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
1245 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1246
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1247 case DIAM_ATTR_FRAMED_APPLETALK_ZONE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1248 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
1249 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1250
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1251 case DIAM_ATTR_FRAMED_COMPRESSION:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1252 CONV2RAD_32B(RADIUS_ATTR_FRAMED_COMPRESSION, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1253 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1254
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1255 case DIAM_ATTR_FRAMED_INTERFACE_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1256 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
1257 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1258
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1259 case DIAM_ATTR_FRAMED_IP_ADDRESS:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1260 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
1261 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1262
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1263 case DIAM_ATTR_FRAMED_IP_NETMASK:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1264 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
1265 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1266
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1267 case DIAM_ATTR_FRAMED_IPV6_PREFIX:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1268 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
1269 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1270
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1271 case DIAM_ATTR_FRAMED_IPV6_POOL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1272 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
1273 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1274
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1275 case DIAM_ATTR_FRAMED_IPV6_ROUTE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1276 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
1277 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1278
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1279 case DIAM_ATTR_FRAMED_IPX_NETWORK:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1280 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
1281 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1282
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1283 case DIAM_ATTR_FRAMED_MTU:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1284 CONV2RAD_32B(RADIUS_ATTR_FRAMED_MTU, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1285 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1286
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1287 case DIAM_ATTR_FRAMED_POOL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1288 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
1289 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1290
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1291 case DIAM_ATTR_FRAMED_PROTOCOL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1292 CONV2RAD_32B(RADIUS_ATTR_FRAMED_PROTOCOL, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1293 break;
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 case DIAM_ATTR_FRAMED_ROUTE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1296 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
1297 break;
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 case DIAM_ATTR_FRAMED_ROUTING:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1300 CONV2RAD_32B(RADIUS_ATTR_FRAMED_ROUTING, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1301 break;
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 case DIAM_ATTR_IDLE_TIMEOUT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1304 CONV2RAD_32B(RADIUS_ATTR_IDLE_TIMEOUT, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1305 break;
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 case DIAM_ATTR_LOGIN_IP_HOST:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1308 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
1309 break;
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 case DIAM_ATTR_LOGIN_IPV6_HOST:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1312 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
1313 break;
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 case DIAM_ATTR_LOGIN_LAT_GROUP:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1316 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
1317 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1318
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1319 case DIAM_ATTR_LOGIN_LAT_NODE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1320 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
1321 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1322
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1323 case DIAM_ATTR_LOGIN_LAT_PORT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1324 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
1325 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1326
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1327 case DIAM_ATTR_LOGIN_LAT_SERVICE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1328 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
1329 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1330
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1331 case DIAM_ATTR_LOGIN_SERVICE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1332 CONV2RAD_32B(RADIUS_ATTR_LOGIN_SERVICE, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1333 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1334
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1335 case DIAM_ATTR_LOGIN_TCP_PORT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1336 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
1337 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1338
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1339 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1340 - If the
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1341 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
1342 be inserted in the RADIUS Session-Timeout AVP.
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 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
1345 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
1346 present, it is translated to the RADIUS Session-Timeout attribute.
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1347 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1348 case DIAM_ATTR_MULTI_ROUND_TIMEOUT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1349 CONV2RAD_32B(RADIUS_ATTR_SESSION_TIMEOUT, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1350 break;
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 case DIAM_ATTR_NAS_FILTER_RULE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1353 /* This is not translatable to RADIUS */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1354 fd_log_debug("[auth.rgwx] Received Diameter answer with non-translatable NAS-Filter-Rule AVP from '%.*s' (session: '%.*s'), ignoring.\n",
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1355 oh->avp_value->os.len, oh->avp_value->os.data,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1356 sid->avp_value->os.len, sid->avp_value->os.data);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1357 handled = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1358 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1359
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1360 /* NAS-Identifier is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1361 /* NAS-IP-Address is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1362 /* NAS-IPv6-Address is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1363 /* NAS-Port is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1364 /* NAS-Port-Id is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1365 /* NAS-Port-Type is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1366
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1367 case DIAM_ATTR_ORIGIN_AAA_PROTOCOL:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1368 /* We just remove this AVP */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1369 break;
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 /* Originating-Line-Info is not present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1372
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1373 case DIAM_ATTR_PASSWORD_RETRY:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1374 CONV2RAD_32B(RADIUS_ATTR_PASSWORD_RETRY, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1375 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1376
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1377 case DIAM_ATTR_PORT_LIMIT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1378 CONV2RAD_32B(RADIUS_ATTR_PORT_LIMIT, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1379 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1380
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1381 case DIAM_ATTR_PROMPT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1382 CONV2RAD_32B(RADIUS_ATTR_PROMPT, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1383 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1384
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1385 case DIAM_ATTR_QOS_FILTER_RULE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1386 /* This is not translatable to RADIUS */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1387 fd_log_debug("[auth.rgwx] Received Diameter answer with non-translatable QoS-Filter-Rule AVP from '%.*s' (session: '%.*s'), ignoring.\n",
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1388 oh->avp_value->os.len, oh->avp_value->os.data,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1389 sid->avp_value->os.len, sid->avp_value->os.data);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1390 handled = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1391 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1392
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1393 /* Re-Auth-Request-Type already handled */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1394
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1395 case DIAM_ATTR_REPLY_MESSAGE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1396 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
1397 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1398
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1399 case DIAM_ATTR_SERVICE_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1400 CONV2RAD_32B(RADIUS_ATTR_SERVICE_TYPE, ahdr->avp_value->u32);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1401 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1402
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1403 case DIAM_ATTR_STATE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1404 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
1405 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1406
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1407 case DIAM_ATTR_TUNNELING:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1408 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1409 #define CONV2RAD_TUN_STR( _attr_, _data_, _len_, _trunc_) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1410 size_t __l = (size_t)(_len_); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1411 size_t __w = (__l > 252) ? 252 : __l; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1412 size_t __off = 0; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1413 if ((_trunc_) == 0) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1414 CHECK_PARAMS( __l <= 252 ); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1415 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1416 if ((__l > 252) && (_trunc_ == 1)) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1417 TRACE_DEBUG(FULL, "Attribute truncated!"); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1418 __l = 252; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1419 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1420 buf[0] = tuntag; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1421 memcpy(&buf[1], (_data_), __w); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1422 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
1423 while (__l -= __w) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1424 __off += __w; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1425 __w = (__l > 253) ? 253 : __l; \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1426 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
1427 } \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1428 }
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 #define CONV2RAD_TUN_32B( _attr_, _data_) { \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1431 uint32_t __v = htonl((uint32_t)(_data_) | (tuntag << 24)); \
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1432 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
1433 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1434 struct avp *inavp, *innext;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1435 tuntag++;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1436 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
1437 while (innext) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1438 inavp = innext;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1439 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
1440 CHECK_FCT( fd_msg_avp_hdr ( inavp, &ahdr ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1441
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1442 if (ahdr->avp_flags & AVP_FLAG_VENDOR == 0) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1443 switch (ahdr->avp_code) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1444 case DIAM_ATTR_TUNNEL_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1445 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
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_TUNNEL_MEDIUM_TYPE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1449 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
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_TUNNEL_CLIENT_ENDPOINT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1453 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
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_TUNNEL_SERVER_ENDPOINT:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1457 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
1458 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1459
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1460 case DIAM_ATTR_TUNNEL_PREFERENCE:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1461 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
1462 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1463
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1464 case DIAM_ATTR_TUNNEL_CLIENT_AUTH_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1465 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
1466 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1467
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1468 case DIAM_ATTR_TUNNEL_SERVER_AUTH_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1469 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
1470 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1471
271
411314907b43 Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 264
diff changeset
1472 case DIAM_ATTR_TUNNEL_ASSIGNMENT_ID:
411314907b43 Added translation of Accounting messages
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 264
diff changeset
1473 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
1474 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1475
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1476 case DIAM_ATTR_TUNNEL_PASSWORD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1477 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1478 /* 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
1479 0 1 2 3
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1480 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
1481 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1482 | Type | Length | Tag | Salt
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1483 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1484 Salt (cont) | String ...
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1485 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1486 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1487 size_t pos;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1488 int i;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1489 size_t buflen;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1490 uint8_t * secret; /* S */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1491 size_t secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1492 uint8_t hash[16]; /* b(i) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1493 const uint8_t *addr[3];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1494 size_t len[3];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1495
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1496 /* We need the request authenticator */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1497 CHECK_PARAMS(req_auth);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1498
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1499 /* Retrieve the shared secret */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1500 CHECK_FCT(rgw_clients_getkey(cli, &secret, &secret_len));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1501
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1502 /* Beginning of the buffer */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1503 buf[0] = tuntag;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1504 buf[1] = (uint8_t)(lrand48()); /* A (hi bits) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1505 buf[2] = (uint8_t)(lrand48()); /* A (low bits) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1506
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1507 /* The plain text string P */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1508 CHECK_PARAM(ahdr->avp_value->os.len < 240);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1509 buf[3] = ahdr->avp_value->os.len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1510 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
1511 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
1512
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1513 /* Initial b1 = MD5(S + R + A) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1514 addr[0] = secret;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1515 len[0] = secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1516 addr[1] = req_auth;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1517 len[1] = 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1518 addr[2] = &buf[1];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1519 len[2] = 2;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1520 md5_vector(3, addr, len, hash);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1521
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1522 /* Initial c(1) = p(1) xor b(1) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1523 for (i = 0; i < 16; i++) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1524 buf[i + 3] ^= hash[i];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1525 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1526 pos = 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1527
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1528 /* loop */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1529 while (pos < ahdr->avp_value->os.len + 1) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1530 addr[0] = secret;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1531 len[0] = secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1532 addr[1] = &buf[pos - 13];
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1533 len[1] = 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1534 /* b(i) = MD5( S + c(i-1) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1535 md5_vector(2, addr, len, hash);
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 /* c(i) = p(i) xor b(i) */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1538 for (i = 0; i < 16; i++)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1539 buf[pos + i + 3] ^= hash[i];
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 pos += 16;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1542 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1543
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1544 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
1545 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1546 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1547
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1548 case DIAM_ATTR_TUNNEL_PRIVATE_GROUP_ID:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1549 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
1550 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1551
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1552 default:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1553 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
1554 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1555 } else {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1556 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
1557 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1558 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1559 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1560 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1561
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1562 case DIAM_ATTR_USER_NAME:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1563 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
1564 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1565
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1566 /* User-Password never present in answers */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1567
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1568 /* 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
1569 /*
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1570 o Diameter Accounting-EAP-Auth-Method AVPs, if present, are
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1571 discarded.
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_ACCOUNTING_EAP_AUTH_METHOD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1574 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1575
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 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
1578 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
1579 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
1580 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
1581 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
1582 attribute is described in [RFC2548].
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1583 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1584 case DIAM_ATTR_EAP_MASTER_SESSION_KEY:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1585 {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1586 uint8_t * secret; /* S */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1587 size_t secret_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1588 size_t recv_len, send_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1589
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1590 /* We need the request authenticator */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1591 CHECK_PARAMS(req_auth);
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 /* Retrieve the shared secret */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1594 CHECK_FCT(rgw_clients_getkey(cli, &secret, &secret_len));
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1595
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1596 if (ahdr->avp_value->os.len != 64) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1597 TRACE_DEBUG(INFO, "Received EAP-Master-Session-Key attribute with length %d != 64.\n", ahdr->avp_value->os.len)
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1598 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1599
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1600 CHECK_PARAMS(ahdr->avp_value->os.len <= 64);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1601 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
1602 send_len = ahdr->avp_value->os.len - recv_len;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1603
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1604 if ( ! radius_msg_add_mppe_keys(*rad_fw, req_auth, secret, secret_len,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1605 ahdr->avp_value->os.data + recv_len, send_len,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1606 ahdr->avp_value->os.data, recv_len) ) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1607 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
1608 return ENOMEM;
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 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1611 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1612
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1613 case DIAM_ATTR_EAP_KEY_NAME:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1614 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
1615 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1616
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 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
1619 attribute(s). If necessary, the value is split into multiple
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1620 RADIUS EAP-Message attributes.
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_EAP_PAYLOAD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1623 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
1624 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
1625 return ENOMEM;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1626 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1627 break;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1628
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 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
1631 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
1632 attribute [RFC3576] with value 202 (decimal), "Invalid EAP Packet
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1633 (Ignored)" [RFC3579].
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1634 */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1635 case DIAM_ATTR_EAP_REISSUED_PAYLOAD:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1636 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
1637 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
1638 return ENOMEM;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1639 }
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 if ( ! radius_msg_add_attr_int32(*rad_fw, RADIUS_ATTR_ERROR_CAUSE, 202) ) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1642 TRACE_DEBUG(INFO, "Error while adding Error-Cause attribute in RADIUS message");
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1643 return ENOMEM;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1644 }
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 default:
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1648 /* Leave the AVP in the message for further treatment */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1649 handled = 0;
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 } else {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1652 /* Vendor-specific AVPs */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1653 switch (ahdr->avp_vendor) {
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 default: /* unknown vendor */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1656 handled = 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1657 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1658 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1659
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1660 if (handled) {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1661 CHECK_FCT( fd_msg_free( avp ) );
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 }
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 CHECK_FCT( fd_msg_free( asid ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1666 CHECK_FCT( fd_msg_free( aoh ) );
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1667 free(req_auth);
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1668
296
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1669 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
1670 /* 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
1671 CHECK_FCT( fd_msg_hdr( *diam_ans, &hdr ) );
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1672 if (sizeof(buf) < snprintf(buf, sizeof(buf), CLASS_AAI_PREFIX "%u",
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1673 no_str ? 0 : hdr->msg_appl)) {
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1674 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
1675 }
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1676 CONV2RAD_STR(RADIUS_ATTR_CLASS, buf, strlen(buf), 0);
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1677 }
e11a9f90a65a Do not send STR if the auth server sent NO_STATE_MAINTAINED
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 273
diff changeset
1678
256
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1679 return 0;
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1680 }
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1681
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1682 /* The exported symbol */
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1683 struct rgw_api rgwp_descriptor = {
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1684 .rgwp_name = "auth",
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1685 .rgwp_conf_parse = auth_conf_parse,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1686 .rgwp_conf_free = auth_conf_free,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1687 .rgwp_rad_req = auth_rad_req,
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1688 .rgwp_diam_ans = auth_diam_ans
042af0000c0a Ported the auth plugin
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1689 };
"Welcome to our mercurial repository"