Subversion Repositories prayer-err

Compare Revisions

Ignore whitespace Rev 2 → Rev 3

/trunk/debian/control
0,0 → 1,48
Source: prayer
Section: mail
Priority: optional
Maintainer: Magnus Holmgren <magnus@kibibyte.se>
Build-Depends: cdbs (>= 0.4.27-1), debhelper (>= 5), quilt, libc-client-dev, zlib1g-dev, libssl-dev (>= 0.9.6), libdb4.3-dev | libdb-dev, libldap2-dev
Standards-Version: 3.7.2
 
Package: prayer
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
Suggests: prayer-accountd, imap-server, aspell | ispell
Description: Standalone IMAP-based webmail server
Prayer is yet another Webmail interface.
.
It is unusual in that it is a complete, standalone, HTTP server and proxy
rather a Apache/mod_php plugin. Prayer maintains persistent connections to
the IMAP server and is written entirely in C. Consequently it is much
faster than most open source Webmail interfaces and puts very little load
on either the machines running the Web server or the backend IMAP servers
(even if traditional Unix format mailfolders are in use).
.
Prayer has very few external dependencies as user preferences are stored on
the IMAP server rather than in a SQL database. It does however implement a
full range of features and user preference settings.
 
Package: prayer-accountd
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Suggests: prayer
Recommends: exim4
Description: account management daemon for Prayer
Prayer is yet another Webmail interface.
.
It is unusual in that it is a complete, standalone, HTTP server and proxy
rather a Apache/mod_php plugin. Prayer maintains persistent connections to
the IMAP server and is written entirely in C. Consequently it is much
faster than most open source Webmail interfaces and puts very little load
on either the machines running the Web server or the backend IMAP servers
(even if traditional Unix format mailfolders are in use).
.
This package contains a daemon that can do the following for users:
.
* Change passwords
* Change their full name
* Manage mail filtering (requires Exim) and forwarding
* Manage vacation messages and logs
.
NOTE: This package is currently not very useful.
/trunk/debian/compat
0,0 → 1,0
5
/trunk/debian/prayer.postinst
0,0 → 1,46
#!/bin/sh
# postinst script for prayer
#
# see: dh_installdeb(1)
 
set -e
 
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
 
case "$1" in
configure)
adduser --quiet --system --ingroup nogroup --no-create-home \
--disabled-password --disabled-login prayer
chown prayer:root /var/run/prayer
chown prayer:adm /var/log/prayer
chmod 2750 /var/run/prayer /var/log/prayer
;;
 
abort-upgrade|abort-remove|abort-deconfigure)
 
;;
 
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
 
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
 
#DEBHELPER#
 
exit 0
 
 
/trunk/debian/prayer.default
0,0 → 1,11
# Defaults for prayer initscript
# sourced by /etc/init.d/prayer
# installed at /etc/default/prayer by the maintainer scripts
 
# This is a POSIX shell fragment
 
# Change to one to enable prayer after editing /etc/prayer/prayer.cf
ENABLED=0
 
# Options. You probably won't need any.
DAEMON_OPTS=""
/trunk/debian/prayer.postrm
0,0 → 1,43
#!/bin/sh
# postrm script for prayer
#
# see: dh_installdeb(1)
 
set -e
 
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
 
 
case "$1" in
purge)
deluser --system --quiet prayer || true
rm -rf /var/log/prayer
find /var/run/prayer/ \( -type s -o -name ssl_scache \) -exec rm {} +
;;
 
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
 
;;
 
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
 
esac
 
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
 
#DEBHELPER#
 
exit 0
/trunk/debian/prayer-accountd.docs
0,0 → 1,8
docs/ACCOUNTD
docs/DESIGN
docs/DONE-OLD
docs/FEATURES
docs/NOTICE
docs/README
docs/SECURITY
docs/TODO
/trunk/debian/patches/hasnochildren_means_noinferiors.patch
0,0 → 1,12
--- prayer-1.0.18.orig/prayer/dirlist.c
+++ prayer-1.0.18/prayer/dirlist.c
@@ -172,7 +172,8 @@
dl->next = NIL;
dl->name = pool_strdup(callback.pool, name);
- dl->isdir = (attributes & LATT_NOINFERIORS) ? NIL : T;
+ dl->isdir = (attributes & (LATT_NOINFERIORS | LATT_HASNOCHILDREN)) ?
+ NIL : T;
/* Insertion sort algorithm */
/trunk/debian/patches/ipv6.patch
0,0 → 1,508
--- prayer-1.0.18.orig/prayer/config.c
+++ prayer-1.0.18/prayer/config.c
@@ -1650,7 +1650,7 @@
if (!config_parse_rest(&option))
error = T;
- else if ((s = (strchr(option, ':')))) {
+ else if ((s = (strrchr(option, ':')))) {
*s++ = '\0';
if (!config_parse_number(&port, s))
error = T;
--- prayer-1.0.18.orig/prayer/ipaddr.c
+++ prayer-1.0.18/prayer/ipaddr.c
@@ -32,11 +32,7 @@
BOOL ipaddr_copy(struct ipaddr * dst, struct ipaddr * src)
{
- dst->version = src->version;
- dst->addr[0] = src->addr[0];
- dst->addr[1] = src->addr[1];
- dst->addr[2] = src->addr[2];
- dst->addr[3] = src->addr[3];
+ memcpy(dst, src, sizeof(struct ipaddr));
return (T);
}
@@ -55,19 +51,7 @@
if (addr1->version != addr2->version)
return (NIL);
- if (addr1->addr[0] != addr2->addr[0])
- return (NIL);
-
- if (addr1->addr[1] != addr2->addr[1])
- return (NIL);
-
- if (addr1->addr[2] != addr2->addr[2])
- return (NIL);
-
- if (addr1->addr[3] != addr2->addr[3])
- return (NIL);
-
- return (T);
+ return (memcmp(&addr1->addr, &addr2->addr, addr1->version == 6 ? 16 : 4) == 0);
}
/* ====================================================================== */
@@ -81,8 +65,7 @@
{
static char buf[64];
- sprintf(buf, "%d.%d.%d.%d",
- addr->addr[0], addr->addr[1], addr->addr[2], addr->addr[3]);
+ os_inet_ntop(addr->addr, addr->version, buf, 64);
return (buf);
}
@@ -96,7 +79,7 @@
{
char *result;
- if ((result = os_gethostbyaddr(addr->addr)))
+ if ((result = os_gethostbyaddr(addr->addr, addr->version)))
return (result);
return (ipaddr_text(addr));
@@ -116,39 +99,10 @@
BOOL ipaddr_parse(struct ipaddr * addr, char *text)
{
- char *next;
-
if (text == NIL)
return (NIL);
- /* IPv4 only for the moment */
- addr->version = 4;
-
- /* Parse first number */
- if (!(next = strchr(text, '.')))
- return (NIL);
- addr->addr[0] = atoi(text);
- text = next + 1;
-
- /* Parse second number */
- if (!(next = strchr(text, '.')))
- return (NIL);
- addr->addr[1] = atoi(text);
- text = next + 1;
-
- /* Parse third number */
- if (!(next = strchr(text, '.')))
- return (NIL);
- addr->addr[2] = atoi(text);
- text = next + 1;
-
- /* Parse forth number */
- if ((next = strchr(text, '.')))
- return (NIL);
- addr->addr[3] = atoi(text);
-
- /* Looks good */
- return (T);
+ return (os_inet_pton(text, addr));
}
/* ====================================================================== */
@@ -157,56 +111,63 @@
*
* Compare IP address to text list of form:
* ipaddr:
- * text: Text string of form "131.111.0.0/16 : 192.168.0.0/24".
+ * text: Text string of form "131.111.0.0/16 : 192.168.0.0/24 : 2001:12cd:1::/48".
+ * (There has to be a space on either side of the colon for it to
+ * separate two networks)
*
* Returns: T if addr matches list.
************************************************************************/
BOOL ipaddr_compare_list(struct ipaddr * ipaddr, char *text)
{
- char *next, *s, *alloc;
+ char *next = NULL, *s, *alloc;
+ int i;
unsigned long bits, mask;
struct ipaddr parsed;
alloc = text = pool_strdup(NIL, text);
while (text && *text) {
- if ((next = strchr(text, ':')))
- *next++ = '\0';
+ s = text;
+ while ((s = strchr(s, ':'))) {
+ if (*(s - 1) == ' ' || *(s + 1) == ' ') {
+ *(next = s) = '\0';
+ next++;
+ }
+ s++;
+ }
text = string_trim_whitespace(text);
if ((s = strchr(text, '/'))) {
*s++ = '\0';
bits = atoi(s);
- } else
- bits = 32;
-
- if (bits > 32)
- bits = 32;
-
- /* Create mask with appropriate number of bits set */
- mask = 0;
- while (bits > 0) {
- mask >>= 1;
- mask |= 0x80000000;
- bits--;
}
+ else
+ bits = 128; /* Doesn't matter if it's too big */
if (ipaddr_parse(&parsed, text)) {
- unsigned long a1;
- unsigned long a2;
-
- a1 = ((ipaddr->addr[0] << 24) + (ipaddr->addr[1] << 16) +
- (ipaddr->addr[2] << 8) + (ipaddr->addr[3]));
-
- a2 = ((parsed.addr[0] << 24) + (parsed.addr[1] << 16) +
- (parsed.addr[2] << 8) + (parsed.addr[3]));
-
- if ((a1 & mask) == (a2 & mask)) {
- free(alloc);
- return (T);
- }
+ if (parsed.version != ipaddr->version) {
+ text = next; continue;
+ }
+
+ for (i = 0; i < (parsed.version == 6 ? 4 : 1); i++) {
+ if (bits == 0) mask = 0;
+ else if (bits < 32) {
+ mask = (-1) << (32 - bits);
+ bits = 0;
+ }
+ else {
+ mask = -1;
+ bits -= 32;
+ }
+
+ if ((parsed.addr[i] & mask) != (ipaddr->addr[i] & mask)) {
+ text = next; continue;
+ }
+ }
+ free(alloc);
+ return (T);
}
text = next;
}
@@ -225,11 +187,11 @@
void ipaddr_send_iostream(struct ipaddr *addr, struct iostream *stream)
{
+ int i;
ioputc(addr->version, stream);
- ioputc(addr->addr[0], stream);
- ioputc(addr->addr[1], stream);
- ioputc(addr->addr[2], stream);
- ioputc(addr->addr[3], stream);
+ for (i = 0; i < (addr->version == 6 ? 16 : 4); i++) {
+ ioputc(((char *)addr->addr)[i], stream);
+ }
}
/* ====================================================================== */
@@ -246,13 +208,13 @@
if ((c = iogetc(stream)) != EOF) {
addr->version = (unsigned char) c;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < (addr->version == 6 ? 16 : 4); i++) {
if ((c = iogetc(stream)) == EOF) {
rc = NIL;
break;
}
- addr->addr[i] = (unsigned char) c;
+ ((char *)addr->addr)[i] = (unsigned char) c;
}
}
@@ -279,9 +241,14 @@
ipaddr_set(struct ipaddr *ipaddr, unsigned long version,
unsigned char *addr)
{
- if (version != 4)
- log_fatal("ipaddr_set(): IPv4 only supported at the moment!");
+ if (version != 4 && version != 6)
+ log_fatal("ipaddr_set(): IPv4 and IPv6 only supported!");
+
+ ipaddr->version = version;
+ memcpy(ipaddr->addr, addr, version == 6 ? 16 : 4);
+ if (ipaddr->addr[0] == 0 && ipaddr->addr[1] == 0 && ipaddr->addr[2] == 0xffff) {
+ ipaddr->addr[0] = ipaddr->addr[3];
+ ipaddr->version = 4;
+ }
- ipaddr->version = 4;
- memcpy(ipaddr->addr, addr, 4);
}
--- prayer-1.0.18.orig/prayer/ipaddr.h
+++ prayer-1.0.18/prayer/ipaddr.h
@@ -8,7 +8,7 @@
struct ipaddr {
unsigned long version;
- unsigned char addr[4];
+ unsigned long addr[4];
};
struct ipaddr *ipaddr_create(struct pool *pool);
--- prayer-1.0.18.orig/prayer/os.h
+++ prayer-1.0.18/prayer/os.h
@@ -24,7 +24,11 @@
int os_socket_nonblocking(int sockfd);
-char *os_gethostbyaddr(void *addr);
+char *os_gethostbyaddr(void *addr, unsigned int version);
+
+int os_inet_ntop(void *addr, unsigned long version, char *buf, unsigned long buflen);
+
+int os_inet_pton(char *str, struct ipaddr *addr);
void os_child_reaper();
--- prayer-1.0.18.orig/prayer/os_linux.c
+++ prayer-1.0.18/prayer/os_linux.c
@@ -13,14 +13,11 @@
#include <sys/un.h>
#include <sys/resource.h>
#include <netinet/in.h>
-#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <signal.h>
#include <netdb.h>
#include <sys/file.h>
-#include <openssl/rand.h>
-
/* ====================================================================== */
BOOL os_socketpair(int *sockfd)
@@ -63,33 +60,28 @@
int os_connect_inet_socket(char *host, unsigned long port)
{
- struct hostent *hostent;
- struct sockaddr_in serv_addr;
+ struct addrinfo *first_ai, *ai;
+ char port_str[12];
int sockfd;
- /* Open the socket */
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- return (-1);
-
- /* Set up the socket */
- bzero((char *) &serv_addr, sizeof(serv_addr));
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_port = htons(port);
-
- if ((hostent = gethostbyname(host)) == NIL) {
- close(sockfd);
- return (-1);
- }
- bcopy(hostent->h_addr, (char *) &serv_addr.sin_addr,
- hostent->h_length);
-
- if (connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr))
- < 0) {
- close(sockfd);
- return (-1);
- }
-
- return (sockfd);
+ sprintf(port_str, "%lu", port);
+ if (getaddrinfo(host, port_str, NULL, &first_ai)) {
+ return (-1);
+ }
+ for (ai = first_ai; ai->ai_next; ai = ai->ai_next) {
+ /* Open the socket */
+ if ((sockfd = socket(ai->ai_family, SOCK_STREAM, 0)) < 0) {
+ break;
+ }
+ if (connect(sockfd, (struct sockaddr *) ai->ai_addr, ai->ai_addrlen) < 0) {
+ close(sockfd);
+ break;
+ }
+ freeaddrinfo(first_ai);
+ return (sockfd);
+ }
+ freeaddrinfo(first_ai);
+ return (-1);
}
/* ====================================================================== */
@@ -150,9 +141,39 @@
int os_bind_inet_socket(unsigned long port, char *interface)
{
int i, sockfd;
- struct sockaddr_in serv_addr;
+ struct sockaddr_storage serv_addr;
+ struct addrinfo *ai;
+
+ bzero((char *) &serv_addr, sizeof(serv_addr));
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ if (interface) {
+ if (getaddrinfo(interface, NULL, NULL, &ai)) {
+ log_panic
+ ("[os_bind_inet_socket()] Failed to lookup hostname: %s",
+ interface);
+ return -1;
+ }
+#if 0 /* Use the first interface address; don't panic if both IPv6
+ and IPv4 addresses are returned. */
+ if (hostent->h_addr_list[1]) {
+ log_panic
+ ("[os_bind_inet_socket()] Ambiguous interface name: %s",
+ interface);
+ return (-1);
+ }
+#endif
+ memcpy(&serv_addr, ai->ai_addr, ai->ai_addrlen);
+ freeaddrinfo(ai);
+ }
+ else {
+ serv_addr.ss_family = AF_INET6;
+ ((struct sockaddr_in6*)&serv_addr)->sin6_addr = in6addr_any;
+ }
+ /* This isn't formally correct, but *in fact*, sin6_port is at the
+ same place as sin_port, so it works. */
+ ((struct sockaddr_in6*)&serv_addr)->sin6_port = htons(port);
+
+ if ((sockfd = socket(serv_addr.ss_family, SOCK_STREAM, 0)) < 0) {
log_panic("[os_bind_inet_socket()] socket() failed, %s",
strerror(errno));
return (-1);
@@ -168,41 +189,6 @@
return (-1);
}
- bzero((char *) &serv_addr, sizeof(serv_addr));
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_port = htons(port);
- serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
-
- /* Calculate serv_addr for specific interface to bind to */
- if (interface) {
- struct hostent *hostent;
- struct in_addr *s;
-
- if (!(hostent = gethostbyname(interface))) {
- log_panic
- ("[os_bind_inet_socket()] Failed to lookup hostname: %s",
- interface);
-
- return (-1);
- }
-
- if (hostent->h_addr_list[1]) {
- log_panic
- ("[os_bind_inet_socket()] Ambiguous interface name: %s",
- interface);
- return (-1);
- }
-
- if (!(s = ((struct in_addr *)hostent->h_addr_list[0]))) {
- log_panic("[os_bind_inet_socket()] Invalid interface name: %s",
- interface);
- return (-1);
- }
-
- /* s has four bytes in network byte order */
- memcpy(&serv_addr.sin_addr.s_addr, s, sizeof(struct in_addr));
- }
-
/* bind() as Internet domain socket */
if (bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) <
0) {
@@ -255,8 +242,8 @@
int os_accept_inet(int sockfd, struct ipaddr *ipaddr)
{
- struct sockaddr_in addr;
- socklen_t len = (socklen_t) sizeof(struct sockaddr_in);
+ struct sockaddr_storage addr;
+ socklen_t len = (socklen_t) sizeof(addr);
int newsockfd;
do {
@@ -271,8 +258,12 @@
return (-1);
}
- if (ipaddr)
- ipaddr_set(ipaddr, 4, (unsigned char *) &addr.sin_addr);
+ if (ipaddr) {
+ if (addr.ss_family == AF_INET6)
+ ipaddr_set(ipaddr, 6, (unsigned char *)&((struct sockaddr_in6*)&addr)->sin6_addr);
+ else
+ ipaddr_set(ipaddr, 4, (unsigned char *)&((struct sockaddr_in*)&addr)->sin_addr);
+ }
/* Set close on exec so subprocesses can't interfere */
if (fcntl(newsockfd, F_SETFD, FD_CLOEXEC) < 0) {
@@ -322,9 +313,14 @@
/* Convert IPv4 address into text form */
-char *os_gethostbyaddr(void *opaque)
+char *os_gethostbyaddr(void *opaque, unsigned int version)
{
- struct hostent *hostent = gethostbyaddr(opaque, 4, AF_INET);
+ struct hostent *hostent;
+
+ if (version == 6)
+ hostent = gethostbyaddr(opaque, 16, AF_INET6);
+ else
+ hostent = gethostbyaddr(opaque, 4, AF_INET);
if (hostent && hostent->h_name && hostent->h_name[0])
return (hostent->h_name);
@@ -332,6 +328,32 @@
return (NIL);
}
+int os_inet_ntop(void *addr, unsigned long version, char *buf, unsigned long buflen) {
+ if (version == 6) {
+ if (inet_ntop(AF_INET6, addr, buf, buflen))
+ return (T);
+ }
+ else {
+ if (inet_ntop(AF_INET, addr, buf, buflen))
+ return (T);
+ }
+ return (NIL);
+}
+
+int os_inet_pton(char *str, struct ipaddr *addr) {
+ unsigned char buf[16];
+
+ if (inet_pton(AF_INET6, str, buf)) {
+ ipaddr_set(addr, 6, buf);
+ return (T);
+ }
+ else if (inet_pton(AF_INET, str, buf)) {
+ ipaddr_set(addr, 4, buf);
+ return (T);
+ }
+ return (NIL);
+}
+
/* ====================================================================== */
/* Trivial SIG_CLD handler to prevent zombies from hanging around */
/trunk/debian/patches/includes.patch
0,0 → 1,26
Index: prayer-1.0.18/prayer/prayer_session.h
===================================================================
--- prayer-1.0.18.orig/prayer/prayer_session.h 2007-03-10 18:50:09.676882377 +0100
+++ prayer-1.0.18/prayer/prayer_session.h 2007-03-10 18:50:11.007049496 +0100
@@ -27,7 +27,7 @@
extern int errno; /* just in case */
-#include "c-client.h"
+#include <c-client.h>
#define PRAYER_FULL_HDRS
#include "prayer_shared.h"
Index: prayer-1.0.18/prayer/cdb.c
===================================================================
--- prayer-1.0.18.orig/prayer/cdb.c 2007-03-10 18:51:20.845827434 +0100
+++ prayer-1.0.18/prayer/cdb.c 2007-03-10 18:51:25.766446163 +0100
@@ -63,7 +63,7 @@
#include <unistd.h>
#include <sys/stat.h>
-#include "mail.h"
+#include "common.h"
#include "cdb.h"
#define CDB_HASH_SPLIT 256 /* num pieces the hash table is split into */
/trunk/debian/patches/session_unix_bugs.patch
0,0 → 1,20
--- prayer-1.0.18.orig/prayer/session_unix.c
+++ prayer-1.0.18/prayer/session_unix.c
@@ -56,7 +56,7 @@
}
if (config->fix_client_ipaddr
- && ipaddr_compare(session->ipaddr, &remote)) {
+ && !ipaddr_compare(session->ipaddr, &remote)) {
struct buffer *b = request->write_buffer;
html_common_start(config, b, "Security Alert");
@@ -69,7 +69,7 @@
response_send(request);
log_misc
("HTTP Request from invalid IP address %s to running session %s",
- &remote, session->url_prefix_asession);
+ ipaddr_text(&remote), session->url_prefix_asession);
return;
}
/trunk/debian/patches/utf8.patch
0,0 → 1,1507
This patch adds support for UTF-8 and modified UTF-7. Functions are in
the new utf8.c. The patch adds calls to utf8_to_imaputf7() or
utf8_from_imaputf7() wherever a folder name is handled in the code. In
addition, it changes prayer to use UTF-8 in all HTML output as well as
in composition of messages.
Index: prayer-1.0.18/prayer/Makefile
===================================================================
--- prayer-1.0.18.orig/prayer/Makefile 2007-03-10 19:39:29.563948453 +0100
+++ prayer-1.0.18/prayer/Makefile 2007-03-10 19:39:30.294042473 +0100
@@ -127,7 +127,7 @@ SESSION_SUPPORT_OBJS = \
abook.o lookup.o role.o dictionary.o \
options.o rfc1522.o banner.o favourite.o wrap.o portlist.o \
account.o account_msshell.o account_sieve.o account_support.o \
- sieve.o filter.o checksum.o
+ sieve.o filter.o checksum.o utf8.o
ifeq ($(strip $(SESSION_NEEDS_DB)), true)
SESSION_SUPPORT_OBJS += mydb_db3.o
Index: prayer-1.0.18/prayer/cmd_change.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_change.c 2007-03-10 19:38:53.659325192 +0100
+++ prayer-1.0.18/prayer/cmd_change.c 2007-03-10 19:39:30.344048912 +0100
@@ -16,7 +16,7 @@ void cmd_change(struct session *session)
if (request->method == POST) {
request_decode_post(request);
- if (!(name = assoc_lookup(request->form, "folder"))) {
+ if (!(name = utf8_to_imaputf7(request->pool, assoc_lookup(request->form, "folder")))) {
session_redirect(session, request, "error");
return;
}
@@ -30,7 +30,8 @@ void cmd_change(struct session *session)
}
if (!session_streams_change(session, name)) {
- session_message(session, "Unable to switch to folder: %s", name);
+ session_message(session, "Unable to switch to folder: %s",
+ utf8_from_imaputf7(request->pool, name));
session_redirect(session, request, "restart");
return;
}
@@ -47,7 +48,7 @@ void cmd_change(struct session *session)
}
session_message(session, "Switched to mailbox: %s",
- session->foldername);
+ utf8_from_imaputf7(request->pool, session->foldername));
session_log(session, "[cmd_change] Switched to mailbox: %s",
session->foldername);
Index: prayer-1.0.18/prayer/cmd_compose.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_compose.c 2007-03-10 19:38:53.719332917 +0100
+++ prayer-1.0.18/prayer/cmd_compose.c 2007-03-10 19:39:30.384054064 +0100
@@ -244,7 +244,7 @@ static BOOL cmd_compose_generate_postpon
strlen(string), string, NIL);
string =
- string_prune(request->pool, string, config->list_addr_maxlen);
+ utf8_prune(request->pool, string, config->list_addr_maxlen);
bputs(b, "<td>" CRLF);
html_quote_string(b, string);
@@ -267,7 +267,7 @@ static BOOL cmd_compose_generate_postpon
rfc1522_decode(pool_alloc(request->pool, strlen(string)),
strlen(string), string, NIL);
- string = string_prune(request->pool, string,
+ string = utf8_prune(request->pool, string,
config->list_subject_maxlen);
} else
string = "(No subject)";
Index: prayer-1.0.18/prayer/cmd_copy.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_copy.c 2007-03-10 19:38:53.769339356 +0100
+++ prayer-1.0.18/prayer/cmd_copy.c 2007-03-10 19:39:30.404056640 +0100
@@ -95,7 +95,7 @@ generate_directory_line(struct session *
html_session_bprintf(session, b,
"<td><a href=\"", "\">" CRLF, "copy?cwd=%s",
name);
- html_quote_string(b, dir);
+ html_quote_string(b, utf8_from_imaputf7(pool, dir));
bprintf(b, "</a></td>" CRLF);
bputs(b, "</tr>" CRLF);
@@ -127,7 +127,7 @@ generate_favourite_folder_line(struct se
html_session_bprintf(session, b,
"<td><a href=\"", "\">" CRLF, "copy_msg/%s",
name);
- html_quote_string(b, folder);
+ html_quote_string(b, utf8_from_imaputf7(pool, folder));
bprintf(b, "</a></td>" CRLF);
bputs(b, "</tr>" CRLF);
@@ -159,7 +159,7 @@ generate_folder_line(struct session *ses
html_session_bprintf(session, b,
"<td><a href=\"", "\">" CRLF, "copy_msg/%s",
name);
- html_quote_string(b, folder);
+ html_quote_string(b, utf8_from_imaputf7(pool, folder));
bprintf(b, "</a></td>" CRLF);
bprintf(b, "</tr>" CRLF);
@@ -209,8 +209,8 @@ html_folderlist(struct session *session,
bputs(b, "<tr>");
bputs(b, "<td>");
bputs(b, "<table><tr><td>" CRLF);
- html_form_field(b, "Directory", "cwd", session->cwd, 32);
- html_form_field(b, "Filter", "filter", session->dir_filter, 12);
+ html_form_field(b, "Directory", "cwd", utf8_from_imaputf7(pool, session->cwd), 32);
+ html_form_field(b, "Filter", "filter", utf8_from_imaputf7(pool, session->dir_filter), 12);
html_form_submit(b, "submit", "Apply");
bputs(b, "</td></tr></table>" CRLF);
bputs(b, "<td align=\"right\"><table><tr><td>" CRLF);
Index: prayer-1.0.18/prayer/cmd_copy_msg.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_copy_msg.c 2007-03-10 19:38:53.829347082 +0100
+++ prayer-1.0.18/prayer/cmd_copy_msg.c 2007-03-10 19:39:30.484066944 +0100
@@ -125,12 +125,13 @@ void cmd_copy_msg(struct session *sessio
/* Keep current message */
if (count > 1) {
session_message(session, "Copied %lu messages to %s", count,
- mailbox);
+ utf8_from_imaputf7(request->pool, mailbox));
session_log(session,
"[cmd_copy_msg] Copied %lu messages to %s", count,
mailbox);
} else if (count == 1) {
- session_message(session, "Copied 1 message to %s", mailbox);
+ session_message(session, "Copied 1 message to %s",
+ utf8_from_imaputf7(request->pool, mailbox));
session_log(session, "[cmd_copy_msg] Copied 1 message to %s",
mailbox);
} else {
@@ -152,9 +153,8 @@ void cmd_copy_msg(struct session *sessio
next = msgmap_value(zm, zm_offset + 1);
else {
/* No next message */
- session_message(session,
- "Copied message %lu to \"%s\", no more messages",
- msgno, mailbox);
+ session_message(session, "Copied message %lu to \"%s\", no more messages",
+ msgno, utf8_from_imaputf7(request->pool, mailbox));
session_log(session, "[cmd_copy_msg] Copied message %lu to %s",
msgno, mailbox);
session->current = msgno;
@@ -162,9 +162,8 @@ void cmd_copy_msg(struct session *sessio
return;
}
- session_message(session,
- "Copied message %lu to \"%s\", displaying %lu out of %lu",
- msgno, mailbox, next, zm->nmsgs);
+ session_message(session, "Copied message %lu to \"%s\", displaying %lu out of %lu",
+ msgno, utf8_from_imaputf7(request->pool, mailbox), next, zm->nmsgs);
session_log(session, "[cmd_copy_msg] Copied message %lu to %s",
msgno, mailbox);
Index: prayer-1.0.18/prayer/cmd_create.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_create.c 2007-03-10 19:38:53.919358672 +0100
+++ prayer-1.0.18/prayer/cmd_create.c 2007-03-10 19:39:30.554075959 +0100
@@ -21,7 +21,8 @@ void cmd_create(struct session *session)
request_decode_get(request);
- if ((mailbox = assoc_lookup(request->form, "name")) == NIL) {
+ if ((mailbox = utf8_to_imaputf7(request->pool,
+ assoc_lookup(request->form, "name"))) == NIL) {
session_redirect(session, request, "error");
return;
}
@@ -58,12 +59,13 @@ void cmd_create(struct session *session)
if (ml_have_error()) {
session_message(session,
"Failed to create directory: %s - %s",
- path, ml_errmsg());
+ utf8_from_imaputf7(request->pool, path), ml_errmsg());
session_log(session,
"[cmd_create] Failed to create directory: %s",
path);
} else {
- session_message(session, "Created directory: %s", path);
+ session_message(session, "Created directory: %s",
+ utf8_from_imaputf7(request->pool, path));
session_log(session,
"[cmd_create] Created directory: %s", path);
dircache_add(session->dircache, path, T);
@@ -72,12 +74,13 @@ void cmd_create(struct session *session)
if (ml_have_error()) {
session_message(session,
"Failed to create mailbox: %s - %s",
- path, ml_errmsg());
+ utf8_from_imaputf7(request->pool, path), ml_errmsg());
session_log(session,
"[cmd_create] Failed to create mailbox: %s",
path);
} else {
- session_message(session, "Created mailbox: %s", path);
+ session_message(session, "Created mailbox: %s",
+ utf8_from_imaputf7(request->pool, path));
session_log(session, "[cmd_create] Created mailbox: %s",
path);
dircache_add(session->dircache, path, NIL);
Index: prayer-1.0.18/prayer/cmd_dir_check.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_dir_check.c 2007-03-10 19:38:53.979366397 +0100
+++ prayer-1.0.18/prayer/cmd_dir_check.c 2007-03-10 19:39:30.584079823 +0100
@@ -43,7 +43,7 @@ void cmd_dir_check(struct session *sessi
session_message(session,
"Refreshed directory cache for directory \"%s\" at %s",
- session->cwd, current_time());
+ utf8_from_imaputf7(request->pool, session->cwd), current_time());
dircache_invalidate(session, session->cwd);
if (request->argc >= 2)
Index: prayer-1.0.18/prayer/cmd_display.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_display.c 2007-03-10 19:38:54.049375411 +0100
+++ prayer-1.0.18/prayer/cmd_display.c 2007-03-10 19:39:30.644087551 +0100
@@ -567,9 +567,11 @@ show_textpart(struct session *session, M
struct request *request = session->request;
struct buffer *b = request->write_buffer;
char *init_msg, *decode_msg;
+ char *charset = "ISO-8859-1";
unsigned long len;
BODY *body = NIL;
BOOL show_html = NIL;
+ PARAMETER *parameter;
if (!(body = ml_body(session, stream, msgno, section)))
return(NIL);
@@ -580,6 +582,13 @@ show_textpart(struct session *session, M
return(NIL);
}
+ for (parameter = body->parameter; parameter; parameter = parameter->next) {
+ if (strcasecmp(parameter->attribute, "charset") == 0) {
+ charset = parameter->value;
+ break;
+ }
+ }
+
if (!(init_msg = ml_fetchbody(session, stream, msgno, section, &len)))
return(NIL);
@@ -637,10 +646,10 @@ show_textpart(struct session *session, M
if (show_html) {
if (decode_msg == init_msg)
decode_msg = strdup(init_msg);
- html_secure(session, b, decode_msg);
+ html_secure(session, b, utf8_from_string(request->pool, charset, decode_msg, len));
} else {
bprintf(b, "<pre>" CRLF);
- wrap_line_html(session, b, decode_msg, 80);
+ wrap_line_html(session, b, utf8_from_string(request->pool, charset, decode_msg, len), 80);
bprintf(b, "</pre>" CRLF);
}
Index: prayer-1.0.18/prayer/cmd_favourites.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_favourites.c 2007-03-10 19:38:54.109383138 +0100
+++ prayer-1.0.18/prayer/cmd_favourites.c 2007-03-10 19:39:30.664090126 +0100
@@ -104,7 +104,7 @@ generate_directory_line(struct session *
html_session_bprintf(session, b, "<a href=\"", "\">" CRLF,
"favourites?cwd=%s", name);
- html_quote_string(b, dir);
+ html_quote_string(b, utf8_from_imaputf7(pool, dir));
bprintf(b, "</a></td>" CRLF);
bputs(b, "<td>&nbsp;</td>" CRLF);
bputs(b, "<td>&nbsp;</td>" CRLF);
@@ -134,7 +134,7 @@ generate_favourite_folder_line(struct se
bputs(b, "</td>" CRLF);
bputs(b, "<td nowrap>" CRLF);
- html_quote_string(b, folder);
+ html_quote_string(b, utf8_from_imaputf7(pool, folder));
bputs(b, "</td>" CRLF);
html_textlink_mailbox_table(session, b, "unsubscribe", name,
@@ -170,7 +170,7 @@ generate_folder_line(struct session *ses
bputs(b, "</td>" CRLF);
bprintf(b, "<td nowrap>" CRLF);
- html_quote_string(b, folder);
+ html_quote_string(b, utf8_from_imaputf7(pool, folder));
bprintf(b, "</td>" CRLF);
html_textlink_mailbox_table(session, b, "subscribe", name,
@@ -208,8 +208,8 @@ html_folderlist(struct session *session,
bputs(b, "<tr>");
bputs(b, "<td>");
bputs(b, "<table><tr><td>" CRLF);
- html_form_field(b, "Directory", "cwd", session->cwd, 32);
- html_form_field(b, "Filter", "filter", session->dir_filter, 12);
+ html_form_field(b, "Directory", "cwd", utf8_from_imaputf7(pool, session->cwd), 32);
+ html_form_field(b, "Filter", "filter", utf8_from_imaputf7(pool, session->dir_filter), 12);
html_form_submit(b, "submit", "Apply");
bputs(b, "</td></tr></table>" CRLF);
bputs(b, "</td>" CRLF);
Index: prayer-1.0.18/prayer/cmd_filter_select.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_filter_select.c 2007-03-10 19:38:54.159389577 +0100
+++ prayer-1.0.18/prayer/cmd_filter_select.c 2007-03-10 19:39:30.694093991 +0100
@@ -68,7 +68,7 @@ generate_directory_line(struct session *
html_session_bprintf(session, b, "<td><a href=\"", "\">" CRLF,
"filter_select?cwd=%s", name);
- html_quote_string(b, dir);
+ html_quote_string(b, utf8_from_imaputf7(pool, dir));
bprintf(b, "</a></td>" CRLF);
bputs(b, "</tr>" CRLF);
@@ -93,7 +93,7 @@ generate_favourite_folder_line(struct se
bputs(b, "</td>" CRLF);
bputs(b, "<td>" CRLF);
- html_quote_string(b, folder);
+ html_quote_string(b, utf8_from_imaputf7(pool, folder));
bputs(b, "</td>" CRLF);
html_textlink_mailbox_table(session, b, "filter_mbox/copy", name,
@@ -124,7 +124,7 @@ generate_folder_line(struct session *ses
bputs(b, "</td>" CRLF);
bputs(b, "<td>" CRLF);
- html_quote_string(b, folder);
+ html_quote_string(b, utf8_from_imaputf7(pool, folder));
bputs(b, "</td>" CRLF);
html_textlink_mailbox_table(session, b, "filter_mbox/copy", name,
@@ -159,8 +159,8 @@ html_folderlist(struct session *session,
/* Change directory form, including back button */
html_form_start(session, b, "GET", "filter_select");
- html_form_field(b, "Directory", "cwd", session->cwd, 32);
- html_form_field(b, "Filter", "filter", session->dir_filter, 12);
+ html_form_field(b, "Directory", "cwd", utf8_from_imaputf7(pool, session->cwd), 32);
+ html_form_field(b, "Filter", "filter", utf8_from_imaputf7(pool, session->dir_filter), 12);
html_form_submit(b, "sub_apply", "Apply");
html_form_submit(b, "sub_cancel", "Cancel");
html_form_end(b);
Index: prayer-1.0.18/prayer/cmd_folders.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_folders.c 2007-03-10 19:38:54.249401166 +0100
+++ prayer-1.0.18/prayer/cmd_folders.c 2007-03-10 19:39:30.734099143 +0100
@@ -95,7 +95,7 @@ generate_directory_line(struct session *
html_session_bprintf(session, b, "<td><a href=\"", "\">" CRLF,
"folders?cwd=%s", name);
- html_quote_string(b, dir);
+ html_quote_string(b, utf8_from_imaputf7(pool, dir));
bprintf(b, "</a></td>" CRLF);
html_textlink_mailbox_table(session, b, "rename", name, "Rename");
@@ -127,7 +127,7 @@ generate_folder_line(struct session *ses
html_session_bprintf(session, b, "<td nowrap><a href=\"", "\">" CRLF,
"change/%s", name);
- html_quote_string(b, folder);
+ html_quote_string(b, utf8_from_imaputf7(pool, folder));
bprintf(b, "</a></td>" CRLF);
if (strcmp(name, "INBOX") != 0) {
@@ -165,8 +165,8 @@ html_folderlist(struct session *session,
else
bputs(b, "<tr>");
bputs(b, "<td><table><tr><td>" CRLF);
- html_form_field(b, "Directory", "cwd", session->cwd, 32);
- html_form_field(b, "Filter", "filter", session->dir_filter, 12);
+ html_form_field(b, "Directory", "cwd", utf8_from_imaputf7(pool, session->cwd), 32);
+ html_form_field(b, "Filter", "filter", utf8_from_imaputf7(pool, session->dir_filter), 12);
html_form_submit(b, "submit", "Apply");
bputs(b, "</td></tr></table></td>" CRLF);
bputs(b, "<td align=\"right\"><table><tr>" CRLF);
@@ -267,7 +267,7 @@ void cmd_folders(struct session *session
request_decode_get(request);
h = request->form;
- if ((s = assoc_lookup(h, "cwd"))) {
+ if ((s = utf8_to_imaputf7(request->pool, assoc_lookup(h, "cwd")))) {
string_canon_decode(s);
if (string_filename_valid(s))
@@ -277,7 +277,7 @@ void cmd_folders(struct session *session
"Path contained illegal characters");
}
- if ((s = assoc_lookup(h, "filter"))
+ if ((s = utf8_to_imaputf7(request->pool, assoc_lookup(h, "filter")))
&& (strcmp(s, session->dir_filter) != 0))
string_strdup(&session->dir_filter, s);
}
Index: prayer-1.0.18/prayer/cmd_forward1.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_forward1.c 2007-03-10 19:38:54.309408891 +0100
+++ prayer-1.0.18/prayer/cmd_forward1.c 2007-03-10 19:39:30.744100430 +0100
@@ -157,6 +157,8 @@ add_text(struct session *session,
char *init_msg, *decode_msg, *type;
BODY *body = NIL;
char *section = "1";
+ PARAMETER *parameter;
+ char *charset = "ISO-8859-1";
if (!(text = ml_fetch_header(session, stream, msgno,
NIL, hdrslist, &len, 0)))
@@ -204,6 +206,13 @@ add_text(struct session *session,
} else
section = "1";
+ for (parameter = body->parameter; parameter; parameter = parameter->next) {
+ if (strcasecmp(parameter->attribute, "charset") == 0) {
+ charset = parameter->value;
+ break;
+ }
+ }
+
if (!(init_msg = ml_fetchbody(session, stream, msgno, section, &len)))
return (NIL);
Index: prayer-1.0.18/prayer/cmd_list.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_list.c 2007-03-10 19:38:54.379417906 +0100
+++ prayer-1.0.18/prayer/cmd_list.c 2007-03-10 19:39:30.794106870 +0100
@@ -143,7 +143,7 @@ cmd_list_toolbar_hdr(struct session *ses
bputs(b, "</tr></table></td>" CRLF);
bputs(b, "<td width=\"33%\" align=\"center\"><strong>\"");
- html_quote_string(b, session->foldername);
+ html_quote_string(b, utf8_from_imaputf7(session->request->pool, session->foldername));
bputs(b, "\" with ");
bprintf(b, "%lu%s %s" CRLF, count, marked, messages);
bputs(b, "</strong></td>" CRLF);
@@ -378,7 +378,7 @@ cmd_list_msg(struct session *session,
(char *) rfc1522_decode(pool_alloc(request->pool, strlen(string)),
strlen(string), string, NIL);
- string = string_prune(request->pool, string, config->list_addr_maxlen);
+ string = utf8_prune(request->pool, string, config->list_addr_maxlen);
if (use_to)
string = pool_strcat(request->pool, "To: ", string);
@@ -400,7 +400,7 @@ cmd_list_msg(struct session *session,
rfc1522_decode(pool_alloc(request->pool, strlen(string)),
strlen(string), string, NIL);
- string = string_prune(request->pool, string,
+ string = utf8_prune(request->pool, string,
config->list_subject_maxlen);
} else
string = "(No subject)";
Index: prayer-1.0.18/prayer/cmd_preferred.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_preferred.c 2007-03-10 19:38:54.429424344 +0100
+++ prayer-1.0.18/prayer/cmd_preferred.c 2007-03-10 19:39:30.824110733 +0100
@@ -22,7 +22,8 @@ void cmd_preferred(struct session *sessi
if (string_filename_valid(name)) {
favourite_preferred(fl, name);
options->save = T;
- session_message(session, "Making %s preferred folder", name);
+ session_message(session, "Making %s preferred folder",
+ utf8_from_imaputf7(request->pool, name));
} else
session_message(session,
"String contained illegal characters");
Index: prayer-1.0.18/prayer/cmd_rename.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_rename.c 2007-03-10 19:38:54.499433358 +0100
+++ prayer-1.0.18/prayer/cmd_rename.c 2007-03-10 19:39:30.844113310 +0100
@@ -63,7 +63,7 @@ generate_directory_line(struct session *
bprintf(b, "</a></td>" CRLF);
html_session_bprintf(session, b, "<td><a href=\"", "\">" CRLF,
"rename?cwd=%s", name);
- html_quote_string(b, dir);
+ html_quote_string(b, utf8_from_imaputf7(pool, dir));
bprintf(b, "</a></td></tr>" CRLF);
}
@@ -84,7 +84,7 @@ generate_folder_line(struct session *ses
html_icon(session, b, "dir.gif", "[mailbox]");
bputs(b, "</a></td>" CRLF);
bputs(b, "<td><a>" CRLF);
- html_quote_string(b, folder);
+ html_quote_string(b, utf8_from_imaputf7(pool, folder));
bputs(b, "</a></td></tr>" CRLF);
}
@@ -107,7 +107,7 @@ rename_html_folderlist(struct session *s
if (session->rename_foldername)
bprintf(b,
"<h2 align=\"center\">Rename folder %s to ...</h2>" CRLF,
- session->rename_foldername);
+ utf8_from_imaputf7(pool, session->rename_foldername));
/* Change directory form, including back button */
html_form_start(session, b, "GET", "rename");
@@ -118,8 +118,8 @@ rename_html_folderlist(struct session *s
else
bputs(b, "<tr>");
bputs(b, "<td>" CRLF);
- html_form_field(b, "Directory", "cwd", session->cwd, 32);
- html_form_field(b, "Filter", "filter", session->dir_filter, 12);
+ html_form_field(b, "Directory", "cwd", utf8_from_imaputf7(pool, session->cwd), 32);
+ html_form_field(b, "Filter", "filter", utf8_from_imaputf7(pool, session->dir_filter), 12);
html_form_submit(b, "submit", "Apply");
bputs(b, "</td></tr></table>" CRLF);
html_form_end(b);
Index: prayer-1.0.18/prayer/cmd_rename_item.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_rename_item.c 2007-03-10 19:38:54.569442372 +0100
+++ prayer-1.0.18/prayer/cmd_rename_item.c 2007-03-10 19:39:30.864115885 +0100
@@ -29,7 +29,7 @@ void cmd_rename_item(struct session *ses
}
if (!(session->rename_foldername &&
- (newname = assoc_lookup(request->form, "name")))) {
+ (newname = utf8_to_imaputf7(pool, assoc_lookup(request->form, "name"))))) {
session_redirect(session, request, "folders");
return;
}
@@ -70,11 +70,13 @@ void cmd_rename_item(struct session *ses
if (ml_have_error()) {
session_message(session,
"Failed to rename mailbox: %s - %s",
- session->rename_foldername, ml_errmsg());
+ utf8_from_imaputf7(pool, session->rename_foldername),
+ ml_errmsg());
} else {
session_message(session,
"Renamed mailbox %s to be %s",
- session->rename_foldername, newname);
+ utf8_from_imaputf7(pool, session->rename_foldername),
+ newname);
dircache_rename(session->dircache, session->rename_foldername,
newname);
}
Index: prayer-1.0.18/prayer/cmd_reply2.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_reply2.c 2007-03-10 19:38:54.619448812 +0100
+++ prayer-1.0.18/prayer/cmd_reply2.c 2007-03-10 19:39:30.894119749 +0100
@@ -51,6 +51,8 @@ add_text(struct session *session, struct
char *init_msg, *decode_msg, *type;
unsigned long len;
char *text, *s;
+ PARAMETER *parameter;
+ char *charset = "ISO-8859-1";
if ((body = ml_body(session, stream, msgno, "1")) == NIL)
return(NIL);
@@ -91,6 +93,13 @@ add_text(struct session *session, struct
return(T);
}
+ for (parameter = body->parameter; parameter; parameter = parameter->next) {
+ if (strcasecmp(parameter->attribute, "charset") == 0) {
+ charset = parameter->value;
+ break;
+ }
+ }
+
/* Got a valid text section to display */
if (!(init_msg=ml_fetchbody(session, stream, msgno, section, &len)))
return(NIL);
@@ -133,11 +142,11 @@ add_text(struct session *session, struct
struct buffer *b = buffer_create(pool, 8192);
if (decode_msg == init_msg)
decode_msg = strdup(init_msg);
- html_secure_strip_all(b, decode_msg);
+ html_secure_strip_all(b, utf8_from_string(pool, charset, decode_msg, len));
text = buffer_fetch(b, 0, buffer_size(b), NIL);
} else
- text = decode_msg;
+ text = utf8_from_string(pool, charset, decode_msg, len);
bputs(b, ">");
for (s = text; *s;) {
Index: prayer-1.0.18/prayer/cmd_rm.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_rm.c 2007-03-10 19:38:54.669455249 +0100
+++ prayer-1.0.18/prayer/cmd_rm.c 2007-03-10 19:39:30.914122325 +0100
@@ -32,16 +32,20 @@ void cmd_rm(struct session *session)
bprintf(b,
"<h2 align=\"center\">Confirm directory deletion: \"%s\"</h2>"
CRLF,
- string_canon_decode(pool_strdup
- (request->pool, request->argv[2])));
+ utf8_from_imaputf7(request->pool,
+ string_canon_decode(pool_strdup
+ (request->pool,
+ request->argv[2]))));
} else {
html_start(session, b, "Confirm Mail folder deletion");
bprintf(b,
"<h2 align=\"center\">Confirm folder deletion: \"%s\"</h2>"
CRLF,
- string_canon_decode(pool_strdup
- (request->pool, request->argv[2])));
+ utf8_from_imaputf7(request->pool,
+ string_canon_decode(pool_strdup
+ (request->pool,
+ request->argv[2]))));
}
cmd = pool_printf(request->pool, "rm1/%s/%s",
Index: prayer-1.0.18/prayer/cmd_rm1.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_rm1.c 2007-03-10 19:38:54.719461687 +0100
+++ prayer-1.0.18/prayer/cmd_rm1.c 2007-03-10 19:39:30.944126189 +0100
@@ -55,7 +55,7 @@ void cmd_rm1(struct session *session)
session_message(session, "%s", ml_errmsg()); /* Includes name */
} else {
session_message(session, "Deleted directory: \"%s\"", mailbox);
- dircache_delete(session->dircache, mailbox);
+ dircache_delete(session->dircache, utf8_from_imaputf7(request->pool, mailbox));
}
} else {
ml_delete(session, stream,
@@ -67,7 +67,8 @@ void cmd_rm1(struct session *session)
} else if (ml_have_error()) {
session_message(session, "%s", ml_errmsg()); /* Includes name */
} else {
- session_message(session, "Deleted mailbox: \"%s\"", mailbox);
+ session_message(session, "Deleted mailbox: \"%s\"",
+ utf8_from_imaputf7(request->pool, mailbox));
dircache_delete(session->dircache, mailbox);
if (favourite_delete(fl, mailbox))
options->save = T;
Index: prayer-1.0.18/prayer/cmd_subscribe.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_subscribe.c 2007-03-10 19:38:54.769468126 +0100
+++ prayer-1.0.18/prayer/cmd_subscribe.c 2007-03-10 19:39:30.954127477 +0100
@@ -23,7 +23,7 @@ void cmd_subscribe(struct session *sessi
if (favourite_add(fl, name)) {
options->save = T;
session_message(session, "Added %s to favourites list",
- name);
+ utf8_from_imaputf7(request->pool, name));
} else
session_message(session, "Already on favourites list",
name);
Index: prayer-1.0.18/prayer/cmd_transfer.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_transfer.c 2007-03-10 19:38:54.829475852 +0100
+++ prayer-1.0.18/prayer/cmd_transfer.c 2007-03-10 19:39:30.994132629 +0100
@@ -93,7 +93,7 @@ generate_directory_line(struct session *
html_session_bprintf(session, b,
"<td><a href=\"", "\">" CRLF, "transfer?cwd=%s",
name);
- html_quote_string(b, dir);
+ html_quote_string(b, utf8_from_imaputf7(pool, dir));
bprintf(b, "</a></td>" CRLF);
bputs(b, "<td>&nbsp;</td>" CRLF);
@@ -125,7 +125,7 @@ generate_favourite_folder_line(struct se
bputs(b, "</a></td>" CRLF);
bputs(b, "<td><a>" CRLF);
- html_quote_string(b, folder);
+ html_quote_string(b, utf8_from_imaputf7(pool, folder));
bputs(b, "</a></td>" CRLF);
bprintf(b, "<td><a href=\"%s/NOSEQ/transfer/%s/%s\">" CRLF,
@@ -159,7 +159,7 @@ generate_folder_line(struct session *ses
bputs(b, "</a></td>" CRLF);
bputs(b, "<td>" CRLF);
- html_quote_string(b, folder);
+ html_quote_string(b, utf8_from_imaputf7(pool, folder));
bputs(b, "</td>" CRLF);
bprintf(b, "<td><a href=\"%s/NOSEQ/transfer/%s/%s\">" CRLF,
@@ -197,8 +197,8 @@ html_folderlist(struct session *session,
else
bputs(b, "<tr>");
bputs(b, "<td><table><tr><td>" CRLF);
- html_form_field(b, "Directory", "cwd", session->cwd, 32);
- html_form_field(b, "Filter", "filter", session->dir_filter, 12);
+ html_form_field(b, "Directory", "cwd", utf8_from_imaputf7(pool, session->cwd), 32);
+ html_form_field(b, "Filter", "filter", utf8_from_imaputf7(pool, session->dir_filter), 12);
html_form_submit(b, "submit", "Apply");
bputs(b, "</td></tr></table></td>" CRLF);
bputs(b, "<td align=\"right\"><table><tr><td>" CRLF);
@@ -332,7 +332,8 @@ static BOOL download(struct session *ses
OP_READONLY);
if (!session->xfer_stream) {
- session_message(session, "Failed to open mail folder: %s", name);
+ session_message(session, "Failed to open mail folder: %s",
+ utf8_from_imaputf7(request->pool, name));
session_log(session,
"[cmd_transfer] Failed to open mail folder: %s", name);
return (NIL);
@@ -343,7 +344,7 @@ static BOOL download(struct session *ses
/* Fetch overview for all messages in folder */
if (!ml_fetch_overview(session, tstream, "1:*", NIL)) {
session_message(session, "Failed to fetch folder overview: %s",
- name);
+ utf8_from_imaputf7(request->pool, name));
session_log(session,
"[cmd_transfer]] Failed to fetch overview: %s", name);
return (NIL);
Index: prayer-1.0.18/prayer/cmd_unsubscribe.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_unsubscribe.c 2007-03-10 19:38:54.919487442 +0100
+++ prayer-1.0.18/prayer/cmd_unsubscribe.c 2007-03-10 19:39:31.014135204 +0100
@@ -23,10 +23,11 @@ void cmd_unsubscribe(struct session *ses
if (favourite_delete(fl, name)) {
options->save = T;
session_message(session, "Removed %s from favourites list",
- name);
+ utf8_from_imaputf7(request->pool, name));
} else
session_message(session,
- "Folder %s not on favourites list", name);
+ "Folder %s not on favourites list",
+ utf8_from_imaputf7(request->pool, name));
} else
session_message(session,
"String contained illegal characters");
Index: prayer-1.0.18/prayer/cmd_upload_select.c
===================================================================
--- prayer-1.0.18.orig/prayer/cmd_upload_select.c 2007-03-10 19:38:54.969493881 +0100
+++ prayer-1.0.18/prayer/cmd_upload_select.c 2007-03-10 19:39:31.034137781 +0100
@@ -122,8 +122,8 @@ html_folderlist(struct session *session,
/* Change directory form, including back button */
html_form_start(session, b, "GET", "upload_select");
- html_form_field(b, "Directory", "cwd", session->cwd, 32);
- html_form_field(b, "Filter", "filter", session->dir_filter, 12);
+ html_form_field(b, "Directory", "cwd", utf8_from_imaputf7(pool, session->cwd), 32);
+ html_form_field(b, "Filter", "filter", utf8_from_imaputf7(pool, session->dir_filter), 12);
html_form_submit(b, "submit", "Apply");
html_form_end(b);
Index: prayer-1.0.18/prayer/draft.c
===================================================================
--- prayer-1.0.18.orig/prayer/draft.c 2007-03-10 19:38:55.019500318 +0100
+++ prayer-1.0.18/prayer/draft.c 2007-03-10 19:39:31.074142931 +0100
@@ -477,7 +477,7 @@ void draft_update_body(struct draft *d,
} else
d->body = pool_strdup(d->pool, d->body);
- draft_transliterate_1252((unsigned char *)d->body);
+ /*draft_transliterate_1252((unsigned char *)d->body);*/
}
/* draft_update() ********************************************************
@@ -535,7 +535,7 @@ void draft_update(struct draft *d, struc
else
d->body = pool_maybe_strdup(d->pool, d->body);
- draft_transliterate_1252((unsigned char *)d->body);
+ /*draft_transliterate_1252((unsigned char *)d->body);*/
d->in_reply_to = pool_maybe_strdup(d->pool, d->in_reply_to);
d->references = pool_maybe_strdup(d->pool, d->references);
@@ -1164,7 +1164,7 @@ static void draft_make_multipart(struct
bprintf(b, CRLF "--%s" CRLF, cookie);
bputs(b,
- "Content-Type: text/plain; format=flowed; charset=ISO-8859-1"
+ "Content-Type: text/plain; format=flowed; charset=UTF-8"
CRLF);
if (need_qprint)
bputs(b, "Content-Transfer-Encoding: QUOTED-PRINTABLE" CRLF);
@@ -1323,7 +1323,7 @@ static void draft_make_single_part(struc
need_qprint = T;
bputs(b,
- "Content-Type: text/plain; format=flowed; charset=ISO-8859-1"
+ "Content-Type: text/plain; format=flowed; charset=UTF-8"
CRLF);
if (need_qprint)
bputs(b, "Content-Transfer-Encoding: quoted-printable" CRLF);
@@ -1418,7 +1418,7 @@ char *draft_make_msg(struct draft *draft
/* Encode using temporary buffer if required */
s = (char *) rfc1522_encode(tmp, len,
- (unsigned char *) s, "ISO-8859-1");
+ (unsigned char *) s, "UTF-8");
bprintf(mb, "Subject: %s" CRLF, s);
free(tmp);
}
Index: prayer-1.0.18/prayer/html.c
===================================================================
--- prayer-1.0.18.orig/prayer/html.c 2007-03-10 19:38:55.069506757 +0100
+++ prayer-1.0.18/prayer/html.c 2007-03-10 19:39:31.134150660 +0100
@@ -35,7 +35,7 @@ void html_start(struct session *session,
bprintf(b, "<title>Webmail service: %s</title>" CRLF, title);
bputs(b, "<meta name=\"robots\" content=\"none\">" CRLF);
bputs(b, ("<meta http-equiv=\"Content-Type\" "
- "content=\"text/html; charset=ISO-8859-1\">" CRLF));
+ "content=\"text/html; charset=UTF-8\">" CRLF));
bputs(b, "</head>" CRLF);
bputs(b, "<body");
@@ -502,7 +502,7 @@ void
html_form_start(struct session *s, struct buffer *b, char *method,
char *cmd)
{
- bprintf(b, "<form method=\"%s\" accept-charset=\"ISO-8859-1\"",
+ bprintf(b, "<form method=\"%s\" accept-charset=\"UTF-8\"",
method);
html_session_bputs(s, b, " action=\"", "\">" CRLF, cmd);
}
@@ -854,7 +854,7 @@ html_banner_toolbar_favourites(struct se
string_canon_encode(request->pool, li->name));
}
- html_quote_string(b, li->name);
+ html_quote_string(b, utf8_from_imaputf7(request->pool, li->name));
bputs(b, "</option>" CRLF);
}
bputs(b, "</select>" CRLF);
@@ -926,14 +926,14 @@ html_banner_toolbar_folders(struct sessi
if (prefix) {
bprintf(b, "<option value=\"%s%s\">",
prefix, string_canon_encode(request->pool, dl->name));
- html_quote_string(b, session->cwd);
+ html_quote_string(b, utf8_from_imaputf7(request->pool, session->cwd));
html_quote_string(b, "/");
- html_quote_string(b, dl->name);
+ html_quote_string(b, utf8_from_imaputf7(request->pool, dl->name));
bputs(b, "</option>" CRLF);
} else if (strcasecmp(dl->name, "INBOX") != 0) {
bprintf(b, "<option value=\"%s\">",
string_canon_encode(request->pool, dl->name));
- html_quote_string(b, dl->name);
+ html_quote_string(b, utf8_from_imaputf7(request->pool, dl->name));
bputs(b, "</option>" CRLF);
}
}
@@ -1077,7 +1077,8 @@ html_banner_toolbar(struct session *sess
void html_quote_char(struct buffer *b, unsigned char c)
{
if (c > 127) {
- bprintf(b, "&#%lu;", (unsigned long) c);
+ /*bprintf(b, "&#%lu;", (unsigned long) c);*/
+ bputc(b, c);
} else
switch (c) {
case '"':
Index: prayer-1.0.18/prayer/prayer_session.h
===================================================================
--- prayer-1.0.18.orig/prayer/prayer_session.h 2007-03-10 19:39:29.243907238 +0100
+++ prayer-1.0.18/prayer/prayer_session.h 2007-03-10 19:39:31.844242104 +0100
@@ -74,3 +74,4 @@ extern int errno; /* just
#include "checksum.h"
#include "wrap.h"
#include "portlist.h"
+#include "utf8.h"
Index: prayer-1.0.18/prayer/response.c
===================================================================
--- prayer-1.0.18.orig/prayer/response.c 2007-03-10 19:38:55.169519634 +0100
+++ prayer-1.0.18/prayer/response.c 2007-03-10 19:39:31.904249831 +0100
@@ -405,7 +405,7 @@ void response_error(struct request *requ
bputs(b, "Expires: ");
response_date_string(b, time(NIL));
bputs(b, "" CRLF);
- bprintf(b, "Content-Type: text/html; charset=iso-8859-1" CRLF);
+ bprintf(b, "Content-Type: text/html; charset=UTF-8" CRLF);
bprintf(b, "Content-Length: %lu" CRLF,
buffer_size(request->write_buffer));
response_header_end(request);
@@ -437,7 +437,7 @@ void response_html(struct request *reque
/* Generate simple header block for HTML */
response_header_start(request, status);
- bputs(b, "Content-Type: text/html; charset=iso-8859-1" CRLF);
+ bputs(b, "Content-Type: text/html; charset=UTF-8" CRLF);
#ifdef STELLA_HACK
bputs(b, "Expires: ");
Index: prayer-1.0.18/prayer/rfc1522.c
===================================================================
--- prayer-1.0.18.orig/prayer/rfc1522.c 2007-03-10 19:38:55.249529936 +0100
+++ prayer-1.0.18/prayer/rfc1522.c 2007-03-10 19:39:31.934253696 +0100
@@ -162,6 +162,7 @@ char **charset;
unsigned char *rv = NULL, *p;
char *start = s, *sw, *cset, *enc, *txt, *ew, **q, *lang;
unsigned long l;
+ unsigned char *src;
int i;
*d = '\0'; /* init destination */
@@ -171,15 +172,16 @@ char **charset;
while (s && (sw = strstr(s, RFC1522_INIT))) {
/* validate the rest of the encoded-word */
if (rfc1522_valid(sw, &cset, &enc, &txt, &ew)) {
- if (!rv)
+ if (!rv)
rv = d; /* remember start of dest */
/* copy everything between s and sw to destination */
for (i = 0; &s[i] < sw; i++)
if (!isspace((unsigned char) s[i])) { /* if some non-whitespace */
- while (s < sw && d - rv < len - 1)
- *d++ = (unsigned char) *s++;
-
+ /* Assume that any 8 bit characters are Latin-1 */
+ utf8_print(VAR_CHAR_SET, NULL,
+ &d, len - (d - rv) - 1,
+ (unsigned char**)&s, sw - s);
break;
}
@@ -188,23 +190,12 @@ char **charset;
if ((lang = strchr(cset, '*')))
*lang++ = '\0';
-
- /* Insert text explaining charset if we don't know what it is */
- if ((strcasecmp((char *) cset, VAR_CHAR_SET))
- && strcasecmp((char *) cset, "US-ASCII")) {
- if (charset) {
- if (!*charset) /* only write first charset */
- *charset = cpystr(cset);
- } else {
- if (d - rv < len - 1)
- *d++ = '[';
-
- sstrncpy((char **) &d, cset, len - 1 - (d - rv));
- if (d - rv < len - 1)
- *d++ = ']';
- if (d - rv < len - 1)
- *d++ = SPACE;
- }
+ if (!*cset) {
+ cset = UNKNOWN_CHARSET;
+ }
+ if (charset) {
+ if (!*charset) /* only write first charset */
+ *charset = cpystr(cset);
}
/* based on encoding, write the encoded text to output buffer */
@@ -228,15 +219,14 @@ char **charset;
} else
q = NULL;
- if ((p =
+ if ((src = p =
rfc822_qprint((unsigned char *) txt, strlen(txt),
&l))) {
- strncpy((char *) d, (char *) p, len - 1 - (d - rv));
- d[len - 1 - (d - rv)] = '\0';
+ utf8_print(cset, VAR_CHAR_SET,
+ &d, len - 1 - (d - rv),
+ &src, l);
+ *d = '\0';
fs_give((void **) &p); /* free encoded buf */
- d += l; /* advance dest ptr to EOL */
- if (d - rv > len - 1)
- d = rv + len - 1;
} else {
if (q)
fs_give((void **) &q);
@@ -255,22 +245,26 @@ char **charset;
case 'B': /* 'B' encoding */
case 'b':
- if ((p =
+ if ((src = p =
rfc822_base64((unsigned char *) txt, strlen(txt),
&l))) {
- strncpy((char *) d, (char *) p, len - 1 - (d - rv));
- d[len - 1 - (d - rv)] = '\0';
+ utf8_print(cset, VAR_CHAR_SET,
+ &d, len - 1 - (d - rv),
+ &src, l);
+ *d = '\0';
fs_give((void **) &p); /* free encoded buf */
- d += l; /* advance dest ptr to EOL */
- if (d - rv > len - 1)
- d = rv + len - 1;
} else
goto bogus;
break;
+ bogus:
default:
- sstrncpy((char **) &d, txt, len - 1 - (d - rv));
+ src = txt;
+ utf8_print(VAR_CHAR_SET, NULL,
+ &d, len - 1 - (d - rv),
+ (unsigned char **)&src, ew - txt);
+ *d = '\0';
break;
}
@@ -283,6 +277,7 @@ char **charset;
if (lang)
lang[-1] = '*';
+
} else {
/*
@@ -291,28 +286,38 @@ char **charset;
/* if already copying to destn, copy it */
if (rv) {
- strncpy((char *) d, s,
- (int) min((l = (sw - s) + RFC1522_INIT_L),
- len - 1 - (d - rv)));
- d += l; /* advance d, tie off text */
- if (d - rv > len - 1)
- d = rv + len - 1;
+ utf8_print(VAR_CHAR_SET, NULL,
+ &d, len - 1 - (d - rv),
+ (unsigned char**)&s, sw - s);
*d = '\0';
- s += l; /* advance s beyond intro */
} else
s += ((sw - s) + RFC1522_INIT_L);
}
}
- if (rv && *s) /* copy remaining text */
- strncat((char *) rv, s, len - 1 - strlen((char *) rv));
+ if (rv && *s) { /* copy remaining text */
+ utf8_print(VAR_CHAR_SET, NULL,
+ &d, len - 1 - (d - rv),
+ (unsigned char**)&s, strlen(s));
+ *d = '\0';
+ }
/* BUG: MUST do code page mapping under DOS after decoding */
- return (rv ? rv : (unsigned char *) start);
+ if (rv) return rv;
+
+ for (s = start; *s; s++) {
+ if (*s & 0x80) {
+ rv = d;
+ utf8_print(VAR_CHAR_SET, NULL,
+ &d, len - 1,
+ (unsigned char**)&start, strlen(s));
+ *d = '\0';
+ return rv;
- bogus:
- return ((unsigned char *) start);
+ }
+ }
+ return (unsigned char *) start;
}
@@ -364,7 +369,7 @@ int c;
int rfc1522_valenc(c)
int c;
{
- return (!(c == '?' || c == SPACE) && isprint((unsigned char) c));
+ return (!(c == '?' /*|| c == SPACE*/) && isprint((unsigned char) c));
}
@@ -386,7 +391,7 @@ char **endp;
&e)
&& rfc1522_token(++e, rfc1522_valtok, RFC1522_DLIM, &t)
&& rfc1522_token(++t, rfc1522_valenc, RFC1522_TERM, &p)
- && p - s <= RFC1522_MAXW;
+ /* && p - s <= RFC1522_MAXW */;
if (charset)
*charset = c;
Index: prayer-1.0.18/prayer/utf8.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ prayer-1.0.18/prayer/utf8.c 2007-03-10 19:39:31.974258848 +0100
@@ -0,0 +1,418 @@
+/* Copyright (c) Magnus Holmgren <magnus@kibibyte.se>,
+ * <holmgren@lysator.liu.se>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include "prayer_session.h"
+#include <iconv.h>
+
+#define JNK 0177
+#define UNI_REPLACEMENT_CHAR 0x0000FFFD
+#define UNI_REPLACEMENT_CHAR_UTF8 "\xEF\xBF\xBD"
+#define ICONV_CHUNK_SIZE 1024
+
+/* utf8_from_imaputf7() ***********************************************
+ *
+ * Convert a string encoded as modified UTF-7 to UTF-8.
+ * pool: Target pool for storage
+ * t: The string to convert
+ *
+ * Returns: A new, UTF-8-encoded string
+ *
+ * Note: This function tries hard to return something useful in case
+ * the input string is invalid in some way, rather than bail out
+ * and return NULL.
+ **********************************************************************/
+
+char *utf8_from_imaputf7(struct pool *pool, char *t)
+{
+ struct buffer *b = buffer_create(pool, 64);
+ BOOL base64mode = NIL;
+ int i, j;
+ unsigned char buf[4];
+ unsigned char *s;
+ unsigned long scalar; /* Unicode scalar value */
+ unsigned char c;
+
+ static char decode_base64[256] = {
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,076,077,JNK,JNK,JNK,
+ 064,065,066,067,070,071,072,073,074,075,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,000,001,002,003,004,005,006,007,010,011,012,013,014,015,016,
+ 017,020,021,022,023,024,025,026,027,030,031,JNK,JNK,JNK,JNK,JNK,
+ JNK,032,033,034,035,036,037,040,041,042,043,044,045,046,047,050,
+ 051,052,053,054,055,056,057,060,061,062,063,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,
+ JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK,JNK
+ };
+
+ if (!t) return NULL;
+
+ for (s = (unsigned char*)t; *s; s++) {
+ if (base64mode) {
+ if (*s == '-') {
+ if (j != 0 || c != 0) /* Some junk left */ {
+ bputs(b, UNI_REPLACEMENT_CHAR_UTF8);
+ }
+ base64mode = NIL;
+ continue;
+ }
+
+ if (decode_base64[*s] == JNK) {
+ break; /* Bail out */
+ }
+
+ switch (i++) {
+ case 0:
+ /* Top 6 bits of the first octet */
+ c = decode_base64[*s] << 2; break;
+ case 1:
+ /* Top 2 bits are bottom 2 bits of the first octet */
+ buf[j++] = c | (decode_base64[*s] >> 4);
+ /* and bottom 4 bits are top 4 bits of the second */
+ c = decode_base64[*s] << 4; break;
+ case 2:
+ /* Top 4 bits are bottom 4 bits of the second octet */
+ buf[j++] = c | (decode_base64[*s] >> 2);
+ /* and bottom 2 bits are top 2 bits of the third */
+ c = decode_base64[*s] << 6; break;
+ case 3:
+ /* Bottom 6 bits of the third octet */
+ buf[j++] = c | decode_base64[*s];
+ i = 0;
+ }
+
+ /* Check if we have a complete UTF-16 character */
+ if (j == 4) { /* We should now have a surrogate pair */
+ scalar = ((buf[0] & 3) << 18) + (buf[1] << 10)
+ + ((buf[2] & 3) << 8) + buf[3] + 0x10000;
+ }
+ else if (j == 2) {
+ if (buf[0] < 0xD8 || buf[0] > 0xDF) {
+ scalar = (buf[0] << 8) + buf[1];
+ }
+ else if (buf[0] > 0xDB) {
+ /* Error - invalid surrogate */
+ scalar = UNI_REPLACEMENT_CHAR;
+ }
+ else {
+ /* High surrogate found - need low surrogate */
+ continue;
+ }
+ }
+ else continue; /* Odd number of bytes */
+
+ if (scalar >= 0x110000) scalar = UNI_REPLACEMENT_CHAR;
+
+ if (scalar < 0x80) {
+ bputc(b, (unsigned char)scalar);
+ j = 0;
+ continue;
+ } else if (scalar < 0x800) {
+ bputc(b, 0xC0 | (scalar >> 6));
+ } else if (scalar < 0x10000) {
+ bputc(b, 0xE0 | (scalar >> 12));
+ } else {
+ bputc(b, 0xF0 | (scalar >> 18));
+ }
+
+ if (scalar >= 0x10000)
+ bputc(b, 0x80 | ((scalar >> 12) & 0x3F));
+ if (scalar >= 0x800)
+ bputc(b, 0x80 | ((scalar >> 6) & 0x3F));
+ bputc(b, 0x80 | (scalar & 0x3F));
+ j = 0;
+
+ }
+ else /* !base64mode */ {
+ if (*s == '&') {
+ if (*(s+1) == '-') {
+ bputc(b, '&');
+ s++;
+ }
+ else {
+ base64mode = T;
+ i = 0; j = 0; c = 0;
+ }
+ }
+ else {
+ bputc(b, *s);
+ }
+ }
+ }
+ return buffer_fetch(b, 0, buffer_size(b), NIL);
+}
+
+
+/* utf8_to_imaputf7() *************************************************
+ *
+ * Convert a string encoded as UTF-8 to modified UTF-7.
+ * pool: Target pool for storage
+ * t: The string to convert
+ *
+ * Returns: A new string encoded as modified UTF-7
+ *
+ * Note: This function tries hard to return something useful in case
+ * the input string is invalid in some way, rather than bail out
+ * and return NULL.
+ **********************************************************************/
+
+char *utf8_to_imaputf7(struct pool *pool, char *t)
+{
+ unsigned char *s;
+ struct buffer *b = buffer_create(pool, 64);
+ BOOL base64mode = NIL;
+ unsigned long scalar;
+ unsigned int L, i, j;
+ unsigned char buf[4];
+ unsigned char c = 0;
+
+ static char encode_base64[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,";
+ if (!t) return NULL;
+
+ for (s = (unsigned char *)t; *s; s++) {
+ if (*s < 0x7f && *s >= 0x20) {
+ if (base64mode) {
+ switch (i) {
+ case 1:
+ /* Remaining bottom 2 bits of the last octet */
+ bputc(b, encode_base64[c << 4]); break;
+ case 2:
+ /* Remaining bottom 4 bits of the last octet */
+ bputc(b, encode_base64[c << 2]);
+ }
+ bputc(b, '-');
+ base64mode = NIL;
+ }
+ bputc(b, *s);
+ if (*s == '&') {
+ bputc(b, '-');
+ }
+ }
+ else {
+ if (*s < 0x80) {
+ L = 0; scalar = *s;
+ } else if ((*s & 0xE0) == 0xC0) {
+ L = 1; scalar = (*s & 0x1F);
+ } else if ((*s & 0xF0) == 0xE0) {
+ L = 2; scalar = (*s & 0x0F);
+ } else if ((*s & 0xF8) == 0xF0) {
+ L = 3; scalar = (*s & 0x07);
+ } else if ((*s & 0xFC) == 0xF8) {
+ L = 4; scalar = (*s & 0x03);
+ } else if ((*s & 0xFE) == 0xFC) {
+ L = 5; scalar = (*s & 0x01);
+ } else {
+ L = 0; scalar = UNI_REPLACEMENT_CHAR;
+ }
+
+ for (j = 0; j < L; j++) {
+ s++;
+ if ((*s & 0xC0) == 0x80) {
+ scalar <<= 6;
+ scalar |= (*s & 0x3F);
+ }
+ else {
+ s--;
+ scalar = UNI_REPLACEMENT_CHAR;
+ }
+ }
+
+ if (!base64mode) {
+ bputc(b, '&');
+ base64mode = T;
+ i = 0;
+ }
+ if (scalar <= 0xFFFF) {
+ buf[1] = scalar & 0xFF;
+ scalar >>= 8;
+ buf[0] = scalar & 0xFF;
+ L = 2;
+ }
+ else {
+ scalar -= 0x100000UL;
+ buf[3] = scalar & 0xFF;
+ scalar >>= 8;
+ buf[2] = 0xDC | (scalar & 0x03);
+ scalar >>= 2;
+ buf[3] = scalar & 0xFF;
+ scalar >>= 8;
+ buf[1] = 0xD8 | (scalar & 0x03);
+ L = 4;
+ }
+
+ for (j = 0; j < L; j++) {
+ switch (i++) {
+ case 0:
+ /* Top 6 bits of the first octet */
+ bputc(b, encode_base64[(buf[j] >> 2) & 0x3F]);
+ c = (buf[j] & 0x03); break;
+ case 1:
+ /* Bottom 2 bits of the first octet, and top 4 bits of the second */
+ bputc(b, encode_base64[(c << 4) |
+ ((buf[j] >> 4) & 0x0F)]);
+ c = (buf[j] & 0x0F); break;
+ case 2:
+ /* Bottom 4 bits of the second octet and top 2 bits of the third */
+ bputc(b, encode_base64[(c << 2) |
+ ((buf[j] >> 6) & 0x03)]);
+ /* Bottom 6 bits of the third octet */
+ bputc(b, encode_base64[buf[j] & 0x3F]);
+ i = 0;
+ }
+ }
+
+ }
+ }
+ if (base64mode) {
+ switch (i) {
+ case 1:
+ /* Remaining bottom 2 bits of the last octet */
+ bputc(b, encode_base64[c << 4]); break;
+ case 2:
+ /* Remaining bottom 4 bits of the last octet */
+ bputc(b, encode_base64[c << 2]);
+ }
+ bputc(b, '-');
+ base64mode = NIL;
+ }
+ return buffer_fetch(b, 0, buffer_size(b), NIL);
+}
+
+
+/* utf8_from_string() ************************************************
+ *
+ * Convert a string with given character encoding to UTF-8
+ *
+ * pool: Pool to allocate memory from
+ * charset: Charset of input string
+ * t: String to convert
+ * len: Length of string
+ ***********************************************************************/
+
+char *utf8_from_string(struct pool *pool, char *charset, char *t, unsigned long len)
+{
+ struct buffer *b;
+ char chunk[ICONV_CHUNK_SIZE];
+ char *outbuf;
+ size_t outbytesleft;
+ size_t result;
+ int i;
+ iconv_t cd = iconv_open("UTF-8", charset);
+ b = buffer_create(pool, 1024);
+
+ if (cd == (iconv_t)(-1)) {
+ buffer_printf(b, "(Conversion from %s failed)", charset);
+ }
+ else while (len) {
+ outbuf = chunk;
+ outbytesleft = ICONV_CHUNK_SIZE;
+ result = iconv(cd, &t, (size_t*)&len, &outbuf, &outbytesleft);
+ for (i = 0; i < ICONV_CHUNK_SIZE - outbytesleft; i++) {
+ bputc(b, chunk[i]);
+ }
+ if (result == (size_t)(-1)) switch (errno) {
+ case E2BIG:
+ break;
+ case EILSEQ:
+ case EINVAL:
+ /* Try skipping a byte */
+ t++;
+ len--;
+ bputs(b, UNI_REPLACEMENT_CHAR_UTF8);
+ break;
+ default:
+ iconv_close(cd);
+ return NULL;
+ }
+ }
+
+ iconv_close(cd);
+ return buffer_fetch(b, 0, buffer_size(b), NIL);
+}
+
+BOOL utf8_print(char *charset, char *fallback_charset,
+ unsigned char **dst, unsigned long dst_size,
+ unsigned char **src, unsigned long src_size)
+{
+
+ iconv_t cd = iconv_open("UTF-8", charset);
+ if (cd == (iconv_t)(-1) && fallback_charset)
+ cd = iconv_open("UTF-8", fallback_charset);
+
+ while (iconv(cd, (char**)src, (size_t*)&src_size,
+ (char**)dst, (size_t*)&dst_size) == (size_t)(-1)) {
+ switch (errno) {
+ case EILSEQ:
+ case EINVAL:
+ /* Try skipping a byte */
+ (*src)++;
+ src_size--;
+ if (dst_size >= sizeof(UNI_REPLACEMENT_CHAR_UTF8)) {
+ strcpy((char*)*dst, UNI_REPLACEMENT_CHAR_UTF8);
+ }
+ if (errno == EILSEQ) break;
+ case E2BIG:
+ default:
+ iconv_close(cd);
+ return NIL;
+ }
+ }
+ iconv_close(cd);
+ return T;
+}
+
+/* utf8_prune() ********************************************************
+ *
+ * Like string_prune, but counts UTF-8 multibyte sequences as units.
+ * pool: Target pool
+ * s: UTF-8 string to prune
+ * maxlen: Maximum length of string before pruning applies.
+ *
+ * Returns: Pruned string, maximum maxlen characters (not bytes), not
+ * counting the terminating null.
+ ***********************************************************************/
+
+char *utf8_prune(struct pool *pool, char *s, unsigned long maxlen)
+{
+ char *result;
+ unsigned long cutoff;
+ unsigned long L;
+ unsigned long i = 0;
+
+ if (maxlen < (strlen("...") + 1))
+ return (s);
+
+ for (L = 0; L < maxlen; L++) {
+ if (s[i] == '\0') return s;
+ if (L == maxlen - strlen("...")) cutoff = i;
+
+ if (s[i] & 0x80)
+ while (s[i] & 0x80) i++;
+ else
+ i++;
+ }
+
+ result = pool_alloc(pool, cutoff + 4);
+ memcpy(result, s, cutoff);
+ strcpy(result + cutoff, "...");
+
+ return (result);
+
+}
Index: prayer-1.0.18/prayer/utf8.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ prayer-1.0.18/prayer/utf8.h 2007-03-10 19:39:32.004262711 +0100
@@ -0,0 +1,7 @@
+char *utf8_from_imaputf7(struct pool *pool, char *t);
+char *utf8_to_imaputf7(struct pool *pool, char *t);
+char *utf8_from_string(struct pool *pool, char *charset, char *t, unsigned long len);
+BOOL utf8_print(char *charset, char *fallback_charset,
+ unsigned char **dst, unsigned long dst_size,
+ unsigned char **src, unsigned long src_size);
+char *utf8_prune(struct pool *pool, char *s, unsigned long maxlen);
/trunk/debian/patches/sighandling.patch
0,0 → 1,75
Index: prayer-1.0.18/prayer/os.h
===================================================================
--- prayer-1.0.18.orig/prayer/os.h 2007-03-10 19:56:40.357114747 +0100
+++ prayer-1.0.18/prayer/os.h 2007-03-10 19:57:56.266959171 +0100
@@ -44,6 +44,8 @@ BOOL os_signal_alarm_clear(void);
BOOL os_signal_init();
+BOOL os_signal_hup_term_init(void (*hup_fn) (), void (*term_fn) ());
+
BOOL os_lock_exclusive(int fd);
BOOL os_lock_shared(int fd);
Index: prayer-1.0.18/prayer/session_server.c
===================================================================
--- prayer-1.0.18.orig/prayer/session_server.c 2007-03-10 19:56:40.647152355 +0100
+++ prayer-1.0.18/prayer/session_server.c 2007-03-10 19:57:56.326966954 +0100
@@ -355,6 +355,7 @@ BOOL session_server(struct config *confi
fd_set readfds;
pid_t child;
unsigned long timeout = 0L;
+ BOOL sighup_seen = NIL;
if (config->direct_enable) {
ssl_portlist
@@ -420,6 +421,18 @@ BOOL session_server(struct config *confi
} else {
rc = select(maxfd + 1, &readfds, NIL, NIL, NIL);
}
+ if (sighup_seen) {
+ log_misc("SIGHUP received - reexec daemon");
+ close(sockfd);
+ if (config->direct_enable) {
+ /* Find some way to pass this information along
+ to the new invocation somehow later. */
+ portlist_close_all(ssl_portlist);
+ portlist_close_all(plain_portlist);
+ }
+ log_misc_free();
+ return (T);
+ }
}
while ((rc < 0) && (errno == EINTR));
Index: prayer-1.0.18/prayer/log.c
===================================================================
--- prayer-1.0.18.orig/prayer/log.c 2007-03-10 19:58:03.667919109 +0100
+++ prayer-1.0.18/prayer/log.c 2007-03-10 19:58:11.688959503 +0100
@@ -502,6 +502,13 @@ BOOL log_misc_init(struct config *config
return (log_open(log_misc_ptr, log_name));
}
+void log_misc_free()
+{
+ if ((log_misc_ptr == NIL) || (log_misc_ptr->fd < 0))
+ return;
+ log_free(log_misc_ptr);
+}
+
/* log_misc_ping() *******************************************************
*
* Reopen misc log file if required
Index: prayer-1.0.18/prayer/log.h
===================================================================
--- prayer-1.0.18.orig/prayer/log.h 2007-03-10 19:58:04.067970999 +0100
+++ prayer-1.0.18/prayer/log.h 2007-03-10 19:58:11.648954314 +0100
@@ -45,6 +45,8 @@ void log_record_peer_pid(struct log *log
BOOL
log_misc_init(struct config *config, char *progname, char *misc_log_name);
+void log_misc_free();
+
BOOL log_misc_ping();
void log_misc(char *fmt, ...);
/trunk/debian/patches/makefile_install_config.patch
0,0 → 1,260
--- prayer-1.0.18.orig/files/etc/prayer-accountd.cf
+++ prayer-1.0.18/files/etc/prayer-accountd.cf
@@ -8,6 +8,8 @@
# Default accountd.cf file suitable for RedHat Linux only.
# See distribution for some sample files for FreeBSD and Solaris
+accountd_port = 145
+
msforward_name = ".MSforward"
forward_name = ".forward"
aliases_name = "vacation.aliases"
--- prayer-1.0.18.orig/files/Makefile
+++ prayer-1.0.18/files/Makefile
@@ -53,41 +53,44 @@
install-cert:
if [ -f certs/prayer.pem ]; then \
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) \
- -m $(PRIVATE_FILE) certs/prayer.pem ${BROOT}${PREFIX}/certs; \
+ -m $(PRIVATE_FILE) certs/prayer.pem ${DESTDIR}${PREFIX}/certs; \
fi
install-config: etc/prayer.cf
$(INSTALL) -D -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_FILE) \
- etc/prayer.cf ${BROOT}${PRAYER_CONFIG_FILE}
+ etc/prayer.cf ${DESTDIR}${PRAYER_CONFIG_FILE}
install-aconfig:
$(INSTALL) -D -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_FILE) \
- etc/prayer-accountd.cf ${BROOT}${ACCOUNTD_CONFIG_FILE}
+ etc/prayer-accountd.cf ${DESTDIR}${ACCOUNTD_CONFIG_FILE}
install-motd:
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_FILE) \
- etc/motd.html ${BROOT}${PREFIX}/etc
+ etc/motd.html ${DESTDIR}/etc/prayer
install-welcome:
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_FILE) \
- etc/welcome.html ${BROOT}${PREFIX}/etc
+ etc/welcome.html ${DESTDIR}/etc/prayer
install:
- PREFIX=$(BROOT)$(PREFIX) VAR_PREFIX=$(BROOT)$(VAR_PREFIX) \
+ ${INSTALL} -d -o ${RO_USER} -g ${RO_GROUP} -m ${PUBLIC_DIR} ${DESTDIR}${PREFIX}
+ ${INSTALL} -d -o ${RO_USER} -g ${RO_GROUP} -m ${PUBLIC_DIR} ${DESTDIR}/etc/prayer
+
+ PREFIX=$(DESTDIR)$(PREFIX) VAR_PREFIX=$(DESTDIR)$(VAR_PREFIX) \
RO_USER=$(RO_USER) RO_GROUP=$(RO_GROUP) \
RW_USER=$(RW_USER) RW_GROUP=$(RW_GROUP) \
PUBLIC_DIR=$(PUBLIC_DIR) PRIVATE_DIR=$(PRIVATE_DIR) \
PUBLIC_FILE=$(PUBLIC_FILE) PRIVATE_FILE=$(PRIVATE_FILE) \
PUBLIC_EXEC=$(PUBLIC_FILE) PRIVATE_EXEC=$(PRIVATE_EXEC) \
- BIN_DIR=$(BIN_DIR) INSTALL=$(INSTALL) \
+ BIN_DIR=$(DESTDIR)$(BIN_DIR) INSTALL=$(INSTALL) \
./install.sh
- if [ ! -f $(BROOT)$(PREFIX)/certs/prayer.pem ]; then $(MAKE) install-cert; fi
- if [ ! -f $(BROOT)$(PRAYER_CONFIG_FILE) ]; then $(MAKE) install-config; fi
- if [ ! -f $(BROOT)$(ACCOUNTD_CONFIG_FILE) ]; then $(MAKE) install-aconfig; fi
- if [ ! -f $(BROOT)$(PREFIX)/etc/motd.html ]; then $(MAKE) install-motd; fi
- if [ ! -f $(BROOT)$(PREFIX)/etc/welcome.html ]; then $(MAKE) install-welcome; fi
+# if [ ! -f $(DESTDIR)$(PREFIX)/certs/prayer.pem ]; then $(MAKE) install-cert; fi
+ if [ ! -f $(DESTDIR)$(PRAYER_CONFIG_FILE) ]; then $(MAKE) install-config; fi
+ if [ ! -f $(DESTDIR)$(ACCOUNTD_CONFIG_FILE) ]; then $(MAKE) install-aconfig; fi
+ if [ ! -f $(DESTDIR)/etc/prayer/motd.html ]; then $(MAKE) install-motd; fi
+ if [ ! -f $(DESTDIR)/etc/prayer/welcome.html ]; then $(MAKE) install-welcome; fi
redhat-install-init.d:
install -D -o root -g root -m 755 \
- ./init.d/prayer $(BROOT)/etc/rc.d/init.d/prayer
+ ./init.d/prayer $(DESTDIR)/etc/rc.d/init.d/prayer
#chkconfig prayer --level 2345 on
--- prayer-1.0.18.orig/files/install.sh
+++ prayer-1.0.18/files/install.sh
@@ -4,77 +4,6 @@
PATH=/bin:/sbin/:/usr/bin:/usr/sbin
-error=0
-
-if [ "x$PREFIX" = "x" ]; then
- echo 'PREFIX not defined'
- error=1
-fi
-
-if [ "x$VAR_PREFIX" = "x" ]; then
- echo 'VAR_PREFIX not defined'
- error=1
-fi
-
-if [ "x$RO_USER" = "x" ]; then
- echo 'RO_USER not defined'
- error=1
-fi
-
-if [ "x$RO_GROUP" = "x" ]; then
- echo 'RO_GROUP not defined'
- error=1
-fi
-
-if [ "x$RW_USER" = "x" ]; then
- echo 'RW_USER not defined'
- error=1
-fi
-
-if [ "x$RW_GROUP" = "x" ]; then
- echo 'RW_GROUP not defined'
- error=1
-fi
-
-if [ "x$PUBLIC_DIR" = "x" ]; then
- echo 'PUBLIC_DIR not defined'
- error=1
-fi
-
-if [ "x$PRIVATE_DIR" = "x" ]; then
- echo 'PRIVATE_DIR not defined'
- error=1
-fi
-
-if [ "x$BIN_DIR" = "x" ]; then
- echo 'BIN_DIR not defined'
- error=1
-fi
-
-if [ $error != 0 ]; then
- exit 1
-fi
-
-if [ ! -d ${VAR_PREFIX} -a `whoami` = "root" ]; then
- ${INSTALL} -d -o ${RW_USER} -g ${RW_GROUP} -m ${PRIVATE_DIR} ${VAR_PREFIX}
-fi
-
-if [ ! -d ${PREFIX} ]; then
- ${INSTALL} -d -o ${RO_USER} -g ${RO_GROUP} -m ${PUBLIC_DIR} ${PREFIX}
-fi
-
-if [ ! -d ${PREFIX}/etc ]; then
- ${INSTALL} -d -o ${RO_USER} -g ${RO_GROUP} -m ${PUBLIC_DIR} ${PREFIX}/etc
-fi
-
-if [ ! -d ${PREFIX}/certs ]; then
- ${INSTALL} -d -o ${RO_USER} -g ${RO_GROUP} -m ${PRIVATE_DIR} ${PREFIX}/certs
-fi
-
-if [ ! -d ${BIN_DIR} ]; then
- ${INSTALL} -d -o ${RO_USER} -g ${RO_GROUP} -m ${PRIVATE_DIR} ${BIN_DIR}
-fi
-
for i in help icons
do
if [ -d "${PREFIX}/${i}" ]; then
--- prayer-1.0.18.orig/files/etc/prayer.cf.SRC
+++ prayer-1.0.18/files/etc/prayer.cf.SRC
@@ -20,7 +20,7 @@
# User ID to run as if we start off as root
prayer_user = "prayer"
# Group ID to run as if we start off as root
-prayer_group = "prayer"
+prayer_group = "nogroup"
# Run prayer as background process.
# TRUE => will return as soon as valid configuration is found.
@@ -423,14 +423,14 @@
# Various directories used by the running system
# Logs stored in $log_dir
-log_dir = "$var_prefix/logs"
+log_dir = "/var/log/prayer"
# $lock_dir used for interlocking between prayer processes
-lock_dir = "$var_prefix/locks"
+lock_dir = "/var/lock"
# $socket_dir is location for unix domain sockets which connect frontend
# to backend in proxy mode of operation.
-socket_dir = "$var_prefix/sockets"
+socket_dir = "/var/run/prayer"
# Split socket directory into 64 subdirs keyed on first letter of sessionID
# Code provides compatibility in both directions: can switch back and forward
@@ -441,14 +441,14 @@
init_socket_name = init
# $ssl_session_dir is location for SSL session cache
-ssl_session_dir = "$var_prefix/ssl_scache"
+ssl_session_dir = "/var/run/prayer/ssl_scache"
# Location for temporary files e.g; attachments and folders in transist
# during upload and download operation. Core files also end up here
-tmp_dir = "$var_prefix/tmp"
+tmp_dir = "/tmp"
# Location for PID files for prayer and prayer-session master processes.
-pid_dir = "$var_prefix/pid"
+pid_dir = "/var/run/prayer"
# Interface to Hermes finger database
#lookup_rpasswd = "/data/finger/rpasswd.cdb"
@@ -587,7 +587,7 @@
suppress_dotfiles = TRUE
# Mail directory in users account
-maildir = "mail"
+maildir = ""
# Temporary hack to remove "mail/" from favourites list (and anywhere
# else where we find the strings embedded into .prayer files).
@@ -601,7 +601,7 @@
# default_domain = "<valid mail domain>"
# Language for ispell.
-ispell_language = "british"
+ispell_language = "american"
# Size of small and large compose windows
small_cols = 80
--- prayer-1.0.18.orig/prayer/Makefile
+++ prayer-1.0.18/prayer/Makefile
@@ -102,8 +102,9 @@
SESSION_LIBS += $(KERB_LIBS)
endif
-CFLAGS = $(BASECFLAGS) $(COMMON_SSL_INCLUDE) $(CCLIENT_INCLUDE)
-LDFLAGS = $(BASELDFLAGS)
+CFLAGS = $(BASECFLAGS)
+override CFLAGS += $(COMMON_SSL_INCLUDE) $(CCLIENT_INCLUDE)
+LDFLAGS = $(BASELDFLAGS) -Wl,--as-needed
SHARED_OBJS = \
pool.o list.o assoc.o memblock.o buffer.o string.o config.o user_agent.o \
@@ -175,21 +176,21 @@
install: all
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_DIR) -d \
- $(BROOT)$(BIN_DIR)
+ $(DESTDIR)$(BIN_DIR)
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_EXEC) \
- prayer $(BROOT)$(BIN_DIR)
+ prayer $(DESTDIR)$(BIN_DIR)
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_EXEC) \
- prayer-chroot $(BROOT)$(BIN_DIR)
+ prayer-chroot $(DESTDIR)$(BIN_DIR)
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_EXEC) \
- prayer-session $(BROOT)$(BIN_DIR)
+ prayer-session $(DESTDIR)$(BIN_DIR)
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_EXEC) \
- prayer-ssl-prune $(BROOT)$(BIN_DIR)
+ prayer-ssl-prune $(DESTDIR)$(BIN_DIR)
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_EXEC) \
- prayer-sem-prune $(BROOT)$(BIN_DIR)
+ prayer-sem-prune $(DESTDIR)$(BIN_DIR)
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_EXEC) \
- prayer-db-prune $(BROOT)$(BIN_DIR)
+ prayer-db-prune $(DESTDIR)$(BIN_DIR)
$(INSTALL) -o $(RO_USER) -g $(RO_GROUP) -m $(PUBLIC_EXEC) \
- prayer-cyclog $(BROOT)$(BIN_DIR)
+ prayer-cyclog $(DESTDIR)$(BIN_DIR)
prayer: $(PRAYER_OBJS) prayer_main.o
$(CC) $(LDFLAGS) -o prayer $(PRAYER_OBJS) prayer_main.o $(PRAYER_LIBS)
/trunk/debian/patches/session_server_bugs.patch
0,0 → 1,12
--- prayer-1.0.18.orig/prayer/session_server.c
+++ prayer-1.0.18/prayer/session_server.c
@@ -375,7 +375,8 @@
if (!os_signal_child_init(os_child_reaper))
return (NIL);
- name = pool_strcat(NIL, config->socket_dir, "/init");
+ name = pool_printf(NIL, "%s/%s",
+ config->socket_dir, config->init_socket_name);
if ((sockfd = os_bind_unix_socket(name)) < 0)
return (NIL);
/trunk/debian/patches/pidfiles_extension.patch
0,0 → 1,22
--- prayer-1.0.18.orig/prayer/prayer_main.c
+++ prayer-1.0.18/prayer/prayer_main.c
@@ -111,7 +111,7 @@
static BOOL prayer_main_write_pid(struct config *config)
{
- char *name = pool_printf(NIL, "%s/prayer", config->pid_dir);
+ char *name = pool_printf(NIL, "%s/prayer.pid", config->pid_dir);
FILE *file;
if ((file = fopen(name, "w")) == NIL)
--- prayer-1.0.18.orig/prayer/session_main.c
+++ prayer-1.0.18/prayer/session_main.c
@@ -32,7 +32,7 @@
static BOOL session_main_write_pid(struct config *config)
{
- char *name = pool_printf(NIL, "%s/prayer-session", config->pid_dir);
+ char *name = pool_printf(NIL, "%s/prayer-session.pid", config->pid_dir);
FILE *file;
if ((file = fopen(name, "w")) == NIL)
/trunk/debian/patches/series
0,0 → 1,8
includes.patch
makefile_install_config.patch
session_unix_bugs.patch
session_server_bugs.patch
hasnochildren_means_noinferiors.patch
pidfiles_extension.patch
ipv6.patch
utf8.patch
/trunk/debian/changelog
0,0 → 1,5
prayer (1.0.18-1) experimental; urgency=low
 
* Initial release (Closes: #392823)
 
-- Magnus Holmgren <magnus@kibibyte.se> Sat, 10 Mar 2007 14:24:21 +0100
/trunk/debian/prayer-session.8.dbk
0,0 → 1,158
<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
 
<!--
 
Process this file with an XSLT processor: `xsltproc \
-''-nonet /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
manpages/docbook.xslb manpage.dbk'. A manual page
<package>.<section> will be generated. You may view the
manual page with: nroff -man <package>.<section> | less'. A
typical entry in a Makefile or Makefile.am is:
 
DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
manpages/docbook.xsl
XP=xsltproc -''-nonet
 
manpage.1: manpage.dbk
$(XP) $(DB2MAN) $<
The xsltproc binary is found in the xsltproc package. The
XSL files are in docbook-xsl. Please remember that if you
create the nroff version in one of the debian/rules file
targets (such as build), you will need to include xsltproc
and docbook-xsl in your Build-Depends control field.
 
-->
 
<!-- Fill in your name for FIRSTNAME and SURNAME. -->
<!ENTITY dhfirstname "<firstname>Magnus</firstname>">
<!ENTITY dhsurname "<surname>Holmgren</surname>">
<!-- Please adjust the date whenever revising the manpage. -->
<!ENTITY dhdate "<date>oktober 24, 2006</date>">
<!-- SECTION should be 1-8, maybe w/ subsection other parameters are
allowed: see man(7), man(1). -->
<!ENTITY dhsection "<manvolnum>8</manvolnum>">
<!ENTITY dhemail "<email>magnus@kibibyte.se</email>">
<!ENTITY dhusername "Magnus Holmgren">
<!ENTITY dhucpackage "<refentrytitle>PRAYER</refentrytitle>">
<!ENTITY dhpackage "prayer-session">
 
<!ENTITY debian "<productname>Debian</productname>">
<!ENTITY gnu "<acronym>GNU</acronym>">
<!ENTITY gpl "&gnu; <acronym>GPL</acronym>">
]>
 
<refentry>
<refentryinfo>
<address>
&dhemail;
</address>
<author>
&dhfirstname;
&dhsurname;
</author>
<copyright>
<year>2006</year>
<holder>&dhusername;</holder>
</copyright>
&dhdate;
</refentryinfo>
<refmeta>
&dhucpackage;
 
&dhsection;
</refmeta>
<refnamediv>
<refname>&dhpackage;</refname>
 
<refpurpose>a fast stand-alone webmail server</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>&dhpackage;</command>
 
<arg><option><replaceable>OPTION</replaceable></option></arg>...</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>DESCRIPTION</title>
 
<para>This manual page documents briefly the
<command>&dhpackage;</command> command.</para>
 
<para>This manual page was written for the &debian; distribution
because the original program does not have a manual page.</para>
 
<para><command>&dhpackage;</command> is a program that...</para>
 
</refsect1>
<refsect1>
<title>OPTIONS</title>
 
<variablelist>
<varlistentry>
<term>
<option>--config-file <replaceable>filename</replaceable></option>
</term>
<listitem>
<para>Define prayer config file (Overrides compilation default and PRAYER_CONFIG_FILE environment variable).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--config-option <replaceable>option</replaceable>=<replaceable>value</replaceable></option>
</term>
<listitem>
<para>Override single configuration option.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--foreground</option>
</term>
<listitem>
<para>Run single threaded server in foreground.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--debug</option>
</term>
<listitem>
<para>Enable debugging.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--help</option>
</term>
<listitem>
<para>Show option summary.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>SEE ALSO</title>
 
<para>prayer(8), prayer.cf(5).</para>
 
</refsect1>
<refsect1>
<title>AUTHOR</title>
 
<para>This manual page was written by &dhusername; &dhemail; for
the &debian; system (but may be used by others). Permission is
granted to copy, distribute and/or modify this document under
the terms of the &gnu; General Public License, Version 2 any
later version published by the Free Software Foundation.
</para>
<para>
On Debian systems, the complete text of the GNU General Public
License can be found in /usr/share/common-licenses/GPL.
</para>
 
</refsect1>
</refentry>
 
/trunk/debian/prayer.docs
0,0 → 1,11
docs/CMD_LINE
docs/DESIGN
docs/DONE-OLD
docs/FEATURES
docs/ICONLIST
docs/LOGS
docs/NOTICE
docs/README
docs/SECURITY
docs/TODO
docs/URL_OPTIONS
/trunk/debian/rules
0,0 → 1,24
#!/usr/bin/make -f
# Sample debian/rules that uses cdbs. Originaly written by Robert Millan.
# This file is public domain.
 
DEB_AUTO_CLEANUP_RCS := yes
 
# Add here any variable or target overrides you need
 
makebuilddir/prayer::
cp debian/Config .
 
include /usr/share/cdbs/1/class/makefile.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/patchsys-quilt.mk
 
#DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) make
DEB_MAKE_INSTALL_TARGET = install DESTDIR=$(CURDIR)/debian/tmp
DEB_INSTALL_CHANGELOGS_ALL = docs/DONE
DEB_INSTALL_DOCS_ALL = -XCVS
DEB_DH_INSTALL_ARGS = -XCVS
DEB_DH_INSTALL_SOURCEDIR = debian/tmp
 
clean::
rm -f Config
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: debian/prayer-accountd.dirs
===================================================================
--- debian/prayer-accountd.dirs (nonexistent)
+++ debian/prayer-accountd.dirs (revision 3)
@@ -0,0 +1 @@
+/var/run/prayer
Index: debian/prayer.logrotate
===================================================================
--- debian/prayer.logrotate (nonexistent)
+++ debian/prayer.logrotate (revision 3)
@@ -0,0 +1,8 @@
+/var/log/prayer/prayer /var/log/prayer/prayer_session /var/log/prayer/access_log /var/log/prayer/session_log {
+ rotate 28
+ daily
+ compress
+ delaycompress
+ missingok
+ notifempty
+}
Index: debian/prayer.dirs
===================================================================
--- debian/prayer.dirs (nonexistent)
+++ debian/prayer.dirs (revision 3)
@@ -0,0 +1,2 @@
+var/run/prayer
+var/log/prayer
Index: debian/prayer-accountd.init
===================================================================
--- debian/prayer-accountd.init (nonexistent)
+++ debian/prayer-accountd.init (revision 3)
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides: prayer-accountd
+# Required-Start:
+# Required-Stop:
+# Should-Start: $local_fs
+# Should-Stop: $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Prayer account helper daemon
+# Description: Lets users change passwords, manage filters and other things not supported by IMAP itself
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/sbin/prayer-accountd
+PIDFILE=/var/run/prayer/accountd.pid
+DESC="Prayer account helper server"
+
+test -x $DAEMON || exit 0
+
+egrep -iq "^[[:space:]]*accountd_port[[:space:]]*=[[:space:]]*[[:digit:]]+[[:space:]]*$" /etc/prayer/accountd.cf || exit 0
+
+. /lib/lsb/init-functions
+
+# Include prayer defaults if available
+if [ -f /etc/default/prayer-accountd ] ; then
+ . /etc/default/prayer-accountd
+fi
+
+set +e
+
+start() {
+ log_daemon_msg "Starting $DESC" "accountd"
+ start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE \
+ --exec $DAEMON -- $DAEMON_OPTS
+ log_end_msg $?
+}
+
+stop() {
+ log_daemon_msg "Stopping $DESC"
+ if [ -f "$PIDFILE" ]; then
+ start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
+ log_progress_msg "accountd"
+ fi
+ rm -f "$PIDFILE"
+ log_end_msg 0
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+
+ stop)
+ stop
+ ;;
+
+ restart|force-reload)
+ stop
+ start
+ ;;
+ *)
+ N=/etc/init.d/prayer-accountd
+ # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+ log_failure_msg "Usage: $N {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
Index: debian/prayer.init
===================================================================
--- debian/prayer.init (nonexistent)
+++ debian/prayer.init (revision 3)
@@ -0,0 +1,89 @@
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides: prayer
+# Required-Start:
+# Required-Stop:
+# Should-Start: $local_fs
+# Should-Stop: $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Prayer init script
+# Description: Init script for prayer services
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+FRONTEND_DAEMON=/usr/sbin/prayer
+SESSION_DAEMON=/usr/sbin/prayer-session
+FRONTEND_PIDFILE=/var/run/prayer/prayer.pid
+SESSION_PIDFILE=/var/run/prayer/prayer-session.pid
+DESC="webmail server"
+
+test -x $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
+ENABLED=0
+
+# Include prayer defaults if available
+if [ -f /etc/default/prayer ] ; then
+ . /etc/default/prayer
+fi
+
+set +e
+
+start() {
+ if [ "$ENABLED" = "0" ]; then
+ echo "Prayer is disabled. Please set ENABLED=1 in /etc/default/prayer"
+ echo "after adapting /etc/prayer/prayer.cf to your needs."
+ exit 0
+ fi
+
+ log_daemon_msg "Starting $DESC" "prayer"
+ start-stop-daemon --start --pidfile $FRONTEND_PIDFILE \
+ --exec $FRONTEND_DAEMON -- $DAEMON_OPTS
+ log_end_msg $?
+}
+
+stop() {
+ log_daemon_msg "Stopping $DESC"
+ if [ -f "$SESSION_PIDFILE" ]; then
+ start-stop-daemon --stop --quiet --oknodo --pidfile $SESSION_PIDFILE
+ log_progress_msg "prayer-session"
+ fi
+ if [ -f "$FRONTEND_PIDFILE" ]; then
+ start-stop-daemon --stop --quiet --oknodo --pidfile $FRONTEND_PIDFILE
+ start-stop-daemon --stop --quiet --oknodo --exec $FRONTEND_DAEMON
+ log_progress_msg "prayer"
+ fi
+ rm -f "$FRONTEND_PIDFILE" "$SESSION_PIDFILE"
+ log_end_msg 0
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+
+ stop)
+ stop
+ ;;
+
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented, move the "force-reload"
+ # option to the "reload" entry above. If not, "force-reload" is
+ # just the same as "restart".
+ #
+ stop
+ start
+ ;;
+ *)
+ N=/etc/init.d/prayer
+ # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+ log_failure_msg "Usage: $N {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
Index: debian/prayer-accountd.install
===================================================================
--- debian/prayer-accountd.install (nonexistent)
+++ debian/prayer-accountd.install (revision 3)
@@ -0,0 +1,2 @@
+usr/sbin/prayer-accountd
+etc/prayer/accountd.cf
Index: debian/Config
===================================================================
--- debian/Config (nonexistent)
+++ debian/Config (revision 3)
@@ -0,0 +1,160 @@
+# $Cambridge: hermes/src/prayer/defaults/Config,v 1.5 2006/04/05 12:35:35 fanf2 Exp $
+#
+# Prayer - a Webmail Interface
+#
+# Copyright (c) University of Cambridge 2000 - 2002
+# See the file NOTICE for conditions of use and distribution.
+#
+# Conventional Configure file.
+
+SSL_ENABLE = true # SSL requires OpenSSL
+SESSION_CACHE_ENABLE = true # SSL session cache Requires Berkeley DB 3 or 4
+GZIP_ENABLE = true # Enable on the fly compression of pages
+LDAP_ENABLE = true # Add LDAP interface
+FENCE_ENABLE = false # Use Electric Fence to catch malloc problems
+DIRECT_ENABLE = false # Experimental. Leave this switched off...
+MUTEX_SEMAPHORE = true # Use SYSV mutexes rather than file locking
+
+# Following depend on the way that you have configured c-client
+CCLIENT_SSL_ENABLE = false # C-client was built with SSL support
+CCLIENT_PAM_ENABLE = false # C-client was built with PAM support
+CCLIENT_KERB_ENABLE = false # C-client was built with Kerberos support
+
+# Probably don't need the following
+ACCOUNTD_ENABLE = true # Only of use in Cambridge at the moment.
+ACCOUNTD_SSL_ENABLE = true # Enable SSL support in account management daemon
+ACCOUNTD_PAM_ENABLE = true # Enable PAM support in account management daemon
+ACCOUNTD_USE_BSD_PTY = true # Use Berkeley PTYs rather than Sys V PTYs
+
+############################################################################
+# Location of compiler
+CC = gcc
+# Location of make program (GNU make required)
+MAKE = make
+# Location of install program (GNU install or compatible required)
+INSTALL = install
+
+# Base Compiler options for GCC.
+#BASECFLAGS = -Wall -g
+#BASELDFLAGS = -g
+BASECFLAGS = -Wall -g -O2
+BASELDFLAGS = -g -O2
+BASE_LIBS = -lcrypt
+
+# Base Compiler options for Sun SUNWspro compiler
+#CC = /opt/SUNWspro/bin/cc
+#BASECFLAGS = -fast
+#BASELDFLAGS = -s
+#BASE_LIBS = -lcrypt -lxnet
+
+############################################################################
+# Location of various include files and libraries.
+############################################################################
+
+# Location of c-client library.
+#
+# Following works if we have a vanilla c-client installation at same level
+# as the prayer installation. Relies on a symbolic link ./prayer/c-client
+# which points to ../../imap/c-client. This just reduces the amount of
+# noise output on each line when building the package.
+#
+CCLIENT_DIR=/usr/include/c-client
+CCLIENT_INCLUDE=-I$(CCLIENT_DIR)
+CCLIENT_LIBS=-lc-client
+
+#
+# Following works with the mail/cclient port from FreeBSD
+#
+#CCLIENT_INCLUDE = -I/usr/local/include/c-client
+#CCLIENT_LIBS = -L/usr/local/lib -lc-client4
+#
+# Complication:
+# The FreeBSD port uses PAM and optionally SSL if built WITH_SSL=yes.
+#
+#CCLIENT_SSL_ENABLE = true
+#CCLIENT_KERB_ENABLE = true
+
+############################################################################
+
+# Electric fence (required if FENCE_ENABLE set)
+FENCE_INCLUDE=
+FENCE_LIBS=-lmcheck
+
+# Zlib (required if GZIP_ENABLE set)
+Z_INCLUDE =
+Z_LIBS = -lz
+
+# LDAP (required if LDAP_ENABLE set)
+LDAP_INCLUDE =
+LDAP_LIBS = -lldap
+
+# Pam (required if CCLIENT_PAM_ENABLE set)
+PAM_INCLUDE =
+PAM_LIBS = -lpam
+
+# Kerberos (required if CCLIENT_KERB_ENABLE set)
+KERB_INCLUDE =
+KERB_LIBS = -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err
+
+# SSL definitions (required if SSL_ENABLE or CCLIENT_SSL_ENABLE set)
+#
+# Following suitable for Linux and FreeBSD which have SSL preinstalled
+# (Header files from OpenSSL 0.9.7 want to include various Kerboros stuff)
+#
+SSL_INCLUDE=
+SSL_LIBS=-lssl -lcrypto
+OPENSSL=openssl
+
+# Following definitions suitable for our Sun systems.
+#SSL_BASE=/opt/local/ssl/current
+#SSL_INCLUDE=-I ${SSL_BASE}/include
+#SSL_LIBS=-L ${SSL_BASE}/lib -lssl -lcrypto
+#OPENSSL=${SSL_BASE}/bin/openssl
+
+# DB definitions (required if SESSION_CACHE_ENABLE set)
+#
+# Following suitable for Redhat Linux which has DB 3 preinstalled
+DB_INCLUDE=
+DB_LIBS=-ldb
+
+# Following suitable for FreeBSD with DB 4 package installed
+#DB_INCLUDE=-I/usr/local/include/db4
+#DB_LIBS=-L/usr/local/lib -ldb4
+
+############################################################################
+
+# Install location of prayer configuration and support files. The initial
+# config file runs prayer processes as user "prayer" and group "prayer".
+# If you are using SSL, the certificate file must be readable by RW_USER or
+# RW_GROUP. It is important that nothing else can read the certificate file.
+
+# Build root (used by Redhat RPM system)
+BROOT=$(CURDIR)/../debian/tmp
+
+# Directory, User and group for read-write files: log files, sockets etc
+VAR_PREFIX = /var/lib/prayer
+RW_USER = root
+RW_GROUP = root
+
+# Root Directory, User and group for read-only configuration files.
+# Default configuration and permissions does not allow prayer user to
+# update prayer configuration file.
+
+PREFIX = /usr/share/prayer
+RO_USER = root
+RO_GROUP = root
+
+# Access permissions for general objects (wrt above users and groups)
+PUBLIC_EXEC = 0755
+PUBLIC_DIR = 0755
+PUBLIC_FILE = 0644
+
+# Access permissions for private objects (wrt above users and groups)
+PRIVATE_EXEC = 0750
+PRIVATE_DIR = 0750
+PRIVATE_FILE = 0640
+
+# Location of configuration files and binaries
+PRAYER_CONFIG_FILE = /etc/prayer/prayer.cf
+BIN_DIR = /usr/sbin
+ACCOUNTD_CONFIG_FILE = /etc/prayer/accountd.cf
Index: debian/watch
===================================================================
--- debian/watch (nonexistent)
+++ debian/watch (revision 3)
@@ -0,0 +1,9 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# to check for upstream updates and more.
+# See uscan(1) for format
+
+# Compulsory line, this is a version 3 file
+version=3
+
+ftp://ftp.csx.cam.ac.uk/pub/software/email/prayer/prayer-(.*)\.tar\.gz debian uupdate
Index: debian/prayer.8.dbk
===================================================================
--- debian/prayer.8.dbk (nonexistent)
+++ debian/prayer.8.dbk (revision 3)
@@ -0,0 +1,178 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+
+<!--
+
+Process this file with an XSLT processor: `xsltproc \
+-''-nonet /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
+manpages/docbook.xslb manpage.dbk'. A manual page
+<package>.<section> will be generated. You may view the
+manual page with: nroff -man <package>.<section> | less'. A
+typical entry in a Makefile or Makefile.am is:
+
+DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\
+manpages/docbook.xsl
+XP=xsltproc -''-nonet
+
+manpage.1: manpage.dbk
+ $(XP) $(DB2MAN) $<
+
+The xsltproc binary is found in the xsltproc package. The
+XSL files are in docbook-xsl. Please remember that if you
+create the nroff version in one of the debian/rules file
+targets (such as build), you will need to include xsltproc
+and docbook-xsl in your Build-Depends control field.
+
+-->
+
+ <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+ <!ENTITY dhfirstname "<firstname>Magnus</firstname>">
+ <!ENTITY dhsurname "<surname>Holmgren</surname>">
+ <!-- Please adjust the date whenever revising the manpage. -->
+ <!ENTITY dhdate "<date>oktober 24, 2006</date>">
+ <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
+ allowed: see man(7), man(1). -->
+ <!ENTITY dhsection "<manvolnum>8</manvolnum>">
+ <!ENTITY dhemail "<email>magnus@kibibyte.se</email>">
+ <!ENTITY dhusername "Magnus Holmgren">
+ <!ENTITY dhucpackage "<refentrytitle>PRAYER</refentrytitle>">
+ <!ENTITY dhpackage "prayer">
+
+ <!ENTITY debian "<productname>Debian</productname>">
+ <!ENTITY gnu "<acronym>GNU</acronym>">
+ <!ENTITY gpl "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+ <refentryinfo>
+ <address>
+ &dhemail;
+ </address>
+ <author>
+ &dhfirstname;
+ &dhsurname;
+ </author>
+ <copyright>
+ <year>2006</year>
+ <holder>&dhusername;</holder>
+ </copyright>
+ &dhdate;
+ </refentryinfo>
+ <refmeta>
+ &dhucpackage;
+
+ &dhsection;
+ </refmeta>
+ <refnamediv>
+ <refname>&dhpackage;</refname>
+
+ <refpurpose>a fast stand-alone webmail server</refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>&dhpackage;</command>
+
+ <arg><option><replaceable>OPTION</replaceable></option></arg>... -- <arg><option><replaceable>PRAYER-SESSION-OPTION</replaceable></option></arg> ...
+ </cmdsynopsis>
+ </refsynopsisdiv>
+ <refsect1>
+ <title>DESCRIPTION</title>
+
+ <para>This manual page documents briefly the
+ <command>&dhpackage;</command> and <command>bar</command>
+ commands.</para>
+
+ <para>This manual page was written for the &debian; distribution
+ because the original program does not have a manual page.
+ Instead, it has documentation in the &gnu;
+ <application>Info</application> format; see below.</para>
+
+ <para><command>&dhpackage;</command> is a program that...</para>
+
+ </refsect1>
+ <refsect1>
+ <title>OPTIONS</title>
+
+ <variablelist>
+ <varlistentry>
+ <term>
+ <option>--config-file <replaceable>filename</replaceable></option>
+ </term>
+ <listitem>
+ <para>Define prayer config file (Overrides compilation default and PRAYER_CONFIG_FILE environment variable).</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>--config-option <replaceable>option</replaceable>=<replaceable>value</replaceable></option>
+ </term>
+ <listitem>
+ <para>Override single configuration option.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>--foreground</option>
+ </term>
+ <listitem>
+ <para>Run single threaded server in foreground.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>--disable-prefork</option>
+ </term>
+ <listitem>
+ <para>Run as simple fork()/exec() daemon.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>--disable-session</option>
+ </term>
+ <listitem>
+ <para>Don't start up prayer-session server.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>--</option>
+ </term>
+ <listitem>
+ <para>End of prayer options: remaining options will be passed to prayer-session server process.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>--help</option>
+ </term>
+ <listitem>
+ <para>Show option summary.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+ <refsect1>
+ <title>SEE ALSO</title>
+
+ <para>prayer-session(8), prayer.cf(5).</para>
+
+ </refsect1>
+ <refsect1>
+ <title>AUTHOR</title>
+
+ <para>This manual page was written by &dhusername; &dhemail; for
+ the &debian; system (but may be used by others). Permission is
+ granted to copy, distribute and/or modify this document under
+ the terms of the &gnu; General Public License, Version 2 any
+ later version published by the Free Software Foundation.
+ </para>
+ <para>
+ On Debian systems, the complete text of the GNU General Public
+ License can be found in /usr/share/common-licenses/GPL.
+ </para>
+
+ </refsect1>
+</refentry>
+
Index: debian/prayer.install
===================================================================
--- debian/prayer.install (nonexistent)
+++ debian/prayer.install (revision 3)
@@ -0,0 +1,10 @@
+usr/sbin/prayer
+usr/sbin/prayer-session
+usr/sbin/prayer-chroot
+usr/sbin/prayer-db-prune
+usr/sbin/prayer-sem-prune
+usr/sbin/prayer-ssl-prune
+usr/share/prayer
+etc/prayer/prayer.cf
+etc/prayer/motd.html
+etc/prayer/welcome.html
Index: debian/copyright
===================================================================
--- debian/copyright (nonexistent)
+++ debian/copyright (revision 3)
@@ -0,0 +1,83 @@
+This package was debianized by Magnus Holmgren <magnus@kibibyte.se> on
+Tue, 24 Oct 2006 21:08:34 +0200.
+
+It was downloaded from http://www-uxsup.csx.cam.ac.uk/~dpc22/prayer/
+
+Upstream author/maintainer: David Carter <dpc22@cam.ac.uk> et al.
+
+The Debian packaging is (C) 2006, Magnus Holmgren <magnus@kibibyte.se>
+and is licensed under the GPL.
+
+The original licence is as follows (from the file NOTICE in the upstream
+distribution); the GPL should be in /usr/share/common-licenses/GPL on a debian
+system.
+
+
+The Prayer Webmail Interface
+----------------------------
+
+Copyright (c) 2002 University of Cambridge
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+In addition, for the avoidance of any doubt, permission is granted to
+link this program with OpenSSL or any other library package.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA
+
+INCORPORATED CODE
+-----------------
+
+Code implementing the SSL session cache has been adapted from code used by
+the Cyrus IMAP server, which is distributed under the following copyright:
+
+/* Copyright (c) 2000 Carnegie Mellon University. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The name "Carnegie Mellon University" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For permission or any other legal
+ * details, please contact
+ * Office of Technology Transfer
+ * Carnegie Mellon University
+ * 5000 Forbes Avenue
+ * Pittsburgh, PA 15213-3890
+ * (412) 268-4387, fax: (412) 268-7395
+ * tech-transfer@andrew.cmu.edu
+ *
+ * 4. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by Computing Services
+ * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
+ *
+ * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
Index: debian/README.Debian
===================================================================
--- debian/README.Debian (nonexistent)
+++ debian/README.Debian (revision 3)
@@ -0,0 +1,51 @@
+prayer for Debian
+-----------------
+
+The Debian version of Prayer is built with SSL support with session
+cache using libdb4.3, gzip Content-Transfer-Encoding, LDAP, and System
+V mutex support. Some bigger and some smaller changes have been made:
+
+ * As the upstream web page explains, "Prayer was designed to work
+ with the Washington IMAP server, which has the most problems
+ associated with transient IMAP connections. Consequently, the user
+ interface distinguishes between mailboxes and directories: this will
+ not work well with servers which provide dual use mail folders."
+ A simple patch from Jonathan McDowell at least makes leaf folders
+ be treated as folders.
+
+ * This packaging adds IPv6 support. However, prayer-session uses
+ libc-client to connect to the IMAP server, and IPv6 support can only
+ be achieved there by building with the version of libc-client
+ currently in experimental.
+
+ * This packaging adds international character support, including
+ encoding and decoding of modified-UTF-7-encoded folder
+ names. However, the folder filter still works on the UTF-7 level,
+ meaning, for example, that a "-" will match any folder with an
+ encoded character in it, since "-" is the shift-out character that
+ ends every base64-encoded sequence in UTF-7.
+
+ Where it was hardwired to ISO-8859-1 it has been re-wired to UTF-8,
+ but I may have missed some spots and ISO-8859-1 is still the hardcoded
+ fallback character set.
+
+ * The decoding of RFC2047 encoded words has been relaxed, accommodating
+ to some common encoding errors: spaces are accepted in the encoded
+ text, as are overlong encoded words.
+
+
+Quirks:
+
+ * If your IMAP server supports STARTTLS, then Prayer (actually the
+ libc-client IMAP client library) will use it automatically and it
+ can't be turned off. Make sure that the server name you specify for
+ imapd_server in prayer.cf matches the Common Name in the SSL
+ certificate; otherwise libc-client will refuse to accept it.
+
+ * If your IMAP server is Dovecot, then you must change
+ prefs_folder_name to something not containing a dot. Unfortunately
+ this means that the preference folder will be fully visible.
+
+ -- Magnus Holmgren <magnus@kibibyte.se>, Wed, 15 Nov 2006 14:51:00 +0100
+
+Tag: interface::web, made-of::lang:c, made-of::data:html mail::imap, mail::user-agent, protocol::imap, protocol::ssl, protocol::http, role::sw:server, use::viewing, works-with::mail, web::application
Index: debian
===================================================================
--- debian (nonexistent)
+++ debian (revision 3)
/debian
Property changes:
Added: mergeWithUpstream
## -0,0 +1 ##
+1
\ No newline at end of property