Skip to content

Commit dc1cfdf

Browse files
Bug Fix and Formatting
Translate null characters to blanks when not preceded by ">" to prevent premature string termination. Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
1 parent c743a9a commit dc1cfdf

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

pyracf/common/irrsmo00.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ static PyObject* call_irrsmo00(PyObject* self, PyObject* args, PyObject *kwargs)
5555
rsp
5656
);
5757

58+
int i;
59+
for (i = 1; i < rsp_len; i++){
60+
if (rsp[i] == 0) {
61+
if (rsp[i-1] == '>') {
62+
break;
63+
}
64+
else {
65+
rsp[i] = ' ';
66+
}
67+
}
68+
}
5869
return Py_BuildValue("y", rsp);
5970
}
6071

pyracf/data_set/data_set_admin.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ def add(
110110
self._build_xml_segments(data_set_request)
111111
return self._make_request(data_set_request)
112112
try:
113-
profile = self.extract(data_set, volume=volume, generic=generic, profile_only=True)
113+
profile = self.extract(
114+
data_set, volume=volume, generic=generic, profile_only=True
115+
)
114116
if self._get_field(profile, "base", "name") == data_set.lower():
115117
raise AddOperationError(data_set, self._profile_type)
116118
except SecurityRequestError as exception:
@@ -135,7 +137,9 @@ def alter(
135137
self._build_xml_segments(data_set_request, alter=True)
136138
return self._make_request(data_set_request, irrsmo00_precheck=True)
137139
try:
138-
profile = self.extract(data_set, volume=volume, generic=generic, profile_only=True)
140+
profile = self.extract(
141+
data_set, volume=volume, generic=generic, profile_only=True
142+
)
139143
except SecurityRequestError:
140144
raise AlterOperationError(data_set, self._profile_type)
141145
if not self._get_field(profile, "base", "name") == data_set.lower():

pyracf/resource/resource_admin.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,10 @@ def alter_resource_class(
234234
def extract_resource_class(self, class_name: str) -> Union[dict, bytes]:
235235
"""Extract the attributes of a general resource class."""
236236
profile = self.extract(
237-
resource=class_name, class_name="CDT", segments=["cdtinfo"], profile_only=True
237+
resource=class_name,
238+
class_name="CDT",
239+
segments=["cdtinfo"],
240+
profile_only=True,
238241
)
239242
return profile["cdtinfo"]
240243

@@ -262,7 +265,10 @@ def alter_started_task(
262265
def extract_started_task(self, started_task_name: str) -> Union[dict, bytes]:
263266
"""Extract the attributes of a started task profile."""
264267
profile = self.extract(
265-
resource=started_task_name, class_name="STARTED", segments=["stdata"], profile_only=True
268+
resource=started_task_name,
269+
class_name="STARTED",
270+
segments=["stdata"],
271+
profile_only=True,
266272
)
267273
return profile["stdata"]
268274

@@ -295,7 +301,10 @@ def extract_custom_field(
295301
"""Extract the attributes of a custom field."""
296302
full_profile_name = f"{custom_field_type}.csdata.{custom_field_name}"
297303
profile = self.extract(
298-
resource=full_profile_name, class_name="CFIELD", segments=["cfdef"], profile_only=True
304+
resource=full_profile_name,
305+
class_name="CFIELD",
306+
segments=["cfdef"],
307+
profile_only=True,
299308
)
300309
return profile["cfdef"]
301310

@@ -326,7 +335,10 @@ def alter_kerberos_realm(
326335
def extract_kerberos_realm(self, kerberos_realm_name: str) -> Union[dict, bytes]:
327336
"""Extract the attributes of a kerberos realm profile."""
328337
profile = self.extract(
329-
resource=kerberos_realm_name, class_name="REALM", segments=["kerb"], profile_only=True
338+
resource=kerberos_realm_name,
339+
class_name="REALM",
340+
segments=["kerb"],
341+
profile_only=True,
330342
)
331343
return profile["kerb"]
332344

@@ -362,7 +374,10 @@ def alter_signed_program(
362374
def extract_signed_program(self, signed_program_name: str) -> Union[dict, bytes]:
363375
"""Extract the attributes of a signed program profile."""
364376
profile = self.extract(
365-
resource=signed_program_name, class_name="PROGRAM", segments=["sigver"], profile_only=True
377+
resource=signed_program_name,
378+
class_name="PROGRAM",
379+
segments=["sigver"],
380+
profile_only=True,
366381
)
367382
profile["sigver"]["library"] = profile["base"].get("member")
368383
return profile["sigver"]
@@ -396,7 +411,10 @@ def extract_appc_session(
396411
"""Extract the attributes of a APPC session profile."""
397412
full_profile_name = f"{net_id}.{local_lu}.{partner_lu}"
398413
profile = self.extract(
399-
resource=full_profile_name, class_name="APPCLU", segments=["session"], profile_only=True
414+
resource=full_profile_name,
415+
class_name="APPCLU",
416+
segments=["session"],
417+
profile_only=True,
400418
)
401419
return profile["session"]
402420

0 commit comments

Comments
 (0)