[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-hal.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-providers-hybris.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/geoclue-providers-hybris.git</param>
<param name="branch">master</param>
- <param name="revision">d6d8b645480b2940bda691172bb59414e26c5c62</param>
+ <param name="revision">0.2.35</param>
<param name="token"></param>
<param name="debian"></param>
<param name="dumb"></param>
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-hal-0.2.35.tar.gz/hal/hallocationbackend.cpp
^
|
@@ -18,8 +18,12 @@
#include <android-config.h>
+#include <errno.h>
+#include <grp.h>
#include <strings.h>
#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
// Define versions of the Android GPS interface supported.
#if ANDROID_VERSION_MAJOR >= 7
@@ -398,6 +402,65 @@
HalLocationBackend::HalLocationBackend(QObject *parent)
: HybrisLocationBackend(parent), m_gps(Q_NULLPTR), m_agps(Q_NULLPTR), m_agpsril(Q_NULLPTR), m_gpsni(Q_NULLPTR), m_xtra(Q_NULLPTR), m_debug(Q_NULLPTR)
{
+ uid_t realUid;
+ uid_t effectiveUid;
+ uid_t savedUid;
+
+ int result = getresuid(&realUid, &effectiveUid, &savedUid);
+ if (result == -1)
+ qFatal("Failed to get process uids, %s", strerror(errno));
+
+ gid_t supplementaryGroups[NGROUPS_MAX];
+ int numberGroups = getgroups(NGROUPS_MAX, supplementaryGroups);
+ if (numberGroups == -1)
+ qFatal("Failed to get supplementary groups, %s", strerror(errno));
+
+ if (numberGroups + 1 > NGROUPS_MAX)
+ qFatal("Too many supplementary groups");
+
+ group *group = getgrnam("gps");
+ if (!group)
+ qFatal("Failed to get id of gps group, %s", strerror(errno));
+
+ supplementaryGroups[numberGroups++] = group->gr_gid;
+
+ // remove nfc, audio, radio and bluetooth groups to avoid confusion in BSP
+ const char *groups_to_remove[] = {"bluetooth", "radio", "audio", "nfc", NULL};
+
+ for (int idx = 0; idx < numberGroups; idx++) {
+ for (int j = 0; groups_to_remove[j]; j++) {
+ group = getgrnam(groups_to_remove[j]);
+ if (group) {
+ if (supplementaryGroups[idx] == group->gr_gid) {
+ // remove it
+ qCDebug(lcGeoclueHybris, "Removing supplementary group %s (%i)", groups_to_remove[j], supplementaryGroups[idx]);
+ memmove((void*)&supplementaryGroups[idx], (void*)&supplementaryGroups[idx + 1], (numberGroups - idx) * sizeof(gid_t));
+ numberGroups--;
+ }
+ }
+ }
+ }
+
+#if GEOCLUE_ANDROID_GPS_INTERFACE >= 2
+ group = getgrnam("net_raw");
+ if (group) {
+ if (numberGroups + 1 > NGROUPS_MAX)
+ qWarning("Too many supplementary groups, can't add net_raw");
+ else
+ supplementaryGroups[numberGroups++] = group->gr_gid;
+ }
+#endif
+
+ numberGroups = setgroups(numberGroups, supplementaryGroups);
+ if (numberGroups == -1)
+ qFatal("Failed to set supplementary groups, %s", strerror(errno));
+
+#if GEOCLUE_ANDROID_GPS_INTERFACE == 1
+ // Drop privileges.
+ result = setuid(realUid);
+ if (result == -1)
+ qFatal("Failed to set process uid to %d, %s", realUid, strerror(errno));
+#endif
}
HalLocationBackend::~HalLocationBackend()
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-hal-0.2.35.tar.gz/locationtypes.h
^
|
@@ -55,7 +55,7 @@
LocationData(const LocationData &other)
: QSharedData(other), timestamp(other.timestamp), latitude(other.latitude),
longitude(other.longitude), altitude(other.altitude), speed(other.speed),
- direction(other.direction), climb(other.climb)
+ direction(other.direction), climb(other.climb), accuracy(other.accuracy)
{ }
~LocationData() { }
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-provider-hybris-hal-0.2.35.tar.gz/main.cpp
^
|
@@ -18,17 +18,8 @@
#include <locationsettings.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <grp.h>
-#include <errno.h>
-
int main(int argc, char *argv[])
{
- uid_t realUid;
- uid_t effectiveUid;
- uid_t savedUid;
-
#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
QCoreApplication::setSetuidAllowed(true);
#endif
@@ -37,60 +28,6 @@
"geoclue.provider.hybris.position.debug=false"));
QCoreApplication a(argc, argv);
- int result = getresuid(&realUid, &effectiveUid, &savedUid);
- if (result == -1)
- qFatal("Failed to get process uids, %s", strerror(errno));
-
- gid_t supplementaryGroups[NGROUPS_MAX];
- int numberGroups = getgroups(NGROUPS_MAX, supplementaryGroups);
- if (numberGroups == -1)
- qFatal("Failed to get supplementary groups, %s", strerror(errno));
-
- if (numberGroups + 1 > NGROUPS_MAX)
- qFatal("Too many supplementary groups");
-
- group *group = getgrnam("gps");
- if (!group)
- qFatal("Failed to get id of gps group, %s", strerror(errno));
-
- supplementaryGroups[numberGroups++] = group->gr_gid;
-
- // remove nfc, audio, radio and bluetooth groups to avoid confusion in BSP
- const char *groups_to_remove[] = {"bluetooth", "radio", "audio", "nfc", NULL};
-
- int idx = 0;
- while (groups_to_remove[idx]) {
- group = getgrnam(groups_to_remove[idx]);
- idx++;
-
- if (idx + 1 < numberGroups) {
- memmove((void*)&supplementaryGroups[idx], (void*)&supplementaryGroups[idx + 1], (numberGroups - idx - 1) * sizeof(gid_t));
- }
-
- numberGroups--;
- }
-
-#if GEOCLUE_ANDROID_GPS_INTERFACE >= 2
- group = getgrnam("net_raw");
- if (group) {
- if (numberGroups + 1 > NGROUPS_MAX)
- qWarning("Too many supplementary groups, can't add net_raw");
- else
- supplementaryGroups[numberGroups++] = group->gr_gid;
- }
-#endif
-
- numberGroups = setgroups(numberGroups, supplementaryGroups);
- if (numberGroups == -1)
- qFatal("Failed to set supplementary groups, %s", strerror(errno));
-
-#if GEOCLUE_ANDROID_GPS_INTERFACE == 1
- // Drop privileges.
- result = setuid(realUid);
- if (result == -1)
- qFatal("Failed to set process uid to %d, %s", realUid, strerror(errno));
-#endif
-
QDBusConnection session = QDBusConnection::sessionBus();
LocationSettings settings;
HybrisProvider provider;
|
[-]
[+]
|
Changed |
_service:tar_git:geoclue-providers-hybris.inc
^
|
@@ -9,7 +9,7 @@
BuildRequires: pkgconfig(qofono-qt5)
BuildRequires: pkgconfig(qofonoext)
BuildRequires: pkgconfig(systemsettings) >= 0.5.5
-BuildRequires: systemd
+BuildRequires: pkgconfig(systemd)
Requires: connectionagent-qt5 >= 0.9.20
Source100: geoclue-providers-hybris.inc
@@ -28,7 +28,12 @@
%make_install
%files
+%if 0%{?with_suid}
%defattr(04755,root,root,-)
+%else
+%defattr(-,root,root,-)
+%endif
+%license COPYING
%{_libexecdir}/geoclue-hybris
%defattr(-,root,root,-)
%{_sysconfdir}/dbus-1
|