popa3d: segfaults w/PAM
by jayjwa from LinuxQuestions.org on (#6MV5D)
popa3d-1.0.3 has an option for PAM authentication, but it is not set correctly, resulting in a segfault when a user tries to login.
Code:> telnet 192.168.20.1 110
Trying 192.168.20.1...
Connected to 192.168.20.1.
Escape character is '^]'.
+OK
USER jayjwa
+OK
PASS s3cr3t
-ERR Authentication failed (bad password?)
Connection closed by foreign host.
May 15 13:51:50 atr2 vmunix: [427685.241713] popa3d[32056]: segfault at fffffffff7f75220 ip 00007ffff7772307 sp 00007fffffffd578 error 5 in libc-2.39.so[7ffff7628000+16f000] likely on CPU 0 (core 0, socket 0)
May 15 13:51:50 atr2 vmunix: [427685.241728] Code: 48 01 d0 c5 f8 77 c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 c4 41 01 ef ff 89 f8 09 f0 c1 e0 14 3d 00 00 00 f8 0f 87 29 03 00 00 <c5> fe 6f 07 c5 fd 74 0e c5 85 74 d0 c5 ed df c9 c5 fd d7 c9 ff c1
May 15 13:51:50 atr2 popa3d[32050]: Authentication failed for jayjwa
May 15 13:54:35 atr2 vmunix: [427849.918832] popa3d[32231]: segfault at fffffffff7f75220 ip 00007ffff7772307 sp 00007fffffffd578 error 5 in libc-2.39.so[7ffff7628000+16f000] likely on CPU 3 (core 1, socket 0)
May 15 13:54:35 atr2 vmunix: [427849.918845] Code: 48 01 d0 c5 f8 77 c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 c4 41 01 ef ff 89 f8 09 f0 c1 e0 14 3d 00 00 00 f8 0f 87 29 03 00 00 <c5> fe 6f 07 c5 fd 74 0e c5 85 74 d0 c5 ed df c9 c5 fd d7 c9 ff c1
May 15 13:54:35 atr2 popa3d[32225]: Authentication failed for jayjwa
May 15 13:55:00 atr2 vmunix: [427874.637699] popa3d[32252]: segfault at fffffffff7f75220 ip 00007ffff7772307 sp 00007fffffffd578 error 5 in libc-2.39.so[7ffff7628000+16f000] likely on CPU 6 (core 5, socket 0)
May 15 13:55:00 atr2 vmunix: [427874.637714] Code: 48 01 d0 c5 f8 77 c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 c4 41 01 ef ff 89 f8 09 f0 c1 e0 14 3d 00 00 00 f8 0f 87 29 03 00 00 <c5> fe 6f 07 c5 fd 74 0e c5 85 74 d0 c5 ed df c9 c5 fd d7 c9 ff c1#define AUTH_PAM 1 should be set instead. Two of the patches against the original source apply clean, but the last does not, so I diff'd against the original.
zcat /tmp/popa3d-2024may05.patch.gz
Code:diff -Nur popa3d-1.0.3.orig/Makefile popa3d-1.0.3/Makefile
--- popa3d-1.0.3.orig/Makefile 2006-03-05 05:36:54.000000000 -0500
+++ popa3d-1.0.3/Makefile 2024-05-15 16:04:45.441343266 -0400
@@ -3,28 +3,28 @@
RM = rm -f
MKDIR = mkdir -p
INSTALL = install -c
-CFLAGS = -Wall -O2 -fomit-frame-pointer
+CFLAGS = -pipe -O2 -fomit-frame-pointer
# You may use OpenSSL's MD5 routines instead of the ones supplied here
#CFLAGS += -DHAVE_OPENSSL
LDFLAGS = -s
LIBS =
# Linux with glibc, FreeBSD, NetBSD
-#LIBS += -lcrypt
+LIBS += -lcrypt
# HP-UX trusted system
#LIBS += -lsec
# Solaris (POP_STANDALONE, POP_VIRTUAL)
#LIBS += -lsocket -lnsl
# PAM
-#LIBS += -lpam
+LIBS += -lpam
# TCP wrappers
#LIBS += -lwrap
# libwrap may also want this
#LIBS += -lnsl
# OpenSSL (-DHAVE_OPENSSL)
-#LIBS += -lcrypto
+LIBS += -lcrypto
DESTDIR =
-PREFIX = /usr/local
+PREFIX = /usr
SBINDIR = $(PREFIX)/sbin
MANDIR = $(PREFIX)/man
diff -Nur popa3d-1.0.3.orig/params.h popa3d-1.0.3/params.h
--- popa3d-1.0.3.orig/params.h 2006-03-05 08:18:32.000000000 -0500
+++ popa3d-1.0.3/params.h 2024-05-15 16:06:37.097555265 -0400
@@ -103,7 +103,7 @@
* A pseudo-user to run as before authentication. The user and its UID
* must not be used for any other purpose.
*/
-#define POP_USER POP_SERVER
+#define POP_USER "pop"
/*
* An empty directory to chroot to before authentication. The directory
@@ -155,8 +155,8 @@
* Note that there's no built-in password aging support.
*/
#define AUTH_PASSWD 0
-#define AUTH_SHADOW 1
-#define AUTH_PAM 0
+#define AUTH_SHADOW 0
+#define AUTH_PAM 1
#define AUTH_PAM_USERPASS 0
#define USE_LIBPAM_USERPASS 0
@@ -191,7 +191,7 @@
*
* #undef this for qmail-style $HOME/Mailbox mailboxes.
*/
-#define MAIL_SPOOL_PATH "/var/mail"
+#define MAIL_SPOOL_PATH "/var/spool/mail"
#ifndef MAIL_SPOOL_PATH
/*After...
Code:> telnet 192.168.20.1 110
Trying 192.168.20.1...
Connected to 192.168.20.1.
Escape character is '^]'.
+OK
USER jayjwa
+OK
PASS s3cr3t
+OK
STAT
+OK 9 159760
QUIT
+OK
Connection closed by foreign host.
Code:> telnet 192.168.20.1 110
Trying 192.168.20.1...
Connected to 192.168.20.1.
Escape character is '^]'.
+OK
USER jayjwa
+OK
PASS s3cr3t
-ERR Authentication failed (bad password?)
Connection closed by foreign host.
May 15 13:51:50 atr2 vmunix: [427685.241713] popa3d[32056]: segfault at fffffffff7f75220 ip 00007ffff7772307 sp 00007fffffffd578 error 5 in libc-2.39.so[7ffff7628000+16f000] likely on CPU 0 (core 0, socket 0)
May 15 13:51:50 atr2 vmunix: [427685.241728] Code: 48 01 d0 c5 f8 77 c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 c4 41 01 ef ff 89 f8 09 f0 c1 e0 14 3d 00 00 00 f8 0f 87 29 03 00 00 <c5> fe 6f 07 c5 fd 74 0e c5 85 74 d0 c5 ed df c9 c5 fd d7 c9 ff c1
May 15 13:51:50 atr2 popa3d[32050]: Authentication failed for jayjwa
May 15 13:54:35 atr2 vmunix: [427849.918832] popa3d[32231]: segfault at fffffffff7f75220 ip 00007ffff7772307 sp 00007fffffffd578 error 5 in libc-2.39.so[7ffff7628000+16f000] likely on CPU 3 (core 1, socket 0)
May 15 13:54:35 atr2 vmunix: [427849.918845] Code: 48 01 d0 c5 f8 77 c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 c4 41 01 ef ff 89 f8 09 f0 c1 e0 14 3d 00 00 00 f8 0f 87 29 03 00 00 <c5> fe 6f 07 c5 fd 74 0e c5 85 74 d0 c5 ed df c9 c5 fd d7 c9 ff c1
May 15 13:54:35 atr2 popa3d[32225]: Authentication failed for jayjwa
May 15 13:55:00 atr2 vmunix: [427874.637699] popa3d[32252]: segfault at fffffffff7f75220 ip 00007ffff7772307 sp 00007fffffffd578 error 5 in libc-2.39.so[7ffff7628000+16f000] likely on CPU 6 (core 5, socket 0)
May 15 13:55:00 atr2 vmunix: [427874.637714] Code: 48 01 d0 c5 f8 77 c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 c4 41 01 ef ff 89 f8 09 f0 c1 e0 14 3d 00 00 00 f8 0f 87 29 03 00 00 <c5> fe 6f 07 c5 fd 74 0e c5 85 74 d0 c5 ed df c9 c5 fd d7 c9 ff c1#define AUTH_PAM 1 should be set instead. Two of the patches against the original source apply clean, but the last does not, so I diff'd against the original.
zcat /tmp/popa3d-2024may05.patch.gz
Code:diff -Nur popa3d-1.0.3.orig/Makefile popa3d-1.0.3/Makefile
--- popa3d-1.0.3.orig/Makefile 2006-03-05 05:36:54.000000000 -0500
+++ popa3d-1.0.3/Makefile 2024-05-15 16:04:45.441343266 -0400
@@ -3,28 +3,28 @@
RM = rm -f
MKDIR = mkdir -p
INSTALL = install -c
-CFLAGS = -Wall -O2 -fomit-frame-pointer
+CFLAGS = -pipe -O2 -fomit-frame-pointer
# You may use OpenSSL's MD5 routines instead of the ones supplied here
#CFLAGS += -DHAVE_OPENSSL
LDFLAGS = -s
LIBS =
# Linux with glibc, FreeBSD, NetBSD
-#LIBS += -lcrypt
+LIBS += -lcrypt
# HP-UX trusted system
#LIBS += -lsec
# Solaris (POP_STANDALONE, POP_VIRTUAL)
#LIBS += -lsocket -lnsl
# PAM
-#LIBS += -lpam
+LIBS += -lpam
# TCP wrappers
#LIBS += -lwrap
# libwrap may also want this
#LIBS += -lnsl
# OpenSSL (-DHAVE_OPENSSL)
-#LIBS += -lcrypto
+LIBS += -lcrypto
DESTDIR =
-PREFIX = /usr/local
+PREFIX = /usr
SBINDIR = $(PREFIX)/sbin
MANDIR = $(PREFIX)/man
diff -Nur popa3d-1.0.3.orig/params.h popa3d-1.0.3/params.h
--- popa3d-1.0.3.orig/params.h 2006-03-05 08:18:32.000000000 -0500
+++ popa3d-1.0.3/params.h 2024-05-15 16:06:37.097555265 -0400
@@ -103,7 +103,7 @@
* A pseudo-user to run as before authentication. The user and its UID
* must not be used for any other purpose.
*/
-#define POP_USER POP_SERVER
+#define POP_USER "pop"
/*
* An empty directory to chroot to before authentication. The directory
@@ -155,8 +155,8 @@
* Note that there's no built-in password aging support.
*/
#define AUTH_PASSWD 0
-#define AUTH_SHADOW 1
-#define AUTH_PAM 0
+#define AUTH_SHADOW 0
+#define AUTH_PAM 1
#define AUTH_PAM_USERPASS 0
#define USE_LIBPAM_USERPASS 0
@@ -191,7 +191,7 @@
*
* #undef this for qmail-style $HOME/Mailbox mailboxes.
*/
-#define MAIL_SPOOL_PATH "/var/mail"
+#define MAIL_SPOOL_PATH "/var/spool/mail"
#ifndef MAIL_SPOOL_PATH
/*After...
Code:> telnet 192.168.20.1 110
Trying 192.168.20.1...
Connected to 192.168.20.1.
Escape character is '^]'.
+OK
USER jayjwa
+OK
PASS s3cr3t
+OK
STAT
+OK 9 159760
QUIT
+OK
Connection closed by foreign host.