login: set PAM RHOST

Signed-off-by: Ryan Phillips <ryan@trolocsis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/loginutils/login.c b/loginutils/login.c
index 5eeb082..ce0d174 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -278,6 +278,14 @@
 			failed_msg = "set_item(TTY)";
 			goto pam_auth_failed;
 		}
+		/* set RHOST */
+		if (opt_host) {
+			pamret = pam_set_item(pamh, PAM_RHOST, opt_host);
+			if (pamret != PAM_SUCCESS) {
+				failed_msg = "set_item(RHOST)";
+				goto pam_auth_failed;
+			}
+		}
 		pamret = pam_authenticate(pamh, 0);
 		if (pamret != PAM_SUCCESS) {
 			failed_msg = "authenticate";