6 |
bindir="$destdir/bin" |
bindir="$destdir/bin" |
7 |
mandir="$destdir/man" |
mandir="$destdir/man" |
8 |
|
|
|
debug="yes" |
|
|
checkperms="yes" |
|
|
memlock="yes" |
|
9 |
encpasswds="yes" |
encpasswds="yes" |
10 |
ssl="yes" |
ssltls="yes" |
11 |
|
cram="yes" |
12 |
|
|
13 |
libs="" |
libs="" |
14 |
libenc="-lcrypto" |
libssl="-lssl" |
15 |
libssl="-lssl -lcrypto" |
libcrypto="-lcrypto" |
16 |
|
|
17 |
cflags="" |
cflags="-g" |
18 |
|
ldflags="" |
19 |
|
|
20 |
interactive="no" |
interactive="no" |
21 |
|
|
39 |
o) |
o) |
40 |
head=`echo $OPTARG | cut -d= -f1` |
head=`echo $OPTARG | cut -d= -f1` |
41 |
body=`echo $OPTARG | cut -d= -f2` |
body=`echo $OPTARG | cut -d= -f2` |
42 |
if [ $head = "debug" ] |
if [ $head = "encpasswds" ] |
|
then |
|
|
if [ $body = "yes" ]; then debug="yes" |
|
|
elif [ $body = "no" ]; then debug="no" |
|
|
fi |
|
|
elif [ $head = "checkperms" ] |
|
|
then |
|
|
if [ $body = "yes" ]; then checkperms="yes" |
|
|
elif [ $body = "no" ]; then checkperms="no" |
|
|
fi |
|
|
elif [ $head = "memlock" ] |
|
|
then |
|
|
if [ $body = "yes" ]; then memlock="yes" |
|
|
elif [ $body = "no" ]; then memlock="no" |
|
|
fi |
|
|
elif [ $head = "encpasswds" ] |
|
43 |
then |
then |
44 |
if [ $body = "yes" ]; then encpasswds="yes" |
if [ $body = "yes" ]; then encpasswds="yes" |
45 |
elif [ $body = "no" ]; then encpasswds="no" |
elif [ $body = "no" ]; then encpasswds="no" |
46 |
fi |
fi |
47 |
elif [ $head = "ssl" ] |
elif [ $head = "ssltls" ] |
48 |
then |
then |
49 |
if [ $body = "yes" ]; then ssl="yes" |
if [ $body = "yes" ]; then ssltls="yes" |
50 |
elif [ $body = "no" ]; then ssl="no" |
elif [ $body = "no" ]; then ssltls="no" |
51 |
|
fi |
52 |
|
elif [ $head = "cram" ] |
53 |
|
then |
54 |
|
if [ $body = "yes" ]; then cram="yes" |
55 |
|
elif [ $body = "no" ]; then cram="no" |
56 |
fi |
fi |
57 |
fi |
fi |
58 |
;; |
;; |
73 |
-o option=argument Enabling/disabling of program's options. |
-o option=argument Enabling/disabling of program's options. |
74 |
|
|
75 |
Options: |
Options: |
|
debug Debugging information, useful during development [$debug] |
|
|
checkperms Configuration file's permissions checking [$checkperms] |
|
|
memlock Try to lock memory pages to avoid swapping [$memlock] |
|
76 |
encpasswds Encrypted passwords support [$encpasswds] |
encpasswds Encrypted passwords support [$encpasswds] |
77 |
ssl Secure Socket Layer and Transport Layer Security [$ssl] |
ssltls Secure Socket Layer and Transport Layer Security [$ssltls] |
78 |
|
cram Challenge-Response Authentication Mechanism [$cram] |
79 |
EOF |
EOF |
80 |
exit 1 |
exit 1 |
81 |
;; |
;; |
99 |
read tmp |
read tmp |
100 |
if [ -n "$tmp" ]; then mandir="$tmp"; fi |
if [ -n "$tmp" ]; then mandir="$tmp"; fi |
101 |
|
|
|
printf "Debugging information [$debug]: " |
|
|
read tmp |
|
|
if [ -n "$tmp" ]; then debug="$tmp"; fi |
|
|
|
|
|
printf "Configuration file permissions checking [$checkperms]: " |
|
|
read tmp |
|
|
if [ -n "$tmp" ]; then checkperms="$tmp"; fi |
|
|
|
|
|
printf "Try to lock memory pages to avoid swapping [$memlock]: " |
|
|
read tmp |
|
|
if [ -n "$tmp" ]; then memlock="$tmp"; fi |
|
|
|
|
102 |
printf "Encrypted passwords support [$encpasswds]: " |
printf "Encrypted passwords support [$encpasswds]: " |
103 |
read tmp |
read tmp |
104 |
if [ -n "$tmp" ]; then encpasswds="$tmp"; fi |
if [ -n "$tmp" ]; then encpasswds="$tmp"; fi |
105 |
|
|
106 |
printf "Secure Socket Layer and Transport Layer Security [$ssl]: " |
printf "Secure Socket Layer and Transport Layer Security [$ssltls]: " |
107 |
read tmp |
read tmp |
108 |
if [ -n "$tmp" ]; then ssl="$tmp"; fi |
if [ -n "$tmp" ]; then ssltls="$tmp"; fi |
109 |
|
|
110 |
|
printf "Challenge-Response Authentication Mechanism [$cram]: " |
111 |
|
read tmp |
112 |
|
if [ -n "$tmp" ]; then cram="$tmp"; fi |
113 |
else |
else |
114 |
cat << EOF |
cat << EOF |
115 |
Destination directory: $destdir |
Destination directory: $destdir |
116 |
Binaries directory: $bindir |
Binaries directory: $bindir |
117 |
Manual pages directory: $mandir |
Manual pages directory: $mandir |
|
Debugging information: $debug |
|
|
Configuration file permissions checking: $checkperms |
|
|
Try to lock memory pages to avoid swapping: $memlock |
|
118 |
Encrypted passwords support: $encpasswds |
Encrypted passwords support: $encpasswds |
119 |
Secure Socket Layer and Transport Layer Security: $ssl |
Secure Socket Layer and Transport Layer Security: $ssltls |
120 |
|
Challenge-Response Authentication Mechanism: $cram |
121 |
EOF |
EOF |
122 |
fi |
fi |
123 |
|
|
124 |
|
|
125 |
# Libraries |
# Libraries |
126 |
|
|
127 |
if [ $ssl = "yes" ] |
if [ $ssltls = "yes" ] |
128 |
then |
then |
129 |
libs="$libs $libssl" |
libs="$libs $libssl $libcrypto" |
130 |
elif [ $encpasswds = "yes" ] |
elif [ $encpasswds = "yes" ] || [ $cram = "yes" ] |
131 |
then |
then |
132 |
libs="$libs $libenc" |
libs="$libs $libcrypto" |
|
fi |
|
|
|
|
|
|
|
|
# C flags |
|
|
|
|
|
if [ $debug = "yes" ] |
|
|
then |
|
|
cflags="-g" |
|
|
else |
|
|
cflags="-O" |
|
133 |
fi |
fi |
134 |
|
|
135 |
|
|
146 |
cat > Makefile << EOF |
cat > Makefile << EOF |
147 |
CC = cc |
CC = cc |
148 |
CFLAGS = $cflags |
CFLAGS = $cflags |
149 |
|
LDFLAGS = |
150 |
|
|
151 |
DESTDIR = $destdir |
DESTDIR = $destdir |
152 |
BINDIR = $bindir |
BINDIR = $bindir |
156 |
MAN_RC = imapfilterrc.5 |
MAN_RC = imapfilterrc.5 |
157 |
|
|
158 |
BIN = imapfilter |
BIN = imapfilter |
159 |
OBJ = data.o file.o imap.o imapfilter.o lock.o log.o memory.o misc.o \\ |
OBJ = account.o action.o auth.o buffer.o cert.o destroy.o file.o filter.o \\ |
160 |
|
imap.o imapfilter.o lock.o log.o match.o memory.o misc.o parse.o \\ |
161 |
passwd.o response.o request.o socket.o tty.o |
passwd.o response.o request.o socket.o tty.o |
162 |
|
|
163 |
LIBS = $libs |
LIBS = $libs |
164 |
|
|
165 |
|
all: imapfilter |
166 |
|
|
167 |
imapfilter: \$(OBJ) |
imapfilter: \$(OBJ) |
168 |
\$(CC) \$(LIBS) \$(CFLAGS) -o \$(BIN) \$(OBJ) |
\$(CC) \$(LIBS) \$(LDFLAGS) -o \$(BIN) \$(OBJ) |
169 |
|
|
170 |
data.o file.o imap.o imapfilter.o lock.o log.o response.o request.o \\ |
account.o action.o auth.o buffer.o cert.o destroy.o file.o filter.o imap.o \\ |
171 |
memory.o passwd.o socket.o tty.o: imapfilter.h config.h |
imapfilter.o lock.o log.o match.o memory.o parse.o passwd.o \\ |
172 |
data.o imapfilter.o imap.o file.o passwd.o request.o socket.o: data.h |
request.o response.o socket.o tty.o: config.h imapfilter.h |
173 |
|
account.o destroy.o filter.o imapfilter.o match.o: account.h |
174 |
|
action.o destroy.o filter.o imap.o imapfilter.o match.o: filter.h |
175 |
|
account.o filter.o: struct.h |
176 |
|
buffer.o imap.o imapfilter.o response.o: buffer.h |
177 |
|
cert.o file.o lock.o log.o parse.o: pathnames.h |
178 |
|
imapfilter.o: version.h |
179 |
|
|
180 |
install: imapfilter |
install: imapfilter |
181 |
if test ! -d \$(BINDIR); then mkdir -p \$(BINDIR); fi |
if test ! -d \$(BINDIR); then mkdir -p \$(BINDIR); fi |
185 |
if test ! -d \$(MANDIR)/man5; then mkdir -p \$(MANDIR)/man5; fi |
if test ! -d \$(MANDIR)/man5; then mkdir -p \$(MANDIR)/man5; fi |
186 |
cp -f \$(MAN_RC) \$(MANDIR)/man5 && chmod 0644 \$(MANDIR)/man5/\$(MAN_RC) |
cp -f \$(MAN_RC) \$(MANDIR)/man5 && chmod 0644 \$(MANDIR)/man5/\$(MAN_RC) |
187 |
|
|
188 |
uninstall: |
deinstall: |
189 |
rm -f \$(BINDIR)/\$(BIN) \$(MANDIR)/man1/\$(MAN_BIN) \$(MANDIR)/man5/\$(MAN_RC) |
rm -f \$(BINDIR)/\$(BIN) \$(MANDIR)/man1/\$(MAN_BIN) \$(MANDIR)/man5/\$(MAN_RC) |
190 |
|
|
191 |
|
uninstall: deinstall |
192 |
|
|
193 |
clean: |
clean: |
194 |
rm -f \$(OBJ) \$(BIN) imapfilter.core core *.BAK *~ |
rm -f \$(OBJ) \$(BIN) imapfilter.core core *.BAK *~ |
195 |
|
|
203 |
|
|
204 |
mv -f config.h config.h~ |
mv -f config.h config.h~ |
205 |
|
|
206 |
echo "/* Debugging information. */" > config.h |
echo "#ifndef CONFIG_H" > config.h |
207 |
if [ $debug = "yes" ] |
echo "#define CONFIG_H" >> config.h |
208 |
then |
echo >> config.h; echo >> config.h |
|
echo "#define DEBUG" >> config.h |
|
|
else |
|
|
echo "#undef DEBUG" >> config.h |
|
|
fi |
|
|
echo >> config.h |
|
|
|
|
|
echo "/* Configuration file's permissions checking. */" >> config.h |
|
|
if [ $checkperms = "yes" ] |
|
|
then |
|
|
echo "#define CHECK_PERMISSIONS" >> config.h |
|
|
else |
|
|
echo "#undef CHECK_PERMISSIONS" >> config.h |
|
|
fi |
|
|
echo >> config.h |
|
|
|
|
|
echo "/* Try to lock memory pages to avoid swapping. */" >> config.h |
|
|
if [ $memlock = "yes" ] |
|
|
then |
|
|
echo "#define MEMORY_LOCK" >> config.h |
|
|
else |
|
|
echo "#undef MEMORY_LOCK" >> config.h |
|
|
fi |
|
|
echo >> config.h |
|
209 |
|
|
210 |
echo "/* Encrypted passwords support. */" >> config.h |
echo "/* Encrypted passwords support. */" >> config.h |
211 |
if [ $encpasswds = "yes" ] |
if [ $encpasswds = "yes" ] |
217 |
echo >> config.h |
echo >> config.h |
218 |
|
|
219 |
echo "/* Secure Socket Layer and Transport Layer Security support. */" >> config.h |
echo "/* Secure Socket Layer and Transport Layer Security support. */" >> config.h |
220 |
if [ $ssl = "yes" ] |
if [ $ssltls = "yes" ] |
221 |
then |
then |
222 |
echo "#define SSL_TLS" >> config.h |
echo "#define SSL_TLS" >> config.h |
223 |
else |
else |
224 |
echo "#undef SSL_TLS" >> config.h |
echo "#undef SSL_TLS" >> config.h |
225 |
fi |
fi |
226 |
|
echo >> config.h |
227 |
|
|
228 |
|
echo "/* Challenge-Response Authentication Mechanism support. */" >> config.h |
229 |
|
if [ $cram = "yes" ] |
230 |
|
then |
231 |
|
echo "#define CRAM_MD5" >> config.h |
232 |
|
else |
233 |
|
echo "#undef CRAM_MD5" >> config.h |
234 |
|
fi |
235 |
|
|
236 |
|
echo >> config.h; echo >> config.h |
237 |
|
echo "#endif /* CONFIG_H */" >> config.h |
238 |
|
|
239 |
|
|
240 |
exit 0 |
exit 0 |