Commit 511d1981 authored by Robert Dubner's avatar Robert Dubner
Browse files

Change some 'ni_' references to 'radius_'

parent c1118a3a
......@@ -307,7 +307,7 @@ build_ttls_challenge( RADIUS_PACKET *response,
static int
process_eap_message_identity( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
int udp_socket,
struct sockaddr_in *client_addr,
search_descriptor *sd,
......@@ -379,7 +379,7 @@ process_eap_message_identity( void *ctx,
static int
process_eap_message_legacy_nak( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
int udp_socket,
struct sockaddr_in *client_addr,
search_descriptor *sd,
......@@ -457,7 +457,7 @@ process_eap_message_legacy_nak( void *ctx,
}
static STATE *
recover_state(radiusov_info *radius_info, RADIUS_PACKET *request)
recover_state(RADIUS_INFO *radius_info, RADIUS_PACKET *request)
{
Debug(LDAP_DEBUG_TRACE,"=> %s()\n", __func__);
// We are going to walk our doubly-linked list of states, looking
......@@ -562,7 +562,7 @@ clobber_state(STATE *state)
}
static void
clobber_stale_states(radiusov_info *radius_info)
clobber_stale_states(RADIUS_INFO *radius_info)
{
// This routine is simple enough. It scans the entire doubly-linked list
// of STATES, and clobbers any that are so old that they can't be of any
......@@ -2221,7 +2221,7 @@ process_peap_application_data(STATE *state)
static int
process_eap_message_peap_or_ttls( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
int udp_socket,
struct sockaddr_in *client_addr,
search_descriptor *sd,
......@@ -2481,7 +2481,7 @@ process_eap_message_peap_or_ttls( void *ctx,
static int
process_access_request( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
int udp_socket,
struct sockaddr_in *client_addr,
search_descriptor *sd,
......@@ -2674,7 +2674,7 @@ process_access_request( void *ctx,
int
radiusov_protocol( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
int udp_socket,
struct sockaddr_in *client_addr,
search_descriptor *sd,
......
......@@ -117,7 +117,7 @@ radiusov_name2dn_cb(Operation *op, SlapReply *rs)
static int
radiusov_get_dn_from_uid( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
search_descriptor *sd,
char *pszUsername,
struct berval *dn)
......@@ -133,7 +133,7 @@ radiusov_get_dn_from_uid( void *ctx,
conn.c_ssf = conn.c_transport_ssf = local_ssf;
op=&opbuf.ob_op;
op->o_bd = radius_info->ni_db;
op->o_bd = radius_info->radius_db;
op->o_dn.bv_val = sd->search_proxy;
op->o_dn.bv_len = strlen(op->o_dn.bv_val);
......@@ -179,7 +179,7 @@ radiusov_get_dn_from_uid( void *ctx,
static int
radiusov_bind( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
BerValue *dn,
const char *password)
{
......@@ -204,7 +204,7 @@ radiusov_bind( void *ctx,
ber_password.bv_len = strlen(password);
ber_password.bv_val = (char *)password;
op->o_bd = radius_info->ni_db;
op->o_bd = radius_info->radius_db;
op->o_tag = LDAP_REQ_BIND;
op->orb_method = LDAP_AUTH_SIMPLE;
op->o_protocol = version;
......@@ -219,7 +219,7 @@ radiusov_bind( void *ctx,
static int
radiusov_verify_username_password( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
search_descriptor *sd,
char *pszUsername,
char *pszPassword)
......@@ -276,7 +276,7 @@ radiusov_password_callback(Operation *op, SlapReply *rs)
int
radiusov_get_password_from_uid( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
search_descriptor *sd,
char *pszUsername,
char *password)
......@@ -295,7 +295,7 @@ radiusov_get_password_from_uid( void *ctx,
op=&opbuf.ob_op;
conn.c_ssf = conn.c_transport_ssf = local_ssf;
op->o_bd = radius_info->ni_db;
op->o_bd = radius_info->radius_db;
/*
* Parse the search request. It looks like this:
......@@ -386,7 +386,7 @@ radiusov_get_password_from_uid( void *ctx,
static int
radiusov_test_and_development( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
search_descriptor *sd,
uint8_t *pszUsernamePassword_)
{
......@@ -476,7 +476,7 @@ radiusov_acceptconn(void *ctx, void *arg)
__func__,
GV_packet_count);
radiusov_info *radius_info = arg;
RADIUS_INFO *radius_info = arg;
ssize_t recv_len;
ssize_t nsent;
......@@ -486,12 +486,12 @@ radiusov_acceptconn(void *ctx, void *arg)
char response[1024];
char ebuf[128];
int udp_socket = radius_info->ni_socket;
//int udp_socket = radius_info->radius_udp_socket;
static const int MAX_MESSAGE_LENGTH = 4096;
uint8_t incoming_request[MAX_MESSAGE_LENGTH + 1]; // Room for a '\0 fencepost
slen = sizeof(client_addr);
recv_len = recvfrom(udp_socket,
recv_len = recvfrom(radius_info->radius_udp_socket,
incoming_request,
MAX_MESSAGE_LENGTH,
0,
......@@ -507,7 +507,7 @@ radiusov_acceptconn(void *ctx, void *arg)
if( packet_eat_count < 0 || packet_eat_count >= 1 )
{
// Let the system know it should keep listening on the port
connection_client_enable(radius_info->ni_conn);
connection_client_enable(radius_info->radius_connection);
}
if( packet_eat_count >= 1)
......@@ -543,7 +543,7 @@ radiusov_acceptconn(void *ctx, void *arg)
// Get the port number of our socket
struct sockaddr_in us;
socklen_t len = sizeof(us);
getsockname(udp_socket, (struct sockaddr *)&us, &len);
getsockname(radius_info->radius_udp_socket, (struct sockaddr *)&us, &len);
int our_port = ntohs(us.sin_port);
// Find our search_descriptor from the client_ipa and the our_port
......@@ -582,7 +582,7 @@ radiusov_acceptconn(void *ctx, void *arg)
case RADIUS_PROTOCOL:
rc = radiusov_protocol( ctx,
radius_info,
udp_socket,
radius_info->radius_udp_socket,
&client_addr,
sd,
incoming_request,
......@@ -619,7 +619,7 @@ radiusov_acceptconn(void *ctx, void *arg)
if( *response )
{
nsent = sendto(udp_socket,
nsent = sendto(radius_info->radius_udp_socket,
response,
strlen(response),
0,
......@@ -649,7 +649,7 @@ radiusov_create_udp_port(BackendDB *be, ConfigReply *cr, int port_number)
port_number);
slap_overinst *radiusov = (slap_overinst *)be->bd_info;
radiusov_info *ni = radiusov->on_bi.bi_private;
RADIUS_INFO *radius_info = radiusov->on_bi.bi_private;
int udp_socket;
struct sockaddr_in server_addr;
......@@ -690,11 +690,17 @@ radiusov_create_udp_port(BackendDB *be, ConfigReply *cr, int port_number)
return;
}
ni->ni_socket = udp_socket;
ni->ni_conn = connection_client_setup( udp_socket, radiusov_acceptconn, ni );
radius_info->radius_udp_socket = udp_socket;
radius_info->radius_connection = connection_client_setup( udp_socket,
radiusov_acceptconn,
radius_info );
}
// ldap://<host>/<base>?<attrs>?<scope>?<filter>
// ldap_url_parse()
static ConfigDriver radius_config_driver;
enum
......@@ -783,12 +789,12 @@ radiusov_db_init( BackendDB *be,
Debug(LDAP_DEBUG_TRACE,"=> %s()\n",__func__);
slap_overinst *on = (slap_overinst *)be->bd_info;
radiusov_info *radius_info;
RADIUS_INFO *radius_info;
radius_info = ch_calloc( 1, sizeof(radiusov_info) );
radius_info = ch_calloc( 1, sizeof(RADIUS_INFO) );
on->on_bi.bi_private = radius_info;
radius_info->ni_db = be->bd_self;
radius_info->radius_db = be->bd_self;
ldap_pvt_thread_mutex_init( &libradius_mutex );
......@@ -811,7 +817,7 @@ radiusov_db_destroy(BackendDB *be, ConfigReply *cr )
Debug(LDAP_DEBUG_TRACE,"=> %s()\n",__func__);
slap_overinst *radiusov = (slap_overinst *)be->bd_info;
radiusov_info *radius_info = radiusov->on_bi.bi_private;
RADIUS_INFO *radius_info = radiusov->on_bi.bi_private;
ldap_pvt_thread_mutex_lock( &libradius_mutex );
// We need to do a final cleanup of any extent STATES. Recall that the
......@@ -876,22 +882,22 @@ radiusov_db_close( BackendDB *be,
Debug(LDAP_DEBUG_TRACE,"=> %s()\n",__func__);
slap_overinst *on = (slap_overinst *)be->bd_info;
radiusov_info *ni = on->on_bi.bi_private;
RADIUS_INFO *radius_info = on->on_bi.bi_private;
if ( slapMode & SLAP_SERVER_MODE )
{
char ebuf[128];
/* close socket if it's still in use */
if (ni->ni_socket >= 0)
if (radius_info->radius_udp_socket >= 0)
{
if (close(ni->ni_socket))
if (close(radius_info->radius_udp_socket))
{
int saved_errno = errno;
Debug( LDAP_DEBUG_ANY,
"problem closing server socket (ignored): %s",
AC_STRERROR_R(saved_errno, ebuf, sizeof(ebuf)) );
}
ni->ni_socket = -1;
radius_info->radius_udp_socket = -1;
}
}
return 0;
......
......@@ -55,7 +55,7 @@
typedef struct _STATE_VOLATILES
{
void *ctx;
struct _radiusov_info *radius_info;
struct _RADIUS_INFO *radius_info;
int udp_socket;
struct sockaddr_in *client_addr;
struct _search_descriptor *sd;
......@@ -102,15 +102,15 @@ typedef struct _STATE
} STATE;
typedef struct _radiusov_info
typedef struct _RADIUS_INFO
{
int ni_socket;
Connection *ni_conn;
BackendDB *ni_db;
int radius_udp_socket;
Connection *radius_connection;
BackendDB *radius_db;
TLS_SERVER_CONF *openssl_configuration;
SSL_CTX *openssl_context;
STATE *openssl_states; // This is the start of a chain of openssl_states
} radiusov_info;
} RADIUS_INFO;
typedef enum _search_methods
{
......@@ -132,7 +132,7 @@ typedef struct _search_descriptor
} search_descriptor;
int radiusov_protocol( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
int udp_socket,
struct sockaddr_in *client_addr,
search_descriptor *sd,
......@@ -179,7 +179,7 @@ void hmac_md5_final( MD5_CTX *context,
uint8_t *digest);
int radiusov_get_password_from_uid( void *ctx,
radiusov_info *radius_info,
RADIUS_INFO *radius_info,
search_descriptor *sd,
char *pszUsername,
char *password);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment