Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f8f01bc
Setting hdl inside AUTHORIZATION macro as it is defined inside the macro
gakamath Feb 17, 2023
73ce441
Adding Explicit typecasts to address compiler warnings
gakamath Feb 23, 2023
d9707fc
Adding underflow check for signed integer datatypes
gakamath Feb 23, 2023
3ba9afd
Changing the type of variable to appropriate type from usage
gakamath Feb 23, 2023
6449a05
Changing the tag from SOAP to s as per DMTF DSP specification examples
gakamath Feb 23, 2023
c1c7e6e
Setting default value of array to 0. Initializing some variables
gakamath Feb 23, 2023
913b119
Adding return case in case of failures
gakamath Feb 27, 2023
73e690c
Fixing improper malloc and free
gakamath Feb 27, 2023
392749b
Correcting comments and spelling
gakamath Feb 27, 2023
ef9fbc8
Calling MI_T macro to decide the type of cast for const char *
gakamath Feb 27, 2023
c450a4b
Adding check for config file as it crashes when config file is not pr…
gakamath Feb 27, 2023
7dd983b
Adding Disable_Shell macro above the call to check for "isShellOperat…
gakamath Feb 27, 2023
5f7e513
Adding DISABLE_SHELL macro around related code in wsmanclient.c
gakamath Feb 27, 2023
84cbf7b
Adding void explicitly in the definition of _GssUnloadLibrary to fix …
gakamath Feb 27, 2023
c8d8070
renaming parameters as namespace_ and class_ as they are C++ keywords
gakamath Feb 27, 2023
92b2d09
Printing path in the output log to help in analysis whether file exis…
gakamath Feb 27, 2023
a3a3792
Adding a macro SUPPORT_KRB5 which enables us to choose whether to do …
gakamath Feb 28, 2023
3791293
Merge branch 'microsoft:master' into master
ganeshkamath89 Mar 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Unix/agent/agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void ResetLog()
conf = Conf_Open(path);
if (!conf)
{
trace_CriticalError("Failed to open configuration file");
trace_CriticalError(MI_T("Failed to open configuration file"));
return;
}

Expand All @@ -113,7 +113,7 @@ void ResetLog()

if (r == -1)
{
trace_CriticalError("Incorrect entry in configuration file");
trace_CriticalError(MI_T("Incorrect entry in configuration file"));
break;
}

Expand All @@ -124,7 +124,7 @@ void ResetLog()
{
if (Log_SetLevelFromString(value) != 0)
{
trace_CriticalError("Incorrect loglevel set in configuration file");
trace_CriticalError(MI_T("Incorrect loglevel set in configuration file"));
}
break;
}
Expand Down Expand Up @@ -312,7 +312,7 @@ static void GetCommandLineOptions(int* argc, const char* argv[])
else if (strcmp(state.opt, "--version") == 0)
{
Tprintf(ZT("%s: %s\n"), scs(arg0),
scs(CONFIG_PRODUCT "-" CONFIG_VERSION " - " CONFIG_DATE));
scs((const char *)(CONFIG_PRODUCT MI_T("-") CONFIG_VERSION MI_T(" - ") CONFIG_DATE)));
exit(0);
}
else if (strcmp(state.opt, "--providerdir") == 0)
Expand All @@ -330,7 +330,7 @@ static void GetCommandLineOptions(int* argc, const char* argv[])
scs(state.arg));
}

s_opts.idletimeout = x;
s_opts.idletimeout = (MI_Uint32)x;
}
else if (strcmp(state.opt, "--loglevel") == 0)
{
Expand Down Expand Up @@ -474,7 +474,7 @@ int agent_main(int argc, const char* argv[])
if (s_opts.idletimeout)
{
/* convert it to usec */
s_data.provmgr.idleTimeoutUsec = s_opts.idletimeout * 1000000;
s_data.provmgr.idleTimeoutUsec = (MI_Uint64)s_opts.idletimeout * 1000000;
trace_Agent_ChangingIdleTimeout(s_opts.idletimeout);

}
Expand Down
56 changes: 28 additions & 28 deletions Unix/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ MI_Result MI_CALL Class_GetElementAt(
}
if (referenceClass)
{
*referenceClass = propertyDecl->className;
*referenceClass = (MI_Char*) propertyDecl->className;
}
if (qualifierSet)
{
Expand Down Expand Up @@ -366,12 +366,12 @@ MI_Result MI_CALL Class_GetElementAtExt(

if(originClass)
{
*originClass = propertyDecl->origin;
*originClass = (MI_Char*) propertyDecl->origin;
}

if(propagatorClass)
{
*propagatorClass = propertyDecl->propagator;
*propagatorClass = (MI_Char*) propertyDecl->propagator;
}

return MI_RESULT_OK;
Expand Down Expand Up @@ -489,12 +489,12 @@ MI_Result MI_CALL Class_GetMethodAtExt(

if(originClass)
{
*originClass = methodDecl->origin;
*originClass = (MI_Char*) methodDecl->origin;
}

if(propagatorClass)
{
*propagatorClass = methodDecl->propagator;
*propagatorClass = (MI_Char*) methodDecl->propagator;
}

if(flags)
Expand Down Expand Up @@ -680,7 +680,7 @@ MI_Result _ParameterSet_GetParameterAt(
(*qualifierSet).reserved2 = (ptrdiff_t) parameterDecl[index]->qualifiers;
if (referenceClass)
{
*referenceClass = parameterDecl[index]->className;
*referenceClass = (MI_Char*) parameterDecl[index]->className;
}
return MI_RESULT_OK;
}
Expand Down Expand Up @@ -1517,7 +1517,7 @@ void* Class_Clone_Value(
MI_Char *string = NULL;
MI_Char **pointerToString = NULL;

pointerToString = (MI_Char**)Batch_Get(batch, sizeof(MI_Char**));
pointerToString = (MI_Char**)Batch_Get(batch, sizeof(MI_Char*));
if (pointerToString == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
Expand All @@ -1538,7 +1538,7 @@ void* Class_Clone_Value(
MI_Instance *instance = NULL;
MI_Instance **pointerToInstance= NULL;

pointerToInstance = (MI_Instance**)Batch_Get(batch, sizeof(MI_Instance**));
pointerToInstance = (MI_Instance**)Batch_Get(batch, sizeof(MI_Instance*));
if (pointerToInstance == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
Expand Down Expand Up @@ -1649,22 +1649,22 @@ MI_PropertyDecl * Class_Clone_Property(
MI_PropertyDecl *newProperty = Batch_Get(batch, sizeof(MI_PropertyDecl));
if (newProperty == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_PropertyDecl*)NULL; /* Returning NULL causes whole batch to destruct */
}
memset(newProperty, 0, sizeof(*newProperty));
newProperty->flags = property->flags;
newProperty->code = property->code;
newProperty->name = Batch_Tcsdup(batch, property->name);
if (newProperty->name == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_PropertyDecl*)NULL; /* Returning NULL causes whole batch to destruct */
}
if (property->qualifiers && property->numQualifiers)
{
newProperty->qualifiers = Class_Clone_Qualifiers(batch, property->qualifiers, property->numQualifiers);
newProperty->qualifiers = (MI_Qualifier**)Class_Clone_Qualifiers(batch, property->qualifiers, property->numQualifiers);
if (newProperty->qualifiers == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_PropertyDecl*)NULL; /* Returning NULL causes whole batch to destruct */
}
newProperty->numQualifiers = property->numQualifiers;
}
Expand All @@ -1674,7 +1674,7 @@ MI_PropertyDecl * Class_Clone_Property(
newProperty->className = Batch_Tcsdup(batch, property->className); /* embedded/reference stringly typed class name */
if (newProperty->className == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_PropertyDecl*)NULL; /* Returning NULL causes whole batch to destruct */
}
}
newProperty->subscript = property->subscript;
Expand All @@ -1684,23 +1684,23 @@ MI_PropertyDecl * Class_Clone_Property(
newProperty->origin = Batch_Tcsdup(batch, property->origin);
if (newProperty->origin == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_PropertyDecl*)NULL; /* Returning NULL causes whole batch to destruct */
}
}
if (property->propagator)
{
newProperty->propagator = Batch_Tcsdup(batch, property->propagator);
if (newProperty->propagator == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_PropertyDecl*)NULL; /* Returning NULL causes whole batch to destruct */
}
}
if (((property->flags & MI_FLAG_NULL) != MI_FLAG_NULL) && property->value)
{
newProperty->value = Class_Clone_Value(batch, property->type, property->value);
if (newProperty->value == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_PropertyDecl*)NULL; /* Returning NULL causes whole batch to destruct */
}
}
else
Expand Down Expand Up @@ -1761,7 +1761,7 @@ MI_ParameterDecl * Class_Clone_Parameter(
}
if (parameter->qualifiers && parameter->numQualifiers)
{
newParameter->qualifiers = Class_Clone_Qualifiers(batch, parameter->qualifiers, parameter->numQualifiers);
newParameter->qualifiers = (MI_Qualifier**)Class_Clone_Qualifiers(batch, parameter->qualifiers, parameter->numQualifiers);
if (newParameter->qualifiers == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
Expand Down Expand Up @@ -1823,31 +1823,31 @@ MI_MethodDecl * Class_Clone_Method(
MI_MethodDecl *newMethod = Batch_Get(batch, sizeof(MI_MethodDecl));
if (newMethod == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_MethodDecl *)NULL; /* Returning NULL causes whole batch to destruct */
}
memset(newMethod, 0, sizeof(*newMethod));
newMethod->flags = method->flags;
newMethod->code = method->code;
newMethod->name = Batch_Tcsdup(batch, method->name);
if (newMethod->name == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_MethodDecl *)NULL; /* Returning NULL causes whole batch to destruct */
}
if (method->qualifiers && method->numQualifiers)
{
newMethod->qualifiers = Class_Clone_Qualifiers(batch, method->qualifiers, method->numQualifiers);
newMethod->qualifiers = (struct _MI_Qualifier**)Class_Clone_Qualifiers(batch, method->qualifiers, method->numQualifiers);
if (newMethod->qualifiers == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_MethodDecl *)NULL; /* Returning NULL causes whole batch to destruct */
}
newMethod->numQualifiers = method->numQualifiers;
}
if (method->parameters && method->numParameters)
{
newMethod->parameters = Class_Clone_Parameters(batch, method->parameters, method->numParameters, className);
newMethod->parameters = (struct _MI_ParameterDecl**)Class_Clone_Parameters(batch, method->parameters, method->numParameters, className);
if (newMethod->parameters == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_MethodDecl *)NULL; /* Returning NULL causes whole batch to destruct */
}
newMethod->numParameters = method->numParameters;
}
Expand All @@ -1858,15 +1858,15 @@ MI_MethodDecl * Class_Clone_Method(
newMethod->origin = Batch_Tcsdup(batch, method->origin);
if (newMethod->origin == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_MethodDecl *)NULL; /* Returning NULL causes whole batch to destruct */
}
}
if (method->propagator)
{
newMethod->propagator = Batch_Tcsdup(batch, method->propagator);
if (newMethod->propagator == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
return (MI_MethodDecl *)NULL; /* Returning NULL causes whole batch to destruct */
}
}
/* Leave owning schema NULL otherwise we would need to potentially clone that and every other class in there */
Expand Down Expand Up @@ -1925,7 +1925,7 @@ MI_ClassDecl* Class_Clone_ClassDecl(
}
if (classDecl->qualifiers && classDecl->numQualifiers)
{
newClassDecl->qualifiers = Class_Clone_Qualifiers(batch, classDecl->qualifiers, classDecl->numQualifiers);
newClassDecl->qualifiers = (struct _MI_Qualifier**)Class_Clone_Qualifiers(batch, classDecl->qualifiers, classDecl->numQualifiers);
if (newClassDecl->qualifiers == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
Expand All @@ -1934,7 +1934,7 @@ MI_ClassDecl* Class_Clone_ClassDecl(
}
if (classDecl->properties && classDecl->numProperties)
{
newClassDecl->properties = Class_Clone_Properties(batch, classDecl->properties, classDecl->numProperties);
newClassDecl->properties = (struct _MI_PropertyDecl**)Class_Clone_Properties(batch, classDecl->properties, classDecl->numProperties);
if (newClassDecl->properties == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
Expand Down Expand Up @@ -1962,7 +1962,7 @@ MI_ClassDecl* Class_Clone_ClassDecl(
}
if (classDecl->methods && classDecl->numMethods)
{
newClassDecl->methods = Class_Clone_Methods(batch, classDecl->methods, classDecl->numMethods, classDecl->name);
newClassDecl->methods = (struct _MI_MethodDecl**)Class_Clone_Methods(batch, classDecl->methods, classDecl->numMethods, classDecl->name);
if (newClassDecl->methods == NULL)
{
return NULL; /* Returning NULL causes whole batch to destruct */
Expand Down
12 changes: 6 additions & 6 deletions Unix/base/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,10 +969,10 @@ static int _Base64DecCallback(

start = *str;
{
unsigned char b1 = (totalSize & 0xFF000000) >> 24;
unsigned char b2 = (totalSize & 0x00FF0000) >> 16;
unsigned char b3 = (totalSize & 0x0000FF00) >> 8;
unsigned char b4 = (totalSize & 0x000000FF);
unsigned char b1 = (unsigned char)((totalSize & 0xFF000000) >> 24);
unsigned char b2 = (unsigned char)((totalSize & 0x00FF0000) >> 16);
unsigned char b3 = (unsigned char)((totalSize & 0x0000FF00) >> 8);
unsigned char b4 = (unsigned char)((totalSize & 0x000000FF));
(*str)[0] = b1;
(*str)[1] = b2;
(*str)[2] = b3;
Expand Down Expand Up @@ -1061,7 +1061,7 @@ MI_Result MI_CALL Instance_SetElementFromStringA(
&& ((msgFlags & WSMANFlag) == WSMANFlag))
{
size_t sizeIncoming = Tcslen(*data);
int sizeDec = 0;
size_t sizeDec = 0;
char * src = (char*) *data;
sizeDec = Base64Dec((const void *)src, sizeIncoming, _Base64DecCallback, &v.array);

Expand Down Expand Up @@ -1257,7 +1257,7 @@ int UsecToDatetime(
timeAsUsec /= 60; /* trim down to hours */
x->u.interval.hours = timeAsUsec % 24;
timeAsUsec /= 24;/* trim down to days */
x->u.interval.days = timeAsUsec;
x->u.interval.days = (MI_Uint32)timeAsUsec;
return 0;
}

18 changes: 9 additions & 9 deletions Unix/base/instance.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ MI_Result MI_CALL Instance_Construct(
if (result != MI_RESULT_OK)
return result;

self->classDecl = newClass->classDecl;
self->classDecl = (MI_ClassDecl*)newClass->classDecl;
}
else if (cd->flags & (MI_FLAG_CLASS|MI_FLAG_ASSOCIATION|MI_FLAG_INDICATION))
{
Expand Down Expand Up @@ -1076,7 +1076,7 @@ MI_Result MI_CALL Instance_Clone(
MI_Result result = MI_Class_Clone(self->classDecl->owningClass, &clonedClass);
if (result != MI_RESULT_OK)
MI_RETURN(result);
inst->classDecl = clonedClass->classDecl;
inst->classDecl = (MI_ClassDecl*)clonedClass->classDecl;
}
else//We had better do a hard clone
{
Expand Down Expand Up @@ -1135,7 +1135,7 @@ MI_Result MI_CALL Instance_SetClassName(
MI_RETURN(MI_RESULT_INVALID_PARAMETER);

/* Save old className */
oldClassName = self->classDecl->name;
oldClassName = (ZChar*)self->classDecl->name;

/* Set new className */
{
Expand Down Expand Up @@ -1252,7 +1252,7 @@ MI_Result MI_CALL Instance_NewDynamic(
MI_PropertyDecl** data;

data = (MI_PropertyDecl**)BAlloc(batch,
_CAPACITY * sizeof(MI_PropertyDecl), CALLSITE);
_CAPACITY * sizeof(MI_PropertyDecl*), CALLSITE);

if (!data)
{
Expand Down Expand Up @@ -1459,13 +1459,13 @@ MI_Result MI_CALL __MI_Instance_Destruct(
for (i = 0; i < self->classDecl->numProperties; i++)
{
MI_PropertyDecl* pd = self->classDecl->properties[i];
BFree(batch, pd->name, CALLSITE);
BFree(batch, pd, CALLSITE);
BFree(batch, (void *)pd->name, CALLSITE);
BFree(batch, (void *)pd, CALLSITE);
}

BFree(batch, self->classDecl->name, CALLSITE);
BFree(batch, self->classDecl->properties, CALLSITE);
BFree(batch, self->classDecl, CALLSITE);
BFree(batch, (void *)self->classDecl->name, CALLSITE);
BFree(batch, (void *)self->classDecl->properties, CALLSITE);
BFree(batch, (void *)self->classDecl, CALLSITE);

if ((void*)self != (void*)self_)
_FreeInstance(batch, self);
Expand Down
2 changes: 1 addition & 1 deletion Unix/base/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static void _PutHeader(
unsigned int line,
Log_Level level)
{
char buf[TIMESTAMP_SIZE];
char buf[TIMESTAMP_SIZE] = { 0 };

GetTimeStamp(buf);
Ftprintf(os, ZT("%s "), scs(buf));
Expand Down
2 changes: 1 addition & 1 deletion Unix/base/oi_traces.h
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ void trace_SigTERM_received_OBSOLETE(const char* user);
OI_EVENT("Starting %s: version: (%s), platform: (%s)")
void trace_Product_Version(const char* product, const char* version, const char* platform);
OI_EVENT("New request received: command=(%T), namespace=(%T), class=(%T)")
void trace_New_Request(const TChar* cmd, const TChar* namespace, const TChar* class);
void trace_New_Request(const TChar* cmd, const TChar* namespace_, const TChar* class_);
OI_EVENT("WARNING: one or more blocks still allocated!")
void trace_DumpAllocList_Warning();
OI_EVENT("BLOCK: %s(%u): ptr=%p: magic=%08X id=%u size=%u")
Expand Down
2 changes: 1 addition & 1 deletion Unix/base/packing.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ MI_Result Instance_Pack(
/* Pack the flags */
MI_RETURN_ERR(Buf_PackU32(buf, pd->flags));

pName = pd->name;
pName = (MI_Char*)pd->name;
if ((pd->flags & MI_FLAG_PARAMETER) && (pd->flags & MI_FLAG_OUT))
{
if (pName && pName[0] == ZT('M') && Tcscmp(pName, ZT("MIReturn"))== 0)
Expand Down
Loading