idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
12,900 | bool ContainerChunk::removeValue( XMP_Uns32 id )
{
valueMap* cm = &this->childmap;
valueMapIter iter = cm->find( id );
if( iter == cm->end() )
return false; //not found
ValueChunk* propChunk = iter->second;
chunkVect* cv = &this->children;
chunkVectIter cvIter;
for (cvIter = cv->begin(); cvIter != cv->end(); ++cvIter )
{
if ( (*cvIter)->id == id )
break; // found!
}
XMP_Validate( cvIter != cv->end(), "property not found in children vector", kXMPErr_InternalFailure );
cv->erase( cvIter );
cm->erase( iter );
delete propChunk;
return true; // found and removed
}
| DoS Overflow | 0 | bool ContainerChunk::removeValue( XMP_Uns32 id )
{
valueMap* cm = &this->childmap;
valueMapIter iter = cm->find( id );
if( iter == cm->end() )
return false; //not found
ValueChunk* propChunk = iter->second;
chunkVect* cv = &this->children;
chunkVectIter cvIter;
for (cvIter = cv->begin(); cvIter != cv->end(); ++cvIter )
{
if ( (*cvIter)->id == id )
break; // found!
}
XMP_Validate( cvIter != cv->end(), "property not found in children vector", kXMPErr_InternalFailure );
cv->erase( cvIter );
cm->erase( iter );
delete propChunk;
return true; // found and removed
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,901 | void ContainerChunk::replaceChildWithJunk( Chunk* child, bool deleteChild )
{
chunkVectIter iter = getChild( child );
if ( iter == this->children.end() ) {
throw new XMP_Error(kXMPErr_InternalFailure, "replaceChildWithJunk: childChunk not found.");
}
*iter = new JunkChunk ( NULL, child->oldSize );
if ( deleteChild ) delete child;
this->hasChange = true;
}
| DoS Overflow | 0 | void ContainerChunk::replaceChildWithJunk( Chunk* child, bool deleteChild )
{
chunkVectIter iter = getChild( child );
if ( iter == this->children.end() ) {
throw new XMP_Error(kXMPErr_InternalFailure, "replaceChildWithJunk: childChunk not found.");
}
*iter = new JunkChunk ( NULL, child->oldSize );
if ( deleteChild ) delete child;
this->hasChange = true;
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,902 | std::string Chunk::toString(XMP_Uns8 level )
{
char buffer[256];
snprintf( buffer, 255, "%.4s -- "
"oldSize: 0x%.8llX, "
"newSize: 0x%.8llX, "
"oldPos: 0x%.8llX\n",
(char*)(&this->id), this->oldSize, this->newSize, this->oldPos );
return std::string(buffer);
}
| DoS Overflow | 0 | std::string Chunk::toString(XMP_Uns8 level )
{
char buffer[256];
snprintf( buffer, 255, "%.4s -- "
"oldSize: 0x%.8llX, "
"newSize: 0x%.8llX, "
"oldPos: 0x%.8llX\n",
(char*)(&this->id), this->oldSize, this->newSize, this->oldPos );
return std::string(buffer);
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,903 | std::string ContainerChunk::toString(XMP_Uns8 level )
{
XMP_Int64 offset= 12; // compute offsets, just for informational purposes
char buffer[256];
snprintf( buffer, 255, "%.4s:%.4s, "
"oldSize: 0x%8llX, "
"newSize: 0x%.8llX, "
"oldPos: 0x%.8llX\n",
(char*)(&this->id), (char*)(&this->containerType), this->oldSize, this->newSize, this->oldPos );
std::string r(buffer);
chunkVectIter iter;
for( iter = this->children.begin(); iter != this->children.end(); iter++ )
{
char buffer[256];
snprintf( buffer, 250, "offset 0x%.8llX", offset );
r += std::string ( level*4, ' ' ) + std::string( buffer ) + ":" + (*iter)->toString( level + 1 );
offset += (*iter)->newSize;
if ( offset % 2 == 1 )
offset++;
}
return std::string(r);
}
| DoS Overflow | 0 | std::string ContainerChunk::toString(XMP_Uns8 level )
{
XMP_Int64 offset= 12; // compute offsets, just for informational purposes
char buffer[256];
snprintf( buffer, 255, "%.4s:%.4s, "
"oldSize: 0x%8llX, "
"newSize: 0x%.8llX, "
"oldPos: 0x%.8llX\n",
(char*)(&this->id), (char*)(&this->containerType), this->oldSize, this->newSize, this->oldPos );
std::string r(buffer);
chunkVectIter iter;
for( iter = this->children.begin(); iter != this->children.end(); iter++ )
{
char buffer[256];
snprintf( buffer, 250, "offset 0x%.8llX", offset );
r += std::string ( level*4, ' ' ) + std::string( buffer ) + ":" + (*iter)->toString( level + 1 );
offset += (*iter)->newSize;
if ( offset % 2 == 1 )
offset++;
}
return std::string(r);
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,904 | void ContainerChunk::write( RIFF_MetaHandler* handler, XMP_IO* file, bool isMainChunk )
{
if ( isMainChunk )
file ->Rewind();
XMP_Int64 chunkStart = file->Offset();
XMP_Int64 chunkEnd = chunkStart + this->newSize;
XMP_Enforce( chunkStart % 2 == 0 );
chunkVect *rc = &this->children;
XMP_Int64 childStart = chunkEnd;
for ( XMP_Int32 chunkNo = (XMP_Int32)(rc->size() -1); chunkNo >= 0; chunkNo-- )
{
Chunk* cur = rc->at(chunkNo);
if ( cur->newSize % 2 == 1 )
{
childStart--;
file->Seek ( childStart, kXMP_SeekFromStart );
XIO::WriteUns8( file, 0 );
}
childStart-= cur->newSize;
file->Seek ( childStart, kXMP_SeekFromStart );
switch ( cur->chunkType )
{
case chunk_GENERAL: //COULDDO enfore no change, since not write-out-able
if ( cur->oldPos != childStart )
XIO::Move( file, cur->oldPos, file, childStart, cur->oldSize );
break;
default:
cur->write( handler, file, false );
break;
} // switch
} // for
XMP_Enforce ( chunkStart + 12 == childStart);
file->Seek ( chunkStart, kXMP_SeekFromStart );
XIO::WriteUns32_LE( file, this->id );
XIO::WriteUns32_LE( file, (XMP_Uns32) this->newSize - 8 ); // validated in changesAndSize() above
XIO::WriteUns32_LE( file, this->containerType );
}
| DoS Overflow | 0 | void ContainerChunk::write( RIFF_MetaHandler* handler, XMP_IO* file, bool isMainChunk )
{
if ( isMainChunk )
file ->Rewind();
XMP_Int64 chunkStart = file->Offset();
XMP_Int64 chunkEnd = chunkStart + this->newSize;
XMP_Enforce( chunkStart % 2 == 0 );
chunkVect *rc = &this->children;
XMP_Int64 childStart = chunkEnd;
for ( XMP_Int32 chunkNo = (XMP_Int32)(rc->size() -1); chunkNo >= 0; chunkNo-- )
{
Chunk* cur = rc->at(chunkNo);
if ( cur->newSize % 2 == 1 )
{
childStart--;
file->Seek ( childStart, kXMP_SeekFromStart );
XIO::WriteUns8( file, 0 );
}
childStart-= cur->newSize;
file->Seek ( childStart, kXMP_SeekFromStart );
switch ( cur->chunkType )
{
case chunk_GENERAL: //COULDDO enfore no change, since not write-out-able
if ( cur->oldPos != childStart )
XIO::Move( file, cur->oldPos, file, childStart, cur->oldSize );
break;
default:
cur->write( handler, file, false );
break;
} // switch
} // for
XMP_Enforce ( chunkStart + 12 == childStart);
file->Seek ( chunkStart, kXMP_SeekFromStart );
XIO::WriteUns32_LE( file, this->id );
XIO::WriteUns32_LE( file, (XMP_Uns32) this->newSize - 8 ); // validated in changesAndSize() above
XIO::WriteUns32_LE( file, this->containerType );
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,905 | void XMPChunk::write( RIFF_MetaHandler* handler, XMP_IO* file, bool isMainChunk )
{
XIO::WriteUns32_LE( file, kChunk_XMP );
XIO::WriteUns32_LE( file, (XMP_Uns32) this->newSize - 8 ); // validated in changesAndSize() above
file->Write ( handler->xmpPacket.data(), (XMP_Int32)handler->xmpPacket.size() );
}
| DoS Overflow | 0 | void XMPChunk::write( RIFF_MetaHandler* handler, XMP_IO* file, bool isMainChunk )
{
XIO::WriteUns32_LE( file, kChunk_XMP );
XIO::WriteUns32_LE( file, (XMP_Uns32) this->newSize - 8 ); // validated in changesAndSize() above
file->Write ( handler->xmpPacket.data(), (XMP_Int32)handler->xmpPacket.size() );
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,906 | void ValueChunk::write( RIFF_MetaHandler* handler, XMP_IO* file, bool isMainChunk )
{
XIO::WriteUns32_LE( file, this->id );
XIO::WriteUns32_LE( file, (XMP_Uns32)this->newSize - 8 );
file->Write ( this->newValue.data() , (XMP_Int32)this->newSize - 8 );
}
| DoS Overflow | 0 | void ValueChunk::write( RIFF_MetaHandler* handler, XMP_IO* file, bool isMainChunk )
{
XIO::WriteUns32_LE( file, this->id );
XIO::WriteUns32_LE( file, (XMP_Uns32)this->newSize - 8 );
file->Write ( this->newValue.data() , (XMP_Int32)this->newSize - 8 );
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,907 | void JunkChunk::write( RIFF_MetaHandler* handler, XMP_IO* file, bool isMainChunk )
{
XIO::WriteUns32_LE( file, kChunk_JUNK ); // write JUNK, never JUNQ
XMP_Enforce( this->newSize < 0xFFFFFFFF );
XMP_Enforce( this->newSize >= 8 ); // minimum size of any chunk
XMP_Uns32 innerSize = (XMP_Uns32)this->newSize - 8;
XIO::WriteUns32_LE( file, innerSize );
while ( innerSize > kZeroBufferSize64K )
{
file->Write ( kZeroes64K , kZeroBufferSize64K );
innerSize -= kZeroBufferSize64K;
}
file->Write ( kZeroes64K , innerSize );
}
| DoS Overflow | 0 | void JunkChunk::write( RIFF_MetaHandler* handler, XMP_IO* file, bool isMainChunk )
{
XIO::WriteUns32_LE( file, kChunk_JUNK ); // write JUNK, never JUNQ
XMP_Enforce( this->newSize < 0xFFFFFFFF );
XMP_Enforce( this->newSize >= 8 ); // minimum size of any chunk
XMP_Uns32 innerSize = (XMP_Uns32)this->newSize - 8;
XIO::WriteUns32_LE( file, innerSize );
while ( innerSize > kZeroBufferSize64K )
{
file->Write ( kZeroes64K , kZeroBufferSize64K );
innerSize -= kZeroBufferSize64K;
}
file->Write ( kZeroes64K , innerSize );
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,908 | ContainerChunk::~ContainerChunk()
{
this->release(); // free resources
}
| DoS Overflow | 0 | ContainerChunk::~ContainerChunk()
{
this->release(); // free resources
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,909 | cdio_add_device_list(char **device_list[], const char *drive,
unsigned int *num_drives)
{
if (NULL != drive) {
unsigned int j;
char real_device_1[PATH_MAX];
char real_device_2[PATH_MAX];
cdio_realpath(drive, real_device_1);
/* Check if drive is already in list. */
for (j=0; j<*num_drives; j++) {
cdio_realpath((*device_list)[j], real_device_2);
if (strcmp(real_device_1, real_device_2) == 0) break;
}
if (j==*num_drives) {
/* Drive not in list. Add it. */
(*num_drives)++;
*device_list = realloc(*device_list, (*num_drives) * sizeof(char *));
cdio_debug("Adding drive %s to list of devices", drive);
(*device_list)[*num_drives-1] = strdup(drive);
}
} else {
(*num_drives)++;
if (*device_list) {
*device_list = realloc(*device_list, (*num_drives) * sizeof(char *));
} else {
*device_list = malloc((*num_drives) * sizeof(char *));
}
cdio_debug("Adding NULL to end of drive list of size %d", (*num_drives)-1);
(*device_list)[*num_drives-1] = NULL;
}
}
| null | 0 | cdio_add_device_list(char **device_list[], const char *drive,
unsigned int *num_drives)
{
if (NULL != drive) {
unsigned int j;
char real_device_1[PATH_MAX];
char real_device_2[PATH_MAX];
cdio_realpath(drive, real_device_1);
/* Check if drive is already in list. */
for (j=0; j<*num_drives; j++) {
cdio_realpath((*device_list)[j], real_device_2);
if (strcmp(real_device_1, real_device_2) == 0) break;
}
if (j==*num_drives) {
/* Drive not in list. Add it. */
(*num_drives)++;
*device_list = realloc(*device_list, (*num_drives) * sizeof(char *));
cdio_debug("Adding drive %s to list of devices", drive);
(*device_list)[*num_drives-1] = strdup(drive);
}
} else {
(*num_drives)++;
if (*device_list) {
*device_list = realloc(*device_list, (*num_drives) * sizeof(char *));
} else {
*device_list = malloc((*num_drives) * sizeof(char *));
}
cdio_debug("Adding NULL to end of drive list of size %d", (*num_drives)-1);
(*device_list)[*num_drives-1] = NULL;
}
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,910 | cdio_generic_free (void *p_user_data)
{
generic_img_private_t *p_env = p_user_data;
if (NULL == p_env) return;
if (p_env->source_name) free (p_env->source_name);
if (NULL != p_env->cdtext) {
cdtext_destroy(p_env->cdtext);
p_env->cdtext = NULL;
}
if (p_env->fd >= 0)
close (p_env->fd);
if (p_env->scsi_tuple != NULL)
free (p_env->scsi_tuple);
free (p_env);
}
| null | 0 | cdio_generic_free (void *p_user_data)
{
generic_img_private_t *p_env = p_user_data;
if (NULL == p_env) return;
if (p_env->source_name) free (p_env->source_name);
if (NULL != p_env->cdtext) {
cdtext_destroy(p_env->cdtext);
p_env->cdtext = NULL;
}
if (p_env->fd >= 0)
close (p_env->fd);
if (p_env->scsi_tuple != NULL)
free (p_env->scsi_tuple);
free (p_env);
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,911 | cdio_generic_init (void *user_data, int open_flags)
{
generic_img_private_t *p_env = user_data;
if (p_env->init) {
cdio_warn ("init called more than once");
return false;
}
p_env->fd = open (p_env->source_name, open_flags, 0);
if (p_env->fd < 0)
{
cdio_warn ("open (%s): %s", p_env->source_name, strerror (errno));
return false;
}
p_env->init = true;
p_env->toc_init = false;
p_env->cdtext = NULL;
p_env->scsi_tuple = NULL;
p_env->b_cdtext_error = false;
p_env->u_joliet_level = 0; /* Assume no Joliet extensions initally */
return true;
}
| null | 0 | cdio_generic_init (void *user_data, int open_flags)
{
generic_img_private_t *p_env = user_data;
if (p_env->init) {
cdio_warn ("init called more than once");
return false;
}
p_env->fd = open (p_env->source_name, open_flags, 0);
if (p_env->fd < 0)
{
cdio_warn ("open (%s): %s", p_env->source_name, strerror (errno));
return false;
}
p_env->init = true;
p_env->toc_init = false;
p_env->cdtext = NULL;
p_env->scsi_tuple = NULL;
p_env->b_cdtext_error = false;
p_env->u_joliet_level = 0; /* Assume no Joliet extensions initally */
return true;
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,912 | cdio_generic_read (void *user_data, void *buf, size_t size)
{
generic_img_private_t *p_env = user_data;
return read(p_env->fd, buf, size);
}
| null | 0 | cdio_generic_read (void *user_data, void *buf, size_t size)
{
generic_img_private_t *p_env = user_data;
return read(p_env->fd, buf, size);
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,913 | cdio_generic_read_form1_sector (void * user_data, void *data, lsn_t lsn)
{
if (0 > cdio_generic_lseek(user_data, CDIO_CD_FRAMESIZE*lsn, SEEK_SET))
return DRIVER_OP_ERROR;
return cdio_generic_read(user_data, data, CDIO_CD_FRAMESIZE);
}
| null | 0 | cdio_generic_read_form1_sector (void * user_data, void *data, lsn_t lsn)
{
if (0 > cdio_generic_lseek(user_data, CDIO_CD_FRAMESIZE*lsn, SEEK_SET))
return DRIVER_OP_ERROR;
return cdio_generic_read(user_data, data, CDIO_CD_FRAMESIZE);
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,914 | cdio_generic_stdio_free (void *p_user_data)
{
generic_img_private_t *p_env = p_user_data;
if (NULL == p_env) return;
if (NULL != p_env->source_name)
free (p_env->source_name);
if (p_env->data_source)
cdio_stdio_destroy (p_env->data_source);
}
| null | 0 | cdio_generic_stdio_free (void *p_user_data)
{
generic_img_private_t *p_env = p_user_data;
if (NULL == p_env) return;
if (NULL != p_env->source_name)
free (p_env->source_name);
if (p_env->data_source)
cdio_stdio_destroy (p_env->data_source);
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,915 | cdio_generic_unimplemented_eject_media (void *p_user_data) {
/* Sort of a stub here. Perhaps log a message? */
return DRIVER_OP_UNSUPPORTED;
}
| null | 0 | cdio_generic_unimplemented_eject_media (void *p_user_data) {
/* Sort of a stub here. Perhaps log a message? */
return DRIVER_OP_UNSUPPORTED;
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,916 | cdio_generic_unimplemented_set_blocksize (void *p_user_data,
uint16_t i_blocksize) {
/* Sort of a stub here. Perhaps log a message? */
return DRIVER_OP_UNSUPPORTED;
}
| null | 0 | cdio_generic_unimplemented_set_blocksize (void *p_user_data,
uint16_t i_blocksize) {
/* Sort of a stub here. Perhaps log a message? */
return DRIVER_OP_UNSUPPORTED;
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,917 | cdio_generic_unimplemented_set_speed (void *p_user_data, int i_speed) {
/* Sort of a stub here. Perhaps log a message? */
return DRIVER_OP_UNSUPPORTED;
}
| null | 0 | cdio_generic_unimplemented_set_speed (void *p_user_data, int i_speed) {
/* Sort of a stub here. Perhaps log a message? */
return DRIVER_OP_UNSUPPORTED;
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,918 | cdio_is_device_generic(const char *source_name)
{
struct stat buf;
if (0 != stat(source_name, &buf)) {
cdio_warn ("Can't get file status for %s:\n%s", source_name,
strerror(errno));
return false;
}
return (S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode));
}
| null | 0 | cdio_is_device_generic(const char *source_name)
{
struct stat buf;
if (0 != stat(source_name, &buf)) {
cdio_warn ("Can't get file status for %s:\n%s", source_name,
strerror(errno));
return false;
}
return (S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode));
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,919 | cdio_is_device_quiet_generic(const char *source_name)
{
struct stat buf;
if (0 != stat(source_name, &buf)) {
return false;
}
return (S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode));
}
| null | 0 | cdio_is_device_quiet_generic(const char *source_name)
{
struct stat buf;
if (0 != stat(source_name, &buf)) {
return false;
}
return (S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode));
}
| @@ -296,7 +296,6 @@ get_cdtext_generic (void *p_user_data)
if(len <= 0 || 0 != cdtext_data_init (p_env->cdtext, &p_cdtext_data[4], len)) {
p_env->b_cdtext_error = true;
- cdtext_destroy (p_env->cdtext);
free(p_env->cdtext);
p_env->cdtext = NULL;
} | CWE-415 | null | null |
12,920 | int session_activate(Session *s) {
int r;
assert(s);
if (s->vtnr < 0)
return -ENOTSUP;
if (!s->seat)
return -ENOTSUP;
if (s->seat->active == s)
return 0;
assert(seat_is_vtconsole(s->seat));
r = chvt(s->vtnr);
if (r < 0)
return r;
return seat_set_active(s->seat, s);
}
| null | 0 | int session_activate(Session *s) {
int r;
assert(s);
if (s->vtnr < 0)
return -ENOTSUP;
if (!s->seat)
return -ENOTSUP;
if (s->seat->active == s)
return 0;
assert(seat_is_vtconsole(s->seat));
r = chvt(s->vtnr);
if (r < 0)
return r;
return seat_set_active(s->seat, s);
}
| @@ -376,15 +376,13 @@ static int session_link_x11_socket(Session *s) {
return -ENOENT;
}
- t = strappend(s->user->runtime_path, "/X11/display");
+ t = strappend(s->user->runtime_path, "/X11-display");
if (!t) {
log_error("Out of memory");
free(f);
return -ENOMEM;
}
- mkdir_parents(t, 0755);
-
if (link(f, t) < 0) {
if (errno == EEXIST) {
unlink(t);
@@ -637,7 +635,7 @@ static int session_unlink_x11_socket(Session *s) {
s->user->display = NULL;
- t = strappend(s->user->runtime_path, "/X11/display");
+ t = strappend(s->user->runtime_path, "/X11-display");
if (!t) {
log_error("Out of memory");
return -ENOMEM; | CWE-59 | null | null |
12,921 | CheckCredentials () {
CredentialWrapper * pCred;
credentials.Rewind();
dprintf (D_FULLDEBUG, "In CheckCredentials()\n");
time_t now = time(NULL);
while (credentials.Next(pCred)) {
init_user_id_from_FQN (pCred->cred->GetOwner());
priv_state priv = set_user_priv();
time_t time = pCred->cred->GetRealExpirationTime();
dprintf (D_FULLDEBUG, "Checking %s:%s = %ld\n",
pCred->cred->GetOwner(),
pCred->cred->GetName(),
time);
if (time - now < 0) {
dprintf (D_FULLDEBUG, "Credential %s:%s expired!\n",
pCred->cred->GetOwner(),
pCred->cred->GetName());
}
else if (time - now < default_cred_expire_threshold) {
dprintf (D_FULLDEBUG, "Credential %s:%s about to expire\n",
pCred->cred->GetOwner(),
pCred->cred->GetName());
if (pCred->cred->GetType() == X509_CREDENTIAL_TYPE) {
RefreshProxyThruMyProxy ((X509CredentialWrapper*)pCred);
}
}
set_priv (priv); // restore old priv
}
}
| DoS Exec Code | 0 | CheckCredentials () {
CredentialWrapper * pCred;
credentials.Rewind();
dprintf (D_FULLDEBUG, "In CheckCredentials()\n");
time_t now = time(NULL);
while (credentials.Next(pCred)) {
init_user_id_from_FQN (pCred->cred->GetOwner());
priv_state priv = set_user_priv();
time_t time = pCred->cred->GetRealExpirationTime();
dprintf (D_FULLDEBUG, "Checking %s:%s = %ld\n",
pCred->cred->GetOwner(),
pCred->cred->GetName(),
time);
if (time - now < 0) {
dprintf (D_FULLDEBUG, "Credential %s:%s expired!\n",
pCred->cred->GetOwner(),
pCred->cred->GetName());
}
else if (time - now < default_cred_expire_threshold) {
dprintf (D_FULLDEBUG, "Credential %s:%s about to expire\n",
pCred->cred->GetOwner(),
pCred->cred->GetName());
if (pCred->cred->GetType() == X509_CREDENTIAL_TYPE) {
RefreshProxyThruMyProxy ((X509CredentialWrapper*)pCred);
}
}
set_priv (priv); // restore old priv
}
}
| @@ -263,7 +263,7 @@ get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name);
@@ -455,7 +455,7 @@ rm_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name); | CWE-134 | null | null |
12,922 | Init() {
char * tmp = param( "CRED_SUPER_USERS" );
if( tmp ) {
super_users.initializeFromString( tmp );
free( tmp );
} else {
#if defined(WIN32)
super_users.initializeFromString("Administrator");
#else
super_users.initializeFromString("root");
#endif
}
char * spool = param ("SPOOL");
tmp = param ( "CRED_STORE_DIR" );
if ( tmp ) {
cred_store_dir = tmp;
} else {
cred_store_dir = dircat (spool, "cred");
}
if ( spool != NULL ) {
free (spool);
}
tmp = param ( "CRED_INDEX_FILE" );
if (tmp ) {
cred_index_file = tmp;
} else {
cred_index_file = dircat (cred_store_dir, "cred-index");
}
default_cred_expire_threshold = param_integer ("DEFAULT_CRED_EXPIRE_THRESHOLD", 3600);
CheckCredentials_interval =
param_integer (
"CRED_CHECK_INTERVAL", // param name
DEF_CRED_CHECK_INTERVAL // default value, seconds
);
struct stat stat_buff;
if (stat (cred_store_dir, &stat_buff)) {
dprintf (D_ALWAYS, "ERROR: Cred store directory %s does not exist\n", cred_store_dir);
DC_Exit (1 );
}
if (stat (cred_index_file, &stat_buff)) {
dprintf (D_ALWAYS, "Creating credential index file %s\n", cred_index_file);
priv_state priv = set_root_priv();
int fd = safe_open_wrapper_follow(cred_index_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
close (fd);
set_priv (priv);
} else {
dprintf (D_ALWAYS, "ERROR: Unable to create credential index file %s\n", cred_index_file);
set_priv (priv);
DC_Exit (1 );
}
} else {
if ((stat_buff.st_mode & (S_IRWXG | S_IRWXO)) ||
(stat_buff.st_uid != getuid())) {
dprintf (D_ALWAYS, "ERROR: Invalid ownership / permissions on credential index file %s\n",
cred_index_file);
DC_Exit (1 );
}
}
}
| DoS Exec Code | 0 | Init() {
char * tmp = param( "CRED_SUPER_USERS" );
if( tmp ) {
super_users.initializeFromString( tmp );
free( tmp );
} else {
#if defined(WIN32)
super_users.initializeFromString("Administrator");
#else
super_users.initializeFromString("root");
#endif
}
char * spool = param ("SPOOL");
tmp = param ( "CRED_STORE_DIR" );
if ( tmp ) {
cred_store_dir = tmp;
} else {
cred_store_dir = dircat (spool, "cred");
}
if ( spool != NULL ) {
free (spool);
}
tmp = param ( "CRED_INDEX_FILE" );
if (tmp ) {
cred_index_file = tmp;
} else {
cred_index_file = dircat (cred_store_dir, "cred-index");
}
default_cred_expire_threshold = param_integer ("DEFAULT_CRED_EXPIRE_THRESHOLD", 3600);
CheckCredentials_interval =
param_integer (
"CRED_CHECK_INTERVAL", // param name
DEF_CRED_CHECK_INTERVAL // default value, seconds
);
struct stat stat_buff;
if (stat (cred_store_dir, &stat_buff)) {
dprintf (D_ALWAYS, "ERROR: Cred store directory %s does not exist\n", cred_store_dir);
DC_Exit (1 );
}
if (stat (cred_index_file, &stat_buff)) {
dprintf (D_ALWAYS, "Creating credential index file %s\n", cred_index_file);
priv_state priv = set_root_priv();
int fd = safe_open_wrapper_follow(cred_index_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd != -1) {
close (fd);
set_priv (priv);
} else {
dprintf (D_ALWAYS, "ERROR: Unable to create credential index file %s\n", cred_index_file);
set_priv (priv);
DC_Exit (1 );
}
} else {
if ((stat_buff.st_mode & (S_IRWXG | S_IRWXO)) ||
(stat_buff.st_uid != getuid())) {
dprintf (D_ALWAYS, "ERROR: Invalid ownership / permissions on credential index file %s\n",
cred_index_file);
DC_Exit (1 );
}
}
}
| @@ -263,7 +263,7 @@ get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name);
@@ -455,7 +455,7 @@ rm_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name); | CWE-134 | null | null |
12,923 | int MyProxyGetDelegationReaper(Service *, int exitPid, int exitStatus)
{
dprintf (D_ALWAYS, "MyProxyGetDelegationReaper pid = %d, rc = %d\n", exitPid, exitStatus);
credentials.Rewind();
CredentialWrapper * cred_wrapper;
X509CredentialWrapper * matched_entry = NULL;
while (credentials.Next (cred_wrapper)) {
if (cred_wrapper->cred->GetType() == X509_CREDENTIAL_TYPE) {
if (((X509CredentialWrapper*)cred_wrapper)->get_delegation_pid == exitPid) {
matched_entry = (X509CredentialWrapper*)cred_wrapper;
break;
}
}
} //elihw
if (matched_entry) {
while (exitStatus != 0) {
int read_fd = matched_entry->get_delegation_err_fd; // shorthand
off_t offset = lseek(read_fd, 0, SEEK_SET); // rewind
if (offset == (off_t)-1) {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"stderr tmp file %s lseek() failed: %s\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
matched_entry->get_delegation_err_filename,
strerror(errno)
);
break;
}
struct stat statbuf;
int status = fstat(read_fd, &statbuf);
if (status == -1) {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"stderr tmp file %s fstat() failed: %s\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
matched_entry->get_delegation_err_filename,
strerror(errno)
);
break;
}
matched_entry->get_delegation_err_buff =
(char *) calloc ( statbuf.st_size + 1, sizeof(char) );
int bytes_read =
read (
read_fd,
matched_entry->get_delegation_err_buff,
statbuf.st_size
);
if (bytes_read < 0 ) {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"stderr tmp file %s read() failed: %s\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
matched_entry->get_delegation_err_filename,
strerror(errno)
);
break;
}
if ( WIFEXITED(exitStatus) ) {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"exited with status %d, output (top):\n%s\n\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
WEXITSTATUS(exitStatus),
matched_entry->get_delegation_err_buff
);
break;
} else if ( WIFSIGNALED(exitStatus) ) {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"terminated by signal %d, output (top):\n%s\n\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
WTERMSIG(exitStatus),
matched_entry->get_delegation_err_buff
);
break;
} else {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"unknown status %d, output (top):\n%s\n\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
exitStatus,
matched_entry->get_delegation_err_buff
);
break;
}
} // if exitStatus != 0
matched_entry->get_delegation_reset();
} else {
dprintf (D_ALWAYS,
"Unable to find X509Credential entry for myproxy-get-delegation pid=%d\n", exitPid);
}
return TRUE;
}
| DoS Exec Code | 0 | int MyProxyGetDelegationReaper(Service *, int exitPid, int exitStatus)
{
dprintf (D_ALWAYS, "MyProxyGetDelegationReaper pid = %d, rc = %d\n", exitPid, exitStatus);
credentials.Rewind();
CredentialWrapper * cred_wrapper;
X509CredentialWrapper * matched_entry = NULL;
while (credentials.Next (cred_wrapper)) {
if (cred_wrapper->cred->GetType() == X509_CREDENTIAL_TYPE) {
if (((X509CredentialWrapper*)cred_wrapper)->get_delegation_pid == exitPid) {
matched_entry = (X509CredentialWrapper*)cred_wrapper;
break;
}
}
} //elihw
if (matched_entry) {
while (exitStatus != 0) {
int read_fd = matched_entry->get_delegation_err_fd; // shorthand
off_t offset = lseek(read_fd, 0, SEEK_SET); // rewind
if (offset == (off_t)-1) {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"stderr tmp file %s lseek() failed: %s\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
matched_entry->get_delegation_err_filename,
strerror(errno)
);
break;
}
struct stat statbuf;
int status = fstat(read_fd, &statbuf);
if (status == -1) {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"stderr tmp file %s fstat() failed: %s\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
matched_entry->get_delegation_err_filename,
strerror(errno)
);
break;
}
matched_entry->get_delegation_err_buff =
(char *) calloc ( statbuf.st_size + 1, sizeof(char) );
int bytes_read =
read (
read_fd,
matched_entry->get_delegation_err_buff,
statbuf.st_size
);
if (bytes_read < 0 ) {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"stderr tmp file %s read() failed: %s\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
matched_entry->get_delegation_err_filename,
strerror(errno)
);
break;
}
if ( WIFEXITED(exitStatus) ) {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"exited with status %d, output (top):\n%s\n\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
WEXITSTATUS(exitStatus),
matched_entry->get_delegation_err_buff
);
break;
} else if ( WIFSIGNALED(exitStatus) ) {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"terminated by signal %d, output (top):\n%s\n\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
WTERMSIG(exitStatus),
matched_entry->get_delegation_err_buff
);
break;
} else {
dprintf (D_ALWAYS, "myproxy-get-delegation for proxy (%s, %s), "
"unknown status %d, output (top):\n%s\n\n",
matched_entry->cred->GetOwner(),
matched_entry->cred->GetName(),
exitStatus,
matched_entry->get_delegation_err_buff
);
break;
}
} // if exitStatus != 0
matched_entry->get_delegation_reset();
} else {
dprintf (D_ALWAYS,
"Unable to find X509Credential entry for myproxy-get-delegation pid=%d\n", exitPid);
}
return TRUE;
}
| @@ -263,7 +263,7 @@ get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name);
@@ -455,7 +455,7 @@ rm_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name); | CWE-134 | null | null |
12,924 | int RefreshProxyThruMyProxy(X509CredentialWrapper * proxy)
{
const char * proxy_filename = proxy->GetStorageName();
char * myproxy_host = NULL;
int status;
if (((X509Credential*)proxy->cred)->GetMyProxyServerHost() == NULL) {
dprintf (D_ALWAYS, "Skipping %s\n", proxy->cred->GetName());
return FALSE;
}
time_t now = time(NULL);
if (proxy->get_delegation_pid != GET_DELEGATION_PID_NONE) {
time_t time_started = proxy->get_delegation_proc_start_time;
if (now - time_started > 500) {
dprintf (D_FULLDEBUG, "MyProxy refresh process pid=%d still running, "
"sending signal %d\n",
proxy->get_delegation_pid, SIGKILL);
daemonCore->Send_Signal (proxy->get_delegation_pid, SIGKILL);
} else {
dprintf (D_FULLDEBUG, "MyProxy refresh process pid=%d still running, "
"letting it finish\n",
proxy->get_delegation_pid);
}
return FALSE;
}
proxy->get_delegation_proc_start_time = now;
Env myEnv;
MyString strBuff;
if (((X509Credential*)proxy->cred)->GetMyProxyServerDN()) {
strBuff="MYPROXY_SERVER_DN=";
strBuff+= ((X509Credential*)proxy->cred)->GetMyProxyServerDN();
myEnv.SetEnv (strBuff.Value());
dprintf (D_FULLDEBUG, "%s\n", strBuff.Value());
}
strBuff="X509_USER_PROXY=";
strBuff+=proxy->GetStorageName();
dprintf (D_FULLDEBUG, "%s\n", strBuff.Value());
const char * myproxy_password =((X509Credential*)proxy->cred)->GetRefreshPassword();
if (myproxy_password == NULL ) {
dprintf (D_ALWAYS, "No MyProxy password specified for %s:%s\n",
proxy->cred->GetName(),
proxy->cred->GetOwner());
myproxy_password = "";
}
status = pipe (proxy->get_delegation_password_pipe);
if (status == -1) {
dprintf (D_ALWAYS, "get_delegation pipe() failed: %s\n", strerror(errno) );
proxy->get_delegation_reset();
return FALSE;
}
write (proxy->get_delegation_password_pipe[1],
myproxy_password,
strlen (myproxy_password));
write (proxy->get_delegation_password_pipe[1], "\n", 1);
const char * username = proxy->cred->GetOrigOwner();
myproxy_host = getHostFromAddr (((X509Credential*)proxy->cred)->GetMyProxyServerHost());
int myproxy_port = getPortFromAddr (((X509Credential*)proxy->cred)->GetMyProxyServerHost());
ArgList args;
args.AppendArg("--verbose ");
args.AppendArg("--out");
args.AppendArg(proxy_filename);
args.AppendArg("--pshost");
args.AppendArg(myproxy_host);
if ( myproxy_host != NULL ) {
free ( myproxy_host );
}
args.AppendArg("--dn_as_username");
args.AppendArg("--proxy_lifetime"); // hours
args.AppendArg(6);
args.AppendArg("--stdin_pass");
args.AppendArg("--username");
args.AppendArg(username);
if (myproxy_port) {
args.AppendArg("--psport");
args.AppendArg(myproxy_port);
}
if ( ((X509Credential*)proxy->cred)->GetCredentialName() &&
( ((X509Credential*)proxy->cred)->GetCredentialName() )[0] ) {
args.AppendArg("--credname");
args.AppendArg(((X509Credential*)proxy->cred)->GetCredentialName());
}
priv_state priv = set_condor_priv();
proxy->get_delegation_err_filename = create_temp_file();
if (proxy->get_delegation_err_filename == NULL) {
dprintf (D_ALWAYS, "get_delegation create_temp_file() failed: %s\n",
strerror(errno) );
proxy->get_delegation_reset();
return FALSE;
}
status = chmod (proxy->get_delegation_err_filename, 0600);
if (status == -1) {
dprintf (D_ALWAYS, "chmod() get_delegation_err_filename %s failed: %s\n",
proxy->get_delegation_err_filename, strerror(errno) );
proxy->get_delegation_reset();
return FALSE;
}
proxy->get_delegation_err_fd = safe_open_wrapper_follow(proxy->get_delegation_err_filename,O_RDWR);
if (proxy->get_delegation_err_fd == -1) {
dprintf (D_ALWAYS, "Error opening get_delegation file %s: %s\n",
proxy->get_delegation_err_filename, strerror(errno) );
proxy->get_delegation_reset();
return FALSE;
}
set_priv (priv);
int arrIO[3];
arrIO[0]=proxy->get_delegation_password_pipe[0]; //stdin
arrIO[1]=-1; //proxy->get_delegation_err_fd;
arrIO[2]=proxy->get_delegation_err_fd; // stderr
char * myproxy_get_delegation_pgm = param ("MYPROXY_GET_DELEGATION");
if (!myproxy_get_delegation_pgm) {
dprintf (D_ALWAYS, "MYPROXY_GET_DELEGATION not defined in config file\n");
return FALSE;
}
MyString args_string;
args.GetArgsStringForDisplay(&args_string);
dprintf (D_ALWAYS, "Calling %s %s\n", myproxy_get_delegation_pgm, args_string.Value());
int pid = daemonCore->Create_Process (
myproxy_get_delegation_pgm, // name
args, // args
PRIV_USER_FINAL, // priv
myproxyGetDelegationReaperId, // reaper_id
FALSE, // want_command_port
&myEnv, // env
NULL, // cwd
NULL, // family_info
NULL, // sock_inherit_list
arrIO); // in/out/err streams
free (myproxy_get_delegation_pgm);
myproxy_get_delegation_pgm = NULL;
if (pid == FALSE) {
dprintf (D_ALWAYS, "Failed to run myproxy-get-delegation\n");
proxy->get_delegation_reset();
return FALSE;
}
proxy->get_delegation_pid = pid;
return TRUE;
}
| DoS Exec Code | 0 | int RefreshProxyThruMyProxy(X509CredentialWrapper * proxy)
{
const char * proxy_filename = proxy->GetStorageName();
char * myproxy_host = NULL;
int status;
if (((X509Credential*)proxy->cred)->GetMyProxyServerHost() == NULL) {
dprintf (D_ALWAYS, "Skipping %s\n", proxy->cred->GetName());
return FALSE;
}
time_t now = time(NULL);
if (proxy->get_delegation_pid != GET_DELEGATION_PID_NONE) {
time_t time_started = proxy->get_delegation_proc_start_time;
if (now - time_started > 500) {
dprintf (D_FULLDEBUG, "MyProxy refresh process pid=%d still running, "
"sending signal %d\n",
proxy->get_delegation_pid, SIGKILL);
daemonCore->Send_Signal (proxy->get_delegation_pid, SIGKILL);
} else {
dprintf (D_FULLDEBUG, "MyProxy refresh process pid=%d still running, "
"letting it finish\n",
proxy->get_delegation_pid);
}
return FALSE;
}
proxy->get_delegation_proc_start_time = now;
Env myEnv;
MyString strBuff;
if (((X509Credential*)proxy->cred)->GetMyProxyServerDN()) {
strBuff="MYPROXY_SERVER_DN=";
strBuff+= ((X509Credential*)proxy->cred)->GetMyProxyServerDN();
myEnv.SetEnv (strBuff.Value());
dprintf (D_FULLDEBUG, "%s\n", strBuff.Value());
}
strBuff="X509_USER_PROXY=";
strBuff+=proxy->GetStorageName();
dprintf (D_FULLDEBUG, "%s\n", strBuff.Value());
const char * myproxy_password =((X509Credential*)proxy->cred)->GetRefreshPassword();
if (myproxy_password == NULL ) {
dprintf (D_ALWAYS, "No MyProxy password specified for %s:%s\n",
proxy->cred->GetName(),
proxy->cred->GetOwner());
myproxy_password = "";
}
status = pipe (proxy->get_delegation_password_pipe);
if (status == -1) {
dprintf (D_ALWAYS, "get_delegation pipe() failed: %s\n", strerror(errno) );
proxy->get_delegation_reset();
return FALSE;
}
write (proxy->get_delegation_password_pipe[1],
myproxy_password,
strlen (myproxy_password));
write (proxy->get_delegation_password_pipe[1], "\n", 1);
const char * username = proxy->cred->GetOrigOwner();
myproxy_host = getHostFromAddr (((X509Credential*)proxy->cred)->GetMyProxyServerHost());
int myproxy_port = getPortFromAddr (((X509Credential*)proxy->cred)->GetMyProxyServerHost());
ArgList args;
args.AppendArg("--verbose ");
args.AppendArg("--out");
args.AppendArg(proxy_filename);
args.AppendArg("--pshost");
args.AppendArg(myproxy_host);
if ( myproxy_host != NULL ) {
free ( myproxy_host );
}
args.AppendArg("--dn_as_username");
args.AppendArg("--proxy_lifetime"); // hours
args.AppendArg(6);
args.AppendArg("--stdin_pass");
args.AppendArg("--username");
args.AppendArg(username);
if (myproxy_port) {
args.AppendArg("--psport");
args.AppendArg(myproxy_port);
}
if ( ((X509Credential*)proxy->cred)->GetCredentialName() &&
( ((X509Credential*)proxy->cred)->GetCredentialName() )[0] ) {
args.AppendArg("--credname");
args.AppendArg(((X509Credential*)proxy->cred)->GetCredentialName());
}
priv_state priv = set_condor_priv();
proxy->get_delegation_err_filename = create_temp_file();
if (proxy->get_delegation_err_filename == NULL) {
dprintf (D_ALWAYS, "get_delegation create_temp_file() failed: %s\n",
strerror(errno) );
proxy->get_delegation_reset();
return FALSE;
}
status = chmod (proxy->get_delegation_err_filename, 0600);
if (status == -1) {
dprintf (D_ALWAYS, "chmod() get_delegation_err_filename %s failed: %s\n",
proxy->get_delegation_err_filename, strerror(errno) );
proxy->get_delegation_reset();
return FALSE;
}
proxy->get_delegation_err_fd = safe_open_wrapper_follow(proxy->get_delegation_err_filename,O_RDWR);
if (proxy->get_delegation_err_fd == -1) {
dprintf (D_ALWAYS, "Error opening get_delegation file %s: %s\n",
proxy->get_delegation_err_filename, strerror(errno) );
proxy->get_delegation_reset();
return FALSE;
}
set_priv (priv);
int arrIO[3];
arrIO[0]=proxy->get_delegation_password_pipe[0]; //stdin
arrIO[1]=-1; //proxy->get_delegation_err_fd;
arrIO[2]=proxy->get_delegation_err_fd; // stderr
char * myproxy_get_delegation_pgm = param ("MYPROXY_GET_DELEGATION");
if (!myproxy_get_delegation_pgm) {
dprintf (D_ALWAYS, "MYPROXY_GET_DELEGATION not defined in config file\n");
return FALSE;
}
MyString args_string;
args.GetArgsStringForDisplay(&args_string);
dprintf (D_ALWAYS, "Calling %s %s\n", myproxy_get_delegation_pgm, args_string.Value());
int pid = daemonCore->Create_Process (
myproxy_get_delegation_pgm, // name
args, // args
PRIV_USER_FINAL, // priv
myproxyGetDelegationReaperId, // reaper_id
FALSE, // want_command_port
&myEnv, // env
NULL, // cwd
NULL, // family_info
NULL, // sock_inherit_list
arrIO); // in/out/err streams
free (myproxy_get_delegation_pgm);
myproxy_get_delegation_pgm = NULL;
if (pid == FALSE) {
dprintf (D_ALWAYS, "Failed to run myproxy-get-delegation\n");
proxy->get_delegation_reset();
return FALSE;
}
proxy->get_delegation_pid = pid;
return TRUE;
}
| @@ -263,7 +263,7 @@ get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name);
@@ -455,7 +455,7 @@ rm_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name); | CWE-134 | null | null |
12,925 | StoreData (const char * file_name, const void * data, const int data_size) {
if (!data) {
return FALSE;
}
priv_state priv = set_root_priv();
dprintf (D_FULLDEBUG, "in StoreData(), euid=%d\n", geteuid());
int fd = safe_open_wrapper_follow(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0600 );
if (fd == -1) {
dprintf (D_ALWAYS, "Unable to store in %s\n", file_name);
set_priv(priv);
return FALSE;
}
fchmod (fd, S_IRUSR | S_IWUSR);
fchown (fd, get_user_uid(), get_user_gid());
write (fd, data, data_size);
close (fd);
set_priv(priv);
return TRUE;
}
| DoS Exec Code | 0 | StoreData (const char * file_name, const void * data, const int data_size) {
if (!data) {
return FALSE;
}
priv_state priv = set_root_priv();
dprintf (D_FULLDEBUG, "in StoreData(), euid=%d\n", geteuid());
int fd = safe_open_wrapper_follow(file_name, O_WRONLY | O_CREAT | O_TRUNC, 0600 );
if (fd == -1) {
dprintf (D_ALWAYS, "Unable to store in %s\n", file_name);
set_priv(priv);
return FALSE;
}
fchmod (fd, S_IRUSR | S_IWUSR);
fchown (fd, get_user_uid(), get_user_gid());
write (fd, data, data_size);
close (fd);
set_priv(priv);
return TRUE;
}
| @@ -263,7 +263,7 @@ get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name);
@@ -455,7 +455,7 @@ rm_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name); | CWE-134 | null | null |
12,926 | init_user_id_from_FQN (const char * _fqn) {
char * uid = NULL;
char * domain = NULL;
char * fqn = NULL;
char default_uid [] = "nobody";
if (_fqn) {
fqn = strdup (_fqn);
uid = fqn;
char * pAt = strchr (fqn, '@');
if (pAt) {
*pAt='\0';
domain = pAt+1;
}
}
if (uid == NULL) {
uid = default_uid;
}
int rc = init_user_ids (uid, domain);
dprintf (D_FULLDEBUG, "Switching to user %s@%s, result = %d\n", uid, domain, rc);
if (fqn)
free (fqn);
return rc;
}
| DoS Exec Code | 0 | init_user_id_from_FQN (const char * _fqn) {
char * uid = NULL;
char * domain = NULL;
char * fqn = NULL;
char default_uid [] = "nobody";
if (_fqn) {
fqn = strdup (_fqn);
uid = fqn;
char * pAt = strchr (fqn, '@');
if (pAt) {
*pAt='\0';
domain = pAt+1;
}
}
if (uid == NULL) {
uid = default_uid;
}
int rc = init_user_ids (uid, domain);
dprintf (D_FULLDEBUG, "Switching to user %s@%s, result = %d\n", uid, domain, rc);
if (fqn)
free (fqn);
return rc;
}
| @@ -263,7 +263,7 @@ get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name);
@@ -455,7 +455,7 @@ rm_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name); | CWE-134 | null | null |
12,927 | isSuperUser( const char* user )
{
if( ! (user)) {
return false;
}
super_users.rewind();
char * next;
while ((next = super_users.next())) {
if (strcmp (user, next ) == 0) {
return true;
}
}
return false;
}
| DoS Exec Code | 0 | isSuperUser( const char* user )
{
if( ! (user)) {
return false;
}
super_users.rewind();
char * next;
while ((next = super_users.next())) {
if (strcmp (user, next ) == 0) {
return true;
}
}
return false;
}
| @@ -263,7 +263,7 @@ get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name);
@@ -455,7 +455,7 @@ rm_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name); | CWE-134 | null | null |
12,928 | store_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
void * data = NULL;
int rtnVal = FALSE;
int rc;
char * temp_file_name = NULL;
bool found_cred;
CredentialWrapper * temp_cred = NULL;
int data_size = -1;
classad::ClassAd * _classad = NULL;
classad::ClassAd classad;
std::string classad_cstr;
char * classad_str = NULL;
classad::ClassAdParser parser;
ReliSock * socket = (ReliSock*)stream;
const char * user = NULL;
CredentialWrapper * cred_wrapper = NULL;
if (!socket->triedAuthentication()) {
CondorError errstack;
if( ! SecMan::authenticate_sock(socket, WRITE, &errstack) ) {
dprintf (D_ALWAYS, "Unable to authenticate, qutting\n");
goto EXIT;
}
}
user = socket->getFullyQualifiedUser();
dprintf (D_FULLDEBUG, "Request by: %s, %s\n", socket->getOwner(), user);
socket->decode();
if (!socket->code (classad_str)) {
dprintf (D_ALWAYS, "Error receiving credential metadata\n");
goto EXIT;
}
classad_cstr = classad_str;
free (classad_str);
_classad = parser.ParseClassAd(classad_cstr);
if (!_classad) {
dprintf (D_ALWAYS, "Error: invalid credential metadata %s\n", classad_cstr.c_str());
goto EXIT;
}
classad = *_classad;
delete _classad;
int type;
if (!classad.EvaluateAttrInt ("Type", type)) {
dprintf (D_ALWAYS, "Missing Type attribute in classad!\n");
goto EXIT;
}
if (type == X509_CREDENTIAL_TYPE) {
cred_wrapper = new X509CredentialWrapper (classad);
dprintf (D_ALWAYS, "Name=%s Size=%d\n",
cred_wrapper->cred->GetName(),
cred_wrapper->cred->GetDataSize());
} else {
dprintf (D_ALWAYS, "Unsupported credential type %d\n", type);
goto EXIT;
}
cred_wrapper->cred->SetOrigOwner (socket->getOwner()); // original remote uname
cred_wrapper->cred->SetOwner (user); // mapped uname
data_size = cred_wrapper->cred->GetDataSize();
if (data_size > MAX_CRED_DATA_SIZE) {
dprintf (D_ALWAYS, "ERROR: Credential data size %d > maximum allowed (%d)\n", data_size, MAX_CRED_DATA_SIZE);
goto EXIT;
}
data = malloc (data_size);
if (data == NULL) {
EXCEPT("Out of memory. Aborting.");
}
if (!socket->code_bytes(data,data_size)) {
dprintf (D_ALWAYS, "Error receiving credential data\n");
goto EXIT;
}
cred_wrapper->cred->SetData (data, data_size);
found_cred=false;
credentials.Rewind();
while (credentials.Next(temp_cred)) {
if ((strcmp(cred_wrapper->cred->GetName(),
temp_cred->cred->GetName()) == 0) &&
(strcmp(cred_wrapper->cred->GetOwner(),
temp_cred->cred->GetOwner()) == 0)) {
found_cred=true;
break; // found it
}
}
if (found_cred) {
dprintf (D_ALWAYS, "Credential %s for owner %s already exists!\n",
cred_wrapper->cred->GetName(),
cred_wrapper->cred->GetOwner());
socket->encode();
int rcred=CREDD_ERROR_CREDENTIAL_ALREADY_EXISTS;
socket->code(rcred);
goto EXIT;
}
temp_file_name = dircat (cred_store_dir, "credXXXXXX");
condor_mkstemp (temp_file_name);
cred_wrapper->SetStorageName (temp_file_name);
init_user_id_from_FQN (user);
if (!StoreData(temp_file_name,data,data_size)) {
socket->encode();
int rcred = CREDD_UNABLE_TO_STORE;
socket->code(rcred);
goto EXIT;
}
((X509CredentialWrapper*)cred_wrapper)->cred->SetRealExpirationTime (
x509_proxy_expiration_time(temp_file_name));
credentials.Append (cred_wrapper);
SaveCredentialList();
socket->encode();
rc = CREDD_SUCCESS;
socket->code(rc);
dprintf( D_ALWAYS, "Credential name %s owner %s successfully stored\n",
cred_wrapper->cred->GetName(), cred_wrapper->cred->GetOwner() );
if (type == X509_CREDENTIAL_TYPE) {
((X509Credential*)cred_wrapper->cred)->display( D_FULLDEBUG );
}
rtnVal = TRUE;
EXIT:
if ( data != NULL ) {
free (data);
}
if ( temp_file_name != NULL ) {
delete [] temp_file_name;
}
if ( cred_wrapper != NULL) {
delete cred_wrapper;
}
return rtnVal;
}
| DoS Exec Code | 0 | store_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
void * data = NULL;
int rtnVal = FALSE;
int rc;
char * temp_file_name = NULL;
bool found_cred;
CredentialWrapper * temp_cred = NULL;
int data_size = -1;
classad::ClassAd * _classad = NULL;
classad::ClassAd classad;
std::string classad_cstr;
char * classad_str = NULL;
classad::ClassAdParser parser;
ReliSock * socket = (ReliSock*)stream;
const char * user = NULL;
CredentialWrapper * cred_wrapper = NULL;
if (!socket->triedAuthentication()) {
CondorError errstack;
if( ! SecMan::authenticate_sock(socket, WRITE, &errstack) ) {
dprintf (D_ALWAYS, "Unable to authenticate, qutting\n");
goto EXIT;
}
}
user = socket->getFullyQualifiedUser();
dprintf (D_FULLDEBUG, "Request by: %s, %s\n", socket->getOwner(), user);
socket->decode();
if (!socket->code (classad_str)) {
dprintf (D_ALWAYS, "Error receiving credential metadata\n");
goto EXIT;
}
classad_cstr = classad_str;
free (classad_str);
_classad = parser.ParseClassAd(classad_cstr);
if (!_classad) {
dprintf (D_ALWAYS, "Error: invalid credential metadata %s\n", classad_cstr.c_str());
goto EXIT;
}
classad = *_classad;
delete _classad;
int type;
if (!classad.EvaluateAttrInt ("Type", type)) {
dprintf (D_ALWAYS, "Missing Type attribute in classad!\n");
goto EXIT;
}
if (type == X509_CREDENTIAL_TYPE) {
cred_wrapper = new X509CredentialWrapper (classad);
dprintf (D_ALWAYS, "Name=%s Size=%d\n",
cred_wrapper->cred->GetName(),
cred_wrapper->cred->GetDataSize());
} else {
dprintf (D_ALWAYS, "Unsupported credential type %d\n", type);
goto EXIT;
}
cred_wrapper->cred->SetOrigOwner (socket->getOwner()); // original remote uname
cred_wrapper->cred->SetOwner (user); // mapped uname
data_size = cred_wrapper->cred->GetDataSize();
if (data_size > MAX_CRED_DATA_SIZE) {
dprintf (D_ALWAYS, "ERROR: Credential data size %d > maximum allowed (%d)\n", data_size, MAX_CRED_DATA_SIZE);
goto EXIT;
}
data = malloc (data_size);
if (data == NULL) {
EXCEPT("Out of memory. Aborting.");
}
if (!socket->code_bytes(data,data_size)) {
dprintf (D_ALWAYS, "Error receiving credential data\n");
goto EXIT;
}
cred_wrapper->cred->SetData (data, data_size);
found_cred=false;
credentials.Rewind();
while (credentials.Next(temp_cred)) {
if ((strcmp(cred_wrapper->cred->GetName(),
temp_cred->cred->GetName()) == 0) &&
(strcmp(cred_wrapper->cred->GetOwner(),
temp_cred->cred->GetOwner()) == 0)) {
found_cred=true;
break; // found it
}
}
if (found_cred) {
dprintf (D_ALWAYS, "Credential %s for owner %s already exists!\n",
cred_wrapper->cred->GetName(),
cred_wrapper->cred->GetOwner());
socket->encode();
int rcred=CREDD_ERROR_CREDENTIAL_ALREADY_EXISTS;
socket->code(rcred);
goto EXIT;
}
temp_file_name = dircat (cred_store_dir, "credXXXXXX");
condor_mkstemp (temp_file_name);
cred_wrapper->SetStorageName (temp_file_name);
init_user_id_from_FQN (user);
if (!StoreData(temp_file_name,data,data_size)) {
socket->encode();
int rcred = CREDD_UNABLE_TO_STORE;
socket->code(rcred);
goto EXIT;
}
((X509CredentialWrapper*)cred_wrapper)->cred->SetRealExpirationTime (
x509_proxy_expiration_time(temp_file_name));
credentials.Append (cred_wrapper);
SaveCredentialList();
socket->encode();
rc = CREDD_SUCCESS;
socket->code(rc);
dprintf( D_ALWAYS, "Credential name %s owner %s successfully stored\n",
cred_wrapper->cred->GetName(), cred_wrapper->cred->GetOwner() );
if (type == X509_CREDENTIAL_TYPE) {
((X509Credential*)cred_wrapper->cred)->display( D_FULLDEBUG );
}
rtnVal = TRUE;
EXIT:
if ( data != NULL ) {
free (data);
}
if ( temp_file_name != NULL ) {
delete [] temp_file_name;
}
if ( cred_wrapper != NULL) {
delete cred_wrapper;
}
return rtnVal;
}
| @@ -263,7 +263,7 @@ get_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name);
@@ -455,7 +455,7 @@ rm_cred_handler(Service * /*service*/, int /*i*/, Stream *stream) {
*pColon = '\0';
// Name is the second part
- sprintf (name, (char*)(pColon+sizeof(char)));
+ sprintf (name, "%s", (char*)(pColon+sizeof(char)));
if (strcmp (owner, user) != 0) {
dprintf (D_ALWAYS, "Requesting another user's (%s) credential %s\n", owner, name); | CWE-134 | null | null |
12,929 | GahpServer::AddGahpClient()
{
m_reference_count++;
if ( m_deleteMeTid != TIMER_UNSET ) {
daemonCore->Cancel_Timer( m_deleteMeTid );
m_deleteMeTid = TIMER_UNSET;
}
}
| DoS Exec Code | 0 | GahpServer::AddGahpClient()
{
m_reference_count++;
if ( m_deleteMeTid != TIMER_UNSET ) {
daemonCore->Cancel_Timer( m_deleteMeTid );
m_deleteMeTid = TIMER_UNSET;
}
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,930 | GahpServer::DeleteMe()
{
m_deleteMeTid = TIMER_UNSET;
if ( m_reference_count <= 0 ) {
delete this;
}
}
| DoS Exec Code | 0 | GahpServer::DeleteMe()
{
m_deleteMeTid = TIMER_UNSET;
if ( m_reference_count <= 0 ) {
delete this;
}
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,931 | void GahpReconfig()
{
int tmp_int;
logGahpIo = param_boolean( "GRIDMANAGER_GAHPCLIENT_DEBUG", true );
logGahpIoSize = param_integer( "GRIDMANAGER_GAHPCLIENT_DEBUG_SIZE", 0 );
useXMLClassads = param_boolean( "GAHP_USE_XML_CLASSADS", false );
tmp_int = param_integer( "GRIDMANAGER_MAX_PENDING_REQUESTS", 50 );
GahpServer *next_server = NULL;
GahpServer::GahpServersById.startIterations();
while ( GahpServer::GahpServersById.iterate( next_server ) != 0 ) {
next_server->max_pending_requests = tmp_int;
}
}
| DoS Exec Code | 0 | void GahpReconfig()
{
int tmp_int;
logGahpIo = param_boolean( "GRIDMANAGER_GAHPCLIENT_DEBUG", true );
logGahpIoSize = param_integer( "GRIDMANAGER_GAHPCLIENT_DEBUG_SIZE", 0 );
useXMLClassads = param_boolean( "GAHP_USE_XML_CLASSADS", false );
tmp_int = param_integer( "GRIDMANAGER_MAX_PENDING_REQUESTS", 50 );
GahpServer *next_server = NULL;
GahpServer::GahpServersById.startIterations();
while ( GahpServer::GahpServersById.iterate( next_server ) != 0 ) {
next_server->max_pending_requests = tmp_int;
}
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,932 | GahpServer::GahpServer(const char *id, const char *path, const ArgList *args)
{
m_gahp_pid = -1;
m_gahp_startup_failed = false;
m_gahp_readfd = -1;
m_gahp_writefd = -1;
m_gahp_errorfd = -1;
m_gahp_error_buffer = "";
m_reference_count = 0;
m_commands_supported = NULL;
m_pollInterval = 5;
poll_tid = -1;
max_pending_requests = param_integer( "GRIDMANAGER_MAX_PENDING_REQUESTS", 50 );
num_pending_requests = 0;
poll_pending = false;
use_prefix = false;
requestTable = NULL;
current_proxy = NULL;
skip_next_r = false;
m_deleteMeTid = TIMER_UNSET;
next_reqid = 1;
rotated_reqids = false;
requestTable = new HashTable<int,GahpClient*>( 300, &hashFuncInt );
ASSERT(requestTable);
globus_gass_server_url = NULL;
globus_gt2_gram_user_callback_arg = NULL;
globus_gt2_gram_callback_func = NULL;
globus_gt2_gram_callback_reqid = 0;
globus_gt2_gram_callback_contact = NULL;
globus_gt4_gram_user_callback_arg = NULL;
globus_gt4_gram_callback_func = NULL;
globus_gt4_gram_callback_reqid = 0;
globus_gt4_gram_callback_contact = NULL;
unicore_gahp_callback_func = NULL;
unicore_gahp_callback_reqid = 0;
my_id = strdup(id);
binary_path = strdup(path);
if ( args != NULL ) {
binary_args.AppendArgsFromArgList( *args );
}
proxy_check_tid = TIMER_UNSET;
master_proxy = NULL;
is_initialized = false;
can_cache_proxies = false;
ProxiesByFilename = NULL;
m_gahp_version[0] = '\0';
m_buffer_pos = 0;
m_buffer_end = 0;
m_buffer = (char *)malloc( m_buffer_size );
m_in_results = false;
}
| DoS Exec Code | 0 | GahpServer::GahpServer(const char *id, const char *path, const ArgList *args)
{
m_gahp_pid = -1;
m_gahp_startup_failed = false;
m_gahp_readfd = -1;
m_gahp_writefd = -1;
m_gahp_errorfd = -1;
m_gahp_error_buffer = "";
m_reference_count = 0;
m_commands_supported = NULL;
m_pollInterval = 5;
poll_tid = -1;
max_pending_requests = param_integer( "GRIDMANAGER_MAX_PENDING_REQUESTS", 50 );
num_pending_requests = 0;
poll_pending = false;
use_prefix = false;
requestTable = NULL;
current_proxy = NULL;
skip_next_r = false;
m_deleteMeTid = TIMER_UNSET;
next_reqid = 1;
rotated_reqids = false;
requestTable = new HashTable<int,GahpClient*>( 300, &hashFuncInt );
ASSERT(requestTable);
globus_gass_server_url = NULL;
globus_gt2_gram_user_callback_arg = NULL;
globus_gt2_gram_callback_func = NULL;
globus_gt2_gram_callback_reqid = 0;
globus_gt2_gram_callback_contact = NULL;
globus_gt4_gram_user_callback_arg = NULL;
globus_gt4_gram_callback_func = NULL;
globus_gt4_gram_callback_reqid = 0;
globus_gt4_gram_callback_contact = NULL;
unicore_gahp_callback_func = NULL;
unicore_gahp_callback_reqid = 0;
my_id = strdup(id);
binary_path = strdup(path);
if ( args != NULL ) {
binary_args.AppendArgsFromArgList( *args );
}
proxy_check_tid = TIMER_UNSET;
master_proxy = NULL;
is_initialized = false;
can_cache_proxies = false;
ProxiesByFilename = NULL;
m_gahp_version[0] = '\0';
m_buffer_pos = 0;
m_buffer_end = 0;
m_buffer = (char *)malloc( m_buffer_size );
m_in_results = false;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,933 | GahpClient::Initialize(Proxy *proxy)
{
return server->Initialize(proxy);
}
| DoS Exec Code | 0 | GahpClient::Initialize(Proxy *proxy)
{
return server->Initialize(proxy);
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,934 | GahpServer::Initialize( Proxy *proxy )
{
if ( is_initialized == true ) {
return true;
}
if ( m_gahp_pid == -1 ) {
if ( Startup() == false ) {
return false;
}
}
master_proxy = new GahpProxyInfo;
master_proxy->proxy = proxy->subject->master_proxy;
AcquireProxy( master_proxy->proxy, (TimerHandlercpp)&GahpServer::ProxyCallback,
this );
master_proxy->cached_expiration = 0;
if ( m_commands_supported->contains_anycase( "INITIALIZE_FROM_FILE" ) ) {
if ( command_initialize_from_file( master_proxy->proxy->proxy_filename ) == false ) {
dprintf( D_ALWAYS, "GAHP: Failed to initialize from file\n" );
return false;
}
}
current_proxy = master_proxy;
if ( can_cache_proxies ) {
if ( cacheProxyFromFile( master_proxy ) == false ) {
dprintf( D_ALWAYS, "GAHP: Failed to cache proxy from file!\n" );
return false;
}
ProxiesByFilename = new HashTable<HashKey,GahpProxyInfo*>( 500,
&hashFunction );
ASSERT(ProxiesByFilename);
}
master_proxy->cached_expiration = master_proxy->proxy->expiration_time;
is_initialized = true;
return true;
}
| DoS Exec Code | 0 | GahpServer::Initialize( Proxy *proxy )
{
if ( is_initialized == true ) {
return true;
}
if ( m_gahp_pid == -1 ) {
if ( Startup() == false ) {
return false;
}
}
master_proxy = new GahpProxyInfo;
master_proxy->proxy = proxy->subject->master_proxy;
AcquireProxy( master_proxy->proxy, (TimerHandlercpp)&GahpServer::ProxyCallback,
this );
master_proxy->cached_expiration = 0;
if ( m_commands_supported->contains_anycase( "INITIALIZE_FROM_FILE" ) ) {
if ( command_initialize_from_file( master_proxy->proxy->proxy_filename ) == false ) {
dprintf( D_ALWAYS, "GAHP: Failed to initialize from file\n" );
return false;
}
}
current_proxy = master_proxy;
if ( can_cache_proxies ) {
if ( cacheProxyFromFile( master_proxy ) == false ) {
dprintf( D_ALWAYS, "GAHP: Failed to cache proxy from file!\n" );
return false;
}
ProxiesByFilename = new HashTable<HashKey,GahpProxyInfo*>( 500,
&hashFunction );
ASSERT(ProxiesByFilename);
}
master_proxy->cached_expiration = master_proxy->proxy->expiration_time;
is_initialized = true;
return true;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,935 | GahpServer::ProxyCallback()
{
if ( m_gahp_pid > 0 ) {
proxy_check_tid = daemonCore->Register_Timer( 0,
(TimerHandlercpp)&GahpServer::doProxyCheck,
"GahpServer::doProxyCheck", (Service*)this );
}
return 0;
}
| DoS Exec Code | 0 | GahpServer::ProxyCallback()
{
if ( m_gahp_pid > 0 ) {
proxy_check_tid = daemonCore->Register_Timer( 0,
(TimerHandlercpp)&GahpServer::doProxyCheck,
"GahpServer::doProxyCheck", (Service*)this );
}
return 0;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,936 | GahpClient::Startup()
{
return server->Startup();
}
| DoS Exec Code | 0 | GahpClient::Startup()
{
return server->Startup();
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,937 | GahpServer::Startup()
{
char *gahp_path = NULL;
ArgList gahp_args;
int stdin_pipefds[2];
int stdout_pipefds[2];
int stderr_pipefds[2];
int low_port;
int high_port;
Env newenv;
char *tmp_char;
if ( m_gahp_startup_failed ) {
return false;
} else if ( m_gahp_pid != -1 ) {
return true;
}
if ( binary_path && strcmp( binary_path, GAHPCLIENT_DEFAULT_SERVER_PATH ) != 0 ) {
gahp_path = strdup(binary_path);
gahp_args.AppendArgsFromArgList(binary_args);
} else {
gahp_path = param("GAHP");
char *args = param("GAHP_ARGS");
MyString args_error;
if(!gahp_args.AppendArgsV1RawOrV2Quoted(args,&args_error)) {
EXCEPT("Failed to parse arguments: %s",args_error.Value());
}
free(args);
}
if (!gahp_path) return false;
gahp_args.InsertArg( gahp_path, 0);
newenv.SetEnv( "GAHP_TEMP", GridmanagerScratchDir );
if ( get_port_range( FALSE, &low_port, &high_port ) == TRUE ) {
std::string buff;
sprintf( buff, "%d,%d", low_port, high_port );
newenv.SetEnv( "GLOBUS_TCP_PORT_RANGE", buff.c_str() );
}
if ( get_port_range( TRUE, &low_port, &high_port ) == TRUE ) {
std::string buff;
sprintf( buff, "%d,%d", low_port, high_port );
newenv.SetEnv( "GLOBUS_TCP_SOURCE_RANGE", buff.c_str() );
}
tmp_char = param("GLITE_LOCATION");
if ( tmp_char ) {
newenv.SetEnv( "GLITE_LOCATION", tmp_char );
free( tmp_char );
}
tmp_char = param("SOAP_SSL_CA_FILE");
if( tmp_char ) {
newenv.SetEnv( "SOAP_SSL_CA_FILE", tmp_char );
free( tmp_char );
}
tmp_char = param("SOAP_SSL_CA_DIR");
if( tmp_char ) {
newenv.SetEnv( "SOAP_SSL_CA_DIR", tmp_char );
free( tmp_char );
}
if ( param_boolean( "SOAP_SSL_SKIP_HOST_CHECK", false ) ) {
newenv.SetEnv( "SOAP_SSL_SKIP_HOST_CHECK", "True" );
}
if ( m_reaperid == -1 ) {
m_reaperid = daemonCore->Register_Reaper(
"GAHP Server",
(ReaperHandler)&GahpServer::Reaper, // handler
"GahpServer::Reaper",
NULL
);
}
bool is_c_gahp = false;
if (strncmp(my_id, "CONDOR/", 7) == 0) {
is_c_gahp = true;
}
if ( (daemonCore->Create_Pipe(stdin_pipefds, is_c_gahp) == FALSE) ||
(daemonCore->Create_Pipe(stdout_pipefds, true, false, true) == FALSE) ||
(daemonCore->Create_Pipe(stderr_pipefds, true, false, true) == FALSE))
{
dprintf(D_ALWAYS,"GahpServer::Startup - pipe() failed, errno=%d\n",
errno);
free( gahp_path );
return false;
}
int io_redirect[3];
io_redirect[0] = stdin_pipefds[0]; // stdin gets read side of in pipe
io_redirect[1] = stdout_pipefds[1]; // stdout get write side of out pipe
io_redirect[2] = stderr_pipefds[1]; // stderr get write side of err pipe
m_gahp_pid = daemonCore->Create_Process(
gahp_path, // Name of executable
gahp_args, // Args
PRIV_USER_FINAL,// Priv State ---- drop root if we have it
m_reaperid, // id for our registered reaper
FALSE, // do not want a command port
&newenv, // env
NULL, // cwd
NULL, // process family info
NULL, // network sockets to inherit
io_redirect // redirect stdin/out/err
);
if ( m_gahp_pid == FALSE ) {
dprintf(D_ALWAYS,"Failed to start GAHP server (%s)\n",
gahp_path);
free( gahp_path );
m_gahp_pid = -1;
return false;
} else {
dprintf(D_ALWAYS,"GAHP server pid = %d\n",m_gahp_pid);
}
free( gahp_path );
daemonCore->Close_Pipe( io_redirect[0] );
daemonCore->Close_Pipe( io_redirect[1] );
daemonCore->Close_Pipe( io_redirect[2] );
m_gahp_errorfd = stderr_pipefds[0];
m_gahp_readfd = stdout_pipefds[0];
m_gahp_writefd = stdin_pipefds[1];
if ( command_version() == false ) {
dprintf(D_ALWAYS,"Failed to read GAHP server version\n");
m_gahp_startup_failed = true;
return false;
} else {
dprintf(D_FULLDEBUG,"GAHP server version: %s\n",m_gahp_version);
}
if ( command_commands() == false ) {
m_gahp_startup_failed = true;
return false;
}
use_prefix = command_response_prefix( GAHP_PREFIX );
if ( !command_async_mode_on() ) {
setPollInterval(m_pollInterval);
} else {
int result = daemonCore->Register_Pipe(m_gahp_readfd,
"m_gahp_readfd",static_cast<PipeHandlercpp>(&GahpServer::pipe_ready),
"&GahpServer::pipe_ready",this);
if ( result == -1 ) {
setPollInterval(m_pollInterval);
} else {
setPollInterval(m_pollInterval * 12);
}
result = daemonCore->Register_Pipe(m_gahp_errorfd,
"m_gahp_errorfd",static_cast<PipeHandlercpp>(&GahpServer::err_pipe_ready),
"&GahpServer::err_pipe_ready",this);
}
if ( m_commands_supported->contains_anycase("CACHE_PROXY_FROM_FILE")==TRUE &&
m_commands_supported->contains_anycase("UNCACHE_PROXY")==TRUE &&
m_commands_supported->contains_anycase("USE_CACHED_PROXY")==TRUE ) {
can_cache_proxies = true;
}
return true;
}
| DoS Exec Code | 0 | GahpServer::Startup()
{
char *gahp_path = NULL;
ArgList gahp_args;
int stdin_pipefds[2];
int stdout_pipefds[2];
int stderr_pipefds[2];
int low_port;
int high_port;
Env newenv;
char *tmp_char;
if ( m_gahp_startup_failed ) {
return false;
} else if ( m_gahp_pid != -1 ) {
return true;
}
if ( binary_path && strcmp( binary_path, GAHPCLIENT_DEFAULT_SERVER_PATH ) != 0 ) {
gahp_path = strdup(binary_path);
gahp_args.AppendArgsFromArgList(binary_args);
} else {
gahp_path = param("GAHP");
char *args = param("GAHP_ARGS");
MyString args_error;
if(!gahp_args.AppendArgsV1RawOrV2Quoted(args,&args_error)) {
EXCEPT("Failed to parse arguments: %s",args_error.Value());
}
free(args);
}
if (!gahp_path) return false;
gahp_args.InsertArg( gahp_path, 0);
newenv.SetEnv( "GAHP_TEMP", GridmanagerScratchDir );
if ( get_port_range( FALSE, &low_port, &high_port ) == TRUE ) {
std::string buff;
sprintf( buff, "%d,%d", low_port, high_port );
newenv.SetEnv( "GLOBUS_TCP_PORT_RANGE", buff.c_str() );
}
if ( get_port_range( TRUE, &low_port, &high_port ) == TRUE ) {
std::string buff;
sprintf( buff, "%d,%d", low_port, high_port );
newenv.SetEnv( "GLOBUS_TCP_SOURCE_RANGE", buff.c_str() );
}
tmp_char = param("GLITE_LOCATION");
if ( tmp_char ) {
newenv.SetEnv( "GLITE_LOCATION", tmp_char );
free( tmp_char );
}
tmp_char = param("SOAP_SSL_CA_FILE");
if( tmp_char ) {
newenv.SetEnv( "SOAP_SSL_CA_FILE", tmp_char );
free( tmp_char );
}
tmp_char = param("SOAP_SSL_CA_DIR");
if( tmp_char ) {
newenv.SetEnv( "SOAP_SSL_CA_DIR", tmp_char );
free( tmp_char );
}
if ( param_boolean( "SOAP_SSL_SKIP_HOST_CHECK", false ) ) {
newenv.SetEnv( "SOAP_SSL_SKIP_HOST_CHECK", "True" );
}
if ( m_reaperid == -1 ) {
m_reaperid = daemonCore->Register_Reaper(
"GAHP Server",
(ReaperHandler)&GahpServer::Reaper, // handler
"GahpServer::Reaper",
NULL
);
}
bool is_c_gahp = false;
if (strncmp(my_id, "CONDOR/", 7) == 0) {
is_c_gahp = true;
}
if ( (daemonCore->Create_Pipe(stdin_pipefds, is_c_gahp) == FALSE) ||
(daemonCore->Create_Pipe(stdout_pipefds, true, false, true) == FALSE) ||
(daemonCore->Create_Pipe(stderr_pipefds, true, false, true) == FALSE))
{
dprintf(D_ALWAYS,"GahpServer::Startup - pipe() failed, errno=%d\n",
errno);
free( gahp_path );
return false;
}
int io_redirect[3];
io_redirect[0] = stdin_pipefds[0]; // stdin gets read side of in pipe
io_redirect[1] = stdout_pipefds[1]; // stdout get write side of out pipe
io_redirect[2] = stderr_pipefds[1]; // stderr get write side of err pipe
m_gahp_pid = daemonCore->Create_Process(
gahp_path, // Name of executable
gahp_args, // Args
PRIV_USER_FINAL,// Priv State ---- drop root if we have it
m_reaperid, // id for our registered reaper
FALSE, // do not want a command port
&newenv, // env
NULL, // cwd
NULL, // process family info
NULL, // network sockets to inherit
io_redirect // redirect stdin/out/err
);
if ( m_gahp_pid == FALSE ) {
dprintf(D_ALWAYS,"Failed to start GAHP server (%s)\n",
gahp_path);
free( gahp_path );
m_gahp_pid = -1;
return false;
} else {
dprintf(D_ALWAYS,"GAHP server pid = %d\n",m_gahp_pid);
}
free( gahp_path );
daemonCore->Close_Pipe( io_redirect[0] );
daemonCore->Close_Pipe( io_redirect[1] );
daemonCore->Close_Pipe( io_redirect[2] );
m_gahp_errorfd = stderr_pipefds[0];
m_gahp_readfd = stdout_pipefds[0];
m_gahp_writefd = stdin_pipefds[1];
if ( command_version() == false ) {
dprintf(D_ALWAYS,"Failed to read GAHP server version\n");
m_gahp_startup_failed = true;
return false;
} else {
dprintf(D_FULLDEBUG,"GAHP server version: %s\n",m_gahp_version);
}
if ( command_commands() == false ) {
m_gahp_startup_failed = true;
return false;
}
use_prefix = command_response_prefix( GAHP_PREFIX );
if ( !command_async_mode_on() ) {
setPollInterval(m_pollInterval);
} else {
int result = daemonCore->Register_Pipe(m_gahp_readfd,
"m_gahp_readfd",static_cast<PipeHandlercpp>(&GahpServer::pipe_ready),
"&GahpServer::pipe_ready",this);
if ( result == -1 ) {
setPollInterval(m_pollInterval);
} else {
setPollInterval(m_pollInterval * 12);
}
result = daemonCore->Register_Pipe(m_gahp_errorfd,
"m_gahp_errorfd",static_cast<PipeHandlercpp>(&GahpServer::err_pipe_ready),
"&GahpServer::err_pipe_ready",this);
}
if ( m_commands_supported->contains_anycase("CACHE_PROXY_FROM_FILE")==TRUE &&
m_commands_supported->contains_anycase("UNCACHE_PROXY")==TRUE &&
m_commands_supported->contains_anycase("USE_CACHED_PROXY")==TRUE ) {
can_cache_proxies = true;
}
return true;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,938 | GahpServer::UnregisterProxy( Proxy *proxy )
{
int rc;
GahpProxyInfo *gahp_proxy = NULL;
if ( ProxiesByFilename == NULL || proxy == NULL ||
can_cache_proxies == false ) {
return;
}
if ( master_proxy != NULL && proxy == master_proxy->proxy ) {
master_proxy->num_references--;
return;
}
rc = ProxiesByFilename->lookup( HashKey( proxy->proxy_filename ),
gahp_proxy );
if ( rc != 0 ) {
dprintf( D_ALWAYS, "GahpServer::UnregisterProxy() called with unknown proxy %s\n", proxy->proxy_filename );
return;
}
gahp_proxy->num_references--;
if ( gahp_proxy->num_references == 0 ) {
ProxiesByFilename->remove( HashKey( gahp_proxy->proxy->proxy_filename ) );
uncacheProxy( gahp_proxy );
ReleaseProxy( gahp_proxy->proxy, (TimerHandlercpp)&GahpServer::ProxyCallback,
this );
delete gahp_proxy;
}
}
| DoS Exec Code | 0 | GahpServer::UnregisterProxy( Proxy *proxy )
{
int rc;
GahpProxyInfo *gahp_proxy = NULL;
if ( ProxiesByFilename == NULL || proxy == NULL ||
can_cache_proxies == false ) {
return;
}
if ( master_proxy != NULL && proxy == master_proxy->proxy ) {
master_proxy->num_references--;
return;
}
rc = ProxiesByFilename->lookup( HashKey( proxy->proxy_filename ),
gahp_proxy );
if ( rc != 0 ) {
dprintf( D_ALWAYS, "GahpServer::UnregisterProxy() called with unknown proxy %s\n", proxy->proxy_filename );
return;
}
gahp_proxy->num_references--;
if ( gahp_proxy->num_references == 0 ) {
ProxiesByFilename->remove( HashKey( gahp_proxy->proxy->proxy_filename ) );
uncacheProxy( gahp_proxy );
ReleaseProxy( gahp_proxy->proxy, (TimerHandlercpp)&GahpServer::ProxyCallback,
this );
delete gahp_proxy;
}
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,939 | GahpClient::blah_job_cancel(const char *job_id)
{
static const char* command = "BLAH_JOB_CANCEL";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_id) job_id=NULLSTRING;
std::string reqline;
int x = sprintf( reqline, "%s", escapeGahpString( job_id ) );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi( result->argv[1] );
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::blah_job_cancel(const char *job_id)
{
static const char* command = "BLAH_JOB_CANCEL";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_id) job_id=NULLSTRING;
std::string reqline;
int x = sprintf( reqline, "%s", escapeGahpString( job_id ) );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi( result->argv[1] );
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,940 | GahpClient::blah_job_status(const char *job_id, ClassAd **status_ad)
{
static const char* command = "BLAH_JOB_STATUS";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_id) job_id=NULLSTRING;
std::string reqline;
int x = sprintf( reqline, "%s", escapeGahpString(job_id) );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 5) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi( result->argv[1] );
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
if ( strcasecmp( result->argv[4], NULLSTRING ) ) {
NewClassAdParser parser;
*status_ad = parser.ParseClassAd( result->argv[4] );
}
if ( *status_ad != NULL ) {
(*status_ad)->Assign( ATTR_JOB_STATUS, atoi( result->argv[3] ) );
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::blah_job_status(const char *job_id, ClassAd **status_ad)
{
static const char* command = "BLAH_JOB_STATUS";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_id) job_id=NULLSTRING;
std::string reqline;
int x = sprintf( reqline, "%s", escapeGahpString(job_id) );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 5) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi( result->argv[1] );
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
if ( strcasecmp( result->argv[4], NULLSTRING ) ) {
NewClassAdParser parser;
*status_ad = parser.ParseClassAd( result->argv[4] );
}
if ( *status_ad != NULL ) {
(*status_ad)->Assign( ATTR_JOB_STATUS, atoi( result->argv[3] ) );
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,941 | GahpServer::buffered_peek()
{
return m_buffer_end - m_buffer_pos;
}
| DoS Exec Code | 0 | GahpServer::buffered_peek()
{
return m_buffer_end - m_buffer_pos;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,942 | GahpServer::buffered_read( int fd, void *buf, int count )
{
ASSERT(fd == m_gahp_readfd);
ASSERT(count == 1);
if ( m_buffer_pos >= m_buffer_end ) {
int dummy_pipe = -1;
err_pipe_ready(dummy_pipe);
int rc = daemonCore->Read_Pipe(fd, m_buffer, m_buffer_size );
m_buffer_pos = 0;
if ( rc <= 0 ) {
m_buffer_end = 0;
return rc;
} else {
m_buffer_end = rc;
}
}
((char *)buf)[0] = ((char *)m_buffer)[m_buffer_pos];
m_buffer_pos++;
return 1;
}
| DoS Exec Code | 0 | GahpServer::buffered_read( int fd, void *buf, int count )
{
ASSERT(fd == m_gahp_readfd);
ASSERT(count == 1);
if ( m_buffer_pos >= m_buffer_end ) {
int dummy_pipe = -1;
err_pipe_ready(dummy_pipe);
int rc = daemonCore->Read_Pipe(fd, m_buffer, m_buffer_size );
m_buffer_pos = 0;
if ( rc <= 0 ) {
m_buffer_end = 0;
return rc;
} else {
m_buffer_end = rc;
}
}
((char *)buf)[0] = ((char *)m_buffer)[m_buffer_pos];
m_buffer_pos++;
return 1;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,943 | GahpClient::check_pending_timeout(const char *,const char *)
{
if ( pending_reqid == 0 ) {
return false;
}
if ( pending_submitted_to_gahp == false ) {
return false;
}
if ( pending_timeout && (time(NULL) > pending_timeout) ) {
clear_pending(); // we no longer want to hear about it...
return true;
}
return false;
}
| DoS Exec Code | 0 | GahpClient::check_pending_timeout(const char *,const char *)
{
if ( pending_reqid == 0 ) {
return false;
}
if ( pending_submitted_to_gahp == false ) {
return false;
}
if ( pending_timeout && (time(NULL) > pending_timeout) ) {
clear_pending(); // we no longer want to hear about it...
return true;
}
return false;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,944 | GahpClient::clear_pending()
{
if ( pending_reqid ) {
if (server->requestTable->remove(pending_reqid) == 0) {
server->requestTable->insert(pending_reqid,NULL);
}
}
pending_reqid = 0;
if (pending_result) delete pending_result;
pending_result = NULL;
free(pending_command);
pending_command = NULL;
if (pending_args) free(pending_args);
pending_args = NULL;
pending_timeout = 0;
if (pending_submitted_to_gahp) {
server->num_pending_requests--;
}
pending_submitted_to_gahp = false;
if ( pending_timeout_tid != -1 ) {
daemonCore->Cancel_Timer(pending_timeout_tid);
pending_timeout_tid = -1;
}
}
| DoS Exec Code | 0 | GahpClient::clear_pending()
{
if ( pending_reqid ) {
if (server->requestTable->remove(pending_reqid) == 0) {
server->requestTable->insert(pending_reqid,NULL);
}
}
pending_reqid = 0;
if (pending_result) delete pending_result;
pending_result = NULL;
free(pending_command);
pending_command = NULL;
if (pending_args) free(pending_args);
pending_args = NULL;
pending_timeout = 0;
if (pending_submitted_to_gahp) {
server->num_pending_requests--;
}
pending_submitted_to_gahp = false;
if ( pending_timeout_tid != -1 ) {
daemonCore->Cancel_Timer(pending_timeout_tid);
pending_timeout_tid = -1;
}
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,945 | GahpServer::command_async_mode_on()
{
static const char* command = "ASYNC_MODE_ON";
if (m_commands_supported->contains_anycase(command)==FALSE) {
return false;
}
write_line(command);
Gahp_Args result;
read_argv(result);
if ( result.argc == 0 || result.argv[0][0] != 'S' ) {
dprintf(D_ALWAYS,"GAHP command '%s' failed\n",command);
return false;
}
return true;
}
| DoS Exec Code | 0 | GahpServer::command_async_mode_on()
{
static const char* command = "ASYNC_MODE_ON";
if (m_commands_supported->contains_anycase(command)==FALSE) {
return false;
}
write_line(command);
Gahp_Args result;
read_argv(result);
if ( result.argc == 0 || result.argv[0][0] != 'S' ) {
dprintf(D_ALWAYS,"GAHP command '%s' failed\n",command);
return false;
}
return true;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,946 | GahpServer::command_cache_proxy_from_file( GahpProxyInfo *new_proxy )
{
static const char *command = "CACHE_PROXY_FROM_FILE";
ASSERT(new_proxy); // Gotta have it...
if (m_commands_supported->contains_anycase(command)==FALSE) {
return false;
}
std::string buf;
int x = sprintf(buf,"%s %d %s",command,new_proxy->proxy->id,
escapeGahpString(new_proxy->proxy->proxy_filename));
ASSERT( x > 0 );
write_line(buf.c_str());
Gahp_Args result;
read_argv(result);
if ( result.argc == 0 || result.argv[0][0] != 'S' ) {
char *reason;
if ( result.argc > 1 ) {
reason = result.argv[1];
} else {
reason = "Unspecified error";
}
dprintf(D_ALWAYS,"GAHP command '%s' failed: %s\n",command,reason);
return false;
}
return true;
}
| DoS Exec Code | 0 | GahpServer::command_cache_proxy_from_file( GahpProxyInfo *new_proxy )
{
static const char *command = "CACHE_PROXY_FROM_FILE";
ASSERT(new_proxy); // Gotta have it...
if (m_commands_supported->contains_anycase(command)==FALSE) {
return false;
}
std::string buf;
int x = sprintf(buf,"%s %d %s",command,new_proxy->proxy->id,
escapeGahpString(new_proxy->proxy->proxy_filename));
ASSERT( x > 0 );
write_line(buf.c_str());
Gahp_Args result;
read_argv(result);
if ( result.argc == 0 || result.argv[0][0] != 'S' ) {
char *reason;
if ( result.argc > 1 ) {
reason = result.argv[1];
} else {
reason = "Unspecified error";
}
dprintf(D_ALWAYS,"GAHP command '%s' failed: %s\n",command,reason);
return false;
}
return true;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,947 | GahpServer::command_commands()
{
write_line("COMMANDS");
Gahp_Args result;
read_argv(result);
if ( result.argc == 0 || result.argv[0][0] != 'S' ) {
dprintf(D_ALWAYS,"GAHP command 'COMMANDS' failed\n");
return false;
}
if ( m_commands_supported ) {
delete m_commands_supported;
m_commands_supported = NULL;
}
m_commands_supported = new StringList();
ASSERT(m_commands_supported);
for ( int i = 1; i < result.argc; i++ ) {
m_commands_supported->append(result.argv[i]);
}
return true;
}
| DoS Exec Code | 0 | GahpServer::command_commands()
{
write_line("COMMANDS");
Gahp_Args result;
read_argv(result);
if ( result.argc == 0 || result.argv[0][0] != 'S' ) {
dprintf(D_ALWAYS,"GAHP command 'COMMANDS' failed\n");
return false;
}
if ( m_commands_supported ) {
delete m_commands_supported;
m_commands_supported = NULL;
}
m_commands_supported = new StringList();
ASSERT(m_commands_supported);
for ( int i = 1; i < result.argc; i++ ) {
m_commands_supported->append(result.argv[i]);
}
return true;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,948 | GahpServer::command_initialize_from_file(const char *proxy_path,
const char *command)
{
ASSERT(proxy_path); // Gotta have it...
std::string buf;
if ( command == NULL ) {
command = "INITIALIZE_FROM_FILE";
}
int x = sprintf(buf,"%s %s",command,
escapeGahpString(proxy_path));
ASSERT( x > 0 );
write_line(buf.c_str());
Gahp_Args result;
read_argv(result);
if ( result.argc == 0 || result.argv[0][0] != 'S' ) {
char *reason;
if ( result.argc > 1 ) {
reason = result.argv[1];
} else {
reason = "Unspecified error";
}
dprintf(D_ALWAYS,"GAHP command '%s' failed: %s\n",command,reason);
return false;
}
return true;
}
| DoS Exec Code | 0 | GahpServer::command_initialize_from_file(const char *proxy_path,
const char *command)
{
ASSERT(proxy_path); // Gotta have it...
std::string buf;
if ( command == NULL ) {
command = "INITIALIZE_FROM_FILE";
}
int x = sprintf(buf,"%s %s",command,
escapeGahpString(proxy_path));
ASSERT( x > 0 );
write_line(buf.c_str());
Gahp_Args result;
read_argv(result);
if ( result.argc == 0 || result.argv[0][0] != 'S' ) {
char *reason;
if ( result.argc > 1 ) {
reason = result.argv[1];
} else {
reason = "Unspecified error";
}
dprintf(D_ALWAYS,"GAHP command '%s' failed: %s\n",command,reason);
return false;
}
return true;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,949 | GahpServer::command_version()
{
int i,j,result;
bool ret_val = false;
j = sizeof(m_gahp_version);
i = 0;
while ( i < j ) {
result = buffered_read(m_gahp_readfd, &(m_gahp_version[i]), 1 );
/* Check return value from read() */
if ( result < 0 ) { /* Error - try reading again */
continue;
}
if ( result == 0 ) { /* End of File */
return false;
}
if ( i==0 && m_gahp_version[0] != '$' ) {
continue;
}
if ( m_gahp_version[i] == '\\' ) {
continue;
}
if ( m_gahp_version[i] == '\n' ) {
ret_val = true;
m_gahp_version[i] = '\0';
break;
}
i++;
}
return ret_val;
}
| DoS Exec Code | 0 | GahpServer::command_version()
{
int i,j,result;
bool ret_val = false;
j = sizeof(m_gahp_version);
i = 0;
while ( i < j ) {
result = buffered_read(m_gahp_readfd, &(m_gahp_version[i]), 1 );
/* Check return value from read() */
if ( result < 0 ) { /* Error - try reading again */
continue;
}
if ( result == 0 ) { /* End of File */
return false;
}
if ( i==0 && m_gahp_version[0] != '$' ) {
continue;
}
if ( m_gahp_version[i] == '\\' ) {
continue;
}
if ( m_gahp_version[i] == '\n' ) {
ret_val = true;
m_gahp_version[i] = '\0';
break;
}
i++;
}
return ret_val;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,950 | GahpClient::condor_job_refresh_proxy(const char *schedd_name, PROC_ID job_id,
const char *proxy_file)
{
static const char* command = "CONDOR_JOB_REFRESH_PROXY";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!proxy_file) proxy_file=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(proxy_file) );
int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free(esc1);
free(esc2);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::condor_job_refresh_proxy(const char *schedd_name, PROC_ID job_id,
const char *proxy_file)
{
static const char* command = "CONDOR_JOB_REFRESH_PROXY";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!proxy_file) proxy_file=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(proxy_file) );
int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free(esc1);
free(esc2);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,951 | GahpClient::condor_job_release(const char *schedd_name, PROC_ID job_id,
const char *reason)
{
static const char* command = "CONDOR_JOB_RELEASE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!reason) reason=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(reason) );
int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free(esc1);
free(esc2);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::condor_job_release(const char *schedd_name, PROC_ID job_id,
const char *reason)
{
static const char* command = "CONDOR_JOB_RELEASE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!reason) reason=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(reason) );
int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free(esc1);
free(esc2);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,952 | GahpClient::condor_job_remove(const char *schedd_name, PROC_ID job_id,
const char *reason)
{
static const char* command = "CONDOR_JOB_REMOVE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!reason) reason=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(reason) );
int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free(esc1);
free(esc2);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::condor_job_remove(const char *schedd_name, PROC_ID job_id,
const char *reason)
{
static const char* command = "CONDOR_JOB_REMOVE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!reason) reason=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(reason) );
int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free(esc1);
free(esc2);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,953 | GahpClient::condor_job_stage_in(const char *schedd_name, ClassAd *job_ad)
{
static const char* command = "CONDOR_JOB_STAGE_IN";
MyString ad_string;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!job_ad) {
ad_string=NULLSTRING;
} else {
if ( useXMLClassads ) {
ClassAdXMLUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( job_ad, ad_string );
} else {
NewClassAdUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( job_ad, ad_string );
}
}
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(ad_string.Value()) );
int x = sprintf(reqline, "%s %s", esc1, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::condor_job_stage_in(const char *schedd_name, ClassAd *job_ad)
{
static const char* command = "CONDOR_JOB_STAGE_IN";
MyString ad_string;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!job_ad) {
ad_string=NULLSTRING;
} else {
if ( useXMLClassads ) {
ClassAdXMLUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( job_ad, ad_string );
} else {
NewClassAdUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( job_ad, ad_string );
}
}
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(ad_string.Value()) );
int x = sprintf(reqline, "%s %s", esc1, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,954 | GahpClient::condor_job_stage_out(const char *schedd_name, PROC_ID job_id)
{
static const char* command = "CONDOR_JOB_STAGE_OUT";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
int x = sprintf(reqline, "%s %d.%d", esc1, job_id.cluster, job_id.proc);
free( esc1 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::condor_job_stage_out(const char *schedd_name, PROC_ID job_id)
{
static const char* command = "CONDOR_JOB_STAGE_OUT";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
int x = sprintf(reqline, "%s %d.%d", esc1, job_id.cluster, job_id.proc);
free( esc1 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,955 | GahpClient::condor_job_status_constrained(const char *schedd_name,
const char *constraint,
int *num_ads, ClassAd ***ads)
{
static const char* command = "CONDOR_JOB_STATUS_CONSTRAINED";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!constraint) constraint=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(constraint) );
int x = sprintf( reqline, "%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc < 4) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
*num_ads = atoi(result->argv[3]);
if (result->argc != 4 + *num_ads ) {
EXCEPT("Bad %s Result",command);
}
if ( *num_ads > 0 ) {
*ads = (ClassAd **)malloc( *num_ads * sizeof(ClassAd*) );
int idst = 0;
for ( int i = 0; i < *num_ads; i++,idst++ ) {
if ( useXMLClassads ) {
ClassAdXMLParser parser;
(*ads)[idst] = parser.ParseClassAd( result->argv[4 + i] );
} else {
NewClassAdParser parser;
(*ads)[idst] = parser.ParseClassAd( result->argv[4 + i] );
}
if( (*ads)[idst] == NULL) {
dprintf(D_ALWAYS, "ERROR: Condor-C GAHP returned "
"unparsable classad: (#%d) %s\n", i, result->argv[4+i]);
idst--;
(*num_ads)--;
}
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::condor_job_status_constrained(const char *schedd_name,
const char *constraint,
int *num_ads, ClassAd ***ads)
{
static const char* command = "CONDOR_JOB_STATUS_CONSTRAINED";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!constraint) constraint=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(constraint) );
int x = sprintf( reqline, "%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc < 4) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
*num_ads = atoi(result->argv[3]);
if (result->argc != 4 + *num_ads ) {
EXCEPT("Bad %s Result",command);
}
if ( *num_ads > 0 ) {
*ads = (ClassAd **)malloc( *num_ads * sizeof(ClassAd*) );
int idst = 0;
for ( int i = 0; i < *num_ads; i++,idst++ ) {
if ( useXMLClassads ) {
ClassAdXMLParser parser;
(*ads)[idst] = parser.ParseClassAd( result->argv[4 + i] );
} else {
NewClassAdParser parser;
(*ads)[idst] = parser.ParseClassAd( result->argv[4 + i] );
}
if( (*ads)[idst] == NULL) {
dprintf(D_ALWAYS, "ERROR: Condor-C GAHP returned "
"unparsable classad: (#%d) %s\n", i, result->argv[4+i]);
idst--;
(*num_ads)--;
}
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,956 | GahpClient::condor_job_update(const char *schedd_name, PROC_ID job_id,
ClassAd *update_ad)
{
static const char* command = "CONDOR_JOB_UPDATE";
MyString ad_string;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!update_ad) {
ad_string=NULLSTRING;
} else {
if ( useXMLClassads ) {
ClassAdXMLUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( update_ad, ad_string );
} else {
NewClassAdUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( update_ad, ad_string );
}
}
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(ad_string.Value()) );
int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::condor_job_update(const char *schedd_name, PROC_ID job_id,
ClassAd *update_ad)
{
static const char* command = "CONDOR_JOB_UPDATE";
MyString ad_string;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!update_ad) {
ad_string=NULLSTRING;
} else {
if ( useXMLClassads ) {
ClassAdXMLUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( update_ad, ad_string );
} else {
NewClassAdUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( update_ad, ad_string );
}
}
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(ad_string.Value()) );
int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,957 | GahpClient::condor_job_update_constrained(const char *schedd_name,
const char *constraint,
ClassAd *update_ad)
{
static const char* command = "CONDOR_JOB_UPDATE_CONSTRAINED";
MyString ad_string;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!constraint) constraint=NULLSTRING;
if (!update_ad) {
ad_string=NULLSTRING;
} else {
if ( useXMLClassads ) {
ClassAdXMLUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( update_ad, ad_string );
} else {
NewClassAdUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( update_ad, ad_string );
}
}
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(constraint) );
char *esc3 = strdup( escapeGahpString(ad_string.Value()) );
int x = sprintf( reqline, "%s %s %s", esc1, esc2, esc3 );
free( esc1 );
free( esc2 );
free( esc3 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::condor_job_update_constrained(const char *schedd_name,
const char *constraint,
ClassAd *update_ad)
{
static const char* command = "CONDOR_JOB_UPDATE_CONSTRAINED";
MyString ad_string;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!schedd_name) schedd_name=NULLSTRING;
if (!constraint) constraint=NULLSTRING;
if (!update_ad) {
ad_string=NULLSTRING;
} else {
if ( useXMLClassads ) {
ClassAdXMLUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( update_ad, ad_string );
} else {
NewClassAdUnparser unparser;
unparser.SetUseCompactSpacing( true );
unparser.SetOutputType( false );
unparser.SetOutputTargetType( false );
unparser.Unparse( update_ad, ad_string );
}
}
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(constraint) );
char *esc3 = strdup( escapeGahpString(ad_string.Value()) );
int x = sprintf( reqline, "%s %s %s", esc1, esc2, esc3 );
free( esc1 );
free( esc2 );
free( esc3 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,958 | GahpClient::condor_job_update_lease(const char *schedd_name,
const SimpleList<PROC_ID> &jobs,
const SimpleList<int> &expirations,
SimpleList<PROC_ID> &updated )
{
static const char* command = "CONDOR_JOB_UPDATE_LEASE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
ASSERT( jobs.Length() == expirations.Length() );
if (!schedd_name) schedd_name=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
int x = sprintf(reqline, "%s %d", esc1, jobs.Length());
free( esc1 );
ASSERT( x > 0 );
SimpleListIterator<PROC_ID> jobs_i (jobs);
SimpleListIterator<int> exps_i (expirations);
PROC_ID next_job;
int next_exp;
while ( jobs_i.Next( next_job ) && exps_i.Next( next_exp ) ) {
x = sprintf_cat( reqline, " %d.%d %d", next_job.cluster, next_job.proc,
next_exp );
ASSERT( x > 0 );
}
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 4) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
updated.Clear();
char *ptr1 = result->argv[3];
while ( ptr1 != NULL && *ptr1 != '\0' ) {
int i;
PROC_ID job_id;
char *ptr2 = strchr( ptr1, ',' );
if ( ptr2 ) {
*ptr2 = '\0';
ptr2++;
}
i = sscanf( ptr1, "%d.%d", &job_id.cluster, &job_id.proc );
if ( i != 2 ) {
dprintf( D_ALWAYS, "condor_job_update_lease: skipping malformed job id '%s'\n", ptr1 );
} else {
updated.Append( job_id );
}
ptr1 = ptr2;
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::condor_job_update_lease(const char *schedd_name,
const SimpleList<PROC_ID> &jobs,
const SimpleList<int> &expirations,
SimpleList<PROC_ID> &updated )
{
static const char* command = "CONDOR_JOB_UPDATE_LEASE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
ASSERT( jobs.Length() == expirations.Length() );
if (!schedd_name) schedd_name=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
int x = sprintf(reqline, "%s %d", esc1, jobs.Length());
free( esc1 );
ASSERT( x > 0 );
SimpleListIterator<PROC_ID> jobs_i (jobs);
SimpleListIterator<int> exps_i (expirations);
PROC_ID next_job;
int next_exp;
while ( jobs_i.Next( next_job ) && exps_i.Next( next_exp ) ) {
x = sprintf_cat( reqline, " %d.%d %d", next_job.cluster, next_job.proc,
next_exp );
ASSERT( x > 0 );
}
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 4) {
EXCEPT("Bad %s Result",command);
}
int rc = 1;
if ( result->argv[1][0] == 'S' ) {
rc = 0;
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
updated.Clear();
char *ptr1 = result->argv[3];
while ( ptr1 != NULL && *ptr1 != '\0' ) {
int i;
PROC_ID job_id;
char *ptr2 = strchr( ptr1, ',' );
if ( ptr2 ) {
*ptr2 = '\0';
ptr2++;
}
i = sscanf( ptr1, "%d.%d", &job_id.cluster, &job_id.proc );
if ( i != 2 ) {
dprintf( D_ALWAYS, "condor_job_update_lease: skipping malformed job id '%s'\n", ptr1 );
} else {
updated.Append( job_id );
}
ptr1 = ptr2;
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,959 | GahpClient::cream_delegate(const char *delg_service, const char *delg_id)
{
static const char* command = "CREAM_DELEGATE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!delg_service) delg_service=NULLSTRING;
if (!delg_id) delg_id=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(delg_service) );
char *esc2 = strdup( escapeGahpString(delg_id) );
int x = sprintf(reqline, "%s %s", esc2, esc1);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy,high_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc;
if (strcmp(result->argv[1], NULLSTRING) == 0) {
rc = 0;
} else {
rc = 1;
error_string = result->argv[1];
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::cream_delegate(const char *delg_service, const char *delg_id)
{
static const char* command = "CREAM_DELEGATE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!delg_service) delg_service=NULLSTRING;
if (!delg_id) delg_id=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(delg_service) );
char *esc2 = strdup( escapeGahpString(delg_id) );
int x = sprintf(reqline, "%s %s", esc2, esc1);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy,high_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc;
if (strcmp(result->argv[1], NULLSTRING) == 0) {
rc = 0;
} else {
rc = 1;
error_string = result->argv[1];
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,960 | GahpClient::cream_job_purge(const char *service, const char *job_id)
{
static const char* command = "CREAM_JOB_PURGE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
if (!job_id) job_id=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,medium_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc;
if (strcmp(result->argv[1], NULLSTRING) == 0) {
rc = 0;
} else {
rc = 1;
error_string = result->argv[1];
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::cream_job_purge(const char *service, const char *job_id)
{
static const char* command = "CREAM_JOB_PURGE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
if (!job_id) job_id=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,medium_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc;
if (strcmp(result->argv[1], NULLSTRING) == 0) {
rc = 0;
} else {
rc = 1;
error_string = result->argv[1];
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,961 | GahpClient::cream_job_register(const char *service, const char *delg_id,
const char *jdl, const char *lease_id, char **job_id, char **upload_url, char **download_url)
{
static const char* command = "CREAM_JOB_REGISTER";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
if (!delg_id) delg_id=NULLSTRING;
if (!jdl) jdl = NULLSTRING;
if (!lease_id) lease_id = "";
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(delg_id) );
char *esc3 = strdup( escapeGahpString(jdl) );
char *esc4 = strdup( escapeGahpString(lease_id) );
int x = sprintf( reqline, "%s %s %s %s", esc1, esc2, esc3, esc4 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy,low_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
int rc = 0;
if ( result->argc == 2 ) {
if ( !strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
error_string = result->argv[1];
rc = 1;
} else if ( result->argc == 5 ) {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
*job_id = strdup(result->argv[2]);
}
if ( strcasecmp(result->argv[3], NULLSTRING) ) {
*upload_url = strdup(result->argv[3]);
}
if ( strcasecmp(result->argv[4], NULLSTRING) ) {
*download_url = strdup(result->argv[4]);
}
rc = 0;
} else {
EXCEPT( "Bad %s result", command );
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::cream_job_register(const char *service, const char *delg_id,
const char *jdl, const char *lease_id, char **job_id, char **upload_url, char **download_url)
{
static const char* command = "CREAM_JOB_REGISTER";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
if (!delg_id) delg_id=NULLSTRING;
if (!jdl) jdl = NULLSTRING;
if (!lease_id) lease_id = "";
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(delg_id) );
char *esc3 = strdup( escapeGahpString(jdl) );
char *esc4 = strdup( escapeGahpString(lease_id) );
int x = sprintf( reqline, "%s %s %s %s", esc1, esc2, esc3, esc4 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy,low_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
int rc = 0;
if ( result->argc == 2 ) {
if ( !strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
error_string = result->argv[1];
rc = 1;
} else if ( result->argc == 5 ) {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
*job_id = strdup(result->argv[2]);
}
if ( strcasecmp(result->argv[3], NULLSTRING) ) {
*upload_url = strdup(result->argv[3]);
}
if ( strcasecmp(result->argv[4], NULLSTRING) ) {
*download_url = strdup(result->argv[4]);
}
rc = 0;
} else {
EXCEPT( "Bad %s result", command );
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,962 | GahpClient::cream_job_status(const char *service, const char *job_id,
char **job_status, int *exit_code, char **failure_reason)
{
static const char* command = "CREAM_JOB_STATUS";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
if (!job_id) job_id=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,medium_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc > 2) {
if( result->argc != 3 + atoi(result->argv[2]) * 4){
EXCEPT("Bad %s Result",command);
}
}
else if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc;
if (strcmp(result->argv[1], NULLSTRING) == 0) {
rc = 0;
} else {
rc = 1;
error_string = result->argv[1];
}
if ( rc == 0 ) {
*job_status = strdup(result->argv[4]);
*exit_code = atoi(result->argv[5]);
if ( strcasecmp(result->argv[6], NULLSTRING) ) {
*failure_reason = strdup(result->argv[6]);
} else {
*failure_reason = NULL;
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::cream_job_status(const char *service, const char *job_id,
char **job_status, int *exit_code, char **failure_reason)
{
static const char* command = "CREAM_JOB_STATUS";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
if (!job_id) job_id=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,medium_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc > 2) {
if( result->argc != 3 + atoi(result->argv[2]) * 4){
EXCEPT("Bad %s Result",command);
}
}
else if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc;
if (strcmp(result->argv[1], NULLSTRING) == 0) {
rc = 0;
} else {
rc = 1;
error_string = result->argv[1];
}
if ( rc == 0 ) {
*job_status = strdup(result->argv[4]);
*exit_code = atoi(result->argv[5]);
if ( strcasecmp(result->argv[6], NULLSTRING) ) {
*failure_reason = strdup(result->argv[6]);
} else {
*failure_reason = NULL;
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,963 | GahpClient::cream_job_status_all(const char *service,
GahpClient::CreamJobStatusMap & results)
{
static const char* command = "CREAM_JOB_STATUS";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
int job_number = 0; // "all"
int x = sprintf(reqline, "%s %d", esc1, job_number);
ASSERT( x > 0 );
free( esc1 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,high_prio);
}
const int FIRST_RESULT = 3; // Field 3 (0 indexed) is the first
const int RECORD_FIELDS = 4; // How many fields in a record?
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
int num_results = 0;
if (result->argc > 2) {
num_results = atoi(result->argv[2]);
if( result->argc != FIRST_RESULT + num_results * RECORD_FIELDS) {
EXCEPT("Bad %s Result",command);
}
}
else if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc;
if (strcmp(result->argv[1], NULLSTRING) == 0) {
rc = 0;
} else {
rc = 1;
error_string = result->argv[1];
}
if ( rc == 0 ) {
for(int i = 0; i < num_results; i++) {
CreamJobStatus status;
int offset = FIRST_RESULT + i * RECORD_FIELDS;
status.job_id = result->argv[offset + 0];
status.job_status = result->argv[offset + 1];
status.exit_code = atoi(result->argv[offset + 2]);
if ( strcasecmp(result->argv[offset + 3], NULLSTRING) ) {
status.failure_reason = result->argv[offset + 3];
}
results[status.job_id] = status;
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::cream_job_status_all(const char *service,
GahpClient::CreamJobStatusMap & results)
{
static const char* command = "CREAM_JOB_STATUS";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
int job_number = 0; // "all"
int x = sprintf(reqline, "%s %d", esc1, job_number);
ASSERT( x > 0 );
free( esc1 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,high_prio);
}
const int FIRST_RESULT = 3; // Field 3 (0 indexed) is the first
const int RECORD_FIELDS = 4; // How many fields in a record?
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
int num_results = 0;
if (result->argc > 2) {
num_results = atoi(result->argv[2]);
if( result->argc != FIRST_RESULT + num_results * RECORD_FIELDS) {
EXCEPT("Bad %s Result",command);
}
}
else if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc;
if (strcmp(result->argv[1], NULLSTRING) == 0) {
rc = 0;
} else {
rc = 1;
error_string = result->argv[1];
}
if ( rc == 0 ) {
for(int i = 0; i < num_results; i++) {
CreamJobStatus status;
int offset = FIRST_RESULT + i * RECORD_FIELDS;
status.job_id = result->argv[offset + 0];
status.job_status = result->argv[offset + 1];
status.exit_code = atoi(result->argv[offset + 2]);
if ( strcasecmp(result->argv[offset + 3], NULLSTRING) ) {
status.failure_reason = result->argv[offset + 3];
}
results[status.job_id] = status;
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,964 | GahpClient::cream_job_suspend(const char *service, const char *job_id)
{
static const char* command = "CREAM_JOB_SUSPEND";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
if (!job_id) job_id=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,medium_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc;
if (strcmp(result->argv[1], NULLSTRING) == 0) {
rc = 0;
} else {
rc = 1;
error_string = result->argv[1];
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::cream_job_suspend(const char *service, const char *job_id)
{
static const char* command = "CREAM_JOB_SUSPEND";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
if (!job_id) job_id=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,medium_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc;
if (strcmp(result->argv[1], NULLSTRING) == 0) {
rc = 0;
} else {
rc = 1;
error_string = result->argv[1];
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,965 | GahpClient::cream_ping(const char * service)
{
static const char* command = "CREAM_PING";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(service));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,high_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
int rc = 0;
if (result->argc < 2 || result->argc > 3) {
EXCEPT("Bad %s Result",command);
}
if (strcmp(result->argv[1], NULLSTRING) == 0) {
if ( strcasecmp( result->argv[2], "true" ) ) {
rc = 0;
} else {
rc = 1;
error_string = "";
}
} else {
rc = 1;
error_string = result->argv[1];
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::cream_ping(const char * service)
{
static const char* command = "CREAM_PING";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(service));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,high_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
int rc = 0;
if (result->argc < 2 || result->argc > 3) {
EXCEPT("Bad %s Result",command);
}
if (strcmp(result->argv[1], NULLSTRING) == 0) {
if ( strcasecmp( result->argv[2], "true" ) ) {
rc = 0;
} else {
rc = 1;
error_string = "";
}
} else {
rc = 1;
error_string = result->argv[1];
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,966 | GahpClient::cream_set_lease(const char *service, const char *lease_id, time_t &lease_expiry)
{
static const char* command = "CREAM_SET_LEASE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
if (!lease_id) lease_id=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(lease_id) );
int x = sprintf(reqline, "%s %s %ld", esc1, esc2, (long)lease_expiry);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,high_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
int rc = 0;
if ( result->argc == 2 ) {
if ( !strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
error_string = result->argv[1];
rc = 1;
} else if ( result->argc == 3 ) {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
lease_expiry = atoi( result->argv[2] );
}
rc = 0;
} else {
EXCEPT( "Bad %s result", command );
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::cream_set_lease(const char *service, const char *lease_id, time_t &lease_expiry)
{
static const char* command = "CREAM_SET_LEASE";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!service) service=NULLSTRING;
if (!lease_id) lease_id=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(lease_id) );
int x = sprintf(reqline, "%s %s %ld", esc1, esc2, (long)lease_expiry);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy,high_prio);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
int rc = 0;
if ( result->argc == 2 ) {
if ( !strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
error_string = result->argv[1];
rc = 1;
} else if ( result->argc == 3 ) {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
lease_expiry = atoi( result->argv[2] );
}
rc = 0;
} else {
EXCEPT( "Bad %s result", command );
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,967 | int GahpClient::dcloud_action( const char *service_url,
const char *username,
const char *password,
const char *instance_id,
const char *action )
{
static const char* command = "DELTACLOUD_VM_ACTION";
if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !service_url ) service_url = NULLSTRING;
if ( !username ) username = NULLSTRING;
if ( !password ) password = NULLSTRING;
if ( !instance_id ) instance_id = NULLSTRING;
if ( !action ) action = NULLSTRING;
MyString reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
char* esc4 = strdup( escapeGahpString(instance_id) );
char* esc5 = strdup( escapeGahpString(action) );
bool x = reqline.sprintf("%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5);
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
ASSERT( x == true );
const char *buf = reqline.Value();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc != 2 ) {
EXCEPT( "Bad %s result", command );
} else {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
error_string = result->argv[1];
rc = 1;
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | int GahpClient::dcloud_action( const char *service_url,
const char *username,
const char *password,
const char *instance_id,
const char *action )
{
static const char* command = "DELTACLOUD_VM_ACTION";
if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !service_url ) service_url = NULLSTRING;
if ( !username ) username = NULLSTRING;
if ( !password ) password = NULLSTRING;
if ( !instance_id ) instance_id = NULLSTRING;
if ( !action ) action = NULLSTRING;
MyString reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
char* esc4 = strdup( escapeGahpString(instance_id) );
char* esc5 = strdup( escapeGahpString(action) );
bool x = reqline.sprintf("%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5);
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
ASSERT( x == true );
const char *buf = reqline.Value();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc != 2 ) {
EXCEPT( "Bad %s result", command );
} else {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
error_string = result->argv[1];
rc = 1;
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,968 | int GahpClient::dcloud_find( const char *service_url,
const char *username,
const char *password,
const char *instance_name,
char **instance_id )
{
static const char* command = "DELTACLOUD_VM_FIND";
if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !service_url ) service_url = NULLSTRING;
if ( !username ) username = NULLSTRING;
if ( !password ) password = NULLSTRING;
if ( !instance_name ) instance_name = NULLSTRING;
MyString reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
char* esc4 = strdup( escapeGahpString(instance_name) );
bool x = reqline.sprintf("%s %s %s %s", esc1, esc2, esc3, esc4);
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
ASSERT( x == true );
const char *buf = reqline.Value();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc < 2 || result->argc > 3 ) {
EXCEPT( "Bad %s result", command );
} else if ( result->argc == 2 ) {
if ( !strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
error_string = result->argv[1];
rc = 1;
} else {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
if ( strcmp( result->argv[2], NULLSTRING ) ) {
*instance_id = strdup( result->argv[2] );
} else {
*instance_id = NULL;
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | int GahpClient::dcloud_find( const char *service_url,
const char *username,
const char *password,
const char *instance_name,
char **instance_id )
{
static const char* command = "DELTACLOUD_VM_FIND";
if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !service_url ) service_url = NULLSTRING;
if ( !username ) username = NULLSTRING;
if ( !password ) password = NULLSTRING;
if ( !instance_name ) instance_name = NULLSTRING;
MyString reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
char* esc4 = strdup( escapeGahpString(instance_name) );
bool x = reqline.sprintf("%s %s %s %s", esc1, esc2, esc3, esc4);
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
ASSERT( x == true );
const char *buf = reqline.Value();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc < 2 || result->argc > 3 ) {
EXCEPT( "Bad %s result", command );
} else if ( result->argc == 2 ) {
if ( !strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
error_string = result->argv[1];
rc = 1;
} else {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
if ( strcmp( result->argv[2], NULLSTRING ) ) {
*instance_id = strdup( result->argv[2] );
} else {
*instance_id = NULL;
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,969 | int GahpClient::dcloud_start_auto( const char *service_url,
const char *username,
const char *password,
bool *autostart )
{
static const char* command = "DELTACLOUD_START_AUTO";
if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !service_url ) service_url = NULLSTRING;
if ( !username ) username = NULLSTRING;
if ( !password ) password = NULLSTRING;
MyString reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
bool x = reqline.sprintf("%s %s %s", esc1, esc2, esc3);
free( esc1 );
free( esc2 );
free( esc3 );
ASSERT( x == true );
const char *buf = reqline.Value();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc < 2 || result->argc > 3 ) {
EXCEPT( "Bad %s result", command );
} else if ( result->argc == 2 ) {
if ( !strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
error_string = result->argv[1];
rc = 1;
} else {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
if ( strcmp( result->argv[2], "TRUE" ) == 0 ) {
*autostart = TRUE;
} else if ( strcmp( result->argv[2], "FALSE" ) == 0 ) {
*autostart = FALSE;
} else {
EXCEPT( "Bad %s result", command );
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | int GahpClient::dcloud_start_auto( const char *service_url,
const char *username,
const char *password,
bool *autostart )
{
static const char* command = "DELTACLOUD_START_AUTO";
if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !service_url ) service_url = NULLSTRING;
if ( !username ) username = NULLSTRING;
if ( !password ) password = NULLSTRING;
MyString reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
bool x = reqline.sprintf("%s %s %s", esc1, esc2, esc3);
free( esc1 );
free( esc2 );
free( esc3 );
ASSERT( x == true );
const char *buf = reqline.Value();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc < 2 || result->argc > 3 ) {
EXCEPT( "Bad %s result", command );
} else if ( result->argc == 2 ) {
if ( !strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
error_string = result->argv[1];
rc = 1;
} else {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
if ( strcmp( result->argv[2], "TRUE" ) == 0 ) {
*autostart = TRUE;
} else if ( strcmp( result->argv[2], "FALSE" ) == 0 ) {
*autostart = FALSE;
} else {
EXCEPT( "Bad %s result", command );
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,970 | int GahpClient::dcloud_status_all( const char *service_url,
const char *username,
const char *password,
StringList &instance_ids,
StringList &statuses )
{
static const char* command = "DELTACLOUD_VM_STATUS_ALL";
if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !service_url ) service_url = NULLSTRING;
if ( !username ) username = NULLSTRING;
if ( !password ) password = NULLSTRING;
MyString reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
bool x = reqline.sprintf("%s %s %s", esc1, esc2, esc3);
free( esc1 );
free( esc2 );
free( esc3 );
ASSERT( x == true );
const char *buf = reqline.Value();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc < 2 || result->argc % 2 != 0 ) {
EXCEPT( "Bad %s result", command );
} else if ( result->argc == 2 ) {
if ( strcmp( result->argv[1], NULLSTRING ) == 0 ) {
instance_ids.clearAll();
statuses.clearAll();
} else {
error_string = result->argv[1];
rc = 1;
}
} else {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
instance_ids.clearAll();
statuses.clearAll();
for ( int i = 2; i < result->argc; i += 2 ) {
instance_ids.append( result->argv[i] );
statuses.append( result->argv[i + 1] );
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | int GahpClient::dcloud_status_all( const char *service_url,
const char *username,
const char *password,
StringList &instance_ids,
StringList &statuses )
{
static const char* command = "DELTACLOUD_VM_STATUS_ALL";
if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !service_url ) service_url = NULLSTRING;
if ( !username ) username = NULLSTRING;
if ( !password ) password = NULLSTRING;
MyString reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
bool x = reqline.sprintf("%s %s %s", esc1, esc2, esc3);
free( esc1 );
free( esc2 );
free( esc3 );
ASSERT( x == true );
const char *buf = reqline.Value();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc < 2 || result->argc % 2 != 0 ) {
EXCEPT( "Bad %s result", command );
} else if ( result->argc == 2 ) {
if ( strcmp( result->argv[1], NULLSTRING ) == 0 ) {
instance_ids.clearAll();
statuses.clearAll();
} else {
error_string = result->argv[1];
rc = 1;
}
} else {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
instance_ids.clearAll();
statuses.clearAll();
for ( int i = 2; i < result->argc; i += 2 ) {
instance_ids.append( result->argv[i] );
statuses.append( result->argv[i + 1] );
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,971 | int GahpClient::dcloud_submit( const char *service_url,
const char *username,
const char *password,
const char *image_id,
const char *instance_name,
const char *realm_id,
const char *hwp_id,
const char *hwp_memory,
const char *hwp_cpu,
const char *hwp_storage,
const char *keyname,
const char *userdata,
StringList &attrs )
{
static const char* command = "DELTACLOUD_VM_SUBMIT";
if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !service_url ) service_url = NULLSTRING;
if ( !username ) username = NULLSTRING;
if ( !password ) password = NULLSTRING;
if ( !image_id ) image_id = NULLSTRING;
if ( !instance_name ) instance_name = NULLSTRING;
if ( !realm_id ) realm_id = NULLSTRING;
if ( !hwp_id ) hwp_id = NULLSTRING;
if ( !hwp_memory ) hwp_memory = NULLSTRING;
if ( !hwp_cpu ) hwp_cpu = NULLSTRING;
if ( !hwp_storage ) hwp_storage = NULLSTRING;
if ( !keyname ) keyname = NULLSTRING;
if ( !userdata ) userdata = NULLSTRING;
MyString reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
char* esc4 = strdup( escapeGahpString(image_id) );
char* esc5 = strdup( escapeGahpString(instance_name) );
char* esc6 = strdup( escapeGahpString(realm_id) );
char* esc7 = strdup( escapeGahpString(hwp_id) );
char* esc8 = strdup( escapeGahpString(hwp_memory) );
char* esc9 = strdup( escapeGahpString(hwp_cpu) );
char* esc10 = strdup( escapeGahpString(hwp_storage) );
char* esc11 = strdup( escapeGahpString(keyname) );
char* esc12 = strdup( escapeGahpString(userdata) );
bool x = reqline.sprintf("%s %s %s %s %s %s %s %s %s %s %s %s", esc1, esc2, esc3,
esc4, esc5, esc6, esc7, esc8, esc9, esc10, esc11, esc12);
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
free( esc6 );
free( esc7 );
free( esc8 );
free( esc9 );
free( esc10 );
free( esc11 );
free( esc12 );
ASSERT( x == true );
const char *buf = reqline.Value();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc < 2 ) {
EXCEPT( "Bad %s result", command );
} else if ( result->argc == 2 ) {
if ( !strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
error_string = result->argv[1];
rc = 1;
} else {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
attrs.clearAll();
for ( int i = 2; i < result->argc; i++ ) {
attrs.append( result->argv[i] );
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | int GahpClient::dcloud_submit( const char *service_url,
const char *username,
const char *password,
const char *image_id,
const char *instance_name,
const char *realm_id,
const char *hwp_id,
const char *hwp_memory,
const char *hwp_cpu,
const char *hwp_storage,
const char *keyname,
const char *userdata,
StringList &attrs )
{
static const char* command = "DELTACLOUD_VM_SUBMIT";
if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !service_url ) service_url = NULLSTRING;
if ( !username ) username = NULLSTRING;
if ( !password ) password = NULLSTRING;
if ( !image_id ) image_id = NULLSTRING;
if ( !instance_name ) instance_name = NULLSTRING;
if ( !realm_id ) realm_id = NULLSTRING;
if ( !hwp_id ) hwp_id = NULLSTRING;
if ( !hwp_memory ) hwp_memory = NULLSTRING;
if ( !hwp_cpu ) hwp_cpu = NULLSTRING;
if ( !hwp_storage ) hwp_storage = NULLSTRING;
if ( !keyname ) keyname = NULLSTRING;
if ( !userdata ) userdata = NULLSTRING;
MyString reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
char* esc4 = strdup( escapeGahpString(image_id) );
char* esc5 = strdup( escapeGahpString(instance_name) );
char* esc6 = strdup( escapeGahpString(realm_id) );
char* esc7 = strdup( escapeGahpString(hwp_id) );
char* esc8 = strdup( escapeGahpString(hwp_memory) );
char* esc9 = strdup( escapeGahpString(hwp_cpu) );
char* esc10 = strdup( escapeGahpString(hwp_storage) );
char* esc11 = strdup( escapeGahpString(keyname) );
char* esc12 = strdup( escapeGahpString(userdata) );
bool x = reqline.sprintf("%s %s %s %s %s %s %s %s %s %s %s %s", esc1, esc2, esc3,
esc4, esc5, esc6, esc7, esc8, esc9, esc10, esc11, esc12);
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
free( esc6 );
free( esc7 );
free( esc8 );
free( esc9 );
free( esc10 );
free( esc11 );
free( esc12 );
ASSERT( x == true );
const char *buf = reqline.Value();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc < 2 ) {
EXCEPT( "Bad %s result", command );
} else if ( result->argc == 2 ) {
if ( !strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
error_string = result->argv[1];
rc = 1;
} else {
if ( strcmp( result->argv[1], NULLSTRING ) ) {
EXCEPT( "Bad %s result", command );
}
attrs.clearAll();
for ( int i = 2; i < result->argc; i++ ) {
attrs.append( result->argv[i] );
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,972 | GahpServer::doProxyCheck()
{
proxy_check_tid = TIMER_UNSET;
if ( m_gahp_pid == -1 ) {
return;
}
GahpProxyInfo *next_proxy;
if ( ProxiesByFilename ) {
ProxiesByFilename->startIterations();
while ( ProxiesByFilename->iterate( next_proxy ) != 0 ) {
if ( next_proxy->proxy->expiration_time >
next_proxy->cached_expiration ) {
if ( cacheProxyFromFile( next_proxy ) == false ) {
EXCEPT( "Failed to refresh proxy!" );
}
next_proxy->cached_expiration = next_proxy->proxy->expiration_time;
}
}
}
if ( master_proxy->proxy->expiration_time >
master_proxy->cached_expiration ) {
static const char *command = "REFRESH_PROXY_FROM_FILE";
if ( m_commands_supported->contains_anycase( command ) ) {
if ( command_initialize_from_file(
master_proxy->proxy->proxy_filename,
command) == false ) {
EXCEPT( "Failed to refresh proxy!" );
}
}
if ( can_cache_proxies ) {
if ( cacheProxyFromFile( master_proxy ) == false ) {
EXCEPT( "Failed to refresh proxy!" );
}
}
master_proxy->cached_expiration = master_proxy->proxy->expiration_time;
}
}
| DoS Exec Code | 0 | GahpServer::doProxyCheck()
{
proxy_check_tid = TIMER_UNSET;
if ( m_gahp_pid == -1 ) {
return;
}
GahpProxyInfo *next_proxy;
if ( ProxiesByFilename ) {
ProxiesByFilename->startIterations();
while ( ProxiesByFilename->iterate( next_proxy ) != 0 ) {
if ( next_proxy->proxy->expiration_time >
next_proxy->cached_expiration ) {
if ( cacheProxyFromFile( next_proxy ) == false ) {
EXCEPT( "Failed to refresh proxy!" );
}
next_proxy->cached_expiration = next_proxy->proxy->expiration_time;
}
}
}
if ( master_proxy->proxy->expiration_time >
master_proxy->cached_expiration ) {
static const char *command = "REFRESH_PROXY_FROM_FILE";
if ( m_commands_supported->contains_anycase( command ) ) {
if ( command_initialize_from_file(
master_proxy->proxy->proxy_filename,
command) == false ) {
EXCEPT( "Failed to refresh proxy!" );
}
}
if ( can_cache_proxies ) {
if ( cacheProxyFromFile( master_proxy ) == false ) {
EXCEPT( "Failed to refresh proxy!" );
}
}
master_proxy->cached_expiration = master_proxy->proxy->expiration_time;
}
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,973 | int GahpClient::ec2_associate_address(const char * service_url,
const char * publickeyfile,
const char * privatekeyfile,
const char * instance_id,
const char * elastic_ip,
StringList & returnStatus,
char* & error_code )
{
static const char* command = "EC2_VM_ASSOCIATE_ADDRESS";
int rc=0;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) || (instance_id == NULL) || (elastic_ip == NULL) ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(instance_id) );
char* esc5 = strdup( escapeGahpString(elastic_ip) );
int x = sprintf(reqline, "%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int return_code = atoi(result->argv[1]);
if (return_code == 1) {
if (result->argc == 2) {
error_string = "";
} else if (result->argc == 4) {
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
} else {
EXCEPT("Bad %s Result",command);
}
} else { // return_code == 0
if ( ( (result->argc-2) % 2) != 0 ) {
EXCEPT("Bad %s Result",command);
} else {
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
returnStatus.rewind();
}
}
delete result;
}
return rc;
}
| DoS Exec Code | 0 | int GahpClient::ec2_associate_address(const char * service_url,
const char * publickeyfile,
const char * privatekeyfile,
const char * instance_id,
const char * elastic_ip,
StringList & returnStatus,
char* & error_code )
{
static const char* command = "EC2_VM_ASSOCIATE_ADDRESS";
int rc=0;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) || (instance_id == NULL) || (elastic_ip == NULL) ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(instance_id) );
char* esc5 = strdup( escapeGahpString(elastic_ip) );
int x = sprintf(reqline, "%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int return_code = atoi(result->argv[1]);
if (return_code == 1) {
if (result->argc == 2) {
error_string = "";
} else if (result->argc == 4) {
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
} else {
EXCEPT("Bad %s Result",command);
}
} else { // return_code == 0
if ( ( (result->argc-2) % 2) != 0 ) {
EXCEPT("Bad %s Result",command);
} else {
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
returnStatus.rewind();
}
}
delete result;
}
return rc;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,974 | int GahpClient::ec2_attach_volume(const char * service_url,
const char * publickeyfile,
const char * privatekeyfile,
const char * volume_id,
const char * instance_id,
const char * device_id,
StringList & returnStatus,
char* & error_code )
{
static const char* command = "EC_VM_ATTACH_VOLUME";
int rc=0;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) || (instance_id == NULL) || (volume_id == NULL) || (device_id == NULL) ){
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(volume_id) );
char* esc5 = strdup( escapeGahpString(instance_id) );
char* esc6 = strdup( escapeGahpString(device_id) );
int x = sprintf(reqline, "%s %s %s %s %s %s", esc1, esc2, esc3, esc4, esc5, esc6 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
free( esc6 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( m_mode == results_only )
{
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
else
{
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int result_code = atoi(result->argv[1]);
if (result_code == 1) {
if (result->argc == 2) {
error_string = "";
} else if (result->argc == 4) {
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
} else {
EXCEPT("Bad %s Result",command);
}
} else { // result_code == 0
if ( ( (result->argc-2) % 2) != 0 ) {
EXCEPT("Bad %s Result",command);
} else {
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
returnStatus.rewind();
}
}
delete result;
}
return rc;
}
| DoS Exec Code | 0 | int GahpClient::ec2_attach_volume(const char * service_url,
const char * publickeyfile,
const char * privatekeyfile,
const char * volume_id,
const char * instance_id,
const char * device_id,
StringList & returnStatus,
char* & error_code )
{
static const char* command = "EC_VM_ATTACH_VOLUME";
int rc=0;
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) || (instance_id == NULL) || (volume_id == NULL) || (device_id == NULL) ){
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(volume_id) );
char* esc5 = strdup( escapeGahpString(instance_id) );
char* esc6 = strdup( escapeGahpString(device_id) );
int x = sprintf(reqline, "%s %s %s %s %s %s", esc1, esc2, esc3, esc4, esc5, esc6 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
free( esc6 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( m_mode == results_only )
{
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
else
{
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int result_code = atoi(result->argv[1]);
if (result_code == 1) {
if (result->argc == 2) {
error_string = "";
} else if (result->argc == 4) {
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
} else {
EXCEPT("Bad %s Result",command);
}
} else { // result_code == 0
if ( ( (result->argc-2) % 2) != 0 ) {
EXCEPT("Bad %s Result",command);
} else {
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
returnStatus.rewind();
}
}
delete result;
}
return rc;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,975 | int GahpClient::ec2_ping(const char *service_url, const char * publickeyfile, const char * privatekeyfile)
{
static const char* command = "EC2_VM_STATUS_ALL";
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
std::string reqline;
sprintf(reqline, "%s %s %s", esc1, esc2, esc3 );
const char *buf = reqline.c_str();
free( esc1 );
free( esc2 );
free( esc3 );
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = atoi(result->argv[1]);
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | int GahpClient::ec2_ping(const char *service_url, const char * publickeyfile, const char * privatekeyfile)
{
static const char* command = "EC2_VM_STATUS_ALL";
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
std::string reqline;
sprintf(reqline, "%s %s %s", esc1, esc2, esc3 );
const char *buf = reqline.c_str();
free( esc1 );
free( esc2 );
free( esc3 );
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = atoi(result->argv[1]);
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,976 | int GahpClient::ec2_vm_start( const char * service_url,
const char * publickeyfile,
const char * privatekeyfile,
const char * ami_id,
const char * keypair,
const char * user_data,
const char * user_data_file,
const char * instance_type,
const char * availability_zone,
const char * vpc_subnet,
const char * vpc_ip,
StringList & groupnames,
char * &instance_id,
char * &error_code)
{
static const char* command = "EC2_VM_START";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) || (ami_id == NULL) ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !keypair ) keypair = NULLSTRING;
if ( !user_data ) user_data = NULLSTRING;
if ( !user_data_file ) user_data_file = NULLSTRING;
if ( !instance_type ) instance_type = NULLSTRING;
if ( !availability_zone || 0==strlen(availability_zone) ) availability_zone = NULLSTRING;
if ( !vpc_subnet || 0==strlen(vpc_subnet) ) vpc_subnet = NULLSTRING;
if ( !vpc_ip || 0==strlen(vpc_ip) ) vpc_ip = NULLSTRING;
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(ami_id) );
char* esc5 = strdup( escapeGahpString(keypair) );
char* esc6 = strdup( escapeGahpString(user_data) );
char* esc7 = strdup( escapeGahpString(user_data_file) );
char* esc8 = strdup( escapeGahpString(instance_type) );
char* esc9 = strdup( escapeGahpString(availability_zone) );
char* esc10 = strdup( escapeGahpString(vpc_subnet) );
char* esc11 = strdup( escapeGahpString(vpc_ip) );
int x = sprintf(reqline, "%s %s %s %s %s %s %s %s %s %s %s", esc1, esc2, esc3, esc4, esc5, esc6, esc7, esc8, esc9, esc10, esc11 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
free( esc6 );
free( esc7 );
free( esc8 );
free( esc9 );
free( esc10 );
free( esc11 );
ASSERT( x > 0 );
const char * group_name;
int cnt = 0;
char * esc_groupname;
groupnames.rewind();
if ( groupnames.number() > 0 ) {
while ( (group_name = groupnames.next()) ) {
esc_groupname = strdup( escapeGahpString(group_name) );
sprintf_cat(reqline, " %s", esc_groupname);
cnt++;
free( esc_groupname );
}
}
ASSERT( cnt == groupnames.number() );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc == 2 ) {
rc = atoi(result->argv[1]);
if ( rc == 0 ) {
EXCEPT( "Bad %s result", command );
rc = 1;
} else {
error_string = "";
}
} else if ( result->argc == 3 ) {
rc = atoi(result->argv[1]);
instance_id = strdup(result->argv[2]);
} else if ( result->argc == 4 ) {
rc = atoi( result->argv[1] );
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
} else {
EXCEPT( "Bad %s result", command );
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | int GahpClient::ec2_vm_start( const char * service_url,
const char * publickeyfile,
const char * privatekeyfile,
const char * ami_id,
const char * keypair,
const char * user_data,
const char * user_data_file,
const char * instance_type,
const char * availability_zone,
const char * vpc_subnet,
const char * vpc_ip,
StringList & groupnames,
char * &instance_id,
char * &error_code)
{
static const char* command = "EC2_VM_START";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) || (ami_id == NULL) ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !keypair ) keypair = NULLSTRING;
if ( !user_data ) user_data = NULLSTRING;
if ( !user_data_file ) user_data_file = NULLSTRING;
if ( !instance_type ) instance_type = NULLSTRING;
if ( !availability_zone || 0==strlen(availability_zone) ) availability_zone = NULLSTRING;
if ( !vpc_subnet || 0==strlen(vpc_subnet) ) vpc_subnet = NULLSTRING;
if ( !vpc_ip || 0==strlen(vpc_ip) ) vpc_ip = NULLSTRING;
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(ami_id) );
char* esc5 = strdup( escapeGahpString(keypair) );
char* esc6 = strdup( escapeGahpString(user_data) );
char* esc7 = strdup( escapeGahpString(user_data_file) );
char* esc8 = strdup( escapeGahpString(instance_type) );
char* esc9 = strdup( escapeGahpString(availability_zone) );
char* esc10 = strdup( escapeGahpString(vpc_subnet) );
char* esc11 = strdup( escapeGahpString(vpc_ip) );
int x = sprintf(reqline, "%s %s %s %s %s %s %s %s %s %s %s", esc1, esc2, esc3, esc4, esc5, esc6, esc7, esc8, esc9, esc10, esc11 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
free( esc5 );
free( esc6 );
free( esc7 );
free( esc8 );
free( esc9 );
free( esc10 );
free( esc11 );
ASSERT( x > 0 );
const char * group_name;
int cnt = 0;
char * esc_groupname;
groupnames.rewind();
if ( groupnames.number() > 0 ) {
while ( (group_name = groupnames.next()) ) {
esc_groupname = strdup( escapeGahpString(group_name) );
sprintf_cat(reqline, " %s", esc_groupname);
cnt++;
free( esc_groupname );
}
}
ASSERT( cnt == groupnames.number() );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if ( result->argc == 2 ) {
rc = atoi(result->argv[1]);
if ( rc == 0 ) {
EXCEPT( "Bad %s result", command );
rc = 1;
} else {
error_string = "";
}
} else if ( result->argc == 3 ) {
rc = atoi(result->argv[1]);
instance_id = strdup(result->argv[2]);
} else if ( result->argc == 4 ) {
rc = atoi( result->argv[1] );
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
} else {
EXCEPT( "Bad %s result", command );
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,977 | int GahpClient::ec2_vm_status( const char *service_url, const char * publickeyfile, const char * privatekeyfile,
const char * instance_id, StringList &returnStatus, char* & error_code )
{
static const char* command = "EC2_VM_STATUS";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) || (instance_id == NULL) ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(instance_id) );
int x = sprintf(reqline, "%s %s %s %s", esc1, esc2, esc3, esc4 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if (result->argc == 2) {
rc = atoi(result->argv[1]);
if (rc == 1) {
error_string = "";
}
}
else if (result->argc == 4) {
rc = atoi( result->argv[1] );
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
}
else if (result->argc == 5)
{
rc = atoi(result->argv[1]);
if (rc == 1) {
EXCEPT( "Bad %s result", command );
}
else {
if ( strcmp(result->argv[3], "running") == 0) {
rc = 1;
}
else
{
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
}
returnStatus.rewind();
}
}
else if (result->argc < 9) {
EXCEPT( "Bad %s result", command );
} else {
rc = atoi(result->argv[1]);
if (rc == 1) {
EXCEPT( "Bad %s result", command );
}
else {
if ( (strcmp(result->argv[3], "pending")!=0) &&
(strcmp(result->argv[3], "running")!=0) ) {
rc = 1;
}
else
{
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
}
returnStatus.rewind();
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | int GahpClient::ec2_vm_status( const char *service_url, const char * publickeyfile, const char * privatekeyfile,
const char * instance_id, StringList &returnStatus, char* & error_code )
{
static const char* command = "EC2_VM_STATUS";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) || (instance_id == NULL) ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(instance_id) );
int x = sprintf(reqline, "%s %s %s %s", esc1, esc2, esc3, esc4 );
free( esc1 );
free( esc2 );
free( esc3 );
free( esc4 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = 0;
if (result->argc == 2) {
rc = atoi(result->argv[1]);
if (rc == 1) {
error_string = "";
}
}
else if (result->argc == 4) {
rc = atoi( result->argv[1] );
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
}
else if (result->argc == 5)
{
rc = atoi(result->argv[1]);
if (rc == 1) {
EXCEPT( "Bad %s result", command );
}
else {
if ( strcmp(result->argv[3], "running") == 0) {
rc = 1;
}
else
{
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
}
returnStatus.rewind();
}
}
else if (result->argc < 9) {
EXCEPT( "Bad %s result", command );
} else {
rc = atoi(result->argv[1]);
if (rc == 1) {
EXCEPT( "Bad %s result", command );
}
else {
if ( (strcmp(result->argv[3], "pending")!=0) &&
(strcmp(result->argv[3], "running")!=0) ) {
rc = 1;
}
else
{
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
}
returnStatus.rewind();
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,978 | int GahpClient::ec2_vm_vm_keypair_all( const char *service_url, const char* publickeyfile, const char* privatekeyfile,
StringList & returnStatus, char* & error_code )
{
static const char* command = "EC2_VM_RUNNING_KEYPAIR";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
int x = sprintf(reqline, "%s %s %s", esc1, esc2, esc3 );
free( esc1 );
free( esc2 );
free( esc3 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = atoi(result->argv[1]);
if (rc == 1) {
if (result->argc == 2) {
error_string = "";
} else if (result->argc == 4) {
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
} else {
EXCEPT("Bad %s Result",command);
}
} else { // rc == 0
if ( ( (result->argc-2) % 2) != 0 ) {
EXCEPT("Bad %s Result",command);
} else {
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
returnStatus.rewind();
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | int GahpClient::ec2_vm_vm_keypair_all( const char *service_url, const char* publickeyfile, const char* privatekeyfile,
StringList & returnStatus, char* & error_code )
{
static const char* command = "EC2_VM_RUNNING_KEYPAIR";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( (service_url == NULL) || (publickeyfile == NULL) || (privatekeyfile == NULL) ) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
char* esc1 = strdup( escapeGahpString(service_url) );
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
int x = sprintf(reqline, "%s %s %s", esc1, esc2, esc3 );
free( esc1 );
free( esc2 );
free( esc3 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command, buf, deleg_proxy);
}
Gahp_Args* result = get_pending_result(command, buf);
if ( result ) {
int rc = atoi(result->argv[1]);
if (rc == 1) {
if (result->argc == 2) {
error_string = "";
} else if (result->argc == 4) {
error_code = strdup(result->argv[2]);
error_string = result->argv[3];
} else {
EXCEPT("Bad %s Result",command);
}
} else { // rc == 0
if ( ( (result->argc-2) % 2) != 0 ) {
EXCEPT("Bad %s Result",command);
} else {
for (int i=2; i<result->argc; i++) {
returnStatus.append( strdup(result->argv[i]) );
}
returnStatus.rewind();
}
}
delete result;
return rc;
}
if ( check_pending_timeout(command, buf) )
{
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,979 | GahpServer::err_pipe_ready(int /*pipe_end*/)
{
int count = 0;
char buff[5001];
buff[0] = '\0';
while (((count = (daemonCore->Read_Pipe(m_gahp_errorfd, &buff, 5000))))>0) {
char *prev_line = buff;
char *newline = buff - 1;
buff[count]='\0';
while ( (newline = strchr( newline + 1, '\n' ) ) != NULL ) {
*newline = '\0';
dprintf( D_FULLDEBUG, "GAHP[%d] (stderr) -> %s%s\n", m_gahp_pid,
m_gahp_error_buffer.c_str(), prev_line );
prev_line = newline + 1;
m_gahp_error_buffer = "";
}
m_gahp_error_buffer += prev_line;
}
return TRUE;
}
| DoS Exec Code | 0 | GahpServer::err_pipe_ready(int /*pipe_end*/)
{
int count = 0;
char buff[5001];
buff[0] = '\0';
while (((count = (daemonCore->Read_Pipe(m_gahp_errorfd, &buff, 5000))))>0) {
char *prev_line = buff;
char *newline = buff - 1;
buff[count]='\0';
while ( (newline = strchr( newline + 1, '\n' ) ) != NULL ) {
*newline = '\0';
dprintf( D_FULLDEBUG, "GAHP[%d] (stderr) -> %s%s\n", m_gahp_pid,
m_gahp_error_buffer.c_str(), prev_line );
prev_line = newline + 1;
m_gahp_error_buffer = "";
}
m_gahp_error_buffer += prev_line;
}
return TRUE;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,980 | escapeGahpString(const char * input)
{
static std::string output;
if (!input) return NULL;
output = "";
unsigned int i = 0;
size_t input_len = strlen(input);
for (i=0; i < input_len; i++) {
if ( input[i] == ' ' || input[i] == '\\' || input[i] == '\r' ||
input[i] == '\n' ) {
output += '\\';
}
output += input[i];
}
return output.c_str();
}
| DoS Exec Code | 0 | escapeGahpString(const char * input)
{
static std::string output;
if (!input) return NULL;
output = "";
unsigned int i = 0;
size_t input_len = strlen(input);
for (i=0; i < input_len; i++) {
if ( input[i] == ' ' || input[i] == '\\' || input[i] == '\r' ||
input[i] == '\n' ) {
output += '\\';
}
output += input[i];
}
return output.c_str();
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,981 | GahpClient::getErrorString()
{
static std::string output;
output = "";
unsigned int i = 0;
unsigned int input_len = error_string.length();
for (i=0; i < input_len; i++) {
switch (error_string[i]) {
case '\n':
output += "\\n";
break;
case '\r':
output += "\\r";
break;
default:
output += error_string[i];
break;
}
}
return output.c_str();
}
| DoS Exec Code | 0 | GahpClient::getErrorString()
{
static std::string output;
output = "";
unsigned int i = 0;
unsigned int input_len = error_string.length();
for (i=0; i < input_len; i++) {
switch (error_string[i]) {
case '\n':
output += "\\n";
break;
case '\r':
output += "\\r";
break;
default:
output += error_string[i];
break;
}
}
return output.c_str();
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,982 | GahpClient::getMasterProxy()
{
return server->master_proxy->proxy;
}
| DoS Exec Code | 0 | GahpClient::getMasterProxy()
{
return server->master_proxy->proxy;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,983 | GahpServer::getPollInterval()
{
return m_pollInterval;
}
| DoS Exec Code | 0 | GahpServer::getPollInterval()
{
return m_pollInterval;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,984 | GahpClient::getVersion()
{
return server->m_gahp_version;
}
| DoS Exec Code | 0 | GahpClient::getVersion()
{
return server->m_gahp_version;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,985 | GahpClient::get_pending_result(const char *,const char *)
{
Gahp_Args* r = NULL;
if ( (m_mode == blocking) && (!pending_result) ) {
for (;;) {
server->poll();
if ( pending_result ) {
break;
}
if ( pending_timeout && (time(NULL) > pending_timeout) ) {
break;
}
sleep(1); // block for one second and then poll again...
}
}
if ( pending_result ) {
ASSERT(pending_reqid == 0);
r = pending_result;
pending_result = NULL; // must do this before calling clear_pending!
clear_pending();
}
return r;
}
| DoS Exec Code | 0 | GahpClient::get_pending_result(const char *,const char *)
{
Gahp_Args* r = NULL;
if ( (m_mode == blocking) && (!pending_result) ) {
for (;;) {
server->poll();
if ( pending_result ) {
break;
}
if ( pending_timeout && (time(NULL) > pending_timeout) ) {
break;
}
sleep(1); // block for one second and then poll again...
}
}
if ( pending_result ) {
ASSERT(pending_reqid == 0);
r = pending_result;
pending_result = NULL; // must do this before calling clear_pending!
clear_pending();
}
return r;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,986 | GahpClient::globus_gass_server_superez_init( char **gass_url, int port )
{
static const char* command = "GASS_SERVER_INIT";
if ( server->globus_gass_server_url != NULL ) {
*gass_url = strdup( server->globus_gass_server_url );
return 0;
}
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
int x = sprintf(reqline,"%d",port);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
*gass_url = strdup(result->argv[2]);
server->globus_gass_server_url = strdup(result->argv[2]);
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::globus_gass_server_superez_init( char **gass_url, int port )
{
static const char* command = "GASS_SERVER_INIT";
if ( server->globus_gass_server_url != NULL ) {
*gass_url = strdup( server->globus_gass_server_url );
return 0;
}
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
std::string reqline;
int x = sprintf(reqline,"%d",port);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
*gass_url = strdup(result->argv[2]);
server->globus_gass_server_url = strdup(result->argv[2]);
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,987 | GahpClient::globus_gram_client_callback_allow(
globus_gram_client_callback_func_t callback_func,
void * user_callback_arg,
char ** callback_contact)
{
char buf[150];
static const char* command = "GRAM_CALLBACK_ALLOW";
if (callback_contact) {
*callback_contact = NULL;
}
if ( server->globus_gt2_gram_callback_contact ) {
if ( callback_func != server->globus_gt2_gram_callback_func ||
user_callback_arg != server->globus_gt2_gram_user_callback_arg )
{
EXCEPT("globus_gram_client_callback_allow called twice");
}
if (callback_contact) {
*callback_contact = strdup(server->globus_gt2_gram_callback_contact);
ASSERT(*callback_contact);
}
return 0;
}
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
int reqid = server->new_reqid();
int x = snprintf(buf,sizeof(buf),"%s %d 0",command,reqid);
ASSERT( x > 0 && x < (int)sizeof(buf) );
server->write_line(buf);
Gahp_Args result;
server->read_argv(result);
if ( result.argc != 2 || result.argv[0][0] != 'S' ) {
int ec = result.argc >= 2 ? atoi(result.argv[1]) : GAHPCLIENT_COMMAND_NOT_SUPPORTED;
const char *es = result.argc >= 3 ? result.argv[2] : "???";
dprintf(D_ALWAYS,"GAHP command '%s' failed: %s error_code=%d\n",
command, es,ec);
return ec;
}
server->globus_gt2_gram_callback_reqid = reqid;
server->globus_gt2_gram_callback_func = callback_func;
server->globus_gt2_gram_user_callback_arg = user_callback_arg;
server->globus_gt2_gram_callback_contact = strdup(result.argv[1]);
ASSERT(server->globus_gt2_gram_callback_contact);
*callback_contact = strdup(server->globus_gt2_gram_callback_contact);
ASSERT(*callback_contact);
return 0;
}
| DoS Exec Code | 0 | GahpClient::globus_gram_client_callback_allow(
globus_gram_client_callback_func_t callback_func,
void * user_callback_arg,
char ** callback_contact)
{
char buf[150];
static const char* command = "GRAM_CALLBACK_ALLOW";
if (callback_contact) {
*callback_contact = NULL;
}
if ( server->globus_gt2_gram_callback_contact ) {
if ( callback_func != server->globus_gt2_gram_callback_func ||
user_callback_arg != server->globus_gt2_gram_user_callback_arg )
{
EXCEPT("globus_gram_client_callback_allow called twice");
}
if (callback_contact) {
*callback_contact = strdup(server->globus_gt2_gram_callback_contact);
ASSERT(*callback_contact);
}
return 0;
}
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
int reqid = server->new_reqid();
int x = snprintf(buf,sizeof(buf),"%s %d 0",command,reqid);
ASSERT( x > 0 && x < (int)sizeof(buf) );
server->write_line(buf);
Gahp_Args result;
server->read_argv(result);
if ( result.argc != 2 || result.argv[0][0] != 'S' ) {
int ec = result.argc >= 2 ? atoi(result.argv[1]) : GAHPCLIENT_COMMAND_NOT_SUPPORTED;
const char *es = result.argc >= 3 ? result.argv[2] : "???";
dprintf(D_ALWAYS,"GAHP command '%s' failed: %s error_code=%d\n",
command, es,ec);
return ec;
}
server->globus_gt2_gram_callback_reqid = reqid;
server->globus_gt2_gram_callback_func = callback_func;
server->globus_gt2_gram_user_callback_arg = user_callback_arg;
server->globus_gt2_gram_callback_contact = strdup(result.argv[1]);
ASSERT(server->globus_gt2_gram_callback_contact);
*callback_contact = strdup(server->globus_gt2_gram_callback_contact);
ASSERT(*callback_contact);
return 0;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,988 | GahpClient::globus_gram_client_error_string(int error_code)
{
static char buf[200];
static const char* command = "GRAM_ERROR_STRING";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
strcpy(buf,"Unknown error");
return buf;
}
int x = snprintf(buf,sizeof(buf),"%s %d",command,error_code);
ASSERT( x > 0 && x < (int)sizeof(buf) );
server->write_line(buf);
Gahp_Args result;
server->read_argv(result);
if ( result.argc < 2 || result.argv[0][0] != 'S' ) {
dprintf(D_ALWAYS,"GAHP command '%s' failed: error_code=%d\n",
command,error_code);
return NULL;
}
strncpy(buf,result.argv[1],sizeof(buf)-1);
buf[sizeof(buf)-1] = '\0';
return buf;
}
| DoS Exec Code | 0 | GahpClient::globus_gram_client_error_string(int error_code)
{
static char buf[200];
static const char* command = "GRAM_ERROR_STRING";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
strcpy(buf,"Unknown error");
return buf;
}
int x = snprintf(buf,sizeof(buf),"%s %d",command,error_code);
ASSERT( x > 0 && x < (int)sizeof(buf) );
server->write_line(buf);
Gahp_Args result;
server->read_argv(result);
if ( result.argc < 2 || result.argv[0][0] != 'S' ) {
dprintf(D_ALWAYS,"GAHP command '%s' failed: error_code=%d\n",
command,error_code);
return NULL;
}
strncpy(buf,result.argv[1],sizeof(buf)-1);
buf[sizeof(buf)-1] = '\0';
return buf;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,989 | GahpClient::globus_gram_client_get_jobmanager_version(const char * resource_contact)
{
static const char* command = "GRAM_GET_JOBMANAGER_VERSION";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!resource_contact) resource_contact=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(resource_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc < 2) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::globus_gram_client_get_jobmanager_version(const char * resource_contact)
{
static const char* command = "GRAM_GET_JOBMANAGER_VERSION";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!resource_contact) resource_contact=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(resource_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc < 2) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,990 | GahpClient::globus_gram_client_job_refresh_credentials(const char *job_contact,
int limited_deleg)
{
static const char* command = "GRAM_JOB_REFRESH_PROXY";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_contact) job_contact=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s %d",escapeGahpString(job_contact),limited_deleg);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::globus_gram_client_job_refresh_credentials(const char *job_contact,
int limited_deleg)
{
static const char* command = "GRAM_JOB_REFRESH_PROXY";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_contact) job_contact=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s %d",escapeGahpString(job_contact),limited_deleg);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,991 | GahpClient::globus_gram_client_job_request(
const char * resource_manager_contact,
const char * description,
const int limited_deleg,
const char * callback_contact,
char ** job_contact)
{
static const char* command = "GRAM_JOB_REQUEST";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!resource_manager_contact) resource_manager_contact=NULLSTRING;
if (!description) description=NULLSTRING;
if (!callback_contact) callback_contact=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(resource_manager_contact) );
char *esc2 = strdup( escapeGahpString(callback_contact) );
char *esc3 = strdup( escapeGahpString(description) );
int x = sprintf(reqline,"%s %s %d %s", esc1, esc2, limited_deleg, esc3 );
free( esc1 );
free( esc2 );
free( esc3 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
*job_contact = strdup(result->argv[2]);
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::globus_gram_client_job_request(
const char * resource_manager_contact,
const char * description,
const int limited_deleg,
const char * callback_contact,
char ** job_contact)
{
static const char* command = "GRAM_JOB_REQUEST";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!resource_manager_contact) resource_manager_contact=NULLSTRING;
if (!description) description=NULLSTRING;
if (!callback_contact) callback_contact=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(resource_manager_contact) );
char *esc2 = strdup( escapeGahpString(callback_contact) );
char *esc3 = strdup( escapeGahpString(description) );
int x = sprintf(reqline,"%s %s %d %s", esc1, esc2, limited_deleg, esc3 );
free( esc1 );
free( esc2 );
free( esc3 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
*job_contact = strdup(result->argv[2]);
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,992 | GahpClient::globus_gram_client_job_signal(const char * job_contact,
globus_gram_protocol_job_signal_t signal,
const char * signal_arg,
int * job_status,
int * failure_code)
{
static const char* command = "GRAM_JOB_SIGNAL";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_contact) job_contact=NULLSTRING;
if (!signal_arg) signal_arg=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(job_contact) );
char *esc2 = strdup( escapeGahpString(signal_arg) );
int x = sprintf(reqline,"%s %d %s",esc1,signal,esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 4) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
*failure_code = atoi(result->argv[2]);
if ( rc == 0 ) {
*job_status = atoi(result->argv[3]);
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::globus_gram_client_job_signal(const char * job_contact,
globus_gram_protocol_job_signal_t signal,
const char * signal_arg,
int * job_status,
int * failure_code)
{
static const char* command = "GRAM_JOB_SIGNAL";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_contact) job_contact=NULLSTRING;
if (!signal_arg) signal_arg=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(job_contact) );
char *esc2 = strdup( escapeGahpString(signal_arg) );
int x = sprintf(reqline,"%s %d %s",esc1,signal,esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 4) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
*failure_code = atoi(result->argv[2]);
if ( rc == 0 ) {
*job_status = atoi(result->argv[3]);
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,993 | GahpClient::globus_gram_client_job_status(const char * job_contact,
int * job_status,
int * failure_code)
{
static const char* command = "GRAM_JOB_STATUS";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_contact) job_contact=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(job_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 4) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
*failure_code = atoi(result->argv[2]);
if ( rc == 0 ) {
*job_status = atoi(result->argv[3]);
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::globus_gram_client_job_status(const char * job_contact,
int * job_status,
int * failure_code)
{
static const char* command = "GRAM_JOB_STATUS";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_contact) job_contact=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(job_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 4) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
*failure_code = atoi(result->argv[2]);
if ( rc == 0 ) {
*job_status = atoi(result->argv[3]);
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,994 | GahpClient::globus_gram_client_ping(const char * resource_contact)
{
static const char* command = "GRAM_PING";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!resource_contact) resource_contact=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(resource_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::globus_gram_client_ping(const char * resource_contact)
{
static const char* command = "GRAM_PING";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!resource_contact) resource_contact=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(resource_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,995 | GahpClient::gridftp_transfer(const char *src_url, const char *dst_url)
{
static const char* command = "GRIDFTP_TRANSFER";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!src_url) src_url=NULLSTRING;
if (!dst_url) dst_url=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(src_url) );
char *esc2 = strdup( escapeGahpString(dst_url) );
int x = sprintf( reqline, "%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::gridftp_transfer(const char *src_url, const char *dst_url)
{
static const char* command = "GRIDFTP_TRANSFER";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!src_url) src_url=NULLSTRING;
if (!dst_url) dst_url=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(src_url) );
char *esc2 = strdup( escapeGahpString(dst_url) );
int x = sprintf( reqline, "%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,996 | GahpClient::gt4_generate_submit_id (char ** submit_id)
{
static const char * command = "GT4_GENERATE_SUBMIT_ID";
if ( submit_id ) {
*submit_id = NULL;
}
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !is_pending( command, NULL ) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending( command, NULL, normal_proxy );
}
Gahp_Args* result = get_pending_result( command, NULL );
if ( result ) {
if (result->argc != 2) {
EXCEPT( "Bad %s Result", command );
}
if ( strcasecmp(result->argv[1], NULLSTRING) ) {
*submit_id = strdup( result->argv[1] );
} else {
*submit_id = NULL;
}
delete result;
return 0;
}
if ( check_pending_timeout( command, NULL ) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::gt4_generate_submit_id (char ** submit_id)
{
static const char * command = "GT4_GENERATE_SUBMIT_ID";
if ( submit_id ) {
*submit_id = NULL;
}
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( !is_pending( command, NULL ) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending( command, NULL, normal_proxy );
}
Gahp_Args* result = get_pending_result( command, NULL );
if ( result ) {
if (result->argc != 2) {
EXCEPT( "Bad %s Result", command );
}
if ( strcasecmp(result->argv[1], NULLSTRING) ) {
*submit_id = strdup( result->argv[1] );
} else {
*submit_id = NULL;
}
delete result;
return 0;
}
if ( check_pending_timeout( command, NULL ) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,997 | GahpClient::gt4_gram_client_callback_allow(
globus_gt4_gram_callback_func_t callback_func,
void * user_callback_arg,
char ** callback_contact)
{
char buf[150];
static const char* command = "GT4_GRAM_CALLBACK_ALLOW";
if (callback_contact) {
*callback_contact = NULL;
}
if ( server->globus_gt4_gram_callback_contact ) {
if ( callback_func != server->globus_gt4_gram_callback_func ||
user_callback_arg != server->globus_gt4_gram_user_callback_arg )
{
EXCEPT("gt4_gram_client_callback_allow called twice");
}
if (callback_contact) {
*callback_contact = strdup(server->globus_gt4_gram_callback_contact);
ASSERT(*callback_contact);
}
return 0;
}
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
int reqid = server->new_reqid();
int x = snprintf(buf,sizeof(buf),"%s %d",command,reqid);
ASSERT( x > 0 && x < (int)sizeof(buf) );
server->write_line(buf);
Gahp_Args result;
server->read_argv(result);
if ( result.argc != 2 || result.argv[0][0] != 'S' ) {
const char *es = result.argc >= 3 ? result.argv[2] : "???";
dprintf(D_ALWAYS,"GAHP command '%s' failed: %s\n",
command, es);
if ( result.argc >= 3 && strcasecmp(result.argv[2], NULLSTRING) ) {
error_string = result.argv[2];
} else {
error_string = "";
}
return 1;
}
server->globus_gt4_gram_callback_reqid = reqid;
server->globus_gt4_gram_callback_func = callback_func;
server->globus_gt4_gram_user_callback_arg = user_callback_arg;
server->globus_gt4_gram_callback_contact = strdup(result.argv[1]);
ASSERT(server->globus_gt4_gram_callback_contact);
*callback_contact = strdup(server->globus_gt4_gram_callback_contact);
ASSERT(*callback_contact);
return 0;
}
| DoS Exec Code | 0 | GahpClient::gt4_gram_client_callback_allow(
globus_gt4_gram_callback_func_t callback_func,
void * user_callback_arg,
char ** callback_contact)
{
char buf[150];
static const char* command = "GT4_GRAM_CALLBACK_ALLOW";
if (callback_contact) {
*callback_contact = NULL;
}
if ( server->globus_gt4_gram_callback_contact ) {
if ( callback_func != server->globus_gt4_gram_callback_func ||
user_callback_arg != server->globus_gt4_gram_user_callback_arg )
{
EXCEPT("gt4_gram_client_callback_allow called twice");
}
if (callback_contact) {
*callback_contact = strdup(server->globus_gt4_gram_callback_contact);
ASSERT(*callback_contact);
}
return 0;
}
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
int reqid = server->new_reqid();
int x = snprintf(buf,sizeof(buf),"%s %d",command,reqid);
ASSERT( x > 0 && x < (int)sizeof(buf) );
server->write_line(buf);
Gahp_Args result;
server->read_argv(result);
if ( result.argc != 2 || result.argv[0][0] != 'S' ) {
const char *es = result.argc >= 3 ? result.argv[2] : "???";
dprintf(D_ALWAYS,"GAHP command '%s' failed: %s\n",
command, es);
if ( result.argc >= 3 && strcasecmp(result.argv[2], NULLSTRING) ) {
error_string = result.argv[2];
} else {
error_string = "";
}
return 1;
}
server->globus_gt4_gram_callback_reqid = reqid;
server->globus_gt4_gram_callback_func = callback_func;
server->globus_gt4_gram_user_callback_arg = user_callback_arg;
server->globus_gt4_gram_callback_contact = strdup(result.argv[1]);
ASSERT(server->globus_gt4_gram_callback_contact);
*callback_contact = strdup(server->globus_gt4_gram_callback_contact);
ASSERT(*callback_contact);
return 0;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,998 | GahpClient::gt4_gram_client_delegate_credentials(const char *delegation_service_url, char ** delegation_uri)
{
static const char* command = "GT4_DELEGATE_CREDENTIAL";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
ASSERT (delegation_service_url && *delegation_service_url);
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(delegation_service_url));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 4) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
*delegation_uri = strdup(result->argv[2]);
}
if ( strcasecmp(result->argv[3], NULLSTRING) ) {
error_string = result->argv[3];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::gt4_gram_client_delegate_credentials(const char *delegation_service_url, char ** delegation_uri)
{
static const char* command = "GT4_DELEGATE_CREDENTIAL";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
ASSERT (delegation_service_url && *delegation_service_url);
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(delegation_service_url));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,deleg_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 4) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
*delegation_uri = strdup(result->argv[2]);
}
if ( strcasecmp(result->argv[3], NULLSTRING) ) {
error_string = result->argv[3];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
12,999 | GahpClient::gt4_gram_client_job_callback_register(const char * job_contact,
const char * callback_contact)
{
static const char* command = "GT4_GRAM_JOB_CALLBACK_REGISTER";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_contact) job_contact=NULLSTRING;
if (!callback_contact) callback_contact=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(job_contact) );
char *esc2 = strdup( escapeGahpString(callback_contact) );
int x = sprintf(reqline,"%s %s",esc1,esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| DoS Exec Code | 0 | GahpClient::gt4_gram_client_job_callback_register(const char * job_contact,
const char * callback_contact)
{
static const char* command = "GT4_GRAM_JOB_CALLBACK_REGISTER";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!job_contact) job_contact=NULLSTRING;
if (!callback_contact) callback_contact=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(job_contact) );
char *esc2 = strdup( escapeGahpString(callback_contact) );
int x = sprintf(reqline,"%s %s",esc1,esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 3) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
if ( strcasecmp(result->argv[2], NULLSTRING) ) {
error_string = result->argv[2];
} else {
error_string = "";
}
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| @@ -321,10 +321,10 @@ GahpServer::Reaper(Service *,int pid,int status)
if ( dead_server ) {
sprintf_cat( buf, " unexpectedly" );
- EXCEPT( buf.c_str() );
+ EXCEPT( "%s", buf.c_str() );
} else {
sprintf_cat( buf, "\n" );
- dprintf( D_ALWAYS, buf.c_str() );
+ dprintf( D_ALWAYS, "%s", buf.c_str() );
}
} | CWE-134 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.