D-Bus  1.12.20
dbus-userdb.c
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-userdb.c User database abstraction
3  *
4  * Copyright (C) 2003, 2004 Red Hat, Inc.
5  *
6  * Licensed under the Academic Free License version 2.1
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 #include <config.h>
24 #define DBUS_USERDB_INCLUDES_PRIVATE 1
25 #include "dbus-userdb.h"
26 #include "dbus-hash.h"
27 #include "dbus-test.h"
28 #include "dbus-internals.h"
29 #include "dbus-protocol.h"
30 #include "dbus-credentials.h"
31 #include <string.h>
32 
38 static DBusUserInfo *
39 _dbus_user_info_ref (DBusUserInfo *info)
40 {
41  _dbus_assert (info->refcount > 0);
42  _dbus_assert (info->refcount < SIZE_MAX);
43  info->refcount++;
44  return info;
45 }
46 
54 void
56 {
57  if (info == NULL) /* hash table will pass NULL */
58  return;
59 
60  _dbus_assert (info->refcount > 0);
61  _dbus_assert (info->refcount < SIZE_MAX);
62 
63  if (--info->refcount > 0)
64  return;
65 
66  _dbus_user_info_free (info);
67  dbus_free (info);
68 }
69 
77 void
79 {
80  if (info == NULL) /* hash table will pass NULL */
81  return;
82 
83  _dbus_assert (info->refcount > 0);
84  _dbus_assert (info->refcount < SIZE_MAX);
85 
86  if (--info->refcount > 0)
87  return;
88 
89  _dbus_group_info_free (info);
90  dbus_free (info);
91 }
92 
98 void
100 {
101  dbus_free (info->group_ids);
102  dbus_free (info->username);
103  dbus_free (info->homedir);
104 }
105 
111 void
113 {
114  dbus_free (info->groupname);
115 }
116 
127  unsigned long *num)
128 {
129  int end;
130 
131  if (_dbus_string_parse_uint (str, 0, num, &end) &&
132  end == _dbus_string_get_length (str))
133  return TRUE;
134  else
135  return FALSE;
136 }
137 
150 const DBusUserInfo *
151 _dbus_user_database_lookup (DBusUserDatabase *db,
152  dbus_uid_t uid,
153  const DBusString *username,
154  DBusError *error)
155 {
156  DBusUserInfo *info;
157 
158  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
159  _dbus_assert (uid != DBUS_UID_UNSET || username != NULL);
160 
161  /* See if the username is really a number */
162  if (uid == DBUS_UID_UNSET)
163  {
164  unsigned long n;
165 
166  if (_dbus_is_a_number (username, &n))
167  uid = n;
168  }
169 
170  if (uid != DBUS_UID_UNSET)
171  info = _dbus_hash_table_lookup_uintptr (db->users, uid);
172  else
173  info = _dbus_hash_table_lookup_string (db->users_by_name, _dbus_string_get_const_data (username));
174 
175  if (info)
176  {
177  _dbus_verbose ("Using cache for UID "DBUS_UID_FORMAT" information\n",
178  info->uid);
179  return info;
180  }
181  else
182  {
183  if (uid != DBUS_UID_UNSET)
184  _dbus_verbose ("No cache for UID "DBUS_UID_FORMAT"\n",
185  uid);
186  else
187  _dbus_verbose ("No cache for user \"%s\"\n",
188  _dbus_string_get_const_data (username));
189 
190  info = dbus_new0 (DBusUserInfo, 1);
191  if (info == NULL)
192  {
194  return NULL;
195  }
196  info->refcount = 1;
197 
198  if (uid != DBUS_UID_UNSET)
199  {
200  if (!_dbus_user_info_fill_uid (info, uid, error))
201  {
202  _DBUS_ASSERT_ERROR_IS_SET (error);
203  _dbus_user_info_unref (info);
204  return NULL;
205  }
206  }
207  else
208  {
209  if (!_dbus_user_info_fill (info, username, error))
210  {
211  _DBUS_ASSERT_ERROR_IS_SET (error);
212  _dbus_user_info_unref (info);
213  return NULL;
214  }
215  }
216 
217  /* be sure we don't use these after here */
218  uid = DBUS_UID_UNSET;
219  username = NULL;
220 
221  /* insert into hash */
222  if (_dbus_hash_table_insert_uintptr (db->users, info->uid, info))
223  {
224  _dbus_user_info_ref (info);
225  }
226  else
227  {
229  _dbus_user_info_unref (info);
230  return NULL;
231  }
232 
233  if (_dbus_hash_table_insert_string (db->users_by_name,
234  info->username,
235  info))
236  {
237  _dbus_user_info_ref (info);
238  }
239  else
240  {
241  _dbus_hash_table_remove_uintptr (db->users, info->uid);
243  _dbus_user_info_unref (info);
244  return NULL;
245  }
246 
247  _dbus_user_info_unref (info);
248 
249  /* Return a borrowed pointer to the DBusUserInfo owned by the
250  * hash tables */
251  return info;
252  }
253 }
254 
255 static dbus_bool_t database_locked = FALSE;
256 static DBusUserDatabase *system_db = NULL;
257 static DBusString process_username;
258 static DBusString process_homedir;
259 
260 static void
261 shutdown_system_db (void *data)
262 {
263  if (system_db != NULL)
264  _dbus_user_database_unref (system_db);
265  system_db = NULL;
266  _dbus_string_free (&process_username);
267  _dbus_string_free (&process_homedir);
268 }
269 
270 static dbus_bool_t
271 init_system_db (void)
272 {
273  _dbus_assert (database_locked);
274 
275  if (system_db == NULL)
276  {
277  DBusError error = DBUS_ERROR_INIT;
278 
279 #ifdef HAVE_PDPLINUX
280  // Patch mem
281  const DBusUserInfo *info=NULL;
282 #else
283  const DBusUserInfo *info;
284 #endif
285 
286  system_db = _dbus_user_database_new ();
287  if (system_db == NULL)
288  return FALSE;
289 
290  if (!_dbus_user_database_get_uid (system_db,
291  _dbus_getuid (),
292  &info,
293  &error))
294  {
295  _dbus_user_database_unref (system_db);
296  system_db = NULL;
297 
299  {
300  dbus_error_free (&error);
301  return FALSE;
302  }
303  else
304  {
305  /* This really should not happen. */
306  _dbus_warn ("Could not get password database information for UID of current process: %s",
307  error.message);
308  dbus_error_free (&error);
309  return FALSE;
310  }
311  }
312 
313  if (!_dbus_string_init (&process_username))
314  {
315  _dbus_user_database_unref (system_db);
316  system_db = NULL;
317  return FALSE;
318  }
319 
320  if (!_dbus_string_init (&process_homedir))
321  {
322  _dbus_string_free (&process_username);
323  _dbus_user_database_unref (system_db);
324  system_db = NULL;
325  return FALSE;
326  }
327 
328  if (!_dbus_string_append (&process_username,
329  info->username) ||
330  !_dbus_string_append (&process_homedir,
331  info->homedir) ||
332  !_dbus_register_shutdown_func (shutdown_system_db, NULL))
333  {
334  _dbus_string_free (&process_username);
335  _dbus_string_free (&process_homedir);
336  _dbus_user_database_unref (system_db);
337  system_db = NULL;
338  return FALSE;
339  }
340 #ifdef HAVE_PDPLINUX
341  //_dbus_verbose ("Added mem free\n");
342  if (info){
343  //_dbus_verbose ("start free\n");
344  //_dbus_user_info_free_allocated(info);
345  //_dbus_verbose ("end free\n");
346  }
347 
348 #endif
349  }
350 
351  return TRUE;
352 }
353 
359 {
360  if (_DBUS_LOCK (system_users))
361  {
362  database_locked = TRUE;
363  return TRUE;
364  }
365  else
366  {
367  return FALSE;
368  }
369 }
370 
374 void
376 {
377  database_locked = FALSE;
378  _DBUS_UNLOCK (system_users);
379 }
380 
387 DBusUserDatabase*
389 {
390  _dbus_assert (database_locked);
391 
392  init_system_db ();
393 
394  return system_db;
395 }
396 
400 void
402 {
404  {
405  /* nothing to flush */
406  return;
407  }
408 
409  if (system_db != NULL)
410  _dbus_user_database_flush (system_db);
411 
413 }
414 
424 {
426  return FALSE;
427 
428  if (!init_system_db ())
429  {
431  return FALSE;
432  }
433  *username = &process_username;
435 
436  return TRUE;
437 }
438 
448 {
450  return FALSE;
451 
452  if (!init_system_db ())
453  {
455  return FALSE;
456  }
457  *homedir = &process_homedir;
459 
460  return TRUE;
461 }
462 
472  DBusString *homedir)
473 {
474  DBusUserDatabase *db;
475  const DBusUserInfo *info;
476 
477  /* FIXME: this can't distinguish ENOMEM from other errors */
479  return FALSE;
480 
482  if (db == NULL)
483  {
485  return FALSE;
486  }
487 
488  if (!_dbus_user_database_get_username (db, username,
489  &info, NULL))
490  {
492  return FALSE;
493  }
494 
495  if (!_dbus_string_append (homedir, info->homedir))
496  {
498  return FALSE;
499  }
500 
502  return TRUE;
503 }
504 
514  DBusString *homedir)
515 {
516  DBusUserDatabase *db;
517  const DBusUserInfo *info;
518 
519  if (uid == _dbus_getuid () && uid == _dbus_geteuid ())
520  {
521  const char *from_environment;
522 
523  from_environment = _dbus_getenv ("HOME");
524 
525  if (from_environment != NULL)
526  return _dbus_string_append (homedir, from_environment);
527  }
528 
529  /* FIXME: this can't distinguish ENOMEM from other errors */
531  return FALSE;
532 
534  if (db == NULL)
535  {
537  return FALSE;
538  }
539 
540  if (!_dbus_user_database_get_uid (db, uid,
541  &info, NULL))
542  {
544  return FALSE;
545  }
546 
547  if (!_dbus_string_append (homedir, info->homedir))
548  {
550  return FALSE;
551  }
552 
554  return TRUE;
555 }
556 
573  const DBusString *username)
574 {
575  DBusUserDatabase *db;
576  const DBusUserInfo *info;
577 
578  /* FIXME: this can't distinguish ENOMEM from other errors */
580  return FALSE;
581 
583  if (db == NULL)
584  {
586  return FALSE;
587  }
588 
589  if (!_dbus_user_database_get_username (db, username,
590  &info, NULL))
591  {
593  return FALSE;
594  }
595 
597  {
599  return FALSE;
600  }
601 
603  return TRUE;
604 }
605 
611 DBusUserDatabase*
613 {
614  DBusUserDatabase *db;
615 
616  db = dbus_new0 (DBusUserDatabase, 1);
617  if (db == NULL)
618  return NULL;
619 
620  db->refcount = 1;
621 
624 
625  if (db->users == NULL)
626  goto failed;
627 
630 
631  if (db->groups == NULL)
632  goto failed;
633 
634  db->users_by_name = _dbus_hash_table_new (DBUS_HASH_STRING,
636  if (db->users_by_name == NULL)
637  goto failed;
638 
639  db->groups_by_name = _dbus_hash_table_new (DBUS_HASH_STRING,
641  if (db->groups_by_name == NULL)
642  goto failed;
643 
644  return db;
645 
646  failed:
648  return NULL;
649 }
650 
654 void
655 _dbus_user_database_flush (DBusUserDatabase *db)
656 {
657  _dbus_hash_table_remove_all(db->users_by_name);
658  _dbus_hash_table_remove_all(db->groups_by_name);
659  _dbus_hash_table_remove_all(db->users);
660  _dbus_hash_table_remove_all(db->groups);
661 }
662 
663 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
664 
669 DBusUserDatabase *
670 _dbus_user_database_ref (DBusUserDatabase *db)
671 {
672  _dbus_assert (db->refcount > 0);
673 
674  db->refcount += 1;
675 
676  return db;
677 }
678 #endif /* DBUS_ENABLE_EMBEDDED_TESTS */
679 
684 void
685 _dbus_user_database_unref (DBusUserDatabase *db)
686 {
687  _dbus_assert (db->refcount > 0);
688 
689  db->refcount -= 1;
690  if (db->refcount == 0)
691  {
692  if (db->users)
693  _dbus_hash_table_unref (db->users);
694 
695  if (db->groups)
696  _dbus_hash_table_unref (db->groups);
697 
698  if (db->users_by_name)
699  _dbus_hash_table_unref (db->users_by_name);
700 
701  if (db->groups_by_name)
702  _dbus_hash_table_unref (db->groups_by_name);
703 
704  dbus_free (db);
705  }
706 }
707 
719 _dbus_user_database_get_uid (DBusUserDatabase *db,
720  dbus_uid_t uid,
721  const DBusUserInfo **info,
722  DBusError *error)
723 {
724  *info = _dbus_user_database_lookup (db, uid, NULL, error);
725  return *info != NULL;
726 }
727 
738 _dbus_user_database_get_username (DBusUserDatabase *db,
739  const DBusString *username,
740  const DBusUserInfo **info,
741  DBusError *error)
742 {
743  *info = _dbus_user_database_lookup (db, DBUS_UID_UNSET, username, error);
744  return *info != NULL;
745 }
746 
749 /* Tests in dbus-userdb-util.c */
_dbus_user_info_fill
dbus_bool_t _dbus_user_info_fill(DBusUserInfo *info, const DBusString *username, DBusError *error)
Gets user info for the given username.
Definition: dbus-sysdeps-unix.c:2786
DBusUserInfo::group_ids
dbus_gid_t * group_ids
Groups IDs, including above primary group.
Definition: dbus-sysdeps-unix.h:111
_dbus_hash_table_insert_uintptr
dbus_bool_t _dbus_hash_table_insert_uintptr(DBusHashTable *table, uintptr_t key, void *value)
Creates a hash entry with the given key and value.
Definition: dbus-hash.c:1299
_dbus_hash_table_unref
void _dbus_hash_table_unref(DBusHashTable *table)
Decrements the reference count for a hash table, freeing the hash table if the count reaches zero.
Definition: dbus-hash.c:361
_dbus_user_info_fill_uid
dbus_bool_t _dbus_user_info_fill_uid(DBusUserInfo *info, dbus_uid_t uid, DBusError *error)
Gets user info for the given user ID.
Definition: dbus-sysdeps-unix.c:2803
_dbus_user_database_get_uid
dbus_bool_t _dbus_user_database_get_uid(DBusUserDatabase *db, dbus_uid_t uid, const DBusUserInfo **info, DBusError *error)
Gets the user information for the given UID, returned user info should not be freed.
Definition: dbus-userdb.c:719
_dbus_getuid
dbus_uid_t _dbus_getuid(void)
Gets our UID.
Definition: dbus-sysdeps-unix.c:2939
_dbus_user_database_unlock_system
void _dbus_user_database_unlock_system(void)
Unlocks global system user database.
Definition: dbus-userdb.c:375
_dbus_string_free
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init().
Definition: dbus-string.c:259
_dbus_group_info_unref
void _dbus_group_info_unref(DBusGroupInfo *info)
Decrements the reference count.
Definition: dbus-userdb.c:78
_dbus_hash_table_lookup_string
void * _dbus_hash_table_lookup_string(DBusHashTable *table, const char *key)
Looks up the value for a given string in a hash table of type DBUS_HASH_STRING.
Definition: dbus-hash.c:1059
_dbus_user_database_unref
void _dbus_user_database_unref(DBusUserDatabase *db)
Decrements refcount of user database.
Definition: dbus-userdb.c:685
DBUS_UID_FORMAT
#define DBUS_UID_FORMAT
an appropriate printf format for dbus_uid_t
Definition: dbus-sysdeps.h:154
DBusFreeFunction
void(* DBusFreeFunction)(void *memory)
The type of a function which frees a block of memory.
Definition: dbus-memory.h:63
_dbus_username_from_current_process
dbus_bool_t _dbus_username_from_current_process(const DBusString **username)
Gets username of user owning current process.
Definition: dbus-userdb.c:423
_dbus_user_database_flush
void _dbus_user_database_flush(DBusUserDatabase *db)
Flush all information out of the user database.
Definition: dbus-userdb.c:655
DBusGroupInfo
Information about a UNIX group.
Definition: dbus-sysdeps-unix.h:121
DBusUserInfo::uid
dbus_uid_t uid
UID.
Definition: dbus-sysdeps-unix.h:109
_dbus_string_init
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
Definition: dbus-string.c:175
DBusUserInfo::refcount
size_t refcount
Reference count.
Definition: dbus-sysdeps-unix.h:108
_DBUS_LOCK
#define _DBUS_LOCK(name)
Locks a global lock, initializing it first if necessary.
Definition: dbus-internals.h:372
_dbus_hash_table_new
DBusHashTable * _dbus_hash_table_new(DBusHashType type, DBusFreeFunction key_free_function, DBusFreeFunction value_free_function)
Constructs a new hash table.
Definition: dbus-hash.c:285
TRUE
#define TRUE
Expands to "1".
DBusGroupInfo::refcount
size_t refcount
Reference count.
Definition: dbus-sysdeps-unix.h:122
_dbus_user_info_free
void _dbus_user_info_free(DBusUserInfo *info)
Frees the members of info (but not info itself)
Definition: dbus-userdb.c:99
DBUS_HASH_STRING
@ DBUS_HASH_STRING
Hash keys are strings.
Definition: dbus-hash.h:69
_dbus_user_database_new
DBusUserDatabase * _dbus_user_database_new(void)
Creates a new user database object used to look up and cache user information.
Definition: dbus-userdb.c:612
dbus_error_has_name
dbus_bool_t dbus_error_has_name(const DBusError *error, const char *name)
Checks whether the error is set and has the given name.
Definition: dbus-errors.c:302
DBusUserInfo::username
char * username
Username.
Definition: dbus-sysdeps-unix.h:113
dbus_free
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
Definition: dbus-memory.c:702
_dbus_user_database_lock_system
dbus_bool_t _dbus_user_database_lock_system(void)
Locks global system user database.
Definition: dbus-userdb.c:358
_dbus_register_shutdown_func
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_register_shutdown_func(DBusShutdownFunction function, void *data)
Register a cleanup function to be called exactly once the next time dbus_shutdown() is called.
Definition: dbus-memory.c:811
DBusString
Definition: dbus-string.h:43
DBusUserInfo::homedir
char * homedir
Home directory.
Definition: dbus-sysdeps-unix.h:114
_dbus_group_info_free
void _dbus_group_info_free(DBusGroupInfo *info)
Frees the members of info (but not info itself).
Definition: dbus-userdb.c:112
DBusCredentials
Definition: dbus-credentials.c:48
_dbus_user_database_get_system
DBusUserDatabase * _dbus_user_database_get_system(void)
Gets the system global user database; must be called with lock held (_dbus_user_database_lock_system(...
Definition: dbus-userdb.c:388
dbus_uid_t
unsigned long dbus_uid_t
A user ID.
Definition: dbus-sysdeps.h:134
FALSE
#define FALSE
Expands to "0".
_dbus_hash_table_remove_all
void _dbus_hash_table_remove_all(DBusHashTable *table)
Removed all entries from a hash table.
Definition: dbus-hash.c:418
DBUS_ERROR_NO_MEMORY
#define DBUS_ERROR_NO_MEMORY
There was not enough memory to complete an operation.
Definition: dbus-protocol.h:370
_dbus_is_a_number
dbus_bool_t _dbus_is_a_number(const DBusString *str, unsigned long *num)
Checks if a given string is actually a number and converts it if it is.
Definition: dbus-userdb.c:126
DBUS_ERROR_INIT
#define DBUS_ERROR_INIT
Expands to a suitable initializer for a DBusError on the stack.
Definition: dbus-errors.h:62
_dbus_hash_table_lookup_uintptr
void * _dbus_hash_table_lookup_uintptr(DBusHashTable *table, uintptr_t key)
Looks up the value for a given integer in a hash table of type DBUS_HASH_UINTPTR.
Definition: dbus-hash.c:1109
DBUS_UID_UNSET
#define DBUS_UID_UNSET
an invalid UID used to represent an uninitialized dbus_uid_t field
Definition: dbus-sysdeps.h:141
_dbus_getenv
const char * _dbus_getenv(const char *varname)
Wrapper for getenv().
Definition: dbus-sysdeps.c:187
DBUS_HASH_UINTPTR
@ DBUS_HASH_UINTPTR
Hash keys are integer capable to hold a pointer.
Definition: dbus-hash.h:71
_dbus_user_database_get_username
dbus_bool_t _dbus_user_database_get_username(DBusUserDatabase *db, const DBusString *username, const DBusUserInfo **info, DBusError *error)
Gets the user information for the given username.
Definition: dbus-userdb.c:738
_dbus_assert
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
Definition: dbus-internals.h:152
dbus_error_free
void dbus_error_free(DBusError *error)
Frees an error that's been set (or just initialized), then reinitializes the error as in dbus_error_i...
Definition: dbus-errors.c:211
DBusUserInfo
Information about a UNIX user.
Definition: dbus-sysdeps-unix.h:107
_dbus_warn
void _dbus_warn(const char *format,...)
Prints a warning message to stderr.
Definition: dbus-internals.c:263
_dbus_geteuid
dbus_uid_t _dbus_geteuid(void)
Gets our effective UID.
Definition: dbus-sysdeps-unix.c:2948
_dbus_user_database_flush_system
void _dbus_user_database_flush_system(void)
Flushes the system global user database;.
Definition: dbus-userdb.c:401
_dbus_credentials_add_from_user
dbus_bool_t _dbus_credentials_add_from_user(DBusCredentials *credentials, const DBusString *username)
Adds the credentials corresponding to the given username.
Definition: dbus-userdb.c:572
_dbus_user_info_unref
void _dbus_user_info_unref(DBusUserInfo *info)
Decrements the reference count.
Definition: dbus-userdb.c:55
DBusError
Object representing an exception.
Definition: dbus-errors.h:49
_dbus_hash_table_remove_uintptr
dbus_bool_t _dbus_hash_table_remove_uintptr(DBusHashTable *table, uintptr_t key)
Removes the hash entry for the given key.
Definition: dbus-hash.c:1189
dbus_set_error
void dbus_set_error(DBusError *error, const char *name, const char *format,...)
Assigns an error name and message to a DBusError.
Definition: dbus-errors.c:354
_dbus_user_database_lookup
const DBusUserInfo * _dbus_user_database_lookup(DBusUserDatabase *db, dbus_uid_t uid, const DBusString *username, DBusError *error)
Looks up a uid or username in the user database.
Definition: dbus-userdb.c:151
_DBUS_UNLOCK
#define _DBUS_UNLOCK(name)
Unlocks a global lock.
Definition: dbus-internals.h:373
_dbus_string_parse_uint
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_parse_uint(const DBusString *str, int start, unsigned long *value_return, int *end_return)
Parses an unsigned integer contained in a DBusString.
Definition: dbus-sysdeps.c:476
DBusError::message
const char * message
public error message field
Definition: dbus-errors.h:51
_dbus_homedir_from_uid
dbus_bool_t _dbus_homedir_from_uid(dbus_uid_t uid, DBusString *homedir)
Gets the home directory for the given user.
Definition: dbus-userdb.c:513
dbus_new0
#define dbus_new0(type, count)
Safe macro for using dbus_malloc0().
Definition: dbus-memory.h:58
_dbus_hash_table_insert_string
dbus_bool_t _dbus_hash_table_insert_string(DBusHashTable *table, char *key, void *value)
Creates a hash entry with the given key and value.
Definition: dbus-hash.c:1224
_dbus_homedir_from_username
dbus_bool_t _dbus_homedir_from_username(const DBusString *username, DBusString *homedir)
Gets the home directory for the given user.
Definition: dbus-userdb.c:471
_dbus_homedir_from_current_process
dbus_bool_t _dbus_homedir_from_current_process(const DBusString **homedir)
Gets homedir of user owning current process.
Definition: dbus-userdb.c:447
_dbus_string_append
dbus_bool_t _dbus_string_append(DBusString *str, const char *buffer)
Appends a nul-terminated C-style string to a DBusString.
Definition: dbus-string.c:935
DBusGroupInfo::groupname
char * groupname
Group name.
Definition: dbus-sysdeps-unix.h:124
DBusTransport::credentials
DBusCredentials * credentials
Credentials of other end read from the socket.
Definition: dbus-transport-protected.h:92
dbus_bool_t
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition: dbus-types.h:35
NULL
#define NULL
A null pointer, defined appropriately for C or C++.
_dbus_credentials_add_unix_uid
dbus_bool_t _dbus_credentials_add_unix_uid(DBusCredentials *credentials, dbus_uid_t uid)
Add a UNIX user ID to the credentials.
Definition: dbus-credentials.c:182