Skip to content
Snippets Groups Projects
Commit 01990ef6 authored by Moe Jette's avatar Moe Jette
Browse files

Minor changes in logic to support possibility of uid_t being other than 32 bits.

parent a5b0cfb1
No related branches found
No related tags found
No related merge requests found
...@@ -385,8 +385,8 @@ slurm_auth_pack( slurm_auth_credential_t *cred, Buf buf ) ...@@ -385,8 +385,8 @@ slurm_auth_pack( slurm_auth_credential_t *cred, Buf buf )
packmem( (char *) plugin_type, strlen( plugin_type ) + 1, buf ); packmem( (char *) plugin_type, strlen( plugin_type ) + 1, buf );
pack32( plugin_version, buf ); pack32( plugin_version, buf );
pack32( cred->cred.uid, buf ); pack32( (uint32_t) cred->cred.uid, buf );
pack32( cred->cred.gid, buf ); pack32( (uint32_t) cred->cred.gid, buf );
pack_time( cred->cred.valid_from, buf ); pack_time( cred->cred.valid_from, buf );
pack_time( cred->cred.valid_to, buf ); pack_time( cred->cred.valid_to, buf );
packmem( cred->sig.data, sig_size, buf ); packmem( cred->sig.data, sig_size, buf );
...@@ -400,7 +400,7 @@ slurm_auth_unpack( Buf buf ) ...@@ -400,7 +400,7 @@ slurm_auth_unpack( Buf buf )
{ {
slurm_auth_credential_t *cred; slurm_auth_credential_t *cred;
uint16_t sig_size; /* ignored */ uint16_t sig_size; /* ignored */
uint32_t version; uint32_t version, tmpint;
char *data; char *data;
if ( buf == NULL ) { if ( buf == NULL ) {
...@@ -433,14 +433,16 @@ slurm_auth_unpack( Buf buf ) ...@@ -433,14 +433,16 @@ slurm_auth_unpack( Buf buf )
xmalloc( sizeof( slurm_auth_credential_t ) ); xmalloc( sizeof( slurm_auth_credential_t ) );
cred->cr_errno = SLURM_SUCCESS; cred->cr_errno = SLURM_SUCCESS;
if ( unpack32( &cred->cred.uid, buf ) != SLURM_SUCCESS ) { if ( unpack32( &tmpint, buf ) != SLURM_SUCCESS ) {
plugin_errno = SLURM_AUTH_UNPACK; plugin_errno = SLURM_AUTH_UNPACK;
goto unpack_error; goto unpack_error;
} }
if ( unpack32( &cred->cred.gid, buf ) != SLURM_SUCCESS ) { cred->cred.uid = tmpint;
if ( unpack32( &tmpint, buf ) != SLURM_SUCCESS ) {
plugin_errno = SLURM_AUTH_UNPACK; plugin_errno = SLURM_AUTH_UNPACK;
goto unpack_error; goto unpack_error;
} }
cred->cred.gid = tmpint;
if ( unpack_time( &cred->cred.valid_from, buf ) != SLURM_SUCCESS ) { if ( unpack_time( &cred->cred.valid_from, buf ) != SLURM_SUCCESS ) {
plugin_errno = SLURM_AUTH_UNPACK; plugin_errno = SLURM_AUTH_UNPACK;
goto unpack_error; goto unpack_error;
...@@ -472,8 +474,8 @@ slurm_auth_print( slurm_auth_credential_t *cred, FILE *fp ) ...@@ -472,8 +474,8 @@ slurm_auth_print( slurm_auth_credential_t *cred, FILE *fp )
} }
verbose( "BEGIN AUTHD CREDENTIAL\n" ); verbose( "BEGIN AUTHD CREDENTIAL\n" );
verbose( " UID: %d", cred->cred.uid ); verbose( " UID: %u", cred->cred.uid );
verbose( " GID: %d", cred->cred.gid ); verbose( " GID: %u", cred->cred.gid );
verbose( " Valid from: %s", ctime( &cred->cred.valid_from ) ); verbose( " Valid from: %s", ctime( &cred->cred.valid_from ) );
verbose( " Valid to: %s", ctime( &cred->cred.valid_to ) ); verbose( " Valid to: %s", ctime( &cred->cred.valid_to ) );
verbose( " Signature: 0x%02x%02x%02x%02x ...\n", verbose( " Signature: 0x%02x%02x%02x%02x ...\n",
......
...@@ -254,8 +254,8 @@ slurm_auth_pack( slurm_auth_credential_t *cred, Buf buf ) ...@@ -254,8 +254,8 @@ slurm_auth_pack( slurm_auth_credential_t *cred, Buf buf )
/* /*
* Pack the data values. * Pack the data values.
*/ */
pack32( cred->uid, buf ); pack32( (uint32_t) cred->uid, buf );
pack32( cred->gid, buf ); pack32( (uint32_t) cred->gid, buf );
return SLURM_SUCCESS; return SLURM_SUCCESS;
} }
...@@ -269,7 +269,7 @@ slurm_auth_unpack( Buf buf ) ...@@ -269,7 +269,7 @@ slurm_auth_unpack( Buf buf )
{ {
slurm_auth_credential_t *cred; slurm_auth_credential_t *cred;
char *tmpstr; char *tmpstr;
int32_t tmpint; uint32_t tmpint;
uint32_t version; uint32_t version;
uint16_t size; uint16_t size;
...@@ -341,8 +341,8 @@ slurm_auth_print( slurm_auth_credential_t *cred, FILE *fp ) ...@@ -341,8 +341,8 @@ slurm_auth_print( slurm_auth_credential_t *cred, FILE *fp )
} }
printf( "BEGIN SLURM BASIC AUTHENTICATION CREDENTIAL\n" ); printf( "BEGIN SLURM BASIC AUTHENTICATION CREDENTIAL\n" );
printf( "\tUID = %d\n", cred->uid ); printf( "\tUID = %u\n", cred->uid );
printf( "\tGID = %d\n", cred->gid ); printf( "\tGID = %u\n", cred->gid );
printf( "END SLURM BASIC AUTHENTICATION CREDENTIAL\n" ); printf( "END SLURM BASIC AUTHENTICATION CREDENTIAL\n" );
return SLURM_SUCCESS; return SLURM_SUCCESS;
......
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