00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#include "dbus-transport-protected.h"
00025
#include "dbus-transport-unix.h"
00026
#include "dbus-connection-internal.h"
00027
#include "dbus-watch.h"
00028
#include "dbus-auth.h"
00029
#include "dbus-address.h"
00030
#ifdef DBUS_BUILD_TESTS
00031
#include "dbus-server-debug-pipe.h"
00032
#endif
00033
00055
static void
00056 live_messages_size_notify (
DBusCounter *counter,
00057
void *user_data)
00058 {
00059
DBusTransport *transport = user_data;
00060
00061
_dbus_transport_ref (transport);
00062
00063
#if 0
00064
_dbus_verbose (
"Counter value is now %d\n",
00065 (
int) _dbus_counter_get_value (counter));
00066
#endif
00067
00068
00069
00070
00071
if (* transport->
vtable->
live_messages_changed)
00072 (* transport->
vtable->
live_messages_changed) (transport);
00073
00074
_dbus_transport_unref (transport);
00075 }
00076
00087
dbus_bool_t
00088 _dbus_transport_init_base (
DBusTransport *transport,
00089
const DBusTransportVTable *vtable,
00090
dbus_bool_t server,
00091
const DBusString *address)
00092 {
00093
DBusMessageLoader *loader;
00094
DBusAuth *auth;
00095
DBusCounter *counter;
00096
char *address_copy;
00097
00098 loader =
_dbus_message_loader_new ();
00099
if (loader ==
NULL)
00100
return FALSE;
00101
00102
if (server)
00103 auth =
_dbus_auth_server_new ();
00104
else
00105 auth =
_dbus_auth_client_new ();
00106
if (auth ==
NULL)
00107 {
00108
_dbus_message_loader_unref (loader);
00109
return FALSE;
00110 }
00111
00112 counter =
_dbus_counter_new ();
00113
if (counter ==
NULL)
00114 {
00115
_dbus_auth_unref (auth);
00116
_dbus_message_loader_unref (loader);
00117
return FALSE;
00118 }
00119
00120
if (server)
00121 {
00122
_dbus_assert (address ==
NULL);
00123 address_copy =
NULL;
00124 }
00125
else
00126 {
00127
_dbus_assert (address !=
NULL);
00128
00129
if (!
_dbus_string_copy_data (address, &address_copy))
00130 {
00131
_dbus_counter_unref (counter);
00132
_dbus_auth_unref (auth);
00133
_dbus_message_loader_unref (loader);
00134
return FALSE;
00135 }
00136 }
00137
00138 transport->
refcount = 1;
00139 transport->
vtable = vtable;
00140 transport->
loader = loader;
00141 transport->
auth = auth;
00142 transport->
live_messages_size = counter;
00143 transport->
authenticated =
FALSE;
00144 transport->
messages_need_sending =
FALSE;
00145 transport->
disconnected =
FALSE;
00146 transport->
send_credentials_pending = !server;
00147 transport->
receive_credentials_pending = server;
00148 transport->
is_server = server;
00149 transport->
address = address_copy;
00150
00151 transport->
unix_user_function =
NULL;
00152 transport->
unix_user_data =
NULL;
00153 transport->
free_unix_user_data =
NULL;
00154
00155
00156
00157
00158 transport->
max_live_messages_size = _DBUS_ONE_MEGABYTE * 63;
00159
00160 transport->
credentials.
pid = -1;
00161 transport->
credentials.
uid = -1;
00162 transport->
credentials.
gid = -1;
00163
00164
_dbus_counter_set_notify (transport->
live_messages_size,
00165 transport->
max_live_messages_size,
00166 live_messages_size_notify,
00167 transport);
00168
00169
if (transport->
address)
00170 _dbus_verbose (
"Initialized transport on address %s\n", transport->
address);
00171
00172
return TRUE;
00173 }
00174
00181
void
00182 _dbus_transport_finalize_base (
DBusTransport *transport)
00183 {
00184
if (!transport->
disconnected)
00185
_dbus_transport_disconnect (transport);
00186
00187
if (transport->
free_unix_user_data !=
NULL)
00188 (* transport->
free_unix_user_data) (transport->
unix_user_data);
00189
00190
_dbus_message_loader_unref (transport->
loader);
00191
_dbus_auth_unref (transport->
auth);
00192
_dbus_counter_set_notify (transport->
live_messages_size,
00193 0,
NULL,
NULL);
00194
_dbus_counter_unref (transport->
live_messages_size);
00195
dbus_free (transport->
address);
00196 }
00197
00209
DBusTransport*
00210 _dbus_transport_open (
const char *address,
00211
DBusError *error)
00212 {
00213
DBusTransport *transport;
00214
DBusAddressEntry **entries;
00215
DBusError tmp_error;
00216
DBusError first_error;
00217
int len, i;
00218
const char *address_problem_type;
00219
const char *address_problem_field;
00220
const char *address_problem_other;
00221
00222 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00223
00224
if (!
dbus_parse_address (address, &entries, &len, error))
00225
return NULL;
00226
00227 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00228
00229 transport =
NULL;
00230 address_problem_type =
NULL;
00231 address_problem_field =
NULL;
00232 address_problem_other =
NULL;
00233
00234
dbus_error_init (&tmp_error);
00235
dbus_error_init (&first_error);
00236
for (i = 0; i < len; i++)
00237 {
00238
const char *method;
00239
00240 method =
dbus_address_entry_get_method (entries[i]);
00241
00242
if (strcmp (method,
"unix") == 0)
00243 {
00244
const char *path =
dbus_address_entry_get_value (entries[i],
"path");
00245
const char *tmpdir =
dbus_address_entry_get_value (entries[i],
"tmpdir");
00246
const char *
abstract =
dbus_address_entry_get_value (entries[i],
"abstract");
00247
00248
if (tmpdir !=
NULL)
00249 {
00250 address_problem_other =
"cannot use the \"tmpdir\" option for an address to connect to, only in an address to listen on";
00251
goto bad_address;
00252 }
00253
00254
if (path ==
NULL &&
abstract ==
NULL)
00255 {
00256 address_problem_type =
"unix";
00257 address_problem_field =
"path or abstract";
00258
goto bad_address;
00259 }
00260
00261
if (path !=
NULL &&
abstract !=
NULL)
00262 {
00263 address_problem_other =
"can't specify both \"path\" and \"abstract\" options in an address";
00264
goto bad_address;
00265 }
00266
00267
if (path)
00268 transport =
_dbus_transport_new_for_domain_socket (path,
FALSE,
00269 &tmp_error);
00270
else
00271 transport =
_dbus_transport_new_for_domain_socket (
abstract,
TRUE,
00272 &tmp_error);
00273 }
00274
else if (strcmp (method,
"tcp") == 0)
00275 {
00276
const char *host =
dbus_address_entry_get_value (entries[i],
"host");
00277
const char *port =
dbus_address_entry_get_value (entries[i],
"port");
00278
DBusString str;
00279
long lport;
00280
dbus_bool_t sresult;
00281
00282
if (port ==
NULL)
00283 {
00284 address_problem_type =
"tcp";
00285 address_problem_field =
"port";
00286
goto bad_address;
00287 }
00288
00289
_dbus_string_init_const (&str, port);
00290 sresult =
_dbus_string_parse_int (&str, 0, &lport,
NULL);
00291
_dbus_string_free (&str);
00292
00293
if (sresult ==
FALSE || lport <= 0 || lport > 65535)
00294 {
00295 address_problem_other =
"Port is not an integer between 0 and 65535";
00296
goto bad_address;
00297 }
00298
00299 transport =
_dbus_transport_new_for_tcp_socket (host, lport, &tmp_error);
00300 }
00301
#ifdef DBUS_BUILD_TESTS
00302
else if (strcmp (method,
"debug-pipe") == 0)
00303 {
00304
const char *name =
dbus_address_entry_get_value (entries[i],
"name");
00305
00306
if (name ==
NULL)
00307 {
00308 address_problem_type =
"debug-pipe";
00309 address_problem_field =
"name";
00310
goto bad_address;
00311 }
00312
00313 transport = _dbus_transport_debug_pipe_new (name, &tmp_error);
00314 }
00315
#endif
00316
else
00317 {
00318 address_problem_other =
"Unknown address type (examples of valid types are \"unix\" and \"tcp\")";
00319
goto bad_address;
00320 }
00321
00322
if (transport)
00323
break;
00324
00325 _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
00326
00327
if (i == 0)
00328
dbus_move_error (&tmp_error, &first_error);
00329
else
00330
dbus_error_free (&tmp_error);
00331 }
00332
00333 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00334 _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
00335
00336
if (transport ==
NULL)
00337 {
00338 _DBUS_ASSERT_ERROR_IS_SET (&first_error);
00339
dbus_move_error (&first_error, error);
00340 }
00341
else
00342 {
00343
dbus_error_free (&first_error);
00344 }
00345
00346
dbus_address_entries_free (entries);
00347
return transport;
00348
00349 bad_address:
00350
dbus_address_entries_free (entries);
00351
00352
if (address_problem_type !=
NULL)
00353
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
00354
"Address of type %s was missing argument %s",
00355 address_problem_type, address_problem_field);
00356
else
00357
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
00358
"Could not parse address: %s",
00359 address_problem_other);
00360
00361
return NULL;
00362 }
00363
00370
DBusTransport *
00371 _dbus_transport_ref (
DBusTransport *transport)
00372 {
00373
_dbus_assert (transport->
refcount > 0);
00374
00375 transport->
refcount += 1;
00376
00377
return transport;
00378 }
00379
00387
void
00388 _dbus_transport_unref (
DBusTransport *transport)
00389 {
00390
_dbus_assert (transport !=
NULL);
00391
_dbus_assert (transport->
refcount > 0);
00392
00393 transport->
refcount -= 1;
00394
if (transport->
refcount == 0)
00395 {
00396
_dbus_assert (transport->
vtable->
finalize !=
NULL);
00397
00398 (* transport->
vtable->
finalize) (transport);
00399 }
00400 }
00401
00410
void
00411 _dbus_transport_disconnect (
DBusTransport *transport)
00412 {
00413
_dbus_assert (transport->
vtable->
disconnect !=
NULL);
00414
00415
if (transport->
disconnected)
00416
return;
00417
00418 (* transport->
vtable->
disconnect) (transport);
00419
00420 transport->
disconnected =
TRUE;
00421 }
00422
00431
dbus_bool_t
00432 _dbus_transport_get_is_connected (
DBusTransport *transport)
00433 {
00434
return !transport->
disconnected;
00435 }
00436
00446
dbus_bool_t
00447 _dbus_transport_get_is_authenticated (
DBusTransport *transport)
00448 {
00449
if (transport->
authenticated)
00450
return TRUE;
00451
else
00452 {
00453
dbus_bool_t maybe_authenticated;
00454
00455
if (transport->
disconnected)
00456
return FALSE;
00457
00458 maybe_authenticated =
00459 (!(transport->
send_credentials_pending ||
00460 transport->
receive_credentials_pending));
00461
00462
if (maybe_authenticated)
00463 {
00464
switch (
_dbus_auth_do_work (transport->
auth))
00465 {
00466
case DBUS_AUTH_STATE_AUTHENTICATED:
00467
00468
break;
00469
default:
00470 maybe_authenticated =
FALSE;
00471 }
00472 }
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
if (maybe_authenticated && transport->
is_server)
00483 {
00484
DBusCredentials auth_identity;
00485
00486
_dbus_auth_get_identity (transport->
auth, &auth_identity);
00487
00488
if (transport->
unix_user_function !=
NULL)
00489 {
00490
00491
if (!(* transport->
unix_user_function) (transport->
connection,
00492 auth_identity.
uid,
00493 transport->
unix_user_data))
00494 {
00495 _dbus_verbose (
"Client UID "DBUS_UID_FORMAT
00496
" was rejected, disconnecting\n",
00497 auth_identity.
uid);
00498
_dbus_transport_disconnect (transport);
00499
return FALSE;
00500 }
00501
else
00502 {
00503 _dbus_verbose (
"Client UID "DBUS_UID_FORMAT
" authorized\n", auth_identity.
uid);
00504 }
00505 }
00506
else
00507 {
00508
DBusCredentials our_identity;
00509
00510
_dbus_credentials_from_current_process (&our_identity);
00511
00512
if (!
_dbus_credentials_match (&our_identity,
00513 &auth_identity))
00514 {
00515 _dbus_verbose (
"Client authorized as UID "DBUS_UID_FORMAT
00516
" but our UID is "DBUS_UID_FORMAT
", disconnecting\n",
00517 auth_identity.
uid, our_identity.
uid);
00518
_dbus_transport_disconnect (transport);
00519
return FALSE;
00520 }
00521
else
00522 {
00523 _dbus_verbose (
"Client authorized as UID "DBUS_UID_FORMAT
00524
" matching our UID "DBUS_UID_FORMAT
"\n",
00525 auth_identity.
uid, our_identity.
uid);
00526 }
00527 }
00528 }
00529
00530 transport->
authenticated = maybe_authenticated;
00531
00532
return transport->
authenticated;
00533 }
00534 }
00535
00543
const char*
00544 _dbus_transport_get_address (
DBusTransport *transport)
00545 {
00546
return transport->
address;
00547 }
00548
00558
dbus_bool_t
00559 _dbus_transport_handle_watch (
DBusTransport *transport,
00560
DBusWatch *watch,
00561
unsigned int condition)
00562 {
00563
dbus_bool_t retval;
00564
00565
_dbus_assert (transport->
vtable->
handle_watch !=
NULL);
00566
00567
if (transport->
disconnected)
00568
return TRUE;
00569
00570
if (
dbus_watch_get_fd (watch) < 0)
00571 {
00572
_dbus_warn (
"Tried to handle an invalidated watch; this watch should have been removed\n");
00573
return TRUE;
00574 }
00575
00576
_dbus_watch_sanitize_condition (watch, &condition);
00577
00578
_dbus_transport_ref (transport);
00579
_dbus_watch_ref (watch);
00580 retval = (* transport->
vtable->
handle_watch) (transport, watch, condition);
00581
_dbus_watch_unref (watch);
00582
_dbus_transport_unref (transport);
00583
00584
return retval;
00585 }
00586
00596
dbus_bool_t
00597 _dbus_transport_set_connection (
DBusTransport *transport,
00598
DBusConnection *connection)
00599 {
00600
_dbus_assert (transport->
vtable->
connection_set !=
NULL);
00601
_dbus_assert (transport->
connection ==
NULL);
00602
00603 transport->
connection = connection;
00604
00605
_dbus_transport_ref (transport);
00606
if (!(* transport->
vtable->
connection_set) (transport))
00607 transport->
connection =
NULL;
00608
_dbus_transport_unref (transport);
00609
00610
return transport->
connection !=
NULL;
00611 }
00612
00622
void
00623 _dbus_transport_messages_pending (
DBusTransport *transport,
00624
int queue_length)
00625 {
00626
_dbus_assert (transport->
vtable->
messages_pending !=
NULL);
00627
00628
if (transport->
disconnected)
00629
return;
00630
00631 transport->
messages_need_sending = queue_length > 0;
00632
00633
_dbus_transport_ref (transport);
00634 (* transport->
vtable->
messages_pending) (transport,
00635 queue_length);
00636
_dbus_transport_unref (transport);
00637 }
00638
00646
dbus_bool_t
00647 _dbus_transport_get_unix_fd (
DBusTransport *transport,
00648
int *fd_p)
00649 {
00650
dbus_bool_t retval;
00651
00652
if (transport->
vtable->
get_unix_fd ==
NULL)
00653
return FALSE;
00654
00655
if (transport->
disconnected)
00656
return FALSE;
00657
00658
_dbus_transport_ref (transport);
00659
00660 retval = (* transport->
vtable->
get_unix_fd) (transport,
00661 fd_p);
00662
00663
_dbus_transport_unref (transport);
00664
00665
return retval;
00666 }
00667
00679
void
00680 _dbus_transport_do_iteration (
DBusTransport *transport,
00681
unsigned int flags,
00682
int timeout_milliseconds)
00683 {
00684
_dbus_assert (transport->
vtable->
do_iteration !=
NULL);
00685
00686 _dbus_verbose (
"Transport iteration flags 0x%x timeout %d connected = %d\n",
00687 flags, timeout_milliseconds, !transport->
disconnected);
00688
00689
if ((flags & (DBUS_ITERATION_DO_WRITING |
00690 DBUS_ITERATION_DO_READING)) == 0)
00691
return;
00692
00693
if (transport->
disconnected)
00694
return;
00695
00696
_dbus_transport_ref (transport);
00697 (* transport->
vtable->
do_iteration) (transport, flags,
00698 timeout_milliseconds);
00699
_dbus_transport_unref (transport);
00700 }
00701
00702
static dbus_bool_t
00703 recover_unused_bytes (
DBusTransport *transport)
00704 {
00705
if (
_dbus_auth_needs_decoding (transport->
auth))
00706 {
00707
DBusString plaintext;
00708
const DBusString *encoded;
00709
DBusString *buffer;
00710
int orig_len;
00711
00712
if (!
_dbus_string_init (&plaintext))
00713
goto nomem;
00714
00715
_dbus_auth_get_unused_bytes (transport->
auth,
00716 &encoded);
00717
00718
if (!
_dbus_auth_decode_data (transport->
auth,
00719 encoded, &plaintext))
00720 {
00721
_dbus_string_free (&plaintext);
00722
goto nomem;
00723 }
00724
00725
_dbus_message_loader_get_buffer (transport->
loader,
00726 &buffer);
00727
00728 orig_len =
_dbus_string_get_length (buffer);
00729
00730
if (!
_dbus_string_move (&plaintext, 0, buffer,
00731 orig_len))
00732 {
00733
_dbus_string_free (&plaintext);
00734
goto nomem;
00735 }
00736
00737 _dbus_verbose (
" %d unused bytes sent to message loader\n",
00738 _dbus_string_get_length (buffer) -
00739 orig_len);
00740
00741
_dbus_message_loader_return_buffer (transport->
loader,
00742 buffer,
00743
_dbus_string_get_length (buffer) -
00744 orig_len);
00745
00746
_dbus_auth_delete_unused_bytes (transport->
auth);
00747
00748
_dbus_string_free (&plaintext);
00749 }
00750
else
00751 {
00752
const DBusString *bytes;
00753
DBusString *buffer;
00754
int orig_len;
00755
dbus_bool_t succeeded;
00756
00757
_dbus_message_loader_get_buffer (transport->
loader,
00758 &buffer);
00759
00760 orig_len =
_dbus_string_get_length (buffer);
00761
00762
_dbus_auth_get_unused_bytes (transport->
auth,
00763 &bytes);
00764
00765 succeeded =
TRUE;
00766
if (!
_dbus_string_copy (bytes, 0, buffer, _dbus_string_get_length (buffer)))
00767 succeeded =
FALSE;
00768
00769 _dbus_verbose (
" %d unused bytes sent to message loader\n",
00770 _dbus_string_get_length (buffer) -
00771 orig_len);
00772
00773
_dbus_message_loader_return_buffer (transport->
loader,
00774 buffer,
00775
_dbus_string_get_length (buffer) -
00776 orig_len);
00777
00778
if (succeeded)
00779
_dbus_auth_delete_unused_bytes (transport->
auth);
00780
else
00781
goto nomem;
00782 }
00783
00784
return TRUE;
00785
00786 nomem:
00787 _dbus_verbose (
"Not enough memory to transfer unused bytes from auth conversation\n");
00788
return FALSE;
00789 }
00790
00798 DBusDispatchStatus
00799 _dbus_transport_get_dispatch_status (
DBusTransport *transport)
00800 {
00801
if (
_dbus_counter_get_value (transport->
live_messages_size) >= transport->
max_live_messages_size)
00802
return DBUS_DISPATCH_COMPLETE;
00803
00804
if (!
_dbus_transport_get_is_authenticated (transport))
00805 {
00806
if (
_dbus_auth_do_work (transport->
auth) ==
00807 DBUS_AUTH_STATE_WAITING_FOR_MEMORY)
00808
return DBUS_DISPATCH_NEED_MEMORY;
00809
else if (!
_dbus_transport_get_is_authenticated (transport))
00810
return DBUS_DISPATCH_COMPLETE;
00811 }
00812
00813
if (!transport->
unused_bytes_recovered &&
00814 !recover_unused_bytes (transport))
00815
return DBUS_DISPATCH_NEED_MEMORY;
00816
00817 transport->
unused_bytes_recovered =
TRUE;
00818
00819
if (!
_dbus_message_loader_queue_messages (transport->
loader))
00820
return DBUS_DISPATCH_NEED_MEMORY;
00821
00822
if (
_dbus_message_loader_peek_message (transport->
loader) !=
NULL)
00823
return DBUS_DISPATCH_DATA_REMAINS;
00824
else
00825
return DBUS_DISPATCH_COMPLETE;
00826 }
00827
00836
dbus_bool_t
00837 _dbus_transport_queue_messages (
DBusTransport *transport)
00838 {
00839 DBusDispatchStatus status;
00840
00841
#if 0
00842
_dbus_verbose (
"_dbus_transport_queue_messages()\n");
00843
#endif
00844
00845
00846
while ((status =
_dbus_transport_get_dispatch_status (transport)) == DBUS_DISPATCH_DATA_REMAINS)
00847 {
00848
DBusMessage *message;
00849
DBusList *link;
00850
00851 link =
_dbus_message_loader_pop_message_link (transport->
loader);
00852
_dbus_assert (link !=
NULL);
00853
00854 message = link->
data;
00855
00856 _dbus_verbose (
"queueing received message %p\n", message);
00857
00858
if (!
_dbus_message_add_size_counter (message, transport->
live_messages_size))
00859 {
00860
_dbus_message_loader_putback_message_link (transport->
loader,
00861 link);
00862 status = DBUS_DISPATCH_NEED_MEMORY;
00863
break;
00864 }
00865
else
00866 {
00867
00868
_dbus_connection_queue_received_message_link (transport->
connection,
00869 link);
00870 }
00871 }
00872
00873
if (
_dbus_message_loader_get_is_corrupted (transport->
loader))
00874 {
00875 _dbus_verbose (
"Corrupted message stream, disconnecting\n");
00876
_dbus_transport_disconnect (transport);
00877 }
00878
00879
return status != DBUS_DISPATCH_NEED_MEMORY;
00880 }
00881
00888
void
00889 _dbus_transport_set_max_message_size (
DBusTransport *transport,
00890
long size)
00891 {
00892
_dbus_message_loader_set_max_message_size (transport->
loader, size);
00893 }
00894
00901
long
00902 _dbus_transport_get_max_message_size (
DBusTransport *transport)
00903 {
00904
return _dbus_message_loader_get_max_message_size (transport->
loader);
00905 }
00906
00913
void
00914 _dbus_transport_set_max_received_size (
DBusTransport *transport,
00915
long size)
00916 {
00917 transport->
max_live_messages_size = size;
00918
_dbus_counter_set_notify (transport->
live_messages_size,
00919 transport->
max_live_messages_size,
00920 live_messages_size_notify,
00921 transport);
00922 }
00923
00924
00931
long
00932 _dbus_transport_get_max_received_size (
DBusTransport *transport)
00933 {
00934
return transport->
max_live_messages_size;
00935 }
00936
00944
dbus_bool_t
00945 _dbus_transport_get_unix_user (
DBusTransport *transport,
00946
unsigned long *uid)
00947 {
00948
DBusCredentials auth_identity;
00949
00950 *uid =
_DBUS_INT_MAX;
00951
00952
00953
00954
00955
if (!transport->
authenticated)
00956
return FALSE;
00957
00958
_dbus_auth_get_identity (transport->
auth, &auth_identity);
00959
00960
if (auth_identity.
uid != DBUS_UID_UNSET)
00961 {
00962 *uid = auth_identity.
uid;
00963
return TRUE;
00964 }
00965
else
00966
return FALSE;
00967 }
00968
00976
dbus_bool_t
00977 _dbus_transport_get_unix_process_id (
DBusTransport *transport,
00978
unsigned long *pid)
00979 {
00980
DBusCredentials auth_identity;
00981
00982 *pid = DBUS_PID_UNSET;
00983
00984
00985
00986
00987
if (!transport->
authenticated)
00988
return FALSE;
00989
00990
_dbus_auth_get_identity (transport->
auth, &auth_identity);
00991
00992
if (auth_identity.
pid != DBUS_PID_UNSET)
00993 {
00994 *pid = auth_identity.
pid;
00995
return TRUE;
00996 }
00997
else
00998
return FALSE;
00999 }
01000
01011
void
01012 _dbus_transport_set_unix_user_function (
DBusTransport *transport,
01013 DBusAllowUnixUserFunction function,
01014
void *data,
01015
DBusFreeFunction free_data_function,
01016
void **old_data,
01017
DBusFreeFunction *old_free_data_function)
01018 {
01019 *old_data = transport->
unix_user_data;
01020 *old_free_data_function = transport->
free_unix_user_data;
01021
01022 transport->
unix_user_function = function;
01023 transport->
unix_user_data = data;
01024 transport->
free_unix_user_data = free_data_function;
01025 }
01026
01035
dbus_bool_t
01036 _dbus_transport_set_auth_mechanisms (
DBusTransport *transport,
01037
const char **mechanisms)
01038 {
01039
return _dbus_auth_set_mechanisms (transport->
auth, mechanisms);
01040 }
01041
01042