public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/gnome-user-share] wip/oholy/f45-update: - Add a patch from SVN to export DBUS session ID via Avahi (b.g.o #455307)
@ 2026-06-24 11:34 Owen Taylor
  0 siblings, 0 replies; only message in thread
From: Owen Taylor @ 2026-06-24 11:34 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/gnome-user-share
Branch : wip/oholy/f45-update
Commit : 9b22babeaef8fad9f0acfa4e2b47d8c3b62d4d64
Author : Owen Taylor <otaylor@fedoraproject.org>
Date   : 2007-07-12T13:27:28+00:00
Stats  : +183/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/gnome-user-share/c/9b22babeaef8fad9f0acfa4e2b47d8c3b62d4d64?branch=wip/oholy/f45-update

Log:
- Add a patch from SVN to export DBUS session ID via Avahi (b.g.o #455307)

---
diff --git a/gnome-user-share-0.11-export-session-id.patch b/gnome-user-share-0.11-export-session-id.patch
new file mode 100644
index 0000000..4729a04
--- /dev/null
+++ b/gnome-user-share-0.11-export-session-id.patch
@@ -0,0 +1,176 @@
+--- gnome-user-share-0.11/user_share.c.export-session-id	2007-03-06 05:30:27.000000000 -0500
++++ gnome-user-share-0.11/user_share.c	2007-07-12 09:22:35.000000000 -0400
+@@ -27,6 +27,10 @@
+ #include <glib/gi18n.h>
+ #include <X11/Xlib.h>
+ 
++#ifdef HAVE_DBUS_1_1
++#include <dbus/dbus.h>
++#endif
++
+ #ifdef HAVE_AVAHI
+ #include <avahi-client/client.h>
+ #include <avahi-client/publish.h>
+@@ -45,6 +49,7 @@
+ 
+ #include <gconf/gconf-client.h>
+ 
++#include <stdarg.h>
+ #include <string.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -63,6 +68,10 @@
+ #define FILE_SHARING_ENABLED "/desktop/gnome/file_sharing/enabled"
+ #define FILE_SHARING_REQUIRE_PASSWORD "/desktop/gnome/file_sharing/require_password"
+ 
++#ifdef HAVE_DBUS_1_1
++static char *dbus_session_id;
++#endif
++
+ static GMainLoop *loop = NULL;
+ static pid_t httpd_pid = 0;
+ static guint disabled_timeout_tag = 0;
+@@ -220,6 +229,42 @@ get_share_name (void)
+ 	return name;
+ }
+ 
++#ifdef HAVE_DBUS_1_1
++static void
++init_dbus() {
++	/* The only use we make of D-BUS is to fetch the session BUS ID so we can export
++	 * it via mDNS, so we connect and then immediately disconnect. If we were using
++	 * the D-BUS session BUS for something persistent, the following code should use
++	 * dbus_bus_get() and skip the shutdown. (Avahi uses the D-BUS  _system_ bus
++	 * internally.)
++	 */
++	
++	DBusError derror;
++	DBusConnection *connection;
++
++	dbus_error_init(&derror);
++	
++	connection = dbus_bus_get_private(DBUS_BUS_SESSION, &derror);
++	if (connection == NULL) {
++        g_printerr("Failed to connect to session bus: %s", derror.message);
++        dbus_error_free(&derror);
++		return;
++	}
++
++    dbus_session_id = dbus_bus_get_id(connection, &derror);
++    if (dbus_session_id == NULL) {
++		/* This can happen if the D-BUS library has been upgraded to 1.1, but the
++		 * user's session hasn't yet been restarted
++		 */
++        g_printerr("Failed to get session BUS ID: %s", derror.message);
++        dbus_error_free(&derror);
++	}
++		
++	dbus_connection_set_exit_on_disconnect(connection, FALSE);
++	dbus_connection_close(connection);
++	dbus_connection_unref(connection);
++}
++#endif
+ 
+ #ifdef HAVE_AVAHI
+ 
+@@ -230,19 +275,64 @@ static int avahi_port = 0;
+ static AvahiEntryGroup *entry_group = NULL;
+ static char *avahi_name = NULL;
+ 
++static AvahiStringList*
++new_text_record_list (const char *first_key,
++					  const char *first_value,
++					  ...)
++{
++    va_list args;
++    const char *k;
++    const char *v;
++    AvahiStringList *list;
++
++    if (first_key == NULL)
++        return NULL;
++
++    list = NULL;
++    
++    list = avahi_string_list_add_pair (list, first_key, first_value);
++    
++    va_start (args, first_value);
++    k = va_arg (args, const char*);
++    if (k)
++        v = va_arg (args, const char*);
++    while (k != NULL) {
++        list = avahi_string_list_add_pair (list, k, v);
++        
++        k = va_arg (args, const char*);
++        if (k)
++            v = va_arg (args, const char*);
++    }
++    
++    va_end(args);
++    
++    return list;
++}
+ 
+ static gboolean
+ create_service (void) {
+     int ret;
++    AvahiStringList *txt_records;
+ 
+ 	if (avahi_name == NULL) {
+ 		avahi_name = g_strdup (get_share_name ());
+ 	}
+ 
+-	ret = avahi_entry_group_add_service (entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 
+-										 AVAHI_PUBLISH_USE_MULTICAST,
+-										 avahi_name, "_webdav._tcp", NULL, NULL, 
+-										 avahi_port, "u=guest", NULL);
++	txt_records = new_text_record_list ("u", "guest",
++#ifdef HAVE_DBUS_1_1
++										/* This must be last */
++										dbus_session_id != NULL ? "org.freedesktop.od.session" : NULL, dbus_session_id,
++#endif									   
++										NULL);
++	
++	ret = avahi_entry_group_add_service_strlst (entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 
++												 AVAHI_PUBLISH_USE_MULTICAST,
++												 avahi_name, "_webdav._tcp", NULL, NULL, 
++												 avahi_port,
++		                                         txt_records);
++
++	avahi_string_list_free(txt_records);
++	
+ 	if (ret < 0) {
+ 		return FALSE;
+ 	}
+@@ -735,6 +825,10 @@ main (int argc, char **argv)
+ 		    G_IO_IN,
+ 		    x_input, xdisplay);
+     g_io_channel_unref (channel);
++
++#ifdef HAVE_DBUS_1_1
++	init_dbus();
++#endif	
+ 	
+ #ifdef HAVE_AVAHI
+ 	if (!init_avahi ()) {    
+--- gnome-user-share-0.11/configure.in.export-session-id	2007-03-06 04:56:32.000000000 -0500
++++ gnome-user-share-0.11/configure.in	2007-07-12 09:22:35.000000000 -0400
+@@ -59,11 +59,17 @@ if test "x$msg_avahi" = "xno" -a "x$enab
+ 	AC_SUBST(HOWL_LIBS)
+ fi
+ 
++PKG_CHECK_EXISTS(dbus-1 >= 1.1.1, have_dbus_1_1=true, have_dbus_1_1=false)
++if $have_dbus_1_1 ; then
++   DBUS_MODULES=dbus-1
++   AC_DEFINE(HAVE_DBUS_1_1, 1, [Set to true if we have D-BUS 1.1])
++fi
++
+ if test "x$msg_avahi" = "xno" -a "x$msg_howl" = "xno"; then
+   AC_MSG_ERROR([Neither avahi nor howl detected. Gnome-user-share needs a mDNS implementation.])
+ fi
+ 
+-PKG_CHECK_MODULES(USER_SHARE, glib-2.0 >= 2.2.0 gconf-2.0)
++PKG_CHECK_MODULES(USER_SHARE, glib-2.0 >= 2.2.0 gconf-2.0 $DBUS_MODULES)
+ AC_SUBST(USER_SHARE_CFLAGS)
+ AC_SUBST(USER_SHARE_LIBS)
+ 

diff --git a/gnome-user-share.spec b/gnome-user-share.spec
index badc8ae..7f41677 100644
--- a/gnome-user-share.spec
+++ b/gnome-user-share.spec
@@ -1,13 +1,15 @@
 Summary: Gnome user file sharing
 Name: gnome-user-share
 Version: 0.11
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPL
 Group: System Environment/Libraries
 URL: http://www.gnome.org
 Source0: %{name}-%{version}.tar.bz2
 # http://bugzilla.gnome.org/show_bug.cgi?id=422047
 Patch0: gnome-user-share-0.11-invisible-char.patch
+# http://bugzilla.gnome.org/show_bug.cgi?id=455307
+Patch1: gnome-user-share-0.11-export-session-id.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
 Requires: httpd >= 2.2.0
@@ -38,6 +40,7 @@ up in the Network location in GNOME.
 %prep
 %setup -q
 %patch0 -p1 -b .invisible-char
+%patch1 -p1 -b .export-session-id
 
 %build
 %configure
@@ -87,6 +90,9 @@ fi
 %{_sysconfdir}/gconf/schemas/*
 
 %changelog
+* Thu Jul 12 2007 Owen Taylor <otaylor@redhat.com> - 0.11-4
+- Add a patch from SVN to export DBUS session ID via Avahi (b.g.o #455307)
+
 * Mon Apr 23 2007 Matthias Clasen  <mclasen@redhat.com> - 0.11-3
 - Improve %%description (#235677)
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-24 11:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-24 11:34 [rpms/gnome-user-share] wip/oholy/f45-update: - Add a patch from SVN to export DBUS session ID via Avahi (b.g.o #455307) Owen Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox