Skip to content

Commit

Permalink
Zowe Suite v1.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored Nov 30, 2021
2 parents 3c4ad77 + 9e902e3 commit 2c1981e
Show file tree
Hide file tree
Showing 16 changed files with 525 additions and 98 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
build/tmp*/
build/build.log
bin/zssServer
bin/zssServer64

# workspace content should be updated by program
.pax/*
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to the ZSS package will be documented in this file.

## Recent Changes

## `1.26.0`

- Enhancement: Add support for continuations in the ZIS PARMLIB member

## `1.25.0`

- Enhancement: Add an endpoint for PassTicket generation
Expand Down
135 changes: 135 additions & 0 deletions build/build_zss64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/sh
set -e

################################################################################
# This program and the accompanying materials are
# made available under the terms of the Eclipse Public License v2.0 which accompanies
# this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
#
# SPDX-License-Identifier: EPL-2.0
#
# Copyright Contributors to the Zowe Project.
################################################################################


export _C89_LSYSLIB="CEE.SCEELKED:SYS1.CSSLIB:CSF.SCSFMOD0"
export _C89_L6SYSLIB="CEE.SCEEBND2:SYS1.CSSLIB:CSF.SCSFMOD0"

WORKING_DIR=$(dirname "$0")
ZSS="../.."
COMMON="../../deps/zowe-common-c"
GSKDIR=/usr/lpp/gskssl
GSKINC="${GSKDIR}/include"
GSKLIB="${GSKDIR}/lib/GSKSSL64.x"

echo "********************************************************************************"
echo "Building ZSS..."

mkdir -p "${WORKING_DIR}/tmp-zss" && cd "$_"

IFS='.' read -r major minor micro < "${ZSS}/version.txt"
date_stamp=$(date +%Y%m%d)
echo "Version: $major.$minor.$micro"
echo "Date stamp: $date_stamp"

export _C89_ACCEPTABLE_RC=0

if ! c89 \
-DPRODUCT_MAJOR_VERSION="$major" \
-DPRODUCT_MINOR_VERSION="$minor" \
-DPRODUCT_REVISION="$micro" \
-DPRODUCT_VERSION_DATE_STAMP="$date_stamp" \
-D_XOPEN_SOURCE=600 \
-DNOIBMHTTP=1 \
-D_OPEN_THREADS=1 \
-DHTTPSERVER_BPX_IMPERSONATION=1 \
-DAPF_AUTHORIZED=0 \
-DUSE_ZOWE_TLS=1 \
-Wc,lp64,dll,expo,langlvl\(extc99\),gonum,goff,hgpr,roconst,ASM,asmlib\('CEE.SCEEMAC','SYS1.MACLIB','SYS1.MODGEN'\) \
-Wc,agg,exp,list,so\(\),off,xref \
-Wl,lp64,ac=1 \
-I ${COMMON}/h \
-I ${COMMON}/jwt/jwt \
-I ${COMMON}/jwt/rscrypto \
-I ${ZSS}/h \
-I ${GSKINC} \
-o ${ZSS}/bin/zssServer64 \
${COMMON}/c/alloc.c \
${COMMON}/c/bpxskt.c \
${COMMON}/c/charsets.c \
${COMMON}/c/cmutils.c \
${COMMON}/c/collections.c \
${COMMON}/c/crossmemory.c \
${COMMON}/c/crypto.c \
${COMMON}/c/dataservice.c \
${COMMON}/c/datasetjson.c \
${COMMON}/c/discovery.c \
${COMMON}/c/dynalloc.c \
${COMMON}/c/fdpoll.c \
${COMMON}/c/http.c \
${COMMON}/c/httpclient.c \
${COMMON}/c/httpserver.c \
${COMMON}/c/httpfileservice.c \
${COMMON}/c/icsf.c \
${COMMON}/c/idcams.c \
${COMMON}/c/impersonation.c \
${COMMON}/c/jcsi.c \
${COMMON}/c/json.c \
${COMMON}/jwt/jwt/jwt.c \
${COMMON}/c/le.c \
${COMMON}/c/logging.c \
${COMMON}/c/nametoken.c \
${COMMON}/c/zos.c \
${COMMON}/c/pause-element.c \
${COMMON}/c/pdsutil.c \
${COMMON}/c/qsam.c \
${COMMON}/c/radmin.c \
${COMMON}/c/rawfd.c \
${COMMON}/c/recovery.c \
${COMMON}/jwt/rscrypto/rs_icsfp11.c \
${COMMON}/jwt/rscrypto/rs_rsclibc.c \
${COMMON}/c/scheduling.c \
${COMMON}/c/signalcontrol.c \
${COMMON}/c/socketmgmt.c \
${COMMON}/c/stcbase.c \
${COMMON}/c/storage.c \
${COMMON}/c/storage_mem.c \
${COMMON}/c/timeutls.c \
${COMMON}/c/tls.c \
${COMMON}/c/utils.c \
${COMMON}/c/vsam.c \
${COMMON}/c/xlate.c \
${COMMON}/c/xml.c \
${COMMON}/c/zosaccounts.c \
${COMMON}/c/zosfile.c \
${COMMON}/c/zvt.c \
${COMMON}/c/shrmem64.c \
${ZSS}/c/zssLogging.c \
${ZSS}/c/zss.c \
${ZSS}/c/storageApiml.c \
${ZSS}/c/serviceUtils.c \
${ZSS}/c/authService.c \
${ZSS}/c/omvsService.c \
${ZSS}/c/certificateService.c \
${ZSS}/c/unixFileService.c \
${ZSS}/c/datasetService.c \
${ZSS}/c/envService.c \
${ZSS}/c/zosDiscovery.c \
${ZSS}/c/securityService.c \
${ZSS}/c/registerProduct.c \
${ZSS}/c/zis/client.c \
${ZSS}/c/serverStatusService.c \
${ZSS}/c/rasService.c \
${ZSS}/c/userInfoService.c \
${ZSS}/c/passTicketService.c \
${GSKLIB} ;
then
extattr +p ${ZSS}/bin/zssServer64
echo "Build successful"
exit 0
else
# remove zssServer in case the linker had RC=4 and produced the binary
rm -f ${ZSS}/bin/zssServer64
echo "Build failed"
exit 8
fi
8 changes: 7 additions & 1 deletion c/certificateService.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ static int serveMappingService(HttpService *service, HttpResponse *response)
userMapCertificateStructure.functionCode = MAP_CERTIFICATE_TO_USERNAME;
int rc;

#ifdef _LP64
rc = 12; /* This needs work to support 64-bit mode.
We will need to get a pointer to this routine w/o using linker
and SAM31 / SAM64 wrap this call. */
#else
rc = IRRSIM00(
&userMapCertificateStructure.workarea, // WORKAREA
&userMapCertificateStructure.safRcAlet , // ALET
Expand All @@ -163,6 +168,7 @@ static int serveMappingService(HttpService *service, HttpResponse *response)
&userMapCertificateStructure.distinguishedNameLength,
&userMapCertificateStructure.registryNameLength
);
#endif

jsonPrinter *p = respondWithJsonPrinter(response);

Expand Down Expand Up @@ -212,4 +218,4 @@ void installCertificateService(HttpServer *server)
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
*/
*/
90 changes: 89 additions & 1 deletion c/envService.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "alloc.h"
#include "json.h"

#define RC_CHECK_VALID_HEX_FAILED (char)-1

extern char **environ;

static bool isNumber(const char s[])
Expand Down Expand Up @@ -73,6 +75,88 @@ static JsonObject *returnJsonObj(ShortLivedHeap *slh, char buf[]) {
return envSettingsJsonObject;
}

static char checkValidHex(char h)
{
if (h >= '0' && h <= '9') {
return h - '0';
} else if (h >= 'a' && h <= 'f') {
return h - 'a' + 10;
} else if (h >= 'A' && h <= 'F') {
return h - 'A' + 10;
} else {
return RC_CHECK_VALID_HEX_FAILED;
}
}

static char convertHexToChar(char h1, char h2)
{
char decodedChar = 0;
char hexCheck1 = checkValidHex(h1);
char hexCheck2 = checkValidHex(h2);
if (hexCheck1!=RC_CHECK_VALID_HEX_FAILED && hexCheck2!=RC_CHECK_VALID_HEX_FAILED) {
decodedChar = (hexCheck1 << 4) | hexCheck2;
a2e(&decodedChar,1);
}
return decodedChar;
}

#define MAX_ENCODED_UNDER_SCORE_COUNT 4
static void decodeEnvKey(const char *encodedKey, const size_t keyLen, char *decodedKey)
{
int count = 0, j = 0, skipPrint = 0;
char decodedChar = 0;

for (int i=0; encodedKey[i]; i++) {
if (encodedKey[i] == '_') {
if (i+3 < keyLen && encodedKey[i+1] == 'x') {
decodedChar = convertHexToChar(encodedKey[i+2],encodedKey[i+3]);
if(decodedChar) {
i = i+3;
}
}

if(!decodedChar && count < MAX_ENCODED_UNDER_SCORE_COUNT) {
count++;
if(i+1 < keyLen) {
continue;
} else {
skipPrint = 1; //last char in key, print count tracked char and skip last char as it is already added to count
}
}
}

if(count > 0) {
switch (count) {
case 1:
case 2:
decodedKey[j++] = '_';
break;
case 3:
decodedKey[j++] = '-';
break;
case 4:
decodedKey[j++] = '.';
break;
}
}

if(decodedChar == 0) {
if (!skipPrint) {
if (encodedKey[i] == '_' && count == MAX_ENCODED_UNDER_SCORE_COUNT) {
i--;
} else {
decodedKey[j++] = encodedKey[i];
}
}
} else {
decodedKey[j++] = decodedChar;
}

count=0; decodedChar=0; skipPrint=0;
}
decodedKey[j] = '\0';
}

static JsonObject *envVarsToObject(const char *prefix) {
int i=0;
int j=0;
Expand All @@ -94,7 +178,11 @@ static JsonObject *envVarsToObject(const char *prefix) {
char* buffer = splitEnvKeyValue(environ[i], array);
if(array[1]!=NULL) {
j++;
foo = returnJSONRow(array[0], array[1]);
size_t envKeyLen = strlen(array[0]);
char envKey[envKeyLen+1];
memset(envKey, '\0', envKeyLen+1);
decodeEnvKey(array[0], envKeyLen, envKey);
foo = returnJSONRow(envKey, array[1]);
if(foo!=NULL) {
if(j>1) {
pos += snprintf(envJsonStr + pos, sizeof(envJsonStr) - pos, ", ");
Expand Down
22 changes: 11 additions & 11 deletions c/omvsService.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ static int serveOMVSSegment(HttpService *service, HttpResponse *response)
char command[COMMAND_BUFFER_SIZE + 1];
sprintf(command, "LISTUSER (%s) OMVS", request->username);

OMVSSegment omvs;
OMVSSegment *__ptr32 omvs = (OMVSSegment*__ptr32)safeMalloc31(sizeof(OMVSSegment),"OMVSSegment31");
/* If the request method is GET */
if(!strcmp(request->method, methodGET))
{
/* Issue the RACF command that
* gets the OMVS segment.
*/
int status = issueRACFCommand(command, &omvs);
int status = issueRACFCommand(command, omvs);
if (status != 0)
{
setResponseStatus(response, 500, "Internal Server Error");
Expand All @@ -114,15 +114,15 @@ static int serveOMVSSegment(HttpService *service, HttpResponse *response)
writeHeader(response);

jsonStart(p);
jsonAddString(p, "uid", omvs.uid);
jsonAddString(p, "home", omvs.home);
jsonAddString(p, "program", omvs.program);
jsonAddString(p, "cpuTimeMax", omvs.cpuTimeMax);
jsonAddString(p, "assizeMax", omvs.assizeMax);
jsonAddString(p, "fileProcMax", omvs.fileProcMax);
jsonAddString(p, "procUserMax", omvs.procUserMax);
jsonAddString(p, "threadsMax", omvs.threadsMax);
jsonAddString(p, "mMapAreaMax", omvs.mMapAreaMax);
jsonAddString(p, "uid", omvs->uid);
jsonAddString(p, "home", omvs->home);
jsonAddString(p, "program", omvs->program);
jsonAddString(p, "cpuTimeMax", omvs->cpuTimeMax);
jsonAddString(p, "assizeMax", omvs->assizeMax);
jsonAddString(p, "fileProcMax", omvs->fileProcMax);
jsonAddString(p, "procUserMax", omvs->procUserMax);
jsonAddString(p, "threadsMax", omvs->threadsMax);
jsonAddString(p, "mMapAreaMax", omvs->mMapAreaMax);
jsonEnd(p);
}
}
Expand Down
5 changes: 4 additions & 1 deletion c/zis/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,10 @@ static int zisCallServiceInternal(const CrossMemoryServerName *serverName,
return RC_ZIS_SRVC_CMS_FAILED;
}

if (routerRC != RC_ZIS_SRVC_OK) {
if (routerRC == RC_ZIS_SRVC_SPECIFIC_AUTH_FAILED){
status->serviceRC = routerRC;
return RC_ZIS_SRVC_SPECIFIC_AUTH_FAILED;
} else if (routerRC != RC_ZIS_SRVC_OK) {
status->serviceRC = routerRC;
return RC_ZIS_SRVC_SERVICE_FAILED;
}
Expand Down
Loading

0 comments on commit 2c1981e

Please sign in to comment.