ACC SHELL

Path : /usr/share/YaST2/clients/
File Upload :
Current File : //usr/share/YaST2/clients/mail-server_ldap-setup.ycp

/**
 * File:
 *   clients/mail-server-ldap-setup.ycp
 *
 * Package:
 *   Configuration of mail
 *
 * Summary:
 *   Setup of a LDAP server to be able store the mail server datas
 *
 * Authors:
 *   Peter Varkoly <varkoly@novell.com>
 *
 * $Id: mail.ycp 37642 2007-04-20 19:06:52Z varkoly $
 *
 *
 */

{
textdomain "mail";
import     "Label";
import     "MailServerLDAP";
import     "Package";
import     "Report";

    string ERROR = "";
    list args = WFM::Args();
    string         to_install = "";
    list<string> l_to_install = [];


    y2milestone("--- mail-server-ldap-setup ---");
    // First we check if all requested modules are installed
    if( contains(args,"setup") && !Package::Installed ( "yast2-ldap-server" ) )
    {
	l_to_install = add( l_to_install, "yast2-ldap-server" );
	to_install   = to_install + "yast2-ldap-server\n";
    }
    if( contains(args,"setup") && !Package::Installed ( "openldap2" ) )
    {
	l_to_install = add( l_to_install, "openldap2" );
	to_install   = to_install + "openldap2\n";
    }
    if( contains(args,"setup") && !Package::Installed ( "bind-utils" ) )
    {
	l_to_install = add( l_to_install, "bind-utils" );
	to_install   = to_install + "bind-utils\n";
    }
    if(contains(args,"ca_mgm") )
    {
	if( !Package::Installed ( "yast2-ca-management" ) )
	{
		l_to_install = add( l_to_install, "yast2-ca-management" );
		to_install   = to_install + "yast2-ca-management\n";
	}
    }
    if(to_install != "")
    {
        if ( Report::AnyQuestion ("",_("You have not installed all needed packages.") +
                                  "\n"+to_install+"\n",
                                  Label::InstallButton(),
                                  Label::AbortButton(),
                                  `focus_yes))
        {
            Package::DoInstall(l_to_install);
        }
        else
        {
            return false;
        }
    }

    //Now we start the requested modules
    if(contains(args,"ca_mgm") )
    {
	WFM::CallFunction("ca_mgm",[]);
    }
    if(contains(args,"setup") )
    {
	WFM::CallFunction("ldap-server",[]);
    }
    if(contains(args,"conf") )
    {
        WFM::CallFunction("ldap",[]);
    }
    if(contains(args,"local"))
    {
	map<string,any> LDB = MailServerLDAP::ConfigureLDAPServer();
        SCR::Write(.sysconfig.ldap.BASE_CONFIG_DN,"ou=ldapconfig,"+LDB["suffix"]:"");
        SCR::Write(.sysconfig.ldap.BIND_DN,LDB["rootdn"]:"");
        SCR::Write(.sysconfig.ldap,nil);
	SCR::Write (add (.etc.ldap_conf.v."/etc/ldap.conf","host"), ["localhost"]);
	SCR::Write (add (.etc.ldap_conf.v."/etc/ldap.conf","base"), [ LDB["suffix"]:""]);
	SCR::Write (add (.etc.ldap_conf.v."/etc/ldap.conf","ldap_version"), ["3"]);
	//SCR::Write (add (.etc.ldap_conf.v."/etc/ldap.conf","ldap_version"), ["3"]);
	//SCR::Write (add (.etc.ldap_conf.v."/etc/ldap.conf","ssl"), ["start_tls"]);
	SCR::Write(.etc.ldap_conf, nil);
    }
    return true;
}

ACC SHELL 2018