- 论坛徽章:
- 0
|
10可用积分
在创建用户时,同时为它创建邮箱,并写入另一个文件。
该如何追究代码?
也就是说,将下面的代码转用perl实现。
# To add user to file mailbox
# for example: xiujuan@tree-inc.com tree-inc.com/xiujuan/Maildir/
echo -e $account $domain/$user/Maildir/ >> /etc/postfix/mailbox
postmap /etc/postfix/mailbox #
============================================
# create_user(&details)
# Creates a new user with the given details
sub create_user
{# add to 'passwd_file'
$lref = &read_file_lines($config{'passwd_file'});
$_[0]->{'line'} = &nis_index($lref);
if (defined(@list_users_cache)) {
map { $_->{'line'}++ if ($_->{'line'} >= $_[0]->{'line'}) }
@list_users_cache;
}
splice(@$lref, $_[0]->{'line'}, 0,
"$_[0]->{'user'}:".
($pft == 2 || $pft == 5 ? "x" : $pft == 4 ? "!" :
$_[0]->{'pass'}).
"$_[0]->{'uid'} $_[0]->{'gid'} $_[0]->{'home'}");
}
[ 本帖最后由 zhg2008 于 2008-2-23 14:44 编辑 ] |
|