$OpenBSD: patch-cgi-bin_openwebmail_shares_ow-shared_pl,v 1.3 2005/02/17 01:46:33 kevlo Exp $
--- cgi-bin/openwebmail/shares/ow-shared.pl.orig	Fri Nov 12 10:38:07 2004
+++ cgi-bin/openwebmail/shares/ow-shared.pl	Fri Nov 12 14:12:41 2004
@@ -231,14 +231,14 @@
 ########## USERENV_INIT ##########################################
 # init user globals, switch euid
 sub userenv_init {
-   load_owconf(\%config_raw, "$SCRIPT_DIR/etc/defaults/openwebmail.conf");
-   read_owconf(\%config, \%config_raw, "$SCRIPT_DIR/etc/openwebmail.conf") if (-f "$SCRIPT_DIR/etc/openwebmail.conf");
+   load_owconf(\%config_raw, "%%SYSCONFDIR%%/openwebmail/defaults/openwebmail.conf");
+   read_owconf(\%config, \%config_raw, "%%SYSCONFDIR%%/openwebmail/openwebmail.conf") if (-f "%%SYSCONFDIR%%/openwebmail/openwebmail.conf");
    loadlang($config{'default_language'});	# so %lang... can be used in error msg
 
    if ($config{'smtpauth'}) {	# load smtp auth user/pass
-      read_owconf(\%config, \%config_raw, "$SCRIPT_DIR/etc/smtpauth.conf");
+      read_owconf(\%config, \%config_raw, "%%SYSCONFDIR%%/openwebmail/smtpauth.conf");
       if ($config{'smtpauth_username'} eq "" || $config{'smtpauth_password'} eq "") {
-         openwebmailerror(__FILE__, __LINE__, "$SCRIPT_DIR/etc/smtpauth.conf $lang_err{'param_fmterr'}");
+         openwebmailerror(__FILE__, __LINE__, "%%SYSCONFDIR%%/openwebmail/smtpauth.conf $lang_err{'param_fmterr'}");
       }
    }
 
@@ -334,7 +334,7 @@ sub userenv_init {
 
    umask(0077);
    if ( $>==0 ) {			# switch to uuid:mailgid if script is setuid root.
-      my $mailgid=getgrnam('mail');	# for better compatibility with other mail progs
+      my $mailgid=getgrnam('_mail');	# for better compatibility with other mail progs
       ow::suid::set_euid_egids($uuid, $mailgid, $ugid);
       if ( $)!~/\b$mailgid\b/) { # group mail doesn't exist?
          openwebmailerror(__FILE__, __LINE__, "Set effective gid to mail($mailgid) failed!");
@@ -1272,7 +1272,7 @@ sub htmlfooter {
 ########## OPENWEBMAILERROR ######################################
 sub openwebmailerror {
    my ($file, $linenum, $msg)=@_;
-   my $mailgid=getgrnam('mail');
+   my $mailgid=getgrnam('_mail');
    my $stackdump='';
    $file=~s!.*/!!;
    $msg="Unknow error $msg at $file:$linenum" if (length($msg)<5);
