2007/01/31

squirrelmail-1.4.8-2.el4.centos4でログインIDにデフォルトのドメイン名

バーチャルドメインを運用すると、ユーザーアカウント名にドメイン名を付加する事が有ります。
しかし、大部分の人は固定のドメイン名が付加されている場合デフォルトのドメイン名が有ればユーザビリティが良く成ります。

以下の部分を変更

----------------------------------------------------------------
変更ファイル名:
/usr/share/squirrelmail/src/redirect.php

以下の行(208行目付近)を追加(太字部分)

if (!sqsession_is_registered('user_is_logged_in')) {
do_hook ('login_before');

$onetimepad = OneTimePadCreate(strlen($secretkey));
$key = OneTimePadEncrypt($secretkey, $onetimepad);
sqsession_register($onetimepad, 'onetimepad');

/* remove redundant spaces */
$login_username = trim($login_username);

/* @が無い場合はデフォルトのドメイン名を追加 @example.com */
$domainpos = strrpos($login_username,"@");
if ($domainpos === false) {
$login_username .= "@example.com";
}

/* Verify that username and password are correct. */
if ($force_username_lowercase) {
$login_username = strtolower($login_username);
}

----------------------------------------------------------------

2007/01/30

squirrelmail-1.4.8-2.el4.centos4で添付ファイル名が文字化け

件名と同じ直し方で文字化けしなくなったので暫く使う
 →解決しなかった
  結局、1.4.9aの日本語パッチを手動で当てた事で解決
  http://www.yamaai-tech.com/~masato/Download/

以下の部分を変更

----------------------------------------------------------------
変更ファイル名:
/usr/share/squirrelmail/functions/i18n.php

以下の行(540行目)の内容を変更
変更前:
case 'downloadfilename':
$useragent = func_get_arg(2);
if (strstr($useragent, 'Windows') !== false ||
strstr($useragent, 'Mac_') !== false) {
$ret = mb_convert_encoding($ret, 'SJIS', 'AUTO');
} else {
$ret = mb_convert_encoding($ret, 'EUC-JP', 'AUTO');
}
break;

変更後:
case 'downloadfilename':
$useragent = func_get_arg(2);
if (strstr($useragent, 'Windows') !== false ||
strstr($useragent, 'Mac_') !== false) {
$ret = mb_convert_encoding($ret, 'UTF-8', 'AUTO');
} else {
$ret = mb_convert_encoding($ret, 'EUC-JP', 'AUTO');
}
break;
----------------------------------------------------------------

----------------------------------------------------------------
変更ファイル名:
/usr/share/squirrelmail/functions/mime.php

以下の行(2160行目)の内容を変更
変更前:
if (preg_match('/compatible; MSIE ([0-9]+)/', $HTTP_USER_AGENT, $match) &&
((int)$match[1]) >= 6 && strstr($HTTP_USER_AGENT, 'Opera') === false) {
$isIE6plus = true;
}

変更後:
if (preg_match('/compatible; MSIE\s?([0-9]+)/', $HTTP_USER_AGENT, $match) &&
((int)$match[1]) >= 6 && strstr($HTTP_USER_AGENT, 'Opera') === false) {
$isIE6plus = true;
}
----------------------------------------------------------------

2007/01/25

squirrelmail-1.4.8-2.el4.centos4で件名が文字化け


「http://www.squirrelmail.jp/node.php?id=290」より引用

以下の部分を変更
----------------------------------------------------------------
変更ファイル名:
/usr/share/squirrelmail/class/deliver/Deliver.class.php

563行目~569行目あたりのswitch構文の中に、
case 'Subject':
を追加
}
}
$hdr_s .= $sLine;
break;
case 'Subject':
case 'To':
case 'Cc':
case 'Bcc':
case 'From':
$hdr_s .= $header[$i];
break;
default: $hdr_s .= $this->foldLine($header[$i], 78, str_pad('',4)); break;
}

----------------------------------------------------------------

2007/01/24

オンラインでLVMボリュームを拡張した


[root@paradise ~]# df
Filesystem 1K-ブロック 使用 使用可 使用% マウント位置
/dev/hda5 13827976 2910672 10214864 23% /
/dev/hda1 101086 11504 84363 12% /boot
none 199044 0 199044 0% /dev/shm
/dev/mapper/gp00-vol00
20642428 77944 19515908 1% /home
/dev/hda3 505636 11767 467764 3% /var/log
[root@paradise ~]# fdisk -l

Disk /dev/hda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = シリンダ数 of 16065 * 512 = 8225280 bytes

デバイス Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 144 1052257+ 82 Linux スワップ
/dev/hda3 145 209 522112+ 83 Linux
/dev/hda4 210 1958 14048842+ 5 拡張領域
/dev/hda5 210 1958 14048811 83 Linux

Disk /dev/hdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = シリンダ数 of 16065 * 512 = 8225280 bytes

デバイス Boot Start End Blocks Id System
/dev/hdb1 * 1 3916 31455238+ 8e Linux LVM

Disk /dev/hdd: 32.2 GB, 32212254720 bytes
15 heads, 63 sectors/track, 66576 cylinders
Units = シリンダ数 of 945 * 512 = 483840 bytes

デバイス Boot Start End Blocks Id System
/dev/hdd1 1 66576 31457128+ 8e Linux LVM
[root@paradise ~]# /usr/sbin/vgextend gp00 /dev/hdd1
Physical volume '/dev/hdd1' is already in volume group 'gp00'
Unable to add physical volume '/dev/hdd1' to volume group 'gp00'.
[root@paradise ~]# lvextend -L+1024MB gp00/vol00
Extending logical volume vol00 to 31.00 GB
Logical volume vol00 successfully resized
[root@paradise ~]# lvextend -L+1024MB gp00/vol00
Extending logical volume vol00 to 32.00 GB
Logical volume vol00 successfully resized
[root@paradise ~]# lvextend -L+1024MB gp00/vol00
Extending logical volume vol00 to 33.00 GB
Logical volume vol00 successfully resized
[root@paradise ~]# lvextend -L+17GB gp00/vol00
Extending logical volume vol00 to 50.00 GB
Logical volume vol00 successfully resized
[root@paradise ~]# lvextend -L+5GB gp00/vol00
Extending logical volume vol00 to 55.00 GB
Logical volume vol00 successfully resized
[root@paradise ~]#
    ・
    ・
    ・
[root@paradise ~]#
[root@paradise ~]#
ext2online /dev/mapper/gp00-vol00
ext2online v1.1.18 - 2001/03/18 for EXT2FS 0.5b
[root@paradise ~]# df
Filesystem 1K-ブロック 使用 使用可 使用% マウント位置
/dev/hda5 13827976 2910744 10214792 23% /
/dev/hda1 101086 11504 84363 12% /boot
none 199044 0 199044 0% /dev/shm
/dev/mapper/gp00-vol00
56766780 86032 53797612 1% /home
/dev/hda3 505636 11907 467624 3% /var/log
[root@paradise ~]#

2007/01/13

Fedora DS 起動スクリプト

起動スクリプトをファイル名fdsとして、次の内容で作成しました。



#!/bin/sh
#
# fds Start/Stop Fedora Directory Server
#
# chkconfig: 345 20 20
# description: Fedora Directory Server
# processname: ns-slapd

# Source Directory name
if [ -f /etc/sysconfig/fds ]; then
. /etc/sysconfig/fds
else
echo $"Directory name is not defined in /etc/sysconfig/fds"
exit 1
fi

SLAPD_PATH=/opt/fedora-ds/

case "$1" in
start)
$SLAPD_PATH/slapd-$DIRECTORYNAME/start-slapd
$SLAPD_PATH/start-admin
;;
stop)
$SLAPD_PATH/stop-admin
$SLAPD_PATH/slapd-$DIRECTORYNAME/stop-slapd
;;
restart)
$SLAPD_PATH/restart-admin
$SLAPD_PATH/slapd-$DIRECTORYNAME/restart-slapd
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac

exit $?



ディレクトリサービスの起動スクリプト start-slapdは、作成したディレクトリ名に依存するため、/etc/sysconfig/fdsで設定するようにしてあります。
/etc/sysconfig/fdsに

DIRECTORYNAME=servername

のようにディレクトリの識別子を指定してファイルを作成してください。

またfdsファイルを作成したら、次の手順で、システムに登録を行います。


# cp fds /etc/rc.d/init.d/fds
# chmod 755 /etc/rc.d/init.d/fds
# /sbin/chkconfig fds --add
# /sbin/chkconfig fds on

これで起動時にFDSのディレクトリサーバと管理サーバを自動起動、自動停止することが可能になります。

また、手動でFDSの起動、停止をしたいときは、それぞれ次々のコマンドで可能になります。


# /sbin/service fds start
# /sbin/service fds stop
# /sbin/service fds restart

注意: FC5ではLDAPを利用する設定にした場合、messagebusサービスより先に、FDSが起動していないと、システムが起動しなくなります。