Installing Horde 3.x & IMP 4.x on OpenBSD

So, you've got an OpenBSD server and you want to use the new ultra-schnazzy Horde 3.x and IMP 4.x packages on it, but you're having problems?

The common error is that the sidebar disappears (specifically, when rendering the 'imp-folders' block, sidebar.php errors leaving a white, empty frame) or you can only view your INBOX in IMP (clicking on the folders button does nothing). The solution took me a while to figure out, but thanks to Hermann Gottschalk (initial solution posted here), it can work beutifully.

The reason is that for IMAP authenication (or IMP over IMAP authentication), Horde uses the IMAP binding in PHP (It's the php-imap package in OpenBSD). This, in turn, uses the c-client library for many of the IMAP routines. For some ungodly reason, c-client checks that the user it is running as exists in the /etc/pwd.db file, but only for some IMAP functions (not all...which is odd). On OpenBSD, Apache runs as user 'www', so c-client only needs that record in /etc/pwd.db. Since Apache runs chroot'ed on OpenBSD by default, you have to create a local copy of that under the chroot'ed directory. But, the pwd.db file is created using the pwd_mkdb program, so you have to do the following.

solution:
As root, issue the following

 # mkdir -p /var/www/etc
 # cp /etc/master.passwd /var/www/etc
 # vi /var/www/etc/master.passwd
   (remove all lines except the one for user 'www')
 # pwd_mkdb -d /var/www/etc /var/www/etc/master.passwd
That's it!