Skip to content

Commit

Permalink
Zowe Suite v2.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored May 29, 2024
2 parents e697314 + 72ed1e0 commit fe74a15
Show file tree
Hide file tree
Showing 16 changed files with 176 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-configmgr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
- name: '[Dep 2] Quickjs'
uses: actions/checkout@v3
with:
repository: joenemo/quickjs-portable
repository: JoeNemo/quickjs-portable
path: deps/configmgr/quickjs
ref: 'main'

Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Zowe Common C Changelog

## `2.16.0`
- No yaml value converted to null (#442)
- Added `zos.getZosVersion()` and `zos.getEsm()` calls for configmgr QJS (#429)
- For correct base64 encoding scheme the buffer size is made to be divisble by 3 (#431).
- Take into account leap seconds in xmem log messages' timestamps (#432, #433)
- Using a temporary buffer pointer to avoid pointer corruption during file write (#437).

## `2.15.0`
- Remove obsolete building script build_configmgr.sh (#410). (#423)
- Add flags to avoid linkage-stack queries in the recovery facility (#404, #412)

## `2.13.0`
- Added support for using "zowe.network" and "components.zss.zowe.network" to set TLS version properties. (#411)
- Added utility for general usage returning the name of External Security Manager
Expand Down
112 changes: 0 additions & 112 deletions build/build_configmgr.sh

This file was deleted.

4 changes: 2 additions & 2 deletions build/configmgr.proj.env
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PROJECT="configmgr"
VERSION=2.14.0
VERSION=2.16.0
DEPS="QUICKJS LIBYAML"

QUICKJS="quickjs"
QUICKJS_SOURCE="[email protected]:joenemo/quickjs-portable.git"
QUICKJS_SOURCE="[email protected]:JoeNemo/quickjs-portable.git"
QUICKJS_BRANCH="main"

LIBYAML="libyaml"
Expand Down
2 changes: 1 addition & 1 deletion build/getesm.proj.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PROJECT="getesm"
VERSION=2.14.0
VERSION=2.16.0
DEPS=""
2 changes: 1 addition & 1 deletion c/configmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ int cfgSetParmlibMemberName(ConfigManager *mgr, const char *configName, const ch
CFGConfig *config = getConfig(mgr,configName);
if (config){
int len = strlen(parmlibMemberName);
if (len < 3 || len > PARMLIB_MEMBER_MAX){
if (len < 1 || len > PARMLIB_MEMBER_MAX){
return ZCFG_BAD_PARMLIB_MEMBER_NAME;
} else {
config->parmlibMemberName = substring(mgr,(char*)parmlibMemberName,0,len);
Expand Down
16 changes: 13 additions & 3 deletions c/crossmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,19 +510,27 @@ static void getSTCK(uint64 *stckValue) {
__asm(" STCK 0(%0)" : : "r"(stckValue));
}

int64 getLocalTimeOffset() {
static int64 getLocalTimeOffset(void) {
CVT * __ptr32 cvt = *(void * __ptr32 * __ptr32)0x10;
void * __ptr32 cvtext2 = cvt->cvtext2;
int64 *cvtldto = (int64 * __ptr32)(cvtext2 + 0x38);
return *cvtldto;
}

static int64 getLeapSecondsOffset(void) {
CVT * __ptr32 cvt = *(void * __ptr32 * __ptr32)0x10;
void * __ptr32 cvtext2 = cvt->cvtext2;
int64 *cvtlso = (int64 * __ptr32)(cvtext2 + 0x50);
return *cvtlso;
}

static void getCurrentLogTimestamp(LogTimestamp *timestamp) {

uint64 stck = 0;
getSTCK(&stck);

stck += getLocalTimeOffset();
stck -= getLeapSecondsOffset();

stckToLogTimestamp(stck, timestamp);

Expand Down Expand Up @@ -1626,10 +1634,12 @@ ZOWE_PRAGMA_PACK_RESET
recoveryRC = recoveryEstablishRouter2(&(envAddr)->recoveryContext, \
(cmsGlobalAreaAddr)->pcssRecoveryPool, \
RCVR_ROUTER_FLAG_PC_CAPABLE | \
RCVR_ROUTER_FLAG_RUN_ON_TERM); \
RCVR_ROUTER_FLAG_RUN_ON_TERM | \
RCVR_ROUTER_FLAG_SKIP_LSTACK_QUERY); \
} else { \
recoveryRC = recoveryEstablishRouter(RCVR_ROUTER_FLAG_PC_CAPABLE | \
RCVR_ROUTER_FLAG_RUN_ON_TERM); \
RCVR_ROUTER_FLAG_RUN_ON_TERM | \
RCVR_ROUTER_FLAG_SKIP_LSTACK_QUERY); \
} \
if (recoveryRC != RC_RCV_OK) { \
returnCode = RC_CMS_ERROR; \
Expand Down
5 changes: 3 additions & 2 deletions c/httpfileservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,11 +935,12 @@ int writeAsciiDataFromBase64(UnixFile *file, char *fileContents, int contentLeng
&reasonCode);
if (status == 0) {
int writtenLength = 0;
char *currentBufferStart = dataToWrite;
while (dataSize != 0) {
writtenLength = fileWrite(file, dataToWrite, dataSize, &returnCode, &reasonCode);
writtenLength = fileWrite(file, currentBufferStart, dataSize, &returnCode, &reasonCode);
if (writtenLength >= 0) {
dataSize -= writtenLength;
dataToWrite -= writtenLength;
currentBufferStart += writtenLength;
}
else {
zowelog(NULL, LOG_COMP_RESTFILE, ZOWE_LOG_DEBUG, "Error writing to file: return: %d, rsn: %d.\n", returnCode, reasonCode);
Expand Down
12 changes: 7 additions & 5 deletions c/httpserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -3210,10 +3210,10 @@ static int serviceAuthNativeWithSessionToken(HttpService *service, HttpRequest *
request->flags = HTTP_REQUEST_NO_PASSWORD;
authDataFound = TRUE;
} else {
zowelog(NULL, LOG_COMP_HTTPSERVER, ZOWE_LOG_INFO, "No user was found for client certificate. (rc = 0x%x racfRC = 0x%x racfRSN = 0x%x)\n", safReturnCode, racfReturnCode, racfReasonCode);
zowelog(NULL, LOG_COMP_HTTPSERVER, ZOWE_LOG_DEBUG, "No user was found for client certificate. (rc = 0x%x racfRC = 0x%x racfRSN = 0x%x)\n", safReturnCode, racfReturnCode, racfReasonCode);
}
} else {
zowelog(NULL, LOG_COMP_HTTPSERVER, ZOWE_LOG_INFO, "Client certificate was attached to request, but credentials are also attached. Server won't attempt to map the client certificate.\n");
zowelog(NULL, LOG_COMP_HTTPSERVER, ZOWE_LOG_DEBUG, "Client certificate was attached to request, but credentials are also attached. Server won't attempt to map the client certificate.\n");
}
}

Expand Down Expand Up @@ -4637,8 +4637,9 @@ static int streamBinaryForFile2(HttpResponse *response, Socket *socket, UnixFile
if (encoding == ENCODING_CHUNKED) {
stream = makeChunkedOutputStreamInternal(response);
}

int bufferSize = FILE_STREAM_BUFFER_SIZE;

// To make bufferSize divisble by 3 for correct base64 encoding.
int bufferSize = FILE_STREAM_BUFFER_SIZE - (FILE_STREAM_BUFFER_SIZE % 3);
char *buffer = safeMalloc(bufferSize+4, "streamBinaryBuffer");
int encodedLength;

Expand Down Expand Up @@ -4710,7 +4711,8 @@ static int streamTextForFile2(HttpResponse *response, Socket *socket, UnixFile *
stream = makeChunkedOutputStreamInternal(response);
/* fallthrough */
case ENCODING_SIMPLE: {
int bufferSize = FILE_STREAM_BUFFER_SIZE;
// To make bufferSize divisble by 3 for correct base64 encoding.
int bufferSize = FILE_STREAM_BUFFER_SIZE - (FILE_STREAM_BUFFER_SIZE % 3);
char *buffer = safeMalloc(bufferSize+4, "streamTextBuffer");
char *translation = safeMalloc((2*bufferSize)+4, "streamTextConvertBuffer"); /* UTF inflation tolerance */
int encodedLength;
Expand Down
49 changes: 47 additions & 2 deletions c/jsonschema.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,27 @@ static JSValueSpec *resolveRef(JsonValidator *validator, ValidityException *pend
static VResult validateJSONSimple(JsonValidator *validator,
Json *value, JSValueSpec *valueSpec, int depth, EvalSet *evalSetList){
if (jsonIsNull(value)){
return validateType(validator,JSTYPE_NULL,valueSpec,depth+1);
VResult typeResult = validateType(validator,JSTYPE_NULL,valueSpec,depth+1);
if (vStatusValid(typeResult.status)) {
return typeResult;
} else if (validator->allowStringToBeNull) {
// FIXME: Some users were relying upon a bug we fixed, where an empty value would be treated as a string.
// TODO: Remove this in v3, we should not keep this bug compatability forever.
if (((1 << JSTYPE_STRING) & valueSpec->typeMask) != 0){
Json *emptyStringJson = (Json*)safeMalloc(sizeof(Json), "Empty String JSON");
emptyStringJson->type = JSON_TYPE_STRING;
char emptyString[1] = {0};
emptyStringJson->data.string = emptyString;
// Check if schema is okay with an "empty string" as the previous bug had null be empty string.
VResult stringResult = validateJSONString(validator,emptyStringJson,valueSpec,depth+1);
safeFree((char*)emptyStringJson, sizeof(Json));
return stringResult;
} else{
return simpleFailure(validator, "string cannot be null for %s\n", validatorAccessPath(validator));
}
} else {
return typeResult;
}
} else if (jsonIsBoolean(value)){
return validateType(validator,JSTYPE_BOOLEAN,valueSpec,depth+1);
} else if (jsonIsObject(value)){
Expand Down Expand Up @@ -1306,14 +1326,34 @@ static VResult validateJSON(JsonValidator *validator,
/* As we go through the valid enum values, record them in comma separated
* form for displaying at the tail end of the error message.
*/

bool nullToString = false;
Json *emptyStringJson;
if (jsonIsNull(value)) {
VResult typeResult = validateType(validator,JSTYPE_NULL,valueSpec,depth+1);
if ((!vStatusValid(typeResult.status)) && (validator->allowStringToBeNull)) {
// FIXME: Some users were relying upon a bug we fixed, where an empty value would be treated as a string.
// TODO: Remove this in v3, we should not keep this bug compatability forever.
if (((1 << JSTYPE_STRING) & valueSpec->typeMask) != 0){
emptyStringJson = (Json*)safeMalloc(sizeof(Json), "Empty String JSON");
emptyStringJson->type = JSON_TYPE_STRING;
char emptyString[1] = {0};
emptyStringJson->data.string = emptyString;
nullToString = true;
}
}
}

unsigned int validValuesMaxSize = (valueSpec->enumeratedValuesCount * (sizeof(Json*) + 3)) + 1;
char *validValues = SLHAlloc(validator->evalHeap, validValuesMaxSize);
if (validValues) {
memset(validValues, 0, validValuesMaxSize);
}

Json *whichValue = nullToString == true ? emptyStringJson : value;
for (int ee=0; ee<valueSpec->enumeratedValuesCount; ee++){
Json *enumValue = valueSpec->enumeratedValues[ee];
if (jsonEquals(value,enumValue)){
if (jsonEquals(whichValue,enumValue)){
matched = true;
break;
}
Expand All @@ -1337,6 +1377,9 @@ static VResult validateJSON(JsonValidator *validator,
strcat(validValues, ", ");
}
}
if (nullToString) {
safeFree((char*)emptyStringJson, sizeof(Json));
}
if (!matched){
if (validValues && strlen(validValues) > 0) {
return simpleFailure(validator,"no matching enum value at %s; expecting one of values '[%s]' of type '%s'",
Expand Down Expand Up @@ -1420,6 +1463,8 @@ static VResult validateJSON(JsonValidator *validator,
int jsonValidateSchema(JsonValidator *validator, Json *value, JsonSchema *topSchema,
JsonSchema **otherSchemas, int otherSchemaCount){
int result = 0;
validator->allowStringToBeNull = true;

if (setjmp(validator->recoveryData) == 0) { /* normal execution */
validator->topSchema = topSchema;
validator->otherSchemas = otherSchemas;
Expand Down
Loading

0 comments on commit fe74a15

Please sign in to comment.