[pulseaudio-discuss] Connect to non system-wide pulse server inside root privilege program (Asynchronous API)

Andrey ap.general at yandex.ru
Tue Nov 12 18:54:27 UTC 2019


Hi all!

Arun, thanks for the answer!


11.11.2019 04:40, Arun Raghavan пишет:
> On Tue, 5 Nov 2019, at 3:50 PM, Andrey wrote:
>> Hi all!
>>
>> Pf: Issue with pa_context_connect() call inside root privilege program.
>>
>> I have Xubuntu 19.10. On default pulseaudio server (ver 13.0) started on
>> user logon with "--demonize=no" parameter. I need reroute digital sound
>> from /dev/dsp  to pulse. For this i install osspd  package (current ver
>> 1.3.2-11). I have successfully used this package previously on Ubuntu
>> 16.04/18.04-3 with no any tuning. Osspd daemon get source trough CUSE
>> and required root privileges. I.e. osspd call pulse as root. I copy
>> user's cookie file to /root/.config/pulse/cookie. But osspd can't
>> connect to pulse server again. My distribution belongs to group 2 and i
>> no put users to the "audio" group (but i test opposed: nothing happens :) ).
>>
>> I debug osspd's slave processes (ossp-padsp) and detect what function
>> pa_context_connect() return code 'connection refused'. I tried to run
>> ossp-padsp as user - it connected to server successful. Then i call
>> pa_context_connect() with name of server
>> "unix:/run/user/1000/pulse/native" (instead NULL).... the connection is
>> established! And as ordinary user and as root! It works for me now.
>>
>> BUT... I assume that somewhere something with settings of access rights
>> to the pulse server I missed... What and where? How correctly should I
>> connect to the non system-wide pulse server as root?
>>
>> Is this behavior of the connection process a normal(documented?) or bug?
>> Can i (is it right) use this feature to select the specific user's pulse
>> server to connect?
> 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.
>
> -- Arun
No... using this option does not work for me :(.

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.
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)

BUT!!!
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???

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)?

Thanks :)






More information about the pulseaudio-discuss mailing list