aboutsummaryrefslogtreecommitdiffstats
path: root/security/cyrus-sasl/scripts/configure.sasl
blob: 65a36ef5c876b3be44b4510465beaea03648bc85 (plain) (blame)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#!/bin/sh
# $FreeBSD$

if [ -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc ]; then
    exit
fi

tempfile=`mktemp -t checklist`

if [ "${BATCH}" ]; then
    if [ "${WITH_DB3}" ]; then
        OPTIONS="\"DB3\""
    else
        OPTIONS="\"NDBM\""
    fi
    if [ "${WITH_JAVA}" ]; then
        OPTIONS="${OPTIONS} \"JAVA\""
    fi
    if [ "${WITH_MYSQL}" ]; then
        OPTIONS="${OPTIONS} \"MySQL\""
    fi
    if [ "${WITH_LDAP2}" ]; then
        OPTIONS="${OPTIONS} \"OpenLDAP2\""
    elif [ "${WITH_LDAP1}" ]; then
        OPTIONS="${OPTIONS} \"OpenLDAP1\""
    fi
    if [ "${OPTIONS}" != "x" ]; then
        OPTIONS="${OPTIONS} \"PWCHECK\""
        set ${OPTIONS}
    fi
else
    if [ "${WITH_DB3}" -o -f ${PREFIX}/lib/libdb3.so ] ; then
        SET_DB3="ON"
        SET_NDBM="OFF"
    else
        SET_DB3="OFF"
        SET_NDBM="ON"
    fi
    if [ "${WITH_JAVA}" ] ; then
        SET_JAVA="ON"
    else
        SET_JAVA="OFF"
    fi
    if [ "${WITH_MYSQL}" -o -f ${PREFIX}/lib/mysql/libmysqlclient.so ] ; then
        SET_MYSQL="ON"
    else
        SET_MYSQL="OFF"
    fi

    #Perfer LDAP2 over LDAP1
    SET_LDAP1="OFF"
    SET_LDAP2="OFF"
    if [ "${WITH_LDAP2}" -o -f ${PREFIX}/lib/libldap.so.2 -a -f ${PREFIX}/lib/liblber.so.2 ] ; then
        SET_LDAP2="ON"
    elif [ "${WITH_LDAP1}" -o -f ${PREFIX}/lib/libldap.so.1 -a -f ${PREFIX}/lib/liblber.so.1 ]; then
        SET_LDAP1="ON"
    fi

    /usr/bin/dialog --title "Additional SASL options" --clear \
        --checklist "\n\
Please select desired options:" -1 -1 16 \
NDBM        "ndbm DB" ${SET_NDBM} \
DB3     "Berkeley DB, revision 3" ${SET_DB3} \
JAVA        "JavaSASL [Experimental]" ${SET_JAVA} \
MySQL       "MySQL password Authentication" ${SET_MYSQL} \
OpenLDAP1   "OpenLDAP 1.x password Authentication" ${SET_LDAP1} \
OpenLDAP2   "OpenLDAP 2.x password Authentication w/TLS" ${SET_LDAP2} \
PWCHECK     "Use pwcheck for password Authentication" ON \
PAMPWCHECK      "Use pwcheck_pam for password Authentication" OFF \
2> $tempfile

    retval=$?

    if [ -s $tempfile ]; then
        set `cat $tempfile`
    fi
    rm -f $tempfile

    case $retval in
        0)  if [ -z "$*" ]; then
                echo "Nothing selected"
                OPTIONS="\"NDBM\""
                set ${OPTIONS}
            fi
            ;;
        1)  echo "Cancel pressed."
            exit 1
            ;;
    esac
fi

${MKDIR} ${WRKDIRPREFIX}${REALCURDIR}
exec > ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc

echo "PREFIX=   ${PREFIX}"

while [ "$1" ]; do
    case $1 in
        \"NDBM\")
            if [ "${DBLIB}" ]; then
                echo "ndbm and db3 are mutually exclusive." > /dev/stderr
                rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
                exit 1
            fi
            echo "CONFIGURE_ARGS+=  --with-dblib=ndbm"
            echo "SASLDB_NAME=  sasldb.db"
            DBLIB=1
            ;;
        \"DB3\")
            if [ "${DBLIB}" ]; then
                echo "ndbm and db3 are mutually exclusive." > /dev/stderr
                rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
                exit 1
            fi
            echo "LIB_DEPENDS+= db3.2:\${PORTSDIR}/databases/db3"
            echo "CONFIGURE_ARGS+=  --with-dblib=berkeley"
            echo "SASLDB_NAME=  sasldb"
            DBLIB=1
            ;;
        \"JAVA\")
            echo "BUILD_DEPENDS+=   \${LOCALBASE}/\${JAVADIR}/bin/java:\${PORTSDIR}/java/jdk13"
            echo "RUN_DEPENDS+= \${LOCALBASE}/\${JAVADIR}/bin/java:\${PORTSDIR}/java/jdk13"
            echo "USE_GMAKE=    yes"
            echo "CONFIGURE_ARGS+=  --enable-java \\"
            echo "          --with-javabase=\${LOCALBASE}/\${JAVADIR}"
            echo "CONFIGURE_ENV+=   JAVAC=\"\${LOCALBASE}/\${JAVADIR}/bin/javac\" \\"
            echo "      JAVAH=\"\${LOCALBASE}/\${JAVADIR}/bin/javah\" \\"
            echo "      JAVADOC=\"\${LOCALBASE}/\${JAVADIR}/bin/javadoc\""
            echo "PLIST_SUB+=   JAVASASL=\"\""
            DEFJAVA=1
            ;;
        \"MySQL\")
            echo "LIB_DEPENDS+= mysqlclient.10:\${PORTSDIR}/databases/mysql323-client"
            echo "CONFIGURE_ARGS+=  --with-mysql=\${PREFIX}"
            MSG=1
            ;;
        \"OpenLDAP1\")
            if [ "$OPENLDAP" ]; then
                echo "OpenLDAP1 and OpenLDAP2 are mutually exclusive." > /dev/stderr
                rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
                exit 1
            fi
            echo "LIB_DEPENDS+= ldap.1:\${PORTSDIR}/net/openldap"
            echo "LIB_DEPENDS+= lber.1:\${PORTSDIR}/net/openldap"
            echo "CONFIGURE_ARGS+=  --with-ldap=\${PREFIX}"
            OPENLDAP=1
            ;;
        \"OpenLDAP2\")
            if [ "$OPENLDAP" ]; then
                echo "OpenLDAP1 and OpenLDAP2 are mutually exclusive." > /dev/stderr
                rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
                exit 1
            fi
            echo "LIB_DEPENDS+= ldap.2:\${PORTSDIR}/net/openldap2"
            echo "LIB_DEPENDS+= lber.2:\${PORTSDIR}/net/openldap2"
            echo "CONFIGURE_ARGS+=  --with-ldap=\${PREFIX}"
            OPENLDAP=1
            ;;
        \"PWCHECK\")
            if [ "$PWCHECK" ]; then
                echo "PWCHECK or PAMPWCHECK must be choosen seperately: Defaulting to PAMPWCHECK" > /dev/stderr
            else
                echo "PWCHECK_SUB+= -e \"s;%%PWCHECK%%;pwcheck;g\""
                PWCHECK=1
            fi
            ;;
        \"PAMPWCHECK\")
            if [ "$PWCHECK" ]; then
                echo "PWCHECK or PAMPWCHECK must be choosen seperately: Defaulting to PWCHECK" > /dev/stderr
            else
                echo "PWCHECK_SUB+= -e \"s;%%PWCHECK%%;pwcheck_pam;g\""
                PWCHECK=1
            fi
            ;;
        *)
            echo "Invalid option(s): $*" > /dev/stderr
            rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
            exit 1
            ;;
    esac
    shift
done

if [ "$PWCHECK" ]; then
    echo "PWCHECK_SUB+= -e \"s;%%ENABLEPWCHECK%%;yes;g\""
else
    echo "PWCHECK_SUB+= -e \"s;%%PWCHECK%%;pwcheck;g\" \\"
    echo "          -e \"s;%%ENABLEPWCHECK%%;no;g\""
fi
if [ ! "${DEFJAVA}" ]; then
    echo "PLIST_SUB+=   JAVASASL=\"@comment \""
fi
if [ ! "${DBLIB}" ]; then
    echo "CONFIGURE_ARGS+=  --with-dblib=ndbm"
    echo "SASLDB_NAME=  sasldb.db"
fi

if [ "$OPENLDAP" ]; then
    echo "LDAP_MYSQL_MSG=   \"See sysadmin.html in the Cyrus-SASL docs directory for informaion on using LDAP or MySQL for authentication.\""
fi