Commit d93edb2d authored by Robert Dubner's avatar Robert Dubner
Browse files

Switch to using ldap_pvt_thread_pool_context()

parent f928413a
......@@ -993,8 +993,7 @@ process_mschap_response(STATE *state)
// Fetch the password for username[] from the LDAP directory:
char password[MAXIMUM_PASSWORD_CHARACTERS+1];
int bad_search = radiusov_get_password_from_uid(volatiles->ctx,
volatiles->radius_info,
int bad_search = radiusov_get_password_from_uid( volatiles->radius_info,
volatiles->sd,
p_username,
password);
......@@ -1649,7 +1648,7 @@ build_and_send_success_or_failure(STATE *state)
{
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-peap/9a255939-eff4-442b-b071-e0d96a8da628
// If we find ourselves revisiting this at all frequently, we should
// If we find ourselves revisiting this at all frequently, we should
// create a TLV object and write real code. But, for now...
int tlv_type = state->cleartext_in.data[5]*256 + state->cleartext_in.data[6];
int tlv_length = state->cleartext_in.data[7]*256 + state->cleartext_in.data[8];
......@@ -1839,8 +1838,7 @@ respond_to_ttls_md5_challenge( EAP_MESSAGE *internal_eap_message,
char password[MAXIMUM_PASSWORD_CHARACTERS+1];
int bad_search = radiusov_get_password_from_uid( volatiles->ctx,
volatiles->radius_info,
int bad_search = radiusov_get_password_from_uid( volatiles->radius_info,
volatiles->sd,
username,
password);
......
......@@ -116,8 +116,7 @@ radiusov_name2dn_cb(Operation *op, SlapReply *rs)
}
static int
radiusov_get_dn_from_uid( void *ctx,
RADIUS_INFO *radius_info,
radiusov_get_dn_from_uid( RADIUS_INFO *radius_info,
search_descriptor *sd,
char *pszUsername,
struct berval *dn)
......@@ -129,8 +128,9 @@ radiusov_get_dn_from_uid( void *ctx,
OperationBuffer opbuf;
Operation *op;
SlapReply rs = {REP_RESULT};
connection_fake_init( &conn, &opbuf, ctx );
conn.c_ssf = conn.c_transport_ssf = local_ssf;
void *thrctx = ldap_pvt_thread_pool_context();
connection_fake_init( &conn, &opbuf, thrctx );
op=&opbuf.ob_op;
op->o_bd = radius_info->radius_db;
......@@ -174,12 +174,13 @@ radiusov_get_dn_from_uid( void *ctx,
rc = 1 ;
}
ldap_pvt_thread_pool_context_reset( thrctx );
return rc;
}
static int
radiusov_bind( void *ctx,
RADIUS_INFO *radius_info,
radiusov_bind( RADIUS_INFO *radius_info,
BerValue *dn,
const char *password)
{
......@@ -191,7 +192,8 @@ radiusov_bind( void *ctx,
OperationBuffer opbuf;
Operation *op;
SlapReply rs = {REP_RESULT};
connection_fake_init( &conn, &opbuf, ctx );
void *thrctx = ldap_pvt_thread_pool_context();
connection_fake_init( &conn, &opbuf, thrctx );
op=&opbuf.ob_op;
int version = 3;
......@@ -214,6 +216,8 @@ radiusov_bind( void *ctx,
rc = op->o_bd->bd_info->bi_op_bind( op, &rs );
ldap_pvt_thread_pool_context_reset( thrctx );
return rc;
}
......@@ -227,11 +231,11 @@ radiusov_verify_username_password( void *ctx,
Debug(LDAP_DEBUG_TRACE,"=> %s()\n",__func__);
// Starting with username, find its DN
BerValue dn;
int rc = radiusov_get_dn_from_uid(ctx, radius_info, sd, pszUsername, &dn);
int rc = radiusov_get_dn_from_uid(radius_info, sd, pszUsername, &dn);
if( rc == 0 )
{
// The DN search succeeded, so do the BIND
rc = radiusov_bind(ctx, radius_info, &dn, pszPassword);
rc = radiusov_bind(radius_info, &dn, pszPassword);
if( rc )
{
rc = 1;
......@@ -275,8 +279,7 @@ radiusov_password_callback(Operation *op, SlapReply *rs)
}
int
radiusov_get_password_from_uid( void *ctx,
RADIUS_INFO *radius_info,
radiusov_get_password_from_uid( RADIUS_INFO *radius_info,
search_descriptor *sd,
char *pszUsername,
char *password)
......@@ -291,7 +294,8 @@ radiusov_get_password_from_uid( void *ctx,
OperationBuffer opbuf;
Operation *op;
SlapReply rs = {REP_RESULT};
connection_fake_init( &conn, &opbuf, ctx );
void *thrctx = ldap_pvt_thread_pool_context();
connection_fake_init( &conn, &opbuf, thrctx );
op=&opbuf.ob_op;
conn.c_ssf = conn.c_transport_ssf = local_ssf;
......@@ -381,6 +385,9 @@ radiusov_get_password_from_uid( void *ctx,
}
ber_free(ber, 1);
ber = NULL;
ldap_pvt_thread_pool_context_reset( thrctx );
return rc;
}
......@@ -691,9 +698,9 @@ radiusov_create_udp_port(BackendDB *be, ConfigReply *cr, int port_number)
}
radius_info->radius_udp_socket = udp_socket;
radius_info->radius_connection = connection_client_setup( udp_socket,
radiusov_acceptconn,
radius_info );
radius_info->radius_connection = connection_client_setup( udp_socket,
radiusov_acceptconn,
radius_info );
}
......@@ -746,23 +753,25 @@ static ConfigTable radiuscfg[] =
static ConfigOCs radiusocs[] =
{
{ "( OLcfgOvOc:" OVERLAY_OID ".1 "
{
"( OLcfgOvOc:" OVERLAY_OID ".1 "
"NAME 'olcRadiusLogConfig' "
"DESC 'Access log configuration' "
"SUP olcOverlayConfig "
"MUST olcRadiusPort "
// "MAY ( olcRadiusLogOps $ olcRadiusLogPurge $ olcRadiusLogSuccess $ "
// "olcRadiusLogOld $ olcRadiusLogOldAttr $ olcRadiusLogBase ) "
")",
Cft_Overlay, radiuscfg },
// {
// "( OLcfgCtOc:" OVERLAY_OID ".1 "
// "NAME 'olcRadiusOvConfig' "
// "DESC 'RADIUS lookup configuration' "
// "SUP olcOverlayConfig "
// ")",
// Cft_Overlay, radiuscfg
// },
")",
Cft_Overlay, radiuscfg
},
// {
// "( OLcfgCtOc:" OVERLAY_OID ".1 "
// "NAME 'olcRadiusOvConfig' "
// "DESC 'RADIUS lookup configuration' "
// "SUP olcOverlayConfig "
// ")",
// Cft_Overlay, radiuscfg
// },
{ NULL, 0, NULL }
};
......
......@@ -178,8 +178,7 @@ void hmac_md5_update(MD5_CTX *context,
void hmac_md5_final( MD5_CTX *context,
uint8_t *digest);
int radiusov_get_password_from_uid( void *ctx,
RADIUS_INFO *radius_info,
int radiusov_get_password_from_uid( 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