diff --git a/Unix/agent/agent.c b/Unix/agent/agent.c index 2b12c9403..10f1a0db7 100644 --- a/Unix/agent/agent.c +++ b/Unix/agent/agent.c @@ -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; } @@ -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; } @@ -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; } @@ -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) @@ -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) { @@ -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); } diff --git a/Unix/base/class.c b/Unix/base/class.c index 8e0431c7d..d06cd4c97 100644 --- a/Unix/base/class.c +++ b/Unix/base/class.c @@ -290,7 +290,7 @@ MI_Result MI_CALL Class_GetElementAt( } if (referenceClass) { - *referenceClass = propertyDecl->className; + *referenceClass = (MI_Char*) propertyDecl->className; } if (qualifierSet) { @@ -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; @@ -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) @@ -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; } @@ -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 */ @@ -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 */ @@ -1649,7 +1649,7 @@ 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; @@ -1657,14 +1657,14 @@ MI_PropertyDecl * Class_Clone_Property( 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; } @@ -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; @@ -1684,7 +1684,7 @@ 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) @@ -1692,7 +1692,7 @@ MI_PropertyDecl * Class_Clone_Property( 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) @@ -1700,7 +1700,7 @@ MI_PropertyDecl * Class_Clone_Property( 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 @@ -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 */ @@ -1823,7 +1823,7 @@ 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; @@ -1831,23 +1831,23 @@ MI_MethodDecl * Class_Clone_Method( 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; } @@ -1858,7 +1858,7 @@ 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) @@ -1866,7 +1866,7 @@ MI_MethodDecl * Class_Clone_Method( 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 */ @@ -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 */ @@ -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 */ @@ -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 */ diff --git a/Unix/base/helpers.c b/Unix/base/helpers.c index 6a7205742..8ef9169c1 100644 --- a/Unix/base/helpers.c +++ b/Unix/base/helpers.c @@ -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; @@ -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); @@ -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; } diff --git a/Unix/base/instance.c b/Unix/base/instance.c index bf6e8d30e..40ba2dd4a 100644 --- a/Unix/base/instance.c +++ b/Unix/base/instance.c @@ -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)) { @@ -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 { @@ -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 */ { @@ -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) { @@ -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); diff --git a/Unix/base/log.c b/Unix/base/log.c index 32f425494..a85828750 100644 --- a/Unix/base/log.c +++ b/Unix/base/log.c @@ -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)); diff --git a/Unix/base/oi_traces.h b/Unix/base/oi_traces.h index 6fee402df..cc89c2660 100644 --- a/Unix/base/oi_traces.h +++ b/Unix/base/oi_traces.h @@ -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") diff --git a/Unix/base/packing.c b/Unix/base/packing.c index 0a850c826..f98cdc2ce 100644 --- a/Unix/base/packing.c +++ b/Unix/base/packing.c @@ -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) diff --git a/Unix/base/preexec.c b/Unix/base/preexec.c index 14dc46dcc..fc8fc0c48 100644 --- a/Unix/base/preexec.c +++ b/Unix/base/preexec.c @@ -167,10 +167,10 @@ int PreExec_CheckExec( uid_t uid, uid_t gid) { - char key[PAL_MAX_PATH_SIZE]; - char uidBuf[11]; + char key[PAL_MAX_PATH_SIZE] = { 0 }; + char uidBuf[11] = { 0 }; const char* uidStr; - char gidBuf[11]; + char gidBuf[11] = { 0 }; const char* gidStr; /* If no pre-exec program, nothing to do */ @@ -252,9 +252,9 @@ int PreExec_ExecuteOnServer( /* Child Process here... */ const char *uidStr; const char *gidStr; - char uidBuf[11]; - char gidBuf[11]; - char path[PAL_MAX_PATH_SIZE]; + char uidBuf[11] = { 0 }; + char gidBuf[11] = { 0 }; + char path[PAL_MAX_PATH_SIZE] = { 0 }; /* Form the UID string */ { @@ -327,7 +327,7 @@ int PreExec_ExecuteOnServer( else { pid_t r; - int status; + int status = 0; /* Parent Process */ r = waitpid(pid, &status, 0); diff --git a/Unix/base/user.c b/Unix/base/user.c index ae0473998..28f82ac9a 100644 --- a/Unix/base/user.c +++ b/Unix/base/user.c @@ -379,9 +379,9 @@ int LookupUser(const char* user, uid_t* uid, gid_t* gid) int GetUserGidByUid(uid_t uid, gid_t* gid) { /* user name */ - char name[USERNAME_SIZE]; + char name[USERNAME_SIZE] = {0}; - if (0 != GetUserName(uid, name)) + if (0 != GetUserName((LPSTR)uid, (LPDWORD)name)) return -1; return LookupUser(name, &uid, gid); @@ -707,6 +707,7 @@ MI_Boolean ValidateGssCredentials(const char *credFilePath, const char *krb5KeyT *p = '\0'; } + if (credFilePath) { struct stat buf = {0}; int rtn = stat(credFilePath, &buf); @@ -834,7 +835,7 @@ int IsUserAuthorized(const char *user, gid_t gid) #else typedef gid_t group_type; #endif - group_type groups[MAX_GROUPS]; + group_type groups[MAX_GROUPS] = { 0 }; int ngroups = MAX_GROUPS; int i; @@ -862,6 +863,9 @@ int IsUserAuthorized(const char *user, gid_t gid) return 0; #else // non-supported platforms + MI_UNUSED(groups); + MI_UNUSED(ngroups); + MI_UNUSED(i); return 1; #endif } diff --git a/Unix/codec/mof/parser/types.c b/Unix/codec/mof/parser/types.c index d93b4747a..8bd90506b 100644 --- a/Unix/codec/mof/parser/types.c +++ b/Unix/codec/mof/parser/types.c @@ -1141,7 +1141,7 @@ static int _PromoteValue( if (destpropertydecl->className) { *embeddedpropertyError = MI_TRUE; - return _IsInstanceOfClass(state, inst, destpropertydecl->className); + return _IsInstanceOfClass(state, inst, (MI_Char *)destpropertydecl->className); } return 0; } @@ -1155,7 +1155,7 @@ static int _PromoteValue( case MI_REFERENCEA: { const MI_InstanceA * insta = *(const MI_InstanceA**)value; - MI_Char *destclassname = destpropertydecl->className; + MI_Char *destclassname = (MI_Char *)destpropertydecl->className; if (destclassname) { *embeddedpropertyError = MI_TRUE; @@ -3003,11 +3003,11 @@ void MOF_PrintInstanceDecl( /* properties */ if (self->properties) - _PrintProperties(self->properties, self->numProperties, level, file); + _PrintProperties(self->properties, (size_t)self->numProperties, level, file); /* qualifiers */ if (self->qualifiers) - _PrintQualifiers(self->qualifiers, self->numQualifiers, level, file); + _PrintQualifiers(self->qualifiers, (size_t)self->numQualifiers, level, file); /* Footer */ level--; @@ -4126,7 +4126,7 @@ int FinalizeInstance( /* For each instance property */ for (i = 0; i < id->numProperties; i++) { - MI_PropertyDecl* p = id->properties[i]; + MI_PropertyDecl* p = (MI_PropertyDecl* )id->properties[i]; MI_PropertyDecl* q = NULL; /* Find the class property with the same name */ @@ -4276,9 +4276,9 @@ int FinalizeInstance( /* For each instance property */ for (i = 0; i < id->numProperties; i++) { - MI_PropertyDecl* p = id->properties[i]; + MI_PropertyDecl* p = (MI_PropertyDecl* )id->properties[i]; MI_Value *value = (MI_Value*)(p->value); - if (ProcessProperty(state->parser->param.schemacheck, p->name, (const MI_Char**) ignorePropertyList, ignorePropertyCount)) + if (ProcessProperty(state->parser->param.schemacheck, (MI_Char*)p->name, (const MI_Char**) ignorePropertyList, ignorePropertyCount)) { if (validClassDecl) { diff --git a/Unix/codec/mof/strings.c b/Unix/codec/mof/strings.c index 409d5bdeb..0246cd6c3 100644 --- a/Unix/codec/mof/strings.c +++ b/Unix/codec/mof/strings.c @@ -180,7 +180,7 @@ MI_Char* GetString(MI_Uint32 id) { if (id < cSTRSLength) { - return cSTRS[id]; + return (MI_Char*)cSTRS[id]; } return NULL; } diff --git a/Unix/codec/mof/strset.c b/Unix/codec/mof/strset.c index 33f7caef9..fabe91b56 100644 --- a/Unix/codec/mof/strset.c +++ b/Unix/codec/mof/strset.c @@ -151,7 +151,7 @@ int StrSet_Add( free(bucket); return 1; } - + free(bucket); return 0; } diff --git a/Unix/deprecated/logging/logging.h b/Unix/deprecated/logging/logging.h index b41b981a6..7930a21f9 100644 --- a/Unix/deprecated/logging/logging.h +++ b/Unix/deprecated/logging/logging.h @@ -88,7 +88,7 @@ extern unsigned long get_tid(); extern const char* mistrerror(MI_Result res); extern const char* selectorflagstr(MI_Uint32 Flags); extern const char* bitnumberstr(unsigned long Bits); -extern const char* sslstrerror(int SslError); +extern const char* sslstrerror(unsigned long SslError); extern const char* notifyitemtypestr(int NotifyItemType); extern const char* clientstatusstr(int Status); extern const char* messagetagnamestr(int Tag); diff --git a/Unix/engine/engine.c b/Unix/engine/engine.c index b07ea39f9..ad220e34c 100644 --- a/Unix/engine/engine.c +++ b/Unix/engine/engine.c @@ -98,6 +98,7 @@ int enginemain(int argc, const char* argv[]) // binary connection with client const char *path = OMI_GetPath(ID_SOCKETFILE); result = BinaryProtocolListenFile(path, &s_data.mux[0], &s_data.protocol0); + free((void *)path); if (result != MI_RESULT_OK) { err(ZT("Failed to initialize binary protocol for socket file")); diff --git a/Unix/gen/QualifierDecls.cpp b/Unix/gen/QualifierDecls.cpp index eb490f42f..7188a21c0 100644 --- a/Unix/gen/QualifierDecls.cpp +++ b/Unix/gen/QualifierDecls.cpp @@ -24,7 +24,7 @@ static MI_Boolean Abstract_qual_decl_value = 0; static MI_QualifierDecl Abstract_qual_decl = { - (char*)"Abstract", /* name */ + (MI_Char*)"Abstract", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_CLASS|MI_FLAG_INDICATION, /* scope */ @@ -36,7 +36,7 @@ static MI_Boolean Aggregate_qual_decl_value = 0; static MI_QualifierDecl Aggregate_qual_decl = { - (char*)"Aggregate", /* name */ + (MI_Char*)"Aggregate", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_REFERENCE, /* scope */ @@ -48,7 +48,7 @@ static MI_Boolean Aggregation_qual_decl_value = 0; static MI_QualifierDecl Aggregation_qual_decl = { - (char*)"Aggregation", /* name */ + (MI_Char*)"Aggregation", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION, /* scope */ @@ -58,7 +58,7 @@ static MI_QualifierDecl Aggregation_qual_decl = static MI_QualifierDecl Alias_qual_decl = { - (char*)"Alias", /* name */ + (MI_Char*)"Alias", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PROPERTY|MI_FLAG_REFERENCE, /* scope */ @@ -66,11 +66,11 @@ static MI_QualifierDecl Alias_qual_decl = NULL, /* value */ }; -static const MI_Char* ArrayType_qual_decl_value = "Bag"; +static const MI_Char* ArrayType_qual_decl_value = (MI_Char *)"Bag"; static MI_QualifierDecl ArrayType_qual_decl = { - (char*)"ArrayType", /* name */ + (MI_Char*)"ArrayType", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -82,7 +82,7 @@ static MI_Boolean Association_qual_decl_value = 0; static MI_QualifierDecl Association_qual_decl = { - (char*)"Association", /* name */ + (MI_Char*)"Association", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION, /* scope */ @@ -92,7 +92,7 @@ static MI_QualifierDecl Association_qual_decl = static MI_QualifierDecl BitMap_qual_decl = { - (char*)"BitMap", /* name */ + (MI_Char*)"BitMap", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -102,7 +102,7 @@ static MI_QualifierDecl BitMap_qual_decl = static MI_QualifierDecl BitValues_qual_decl = { - (char*)"BitValues", /* name */ + (MI_Char*)"BitValues", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -112,7 +112,7 @@ static MI_QualifierDecl BitValues_qual_decl = static MI_QualifierDecl ClassConstraint_qual_decl = { - (char*)"ClassConstraint", /* name */ + (MI_Char*)"ClassConstraint", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_CLASS|MI_FLAG_INDICATION, /* scope */ @@ -124,7 +124,7 @@ static MI_Boolean Composition_qual_decl_value = 0; static MI_QualifierDecl Composition_qual_decl = { - (char*)"Composition", /* name */ + (MI_Char*)"Composition", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION, /* scope */ @@ -134,7 +134,7 @@ static MI_QualifierDecl Composition_qual_decl = static MI_QualifierDecl Correlatable_qual_decl = { - (char*)"Correlatable", /* name */ + (MI_Char*)"Correlatable", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_PROPERTY, /* scope */ @@ -146,7 +146,7 @@ static MI_Boolean Counter_qual_decl_value = 0; static MI_QualifierDecl Counter_qual_decl = { - (char*)"Counter", /* name */ + (MI_Char*)"Counter", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -158,7 +158,7 @@ static MI_Boolean DN_qual_decl_value = 0; static MI_QualifierDecl DN_qual_decl = { - (char*)"DN", /* name */ + (MI_Char*)"DN", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -170,7 +170,7 @@ static MI_Boolean Delete_qual_decl_value = 0; static MI_QualifierDecl Delete_qual_decl = { - (char*)"Delete", /* name */ + (MI_Char*)"Delete", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_REFERENCE, /* scope */ @@ -180,7 +180,7 @@ static MI_QualifierDecl Delete_qual_decl = static MI_QualifierDecl Deprecated_qual_decl = { - (char*)"Deprecated", /* name */ + (MI_Char*)"Deprecated", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_ANY, /* scope */ @@ -190,7 +190,7 @@ static MI_QualifierDecl Deprecated_qual_decl = static MI_QualifierDecl Description_qual_decl = { - (char*)"Description", /* name */ + (MI_Char*)"Description", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_ANY, /* scope */ @@ -200,7 +200,7 @@ static MI_QualifierDecl Description_qual_decl = static MI_QualifierDecl DisplayDescription_qual_decl = { - (char*)"DisplayDescription", /* name */ + (MI_Char*)"DisplayDescription", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_ANY, /* scope */ @@ -210,7 +210,7 @@ static MI_QualifierDecl DisplayDescription_qual_decl = static MI_QualifierDecl DisplayName_qual_decl = { - (char*)"DisplayName", /* name */ + (MI_Char*)"DisplayName", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_ANY, /* scope */ @@ -220,7 +220,7 @@ static MI_QualifierDecl DisplayName_qual_decl = static MI_QualifierDecl EmbeddedInstance_qual_decl = { - (char*)"EmbeddedInstance", /* name */ + (MI_Char*)"EmbeddedInstance", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -232,7 +232,7 @@ static MI_Boolean EmbeddedObject_qual_decl_value = 0; static MI_QualifierDecl EmbeddedObject_qual_decl = { - (char*)"EmbeddedObject", /* name */ + (MI_Char*)"EmbeddedObject", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -244,7 +244,7 @@ static MI_Boolean Exception_qual_decl_value = 0; static MI_QualifierDecl Exception_qual_decl = { - (char*)"Exception", /* name */ + (MI_Char*)"Exception", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_CLASS|MI_FLAG_INDICATION, /* scope */ @@ -256,7 +256,7 @@ static MI_Boolean Expensive_qual_decl_value = 0; static MI_QualifierDecl Expensive_qual_decl = { - (char*)"Expensive", /* name */ + (MI_Char*)"Expensive", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_ANY, /* scope */ @@ -268,7 +268,7 @@ static MI_Boolean Experimental_qual_decl_value = 0; static MI_QualifierDecl Experimental_qual_decl = { - (char*)"Experimental", /* name */ + (MI_Char*)"Experimental", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_ANY, /* scope */ @@ -280,7 +280,7 @@ static MI_Boolean Gauge_qual_decl_value = 0; static MI_QualifierDecl Gauge_qual_decl = { - (char*)"Gauge", /* name */ + (MI_Char*)"Gauge", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -292,7 +292,7 @@ static MI_Boolean Ifdeleted_qual_decl_value = 0; static MI_QualifierDecl Ifdeleted_qual_decl = { - (char*)"Ifdeleted", /* name */ + (MI_Char*)"Ifdeleted", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_REFERENCE, /* scope */ @@ -304,7 +304,7 @@ static MI_Boolean In_qual_decl_value = 1; static MI_QualifierDecl In_qual_decl = { - (char*)"In", /* name */ + (MI_Char*)"In", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_PARAMETER, /* scope */ @@ -316,7 +316,7 @@ static MI_Boolean Indication_qual_decl_value = 0; static MI_QualifierDecl Indication_qual_decl = { - (char*)"Indication", /* name */ + (MI_Char*)"Indication", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_CLASS|MI_FLAG_INDICATION, /* scope */ @@ -328,7 +328,7 @@ static MI_Boolean Invisible_qual_decl_value = 0; static MI_QualifierDecl Invisible_qual_decl = { - (char*)"Invisible", /* name */ + (MI_Char*)"Invisible", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_CLASS|MI_FLAG_METHOD|MI_FLAG_PROPERTY|MI_FLAG_REFERENCE, /* scope */ @@ -340,7 +340,7 @@ static MI_Boolean IsPUnit_qual_decl_value = 0; static MI_QualifierDecl IsPUnit_qual_decl = { - (char*)"IsPUnit", /* name */ + (MI_Char*)"IsPUnit", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -352,7 +352,7 @@ static MI_Boolean Key_qual_decl_value = 0; static MI_QualifierDecl Key_qual_decl = { - (char*)"Key", /* name */ + (MI_Char*)"Key", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_PROPERTY|MI_FLAG_REFERENCE, /* scope */ @@ -364,7 +364,7 @@ static MI_Boolean Large_qual_decl_value = 0; static MI_QualifierDecl Large_qual_decl = { - (char*)"Large", /* name */ + (MI_Char*)"Large", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_CLASS|MI_FLAG_PROPERTY, /* scope */ @@ -374,7 +374,7 @@ static MI_QualifierDecl Large_qual_decl = static MI_QualifierDecl MappingStrings_qual_decl = { - (char*)"MappingStrings", /* name */ + (MI_Char*)"MappingStrings", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_ANY, /* scope */ @@ -384,7 +384,7 @@ static MI_QualifierDecl MappingStrings_qual_decl = static MI_QualifierDecl Max_qual_decl = { - (char*)"Max", /* name */ + (MI_Char*)"Max", /* name */ MI_UINT32, /* type */ 0, /* subscript */ MI_FLAG_REFERENCE, /* scope */ @@ -394,7 +394,7 @@ static MI_QualifierDecl Max_qual_decl = static MI_QualifierDecl MaxLen_qual_decl = { - (char*)"MaxLen", /* name */ + (MI_Char*)"MaxLen", /* name */ MI_UINT32, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -404,7 +404,7 @@ static MI_QualifierDecl MaxLen_qual_decl = static MI_QualifierDecl MaxValue_qual_decl = { - (char*)"MaxValue", /* name */ + (MI_Char*)"MaxValue", /* name */ MI_SINT64, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -414,7 +414,7 @@ static MI_QualifierDecl MaxValue_qual_decl = static MI_QualifierDecl MethodConstraint_qual_decl = { - (char*)"MethodConstraint", /* name */ + (MI_Char*)"MethodConstraint", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_METHOD, /* scope */ @@ -426,7 +426,7 @@ static MI_Uint32 Min_qual_decl_value = 0; static MI_QualifierDecl Min_qual_decl = { - (char*)"Min", /* name */ + (MI_Char*)"Min", /* name */ MI_UINT32, /* type */ 0, /* subscript */ MI_FLAG_REFERENCE, /* scope */ @@ -438,7 +438,7 @@ static MI_Uint32 MinLen_qual_decl_value = 0; static MI_QualifierDecl MinLen_qual_decl = { - (char*)"MinLen", /* name */ + (MI_Char*)"MinLen", /* name */ MI_UINT32, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -448,7 +448,7 @@ static MI_QualifierDecl MinLen_qual_decl = static MI_QualifierDecl MinValue_qual_decl = { - (char*)"MinValue", /* name */ + (MI_Char*)"MinValue", /* name */ MI_SINT64, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -458,7 +458,7 @@ static MI_QualifierDecl MinValue_qual_decl = static MI_QualifierDecl ModelCorrespondence_qual_decl = { - (char*)"ModelCorrespondence", /* name */ + (MI_Char*)"ModelCorrespondence", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_ANY, /* scope */ @@ -468,7 +468,7 @@ static MI_QualifierDecl ModelCorrespondence_qual_decl = static MI_QualifierDecl Nonlocal_qual_decl = { - (char*)"Nonlocal", /* name */ + (MI_Char*)"Nonlocal", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_REFERENCE, /* scope */ @@ -478,7 +478,7 @@ static MI_QualifierDecl Nonlocal_qual_decl = static MI_QualifierDecl NonlocalType_qual_decl = { - (char*)"NonlocalType", /* name */ + (MI_Char*)"NonlocalType", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_REFERENCE, /* scope */ @@ -488,7 +488,7 @@ static MI_QualifierDecl NonlocalType_qual_decl = static MI_QualifierDecl NullValue_qual_decl = { - (char*)"NullValue", /* name */ + (MI_Char*)"NullValue", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_PROPERTY, /* scope */ @@ -500,7 +500,7 @@ static MI_Boolean Octetstring_qual_decl_value = 0; static MI_QualifierDecl Octetstring_qual_decl = { - (char*)"Octetstring", /* name */ + (MI_Char*)"Octetstring", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -512,7 +512,7 @@ static MI_Boolean Out_qual_decl_value = 0; static MI_QualifierDecl Out_qual_decl = { - (char*)"Out", /* name */ + (MI_Char*)"Out", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_PARAMETER, /* scope */ @@ -522,7 +522,7 @@ static MI_QualifierDecl Out_qual_decl = static MI_QualifierDecl Override_qual_decl = { - (char*)"Override", /* name */ + (MI_Char*)"Override", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PROPERTY|MI_FLAG_REFERENCE, /* scope */ @@ -532,7 +532,7 @@ static MI_QualifierDecl Override_qual_decl = static MI_QualifierDecl PUnit_qual_decl = { - (char*)"PUnit", /* name */ + (MI_Char*)"PUnit", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -542,7 +542,7 @@ static MI_QualifierDecl PUnit_qual_decl = static MI_QualifierDecl Propagated_qual_decl = { - (char*)"Propagated", /* name */ + (MI_Char*)"Propagated", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_PROPERTY, /* scope */ @@ -552,7 +552,7 @@ static MI_QualifierDecl Propagated_qual_decl = static MI_QualifierDecl PropertyConstraint_qual_decl = { - (char*)"PropertyConstraint", /* name */ + (MI_Char*)"PropertyConstraint", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_PROPERTY|MI_FLAG_REFERENCE, /* scope */ @@ -560,11 +560,11 @@ static MI_QualifierDecl PropertyConstraint_qual_decl = NULL, /* value */ }; -static const MI_Char* PropertyUsage_qual_decl_value = "CurrentContext"; +static const MI_Char* PropertyUsage_qual_decl_value = (MI_Char*)"CurrentContext"; static MI_QualifierDecl PropertyUsage_qual_decl = { - (char*)"PropertyUsage", /* name */ + (MI_Char*)"PropertyUsage", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_PROPERTY, /* scope */ @@ -574,7 +574,7 @@ static MI_QualifierDecl PropertyUsage_qual_decl = static MI_QualifierDecl Provider_qual_decl = { - (char*)"Provider", /* name */ + (MI_Char*)"Provider", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_ANY, /* scope */ @@ -586,7 +586,7 @@ static MI_Boolean Read_qual_decl_value = 1; static MI_QualifierDecl Read_qual_decl = { - (char*)"Read", /* name */ + (MI_Char*)"Read", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_PROPERTY, /* scope */ @@ -598,7 +598,7 @@ static MI_Boolean Required_qual_decl_value = 0; static MI_QualifierDecl Required_qual_decl = { - (char*)"Required", /* name */ + (MI_Char*)"Required", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY|MI_FLAG_REFERENCE, /* scope */ @@ -608,7 +608,7 @@ static MI_QualifierDecl Required_qual_decl = static MI_QualifierDecl Revision_qual_decl = { - (char*)"Revision", /* name */ + (MI_Char*)"Revision", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_CLASS|MI_FLAG_INDICATION, /* scope */ @@ -618,7 +618,7 @@ static MI_QualifierDecl Revision_qual_decl = static MI_QualifierDecl Schema_qual_decl = { - (char*)"Schema", /* name */ + (MI_Char*)"Schema", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PROPERTY, /* scope */ @@ -628,7 +628,7 @@ static MI_QualifierDecl Schema_qual_decl = static MI_QualifierDecl Source_qual_decl = { - (char*)"Source", /* name */ + (MI_Char*)"Source", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_CLASS|MI_FLAG_INDICATION, /* scope */ @@ -638,7 +638,7 @@ static MI_QualifierDecl Source_qual_decl = static MI_QualifierDecl SourceType_qual_decl = { - (char*)"SourceType", /* name */ + (MI_Char*)"SourceType", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_CLASS|MI_FLAG_INDICATION|MI_FLAG_REFERENCE, /* scope */ @@ -650,7 +650,7 @@ static MI_Boolean Static_qual_decl_value = 0; static MI_QualifierDecl Static_qual_decl = { - (char*)"Static", /* name */ + (MI_Char*)"Static", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PROPERTY, /* scope */ @@ -660,7 +660,7 @@ static MI_QualifierDecl Static_qual_decl = static MI_QualifierDecl Syntax_qual_decl = { - (char*)"Syntax", /* name */ + (MI_Char*)"Syntax", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY|MI_FLAG_REFERENCE, /* scope */ @@ -670,7 +670,7 @@ static MI_QualifierDecl Syntax_qual_decl = static MI_QualifierDecl SyntaxType_qual_decl = { - (char*)"SyntaxType", /* name */ + (MI_Char*)"SyntaxType", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY|MI_FLAG_REFERENCE, /* scope */ @@ -682,7 +682,7 @@ static MI_Boolean Terminal_qual_decl_value = 0; static MI_QualifierDecl Terminal_qual_decl = { - (char*)"Terminal", /* name */ + (MI_Char*)"Terminal", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_CLASS|MI_FLAG_INDICATION, /* scope */ @@ -692,7 +692,7 @@ static MI_QualifierDecl Terminal_qual_decl = static MI_QualifierDecl TriggerType_qual_decl = { - (char*)"TriggerType", /* name */ + (MI_Char*)"TriggerType", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_CLASS|MI_FLAG_INDICATION|MI_FLAG_METHOD|MI_FLAG_PROPERTY|MI_FLAG_REFERENCE, /* scope */ @@ -702,7 +702,7 @@ static MI_QualifierDecl TriggerType_qual_decl = static MI_QualifierDecl UMLPackagePath_qual_decl = { - (char*)"UMLPackagePath", /* name */ + (MI_Char*)"UMLPackagePath", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_CLASS|MI_FLAG_INDICATION, /* scope */ @@ -712,7 +712,7 @@ static MI_QualifierDecl UMLPackagePath_qual_decl = static MI_QualifierDecl Units_qual_decl = { - (char*)"Units", /* name */ + (MI_Char*)"Units", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -722,7 +722,7 @@ static MI_QualifierDecl Units_qual_decl = static MI_QualifierDecl UnknownValues_qual_decl = { - (char*)"UnknownValues", /* name */ + (MI_Char*)"UnknownValues", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_PROPERTY, /* scope */ @@ -732,7 +732,7 @@ static MI_QualifierDecl UnknownValues_qual_decl = static MI_QualifierDecl UnsupportedValues_qual_decl = { - (char*)"UnsupportedValues", /* name */ + (MI_Char*)"UnsupportedValues", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_PROPERTY, /* scope */ @@ -742,7 +742,7 @@ static MI_QualifierDecl UnsupportedValues_qual_decl = static MI_QualifierDecl ValueMap_qual_decl = { - (char*)"ValueMap", /* name */ + (MI_Char*)"ValueMap", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -752,7 +752,7 @@ static MI_QualifierDecl ValueMap_qual_decl = static MI_QualifierDecl Values_qual_decl = { - (char*)"Values", /* name */ + (MI_Char*)"Values", /* name */ MI_STRINGA, /* type */ 0, /* subscript */ MI_FLAG_METHOD|MI_FLAG_PARAMETER|MI_FLAG_PROPERTY, /* scope */ @@ -762,7 +762,7 @@ static MI_QualifierDecl Values_qual_decl = static MI_QualifierDecl Version_qual_decl = { - (char*)"Version", /* name */ + (MI_Char*)"Version", /* name */ MI_STRING, /* type */ 0, /* subscript */ MI_FLAG_ASSOCIATION|MI_FLAG_CLASS|MI_FLAG_INDICATION, /* scope */ @@ -774,7 +774,7 @@ static MI_Boolean Weak_qual_decl_value = 0; static MI_QualifierDecl Weak_qual_decl = { - (char*)"Weak", /* name */ + (MI_Char*)"Weak", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_REFERENCE, /* scope */ @@ -786,7 +786,7 @@ static MI_Boolean Write_qual_decl_value = 0; static MI_QualifierDecl Write_qual_decl = { - (char*)"Write", /* name */ + (MI_Char*)"Write", /* name */ MI_BOOLEAN, /* type */ 0, /* subscript */ MI_FLAG_PROPERTY, /* scope */ diff --git a/Unix/gen/main.cpp b/Unix/gen/main.cpp index 94470f58e..15105a0ce 100644 --- a/Unix/gen/main.cpp +++ b/Unix/gen/main.cpp @@ -420,7 +420,7 @@ static void _GetConfigFileOptions(GeneratorOptions& opts) /* Form the configuration file path */ if (FindConfigFile(path) != 0) - err("failed to find configuration file"); + err("failed to find configuration file: %s", path); /* Open the configuration file */ conf = Conf_Open(path); diff --git a/Unix/http/http.c b/Unix/http/http.c index 4a481bfa7..ea524adf0 100644 --- a/Unix/http/http.c +++ b/Unix/http/http.c @@ -222,7 +222,7 @@ static MI_Boolean _getHeaderField( } break; } - case (_HashCode('u','t',10)): + case (_HashCode('u', 't', 10)): /*User-Agent*/ { /* Remember the User-Agent for later use */ if (Strcasecmp(name, "User-Agent") == 0) @@ -231,7 +231,7 @@ static MI_Boolean _getHeaderField( } break; } - case (_HashCode('p', 't', 4)): + case (_HashCode('p', 't', 4)): /*POST*/ { /* Remember the User-Agent for later use */ if (Strcasecmp(name, "POST") == 0) @@ -821,7 +821,7 @@ _BuildHeader( Http_SR_SocketData* handler, int contentLen, const char *perrcode_desc = _HttpErrorCodeDescription(handler->httpErrorCode, &errcode_desc_len); int content_len_strlen = 0; - char content_len_buff[16] ; + char content_len_buff[16] = { 0 }; char *pcontent_len = int64_to_a(content_len_buff, sizeof(content_len_buff), contentLen, &content_len_strlen); int needed_size = HTTP_PROTOCOL_HEADER_LEN + errorcode_strlen + 1 + errcode_desc_len + 2 + // HTTP/1.1 0 200 Success\r\n @@ -992,9 +992,9 @@ static Http_CallbackResult _WriteHeader( Http_SR_SocketData* handler) { GetTimeStamp(startTime); _WriteTraceFile(ID_HTTPSENDTRACEFILE, &startTime, strlen(startTime)); - _WriteTraceFile(ID_HTTPSENDTRACEFILE, &before_encrypt, sizeof(before_encrypt)); + _WriteTraceFile(ID_HTTPSENDTRACEFILE, (void *) &before_encrypt, sizeof(before_encrypt)); _WriteTraceFile(ID_HTTPSENDTRACEFILE, (char *)(pOldPage+1), pOldPage->u.s.size); - _WriteTraceFile(ID_HTTPSENDTRACEFILE, &before_encrypt_end, sizeof(before_encrypt_end)); + _WriteTraceFile(ID_HTTPSENDTRACEFILE, (void *) &before_encrypt_end, sizeof(before_encrypt_end)); } } @@ -1094,7 +1094,7 @@ static Http_CallbackResult _WriteData( buf_size = handler->sendPage->u.s.size - handler->sentSize; sent = 0; - r = _Sock_Write(handler, buf, buf_size, &sent); + r = _Sock_Write(handler, (void*)(buf), buf_size, &sent); if ( r == MI_RESULT_OK && 0 == sent ) return PRT_RETURN_FALSE; /* conection closed */ @@ -1685,7 +1685,7 @@ static MI_Result _CreateSSLContext(Http* self, const char* sslCipherSuite, SSL_O ** certificate. */ { - char errorBuf[256]; + char errorBuf[256] = { 0 }; /* load the specified server certificates */ trace_SSL_LoadingServerCert(scs(OMI_GetPath(ID_PEMFILE))); @@ -1705,7 +1705,7 @@ static MI_Result _CreateSSLContext(Http* self, const char* sslCipherSuite, SSL_O ** If specified, validate and load the key. */ { - char errorBuf[256]; + char errorBuf[256] = { 0 }; /* load the specified server certificates */ trace_SSL_LoadingCertPrivateKey(scs(OMI_GetPath(ID_KEYFILE))); diff --git a/Unix/http/httpauth.c b/Unix/http/httpauth.c index 1f4cd8cef..efb97fb30 100644 --- a/Unix/http/httpauth.c +++ b/Unix/http/httpauth.c @@ -8,6 +8,7 @@ */ #include +#if defined SUPPORT_KRB5 #if ( AUTHORIZATION == 1 ) #if defined(macos) #include @@ -15,6 +16,7 @@ #include #endif #endif +#endif #include #include #include @@ -40,13 +42,16 @@ // #define ENCRYPT_DECRYPT 1 // #define AUTHORIZATION 1 +#if defined SUPPORT_KRB5 #if !defined(KRB5_CALLCOV) #define KRB5_CALLCONV #endif +#endif #define MAX_ERROR_STRING_SIZE 256 #define TIMESTAMP_SIZE 128 int GetTimeStamp(_Pre_writable_size_(TIMESTAMP_SIZE) char buf[TIMESTAMP_SIZE]); +#if defined SUPPORT_KRB5 static void _report_error(OM_uint32 major_status, OM_uint32 minor_status, const char *msg); // dlsyms from the dlopen @@ -169,7 +174,7 @@ static Gss_Extensions _g_gssState = { 0 }; static struct _Once g_once_state = ONCE_INITIALIZER; static const char GSS_LIBRARY_NAME[] = CONFIG_GSSLIB; - +#endif static const char RESPONSE_HEADER_UNAUTH_FMT[] = "HTTP/1.1 401 Unauthorized\r\n" "Content-Length: 0\r\n" "WWW-Authenticate: Basic realm=\"WSMAN\"\r\n" \ @@ -177,6 +182,7 @@ static const char RESPONSE_HEADER_UNAUTH_FMT[] = "WWW-Authenticate: Kerberos\r\n" "\r\n"; static const int RESPONSE_HEADER_UNAUTH_FMT_LEN = MI_COUNT(RESPONSE_HEADER_UNAUTH_FMT)-1; +#if defined SUPPORT_KRB5 void _GssUnloadLibrary() { dlclose(_g_gssState.libHandle); @@ -333,7 +339,7 @@ int _GssInitLibrary(_In_ void *data, _Outptr_result_maybenull_ void **value) return FALSE; } - +#endif #define HTTP_LONGEST_ERROR_DESCRIPTION 50 void _WriteTraceFile(PathID id, const void *data, size_t size); @@ -875,7 +881,7 @@ static MI_Boolean _WriteAuthResponse(Http_SR_SocketData * handler, const char *p total_sent += sent; } - while (total_sent < responseLen); + while ((int)total_sent < responseLen); if (FORCE_TRACING || ((total_sent > 0) && handler->enableTracing)) { @@ -932,6 +938,7 @@ static void _SendAuthResponse(Http_SR_SocketData * sendSock, const char *pRespon } +#if defined SUPPORT_KRB5 #if AUTHORIZATION static gss_buffer_t _getPrincipalName(gss_ctx_id_t pContext) { @@ -1606,13 +1613,14 @@ static char *_BuildAuthResponse(_In_ const char *pProtocol, } #endif - +#endif void Deauthorize(_In_ Http_SR_SocketData * handler) { +#if defined SUPPORT_KRB5 #if defined(AUTHORIZATION) OM_uint32 maj_stat, min_stat; #endif - +#endif // Reinit all of the handler authorisation state. handler->authFailed = FALSE; @@ -1621,6 +1629,7 @@ void Deauthorize(_In_ Http_SR_SocketData * handler) { // Tear down the context. The function will set to null +#if defined SUPPORT_KRB5 #if defined(AUTHORIZATION) gss_ctx_id_t hdl = handler->pAuthContext; maj_stat = (* _g_gssState.Gss_Delete_Sec_Context)(&min_stat, &hdl, NULL); @@ -1629,12 +1638,15 @@ void Deauthorize(_In_ Http_SR_SocketData * handler) // 2do: Not clear what to do here // I'm going to procede anyway. } -#endif handler->pAuthContext = hdl; +#endif +#endif } if (handler->pVerifierCred) { +#if defined SUPPORT_KRB5 (* _g_gssState.Gss_Release_Cred)(&min_stat, handler->pVerifierCred); +#endif handler->pVerifierCred = NULL; } @@ -1731,7 +1743,9 @@ Http_CallbackResult IsClientAuthorized(_In_ Http_SR_SocketData * handler) #if AUTHORIZATION static const char RESPONSE_HEADER_BAD_REQUEST[] = "HTTP/1.1 400 Bad Request\r\n" "Content-Length: 0\r\n" "\r\n"; static const int RESPONSE_HEADER_BAD_REQUEST_LEN = MI_COUNT(RESPONSE_HEADER_BAD_REQUEST)-1; +#if defined SUPPORT_KRB5 OM_uint32 flags = 0; +#endif const char *protocol_p = NULL; #endif @@ -1843,6 +1857,7 @@ Http_CallbackResult IsClientAuthorized(_In_ Http_SR_SocketData * handler) handler->isAuthorised = TRUE; return PRT_RETURN_TRUE; } +#if defined SUPPORT_KRB5 #ifdef AUTHORIZATION else { @@ -2253,7 +2268,7 @@ Http_CallbackResult IsClientAuthorized(_In_ Http_SR_SocketData * handler) } } #endif - +#endif Done: return authorised; } @@ -2261,6 +2276,7 @@ Http_CallbackResult IsClientAuthorized(_In_ Http_SR_SocketData * handler) void HttpAuth_Close(_In_ Handler *handlerIn) { +#if defined SUPPORT_KRB5 Http_SR_SocketData* handler = FromOffset( Http_SR_SocketData, handler, handlerIn ); gss_ctx_id_t context_hdl = handler->pAuthContext; OM_uint32 min_stat = 0; @@ -2279,6 +2295,7 @@ void HttpAuth_Close(_In_ Handler *handlerIn) (*_g_gssState.Gss_Delete_Sec_Context)(&min_stat, &context_hdl, NULL); } } +#endif } MI_Result Process_Authorized_Message( diff --git a/Unix/http/httpclient.c b/Unix/http/httpclient.c index 81ee562ad..624e3ffc8 100644 --- a/Unix/http/httpclient.c +++ b/Unix/http/httpclient.c @@ -560,7 +560,7 @@ static void _WriteTraceSessionTimestamp(_In_ PathID pathId, _In_opt_z_ const cha // [Session: NNNNN Date: YYYY/MM/DD HH:MM:SS.1234567Z] #define SESSION_DATETIME_SIZE 70 const char FMT[] = "[Session: %s Date: %04d-%02d-%02d %02d:%02d:%02d.%07dZ]"; - char buf[SESSION_DATETIME_SIZE]; + char buf[SESSION_DATETIME_SIZE] = { 0 }; struct timeval tv; struct tm tm; @@ -2024,7 +2024,7 @@ Page* _CreateHttpHeader( pageSize += Strlen(hostHeader) + 2; if (extraHeaders) { - int i; + size_t i; for (i = 0; i < extraHeaders->size; ++i) { pageSize += Strlen(extraHeaders->data[i]) + 2; @@ -2163,7 +2163,7 @@ Page* _CreateHttpHeader( if (extraHeaders) { - int i; + size_t i; for (i = 0; i < extraHeaders->size; ++i) { r = (int)Strlcpy(p, extraHeaders->data[i], pageSize); @@ -3030,7 +3030,8 @@ MI_Result HttpClient_StartRequest( HttpClientRequestHeaders *headers, Page** data) -{ char *content_type = NULL; +{ + char *content_type = NULL; char *auth_header = NULL; HttpClientRequestHeaders extra_headers = { NULL, 0 }; const char** tmp_headers = NULL; @@ -3045,8 +3046,8 @@ MI_Result HttpClient_StartRequest( { tmp_headers = (headers->size != 0) ? (const char **)PAL_Malloc(sizeof(char *) * headers->size) : NULL; - int i = 0; - int j = 0; + size_t i = 0; + size_t j = 0; for (i = 0; i < headers->size; i++ ) { if (Strncasecmp(headers->data[i], CONTENT_TYPE_HDR, CONTENT_TYPE_HDR_LEN) == 0) @@ -3082,13 +3083,13 @@ MI_Result HttpClient_StartRequest( self->connector->authType = AUTH_METHOD_BYPASS; } - rtnval = HttpClient_StartRequestV2(self, verb, uri, content_type, auth_header, headers, data, NULL ); + rtnval = HttpClient_StartRequestV2(self, verb, uri, content_type, auth_header, (HttpClientRequestHeaders*)headers, data, (Probable_Cause_Data **)NULL); if (tmp_headers != NULL) { // When extra_headers are used properly, please reassess whether this PAL_Free belongs here. // This exists for now to prevent a memory leak. - PAL_Free(tmp_headers); + PAL_Free((void *)tmp_headers); } return rtnval; diff --git a/Unix/http/httpclientauth.c b/Unix/http/httpclientauth.c index cab874f2f..a9c141948 100644 --- a/Unix/http/httpclientauth.c +++ b/Unix/http/httpclientauth.c @@ -7,6 +7,7 @@ **============================================================================== */ #include +#if defined SUPPORT_KRB5 #if AUTHORIZATION #if defined(macos) #include @@ -15,6 +16,7 @@ #include #endif #endif +#endif #include #include #include @@ -260,6 +262,7 @@ typedef void KRB5_CALLCONV typedef enum { NOT_LOADED = 0, LOADING, LOADED } LoadState; +#if defined SUPPORT_KRB5 typedef struct _Gss_Extensions { LoadState gssLibLoaded; /* Default is NOT_LOADED */ @@ -326,6 +329,7 @@ MI_Boolean Gss_Oid_Equal(const gss_OID poid1, const gss_OID poid2) return MI_TRUE; } +#endif /* * Credentials are expected to live in the file ~/.omi/ntlmcred. @@ -559,8 +563,9 @@ _Success_(return == 0) int _ValidateClientCredentials(HttpClient_SR_SocketData * } +#if defined SUPPORT_KRB5 static void -_GssUnloadLibrary() +_GssUnloadLibrary(void) { dlclose(_g_gssClientState.libHandle); @@ -898,7 +903,7 @@ static _Success_(return == 0) int _GssClientInitLibrary( _In_ void* data, _Outpt _g_gssClientState.gssLibLoaded = NOT_LOADED; return FALSE; } - +#endif @@ -936,6 +941,7 @@ static int EncodePlaceCallback(const char *data, size_t size, void *callbackData return 0; } +#if defined SUPPORT_KRB5 #if AUTHORIZATION static void _getStatusMsg(OM_uint32 status_code, int status_type, gss_buffer_t statusString) @@ -961,7 +967,7 @@ static void _ReportError(HttpClient_SR_SocketData * self, const char *msg, gss_buffer_desc major_err = { 0 }; gss_buffer_desc minor_err = { 0 }; int msglen = 0; - char *pmsg = NULL; + MI_Char *pmsg = NULL; if (major_status != 0) @@ -1082,7 +1088,7 @@ MI_Boolean HttpClient_DecryptData(_In_ HttpClient_SR_SocketData * handler, _Out_ return FALSE; } - int i = 0; + MI_Uint32 i = 0; for (i = 0; i < pHeaders->sizeHeaders; i++ ) { if (strncasecmp(pHeaders->headers[i].name, CONTENT_TYPE, CONTENT_TYPE_LEN) == 0) @@ -1899,7 +1905,7 @@ static int _getInputToken(_In_ struct _HttpClient_SR_SocketData * self, const c } #endif - +#endif /* * Based on the authorisation type, we create an auth clause for the Http response header. * The response token is converted to base 64. @@ -2076,7 +2082,7 @@ static MI_Boolean _WriteAuthRequest(HttpClient_SR_SocketData * handler, const ch total_sent += sent; } - while (total_sent < requestLen); + while ((int)total_sent < requestLen); if (FORCE_TRACING || ((total_sent > 0) && handler->enableTracing)) { @@ -2086,6 +2092,7 @@ static MI_Boolean _WriteAuthRequest(HttpClient_SR_SocketData * handler, const ch return TRUE; } +#if defined SUPPORT_KRB5 /* * Evaluates the response header returned by the server . * @@ -2693,7 +2700,7 @@ static char *_BuildInitialGssAuthHeader(_In_ HttpClient_SR_SocketData * self, MI } #endif - +#endif Http_CallbackResult HttpClient_RequestAuthorization(_In_ struct _HttpClient_SR_SocketData *handler, const char **pAuthHeader) { MI_Uint32 status = 0; @@ -2721,6 +2728,7 @@ Http_CallbackResult HttpClient_RequestAuthorization(_In_ struct _HttpClient_SR_S return PRT_CONTINUE; +#if defined SUPPORT_KRB5 #if AUTHORIZATION case AUTH_METHOD_NEGOTIATE_WITH_CREDS: case AUTH_METHOD_NEGOTIATE: @@ -2744,7 +2752,7 @@ Http_CallbackResult HttpClient_RequestAuthorization(_In_ struct _HttpClient_SR_S return PRT_CONTINUE; #endif - +#endif default: goto AuthFailed; } @@ -2782,7 +2790,7 @@ Http_CallbackResult HttpClient_IsAuthorized(_In_ struct _HttpClient_SR_SocketDat HttpClientResponseHeader *pheaders = &self->recvHeaders; char *auth_header = NULL; - int i = 0; + size_t i = 0; // For unit test if (IsAuthCallsIgnored()) @@ -2840,7 +2848,7 @@ Http_CallbackResult HttpClient_IsAuthorized(_In_ struct _HttpClient_SR_SocketDat #define BASIC_AUTH_FAIL_MSG "Basic Authorization failed for user " int msglen = MI_COUNT(BASIC_AUTH_FAIL_MSG)-1; int username_len = strlen(self->username); - char *pmsg = NULL; + MI_Char *pmsg = NULL; if (username_len > USERNAME_LIMIT) { @@ -2858,7 +2866,7 @@ Http_CallbackResult HttpClient_IsAuthorized(_In_ struct _HttpClient_SR_SocketDat client->probableCause->probable_cause_id = WSMAN_CIMERROR_PROBABLE_CAUSE_AUTHENTICATION_FAILURE; client->probableCause->description = (MI_Char *)(client->probableCause+1); - self->errMsg = (char*)(client->probableCause+1); + self->errMsg = (MI_Char*)(client->probableCause+1); pmsg = self->errMsg; memcpy(pmsg, BASIC_AUTH_FAIL_MSG, msglen); pmsg += msglen; @@ -2871,6 +2879,7 @@ Http_CallbackResult HttpClient_IsAuthorized(_In_ struct _HttpClient_SR_SocketDat } +#if defined SUPPORT_KRB5 case AUTH_METHOD_NEGOTIATE_WITH_CREDS: case AUTH_METHOD_NEGOTIATE: case AUTH_METHOD_KERBEROS: @@ -3000,6 +3009,7 @@ Http_CallbackResult HttpClient_IsAuthorized(_In_ struct _HttpClient_SR_SocketDat #endif // unreachable return PRT_RETURN_FALSE; +#endif default: return PRT_RETURN_FALSE; diff --git a/Unix/mof/types.c b/Unix/mof/types.c index 8b4b807e3..47694097f 100644 --- a/Unix/mof/types.c +++ b/Unix/mof/types.c @@ -2704,11 +2704,11 @@ void MOF_PrintInstanceDecl( /* properties */ if (self->properties) - _PrintProperties(self->properties, self->numProperties, level, file); + _PrintProperties((MI_PropertyDecl**)self->properties, (size_t)self->numProperties, level, file); /* qualifiers */ if (self->qualifiers) - _PrintQualifiers(self->qualifiers, self->numQualifiers, level, file); + _PrintQualifiers((MI_Qualifier**)self->qualifiers, (size_t)self->numQualifiers, level, file); /* Footer */ level--; @@ -3523,7 +3523,7 @@ int FinalizeInstance(MI_InstanceDecl* id) /* For each instance property */ for (i = 0; i < id->numProperties; i++) { - MI_PropertyDecl* p = id->properties[i]; + MI_PropertyDecl* p = (MI_PropertyDecl*)id->properties[i]; MI_PropertyDecl* q = NULL; /* Find the class property with the same name */ @@ -3546,7 +3546,7 @@ int FinalizeInstance(MI_InstanceDecl* id) } /* Promote instance property (to the type given by class property) */ - if (_PromoteValue(p->type, q->type, &p->value) != 0) + if (_PromoteValue(p->type, q->type, (void**)&p->value) != 0) { yyerrorf(ID_INVALID_INITIALIZER, "invalid initializer: \"%s\"", p->name); diff --git a/Unix/omi_error/schema.c b/Unix/omi_error/schema.c index edf1e6bbc..145b593ca 100644 --- a/Unix/omi_error/schema.c +++ b/Unix/omi_error/schema.c @@ -344,9 +344,9 @@ MI_CONST MI_ClassDecl CIM_Error_rtti = MI_FLAG_CLASS|MI_FLAG_INDICATION, /* flags */ 0x00637209, /* code */ MI_T("CIM_Error"), /* name */ - CIM_Error_quals, /* qualifiers */ + (struct _MI_Qualifier**)CIM_Error_quals, /* qualifiers */ MI_COUNT(CIM_Error_quals), /* numQualifiers */ - CIM_Error_props, /* properties */ + (struct _MI_PropertyDecl**)CIM_Error_props, /* properties */ MI_COUNT(CIM_Error_props), /* numProperties */ sizeof(CIM_Error), /* size */ NULL, /* superClass */ @@ -478,13 +478,13 @@ MI_CONST MI_ClassDecl OMI_Error_rtti = MI_FLAG_CLASS|MI_FLAG_INDICATION, /* flags */ 0x006F7209, /* code */ MI_T("OMI_Error"), /* name */ - OMI_Error_quals, /* qualifiers */ + (struct _MI_Qualifier**)OMI_Error_quals, /* qualifiers */ MI_COUNT(OMI_Error_quals), /* numQualifiers */ - OMI_Error_props, /* properties */ + (struct _MI_PropertyDecl**)OMI_Error_props, /* properties */ MI_COUNT(OMI_Error_props), /* numProperties */ sizeof(OMI_Error), /* size */ - MI_T("CIM_Error"), /* superClass */ - &CIM_Error_rtti, /* superClassDecl */ + (MI_CONST MI_Char*)(MI_T("CIM_Error")), /* superClass */ + (MI_ClassDecl*)&CIM_Error_rtti, /* superClassDecl */ NULL, /* methods */ 0, /* numMethods */ &errorSchemaDecl, /* schema */ diff --git a/Unix/omireg/omireg.cpp b/Unix/omireg/omireg.cpp index 6ac37ef85..230db45b0 100644 --- a/Unix/omireg/omireg.cpp +++ b/Unix/omireg/omireg.cpp @@ -763,12 +763,12 @@ static void _GetConfigFileOptions( /* Form the configuration file path */ if (FindConfigFile(path) != 0) - err("failed to find configuration file"); + err(MI_T("failed to find configuration file")); /* Open the configuration file */ conf = Conf_Open(path); if (!conf) - err("failed to open configuration file: %s", path); + err(MI_T("failed to open configuration file: %s"), path); /* For each key=value pair in configuration file */ for (;;) @@ -778,7 +778,7 @@ static void _GetConfigFileOptions( int r = Conf_Read(conf, &key, &value); if (r == -1) - err("%s: %s\n", path, Conf_Error(conf)); + err(MI_T("%s: %s\n"), path, Conf_Error(conf)); if (r == 1) break; @@ -801,13 +801,13 @@ static void _GetConfigFileOptions( } else { - err("%s(%u): duplicate key: %s", + err(MI_T("%s(%u): duplicate key: %s"), path, Conf_Line(conf), opt.c_str ()); } } } else - err("%s(%u): unknown key: %s", path, Conf_Line(conf), key); + err(MI_T("%s(%u): unknown key: %s"), path, Conf_Line(conf), key); } /* Close configuration file */ diff --git a/Unix/protocol/protocol.c b/Unix/protocol/protocol.c index 4e8545ff9..b5cb58697 100644 --- a/Unix/protocol/protocol.c +++ b/Unix/protocol/protocol.c @@ -1175,7 +1175,7 @@ static MI_Boolean _ProcessCreateAgentMsg( { /* create/open log file for agent */ { - char path[PAL_MAX_PATH_SIZE]; + char path[PAL_MAX_PATH_SIZE] = { 0 }; if (0 != FormatLogFileName(agentMsg->uid, agentMsg->gid, agentMsg->libraryName, path)) { @@ -1199,11 +1199,11 @@ static MI_Boolean _ProcessCreateAgentMsg( char param_sock[32]; char param_logfd[32]; const char *agentProgram = OMI_GetPath(ID_AGENTPROGRAM); - char realAgentProgram[PATH_MAX]; + char realAgentProgram[PATH_MAX] = { 0 }; const char *destDir = OMI_GetPath(ID_DESTDIR); - char realDestDir[PATH_MAX]; + char realDestDir[PATH_MAX] = { 0 }; const char *provDir = OMI_GetPath(ID_PROVIDERDIR); - char realProvDir[PATH_MAX]; + char realProvDir[PATH_MAX] = { 0 }; char *ret; ret = realpath(agentProgram, realAgentProgram); diff --git a/Unix/providers/identify/schema.c b/Unix/providers/identify/schema.c index 3e724cd7e..9ae2f5ca3 100644 --- a/Unix/providers/identify/schema.c +++ b/Unix/providers/identify/schema.c @@ -514,9 +514,9 @@ MI_CONST MI_ClassDecl Identify_rtti = MI_FLAG_CLASS, /* flags */ 0x006F790C, /* code */ MI_T("OMI_Identify"), /* name */ - NULL, /* qualifiers */ + (struct _MI_Qualifier**)NULL, /* qualifiers */ 0, /* numQualifiers */ - Identify_props, /* properties */ + (struct _MI_PropertyDecl**)Identify_props, /* properties */ MI_COUNT(Identify_props), /* numProperties */ sizeof(Identify), /* size */ NULL, /* superClass */ diff --git a/Unix/provmgr/indicationSchema.c b/Unix/provmgr/indicationSchema.c index 4a797d872..5c43ab5ce 100644 --- a/Unix/provmgr/indicationSchema.c +++ b/Unix/provmgr/indicationSchema.c @@ -222,9 +222,9 @@ MI_CONST MI_ClassDecl CIM_Indication_rtti = MI_FLAG_CLASS|MI_FLAG_INDICATION|MI_FLAG_ABSTRACT, /* flags */ 0x00636E0E, /* code */ MI_T("CIM_Indication"), /* name */ - CIM_Indication_quals, /* qualifiers */ + (struct _MI_Qualifier**)CIM_Indication_quals, /* qualifiers */ MI_COUNT(CIM_Indication_quals), /* numQualifiers */ - CIM_Indication_props, /* properties */ + (struct _MI_PropertyDecl**)CIM_Indication_props, /* properties */ MI_COUNT(CIM_Indication_props), /* numProperties */ sizeof(CIM_Indication), /* size */ NULL, /* superClass */ @@ -342,13 +342,13 @@ MI_CONST MI_ClassDecl CIM_InstIndication_rtti = MI_FLAG_CLASS|MI_FLAG_INDICATION|MI_FLAG_ABSTRACT, /* flags */ 0x00636E12, /* code */ MI_T("CIM_InstIndication"), /* name */ - CIM_InstIndication_quals, /* qualifiers */ + (struct _MI_Qualifier**)CIM_InstIndication_quals, /* qualifiers */ MI_COUNT(CIM_InstIndication_quals), /* numQualifiers */ - CIM_InstIndication_props, /* properties */ + (struct _MI_PropertyDecl**)CIM_InstIndication_props, /* properties */ MI_COUNT(CIM_InstIndication_props), /* numProperties */ sizeof(CIM_InstIndication), /* size */ - MI_T("CIM_Indication"), /* superClass */ - &CIM_Indication_rtti, /* superClassDecl */ + (MI_CONST MI_Char*)MI_T("CIM_Indication"), /* superClass */ + (MI_ClassDecl*)&CIM_Indication_rtti, /* superClassDecl */ NULL, /* methods */ 0, /* numMethods */ &indicationSchemaDecl, /* schema */ @@ -411,13 +411,13 @@ MI_CONST MI_ClassDecl CIM_InstCreation_rtti = MI_FLAG_CLASS|MI_FLAG_INDICATION, /* flags */ 0x00636E10, /* code */ MI_T("CIM_InstCreation"), /* name */ - CIM_InstCreation_quals, /* qualifiers */ + (struct _MI_Qualifier**)CIM_InstCreation_quals, /* qualifiers */ MI_COUNT(CIM_InstCreation_quals), /* numQualifiers */ - CIM_InstCreation_props, /* properties */ + (struct _MI_PropertyDecl**)CIM_InstCreation_props, /* properties */ MI_COUNT(CIM_InstCreation_props), /* numProperties */ sizeof(CIM_InstCreation), /* size */ - MI_T("CIM_InstIndication"), /* superClass */ - &CIM_InstIndication_rtti, /* superClassDecl */ + (MI_CONST MI_Char*)MI_T("CIM_InstIndication"), /* superClass */ + (MI_ClassDecl*)&CIM_InstIndication_rtti, /* superClassDecl */ NULL, /* methods */ 0, /* numMethods */ &indicationSchemaDecl, /* schema */ @@ -480,13 +480,13 @@ MI_CONST MI_ClassDecl CIM_InstDeletion_rtti = MI_FLAG_CLASS|MI_FLAG_INDICATION, /* flags */ 0x00636E10, /* code */ MI_T("CIM_InstDeletion"), /* name */ - CIM_InstDeletion_quals, /* qualifiers */ + (struct _MI_Qualifier**)CIM_InstDeletion_quals, /* qualifiers */ MI_COUNT(CIM_InstDeletion_quals), /* numQualifiers */ - CIM_InstDeletion_props, /* properties */ + (struct _MI_PropertyDecl**)CIM_InstDeletion_props, /* properties */ MI_COUNT(CIM_InstDeletion_props), /* numProperties */ sizeof(CIM_InstDeletion), /* size */ - MI_T("CIM_InstIndication"), /* superClass */ - &CIM_InstIndication_rtti, /* superClassDecl */ + (MI_CONST MI_Char*)MI_T("CIM_InstIndication"), /* superClass */ + (MI_ClassDecl*)&CIM_InstIndication_rtti, /* superClassDecl */ NULL, /* methods */ 0, /* numMethods */ &indicationSchemaDecl, /* schema */ @@ -621,13 +621,13 @@ MI_CONST MI_ClassDecl CIM_InstMethodCall_rtti = MI_FLAG_CLASS|MI_FLAG_INDICATION, /* flags */ 0x00636C12, /* code */ MI_T("CIM_InstMethodCall"), /* name */ - CIM_InstMethodCall_quals, /* qualifiers */ + (struct _MI_Qualifier**)CIM_InstMethodCall_quals, /* qualifiers */ MI_COUNT(CIM_InstMethodCall_quals), /* numQualifiers */ - CIM_InstMethodCall_props, /* properties */ + (struct _MI_PropertyDecl**)CIM_InstMethodCall_props, /* properties */ MI_COUNT(CIM_InstMethodCall_props), /* numProperties */ sizeof(CIM_InstMethodCall), /* size */ - MI_T("CIM_InstIndication"), /* superClass */ - &CIM_InstIndication_rtti, /* superClassDecl */ + (MI_CONST MI_Char*)MI_T("CIM_InstIndication"), /* superClass */ + (MI_ClassDecl*)&CIM_InstIndication_rtti, /* superClassDecl */ NULL, /* methods */ 0, /* numMethods */ &indicationSchemaDecl, /* schema */ @@ -708,13 +708,13 @@ MI_CONST MI_ClassDecl CIM_InstModification_rtti = MI_FLAG_CLASS|MI_FLAG_INDICATION, /* flags */ 0x00636E14, /* code */ MI_T("CIM_InstModification"), /* name */ - CIM_InstModification_quals, /* qualifiers */ + (struct _MI_Qualifier**)CIM_InstModification_quals, /* qualifiers */ MI_COUNT(CIM_InstModification_quals), /* numQualifiers */ - CIM_InstModification_props, /* properties */ + (struct _MI_PropertyDecl**)CIM_InstModification_props, /* properties */ MI_COUNT(CIM_InstModification_props), /* numProperties */ sizeof(CIM_InstModification), /* size */ - MI_T("CIM_InstIndication"), /* superClass */ - &CIM_InstIndication_rtti, /* superClassDecl */ + (MI_CONST MI_Char*)MI_T("CIM_InstIndication"), /* superClass */ + (MI_ClassDecl*)&CIM_InstIndication_rtti, /* superClassDecl */ NULL, /* methods */ 0, /* numMethods */ &indicationSchemaDecl, /* schema */ @@ -777,13 +777,13 @@ MI_CONST MI_ClassDecl CIM_InstRead_rtti = MI_FLAG_CLASS|MI_FLAG_INDICATION, /* flags */ 0x0063640C, /* code */ MI_T("CIM_InstRead"), /* name */ - CIM_InstRead_quals, /* qualifiers */ + (struct _MI_Qualifier**)CIM_InstRead_quals, /* qualifiers */ MI_COUNT(CIM_InstRead_quals), /* numQualifiers */ - CIM_InstRead_props, /* properties */ + (struct _MI_PropertyDecl**)CIM_InstRead_props, /* properties */ MI_COUNT(CIM_InstRead_props), /* numProperties */ sizeof(CIM_InstRead), /* size */ - MI_T("CIM_InstIndication"), /* superClass */ - &CIM_InstIndication_rtti, /* superClassDecl */ + (MI_CONST MI_Char*)MI_T("CIM_InstIndication"), /* superClass */ + (MI_ClassDecl*)&CIM_InstIndication_rtti, /* superClassDecl */ NULL, /* methods */ 0, /* numMethods */ &indicationSchemaDecl, /* schema */ diff --git a/Unix/provreg/provreg.c b/Unix/provreg/provreg.c index eccb052cb..5e415fe19 100644 --- a/Unix/provreg/provreg.c +++ b/Unix/provreg/provreg.c @@ -694,7 +694,7 @@ static int _AddEntryForExtraClass( return 0; } -/* Initialize ProvReg strucutre from given directory */ +/* Initialize ProvReg structure from given directory */ _Use_decl_annotations_ MI_Result ProvReg_Init(ProvReg* self, const char* directory) { @@ -875,7 +875,7 @@ MI_Result ProvReg_Init(ProvReg* self, const char* directory) return r; } -/* Initialize ProvReg strucutre from omiregister directory */ +/* Initialize ProvReg structure from omiregister directory */ _Use_decl_annotations_ MI_Result ProvReg_Init2(ProvReg* self) { diff --git a/Unix/provreg/provreg.h b/Unix/provreg/provreg.h index bae16be54..eb1b05908 100644 --- a/Unix/provreg/provreg.h +++ b/Unix/provreg/provreg.h @@ -119,12 +119,12 @@ typedef struct _ProvReg } ProvReg; -/* Initialize ProvReg strucutre from given directory */ +/* Initialize ProvReg structure from given directory */ MI_Result ProvReg_Init( _Inout_ ProvReg* self, _In_z_ const char* directory); -/* Initialize ProvReg strucutre from omiregister directory */ +/* Initialize ProvReg structure from omiregister directory */ MI_Result ProvReg_Init2( _Inout_ ProvReg* self); diff --git a/Unix/server/server.c b/Unix/server/server.c index 535b31084..c58051fec 100644 --- a/Unix/server/server.c +++ b/Unix/server/server.c @@ -479,7 +479,7 @@ int servermain(int argc, const char* argv[], const char *envp[]) int engine_argc = 0; char **engine_argv = NULL; char **engine_envp = NULL; - char socketFile[PAL_MAX_PATH_SIZE]; + char socketFile[PAL_MAX_PATH_SIZE] = { 0 }; const char* arg0 = argv[0]; MI_Result result; int r; diff --git a/Unix/server/servercommon.c b/Unix/server/servercommon.c index b57e6394c..6fdf8f035 100644 --- a/Unix/server/servercommon.c +++ b/Unix/server/servercommon.c @@ -143,7 +143,7 @@ int _ParseHttpPortSpecification(unsigned short **ports, int *size, const char *s *size = 0; // Skip leading spaces - char *saveptr; + char *saveptr = NULL; char *ptr = (char *) spec; while (*ptr == ' ') { @@ -191,7 +191,7 @@ int _ParseHttpPortSpecification(unsigned short **ports, int *size, const char *s err(ZT("memory allocation failure allocating %d bytes"), bytes); } - (*ports)[(*size) - 1] = x; + (*ports)[(*size) - 1] = (unsigned short)x; } } } @@ -446,7 +446,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; } @@ -459,7 +459,7 @@ void ResetLog() if (r == -1) { - trace_CriticalError("Incorrect entry in configuration file"); + trace_CriticalError(MI_T("Incorrect entry in configuration file")); break; } @@ -470,7 +470,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; } @@ -1020,6 +1020,7 @@ static void _ProcessNoopRequest(_Inout_ InteractionOpenParams* params) trace_OutOfMemory(); Strand_FailOpen(params); err(ZT("out of memory")); + return; } /* Send NoOp response back */ @@ -1030,6 +1031,7 @@ static void _ProcessNoopRequest(_Inout_ InteractionOpenParams* params) trace_OutOfMemory(); Strand_FailOpen(params); err(ZT("out of memory")); + return; } #if !defined(CONFIG_FAVORSIZE) diff --git a/Unix/sock/addr.c b/Unix/sock/addr.c index 91f851c5e..742fd990e 100644 --- a/Unix/sock/addr.c +++ b/Unix/sock/addr.c @@ -73,7 +73,7 @@ MI_Result Addr_Init( memcpy(&self->u.sock_addr, rp->ai_addr, (size_t)rp->ai_addrlen); /* Set the duplicate copies of family, port and socket type */ - self->sock_addr_size = rp->ai_addrlen; + self->sock_addr_size = (MI_Uint16)rp->ai_addrlen; self->port_high_endian = htons(port); self->is_ipv6 = (rp->ai_family == AF_INET6); diff --git a/Unix/wql/output.c b/Unix/wql/output.c index 9261e3489..3ec895964 100644 --- a/Unix/wql/output.c +++ b/Unix/wql/output.c @@ -67,6 +67,10 @@ int WQL_Define(const WQL* self, Buf* out, size_t nindent) _Indent(nindent, out); len = Snprintf(buf, sizeof(buf), " %u,\n", (int)self->nproperties); + if(len<0) + { + return -1; + } Buf_App(out, buf, len); } @@ -133,6 +137,10 @@ int WQL_Define(const WQL* self, Buf* out, size_t nindent) Buf_App(out, STRLIT("WQL_TYPE_BOOLEAN, ")); Buf_App(out, STRLIT("WQL_VALUE_BOOLEAN(")); len = Snprintf(buf, sizeof(buf), "%u", sym->value.boolean); + if(len<0) + { + return -1; + } Buf_App(out, buf, len); Buf_App(out, STRLIT(")")); break; @@ -141,6 +149,10 @@ int WQL_Define(const WQL* self, Buf* out, size_t nindent) Buf_App(out, STRLIT("WQL_VALUE_INTEGER(")); len = Snprintf(buf, sizeof(buf), SINT64_FMT, sym->value.integer); + if(len<0) + { + return -1; + } Buf_App(out, buf, len); Buf_App(out, STRLIT(")")); break; @@ -148,6 +160,10 @@ int WQL_Define(const WQL* self, Buf* out, size_t nindent) Buf_App(out, STRLIT("WQL_TYPE_REAL, ")); Buf_App(out, STRLIT("WQL_VALUE_REAL(")); len = Snprintf(buf, sizeof(buf), "%lf", sym->value.real); + if(len<0) + { + return -1; + } Buf_App(out, buf, len); Buf_App(out, STRLIT(")")); break; @@ -225,6 +241,10 @@ int WQL_Define(const WQL* self, Buf* out, size_t nindent) len = Snprintf(buf, sizeof(buf), " %u,\n", (int)self->nsymbols); _Indent(nindent, out); + if(len<0) + { + return -1; + } Buf_App(out, buf, len); } diff --git a/Unix/wsman/wsbuf.c b/Unix/wsman/wsbuf.c index fe4e4c9f7..733400af7 100644 --- a/Unix/wsman/wsbuf.c +++ b/Unix/wsman/wsbuf.c @@ -111,98 +111,98 @@ static const BUF_FaultItem s_faults[] = { /* WSBUF_FAULT_INTERNAL_ERROR */ { LIT(ZT("http://schemas.dmtf.org/wbem/wsman/1/wsman/fault")), - "SOAP-ENV:Receiver", + "s:Receiver", "wsman:InternalError", ZT("The service cannot comply with the request due to internal processing errors.") }, /* WSBUF_FAULT_NOT_SUPPORTED */ { LIT(ZT("http://schemas.dmtf.org/wbem/wsman/1/wsman/fault")), - "SOAP-ENV:Sender", + "s:Sender", "wsman:UnsupportedFeature", ZT("not supported") }, /* WSBUF_FAULT_NOT_UNDERSTOOD */ { LIT(ZT("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault")), - "SOAP-ENV:MustUnderstand", + "s:MustUnderstand", 0, ZT("Header not understood") }, /* WSBUF_FAULT_DESTINATION_UNREACHABLE */ { LIT(ZT("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault")), - "SOAP-ENV:Sender", + "s:Sender", "wsa:DestinationUnreachable", ZT("No route can be determined to reach the destination role defined by the Addressing To header.") }, /* WSBUF_FAULT_ACCESS_DENIED */ { LIT(ZT("http://schemas.dmtf.org/wbem/wsman/1/wsman/fault")), - "SOAP-ENV:Sender", + "s:Sender", "wsman:AccessDenied", ZT("The sender was not authorized to access the resource.") }, /* WSBUF_FAULT_ENCODING_LIMIT */ { LIT(ZT("http://schemas.dmtf.org/wbem/wsman/1/wsman/fault")), - "SOAP-ENV:Sender", + "s:Sender", "wsman:EncodingLimit", ZT("An internal encoding limit was exceeded in a request or would be violated if the message were processed.") }, /* WSBUF_FAULT_INVALID_EXPIRATION_TIME */ { LIT(ZT("http://schemas.dmtf.org/wbem/wsman/1/wsman/fault")), - "SOAP-ENV:Sender", + "s:Sender", "wsman:InvalidExpirationTime", ZT("The request specified an invalid expiration time that cannot be supported (zero or in the past).") }, /* WSBUF_FAULT_UNSUPPORTED_EXPIRATION_TIME */ { LIT(ZT("http://schemas.dmtf.org/wbem/wsman/1/wsman/fault")), - "SOAP-ENV:Sender", + "s:Sender", "wsman:UnsupportedExpirationTime", ZT("Only xs:duration expiration values are supported.") }, /* WSBUF_FAULT_TIMED_OUT */ { LIT(ZT("http://schemas.dmtf.org/wbem/wsman/1/wsman/fault")), - "SOAP-ENV:Receiver", + "s:Receiver", "wsman:TimedOut", ZT("The operation has timed out.") }, /* WSBUF_FAULT_INVALID_MESSAGE_INFORMATION_HEADER */ { LIT(ZT("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault")), - "SOAP-ENV:Sender", + "s:Sender", "wsa:InvalidMessageInformationHeader", ZT("The request specified an invalid header property.") }, /* WSBUF_FAULT_INVALID_HEARTBEAT */ { LIT(ZT("http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/Heartbeats")), - "SOAP-ENV:Sender", + "s:Sender", "wsman:UnsupportedFeature", ZT("The request specified an invalid heartbeat.") }, /* WSBUF_FAULT_ACTION_NOT_SUPPORTED */ { LIT(ZT("http://schemas.xmlsoap.org/ws/2004/08/addressing/fault")), - "SOAP-ENV:Sender", + "s:Sender", "wsa:ActionNotSupported", ZT("The request specified an unsupported action.") }, /* WSBUF_FAULT_CONNECTION_RETRY_NOT_SUPPORTED */ { LIT(ZT("http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/DeliveryRetries")), - "SOAP-ENV:Sender", + "s:Sender", "wsman:UnsupportedFeature", ZT("Connection retry is not supported.") }, /* WSBUF_FAULT_BOOKMARK_INVALID_FORMAT */ { LIT(ZT("http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/InvalidFormat")), - "SOAP-ENV:Sender", + "s:Sender", "wsman:InvalidBookmark", ZT("Bookmark must be non-empty if specified.") } @@ -778,6 +778,8 @@ MI_Result WSBuf_AddString( ZChar* pos = start; ZChar* end = (ZChar*)(((char*)(buf->page +1))+ buf->page->u.s.size); /* Add reamingin characters (next character is special)*/ + if (str == NULL) + return MI_RESULT_OK; while (*str) { const ZChar* item; @@ -1250,6 +1252,10 @@ static MI_Result _PackFieldSint32( ZChar s[24]; MI_Sint32 size = Stprintf(s, MI_COUNT(s), ZT("%d"), value); + if(size<0) + { + return MI_RESULT_FAILED; + } return _PackFieldStringLit(buf,writer,name,s,size, flags, nsPrefix); } @@ -1264,6 +1270,10 @@ static MI_Result _PackFieldSint64( ZChar s[24]; MI_Sint32 size = Stprintf(s, MI_COUNT(s), SINT64_FMT_T, value); + if(size<0) + { + return MI_RESULT_FAILED; + } return _PackFieldStringLit(buf,writer,name,s,size,flags, nsPrefix); } @@ -1279,6 +1289,10 @@ static MI_Result _PackFieldReal64( /* Use DBL_DIG=15 for precision. Check MSDN DBL_DIG */ MI_Sint32 size = Stprintf(s, MI_COUNT(s), ZT("%.15g"), value); + if(size<0) + { + return MI_RESULT_FAILED; + } return _PackFieldStringLit(buf,writer,name,s,size,flags, nsPrefix); } @@ -1564,9 +1578,10 @@ static MI_Result _PackEPR( /* namespace (if present)*/ if (self->nameSpace) { - WSBuf_AddLit(buf, LIT(ZT(""))); - WSBuf_AddStringNoEncoding(buf, self->nameSpace); - WSBuf_AddLit(buf, LIT(ZT(""))); + if(MI_RESULT_OK != WSBuf_AddLit(buf, LIT(ZT(""))) || + MI_RESULT_OK != WSBuf_AddStringNoEncoding(buf, self->nameSpace) || + MI_RESULT_OK != WSBuf_AddLit(buf, LIT(ZT("")))) + return MI_RESULT_FAILED; } /* Put properties */ @@ -2373,8 +2388,8 @@ MI_Result WSBuf_CreateSoapResponseHeader( /* Response header */ if (MI_RESULT_OK != WSBuf_AddLit(buf, LIT( - ZT("") - ZT("") + ZT("") ZT("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous") - ZT("")))) + ZT("")))) { goto failed; } @@ -2398,7 +2413,7 @@ MI_Result WSBuf_CreateSoapResponseHeader( if (MI_RESULT_OK != WSBuf_AddLit(buf, LIT(ZT("") - ZT("")))) + ZT("")))) goto failed; /* Generate new uniqueue msg id */ @@ -2463,7 +2478,7 @@ Page* WSBuf_CreateFaultResponsePage( if (notUnderstoodTag) { if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") - ZT("") - ZT("") - ZT("") - ZT("")))) + ZT("") + ZT("") + ZT("") + ZT("") + ZT("")))) goto failed; if (MI_RESULT_OK != WSBuf_AddCharStringNoEncoding(&outBuf, fault->code)) goto failed; - //SOAP-ENV:Sender + //s:Sender if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("")))) + LIT(ZT("")))) goto failed; if (fault->subCode) { if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") - ZT("")))) + LIT(ZT("") + ZT("")))) goto failed; if (MI_RESULT_OK != WSBuf_AddCharStringNoEncoding( @@ -2509,15 +2524,15 @@ Page* WSBuf_CreateFaultResponsePage( } if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") - ZT("")))) + LIT(ZT("") + ZT("")))) goto failed; } if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") - ZT("") - ZT("")))) + LIT(ZT("") + ZT("") + ZT("")))) goto failed; textToSend = fault->defaultText; @@ -2533,8 +2548,8 @@ Page* WSBuf_CreateFaultResponsePage( } if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") - ZT("")))) + LIT(ZT("") + ZT("")))) { goto failed; } @@ -2546,7 +2561,7 @@ Page* WSBuf_CreateFaultResponsePage( * only have 1 right now so this works! */ if ((MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") + LIT(ZT("") ZT("") - ZT("")))) + ZT("")))) { goto failed; } } else if ((message->result != MI_RESULT_OK) || (NULL != message->packedInstancePtr)) { - if ((MI_RESULT_OK != WSBuf_AddLit(&outBuf, LIT(ZT("")ZT("")ZT("cimErrorClassName?message->cimErrorClassName:ZT("OMI_Error")))) || (MI_RESULT_OK != WSBuf_AddLit(&outBuf, LIT(ZT(" wsmb:IsCIM_Error=\"true\" ") @@ -2757,16 +2772,16 @@ Page* WSBuf_CreateFaultResponsePage( if ((MI_RESULT_OK != WSBuf_AddLit(&outBuf, LIT(ZT("cimErrorClassName?message->cimErrorClassName:ZT("OMI_Error")))) || - (MI_RESULT_OK != WSBuf_AddLit(&outBuf, LIT(ZT(">") ZT("")))))) + (MI_RESULT_OK != WSBuf_AddLit(&outBuf, LIT(ZT(">") ZT("")))))) { goto failed; } } if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") - ZT("") - ZT("")))) + LIT(ZT("") + ZT("") + ZT("")))) { goto failed; } @@ -2796,9 +2811,9 @@ Page* WSBuf_CreateReleaseResponsePage( if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, LIT( - ZT("") - ZT("") - ZT("")))) + ZT("") + ZT("") + ZT("")))) goto failed; return WSBuf_StealPage(&outBuf); diff --git a/Unix/wsman/wsman.c b/Unix/wsman/wsman.c index 6ef5108bd..424f783b1 100644 --- a/Unix/wsman/wsman.c +++ b/Unix/wsman/wsman.c @@ -76,8 +76,8 @@ STRAND_DEBUGNAME2( WsmanEnumerationContext, PullAttached, UnsubscribeAttached ) const MI_Uint64 WSMAN_TIMEOUT_DEFAULT = 60 * 1000 * 1000; // 60 Seconds in microseconds #define TYPICAL_ENUM_RESPONSE_ENVELOPE \ - "\n" \ - "\n" \ + "\n" \ "\n" \ "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous\n" \ "\n" \ - "\n" \ + "\n" \ "http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse\n" \ "\n" \ - "\n" \ + "\n" \ "uuid:00000000-0000-0000-0000-000000000000\n" \ "\n" \ "\n" \ "uuid:00000000-0000-0000-0000-000000000000\n" \ "\n" \ - "\n" \ - "\n" \ + "\n" \ + "\n" \ "\n" \ "\n" \ "000000000000\n" \ @@ -117,8 +117,8 @@ const MI_Uint64 WSMAN_TIMEOUT_DEFAULT = 60 * 1000 * 1000; // 60 Seconds in micro "\n" \ "\n" \ "\n" \ - "\n" \ - "\n" + "\n" \ + "\n" /* aproximate repsonse header size */ #define APPROX_ENUM_RESP_ENVELOPE_SIZE \ @@ -1044,9 +1044,8 @@ static int _ValidateEnumerateRequest( selfCD, NULL, WSBUF_FAULT_INTERNAL_ERROR, - ZT("mandatory parameters (className, namespace) " - "are missing for enumerate request")); - + ZT("mandatory parameters (className, namespace) ") + ZT("are missing for enumerate request")); return -1; } @@ -1244,8 +1243,8 @@ static MI_Result _GetHTTPHeaderOpts( for (i = 0; i < selfCD->headersSize; i++) { MI_Value v; - ZChar name[128]; - ZChar value[128]; + ZChar name[128] = { 0 }; + ZChar value[128] = { 0 }; Tcslcpy(name, MI_T("HTTP_"), MI_COUNT(name)); TcsStrlcat(name, selfCD->headers[i].name, MI_COUNT(name)); @@ -1254,7 +1253,7 @@ static MI_Result _GetHTTPHeaderOpts( Tcslcpy(value, selfCD->headers[i].value, MI_COUNT(value)); - v.string = value; + v.string = (MI_Char*)value; r = __MI_Instance_AddElement( options, @@ -2304,11 +2303,11 @@ static void _ParseValidateProcessCreateRequest( /* Set the user agent */ msg->base.userAgent = selfCD->userAgent; +#ifndef DISABLE_SHELL /* Parse create request/body */ if (WS_ParseCreateBody(xml, msg->base.base.batch, &msg->instance, &selfCD->wsheader.isShellOperation) != 0) GOTO_FAILED; -#ifndef DISABLE_SHELL if (selfCD->wsheader.isCompressed) { MI_Value value; @@ -2695,8 +2694,8 @@ static void _SendEnumPullResponse( } if (MI_RESULT_OK != WSBuf_AddLit(&outBufHeader, - LIT(ZT("") - ZT("")))) + LIT(ZT("") + ZT("")))) GOTO_FAILED; if (selfCD->wsheader.rqtAction == WSMANTAG_ACTION_ENUMERATE) @@ -2804,8 +2803,8 @@ static void _SendEnumPullResponse( GOTO_FAILED; } if (MI_RESULT_OK != WSBuf_AddLit(&outBufTrailer, - LIT(ZT("") - ZT("")))) + LIT(ZT("") + ZT("")))) GOTO_FAILED; /* all together */ @@ -2982,8 +2981,8 @@ static void _SendInvokeResponse( GOTO_FAILED; if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") - ZT("")))) + LIT(ZT("") + ZT("")))) { GOTO_FAILED; } @@ -2998,8 +2997,8 @@ static void _SendInvokeResponse( if (MI_RESULT_OK != WSBuf_AddLit( &outBuf, - LIT(ZT("") - ZT("")))) + LIT(ZT("") + ZT("")))) { GOTO_FAILED; } @@ -3054,8 +3053,8 @@ static void _SendSingleResponseHelper( GOTO_FAILED; if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") - ZT("") + LIT(ZT("") + ZT("") ))) GOTO_FAILED; @@ -3073,8 +3072,8 @@ static void _SendSingleResponseHelper( /* trailer */ if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, LIT( - ZT("") - ZT("")))) + ZT("") + ZT("")))) GOTO_FAILED; /* all together */ @@ -3133,9 +3132,9 @@ static void _SendEmptyBodyResponse(WSMAN_ConnectionData* selfCD, GOTO_FAILED; if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") - ZT("") - ZT("") + LIT(ZT("") + ZT("") + ZT("") ))) GOTO_FAILED; @@ -4770,16 +4769,16 @@ static void _SendHeartbeatResponse( GOTO_FAILED; if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("") - ZT("") + LIT(ZT("") + ZT("") ))) GOTO_FAILED; / * trailer * / if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, LIT( - ZT("") - ZT("")))) + ZT("") + ZT("")))) GOTO_FAILED; / * all together * / @@ -4830,7 +4829,7 @@ static void _SendUnsubscribeResponse( GOTO_FAILED; if (MI_RESULT_OK != WSBuf_AddLit(&outBuf, - LIT(ZT("\n\n") + LIT(ZT("\n\n") ))) GOTO_FAILED; diff --git a/Unix/wsman/wsmanclient.c b/Unix/wsman/wsmanclient.c index 133e89a79..7364ee4ef 100644 --- a/Unix/wsman/wsmanclient.c +++ b/Unix/wsman/wsmanclient.c @@ -800,6 +800,7 @@ void _WsmanClient_Post( _In_ Strand* self_, _In_ Message* msg) self->wsmanSoapHeaders.action = value.string; } +#ifndef DISABLE_SHELL if ((MI_Instance_GetElement(requestMessage->options, MI_T("__MI_OPERATIONOPTIONS_SESSIONID"), &value, @@ -811,6 +812,7 @@ void _WsmanClient_Post( _In_ Strand* self_, _In_ Message* msg) { self->wsmanSoapHeaders.sessionId = value.string; } +#endif if ((MI_Instance_GetElement(requestMessage->options, MI_T("__MI_OPERATIONOPTIONS_ISSHELL"), &value, @@ -841,6 +843,7 @@ void _WsmanClient_Post( _In_ Strand* self_, _In_ Message* msg) break; } +#ifndef DISABLE_SHELL case CreateInstanceReqTag: { CreateInstanceReq *createMessage = (CreateInstanceReq*) msg; @@ -855,7 +858,7 @@ void _WsmanClient_Post( _In_ Strand* self_, _In_ Message* msg) miresult = CreateMessageRequest(&self->wsbuf, &self->wsmanSoapHeaders, createMessage); break; } - +#endif case ModifyInstanceReqTag: { ModifyInstanceReq *putMessage = (ModifyInstanceReq*) msg; diff --git a/Unix/xml/xml.c b/Unix/xml/xml.c index 163c090a6..e34026a0f 100644 --- a/Unix/xml/xml.c +++ b/Unix/xml/xml.c @@ -1725,7 +1725,7 @@ int XML_ParseCharFault(const XML *self, const XML_Char *data, XML_Char *buffer, { #define PREFIX_SIZE 32 XML_Char prefix[PREFIX_SIZE]; - int i, j, k, l; + size_t i, j, k, l; MI_Boolean prefixFound = MI_FALSE; for (i=0; iGetClassName(&classOfInstance, &classNameOfInstance); @@ -137,6 +141,10 @@ static void WriteBuffer_Instance( { WriteBuffer_String(clientBuffer, clientBufferLength, clientBufferNeeded, classNameOfInstance, escapingDepth, result); } + else + { + return; + } WriteBuffer_StringLiteral(clientBuffer, clientBufferLength, clientBufferNeeded, PAL_T("\""), escapingDepth, result); WriteBuffer_StringLiteral(clientBuffer, clientBufferLength, clientBufferNeeded, PAL_T(">"), escapingDepth, result); @@ -271,6 +279,10 @@ static void WriteBuffer_InstanceEmbeddedClass( serverName = embeddedInstance[embeddedInstanceLoop]->serverName; } MI_Instance_GetClassExt(embeddedInstance[embeddedInstanceLoop], &classOfInstance); + if(classOfInstance.ft == NULL) + { + return; + } WriteBuffer_RecurseInstanceClass(clientBuffer, clientBufferLength, clientBufferNeeded, serializeFlags, &classOfInstance, namespaceName, serverName, writtenClasses, writtenClassCount, result); //Recurse in case it has any embedded classes @@ -304,6 +316,10 @@ static void WriteBuffer_SerializeClass( { WriteBuffer_CimName(clientBuffer, clientBufferLength, clientBufferNeeded, miClassName, SERIALIZE_NO_ESCAPE, result); } + else + { + return; + } /* %SuperClass; */ GetClassExtendedFt(miClass)->GetParentClassName(miClass, &miParentClassName); @@ -566,7 +582,8 @@ static void WriteBuffer_MiPropertyDecls( GetClassExtendedFt(miClass)->GetElementAtExt(miClass, propertyCount, &propertyName, &propertyValue, &propertyValueExistsInDecl, &propertyType, &propertySubscript, &propertyOffset , &propertyReferenceClass, &propertyOriginClass, &propertyPropagatorClass, &propertyQualifierSet, &propertyFlags); - MI_Instance_GetElementAt((MI_Instance*)instanceStart, propertyCount, &propertyName, &propertyValue, &propertyType, &propertyFlags); + if(MI_RESULT_OK != MI_Instance_GetElementAt((MI_Instance*)instanceStart, propertyCount, &propertyName, &propertyValue, &propertyType, &propertyFlags)) + return; /* If not serializing deep and we are not the propagator of the property then we need to skip this one */ //MI_SERIALIZER_FLAGS_CLASS_DEEP @@ -1597,7 +1614,10 @@ static void WriteBuffer_INSTANCENAME( MI_Uint32 propertyFlags; *result = MI_Instance_GetClassExt(refValue, &classOfRefValue); - + if(classOfRefValue.ft == NULL) + { + return; + } *result = GetClassExtendedFt(&classOfRefValue)->GetClassName(&classOfRefValue, &classNameOfRefValue); WriteBuffer_StringLiteral(clientBuffer, clientBufferLength, clientBufferNeeded, PAL_T("nameSpace, _instanceObject->serverName, writtenClasses, &writtenClassCount, &result); //Loop through embedded object classes