/*
  Check password for a userid.
  Note: requires program-controlled environment
  To build:
      c99 -o checkpass checkpass.c  i
      extattr +p checkpass
*/
#define _POSIX_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include <errno.h>
#include <env.h>

int main(int argc, char** argv) {

  if (argc != 3) {
    fprintf(stderr, "Syntax: checkpass <userid> <pass>\n");
    return 1;
  }
  setenv("_EDC_ADD_ERRNO2", "1", 1);
  if (__passwd(argv[1], argv[2], NULL)) {
    if (errno == EACCES) {
      fprintf(stderr, "password not authorized\n");
      return 2;
    } else {
      fprintf(stderr, "__passwd() - %s\n", strerror(errno));
      return 3;
    }
  }
  return 0;  /* no message - password valid */
}

On Fri, Jan 8, 2021 at 11:19 AM Sam Golob <[email protected]> wrote:

> Dear Folks,
>
>      Does anyone have user-written code for RACF, so that if the user
> types in a password, the code will verify if it is the user's actual
> LOGON password?
>
>      I'd like to see code that does this, for ACF2 and Top Secret as
> well, but I'm primarily interested in RACF.
>
>      Thank you very much.  All the best of everything to all of you.
>
> Sincerely,     Sam
>
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to