<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1251">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">12.11.2019 21:54, Andrey ïèøåò:<br>
    </div>
    <blockquote type="cite"
      cite="mid:dff6f566-2539-2294-0ee8-c8985e4e7909@yandex.ru">Hi all!
      <br>
      <br>
      Arun, thanks for the answer!
      <br>
      <br>
      <br>
      11.11.2019 04:40, Arun Raghavan ïèøåò:
      <br>
      <blockquote type="cite">On Tue, 5 Nov 2019, at 3:50 PM, Andrey
        wrote:
        <br>
        <blockquote type="cite">Hi all!
          <br>
          <br>
          Pf: Issue with pa_context_connect() call inside root privilege
          program.
          <br>
          <br>
          I have Xubuntu 19.10. On default pulseaudio server (ver 13.0)
          started on
          <br>
          user logon with "--demonize=no" parameter. I need reroute
          digital sound
          <br>
          from /dev/dsp  to pulse. For this i install osspd  package
          (current ver
          <br>
          1.3.2-11). I have successfully used this package previously on
          Ubuntu
          <br>
          16.04/18.04-3 with no any tuning. Osspd daemon get source
          trough CUSE
          <br>
          and required root privileges. I.e. osspd call pulse as root. I
          copy
          <br>
          user's cookie file to /root/.config/pulse/cookie. But osspd
          can't
          <br>
          connect to pulse server again. My distribution belongs to
          group 2 and i
          <br>
          no put users to the "audio" group (but i test opposed: nothing
          happens :) ).
          <br>
          <br>
          I debug osspd's slave processes (ossp-padsp) and detect what
          function
          <br>
          pa_context_connect() return code 'connection refused'. I tried
          to run
          <br>
          ossp-padsp as user - it connected to server successful. Then i
          call
          <br>
          pa_context_connect() with name of server
          <br>
          "unix:/run/user/1000/pulse/native" (instead NULL).... the
          connection is
          <br>
          established! And as ordinary user and as root! It works for me
          now.
          <br>
          <br>
          BUT... I assume that somewhere something with settings of
          access rights
          <br>
          to the pulse server I missed... What and where? How correctly
          should I
          <br>
          connect to the non system-wide pulse server as root?
          <br>
          <br>
          Is this behavior of the connection process a
          normal(documented?) or bug?
          <br>
          Can i (is it right) use this feature to select the specific
          user's pulse
          <br>
          server to connect?
          <br>
        </blockquote>
        Not sure what the issue you have is, but there is one big hammer
        to sidestep this problem -- you can provide auth_anonymous=1 to
        module-native-protocol-unix in default.pa, and any local client
        can then connect.
        <br>
        <br>
        -- Arun
        <br>
      </blockquote>
      No... using this option does not work for me :(.
      <br>
      <br>
      I think that the problem is not the restriction of the rights to
      the pulse server... I did not correctly formulate my original
      question. It's just that the libpulse library doesn't know now
      what the default server is. it requires an explicit server name in
      case the current user's session does not have its own server
      running. That's the only way I understand it.
      <br>
      Now I tried to run the program as root, but previously set the
      pulse_server environment variable (eval `pax11publish -i`).  It
      work perfect!(i.e. with access rights all is ok)
      <br>
      <br>
      BUT!!!
      <br>
      This program run on Ubuntu 16.04 with pulse 8.0 as root too....
      WITHOUT !!! PULSE_SERVER variable (it not set for root and
      ordinary user). Where does the libpulse get the default server
      name???From root X11 properties???
      <br>
      <br>
      How can I (is it possible to do this now?) configure
      pulseaudio/libpulse 13.0 in Xubuntu 19.10 for the same
      pa_context_connect() function behavior (in non system-wide mode)?
      <br>
      <br>
      Thanks :)
      <br>
      <br>
      <br>
      <br>
    </blockquote>
    <p><span class="tlid-translation translation" lang="en"><span
          title="" class="">Well, for myself, I found as many as three
          solutions </span></span><span class="tlid-translation
        translation" lang="en"><span title="" class=""><span
            class="tlid-translation translation" lang="en"><span
              title="" class="">for the </span></span></span></span><span
        class="tlid-translation translation" lang="en"><span title=""
          class=""><span class="tlid-translation translation" lang="en"><span
              title="" class="">osspd package. They all work.<br>
            </span></span></span></span></p>
    <p><span class="tlid-translation translation" lang="en"><span
          title="" class=""><span class="tlid-translation translation"
            lang="en"><span title="" class="">1. Using wrapper to
              execute </span></span></span></span><span
        class="tlid-translation translation" lang="en"><span title=""
          class=""><span class="tlid-translation translation" lang="en"><span
              title="" class="">"eval `pax11publish -i`" </span></span></span></span><span
        class="tlid-translation translation" lang="en"><span title=""
          class=""><span class="tlid-translation translation" lang="en"><span
              title="" class=""><span class="tlid-translation
                translation" lang="en"><span title="" class="">before
                  running </span></span>ossp-padsp (slave process of
              osspd) (!!! it denote that </span></span></span></span><span
        class="tlid-translation translation" lang="en"><span title=""
          class=""><span class="tlid-translation translation" lang="en"><span
              title="" class="">root X11 properties contained pulse
              server name and root apply it!!!) <br>
            </span></span></span></span></p>
    <p><span class="tlid-translation translation" lang="en"><span
          title="" class=""><span class="tlid-translation translation"
            lang="en"><span title="" class="">2. Adding the predefined
              unix </span></span></span></span><span
        class="tlid-translation translation" lang="en"><span title=""
          class=""><span class="tlid-translation translation" lang="en"><span
              title="" class="">socket to user's pulse server (i.e.
              "load-module module-native-protocol-unix auth-anonymous=1
              socket=/tmp/pulse-socket") and using "default-server =
              unix:/tmp/pulse-socket" in
              "/root/.config/pulse/client.conf".</span></span></span></span></p>
    <p><span class="tlid-translation translation" lang="en"><span
          title="" class=""><span class="tlid-translation translation"
            lang="en"><span title="" class="">3. Reworking source code
              of ossp-padsp.c to c</span></span></span></span><span
        class="tlid-translation translation" lang="en"><span title=""
          class=""><span class="tlid-translation translation" lang="en"><span
              title="" class="">all
              function pa_context_connect() with server's name
              "unix:/run/user/<USERID>/pulse/native" (</span></span></span></span><span
        class="tlid-translation translation" lang="en"><span title=""
          class=""><span class="tlid-translation translation" lang="en"><span
              title="" class=""><span class="tlid-translation
                translation" lang="en"><span title="" class="">I can get
                  USERID easily). Or using combination with predefined
                  unix socket (as above) and  applying it as pulse
                  server name in pa_context_connect().</span></span></span></span></span></span></p>
    <p><br>
      <span class="tlid-translation translation" lang="en"><span
          title="" class=""><span class="tlid-translation translation"
            lang="en"><span title="" class=""><span
                class="tlid-translation translation" lang="en"><span
                  title="" class=""><span class="tlid-translation
                    translation" lang="en"><span title="" class="">Things
                      are good...</span> <span title="" class=""><br>
                      BUT why did this function work before without
                      these settings? Maybe something needs to be
                      tweaked in the system? </span></span></span></span></span></span></span></span><span
        class="tlid-translation translation" lang="en"><span title=""
          class=""><span class="tlid-translation translation" lang="en"><span
              title="" class=""><span class="tlid-translation
                translation" lang="en"><span title="" class=""><span
                    class="tlid-translation translation" lang="en"><span
                      title="" class=""><span class="tlid-translation
                        translation" lang="en"><span title="" class=""><span
                            class="tlid-translation translation"
                            lang="en"><span title="" class="">Where does
                              the </span></span></span></span></span></span></span></span></span></span></span></span><span
        class="tlid-translation translation" lang="en"><span title=""
          class=""><span class="tlid-translation translation" lang="en"><span
              title="" class=""><span class="tlid-translation
                translation" lang="en"><span title="" class=""><span
                    class="tlid-translation translation" lang="en"><span
                      title="" class=""><span class="tlid-translation
                        translation" lang="en"><span title="" class=""><span
                            class="tlid-translation translation"
                            lang="en"><span title="" class=""><span
                                class="tlid-translation translation"
                                lang="en"><span title="" class=""><span
                                    class="tlid-translation translation"
                                    lang="en"><span title="" class=""><span
                                        class="tlid-translation
                                        translation" lang="en"><span
                                          title="" class=""><span
                                            class="tlid-translation
                                            translation" lang="en"><span
                                              title="" class=""><span
                                                class="tlid-translation
                                                translation" lang="en"><span
                                                  title="" class=""><span
class="tlid-translation translation" lang="en"><span title="" class="">pa_context_connect()</span></span></span></span>
                                            </span></span></span></span></span></span></span></span>
                              get the default server name???</span></span></span></span><br>
                    </span></span></span></span></span></span></span></span></p>
    <p><span class="tlid-translation translation" lang="en"><span
          title="" class=""><span class="tlid-translation translation"
            lang="en"><span title="" class=""><span
                class="tlid-translation translation" lang="en"><span
                  title="" class=""><span class="tlid-translation
                    translation" lang="en"><span title="" class="">And
                      one more question. How to find out the server name
                      after a successful connection (with NULL as
                      calling name)? Function
                      pa_context_get_server_info() does not contain such
                      information... or I looked bad?</span></span></span></span></span></span></span></span></p>
    Thanks :)
  </body>
</html>