Can you retrieve a D-Bus property without calling org.freedesktop.DBus.Properties.Get? - dbus

Say I want to programmatically get the interface name of my ethernet card. This seems to work:
dbus-send --print-reply \
--type=method_call \
--system \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager/Devices/0 \
org.freedesktop.DBus.Properties.Get \
string:org.freedesktop.NetworkManager.Device \
string:Interface
Which returns:
method return sender=:1.5 -> dest=:1.135 reply_serial=2
variant string "eth0"
Is there some way of cutting out the middleman org.freedesktop.DBus.Properties.Get and retrieve the property more directly? Alas, calling it as a method does not work:
dbus-send --print-reply \
--type=method_call \
--system \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager/Devices/0 \
org.freedesktop.NetworkManager.Device.Interface
Returns:
Error org.freedesktop.DBus.Error.UnknownMethod:
Method "Interface" with signature "" on interface
"org.freedesktop.NetworkManager.Device" doesn't exist
I ask because having to call org.freedesktop.DBus.Properties.Get looks like having to call a object.getProp("someproperty") instead of object.getSomeProperty() in Python/Java/etc.

Yep, you can do that if you use qdbus. I don't have NetworkManager with me, but a command like that should work:
qdbus --system \
org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager/Devices/0 \
org.freedesktop.NetworkManager.Device.Interface
There are various command-line clients for talking to D-Bus, some are more convenient than others. Here's the list of the ones I know.
dbus-send (provided with D-Bus itself)
gdbus (provided by GLib)
qdbus (provided by Qt)
busctl (provided by systemd)

No.
Most likely org.freedesktop.DBus.Properties.GetAll will return you same value, but internally every service implement properties as handlers to messages with org.freedesktop.DBus.Properties.Get/org.freedesktop.DBus.Properties.GetAll method calls.
It looks like object.getProp("someproperty") because it actually is more like this pseudo-code
bus.handleMessage({
service: "org.freedesktop.NetworkManager",
object: "/org/freedesktop/NetworkManager/Devices/0",
iface: "org.freedesktop.NetworkManager.Device.Interface",
body: [ "org.freedesktop.NetworkManager.Device", "Interface"],
thisMessageIsReplyTo: null
})
Internally every method call/signal/reply is just a message with big signature (service name/object path/interface) and body

Related

How to send method call by dbus-send?

I am analyzing Chromium OS.
I have captured a dbus method call using dbus-monitor and want to reappear it by dbus-send.
Below is what I want to reappear.
my-chromiumos ! # dbus-monitor --system "path=/org/chromium/SessionManager"
method call time=1632639141.486152 sender=:1.325 -> destination=org.chromium.SessionManager serial=402 path=/org/chromium/SessionManager; interface=org.chromium.SessionManagerInterface; member=RestartJob
file descriptor
inode: 489350
type: socket
address family: unix
name #
peer #
array [
string "/opt/google/chrome/chrome"
string "--gpu-sandbox-failures-fatal=no"
string "--enable-logging"
string "--use-cras"
string "--use-gl=egl"
string "--user-data-dir=/home/chronos"
string "--vmodule=*night_light*=1,*/ash/wm/tablet_mode/*=1,wizard_controller=1,*/webui/chromeos/login/*=1,*/browser/chromeos/login/screens/*=1,enrollment_screen_handler=1,*/browser/chromeos/login/enrollment/*=1,*/ui/ozone/*=1,*/ui/display/manager/chromeos/*=1"
string "--enable-wayland-server"
string "--aura-legacy-power-button"
string "--login-profile=user"
string "--system-developer-mode"
string "--bwsi"
string "--homepage=chrome://newtab/"
string "--incognito"
string "--log-level=1"
string "--login-user=$guest"
]
uint32 0
Please take a look at dbus-send documentation for more details.
dbus-send --dest=org.chromium.SessionManager \
--print-reply \
--type=method_call \
/org/chromium/SessionManager \
org.chromium.SessionManagerInterface.RestartJob
It looks like the above method call do not take any argument, but you should confirm with the available API documentation.
Also, I found this Chrome OS D-Bus Best Practices guide, please take a look at it as well.

Custom build of openSSL for OS X - limit ciphers suites

Main goal
I need openSSL. Apple deprecated this library since 10.7 It is even impossible to create context when ignoring warnings about deprecation.
I decided to build openSSL and tweak it to my needs:
disable SSL protocol (only TLS should be supported)
limit cipher suites to secure one
What I have done
How I'm trying to build it.
I've downloaded sources version 1.0.2d and configured it this way:
./Configure -openssldir=$(pwd)/output-build \
enable-ec_nistp_64_gcc_128 \
no-ssl2 no-ssl3 \
no-shared no-comp \
enable-TLS_DHE_RSA_WITH_AES_256_CBC_SHA \
enable-TLS_DH_RSA_WITH_AES_256_CBC_SHA \
enable-TLS_DHE_DSS_WITH_AES_256_CBC_SHA \
enable-TLS_DH_DSS_WITH_AES_256_CBC_SHA \
enable-TLS_RSA_WITH_AES_256_CBC_SHA \
enable-TLS_DHE_RSA_WITH_AES_128_CBC_SHA \
enable-TLS_DH_RSA_WITH_AES_128_CBC_SHA \
enable-TLS_DHE_DSS_WITH_AES_128_CBC_SHA \
enable-TLS_DH_DSS_WITH_AES_128_CBC_SHA \
enable-TLS_RSA_WITH_AES_128_CBC_SHA \
enable-TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA \
enable-TLS_RSA_WITH_3DES_EDE_CBC_SHA \
darwin64-x86_64-cc
Problem
Switches for disabling SSL are clear and I'm happy with it.
Switches for cipher suites are very inconvenient, I'm not sure how they work. They are not documented, ./Configure --help prints this:
Usage: Configure [no-<cipher> ...] [enable-<cipher> ...]
[experimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx]
[no-hw-xxx|no-hw] [[no-]threads] [[no-]shared]
[[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [sctp] [386]
[--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]]
[--test-sanity] os/compiler[:flags]
I just want listed cipher suites and nothing else. Format of this switches give me impression that I have to disable quite long list of other cipher suites. Is there better way so I can disabled all but those listed above?

Unknown parameter "includeObjects" throws exception in command line liquiBase

I'm using liquibase 3.3.2 and i'm trying use the "includeObjects" parameter. This is the command line:
java -jar liquibase.jar \
--driver=com.ingres.jdbc.IngresDriver \
--url="jdbc:ingres://localhost:21071/local" \
--username=ingres \
--password=ingres \
--logLevel=debug \
--classpath="iijdbc.jar" \
"--currentDateTimeFunction=now()" \
--changeLogFile=db.changelog.xml \
--defaultSchemaName=ingres \
--includeObjects=personal \
generateChangeLog
This is the exception thrown.
Unexpected error running Liquibase: Unknown parameter: 'includeObjects'
SEVERE 24/03/15 10:05 AM: liquibase: Unknown parameter: 'includeObjects'
liquibase.exception.CommandLineParsingException: Unknown parameter: 'includeObjects'
at liquibase.integration.commandline.Main.parseOptions(Main.java:702)
at liquibase.integration.commandline.Main.run(Main.java:124)
at liquibase.integration.commandline.Main.main(Main.java:94)
Can anyone point what I am doing wrong?
Supposedly in version 3.3.2 the "includeObject" option is now available:
Liquibase 3.3.2 Released
The option --includeObjects is a parameter that belongs to the commands diff or diffChangeLog.
I guess it can not be used on the command generateChangeLog.
As Jens mentioned in the comment, the following should work as the include/excludeObjects arguments come AFTER the generate/diffChangeLog command apparently:
java -jar liquibase.jar \
--driver=com.ingres.jdbc.IngresDriver \
--url="jdbc:ingres://localhost:21071/local" \
--username=ingres \
--password=ingres \
--logLevel=debug \
--classpath="iijdbc.jar" \
"--currentDateTimeFunction=now()" \
--changeLogFile=db.changelog.xml \
--defaultSchemaName=ingres \
generateChangeLog --includeObjects=personal
I did the same approach (with mulitple tables comma-seperated) and it worked fine.

How to find methods exposed in a D-Bus interface

Question: Is there any way in which we can find out the methods (and their signatures) which are exposed in a D-Bus interface?
Issue Description: In my phone, I am calling BlueZ methods using D-Bus to adapter interface, when checked on phone 2 of these methods are not available.
Intention is to check if the method name/signatures are modified in other device, I don't have access to code so looking to find the methods in an interface
Using dbus-send, you can list the available services on your system:
Session:
dbus-send --session \
--dest=org.freedesktop.DBus \
--type=method_call \
--print-reply \
/org/freedesktop/DBus \
org.freedesktop.DBus.ListNames
System:
dbus-send --system \
--dest=org.freedesktop.DBus \
--type=method_call \
--print-reply \
/org/freedesktop/DBus \
org.freedesktop.DBus.ListNames
You'll get an answer like that:
array [
string "org.freedesktop.DBus"
string ":1.1"
string ":1.26"
string "org.asamk.Signal"
]
And if you want to list all methods available behind a dbus service, you can still use dbus-send to introspect the dbus service.
For example with org.asamk.Signal:
dbus-send --system --type=method_call --print-reply \
--dest=org.asamk.Signal \
/org/asamk/Signal \
org.freedesktop.DBus.Introspectable.Introspect
You'll get this kind of result (truncated)
<node name="/org/asamk/Signal">
<interface name="org.asamk.Signal">
<method name="sendMessage" >
...parameters
</method>
<method name="sendGroupMessage" >
...parameters
</method>
</interface>
</node>
Here there are 2 methods, sendMessage and sendGroupMessage
You can also take a look at D-Feet.
With an extra google search and dbus understanding, using D-Bus Introspection helps to get the methods (with signatures) exposed on that particular interface. More information available at link.

In AIX 7.1 Apache modules not building as shared

I want all my modules built with a .so extension so that they are shared. However, all my modules are building with a .la extension. Here are the contents of the module directory:
httpd.exp libmod_proxy_ajp.a libmod_speling.a mod_info.la mod_proxy_scgi.la
libmod_cern_meta.a libmod_proxy_balancer.a libmod_ssl.a mod_proxy.la mod_rewrite.la
libmod_dbd.a libmod_proxy_connect.a libmod_vhost_alias.a mod_proxy_ajp.la mod_speling.la
libmod_deflate.a libmod_proxy_ftp.a mod_cern_meta.la mod_proxy_balancer.la mod_ssl.la
libmod_expires.a libmod_proxy_http.a mod_dbd.la mod_proxy_connect.la mod_vhost_alias.la
libmod_info.a libmod_proxy_scgi.a mod_deflate.la mod_proxy_ftp.la
libmod_proxy.a libmod_rewrite.a mod_expires.la mod_proxy_http.la
Here is my configure command:
./configure \
--with-mpm=prefork \
--with-ssl=/opt/freeware \
--enable-cern-meta \
--enable-dbd \
--enable-deflate \
--enable-expires \
--enable-info \
--enable-proxy \
--enable-rewrite \
--enable-speling \
--enable-ssl \
--enable-vhost-alias \
--enable-mods-shared="cern_meta dbd deflate expires info proxy rewrite speling ssl vhost_alias"
I have done this many times in the past on AIX 5.2, 5.3 and 6.1 without issue.
.la files are libtool's library control file syntax. Notice they are really just small scripts. Check for your shared library objects inside the .libs directory. You might also explicitly tell configure that you want shared libraries with --enable-shared

Resources