26 #include "dbus-nonce.h"    27 #include "dbus-internals.h"    28 #include "dbus-protocol.h"    29 #include "dbus-sysdeps.h"    42   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
    73       saved_errno = _dbus_save_socket_errno ();
   131   buffer[
sizeof buffer - 1] = 
'\0';
   133   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   135   _dbus_verbose (
"reading nonce from file: %s\n", _dbus_string_get_const_data (fname));
   138   fp = fopen (_dbus_string_get_const_data (fname), 
"rb");
   143                       "Failed to open %s for read: %s",
   144                       _dbus_string_get_const_data (fname),
   149   nread = fread (buffer, 1, 
sizeof buffer - 1, fp);
   181   if (_dbus_read_nonce (_dbus_noncefile_get_path(noncefile), &nonce, 
NULL) != 
TRUE)
   186   if (!_dbus_socket_is_valid (fd))
   189   if (do_check_nonce(fd, &nonce, 
NULL) != 
TRUE) {
   190     _dbus_verbose (
"nonce check failed. Closing socket.\n");
   192     _dbus_socket_invalidate (&fd);
   207   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   246   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   248   if (_dbus_string_get_length (noncefile) == 0)
   257   read_result = _dbus_read_nonce (noncefile, &nonce, error);
   260       _DBUS_ASSERT_ERROR_IS_SET (error);
   264   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   270   if (send_result == -1)
   274                       "Failed to send nonce (fd=%" DBUS_SOCKET_FORMAT 
"): %s",
   275                       _dbus_socket_printable (fd),
   291     _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   338             _DBUS_ASSERT_ERROR_IS_SET (error);
   341         _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   357     if (!generate_and_write_nonce (&noncefile->path, error))
   359         _DBUS_ASSERT_ERROR_IS_SET (error);
   364     _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   370     if (use_subdir && _dbus_string_get_length (&noncefile->dir) != 0)
   390     return do_noncefile_create (noncefile, error, 
FALSE);
   404     _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   425     return do_noncefile_create (noncefile, error, 
TRUE);
   439     _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   459     return &noncefile->path;
   477     return do_check_nonce (fd, _dbus_noncefile_get_path (noncefile), error);
 dbus_bool_t _dbus_string_append(DBusString *str, const char *buffer)
Appends a nul-terminated C-style string to a DBusString. 
#define DBUS_ERROR_FILE_NOT_FOUND
Missing file. 
#define NULL
A null pointer, defined appropriately for C or C++. 
dbus_bool_t _dbus_string_save_to_file(const DBusString *str, const DBusString *filename, dbus_bool_t world_readable, DBusError *error)
Writes a string out to a file. 
#define _dbus_assert(condition)
Aborts with an error message if the condition is false. 
int _dbus_read_socket(DBusSocket fd, DBusString *buffer, int count)
Like _dbus_read(), but only works on sockets so is available on Windows. 
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string. 
#define DBUS_ERROR_IO_ERROR
Something went wrong reading or writing to a socket, for example. 
dbus_bool_t _dbus_string_copy(const DBusString *source, int start, DBusString *dest, int insert_at)
Like _dbus_string_move(), but does not delete the section of the source string that's copied to the d...
dbus_bool_t _dbus_close_socket(DBusSocket fd, DBusError *error)
Closes a socket. 
dbus_bool_t _dbus_delete_file(const DBusString *filename, DBusError *error)
Deletes the given file. 
dbus_bool_t _dbus_get_is_errno_eagain_or_ewouldblock(int e)
See if errno is EAGAIN or EWOULDBLOCK (this has to be done differently for Winsock so is abstracted) ...
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE. 
void _dbus_string_init_const(DBusString *str, const char *value)
Initializes a constant string. 
dbus_bool_t _dbus_generate_random_ascii(DBusString *str, int n_bytes, DBusError *error)
Generates the given number of random bytes, where the bytes are chosen from the alphanumeric ASCII su...
DBusSocket _dbus_accept(DBusSocket listen_fd)
Accepts a connection on a listening socket. 
dbus_bool_t _dbus_create_directory(const DBusString *filename, DBusError *error)
Creates a directory. 
dbus_bool_t _dbus_delete_directory(const DBusString *filename, DBusError *error)
Removes a directory; Directory must be empty. 
dbus_bool_t _dbus_get_is_errno_eintr(int e)
See if errno is EINTR. 
Object representing an exception. 
void dbus_set_error(DBusError *error, const char *name, const char *format,...)
Assigns an error name and message to a DBusError. 
dbus_bool_t _dbus_string_equal_len(const DBusString *a, const DBusString *b, int len)
Tests two DBusString for equality up to the given length. 
const char * _dbus_get_tmpdir(void)
Gets the temporary files directory by inspecting the environment variables TMPDIR, TMP, and TEMP in that order. 
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init(). 
#define TRUE
Expands to "1". 
const char * _dbus_strerror_from_errno(void)
Get error message from errno. 
const char * _dbus_error_from_system_errno(void)
Converts the current system errno value into a DBusError name. 
#define DBUS_ERROR_ACCESS_DENIED
Security restrictions don't allow doing what you're trying to do. 
dbus_bool_t _dbus_string_append_len(DBusString *str, const char *buffer, int len)
Appends block of bytes with the given length to a DBusString. 
dbus_bool_t _dbus_generate_random_bytes(DBusString *str, int n_bytes, DBusError *error)
Generates the given number of securely random bytes, using the best mechanism we can come up with...
#define DBUS_ERROR_NO_MEMORY
There was not enough memory to complete an operation. 
#define FALSE
Expands to "0". 
int _dbus_write_socket(DBusSocket fd, const DBusString *buffer, int start, int len)
Like _dbus_write(), but only supports sockets and is thus available on Windows. 
void _dbus_sleep_milliseconds(int milliseconds)
Sleeps the given number of milliseconds.