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

Add plugin version to pack/unpack

parent 9273da53
No related branches found
No related tags found
No related merge requests found
...@@ -288,11 +288,12 @@ slurm_auth_pack( slurm_auth_credential_t *cred, Buf buf ) ...@@ -288,11 +288,12 @@ slurm_auth_pack( slurm_auth_credential_t *cred, Buf buf )
if ( ( cred == NULL ) || ( buf == NULL ) ) return; if ( ( cred == NULL ) || ( buf == NULL ) ) return;
/* /*
* Marshall the plugin type for runtime sanity check. * Marshall the plugin type and version for runtime sanity check.
* Add the terminating zero so we get it for free at the * Add the terminating zero so we get it for free at the
* other end. * other end.
*/ */
packmem( (char *) plugin_type, strlen( plugin_type ) + 1, buf ); packmem( (char *) plugin_type, strlen( plugin_type ) + 1, buf );
pack32( plugin_version, buf );
pack32( cred->cred.uid, buf ); pack32( cred->cred.uid, buf );
pack32( cred->cred.gid, buf ); pack32( cred->cred.gid, buf );
...@@ -306,6 +307,7 @@ int ...@@ -306,6 +307,7 @@ int
slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf ) slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf )
{ {
uint16_t sig_size; /* ignored */ uint16_t sig_size; /* ignored */
uint32_t version;
char *data; char *data;
if ( ( cred == NULL) || ( buf == NULL ) ) if ( ( cred == NULL) || ( buf == NULL ) )
...@@ -317,6 +319,7 @@ slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf ) ...@@ -317,6 +319,7 @@ slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf )
error( "authd plugin: authentication mismatch, got %s", data ); error( "authd plugin: authentication mismatch, got %s", data );
return SLURM_ERROR; return SLURM_ERROR;
} }
unpack32( &version, buf );
unpack32( &cred->cred.uid, buf ); unpack32( &cred->cred.uid, buf );
unpack32( &cred->cred.gid, buf ); unpack32( &cred->cred.gid, buf );
......
...@@ -264,6 +264,7 @@ slurm_auth_pack( slurm_auth_credential_t *cred, Buf buf ) ...@@ -264,6 +264,7 @@ slurm_auth_pack( slurm_auth_credential_t *cred, Buf buf )
* type so that it can be sanity-checked at the receiving end. * type so that it can be sanity-checked at the receiving end.
*/ */
packstr( (char *) plugin_type, buf ); packstr( (char *) plugin_type, buf );
pack32( plugin_version, buf );
/* /*
* Pack the data. * Pack the data.
*/ */
...@@ -278,8 +279,9 @@ int ...@@ -278,8 +279,9 @@ int
slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf ) slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf )
{ {
char *type; char *type;
char *m; char *m;
uint16_t size; uint16_t size;
uint32_t version;
if ((cred == NULL) || (buf == NULL)) { if ((cred == NULL) || (buf == NULL)) {
error("malformed slurm_auth_unpack call in auth/munge plugin"); error("malformed slurm_auth_unpack call in auth/munge plugin");
...@@ -298,6 +300,9 @@ slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf ) ...@@ -298,6 +300,9 @@ slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf )
error( "plugin expected 'auth/munge' and got '%s'", type ); error( "plugin expected 'auth/munge' and got '%s'", type );
return SLURM_ERROR; return SLURM_ERROR;
} }
if ( unpack32( &version, buf ) != SLURM_SUCCESS ) {
return SLURM_ERROR;
}
if (unpackmem_ptr(&m, &size, buf) < 0) { if (unpackmem_ptr(&m, &size, buf) < 0) {
error("error retrieving munge cred in auth/munge plugin"); error("error retrieving munge cred in auth/munge plugin");
......
...@@ -237,6 +237,7 @@ slurm_auth_pack( slurm_auth_credential_t *cred, Buf buf ) ...@@ -237,6 +237,7 @@ slurm_auth_pack( slurm_auth_credential_t *cred, Buf buf )
* type so that it can be sanity-checked at the receiving end. * type so that it can be sanity-checked at the receiving end.
*/ */
packmem( (char *) plugin_type, strlen( plugin_type ) + 1, buf ); packmem( (char *) plugin_type, strlen( plugin_type ) + 1, buf );
pack32( plugin_version, buf );
/* /*
* Pack the data values. * Pack the data values.
*/ */
...@@ -253,6 +254,7 @@ slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf ) ...@@ -253,6 +254,7 @@ slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf )
{ {
char *tmpstr; char *tmpstr;
int32_t tmpint; int32_t tmpint;
uint32_t version;
uint16_t size; uint16_t size;
if ( ( cred == NULL ) || ( buf == NULL ) ) { if ( ( cred == NULL ) || ( buf == NULL ) ) {
...@@ -272,6 +274,7 @@ slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf ) ...@@ -272,6 +274,7 @@ slurm_auth_unpack( slurm_auth_credential_t *cred, Buf buf )
error( "plugin expected 'auth/none' and got '%s'", tmpstr ); error( "plugin expected 'auth/none' and got '%s'", tmpstr );
return SLURM_ERROR; return SLURM_ERROR;
} }
if ( unpack32( &version, buf ) != SLURM_SUCCESS ) return SLURM_ERROR;
/* /*
* We do it the hard way because we don't know anything about the * We do it the hard way because we don't know anything about the
......
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