Browse code

First commit

Qurban Ullah authored on 27/02/2018 18:06:01
Showing 5 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,6 @@
1
+#!/bin/bash
2
+
3
+# launches a session dbus instance
4
+if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && type dbus-launch >/dev/null; then
5
+  eval $(dbus-launch --sh-syntax --exit-with-session)
6
+fi
0 7
new file mode 100755
... ...
@@ -0,0 +1,89 @@
1
+# $Id$
2
+# Maintainer: Qurban Ullah <qurbanullah@avouch.org>
3
+# Contributor: Qurban Ullah <qurbanullah@avouch.org>
4
+
5
+pkgbase=dbus
6
+pkgname=(dbus dbus-docs)
7
+pkgver=1.12.2
8
+pkgrel=1
9
+pkgdesc="Freedesktop.org message bus system"
10
+url="http://www.freedesktop.org/Software/dbus"
11
+arch=(i686 x86_64)
12
+license=('GPL' 'custom')
13
+makedepends=('libx11' 'systemd' 'xmlto' 'docbook-xsl')
14
+source=(http://dbus.freedesktop.org/releases/dbus/dbus-$pkgver.tar.gz{,.asc})
15
+md5sums=('5af6297348107a906c8449817a728b3b'
16
+         'SKIP')
17
+
18
+prepare() {
19
+	cd ${srcdir}/${pkgbase}-${pkgver}
20
+
21
+    # Reduce docs size
22
+    printf '%s\n' >>Doxyfile.in \
23
+        HAVE_DOT=yes DOT_IMAGE_FORMAT=svg INTERACTIVE_SVG=yes
24
+
25
+}
26
+
27
+build() {
28
+	cd ${srcdir}/${pkgbase}-${pkgver}
29
+	./configure --prefix=/usr \
30
+	--sysconfdir=/etc \
31
+	--localstatedir=/var \
32
+	--libexecdir=/usr/lib/dbus-1.0 \
33
+	--with-dbus-user=messagebus \
34
+	--with-system-pid-file=/run/dbus/pid \
35
+	--with-system-socket=/run/dbus/system_bus_socket \
36
+	--with-console-auth-dir=/run/console/ \
37
+	--with-systemdsystemunitdir=/usr/lib/systemd/system \
38
+	--enable-inotify \
39
+	--enable-systemd \
40
+	--enable-user-session \
41
+	--enable-selinux \
42
+	--enable-libaudit \
43
+	--disable-verbose-mode \
44
+	--disable-static \
45
+	--disable-tests \
46
+	--disable-asserts
47
+
48
+	make ${MAKEFLAGS}
49
+}
50
+
51
+check() {
52
+	cd ${srcdir}/${pkgbase}-${pkgver}
53
+    make check
54
+}
55
+
56
+package_dbus(){
57
+	provides=(libdbus)
58
+	conflicts=(libdbus)
59
+	replaces=(libdbus)
60
+
61
+	cd ${srcdir}/${pkgbase}-${pkgver}
62
+	make DESTDIR="$pkgdir" install
63
+	
64
+	rm -rf "$pkgdir/var/run"
65
+	
66
+	#If you are using a DESTDIR install, dbus-daemon-launch-helper needs to be fixed afterwards.
67
+	chown -v root:messagebus "$pkgdir"/usr/lib/dbus-1.0/dbus-daemon-launch-helper
68
+	chmod -v      4750       "$pkgdir"/usr/lib/dbus-1.0/dbus-daemon-launch-helper
69
+	
70
+    # We have a pre-assigned uid (18)
71
+    install -m644 "$srcdir/dbus.sysusers" "$pkgdir/usr/lib/sysusers.d/dbus.conf"
72
+
73
+	#Create a symlink, so that D-Bus and systemd can use the same machine-id file:
74
+	ln -sfv /etc/machine-id "$pkgdir"/var/lib/dbus
75
+	
76
+	# Split docs
77
+	mv "$pkgdir/usr/share/doc" "$srcdir"
78
+}
79
+
80
+package_dbus-docs() {
81
+	pkgdesc+=" (documentation)"
82
+	depends=(dbus)
83
+
84
+	install -d "$pkgdir/usr/share/licenses"
85
+	ln -s dbus "$pkgdir/usr/share/licenses/dbus-docs"
86
+
87
+	mv doc "$pkgdir/usr/share"
88
+}
89
+
0 90
new file mode 100644
... ...
@@ -0,0 +1,5 @@
1
+# sysusers.d snippet for creating the D-Bus system user automatically
2
+# at boot on systemd-based systems that ship with an unpopulated
3
+# /etc. See sysusers.d(5) for details.
4
+
5
+u messagebus 18 "System Message Bus" /run/dbus
0 6
new file mode 100755
... ...
@@ -0,0 +1,37 @@
1
+From 03aeaccbffa97c9237b57ca067e3da7388862129 Mon Sep 17 00:00:00 2001
2
+From: Radoslaw Pajak <r.pajak@samsung.com>
3
+Date: Fri, 08 Nov 2013 12:51:32 +0000
4
+Subject: fixed memory freeing if error during listing services
5
+
6
+Signed-off-by: Radoslaw Pajak <r.pajak@samsung.com>
7
+Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71526
9
+---
10
+diff --git a/bus/activation.c b/bus/activation.c
11
+index fcb7133..ea48a26 100644
12
+--- a/bus/activation.c
13
+@@ -2179,7 +2179,7 @@ bus_activation_list_services (BusActivation *activation,
14
+ 
15
+  error:
16
+   for (j = 0; j < i; j++)
17
+-    dbus_free (retval[i]);
18
++    dbus_free (retval[j]);
19
+   dbus_free (retval);
20
+ 
21
+   return FALSE;
22
+diff --git a/bus/services.c b/bus/services.c
23
+index 6f380fa..01a720e 100644
24
+--- a/bus/services.c
25
+@@ -368,7 +368,7 @@ bus_registry_list_services (BusRegistry *registry,
26
+   
27
+  error:
28
+   for (j = 0; j < i; j++)
29
+-    dbus_free (retval[i]);
30
++    dbus_free (retval[j]);
31
+   dbus_free (retval);
32
+ 
33
+   return FALSE;
34
+--
35
+cgit v0.9.0.2-2-gbebe
0 36
new file mode 100755
... ...
@@ -0,0 +1,183 @@
1
+commit d728fdc655f17031da3bb129ab2fd17dadf0fe3a
2
+Author: Simon Peeters <peeters.simon@gmail.com>
3
+Date:   8 weeks ago
4
+
5
+    Set correct address when using --address=systemd:
6
+    
7
+    When dbus gets launched through systemd, we need to create an address
8
+    string based on the sockets passed.
9
+    
10
+    The _dbus_append_addres_from_socket() function is responsible for
11
+    extracting the address information from the file-descriptor and
12
+    formatting it in a dbus friendly way.
13
+    
14
+    This fixes bus activation when running dbus under a systemd session.
15
+    
16
+    https://bugs.freedesktop.org/show_bug.cgi?id=50962
17
+    
18
+    Signed-off-by: Simon Peeters <peeters.simon@gmail.com>
19
+
20
+diff --git a/dbus/dbus-server-unix.c b/dbus/dbus-server-unix.c
21
+index 130f66e..d995240 100644
22
+--- a/dbus/dbus-server-unix.c
23
+@@ -149,7 +149,7 @@ _dbus_server_listen_platform_specific (DBusAddressEntry *entry,
24
+     }
25
+   else if (strcmp (method, "systemd") == 0)
26
+     {
27
+-      int n, *fds;
28
++      int i, n, *fds;
29
+       DBusString address;
30
+ 
31
+       n = _dbus_listen_systemd_sockets (&fds, error);
32
+@@ -159,27 +159,39 @@ _dbus_server_listen_platform_specific (DBusAddressEntry *entry,
33
+           return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
34
+         }
35
+ 
36
+-      _dbus_string_init_const (&address, "systemd:");
37
++      if (!_dbus_string_init (&address))
38
++          goto systemd_oom;
39
+ 
40
+-      *server_p = _dbus_server_new_for_socket (fds, n, &address, NULL);
41
+-      if (*server_p == NULL)
42
++      for (i = 0; i < n; i++)
43
+         {
44
+-          int i;
45
+-
46
+-          for (i = 0; i < n; i++)
47
++          if (i > 0)
48
+             {
49
+-              _dbus_close_socket (fds[i], NULL);
50
++              if (!_dbus_string_append (&address, ";"))
51
++                goto systemd_oom;
52
+             }
53
+-          dbus_free (fds);
54
+-
55
+-          dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
56
+-          return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
57
++          if (!_dbus_append_address_from_socket (fds[i], &address, error))
58
++            goto systemd_err;
59
+         }
60
+ 
61
++      *server_p = _dbus_server_new_for_socket (fds, n, &address, NULL);
62
++      if (*server_p == NULL)
63
++        goto systemd_oom;
64
++
65
+       dbus_free (fds);
66
+ 
67
+       return DBUS_SERVER_LISTEN_OK;
68
+-	}
69
++  systemd_oom:
70
++      _DBUS_SET_OOM (error);
71
++  systemd_err:
72
++      for (i = 0; i < n; i++)
73
++        {
74
++          _dbus_close_socket (fds[i], NULL);
75
++        }
76
++      dbus_free (fds);
77
++      _dbus_string_free (&address);
78
++
79
++      return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
80
++    }
81
+ #ifdef DBUS_ENABLE_LAUNCHD
82
+   else if (strcmp (method, "launchd") == 0)
83
+     {
84
+diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
85
+index b4ecc96..55743b1 100644
86
+--- a/dbus/dbus-sysdeps-unix.c
87
+@@ -55,6 +55,7 @@
88
+ #include <netinet/in.h>
89
+ #include <netdb.h>
90
+ #include <grp.h>
91
++#include <arpa/inet.h>
92
+ 
93
+ #ifdef HAVE_ERRNO_H
94
+ #include <errno.h>
95
+@@ -4160,4 +4161,71 @@ _dbus_check_setuid (void)
96
+ #endif
97
+ }
98
+ 
99
++/**
100
++ * Read the address from the socket and append it to the string
101
++ *
102
++ * @param fd the socket
103
++ * @param address
104
++ * @param error return location for error code
105
++ */
106
++dbus_bool_t
107
++_dbus_append_address_from_socket (int         fd,
108
++                                  DBusString *address,
109
++                                  DBusError  *error)
110
++{
111
++  union {
112
++      struct sockaddr sa;
113
++      struct sockaddr_storage storage;
114
++      struct sockaddr_un un;
115
++      struct sockaddr_in ipv4;
116
++      struct sockaddr_in6 ipv6;
117
++  } socket;
118
++  char hostip[INET6_ADDRSTRLEN];
119
++  int size = sizeof (socket);
120
++
121
++  if (getsockname (fd, &socket.sa, &size))
122
++    goto err;
123
++
124
++  switch (socket.sa.sa_family)
125
++    {
126
++    case AF_UNIX:
127
++      if (socket.un.sun_path[0]=='\0')
128
++        {
129
++          if (_dbus_string_append_printf (address, "unix:abstract=%s", &(socket.un.sun_path[1])))
130
++            return TRUE;
131
++        }
132
++      else
133
++        {
134
++          if (_dbus_string_append_printf (address, "unix:path=%s", socket.un.sun_path))
135
++            return TRUE;
136
++        }
137
++      break;
138
++    case AF_INET:
139
++      if (inet_ntop (AF_INET, &socket.ipv4.sin_addr, hostip, sizeof (hostip)))
140
++        if (_dbus_string_append_printf (address, "tcp:family=ipv4,host=%s,port=%u",
141
++                   hostip, ntohs (socket.ipv4.sin_port)))
142
++          return TRUE;
143
++      break;
144
++#ifdef AF_INET6
145
++    case AF_INET6:
146
++      if (inet_ntop (AF_INET6, &socket.ipv6.sin6_addr, hostip, sizeof (hostip)))
147
++        if (_dbus_string_append_printf (address, "tcp:family=ipv6,host=%s,port=%u",
148
++                   hostip, ntohs (socket.ipv6.sin6_port)))
149
++          return TRUE;
150
++      break;
151
++#endif
152
++    default:
153
++      dbus_set_error (error,
154
++                      _dbus_error_from_errno (EINVAL),
155
++                      "Failed to read address from socket: Unknown socket type.");
156
++      return FALSE;
157
++    }
158
++ err:
159
++  dbus_set_error (error,
160
++                  _dbus_error_from_errno (errno),
161
++                  "Failed to open socket: %s",
162
++                  _dbus_strerror (errno));
163
++  return FALSE;
164
++}
165
++
166
+ /* tests in dbus-sysdeps-util.c */
167
+diff --git a/dbus/dbus-sysdeps-unix.h b/dbus/dbus-sysdeps-unix.h
168
+index 9b70896..a265b33 100644
169
+--- a/dbus/dbus-sysdeps-unix.h
170
+@@ -138,6 +138,10 @@ dbus_bool_t _dbus_parse_uid (const DBusString  *uid_str,
171
+ 
172
+ void _dbus_close_all (void);
173
+ 
174
++dbus_bool_t _dbus_append_address_from_socket (int         fd,
175
++                                              DBusString *address,
176
++                                              DBusError  *error);
177
++
178
+ /** @} */
179
+ 
180
+ DBUS_END_DECLS