Skip to content

New FreeBSD support + fix setup.py #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,31 @@ Building and Installing
To run the test suite, in the directory containing this file run:
make test

Building and Installing FreeBSD
-----------------------

The build dependencies are:
- Python2 development system, http://www.python.org
- A POSIX system (make, unix shell, sed, etc).
- gcc >= 5
- The PAM development libraries,
http://pam.sourceforge.net

In addition the unit test requires:
- sudo, http://www.sudo.ws/
- An account with root privileges.

To build the re-distributable, in the directory containing
this file run:
gmake

To install, in the directory containing this file run:
gmake install

To run the test suite, in the directory containing this file run:
gmake test

PAM module pam_python.so will be installed in /usr/local/lib/security path

License
-------
Expand Down
4 changes: 4 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),FreeBSD)
PREFIX ?= /usr/local
endif
PREFIX ?= /usr
DOCDIR ?= $(PREFIX)/share/doc/pam_python

Expand Down
5 changes: 5 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ all: ctest pam_python.so test-pam_python.pam
WARNINGS=-Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Werror
#WARNINGS=-Wunreachable-code # Gcc 4.1 .. 4.4 are too buggy to make this useful

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),FreeBSD)
LIBDIR ?= /usr/local/lib/security
endif

LIBDIR ?= /lib/security

pam_python.so: pam_python.c setup.py Makefile
Expand Down
8 changes: 5 additions & 3 deletions src/pam_python.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define PAM_SM_PASSWORD

#include <security/pam_modules.h>
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__FreeBSD__)
#include <security/_pam_macros.h>
#include <security/_pam_types.h>
#else
Expand All @@ -51,8 +51,10 @@
#endif

#ifndef DEFAULT_SECURITY_DIR
#ifdef __APPLE__
#if defined(__APPLE__)
#define DEFAULT_SECURITY_DIR "/usr/lib/pam/"
#elif defined(__FreeBSD__)
#define DEFAULT_SECURITY_DIR "/usr/lib/"
#else
#define DEFAULT_SECURITY_DIR "/lib/security/"
#endif
Expand Down Expand Up @@ -1927,7 +1929,7 @@ static PyObject* PamHandle_fail_delay(
{
int err;
int micro_sec = 0;
int pam_result;
/*int pam_result; */
PyObject* result = 0;
static char* kwlist[] = {"micro_sec", NULL};

Expand Down
6 changes: 4 additions & 2 deletions src/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python -W default
#!/usr/bin/env -S python2.7 -W default
import warnings; warnings.simplefilter('default')

import distutils.sysconfig
Expand All @@ -25,7 +25,9 @@
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Systems Administration :: Authentication/Directory"]

if not os.environ.has_key("Py_DEBUG"):
#if not os.environ.has_key("Py_DEBUG"):
# fixed for python3 compatibility
if not 'Py_DEBUG' in os.environ:
Py_DEBUG = []
else:
Py_DEBUG = [('Py_DEBUG',1)]
Expand Down