{

my $auth = $openupload{'Authentication'} || 'ldap';
my $ldapbase = esmith::util::ldapBase($DomainName);

if ($auth eq 'imap'){
    $OUT .=<<"EOF";

\$CONFIG['auth'] = 'imap';
\$CONFIG['imap']['server'] = "\{localhost/imap/notls\}";
\$CONFIG['imap']['domain'] = "$DomainName";
\$CONFIG['imap']['default_group'] = 'registered';

EOF
}
elsif ($auth eq 'database' or $auth eq 'internal'){
    $OUT .=<<"EOF";

\$CONFIG['auth'] = 'default';

EOF
}
elsif ($auth eq 'ldap' or $auth eq 'LemonLDAP'){

    if ($auth eq 'ldap'){
        $OUT .= "\$CONFIG['auth'] = 'ldap';\n";
    }
    elsif ($auth eq 'LemonLDAP'){
        $OUT .= "\$CONFIG['auth'] = 'httpldap';\n";
        $OUT .= "\$CONFIG['httpldap']['login'] = 'HTTP_AUTH_USER';\n";
    }
    $OUT .=<<"EOF";

\$CONFIG['ldap']['host'] = '127.0.0.1';
\$CONFIG['ldap']['basedn'] = "$ldapbase";
\$CONFIG['ldap']['userdn'] = 'ou=Users,$ldapbase';
\$CONFIG['ldap']['userclass'] = 'inetOrgPerson';
\$CONFIG['ldap']['uid'] = 'uid';
\$CONFIG['ldap']['userfields'] = array ( 'uid' => 'login', 'cn' => 'name', 'gidnumber' => 'group_id', 'mail' => 'email');
\$CONFIG['ldap']['groupdn'] = 'ou=Groups,$ldapbase';
\$CONFIG['ldap']['groupclass'] = 'mailboxRelatedObject';
\$CONFIG['ldap']['gid'] = 'gidNumber';
\$CONFIG['ldap']['sgid'] = 'memberUid';
\$CONFIG['ldap']['groupfields'] = array ( 'cn' => 'name', 'description' => 'description' );
\$CONFIG['ldap']['sgroupfields'] = array ( 'cn' => 'name', 'description' => 'description' );

EOF
}
}
