char *thishost; /* this machine */
char *thisdomain; /* this machine's domain */
char *hostname; /* remote machine */
+ char *cmd_hostname; /* remote machine as specified on command line */
char hostaddress[16]; /* remote address */
pid_t pid;
/* hostname & tty are either set to NULL or their correct values,
* depending on how much we know. */
- rc = pam_set_item(pamh, PAM_RHOST, cxt->hostname);
+ rc = pam_set_item(pamh, PAM_RHOST, cxt->cmd_hostname);
if (is_pam_failure(rc))
loginpam_err(pamh, rc);
get_thishost(cxt, &domain);
+ cxt->cmd_hostname = xstrdup(remotehost);
+
if (domain && (p = strchr(remotehost, '.')) &&
strcasecmp(p + 1, domain) == 0)
*p = '\0';