authctxt->pw ? user : "unknown" is pointless because illegal users get pw from fakepw(), the code should check authctxt->valid moreover, a check of this kind is completely missing in auth-pam.c
Created attachment 690 [details] this patch fixes the bug
I'm ok with the first two. Makes sense to key off of ->valid since everything else does. I'm leary of the change to do: setproctitle("%s [pam]", sshpam_authctxt && sshpam_authctxt->valid ? pam_user : "unknown"); Mainly because I don't see the (xx && yy ? zz : pp) abuse normally and as a result I'd be skiddy until someone else on the project agrees. I'd also rather see it as: if ( ( xx ) && ( yy ) ) setproc[..] else setproc[..] could be I've seen too many (xx & yy) mistakes in OpenBSD audits.
Fix applied - thanks.