Skip to contentSkip to conversation

Use PAM correctly

PATCH In review Roy Marples 2 participants 3 messages Oct 11, 2006 – Oct 13, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use PAM correctly

Hi List!

openvpn pam plugin does not use PAM correctly. Namely it requires a private LinuxPAM header and links using -ldl which is Linux only.

Attached is a trivial patch that removes this private header and links using -lpam.

This enables openvpn pam plugin to compile correctly on default LinuxPAM and OpenPAM installs.

Thanks

Signature · 2 lines
Roy Marples <[email protected]...>
Gentoo/Linux Developer (baselayout, networking)

We should use pam property - this works on both LinuxPAM and OpenPAM

plugin/auth-pam/Makefile +1 -1
diff -ur openvpn-2.0.7.orig/plugin/auth-pam/Makefile openvpn-2.0.7/plugin/auth-pam/Makefile
@@ -4,7 +4,7 @@
 
 # If PAM modules are not linked against libpam.so, set DLOPEN_PAM to 1. This
 # must be done on SUSE 9.1, at least.
-DLOPEN_PAM=1
+DLOPEN_PAM=0
 
 ifeq ($(DLOPEN_PAM),1)
 	LIBPAM=-ldl
plugin/auth-pam/pamdl.c +1 -2
diff -ur openvpn-2.0.7.orig/plugin/auth-pam/pamdl.c openvpn-2.0.7/plugin/auth-pam/pamdl.c
@@ -10,7 +10,6 @@
 #include <stdio.h>
 #include <dlfcn.h>
 #include <security/pam_appl.h>
-#include <security/_pam_macros.h>
 
 #include "pamdl.h"
 
@@ -74,7 +73,7 @@
     return real_pam_set_item(pamh, item_type, item);
 }
 
-int pam_get_item(const pam_handle_t *pamh, int item_type, const void **item)
+int pam_get_item(pam_handle_t *pamh, int item_type, const void **item)
 {
     int (*real_pam_get_item)(const pam_handle_t *, int, const void **);
     RESOLVE_PAM_FUNCTION(pam_get_item, int,
#1 lore raw
Quoted 2 lines · Roy Marples

openvpn pam plugin does not use PAM correctly. Namely it requires a private LinuxPAM header and links using -ldl which is Linux only.

To top this off, someone would have to rewrite the Makefile so that it works with POSIX makes, too, and not just GNU make as it is now.

Quoted 2 lines

This enables openvpn pam plugin to compile correctly on default LinuxPAM and OpenPAM installs.

We've needed to do the equivalent for the FreeBSD port, Michael Helmeste was so kind as to make me aware of the issue and this possible solution.

IOW, if you're installing on FreeBSD, use the official port in version 2.0.6_4 and all this is automatic - no 2.0.9 port needed since all fixes since then were relevant for Windoze and we don't need to toss hundreds of MBytes around for no good.

Signature · 1 line
Matthias Andree
#2 lore raw
Quoted 7 lines · Matthias Andree

We've needed to do the equivalent for the FreeBSD port, Michael Helmeste was so kind as to make me aware of the issue and this possible solution.

IOW, if you're installing on FreeBSD, use the official port in version 2.0.6_4 and all this is automatic - no 2.0.9 port needed since all fixes since then were relevant for Windoze and we don't need to toss hundreds of MBytes around for no good.

I made that patch using Gentoo/FreeBSD on Sparc64 :P (currently cursing BSD devs for using __sparc64__ define in their code)

Gentoo enforces gmake being present on the system as it's predominately Linux, so the makefile wasn't an issue for us.

Thanks

Signature · 2 lines
Roy Marples <[email protected]...>
Gentoo/Linux/FreeBSD Developer (baselayout, networking)