Performs an administrative reset of a user's password. The new password is marked as being expired unless it is non-expiring.
#include <ascauth.h>
int ASC_ADMINRSTPASSWD(ASCENV *asce, char *adminUser, char *adminPassword, char *user, char *newpass);
Returns one of the following integer values defined in ascauth.h:
#include <stdio.h> #include <stdlib.h> #include <ascauth.h> main(int argc, char *argv[]) { ASCENV *asce; ASCUSER ascu; char *adminUser, *adminPass, *user, *newpass; int rc; if (argc != 5) { fprintf(stderr, "usage: %s <adminUser> <adminPass> <user> <newpass>\n", argv[0]); exit(EXIT_FAILURE); } adminUser = argv[1]; adminPass = argv[2]; user = argv[3]; newpass = argv[4]; /* initialize the authentication environment */ asce = ASC_INIT(NULL); if (asce == NULL) { fprintf(stderr, "Error: cannot initialize authentication environment\n"); exit(EXIT_FAILURE); } /* change the user's password */ rc = ASC_ADMINRSTPASSWD(asce, adminUser, adminPass, user, newpass); if (rc == AS_OK) printf("password has been changed\n"); else if (rc == AS_NO) printf("password has not been changed\n"); else printf("RC=%d, %s", rc, ASC_STRERROR(rc));
/* now terminate the authentication environment */ ASC_TERM(asce); return 0; }