Skip to content

Commit

Permalink
Zowe Suite 1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored Feb 5, 2020
2 parents 37e3752 + 1088afb commit 127c351
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 84 deletions.
26 changes: 18 additions & 8 deletions c/securityService.c
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,13 @@ static void respondToProfileGET(ClassMgmtCommonParms *commonParms,

zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_DEBUG2, "%s begin\n", __FUNCTION__);

if (strlen(commonParms->className) > 0) {
respondWithError(response, HTTP_STATUS_FORBIDDEN, "forbidden");
zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_WARNING,
"non standard class provided for profiles GET, leaving...\n");
return;
}

if (strlen(commonParms->profileName) > 0) {
respondWithError(response, HTTP_STATUS_NOT_IMPLEMENTED,
"specific profile info retrieval not implemented");
Expand Down Expand Up @@ -1129,8 +1136,7 @@ static void respondToProfilePOST(ClassMgmtCommonParms *commonParms,
zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_DEBUG2, "%s begin\n", __FUNCTION__);

if (strlen(commonParms->className) > 0) {
respondWithError(response, HTTP_STATUS_FORBIDDEN,
"non standard class not allowed for mutation requests");
respondWithError(response, HTTP_STATUS_FORBIDDEN, "forbidden");
zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_WARNING,
"non standard class provided for profiles POST, leaving...\n");
return;
Expand Down Expand Up @@ -1201,8 +1207,7 @@ static void respondToProfileDELETE(ClassMgmtCommonParms *commonParms,
zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_DEBUG2, "%s begin\n", __FUNCTION__);

if (strlen(commonParms->className) > 0) {
respondWithError(response, HTTP_STATUS_FORBIDDEN,
"non standard class not allowed for mutation requests");
respondWithError(response, HTTP_STATUS_FORBIDDEN, "forbidden");
zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_WARNING,
"non standard class provided for profiles DELETE, leaving...\n");
return;
Expand Down Expand Up @@ -1281,8 +1286,7 @@ static void respondToProfileAccessListPUT(ClassMgmtCommonParms *commonParms,
zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_DEBUG2, "%s begin\n", __FUNCTION__);

if (strlen(commonParms->className) > 0) {
respondWithError(response, HTTP_STATUS_FORBIDDEN,
"non standard class not allowed for mutation requests");
respondWithError(response, HTTP_STATUS_FORBIDDEN, "forbidden");
zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_WARNING,
"non standard class provided for user POST/PUT, leaving...\n");
return;
Expand Down Expand Up @@ -1391,6 +1395,13 @@ static void respondToProfileAccessListGET(ClassMgmtCommonParms *commonParms,

zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_DEBUG2, "%s begin\n", __FUNCTION__);

if (strlen(commonParms->className) > 0) {
respondWithError(response, HTTP_STATUS_FORBIDDEN, "forbidden");
zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_WARNING,
"non standard class provided for access list GET, leaving...\n");
return;
}

if (strlen(commonParms->accessListEntryID) > 0) {
respondWithError(response, HTTP_STATUS_NOT_IMPLEMENTED,
"specific user access status retrieval not implemented");
Expand Down Expand Up @@ -1492,8 +1503,7 @@ static void respondToProfileAccessListDELETE(ClassMgmtCommonParms *commonParms,
zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_DEBUG2, "%s begin\n", __FUNCTION__);

if (strlen(commonParms->className) > 0) {
respondWithError(response, HTTP_STATUS_FORBIDDEN,
"non standard class not allowed for mutation requests");
respondWithError(response, HTTP_STATUS_FORBIDDEN, "forbidden");
zowelog(NULL, LOG_COMP_ID_SECURITY, ZOWE_LOG_WARNING,
"non standard class provided for access list DELETE, leaving...\n");
return;
Expand Down
66 changes: 26 additions & 40 deletions c/zis/services/secmgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,31 +294,24 @@ int zisGenresProfilesServiceFunctionRACF(CrossMemoryServerGlobalArea *globalArea
};

RadminStatus radminStatus;
char classNullTerm[ZIS_SECURITY_CLASS_MAX_LENGTH + 1] = {0};
memcpy(classNullTerm, localParmList.class.value,
localParmList.class.length);
char profileNameBuffer[ZIS_SECURITY_PROFILE_MAX_LENGTH + 1] = {0};
memcpy(profileNameBuffer, localParmList.startProfile.value,
localParmList.startProfile.length);
const char *startProfileNullTerm = localParmList.startProfile.length > 0 ?
profileNameBuffer : NULL;

if (localParmList.class.length == 0) {
CrossMemoryServerConfigParm userClassParm = {0};
int getParmRC = cmsGetConfigParm(&globalArea->serverName,
ZIS_PARMLIB_PARM_SECMGMT_USER_CLASS,
&userClassParm);
if (getParmRC != RC_CMS_OK) {
localParmList.internalServiceRC = getParmRC;
status = RC_ZIS_GRPRFSRV_USER_CLASS_NOT_READ;
break;
}
if (userClassParm.valueLength > ZIS_SECURITY_CLASS_MAX_LENGTH) {
status = RC_ZIS_GRPRFSRV_CLASS_TOO_LONG;
break;
}
memcpy(classNullTerm, userClassParm.charValueNullTerm,
userClassParm.valueLength);
CrossMemoryServerConfigParm userClassParm = {0};
int getParmRC = cmsGetConfigParm(&globalArea->serverName,
ZIS_PARMLIB_PARM_SECMGMT_USER_CLASS,
&userClassParm);
if (getParmRC != RC_CMS_OK) {
localParmList.internalServiceRC = getParmRC;
status = RC_ZIS_GRPRFSRV_USER_CLASS_NOT_READ;
break;
}
if (userClassParm.valueLength > ZIS_SECURITY_CLASS_MAX_LENGTH) {
status = RC_ZIS_GRPRFSRV_CLASS_TOO_LONG;
break;
}

size_t tmpResultBufferSize =
Expand Down Expand Up @@ -346,7 +339,7 @@ int zisGenresProfilesServiceFunctionRACF(CrossMemoryServerGlobalArea *globalArea

radminExtractRC = radminExtractBasicGenresProfileInfo(
authInfo,
classNullTerm,
userClassParm.charValueNullTerm,
startProfileNullTerm,
localParmList.profilesToExtract,
tmpResultBuffer,
Expand Down Expand Up @@ -492,29 +485,22 @@ int zisGenresAccessListServiceFunctionRACF(CrossMemoryServerGlobalArea *globalAr
size_t entriesExtracted = 0;

RadminStatus radminStatus;
char classNullTerm[ZIS_SECURITY_CLASS_MAX_LENGTH + 1] = {0};
memcpy(classNullTerm, localParmList.class.value,
localParmList.class.length);
char profileNullTerm[ZIS_SECURITY_PROFILE_MAX_LENGTH + 1] = {0};
memcpy(profileNullTerm, localParmList.profile.value,
localParmList.profile.length);

if (localParmList.class.length == 0) {
CrossMemoryServerConfigParm userClassParm = {0};
int getParmRC = cmsGetConfigParm(&globalArea->serverName,
ZIS_PARMLIB_PARM_SECMGMT_USER_CLASS,
&userClassParm);
if (getParmRC != RC_CMS_OK) {
localParmList.internalServiceRC = getParmRC;
status = RC_ZIS_ACSLSRV_USER_CLASS_NOT_READ;
break;
}
if (userClassParm.valueLength > ZIS_SECURITY_CLASS_MAX_LENGTH) {
status = RC_ZIS_ACSLSRV_CLASS_TOO_LONG;
break;
}
memcpy(classNullTerm, userClassParm.charValueNullTerm,
userClassParm.valueLength);
CrossMemoryServerConfigParm userClassParm = {0};
int getParmRC = cmsGetConfigParm(&globalArea->serverName,
ZIS_PARMLIB_PARM_SECMGMT_USER_CLASS,
&userClassParm);
if (getParmRC != RC_CMS_OK) {
localParmList.internalServiceRC = getParmRC;
status = RC_ZIS_ACSLSRV_USER_CLASS_NOT_READ;
break;
}
if (userClassParm.valueLength > ZIS_SECURITY_CLASS_MAX_LENGTH) {
status = RC_ZIS_ACSLSRV_CLASS_TOO_LONG;
break;
}

size_t tmpResultBufferSize =
Expand All @@ -538,7 +524,7 @@ int zisGenresAccessListServiceFunctionRACF(CrossMemoryServerGlobalArea *globalAr

int radminExtractRC = radminExtractGenresAccessList(
authInfo,
classNullTerm,
userClassParm.charValueNullTerm,
profileNullTerm,
tmpResultBuffer,
localParmList.resultBufferCapacity,
Expand Down
58 changes: 24 additions & 34 deletions c/zis/services/secmgmttss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1429,28 +1429,23 @@ int zisGenresAccessListServiceFunctionTSS(CrossMemoryServerGlobalArea *globalAre
.userID = caller
};

char classNullTerm[ZIS_SECURITY_CLASS_MAX_LENGTH + 1] = {0};
memcpy(classNullTerm, localParmList.class.value,
localParmList.class.length);
char *classNullTerm = NULL;
char profileNullTerm[ZIS_SECURITY_PROFILE_MAX_LENGTH + 1] = {0};
memcpy(profileNullTerm, localParmList.profile.value,
localParmList.profile.length);

if (localParmList.class.length == 0) {
CrossMemoryServerConfigParm userClassParm = {0};
int getParmRC = cmsGetConfigParm(&globalArea->serverName,
ZIS_PARMLIB_PARM_SECMGMT_USER_CLASS,
&userClassParm);
if (getParmRC != RC_CMS_OK) {
localParmList.internalServiceRC = getParmRC;
return RC_ZIS_ACSLSRV_USER_CLASS_NOT_READ;
}
if (userClassParm.valueLength > ZIS_SECURITY_CLASS_MAX_LENGTH) {
return RC_ZIS_ACSLSRV_CLASS_TOO_LONG;
}
memcpy(classNullTerm, userClassParm.charValueNullTerm,
userClassParm.valueLength);
CrossMemoryServerConfigParm userClassParm = {0};
int getParmRC = cmsGetConfigParm(&globalArea->serverName,
ZIS_PARMLIB_PARM_SECMGMT_USER_CLASS,
&userClassParm);
if (getParmRC != RC_CMS_OK) {
localParmList.internalServiceRC = getParmRC;
return RC_ZIS_ACSLSRV_USER_CLASS_NOT_READ;
}
if (userClassParm.valueLength > ZIS_SECURITY_CLASS_MAX_LENGTH) {
return RC_ZIS_ACSLSRV_CLASS_TOO_LONG;
}
classNullTerm = userClassParm.charValueNullTerm;

size_t tmpResultBufferSize =
sizeof(ZISGenresAccessEntry) * localParmList.resultBufferCapacity;
Expand Down Expand Up @@ -3106,30 +3101,25 @@ int zisGenresProfilesServiceFunctionTSS(CrossMemoryServerGlobalArea *globalArea,
.userID = caller
};

char classNullTerm[ZIS_SECURITY_CLASS_MAX_LENGTH + 1] = {0};
memcpy(classNullTerm, localParmList.class.value,
localParmList.class.length);
char *classNullTerm = NULL;
char profileNameBuffer[ZIS_SECURITY_PROFILE_MAX_LENGTH + 1] = {0};
memcpy(profileNameBuffer, localParmList.startProfile.value,
localParmList.startProfile.length);
const char *startProfileNullTerm = localParmList.startProfile.length > 0 ?
profileNameBuffer : NULL;

if (localParmList.class.length == 0) {
CrossMemoryServerConfigParm userClassParm = {0};
int getParmRC = cmsGetConfigParm(&globalArea->serverName,
ZIS_PARMLIB_PARM_SECMGMT_USER_CLASS,
&userClassParm);
if (getParmRC != RC_CMS_OK) {
localParmList.internalServiceRC = getParmRC;
return RC_ZIS_GRPRFSRV_USER_CLASS_NOT_READ;
}
if (userClassParm.valueLength > ZIS_SECURITY_CLASS_MAX_LENGTH) {
return RC_ZIS_GRPRFSRV_CLASS_TOO_LONG;
}
memcpy(classNullTerm, userClassParm.charValueNullTerm,
userClassParm.valueLength);
CrossMemoryServerConfigParm userClassParm = {0};
int getParmRC = cmsGetConfigParm(&globalArea->serverName,
ZIS_PARMLIB_PARM_SECMGMT_USER_CLASS,
&userClassParm);
if (getParmRC != RC_CMS_OK) {
localParmList.internalServiceRC = getParmRC;
return RC_ZIS_GRPRFSRV_USER_CLASS_NOT_READ;
}
if (userClassParm.valueLength > ZIS_SECURITY_CLASS_MAX_LENGTH) {
return RC_ZIS_GRPRFSRV_CLASS_TOO_LONG;
}
classNullTerm = userClassParm.charValueNullTerm;

size_t tmpResultBufferSize =
sizeof(ZISGenresProfileEntry) * localParmList.profilesToExtract;
Expand Down
2 changes: 1 addition & 1 deletion deps/zowe-common-c
Submodule zowe-common-c updated 2 files
+1 −2 c/radmin.c
+1 −1 c/zosfile.c
2 changes: 1 addition & 1 deletion samplib/zis/ZWESIP00
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
//* THE PARMLIB CLASS VALUE IS USED. */
//* SECMGMT - SECURITY SERVICES PARAMETERS NAMESPACE. */
//* CLASS - */
//* SAF CLASS USED BY THE PROFILE MANAGEMENT SERVICES. */
//* SAF CLASS USED BY THE SECURITY MANAGEMENT SERVICES. */
//* ANY PROFILE OPERATIONS WILL BE PERFORMED WITHIN */
//* THIS CLASS ONLY. IF OMITTED, THE PROFILE SERVICES */
//* WILL RETURN THE CORRESPONDING ERROR CODE. */
Expand Down

0 comments on commit 127c351

Please sign in to comment.