summaryrefslogtreecommitdiff
blob: 188c1055dfa4148b5baac79e9e4bea5c810da5ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-apache/pwauth/pwauth-2.3.5.ebuild,v 1.1 2008/01/27 18:08:47 hollow Exp $

inherit eutils toolchain-funcs pam

DESCRIPTION="A Unix Web Authenticator"
HOMEPAGE="http://www.unixpapa.com/pwauth/"
SRC_URI="http://www.unixpapa.com/software/${P}.tar.gz"

LICENSE="Apache-1.1"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="faillog pam ignore-case domain-aware"

DEPEND="pam? ( virtual/pam )"

pkg_setup() {
	local OPTS

	einfo "You can configure various build time options with ENV variables:"
	einfo
	einfo "    PWAUTH_FAILLOG      Path to logfile for login failures"
	einfo "                        (default: /var/log/pwauth.log)"
	einfo "    PWAUTH_SERVERUIDS   Comma seperated list of UIDs allowed to run pwauth"
	einfo "                        (default: 81)"
	einfo "    PWAUTH_MINUID       Minimum UID for which authentication will succeed"
	einfo "                        (default: 1000)"
	einfo

	PWAUTH_FAILLOG="${PWAUTH_FAILLOG:-/var/log/pwauth.log}"
	PWAUTH_SERVERUIDS="${PWAUTH_SERVERUIDS:-81}"
	PWAUTH_MINUID="${PWAUTH_MINUID:-1000}"

	OPTS="${OPTS} -DSERVER_UIDS=${PWAUTH_SERVERUIDS}"
	OPTS="${OPTS} -DMIN_UNIX_UID=${PWAUTH_MINUID}"

	if use faillog; then
		OPTS="${OPTS} -DFAILLOG_PWAUTH"
		OPTS="${OPTS} -DPATH_FAILLOG=\"\\\"${PWAUTH_FAILLOG}\\\"\""
	fi

	if use pam; then
		OPTS="${OPTS} -DPAM"
		LDFLAGS="-lpam"
	else
		OPTS="${OPTS} -DSHADOW_SUN"
		LDFLAGS="-lcrypt"
	fi

	if use ignore-case; then
		OPTS="${OPTS} -DIGNORE_CASE"
	fi

	if use domain-aware; then
		OPTS="${OPTS} -DOMAIN_AWARE"
	fi

	CC=$(tc-getCC)
	CFLAGS="${CFLAGS} ${OPTS}"
}

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}"/pwauth-gentoo.patch
}

src_install() {
	dosbin pwauth unixgroup
	fperms 4755 /usr/sbin/pwauth

	use pam && newpamd "${FILESDIR}"/pwauth.pam-include pwauth

	dodoc CHANGES FORM_AUTH INSTALL README
}