[yast-commit] r39094 - in /trunk/ftp-server/src: FtpServer.ycp dialogs.ycp ftp-server.desktop wid_functions.ycp write_load.ycp
Author: juhliarik Date: Fri Jun 29 12:38:00 2007 New Revision: 39094 URL: http://svn.opensuse.org/viewcvs/yast?rev=39094&view=rev Log: added pathes for creating upload dir, correct place of ftp-server icon in YaST etc. Modified: trunk/ftp-server/src/FtpServer.ycp trunk/ftp-server/src/dialogs.ycp trunk/ftp-server/src/ftp-server.desktop trunk/ftp-server/src/wid_functions.ycp trunk/ftp-server/src/write_load.ycp Modified: trunk/ftp-server/src/FtpServer.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/FtpServer.ycp?rev=39094&r1=39093&r2=39094&view=diff ============================================================================== --- trunk/ftp-server/src/FtpServer.ycp (original) +++ trunk/ftp-server/src/FtpServer.ycp Fri Jun 29 12:38:00 2007 @@ -37,6 +37,12 @@ global boolean WriteToEditMap (string key, string value); +global boolean WriteSettings (); + +global boolean WriteUpload (); + +global boolean WriteXinetd (); + /** * Data was modified? */ @@ -96,6 +102,16 @@ global boolean start_xinetd = false; /** + * variable signifies if daemon will be stoped in xinetd + * + * global boolean variable + */ + +global boolean stop_daemon_xinetd = false; + + + +/** * variable signifies if it is create upload dir * only for vsftpd and anonymous connections with allowed upload * @@ -350,6 +366,7 @@ if (result) { result = InitEDIT_SETTINGS (); } + //read info about anonymous user "ftp" Users::SetGUI (false); if ((Users::Read () == "") && (EDIT_SETTINGS["VirtualUser"]:nil == "NO")) { @@ -446,6 +463,21 @@ return true; } + +/** + * Restart daemon apply changes + * only if daemon running... + * + * @return boolean successfull +*/ +//boolean ApplyChanges () { + + + + +//} + + /** * Write firewall configuration * @@ -502,7 +534,7 @@ * * @return boolean successfull */ -boolean WriteSettings () { +global boolean WriteSettings () { boolean result = false; result = WriteToSETTINGS(); if (vsftpd_edit) { @@ -558,7 +590,7 @@ * * @return boolean result of function (true/false) */ -boolean WriteXinetd () { +global boolean WriteXinetd () { boolean result = false; if (vsftpd_xined_id != -1) { result = WriteStartViaXinetd (start_xinetd); @@ -571,26 +603,32 @@ * It is necessary if user want to allow uploading for anonymous * @return boolean result of function (true/false) */ -boolean WriteUpload () { +global boolean WriteUpload () { boolean result = true; string command =""; + string upload =""; integer authentication = tointeger(EDIT_SETTINGS["AnonAuthen"]:nil); if ((vsftpd_edit) && (authentication == 0) && (create_upload_dir) && (upload_good_permission)) { boolean write_enable = ((EDIT_SETTINGS["EnableUpload"]:nil == "YES") ? true:false); boolean anon_upload = ((EDIT_SETTINGS["AnonReadOnly"]:nil == "NO") ? true:false); boolean anon_create_dirs = ((EDIT_SETTINGS["AnonCreatDirs"]:nil == "YES") ? true:false); - if ((write_enable) && ((anon_upload) || (anon_create_dirs))) + if ((write_enable) && ((anon_upload) || (anon_create_dirs))) + if (substring (anon_homedir, (size(anon_homedir)-1)) == "/") + upload ="upload"; + else + upload ="/upload"; command = "dir=`ls "; command = command + anon_homedir; command = command + " | grep upload`; if [ -z $dir ]; then mkdir "; - command = command + anon_homedir +"upload; chown "; + command = command + anon_homedir +upload + "; chown "; if (EDIT_SETTINGS["GuestUser"]:nil !="") - command = command + EDIT_SETTINGS["GuestUser"]:nil +":"+EDIT_SETTINGS["GuestUser"]:nil; - else if (EDIT_SETTINGS["FTPUser"]:nil !="") + command = command + EDIT_SETTINGS["GuestUser"]:nil +":"+EDIT_SETTINGS["GuestUser"]:nil; + else if (EDIT_SETTINGS["FTPUser"]:nil !="") command = command + EDIT_SETTINGS["FTPUser"]:nil +":"+EDIT_SETTINGS["FTPUser"]:nil; - command = command + " " + anon_homedir +"upload; chmod 766 "; - command = command + anon_homedir +"upload; else chmod 766 " + anon_homedir +"upload; fi"; + + command = command + " " + anon_homedir + upload + "; chmod 766 "; + command = command + anon_homedir +upload + "; else chmod 766 " + anon_homedir +"upload; fi"; /* "dir=`ls /srv/ftp/ | grep upload`; if [ -z $dir ]; then echo $dir; mkdir /srv/ftp/upload; chown ftp:ftp /srv/ftp/upload/; chmod 755 /srv/ftp/upload; else chmod 766 /srv/ftp/upload/; fi" Modified: trunk/ftp-server/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/dialogs.ycp?rev=39094&r1=39093&r2=39094&view=diff ============================================================================== --- trunk/ftp-server/src/dialogs.ycp (original) +++ trunk/ftp-server/src/dialogs.ycp Fri Jun 29 12:38:00 2007 @@ -109,7 +109,10 @@ result["service_not_running_label"] = _("FTP is not running"); result["start_now_button"] = _("&Start FTP Now"); result["stop_now_button"] = _("S&top FTP Now"); + result["save_now_action"] = SaveAndRestartVsftpd; result["save_now_button"] = _("Sa&ve Settings and Restart FTP Now"); + result["start_now_action"] = StartNowVsftpd; + result["stop_now_action"] = StopNowVsftpd; result["help"] = sformat (CWMServiceStart::StartStopHelpTemplate (true), // part of help text - push button label, NO SHORTCUT!!! _("Start FTP daemon Now"), @@ -135,7 +138,10 @@ result["service_not_running_label"] = _("FTP is not running"); result["start_now_button"] = _("&Start FTP Now"); result["stop_now_button"] = _("S&top FTP Now"); + result["save_now_action"] = SaveAndRestartPure; result["save_now_button"] = _("Sa&ve Settings and Restart FTP Now"); + result["start_now_action"] = StartNowPure; + result["stop_now_action"] = StopNowPure; result["help"] = sformat (CWMServiceStart::StartStopHelpTemplate (true), // part of help text - push button label, NO SHORTCUT!!! _("Start FTP daemon Now"), Modified: trunk/ftp-server/src/ftp-server.desktop URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/ftp-server.desktop?rev=39094&r1=39093&r2=39094&view=diff ============================================================================== --- trunk/ftp-server/src/ftp-server.desktop (original) +++ trunk/ftp-server/src/ftp-server.desktop Fri Jun 29 12:38:00 2007 @@ -1,6 +1,6 @@ [Desktop Entry] Type=Application -Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Misc; +Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Net_advanced; X-KDE-ModuleType=Library X-KDE-RootOnly=true Modified: trunk/ftp-server/src/wid_functions.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/wid_functions.ycp?rev=39094&r1=39093&r2=39094&view=diff ============================================================================== --- trunk/ftp-server/src/wid_functions.ycp (original) +++ trunk/ftp-server/src/wid_functions.ycp Fri Jun 29 12:38:00 2007 @@ -123,6 +123,264 @@ } } + +/** + * Function start vsftpd + */ +boolean StartNowVsftpd () { + boolean result = false; + if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") { + if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES") + //FtpServer::start_xinetd = true; + Popup::Message("This is not supported now!"); + else { + Popup::Message("This is not supported now!"); + } + } else { + string command = "rcvsftpd start"; + map options = (map)SCR::Execute (.target.bash_output, command); + y2milestone("[ftp-server] (StartNowVsftpd) command for starting vsftpd: %1 output: %2",command, options); + if (options["exit"]:nil == 0) + result = true; + else + result = false; + } + return result; +} + + +/** + * Function stop vsftpd + */ +boolean StopNowVsftpd () { + boolean result = false; +if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") { + if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES") + //FtpServer::start_xinetd = true; + Popup::Message("This is not supported now!"); + else { + Popup::Message("This is not supported now!"); + } + } else { + + string command = "rcvsftpd stop"; + map options = (map)SCR::Execute (.target.bash_output, command); + y2milestone("[ftp-server] (StopNowVsftpd) command for stop vsftpd: %1 output: %2",command, options); + if (options["exit"]:nil == 0) + result = true; + else + result = false; + } + return result; +} + +/** + * Function saves configuration and restarts vsftpd + */ +boolean SaveAndRestartVsftpd () { + + boolean result = false; + if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") { + if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES") + //FtpServer::start_xinetd = true; + Popup::Message("This is not supported now!"); + else { + Popup::Message("This is not supported now!"); + /* + if ((Service::Status("xinetd") != 0) && + (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "NO")) { + if (Mode::normal()) { + UI::OpenDialog( + `VBox( + `Label("Xinetd is not started!"), + `Label("Do you want to start it?"), + `HBox( + `PushButton(`id(`accept), "&Start"), + `PushButton(`id(`cancel), "Canc&el") + ) + ) // end of `VBox( + ); // end of UI::OpenDialog( + while (true) { + any ret = UI::UserInput(); + if ( ret == `accept ) { + FtpServer::EDIT_SETTINGS["StartXinetd"] = "YES"; + FtpServer::start_xinetd = true; + break; + } else if (ret == `cancel) { + //FtpServer::EDIT_SETTINGS["StartXinetd"] = "NO"; + FtpServer::start_xinetd = false; + break; + } + }; + UI::CloseDialog(); + } // end of if (Mode::normal()) { + } // end of if ((Service::Status("xinetd") != 0)... + } + FtpServer::WriteSettings (); + FtpServer::WriteUpload (); + result = FtpServer::WriteXinetd (); + */ + } + } else { + FtpServer::WriteSettings (); + FtpServer::WriteUpload (); + string command = "rcvsftpd restart"; + map options = (map)SCR::Execute (.target.bash_output, command); + y2milestone("[ftp-server] (SaveAndRestartVsftpd) command for save and restart vsftpd: %1 output: %2",command, options); + if (options["exit"]:nil == 0) + result = true; + else + result = false; + } + return result; +} + + +/** + * Function start pure-ftpd + */ + +boolean StartNowPure () { + boolean result = false; + if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") { + if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES") + //FtpServer::start_xinetd = true; + Popup::Message("This is not supported now!"); + else { + Popup::Message("This is not supported now!"); + /* + if ((Service::Status("xinetd") != 0) && + (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "NO")) { + if (Mode::normal()) { + UI::OpenDialog( + `VBox( + `Label("Xinetd is not started!"), + `Label("Do you want to start it?"), + `HBox( + `PushButton(`id(`accept), "&Start"), + `PushButton(`id(`cancel), "Canc&el") + ) + ) // end of `VBox( + ); // end of UI::OpenDialog( + while (true) { + any ret = UI::UserInput(); + if ( ret == `accept ) { + FtpServer::EDIT_SETTINGS["StartXinetd"] = "YES"; + FtpServer::start_xinetd = true; + break; + } else if (ret == `cancel) { + //FtpServer::EDIT_SETTINGS["StartXinetd"] = "NO"; + FtpServer::start_xinetd = false; + break; + } + }; + UI::CloseDialog(); + } // end of if (Mode::normal()) { + } // end of if ((Service::Status("xinetd") != 0)... + } + //FtpServer::WriteSettings (); + result = FtpServer::WriteXinetd (); + y2milestone("[ftp-server] (StopNowPure) command for start pure-ftpd via xinetd"); + */ + } + } else { + string command = "rcpure-ftpd start"; + map options = (map)SCR::Execute (.target.bash_output, command); + y2milestone("[ftp-server] (StartNowPure) command for start pure-ftpd: %1 output: %2",command, options); + if (options["exit"]:nil == 0) + result = true; + else + result = false; + } + return result; +} + +/** + * Function stop pure-ftpd + */ + +boolean StopNowPure () { + boolean result = false; + if ((FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") && (Service::Status("xinetd") != 0)) { + Popup::Message("This is not supported now!"); + /* + FtpServer::stop_daemon_xinetd = true; + result = FtpServer::WriteXinetd (); + */ + } else { + string command = "rcpure-ftpd stop"; + map options = (map)SCR::Execute (.target.bash_output, command); + y2milestone("[ftp-server] (StopNowPure) command for stop pure-ftpd: %1 output: %2",command, options); + if (options["exit"]:nil == 0) + result = true; + else + result = false; + } + return result; +} + +/** + * Function saves configuration and restarts pure-ftpd + */ +boolean SaveAndRestartPure () { + boolean result = false; + if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") { + if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES") + //FtpServer::start_xinetd = true; + Popup::Message("This is not supported now!"); + else { + Popup::Message("This is not supported now!"); + /* + if ((Service::Status("xinetd") != 0) && + (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "NO")) { + if (Mode::normal()) { + UI::OpenDialog( + `VBox( + `Label("Xinetd is not started!"), + `Label("Do you want to start it?"), + `HBox( + `PushButton(`id(`accept), "&Start"), + `PushButton(`id(`cancel), "Canc&el") + ) + ) // end of `VBox( + ); // end of UI::OpenDialog( + while (true) { + any ret = UI::UserInput(); + if ( ret == `accept ) { + FtpServer::EDIT_SETTINGS["StartXinetd"] = "YES"; + FtpServer::start_xinetd = true; + break; + } else if (ret == `cancel) { + //FtpServer::EDIT_SETTINGS["StartXinetd"] = "NO"; + FtpServer::start_xinetd = false; + break; + } + }; + UI::CloseDialog(); + } // end of if (Mode::normal()) { + } // end of if ((Service::Status("xinetd") != 0)... + + } + FtpServer::WriteSettings (); + result = FtpServer::WriteXinetd (); + y2milestone("[ftp-server] (StopNowPure) command for save and restart pure-ftpd via xinetd"); + */ + } + } else { + FtpServer::WriteSettings (); + string command = "rcpure-ftpd restart"; + map options = (map)SCR::Execute (.target.bash_output, command); + y2milestone("[ftp-server] (StopNowPure) command for save and restart pure-ftpd: %1 output: %2",command, options); + if (options["exit"]:nil == 0) + result = true; + else + result = false; + } + return result; +} + + + /** * Init function for general settings * change ValidChars for textentry Modified: trunk/ftp-server/src/write_load.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/write_load.ycp?rev=39094&r1=39093&r2=39094&view=diff ============================================================================== --- trunk/ftp-server/src/write_load.ycp (original) +++ trunk/ftp-server/src/write_load.ycp Fri Jun 29 12:38:00 2007 @@ -212,7 +212,7 @@ boolean WriteStartViaXinetd (boolean startxinetd) { string pure_options = ""; boolean result = false; - if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2"){ + if ((FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") && (!FtpServer::stop_daemon_xinetd)) { if (FtpServer::vsftpd_edit) { Inetd::netd_conf[FtpServer::vsftpd_xined_id,"enabled"] = true; Inetd::netd_conf[FtpServer::pureftpd_xined_id,"enabled"] = false; @@ -231,6 +231,7 @@ if (startxinetd) Inetd::netd_status = 0; //start xinetd if not running else reload } else { + Inetd::netd_status = 0; Inetd::netd_conf[FtpServer::pureftpd_xined_id,"enabled"] = false; Inetd::netd_conf[FtpServer::vsftpd_xined_id,"enabled"] = false; } //end of else [ if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2")] -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
juhliarik@svn.opensuse.org