View | Details | Raw Unified | Return to bug 3508 | Differences between
and this patch

Collapse All | Expand All

(-)a/auth-pam.c (-5 / +10 lines)
Lines 252-258 static Authctxt *sshpam_authctxt = NULL; Link Here
252
static const char *sshpam_password = NULL;
252
static const char *sshpam_password = NULL;
253
static char *sshpam_rhost = NULL;
253
static char *sshpam_rhost = NULL;
254
static char *sshpam_laddr = NULL;
254
static char *sshpam_laddr = NULL;
255
static char *sshpam_conninfo = NULL;
256
255
257
/* Some PAM implementations don't implement this */
256
/* Some PAM implementations don't implement this */
258
#ifndef HAVE_PAM_GETENVLIST
257
#ifndef HAVE_PAM_GETENVLIST
Lines 688-693 sshpam_init(struct ssh *ssh, Authctxt *authctxt) Link Here
688
{
687
{
689
	const char *pam_user, *user = authctxt->user;
688
	const char *pam_user, *user = authctxt->user;
690
	const char **ptr_pam_user = &pam_user;
689
	const char **ptr_pam_user = &pam_user;
690
	char *conninfo = NULL;
691
	int r;
691
692
692
#if defined(PAM_SUN_CODEBASE) && defined(PAM_MAX_RESP_SIZE)
693
#if defined(PAM_SUN_CODEBASE) && defined(PAM_MAX_RESP_SIZE)
693
	/* Protect buggy PAM implementations from excessively long usernames */
694
	/* Protect buggy PAM implementations from excessively long usernames */
Lines 729-737 sshpam_init(struct ssh *ssh, Authctxt *authctxt) Link Here
729
		    options.use_dns));
730
		    options.use_dns));
730
		sshpam_laddr = get_local_ipaddr(
731
		sshpam_laddr = get_local_ipaddr(
731
		    ssh_packet_get_connection_in(ssh));
732
		    ssh_packet_get_connection_in(ssh));
732
		xasprintf(&sshpam_conninfo, "SSH_CONNECTION=%.50s %d %.50s %d",
733
		    ssh_remote_ipaddr(ssh), ssh_remote_port(ssh),
734
		    sshpam_laddr, ssh_local_port(ssh));
735
	}
733
	}
736
	if (sshpam_rhost != NULL) {
734
	if (sshpam_rhost != NULL) {
737
		debug("PAM: setting PAM_RHOST to \"%s\"", sshpam_rhost);
735
		debug("PAM: setting PAM_RHOST to \"%s\"", sshpam_rhost);
Lines 742-749 sshpam_init(struct ssh *ssh, Authctxt *authctxt) Link Here
742
			sshpam_handle = NULL;
740
			sshpam_handle = NULL;
743
			return (-1);
741
			return (-1);
744
		}
742
		}
743
	}
744
	if (ssh != NULL && sshpam_laddr != NULL) {
745
		/* Put SSH_CONNECTION in the PAM environment too */
745
		/* Put SSH_CONNECTION in the PAM environment too */
746
		pam_putenv(sshpam_handle, sshpam_conninfo);
746
		xasprintf(&conninfo, "SSH_CONNECTION=%.50s %d %.50s %d",
747
		    ssh_remote_ipaddr(ssh), ssh_remote_port(ssh),
748
		    sshpam_laddr, ssh_local_port(ssh));
749
		if ((r = pam_putenv(sshpam_handle, conninfo)) != PAM_SUCCESS)
750
			logit("pam_putenv: %s", pam_strerror(sshpam_handle, r));
751
		free(conninfo);
747
	}
752
	}
748
753
749
#ifdef PAM_TTY_KLUDGE
754
#ifdef PAM_TTY_KLUDGE

Return to bug 3508