@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $ Header : / cvsroot / pgsql / src / backend / libpq / auth . c , v 1.23 1998 / 01 / 27 03 : 24 : 54 scrappy Exp $
* $ Header : / cvsroot / pgsql / src / backend / libpq / auth . c , v 1.24 1998 / 01 / 29 03 : 23 : 05 scrappy Exp $
*
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
*/
@ -390,9 +390,6 @@ void auth_failed(Port *port)
*/
*/
void be_recvauth ( Port * port )
void be_recvauth ( Port * port )
{
{
AuthRequest areq ;
void ( * auth_handler ) ( ) ;
/*
/*
* Get the authentication method to use for this frontend / database
* Get the authentication method to use for this frontend / database
* combination .
* combination .
@ -400,70 +397,76 @@ void be_recvauth(Port *port)
if ( hba_getauthmethod ( & port - > raddr , port - > database , port - > auth_arg ,
if ( hba_getauthmethod ( & port - > raddr , port - > database , port - > auth_arg ,
& port - > auth_method ) ! = STATUS_OK )
& port - > auth_method ) ! = STATUS_OK )
{
PacketSendError ( & port - > pktInfo , " Missing or mis-configured pg_hba.conf file " ) ;
PacketSendError ( & port - > pktInfo , " Missing or mis-configured pg_hba.conf file " ) ;
return ;
}
/* Handle old style authentication. */
else if ( PG_PROTOCOL_MAJOR ( port - > proto ) = = 0 )
if ( PG_PROTOCOL_MAJOR ( port - > proto ) = = 0 )
{
{
/* Handle old style authentication. */
if ( old_be_recvauth ( port ) ! = STATUS_OK )
if ( old_be_recvauth ( port ) ! = STATUS_OK )
auth_failed ( port ) ;
auth_failed ( port ) ;
return ;
}
}
else
/* Handle new style authentication. */
switch ( port - > auth_method )
{
{
case uaReject :
AuthRequest areq ;
auth_failed ( port ) ;
void ( * auth_handler ) ( ) ;
return ;
case uaKrb4 :
areq = AUTH_REQ_KRB4 ;
auth_handler = handle_krb4_auth ;
break ;
case uaKrb5 :
/* Keep the compiler quiet. */
areq = AUTH_REQ_KRB5 ;
auth_handler = handle_krb5_auth ;
break ;
case uaTrust :
areq = AUTH_REQ_OK ;
areq = AUTH_REQ_OK ;
auth_handler = handle_done_auth ;
break ;
case uaIdent :
/* Handle new style authentication. */
if ( authident ( & port - > raddr . in , & port - > laddr . in , port - > user ,
port - > auth_arg ) ! = STATUS_OK )
auth_handler = NULL ;
switch ( port - > auth_method )
{
{
auth_failed ( port ) ;
case uaReject :
return ;
break ;
}
case uaKrb4 :
areq = AUTH_REQ_KRB4 ;
auth_handler = handle_krb4_auth ;
break ;
areq = AUTH_REQ_OK ;
case uaKrb5 :
auth_handler = handle_done_auth ;
areq = AUTH_REQ_KRB5 ;
break ;
auth_handler = handle_krb5_auth ;
break ;
case uaPassword :
case uaTrust :
areq = AUTH_REQ_PASSWORD ;
areq = AUTH_REQ_OK ;
auth_handler = handle_password _auth ;
auth_handler = handle_done _auth ;
break ;
break ;
case uaCrypt :
case uaIdent :
areq = AUTH_REQ_CRYPT ;
if ( authident ( & port - > raddr . in , & port - > laddr . in ,
auth_handler = handle_password_auth ;
port - > user , port - > auth_arg ) = = STATUS_OK )
break ;
{
}
areq = AUTH_REQ_OK ;
auth_handler = handle_done_auth ;
}
break ;
/* Tell the frontend what we want next. */
case uaPassword :
areq = AUTH_REQ_PASSWORD ;
auth_handler = handle_password_auth ;
break ;
sendAuthRequest ( port , areq , auth_handler ) ;
case uaCrypt :
areq = AUTH_REQ_CRYPT ;
auth_handler = handle_password_auth ;
break ;
}
/* Tell the frontend what we want next. */
if ( auth_handler ! = NULL )
sendAuthRequest ( port , areq , auth_handler ) ;
else
auth_failed ( port ) ;
}
}
}