#!/bin/bash # 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. # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # This script updates a cache of the unix group database. It's purpose is to # speedup group authorization when using large groups with slow nss backends. # For more info consult the README.groupcache file. # # This script can safely be run as root, it will reexec itself as user # cyrus if needed. # # author: Simon Matter, Invoca Systems # changelog # v1.0.0, Dec 15 2004 Simon Matter # - initial release # # v1.0.1, Nov 29 2007 Simon Matter # - add ability to handle "@include" options in imapd.conf, patch # provided by Tim Bannister # # v1.1.0, Sep 29 2008 Simon Matter # - create group.cache in $PWD # check that we were called as user 'cyrus' if [ ! $(whoami) = "cyrus" ]; then echo "This script should be run as user 'cyrus' from cyrus-master." echo "Check the README to learn howto configure it in /etc/cyrus.conf." exit 1 fi # files get mode 0600 umask 166 TMPCACHE=$(mktemp group.cache.XXXXXX) || exit 1 getent group >> $TMPCACHE mv -f $TMPCACHE group.cache