inline bool isauth() {
  int rc;
  __asm (" TESTAUTH FCTN=1"
        : "=NR:r15"(rc)
        :
        : "r1", "r14", "r15");
  return rc == 0;
}

On 16/08/2022 2:17 am, Tony Harminc wrote:
Marginally related to my previous question - I'd like to do a TESTAUTH from
C/C++ code, and refuse to run if I'm not APF authorized. I'm not proposing
to actual use the result for any sort of my own security testing, but just
to know if calling a C/C++ library function that is documented to require
APF (or better) is likely to fail so I can tell the user early.

I don't see a C library function to do this. The TESTAUTH expansion is
tiny, and I could use __ASM(...), but it's perhaps neater to just test
JSCBAUTH directly in C code. Yes, I realize TESTAUTH is more than just
testing that one bit, but I think it's true that if that bit is off (and
I'm not in supervisor state or system key, which I won't be), then a
TESTAUTH would fail, and that's all I want to know.

Oddly enough, there *is* a library function that appears to test for the
Program Controlled state. Well, maybe not - it's __must_stay_clean() which
tests for the "must not lose Program Controlled" status, so not quite the
same.

What's the best approach?

Tony H.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to