--- ./plugins/sudoers/auth/aix_auth.c.orig	2023-01-30 05:22:03.511843910 +0000
+++ ./plugins/sudoers/auth/aix_auth.c	2023-01-30 05:20:03.380330151 +0000
@@ -231,13 +231,35 @@
 int
 sudo_aix_verify(struct passwd *pw, const char *prompt, sudo_auth *auth, struct sudo_conv_callback *callback)
 {
-    char *pass, *message = NULL;
-    int result = 1, reenter = 0;
+    char *pass, *message = NULL, *restrict_msg = NULL;
+    int result = 1, reenter = 0, restrict_result = -1, pwdexp_msg = 0;
     int ret = AUTH_SUCCESS;
+    void *login_state = NULL;
+
     debug_decl(sudo_aix_verify, SUDOERS_DEBUG_AUTH);
 
+    /* Use newer APIs */
+    restrict_result = loginrestrictionsx(pw->pw_name, 0, NULL,&restrict_msg, &login_state);
+    if (restrict_result != 0)
+    {
+       if (restrict_msg != NULL && restrict_msg[0] != '\0')
+       {
+         struct sudo_conv_message msg;
+         struct sudo_conv_reply repl;
+         
+         memset(&msg, 0, sizeof(msg));
+         msg.msg_type = SUDO_CONV_ERROR_MSG;
+         msg.msg = restrict_msg;
+         memset(&repl, 0, sizeof(repl));
+         sudo_conv(1, &msg, &repl, NULL);
+         free(restrict_msg);
+         restrict_msg = NULL;
+	}
+        sudo_warn("loginrestrictionsx");
+        debug_return_int(AUTH_FATAL);
+    }
     if (IS_NONINTERACTIVE(auth))
-        debug_return_int(AUTH_NONINTERACTIVE);
+        debug_return_int(AUTH_NONINTERACTIVE); 
 
     do {
 	pass = auth_getpass(prompt, SUDO_CONV_PROMPT_ECHO_OFF, callback);
@@ -245,9 +267,11 @@
 	    break;
 	free(message);
 	message = NULL;
-	result = authenticate(pw->pw_name, pass, &reenter, &message);
+        result = authenticatex(pw->pw_name, pass, &reenter, &message, &login_state);
 	freezero(pass, strlen(pass));
 	prompt = message;
+          if (!reenter && !result && message)
+              sudo_printf(SUDO_CONV_ERROR_MSG, "%s ", message);
     } while (reenter);
 
     if (result != 0) {
