Page MenuHomeFreeBSD

pam_exec(8) expose_authtok should send a trailing NUL
ClosedPublic

Authored by munro_ip9.org on Aug 30 2018, 11:20 AM.
Tags
None
Referenced Files
F143986499: D16950.id47480.diff
Tue, Feb 3, 12:01 AM
Unknown Object (File)
Sun, Jan 25, 5:40 PM
Unknown Object (File)
Thu, Jan 22, 6:47 PM
Unknown Object (File)
Dec 16 2025, 6:56 AM
Unknown Object (File)
Dec 15 2025, 10:11 AM
Unknown Object (File)
Dec 14 2025, 12:40 PM
Unknown Object (File)
Nov 26 2025, 10:12 AM
Unknown Object (File)
Nov 20 2025, 9:33 PM
Subscribers

Details

Summary

On Linux PAM, pam_exec(8) expose_authtok sends the password followed by a NUL character. The FreeBSD version doesn't send the NUL. The invoked program may or may not notice, depending on the language, but since the point of expose_authtok is to be compatible with Linux PAM we should send that trailing NUL too.

Test Plan

Create an executable script /tmp/test.sh to dump the password into a file:

#!/bin/sh
cat > /tmp/captured

Create a service file /etc/pam.d/my-service containing:

auth required /path/to/pam_exec.so expose_authtok /tmp/test.sh
account required pam_permit.so

Install pamtester with pkg, and then test with:

pamtester my-service abc authenticate

Enter "hello" at the password prompt. Now od -c /tmp/captured should show:

0000000    h   e   l   l   o  \0
0000006

The same test run on a Linux system ("apt-get install pamtester" for Debian) shows the same output.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable