1 --- hpn-ssh-hpn-18.4.2/auth-pam.c.orig
2 +++ hpn-ssh-hpn-18.4.2/auth-pam.c
4 return (sshpam_account_status);
9 +do_pam_set_auser(const char* auser)
11 + if (auser != NULL) {
12 + debug("PAM: setting PAM_AUSER to \"%s\"", auser);
13 + sshpam_err = pam_set_item(sshpam_handle, PAM_AUSER, auser);
14 + if (sshpam_err != PAM_SUCCESS)
15 + error("PAM: failed to set PAM_AUSER: %s",
16 + pam_strerror(sshpam_handle, sshpam_err));
22 do_pam_setcred(int init)
24 --- hpn-ssh-hpn-18.4.2/auth-pam.h.orig
25 +++ hpn-ssh-hpn-18.4.2/auth-pam.h
27 void sshpam_set_maxtries_reached(int);
28 int is_pam_session_open(void);
30 +#ifdef HAVE_PAM_AUSER
31 +void do_pam_set_auser(const char *);
33 +void do_pam_set_tty(const char *);
36 --- hpn-ssh-hpn-18.4.2/auth.h.orig
37 +++ hpn-ssh-hpn-18.4.2/auth.h
39 #ifdef PAM_ENHANCEMENT
40 char *authmethod_name;
42 +#ifdef HAVE_PAM_AUSER
48 --- hpn-ssh-hpn-18.4.2/auth2-hostbased.c.orig
49 +++ hpn-ssh-hpn-18.4.2/auth2-hostbased.c
52 sshbuf_dump_data(sig, slen, stderr);
54 +#ifdef HAVE_PAM_AUSER
55 + authctxt->auser = NULL;
57 pktype = sshkey_type_from_name(pkalg);
58 if (pktype == KEY_UNSPEC) {
59 /* this is perfectly legal */
61 sshbuf_ptr(b), sshbuf_len(b), pkalg, ssh->compat, NULL)) == 0)
64 +#ifdef HAVE_PAM_AUSER
65 + if (authenticated) {
66 + authctxt->auser = cuser;
71 auth2_record_key(authctxt, authenticated, key);
74 --- hpn-ssh-hpn-18.4.2/auth2.c.orig
75 +++ hpn-ssh-hpn-18.4.2/auth2.c
80 +#ifdef HAVE_PAM_AUSER
82 + do_pam_set_auser(authctxt->auser);
83 + free(authctxt->auser);
84 + authctxt->auser = NULL;
88 if (authenticated && options.num_auth_methods != 0) {
90 #if defined(USE_PAM) && defined(PAM_ENHANCEMENT)
91 --- hpn-ssh-hpn-18.4.2/monitor.c.orig
92 +++ hpn-ssh-hpn-18.4.2/monitor.c
97 +#if defined(HAVE_PAM_AUSER) && defined(USE_PAM)
98 + if (hostbased_cuser != NULL) {
99 + free(hostbased_cuser);
100 + hostbased_cuser = NULL;
103 if (!authctxt->valid)
104 fatal_f("authenticated invalid user");
105 if (strcmp(auth_method, "unknown") == 0)
106 @@ -594,14 +600,16 @@
110 +#if !defined(HAVE_PAM_AUSER) || !defined(USE_PAM)
111 free(hostbased_cuser);
112 + hostbased_cuser = NULL;
114 free(hostbased_chost);
115 sshauthopt_free(key_opts);
118 key_blobtype = MM_NOKEY;
120 - hostbased_cuser = NULL;
121 hostbased_chost = NULL;
124 @@ -1074,6 +1082,11 @@
125 if (!options.use_pam)
126 fatal("%s: PAM not enabled", __func__);
128 +#ifdef HAVE_PAM_AUSER
129 + if (hostbased_cuser != NULL)
130 + do_pam_set_auser(hostbased_cuser);
133 ret = do_pam_account();
135 if ((r = sshbuf_put_u32(m, ret)) != 0 ||