Skip to content
Snippets Groups Projects
Commit b6f22d88 authored by jwindley's avatar jwindley
Browse files

Move authentication arg marshaling to inside plugin wrappers

parent 3b02727d
No related branches found
No related tags found
No related merge requests found
......@@ -198,7 +198,7 @@ slurm_auth_get_arg_desc( void )
return auth_args;
}
void **
static void **
slurm_auth_marshal_args( void *hosts, int timeout )
{
static int hostlist_idx = -1;
......@@ -225,12 +225,6 @@ slurm_auth_marshal_args( void *hosts, int timeout )
}
void slurm_auth_free_args( void **argv )
{
xfree( argv );
}
slurm_auth_context_t
slurm_auth_context_create( const char *auth_type )
{
......@@ -346,12 +340,21 @@ slurm_auth_init( void )
*/
void *
g_slurm_auth_create( void *argv[] )
g_slurm_auth_create( void *hosts, int timeout )
{
void **argv;
void *ret;
if ( slurm_auth_init() < 0 )
return NULL;
return (*(g_context->ops.create))( argv );
if ( ( argv = slurm_auth_marshal_args( hosts, timeout ) ) == NULL ) {
return NULL;
}
ret = (*(g_context->ops.create))( argv );
xfree( argv );
return ret;
}
int
......@@ -364,12 +367,21 @@ g_slurm_auth_destroy( void *cred )
}
int
g_slurm_auth_verify( void *cred, void *argv[] )
g_slurm_auth_verify( void *cred, void *hosts, int timeout )
{
int ret;
void **argv;
if ( slurm_auth_init() < 0 )
return SLURM_ERROR;
if ( ( argv = slurm_auth_marshal_args( hosts, timeout ) ) == NULL ) {
return SLURM_ERROR;
}
return (*(g_context->ops.verify))( cred, argv );
ret = (*(g_context->ops.verify))( cred, argv );
xfree( argv );
return ret;
}
uid_t
......
......@@ -95,17 +95,6 @@ enum {
*/
const arg_desc_t *slurm_auth_get_arg_desc( void );
/*
* Marshal the arguments into a generic argument vector according to
* the authentication argument layout.
*/
void **slurm_auth_marshal_args( void *hosts, int timeout );
/*
* Free an argument list created by slurm_auth_marshal_args().
*/
void slurm_auth_free_args( void **args );
/*
* SLURM authentication context opaque type.
*/
......@@ -142,9 +131,9 @@ int slurm_auth_init( void );
/*
* Static bindings for the global authentication context.
*/
void *g_slurm_auth_create( void *argv[] );
void *g_slurm_auth_create( void *hosts, int timeout );
int g_slurm_auth_destroy( void *cred );
int g_slurm_auth_verify( void *cred, void *argv[] );
int g_slurm_auth_verify( void *cred, void *hosts, int timeout );
uid_t g_slurm_auth_get_uid( void *cred );
gid_t g_slurm_auth_get_gid( void *cred );
int g_slurm_auth_pack( void *cred, Buf buf );
......
......@@ -334,7 +334,6 @@ int slurm_receive_msg(slurm_fd open_fd, slurm_msg_t * msg)
int rc;
void *auth_cred;
Buf buffer;
void **argv;
buftemp = xmalloc(SLURM_PROTOCOL_MAX_MESSAGE_BUFFER_SIZE);
if ((rc = _slurm_msg_recvfrom(open_fd, buftemp,
......@@ -366,14 +365,7 @@ int slurm_receive_msg(slurm_fd open_fd, slurm_msg_t * msg)
}
/* verify credentials */
argv = slurm_auth_marshal_args( NULL, 2 );
if ( argv == NULL ) {
(void) g_slurm_auth_destroy( auth_cred );
free_buf( buffer );
slurm_seterrno_ret( SLURM_PROTOCOL_AUTHENTICATION_ERROR );
}
rc = g_slurm_auth_verify( auth_cred, argv );
slurm_auth_free_args( argv );
rc = g_slurm_auth_verify( auth_cred, NULL, 2 );
if ( rc != SLURM_SUCCESS) {
error( "authentication: %s ",
g_slurm_auth_errstr( g_slurm_auth_errno( auth_cred ) ) );
......@@ -439,16 +431,9 @@ int slurm_send_node_msg(slurm_fd open_fd, slurm_msg_t * msg)
unsigned int msg_len, tmp_len;
Buf buffer;
void *auth_cred;
void **argv;
/* initialize header */
argv = slurm_auth_marshal_args( NULL, 1 );
if ( argv == NULL ) {
error( "cannot marshal arguments to create credential" );
return SLURM_PROTOCOL_AUTHENTICATION_ERROR;
}
auth_cred = g_slurm_auth_create( argv );
slurm_auth_free_args( argv );
auth_cred = g_slurm_auth_create( NULL, 2 );
if ( auth_cred == NULL ) {
error( "authentication: %s",
g_slurm_auth_errstr( g_slurm_auth_errno( NULL ) ) );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment