Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libyui for openSUSE:Factory checked 
in at 2023-01-11 17:14:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libyui (Old)
 and      /work/SRC/openSUSE:Factory/.libyui.new.32243 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libyui"

Wed Jan 11 17:14:16 2023 rev:84 rq:1057656 version:4.4.8

Changes:
--------
--- /work/SRC/openSUSE:Factory/libyui/libyui.changes    2022-12-07 
17:35:50.500827144 +0100
+++ /work/SRC/openSUSE:Factory/.libyui.new.32243/libyui.changes 2023-01-11 
17:14:18.579566855 +0100
@@ -1,0 +2,11 @@
+Tue Jan 10 12:42:09 UTC 2023 - Ladislav Slezák <lsle...@suse.com>
+
+- NCurses REST API - fixed RunInTerminal behavior (bsc#1206929)
+  Stop the REST API server during execution of the
+  RunInTerminal() call. This allows the subprocess to open
+  it's own REST API server using the same port.
+  This is useful for the ncurses YaST control center which
+  starts other YaST modules as subprocesses.
+- 4.4.8
+
+-------------------------------------------------------------------

Old:
----
  libyui-4.4.7.tar.bz2

New:
----
  libyui-4.4.8.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libyui-bindings.spec ++++++
--- /var/tmp/diff_new_pack.llFU9n/_old  2023-01-11 17:14:19.727573535 +0100
+++ /var/tmp/diff_new_pack.llFU9n/_new  2023-01-11 17:14:19.731573558 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package libyui-bindings
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
 Name:           libyui-bindings
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 Summary:        Bindings for libyui
 License:        LGPL-2.1-only OR LGPL-3.0-only

++++++ libyui-ncurses-pkg.spec ++++++
--- /var/tmp/diff_new_pack.llFU9n/_old  2023-01-11 17:14:19.755573698 +0100
+++ /var/tmp/diff_new_pack.llFU9n/_new  2023-01-11 17:14:19.759573721 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package libyui-ncurses-pkg
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 Name:           libyui-ncurses-pkg
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16

libyui-ncurses-rest-api.spec: same change
libyui-ncurses.spec: same change
++++++ libyui-qt-graph.spec ++++++
--- /var/tmp/diff_new_pack.llFU9n/_old  2023-01-11 17:14:19.827574117 +0100
+++ /var/tmp/diff_new_pack.llFU9n/_new  2023-01-11 17:14:19.831574140 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package libyui-qt-graph
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 Name:           libyui-qt-graph
 
 # DO NOT manually bump the version here; instead, use   rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16

++++++ libyui-qt-pkg.spec ++++++
--- /var/tmp/diff_new_pack.llFU9n/_old  2023-01-11 17:14:19.875574396 +0100
+++ /var/tmp/diff_new_pack.llFU9n/_new  2023-01-11 17:14:19.879574419 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package libyui-qt-pkg
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 Name:           libyui-qt-pkg
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16

libyui-qt-rest-api.spec: same change
libyui-qt.spec: same change
libyui-rest-api.spec: same change
libyui.spec: same change
++++++ libyui-4.4.7.tar.bz2 -> libyui-4.4.8.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/VERSION.cmake 
new/libyui-4.4.8/VERSION.cmake
--- old/libyui-4.4.7/VERSION.cmake      2022-12-06 14:56:32.000000000 +0100
+++ new/libyui-4.4.8/VERSION.cmake      2023-01-10 18:10:44.000000000 +0100
@@ -1,6 +1,6 @@
 SET( VERSION_MAJOR "4")
 SET( VERSION_MINOR "4" )
-SET( VERSION_PATCH "7" )
+SET( VERSION_PATCH "8" )
 SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
 
 SET( SONAME_MAJOR "16" )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/libyui-ncurses/src/YNCursesUI.cc 
new/libyui-4.4.8/libyui-ncurses/src/YNCursesUI.cc
--- old/libyui-4.4.7/libyui-ncurses/src/YNCursesUI.cc   2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/libyui-ncurses/src/YNCursesUI.cc   2023-01-10 
18:10:44.000000000 +0100
@@ -83,7 +83,12 @@
        // The encoding of a terminal (xterm, konsole etc.) can never change; 
the encoding
        // of the "real" console is changed in setConsoleFont().
        NCstring::setTerminalEncoding( encoding );
-       app()->setLanguage( language, encoding );
+
+       // see NCApplication::setLanguage()
+       // NOTE: we cannot call app()->setLanguage() here because that would 
initialize
+       // the app() to the NCApplication instead of NCHttpApplication
+       // when running with REST API (when calling the base class constructor 
from YNCHttpUI)
+       setlocale( LC_NUMERIC, "C" );   // always format numbers with "."
     }
 
     YButtonBoxMargins buttonBoxMargins;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libyui-4.4.7/libyui-ncurses-rest-api/src/CMakeLists.txt 
new/libyui-4.4.8/libyui-ncurses-rest-api/src/CMakeLists.txt
--- old/libyui-4.4.7/libyui-ncurses-rest-api/src/CMakeLists.txt 2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/libyui-ncurses-rest-api/src/CMakeLists.txt 2023-01-10 
18:10:44.000000000 +0100
@@ -29,6 +29,7 @@
   YNCHttpUI.cc
   YNCHttpWidgetsActionHandler.cc
   YNCWidgetActionHandler.cc
+  NCHttpApplication.cc
   NCHttpWidgetFactory.cc
   NCHttpDialog.cc
   )
@@ -38,6 +39,7 @@
   YNCHttpUI.h
   YNCHttpWidgetsActionHandler.h
   YNCWidgetActionHandler.h
+  NCHttpApplication.h
   NCHttpWidgetFactory.h
   NCHttpDialog.h
   )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libyui-4.4.7/libyui-ncurses-rest-api/src/NCHttpApplication.cc 
new/libyui-4.4.8/libyui-ncurses-rest-api/src/NCHttpApplication.cc
--- old/libyui-4.4.7/libyui-ncurses-rest-api/src/NCHttpApplication.cc   
1970-01-01 01:00:00.000000000 +0100
+++ new/libyui-4.4.8/libyui-ncurses-rest-api/src/NCHttpApplication.cc   
2023-01-10 18:10:44.000000000 +0100
@@ -0,0 +1,41 @@
+/*
+  Copyright (C) 2023 SUSE LLC
+
+  This library is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) version 3.0 of the License. This library
+  is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+  License for more details. You should have received a copy of the GNU
+  Lesser General Public License along with this library; if not, write
+  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+  Floor, Boston, MA 02110-1301 USA
+*/
+
+#include <yui/rest-api/YHttpServer.h>
+#include <yui/ncurses/NCApplication.h>
+
+#include "NCHttpApplication.h"
+
+int
+NCHttpApplication::runInTerminal( const std::string & cmd )
+{
+    // temporarily stop the REST API server to avoid conflicts
+    // when running another program which also uses libyui with REST API
+    // (like YaST), the started process will open its own REST API server
+    YHttpServer::yserver()->stop();
+    // run the base class implementation
+    int ret = NCApplication::runInTerminal(cmd);
+    YHttpServer::yserver()->start();
+    return ret;
+}
+
+NCHttpApplication::NCHttpApplication()
+{
+}
+
+NCHttpApplication::~NCHttpApplication()
+{
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libyui-4.4.7/libyui-ncurses-rest-api/src/NCHttpApplication.h 
new/libyui-4.4.8/libyui-ncurses-rest-api/src/NCHttpApplication.h
--- old/libyui-4.4.7/libyui-ncurses-rest-api/src/NCHttpApplication.h    
1970-01-01 01:00:00.000000000 +0100
+++ new/libyui-4.4.8/libyui-ncurses-rest-api/src/NCHttpApplication.h    
2023-01-10 18:10:44.000000000 +0100
@@ -0,0 +1,48 @@
+/*
+  Copyright (C) 2023 SUSE LLC
+
+  This library is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) version 3.0 of the License. This library
+  is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+  License for more details. You should have received a copy of the GNU
+  Lesser General Public License along with this library; if not, write
+  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+  Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef NCHttpApplication_h
+#define NCHttpApplication_h
+
+#include <yui/ncurses/NCApplication.h>
+
+class NCHttpApplication: public NCApplication
+{
+
+  protected:
+
+    friend class YNCHttpUI;
+
+    /**
+     * Constructor.
+     *
+     * Use YUI::app() to get the singleton for this class.
+     **/
+    NCHttpApplication();
+
+    /**
+     * Destructor.
+     **/
+    virtual ~NCHttpApplication();
+
+
+  public:
+
+    virtual int runInTerminal( const std::string & command ) override;
+};
+
+
+#endif // NCHttpApplication_h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libyui-4.4.7/libyui-ncurses-rest-api/src/YNCHttpUI.cc 
new/libyui-4.4.8/libyui-ncurses-rest-api/src/YNCHttpUI.cc
--- old/libyui-4.4.7/libyui-ncurses-rest-api/src/YNCHttpUI.cc   2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/libyui-ncurses-rest-api/src/YNCHttpUI.cc   2023-01-10 
18:10:44.000000000 +0100
@@ -24,6 +24,7 @@
 
 #include "YNCHttpUI.h"
 #include "YNCHttpWidgetsActionHandler.h"
+#include "NCHttpApplication.h"
 #include "NCHttpWidgetFactory.h"
 #include "NCHttpDialog.h"
 
@@ -169,3 +170,12 @@
 
     return factory;
 }
+
+YApplication *
+YNCHttpUI::createApplication()
+{
+    NCHttpApplication * app = new NCHttpApplication();
+    YUI_CHECK_NEW( app );
+
+    return app;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/libyui-ncurses-rest-api/src/YNCHttpUI.h 
new/libyui-4.4.8/libyui-ncurses-rest-api/src/YNCHttpUI.h
--- old/libyui-4.4.7/libyui-ncurses-rest-api/src/YNCHttpUI.h    2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/libyui-ncurses-rest-api/src/YNCHttpUI.h    2023-01-10 
18:10:44.000000000 +0100
@@ -24,11 +24,10 @@
 #define YNCHttpUI_h
 
 #include <yui/YUI.h>
+#include <yui/YApplication.h>
+#include <yui/YWidgetFactory.h>
 #include <yui/ncurses/YNCursesUI.h>
-#include <yui/ncurses/NCApplication.h>
 #include <yui/ncurses/NCurses.h>
-#include "NCHttpWidgetFactory.h"
-
 
 class YNCHttpUI: public YNCursesUI
 {
@@ -49,6 +48,8 @@
      */
     virtual void idleLoop( int fd_ycp );
 
+protected:
+
     /**
      * Widget factory that provides all the createXY() methods for
      * standard (mandatory, i.e. non-optional) widgets.
@@ -57,6 +58,13 @@
      * so need to create NCHttpDialog instead there.
      **/
     virtual YWidgetFactory * createWidgetFactory();
+
+    /*
+     * Create the YApplication object that provides global methods.
+     *
+     * Reimplemented from YNCursesUI.
+     **/
+    virtual YApplication * createApplication();
 };
 
 /**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libyui-4.4.7/libyui-ncurses-rest-api/src/YNCWidgetActionHandler.cc 
new/libyui-4.4.8/libyui-ncurses-rest-api/src/YNCWidgetActionHandler.cc
--- old/libyui-4.4.7/libyui-ncurses-rest-api/src/YNCWidgetActionHandler.cc      
2022-12-06 14:56:32.000000000 +0100
+++ new/libyui-4.4.8/libyui-ncurses-rest-api/src/YNCWidgetActionHandler.cc      
2023-01-10 18:10:44.000000000 +0100
@@ -16,6 +16,8 @@
 
 #include "YNCWidgetActionHandler.h"
 
+#include "NCHttpWidgetFactory.h"
+
 void YNCWidgetActionHandler::activate_widget( YCheckBoxFrame * widget )
 {
     activate_nc_widget( widget );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/libyui-rest-api/doc/README.md 
new/libyui-4.4.8/libyui-rest-api/doc/README.md
--- old/libyui-4.4.7/libyui-rest-api/doc/README.md      2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/libyui-rest-api/doc/README.md      2023-01-10 
18:10:44.000000000 +0100
@@ -1,16 +1,17 @@
 ## Table of Contents
-* [libyui-rest-api](#libyui-rest-api)
-    * [Features](#features)
-    * [TODO](#todo)
-    * [Usage](#usage)
-        * [Remote Access](#remote-access)
-        * [User Authentication](#user-authentication)
-        * [Reuse of the socket](#reuse-of-the-socket)
-    * [Contributing](#contributing)
-    * [Building](#building)
-    * [Testing](#testing)
-    * [Troubleshooting](#troubleshooting)
-* [License](#license)
+- [libyui-rest-api](#libyui-rest-api)
+  - [Features](#features)
+  - [TODO](#todo)
+  - [Usage](#usage)
+    - [Remote Access](#remote-access)
+    - [User Authentication](#user-authentication)
+    - [Reuse of the socket](#reuse-of-the-socket)
+  - [Building](#building)
+  - [Testing](#testing)
+  - [Troubleshooting](#troubleshooting)
+  - [Notes](#notes)
+  - [Contributing](#contributing)
+  - [License](#license)
 
 # libyui-rest-api
 
@@ -170,6 +171,16 @@
    sudo ./build-all install --rest-api
    ```
 
+## Notes
+
+During the `RunInTerminal` call the REST API is temporarily stopped to
+allow the started process to possibly open its own REST API server on the same 
port.
+
+If it does not use the REST API then during the execution of the process
+the REST API is not available (you will get a `connection denied` error).
+
+If the new process uses a REST API there still might be a short time before the
+subprocess opens the port when the REST API is not running.
 
 ## Contributing
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/libyui-rest-api/doc/TODO.md 
new/libyui-4.4.8/libyui-rest-api/doc/TODO.md
--- old/libyui-4.4.7/libyui-rest-api/doc/TODO.md        2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/libyui-rest-api/doc/TODO.md        2023-01-10 
18:10:44.000000000 +0100
@@ -2,22 +2,15 @@
 
 ## Important
 
-- [ ] Split the package into separate Ncurses and Qt parts
-(less dependencies, not possible to test a minimal system without X)
 - [ ] Improve the plugin loading (it requires to pass the `ui`
 UI and decide in libyui whether to use the Qt/ncurses with REST API)
 - [ ] Support for more widgets and attributes
 
 ## Security
 
-- [ ] User authentication via basic auth([tutorial](
-https://www.gnu.org/software/libmicrohttpd/tutorial.html#Supporting-basic-authentication),
-[documentation](https://www.gnu.org/software/libmicrohttpd/manual/html_node/microhttpd_002ddauth-basic.html#microhttpd_002ddauth-basic),
-[example](https://github.com/Metaswitch/libmicrohttpd/blob/master/src/examples/authorization_example.c))
 - [ ] SSL for encryption and peer verification 
([tutorial](https://www.gnu.org/software/libmicrohttpd/tutorial.html#Adding-a-layer-of-security))
 
 
 ## Optional
 
 - [ ] Support also the Gtk UI
-- [ ] IPv6 support 
([example](https://github.com/rboulton/libmicrohttpd/blob/master/src/examples/dual_stack_example.c))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/libyui-rest-api/src/YHttpServer.cc 
new/libyui-4.4.8/libyui-rest-api/src/YHttpServer.cc
--- old/libyui-4.4.7/libyui-rest-api/src/YHttpServer.cc 2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/libyui-rest-api/src/YHttpServer.cc 2023-01-10 
18:10:44.000000000 +0100
@@ -102,37 +102,31 @@
     if (const char *user = getenv(YUI_AUTH_USER))
     {
         auth_user = user;
-        // unset to not leak to the child processes
-        unsetenv(YUI_AUTH_USER);
     }
 
     // authorization password set?
     if (const char *pwd = getenv(YUI_AUTH_PASSWD))
     {
         auth_passwd = pwd;
-        // unset to not leak to the child processes
-        unsetenv(YUI_AUTH_PASSWD);
     }
 
     if (auth_user.empty() && auth_passwd.empty())
         yuiWarning() << "User authentication not configured! " \
             "You can pass it via environment variables " <<
             YUI_AUTH_USER << " and " << YUI_AUTH_PASSWD <<std::endl;
+
+    // initialize the path handlers
+    mount("/", "GET", new YHttpRootHandler(), false);
+    mount("/dialog", "GET", new YHttpDialogHandler());
+    mount("/widgets", "GET", new YHttpWidgetsHandler());
+    mount("/widgets", "POST", get_widget_action_handler());
+    mount("/application", "GET", new YHttpAppHandler());
+    mount("/version", "GET", new YHttpVersionHandler(), false);
 }
 
 YHttpServer::~YHttpServer()
 {
-    yuiMilestone() << "Finishing the REST API HTTP server..." << std::endl;
-
-    if (server_v4) {
-        yuiMilestone() << "Stopping IPv4 HTTP server" << std::endl;
-        MHD_stop_daemon(server_v4);
-    }
-
-    if (server_v6) {
-        yuiMilestone() << "Stopping IPv6 HTTP server" << std::endl;
-        MHD_stop_daemon(server_v6);
-    }
+    stop();
 }
 
 // add the server file descriptors to the socket lists
@@ -266,59 +260,58 @@
 
 void YHttpServer::start()
 {
-    mount("/", "GET", new YHttpRootHandler(), false);
-    mount("/dialog", "GET", new YHttpDialogHandler());
-    mount("/widgets", "GET", new YHttpWidgetsHandler());
-    mount("/widgets", "POST", get_widget_action_handler());
-    mount("/application", "GET", new YHttpAppHandler());
-    mount("/version", "GET", new YHttpVersionHandler(), false);
-
     bool remote = remote_access();
 
-    // setup the IPv4 server
-    sockaddr_in server_socket;
-    server_socket.sin_family = AF_INET;
-    server_socket.sin_port = htons(port_num());
-    server_socket.sin_addr.s_addr = listen_address_v4(remote);
-    server_v4 = MHD_start_daemon (
-                        // enable debugging output (on STDERR)
-                        MHD_USE_DEBUG,
-                        // the port number to use
-                        port_num(),
-                        // handler for new connections
-                        &onConnect, this,
-                        // handler for processing requests
-                        &requestHandler, this,
-                        // allow or forbid reusing the socket for multiple 
processes
-                        MHD_OPTION_LISTENING_ADDRESS_REUSE, port_reuse(),
-                        // set the port and interface to listen to
-                        MHD_OPTION_SOCK_ADDR, &server_socket,
-                        // finish the argument list
-                        MHD_OPTION_END);
-
-    // setup the IPv6 server
-    sockaddr_in6 server_socket_v6;
-    server_socket_v6.sin6_family = AF_INET6;
-    server_socket_v6.sin6_port = htons(port_num());
-    server_socket_v6.sin6_addr = listen_address_v6(remote);
-    server_v6 = MHD_start_daemon (
-                        // enable debugging output (on STDERR)
-                        MHD_USE_DEBUG |
-                        // use IPv6
-                        MHD_USE_IPv6,
-                        // the port number to use
-                        port_num(),
-                        // handler for new connections
-                        &onConnect, this,
-                        // handler for processing requests
-                        &requestHandler, this,
-                        // disable reusing the socket for multiple processes,
-                        // for security reasons allow only one process to use 
this port
-                        MHD_OPTION_LISTENING_ADDRESS_REUSE, port_reuse(),
-                        // set the port and interface to listen to
-                        MHD_OPTION_SOCK_ADDR, &server_socket_v6,
-                        // finish the argument list
-                        MHD_OPTION_END);
+    if (server_v4 == nullptr)
+    {
+        // setup the IPv4 server
+        sockaddr_in server_socket;
+        server_socket.sin_family = AF_INET;
+        server_socket.sin_port = htons(port_num());
+        server_socket.sin_addr.s_addr = listen_address_v4(remote);
+        server_v4 = MHD_start_daemon (
+                            // enable debugging output (on STDERR)
+                            MHD_USE_DEBUG,
+                            // the port number to use
+                            port_num(),
+                            // handler for new connections
+                            &onConnect, this,
+                            // handler for processing requests
+                            &requestHandler, this,
+                            // allow or forbid reusing the socket for multiple 
processes
+                            MHD_OPTION_LISTENING_ADDRESS_REUSE, port_reuse(),
+                            // set the port and interface to listen to
+                            MHD_OPTION_SOCK_ADDR, &server_socket,
+                            // finish the argument list
+                            MHD_OPTION_END);
+    }
+
+    if (server_v6 == nullptr)
+    {
+        // setup the IPv6 server
+        sockaddr_in6 server_socket_v6;
+        server_socket_v6.sin6_family = AF_INET6;
+        server_socket_v6.sin6_port = htons(port_num());
+        server_socket_v6.sin6_addr = listen_address_v6(remote);
+        server_v6 = MHD_start_daemon (
+                            // enable debugging output (on STDERR)
+                            MHD_USE_DEBUG |
+                            // use IPv6
+                            MHD_USE_IPv6,
+                            // the port number to use
+                            port_num(),
+                            // handler for new connections
+                            &onConnect, this,
+                            // handler for processing requests
+                            &requestHandler, this,
+                            // disable reusing the socket for multiple 
processes,
+                            // for security reasons allow only one process to 
use this port
+                            MHD_OPTION_LISTENING_ADDRESS_REUSE, port_reuse(),
+                            // set the port and interface to listen to
+                            MHD_OPTION_SOCK_ADDR, &server_socket_v6,
+                            // finish the argument list
+                            MHD_OPTION_END);
+    }
 
     if (server_v4 == nullptr) {
       std::cerr << "Cannot start the IPv4 HTTP server at port " << port_num() 
<< std::endl;
@@ -338,6 +331,23 @@
     // FIXME: exit when no server available?
 }
 
+void YHttpServer::stop()
+{
+    yuiMilestone() << "Stopping the REST API HTTP server..." << std::endl;
+
+    if (server_v4) {
+        yuiMilestone() << "Stopping IPv4 HTTP server" << std::endl;
+        MHD_stop_daemon(server_v4);
+        server_v4 = nullptr;
+    }
+
+    if (server_v6) {
+        yuiMilestone() << "Stopping IPv6 HTTP server" << std::endl;
+        MHD_stop_daemon(server_v6);
+        server_v6 = nullptr;
+    }
+}
+
 bool YHttpServer::process_data()
 {
     redraw = false;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/libyui-rest-api/src/YHttpServer.h 
new/libyui-4.4.8/libyui-rest-api/src/YHttpServer.h
--- old/libyui-4.4.7/libyui-rest-api/src/YHttpServer.h  2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/libyui-rest-api/src/YHttpServer.h  2023-01-10 
18:10:44.000000000 +0100
@@ -70,6 +70,12 @@
     void start();
 
     /**
+     * Stop the HTTP server. The server is also stopped automatically in the
+     * destructor.
+     */
+    void stop();
+
+    /**
      * Process the data by the HTTP server
      * @return true if the UI content has been changed and it should be 
refreshed
      */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui-bindings.spec 
new/libyui-4.4.8/package/libyui-bindings.spec
--- old/libyui-4.4.7/package/libyui-bindings.spec       2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/package/libyui-bindings.spec       2023-01-10 
18:10:44.000000000 +0100
@@ -20,7 +20,7 @@
 Name:           libyui-bindings
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 Summary:        Bindings for libyui
 License:        LGPL-2.1-only OR LGPL-3.0-only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui-ncurses-pkg.spec 
new/libyui-4.4.8/package/libyui-ncurses-pkg.spec
--- old/libyui-4.4.7/package/libyui-ncurses-pkg.spec    2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/package/libyui-ncurses-pkg.spec    2023-01-10 
18:10:44.000000000 +0100
@@ -19,7 +19,7 @@
 Name:           libyui-ncurses-pkg
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui-ncurses-rest-api.spec 
new/libyui-4.4.8/package/libyui-ncurses-rest-api.spec
--- old/libyui-4.4.7/package/libyui-ncurses-rest-api.spec       2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/package/libyui-ncurses-rest-api.spec       2023-01-10 
18:10:44.000000000 +0100
@@ -19,7 +19,7 @@
 Name:           libyui-ncurses-rest-api
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui-ncurses.spec 
new/libyui-4.4.8/package/libyui-ncurses.spec
--- old/libyui-4.4.7/package/libyui-ncurses.spec        2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/package/libyui-ncurses.spec        2023-01-10 
18:10:44.000000000 +0100
@@ -19,7 +19,7 @@
 Name:           libyui-ncurses
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui-qt-graph.spec 
new/libyui-4.4.8/package/libyui-qt-graph.spec
--- old/libyui-4.4.7/package/libyui-qt-graph.spec       2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/package/libyui-qt-graph.spec       2023-01-10 
18:10:44.000000000 +0100
@@ -19,7 +19,7 @@
 Name:           libyui-qt-graph
 
 # DO NOT manually bump the version here; instead, use   rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui-qt-pkg.spec 
new/libyui-4.4.8/package/libyui-qt-pkg.spec
--- old/libyui-4.4.7/package/libyui-qt-pkg.spec 2022-12-06 14:56:32.000000000 
+0100
+++ new/libyui-4.4.8/package/libyui-qt-pkg.spec 2023-01-10 18:10:44.000000000 
+0100
@@ -19,7 +19,7 @@
 Name:           libyui-qt-pkg
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui-qt-rest-api.spec 
new/libyui-4.4.8/package/libyui-qt-rest-api.spec
--- old/libyui-4.4.7/package/libyui-qt-rest-api.spec    2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/package/libyui-qt-rest-api.spec    2023-01-10 
18:10:44.000000000 +0100
@@ -19,7 +19,7 @@
 Name:           libyui-qt-rest-api
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui-qt.spec 
new/libyui-4.4.8/package/libyui-qt.spec
--- old/libyui-4.4.7/package/libyui-qt.spec     2022-12-06 14:56:32.000000000 
+0100
+++ new/libyui-4.4.8/package/libyui-qt.spec     2023-01-10 18:10:44.000000000 
+0100
@@ -19,7 +19,7 @@
 Name:           libyui-qt
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui-rest-api.spec 
new/libyui-4.4.8/package/libyui-rest-api.spec
--- old/libyui-4.4.7/package/libyui-rest-api.spec       2022-12-06 
14:56:32.000000000 +0100
+++ new/libyui-4.4.8/package/libyui-rest-api.spec       2023-01-10 
18:10:44.000000000 +0100
@@ -19,7 +19,7 @@
 Name:           libyui-rest-api
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui.changes 
new/libyui-4.4.8/package/libyui.changes
--- old/libyui-4.4.7/package/libyui.changes     2022-12-06 14:56:32.000000000 
+0100
+++ new/libyui-4.4.8/package/libyui.changes     2023-01-10 18:10:44.000000000 
+0100
@@ -1,4 +1,15 @@
 -------------------------------------------------------------------
+Tue Jan 10 12:42:09 UTC 2023 - Ladislav Slezák <lsle...@suse.com>
+
+- NCurses REST API - fixed RunInTerminal behavior (bsc#1206929)
+  Stop the REST API server during execution of the
+  RunInTerminal() call. This allows the subprocess to open
+  it's own REST API server using the same port.
+  This is useful for the ncurses YaST control center which
+  starts other YaST modules as subprocesses.
+- 4.4.8
+
+-------------------------------------------------------------------
 Tue Dec  6 13:19:20 UTC 2022 - Stefan Hundhammer <shundham...@suse.com>
 
 - YQPkg: Scroll patterns list by pixels, not by item to avoid problems
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-4.4.7/package/libyui.spec 
new/libyui-4.4.8/package/libyui.spec
--- old/libyui-4.4.7/package/libyui.spec        2022-12-06 14:56:32.000000000 
+0100
+++ new/libyui-4.4.8/package/libyui.spec        2023-01-10 18:10:44.000000000 
+0100
@@ -19,7 +19,7 @@
 Name:           libyui
 
 # DO NOT manually bump the version here; instead, use rake version:bump
-Version:        4.4.7
+Version:        4.4.8
 Release:        0
 
 %define         so_version 16

Reply via email to