Changeset 1088:1d1a20a0779d in freeDiameter for extensions/app_radgw/rgwx_auth.c
- Timestamp:
- May 5, 2013, 4:25:27 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/app_radgw/rgwx_auth.c
r1027 r1088 125 125 }; 126 126 127 struct sess_state { 128 char req_auth[16]; 129 }; 130 131 127 132 /* Initialize the plugin */ 128 133 static int auth_conf_parse(char * confstr, struct rgwp_config ** state) … … 137 142 memset(new, 0, sizeof(struct rgwp_config)); 138 143 139 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, free, NULL ) );144 CHECK_FCT( fd_sess_handler_create( &new->sess_hdl, (void *)free, NULL, NULL ) ); 140 145 new->confstr = confstr; 141 146 … … 1057 1062 /* Store the request identifier in the session (if provided) */ 1058 1063 { 1059 unsigned char * req_auth;1060 CHECK_MALLOC( req_auth = malloc(16));1061 memcpy( req_auth, &rad_req->hdr->authenticator[0], 16);1064 struct sess_state *st; 1065 CHECK_MALLOC(st = malloc(sizeof(struct sess_state))); 1066 memcpy(st->req_auth, &rad_req->hdr->authenticator[0], 16); 1062 1067 1063 CHECK_FCT( fd_sess_state_store( cs->sess_hdl, sess, & req_auth) );1068 CHECK_FCT( fd_sess_state_store( cs->sess_hdl, sess, &st ) ); 1064 1069 } 1065 1070 … … 1077 1082 int no_str = 0; /* indicate if an STR is required for this server */ 1078 1083 uint8_t tuntag = 0; 1079 unsigned char * req_auth = NULL;1084 struct sess_state *st; 1080 1085 int error_cause = 0; 1081 1086 struct session * sess; … … 1089 1094 CHECK_FCT( fd_msg_sess_get(fd_g_config->cnf_dict, *diam_ans, &sess, NULL) ); 1090 1095 if (sess) { 1091 CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, sess, & req_auth) );1096 CHECK_FCT( fd_sess_state_retrieve( cs->sess_hdl, sess, &st ) ); 1092 1097 CHECK_FCT( fd_sess_getsid(sess, &sid, &sidlen) ); 1093 1098 } /* else ? */ … … 1759 1764 1760 1765 /* We need the request authenticator */ 1761 CHECK_PARAMS( req_auth);1766 CHECK_PARAMS(st); 1762 1767 1763 1768 /* Retrieve the shared secret */ … … 1778 1783 addr[0] = secret; 1779 1784 len[0] = secret_len; 1780 addr[1] = req_auth;1785 addr[1] = st->req_auth; 1781 1786 len[1] = 16; 1782 1787 addr[2] = &buf[1]; … … 1853 1858 1854 1859 /* We need the request authenticator */ 1855 CHECK_PARAMS( req_auth);1860 CHECK_PARAMS(st); 1856 1861 1857 1862 /* Retrieve the shared secret */ … … 1866 1871 send_len = ahdr->avp_value->os.len - recv_len; 1867 1872 1868 if ( ! radius_msg_add_mppe_keys(*rad_fw, req_auth, secret, secret_len,1873 if ( ! radius_msg_add_mppe_keys(*rad_fw, st->req_auth, secret, secret_len, 1869 1874 ahdr->avp_value->os.data + recv_len, send_len, 1870 1875 ahdr->avp_value->os.data, recv_len) ) { … … 1925 1930 1926 1931 CHECK_FCT( fd_msg_free( aoh ) ); 1927 free( req_auth);1932 free(st); 1928 1933 1929 1934 if (error_cause) {
Note: See TracChangeset
for help on using the changeset viewer.