Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replaced ffi getuid by posix package #360

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/src/dbus_auth_client.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'dart:async';
import 'dart:io';

import 'package:posix/posix.dart';

import 'dbus_uuid.dart';
import 'getsid.dart';
import 'getuid.dart';
import 'getsid.dart' as getsid;

/// A client for D-Bus authentication.
class DBusAuthClient {
Expand Down Expand Up @@ -129,7 +130,7 @@ class DBusAuthClient {
if (Platform.isLinux) {
authId = getuid().toString();
} else if (Platform.isWindows) {
authId = getsid();
authId = getsid.getsid();
} else {
throw 'Authentication not supported on ${Platform.operatingSystem}';
}
Expand Down
3 changes: 2 additions & 1 deletion lib/src/dbus_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:posix/posix.dart';

import 'dbus_address.dart';
import 'dbus_auth_client.dart';
import 'dbus_bus_name.dart';
Expand All @@ -22,7 +24,6 @@ import 'dbus_read_buffer.dart';
import 'dbus_signal.dart';
import 'dbus_value.dart';
import 'dbus_write_buffer.dart';
import 'getuid.dart';

/// Reply received when calling [DBusClient.requestName].
enum DBusRequestNameReply { primaryOwner, inQueue, exists, alreadyOwner }
Expand Down
3 changes: 2 additions & 1 deletion lib/src/dbus_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import 'dart:convert';
import 'dart:io';
import 'dart:math';

import 'package:posix/posix.dart';

import 'dbus_address.dart';
import 'dbus_auth_server.dart';
import 'dbus_bus_name.dart';
Expand All @@ -20,7 +22,6 @@ import 'dbus_read_buffer.dart';
import 'dbus_uuid.dart';
import 'dbus_value.dart';
import 'dbus_write_buffer.dart';
import 'getuid.dart';

/// Results of starting a service.
enum DBusServerStartServiceResult { success, alreadyRunning, notFound }
Expand Down
2 changes: 0 additions & 2 deletions lib/src/getuid.dart

This file was deleted.

16 changes: 0 additions & 16 deletions lib/src/getuid_linux.dart

This file was deleted.

4 changes: 0 additions & 4 deletions lib/src/getuid_stub.dart

This file was deleted.

1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies:
args: ^2.0.0
ffi: ^2.0.0
meta: ^1.3.0
posix: ^5.0.0
xml: ^6.1.0

dev_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion test/dbus_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:dbus/src/dbus_match_rule.dart';
import 'package:dbus/src/dbus_member_name.dart';
import 'package:dbus/src/dbus_message.dart';
import 'package:dbus/src/dbus_uuid.dart';
import 'package:dbus/src/getuid.dart';
import 'package:posix/posix.dart';
import 'package:test/test.dart';

// Test server that exposes an activatable service.
Expand Down