mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-01 07:57:58 +02:00
2003-02-19 Anders Carlsson <andersca@codefactory.se>
* configure.in: Add check for nonposix getpwnam_r * dbus/dbus-mempool.c: (_dbus_mem_pool_new): Align the pool element size to a sizeof (void *) boundary. * dbus/dbus-sysdeps.c: (_dbus_setenv), (_dbus_connect_unix_socket), (_dbus_listen_unix_socket), (_dbus_credentials_from_username): General Solaris fixes. * test/data/valid-messages/simplest-manual.message: Explicitly state that we want little-endian packing.
This commit is contained in:
parent
90c4578863
commit
89ee9e6abf
5 changed files with 101 additions and 12 deletions
15
ChangeLog
15
ChangeLog
|
|
@ -1,3 +1,18 @@
|
|||
2003-02-19 Anders Carlsson <andersca@codefactory.se>
|
||||
|
||||
* configure.in:
|
||||
Add check for nonposix getpwnam_r
|
||||
|
||||
* dbus/dbus-mempool.c: (_dbus_mem_pool_new):
|
||||
Align the pool element size to a sizeof (void *) boundary.
|
||||
|
||||
* dbus/dbus-sysdeps.c: (_dbus_setenv), (_dbus_connect_unix_socket),
|
||||
(_dbus_listen_unix_socket), (_dbus_credentials_from_username):
|
||||
General Solaris fixes.
|
||||
|
||||
* test/data/valid-messages/simplest-manual.message:
|
||||
Explicitly state that we want little-endian packing.
|
||||
|
||||
2003-02-19 Mikael Hallendal <micke@codefactory.se>
|
||||
|
||||
* dbus/dbus-server.c (dbus_server_listen): Support tcp: addresses.
|
||||
|
|
|
|||
40
configure.in
40
configure.in
|
|
@ -131,7 +131,45 @@ AC_CHECK_SIZEOF(__int64)
|
|||
## byte order
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
AC_CHECK_FUNCS(vsnprintf vasprintf getpwnam_r nanosleep usleep poll)
|
||||
AC_CHECK_LIB(socket,socket)
|
||||
|
||||
AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv)
|
||||
|
||||
AC_CACHE_CHECK([for posix getpwnam_r],
|
||||
ac_cv_func_posix_getpwnam_r,
|
||||
[AC_TRY_RUN([
|
||||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
int main () {
|
||||
char buffer[10000];
|
||||
struct passwd pwd, *pwptr = &pwd;
|
||||
int error;
|
||||
errno = 0;
|
||||
error = getpwnam_r ("", &pwd, buffer,
|
||||
sizeof (buffer), &pwptr);
|
||||
return (error < 0 && errno == ENOSYS)
|
||||
|| error == ENOSYS;
|
||||
} ],
|
||||
[ac_cv_func_posix_getpwnam_r=yes],
|
||||
[ac_cv_func_posix_getpwnam_r=no])])
|
||||
if test "$ac_cv_func_posix_getpwnam_r" = yes; then
|
||||
AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
|
||||
[Have POSIX function getpwnam_r])
|
||||
else
|
||||
AC_CACHE_CHECK([for nonposix getpwnam_r],
|
||||
ac_cv_func_nonposix_getpwnam_r,
|
||||
[AC_TRY_LINK([#include <pwd.h>],
|
||||
[char buffer[10000];
|
||||
struct passwd pwd;
|
||||
getpwnam_r ("", &pwd, buffer,
|
||||
sizeof (buffer));],
|
||||
[ac_cv_func_nonposix_getpwnam_r=yes],
|
||||
[ac_cv_func_nonposix_getpwnam_r=no])])
|
||||
if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
|
||||
AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
|
||||
[Have non-POSIX function getpwnam_r])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl check for writev header and writev function so we're
|
||||
dnl good to go if HAVE_WRITEV gets defined.
|
||||
|
|
|
|||
|
|
@ -144,17 +144,20 @@ _dbus_mem_pool_new (int element_size,
|
|||
*/
|
||||
_dbus_assert (element_size >= (int) sizeof (void*));
|
||||
_dbus_assert (element_size >= (int) sizeof (DBusFreedElement));
|
||||
|
||||
pool->element_size = element_size;
|
||||
|
||||
/* align the element size to a pointer boundary so we won't get bus
|
||||
* errors under other architectures.
|
||||
*/
|
||||
pool->element_size = _DBUS_ALIGN_VALUE (element_size, sizeof (void *));
|
||||
|
||||
pool->zero_elements = zero_elements != FALSE;
|
||||
|
||||
/* pick a size for the first block; it increases
|
||||
* for each block we need to allocate. This is
|
||||
* actually half the initial block size
|
||||
* since _dbus_mem_pool_alloc() unconditionally
|
||||
* doubles it prior to creating a new block.
|
||||
*/
|
||||
pool->block_size = element_size * 8;
|
||||
* doubles it prior to creating a new block. */
|
||||
pool->block_size = pool->element_size * 8;
|
||||
|
||||
_dbus_assert ((pool->block_size %
|
||||
pool->element_size) == 0);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
|
@ -54,6 +55,12 @@
|
|||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
#ifndef SUN_LEN
|
||||
/* This system is not POSIX.1g. */
|
||||
#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
|
||||
+ strlen ((ptr)->sun_path))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup DBusInternalsUtils
|
||||
* @{
|
||||
|
|
@ -78,7 +85,28 @@ _dbus_abort (void)
|
|||
dbus_bool_t
|
||||
_dbus_setenv (const char *varname, const char *value)
|
||||
{
|
||||
#ifdef HAVE_SETENV
|
||||
return (setenv (varname, value, TRUE) == 0);
|
||||
#else
|
||||
DBusString str;
|
||||
char *putenv_value;
|
||||
|
||||
if (!_dbus_string_init (&str, _DBUS_INT_MAX))
|
||||
return FALSE;
|
||||
|
||||
if (!_dbus_string_append (&str, varname) ||
|
||||
!_dbus_string_append (&str, "=") ||
|
||||
!_dbus_string_append (&str, value) ||
|
||||
!_dbus_string_steal_data (&str, &putenv_value))
|
||||
{
|
||||
_dbus_string_free (&str);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_dbus_string_free (&str);
|
||||
|
||||
return (putenv (putenv_value) == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -295,7 +323,7 @@ _dbus_connect_unix_socket (const char *path,
|
|||
int fd;
|
||||
struct sockaddr_un addr;
|
||||
|
||||
fd = socket (AF_LOCAL, SOCK_STREAM, 0);
|
||||
fd = socket (PF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
|
|
@ -309,7 +337,7 @@ _dbus_connect_unix_socket (const char *path,
|
|||
}
|
||||
|
||||
_DBUS_ZERO (addr);
|
||||
addr.sun_family = AF_LOCAL;
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy (addr.sun_path, path, _DBUS_MAX_SUN_PATH_LENGTH);
|
||||
addr.sun_path[_DBUS_MAX_SUN_PATH_LENGTH] = '\0';
|
||||
|
||||
|
|
@ -354,7 +382,7 @@ _dbus_listen_unix_socket (const char *path,
|
|||
int listen_fd;
|
||||
struct sockaddr_un addr;
|
||||
|
||||
listen_fd = socket (AF_LOCAL, SOCK_STREAM, 0);
|
||||
listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
if (listen_fd < 0)
|
||||
{
|
||||
|
|
@ -365,7 +393,7 @@ _dbus_listen_unix_socket (const char *path,
|
|||
}
|
||||
|
||||
_DBUS_ZERO (addr);
|
||||
addr.sun_family = AF_LOCAL;
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy (addr.sun_path, path, _DBUS_MAX_SUN_PATH_LENGTH);
|
||||
addr.sun_path[_DBUS_MAX_SUN_PATH_LENGTH] = '\0';
|
||||
|
||||
|
|
@ -973,7 +1001,7 @@ _dbus_credentials_from_username (const DBusString *username,
|
|||
|
||||
_dbus_string_get_const_data (username, &username_c_str);
|
||||
|
||||
#ifdef HAVE_GETPWNAM_R
|
||||
#if defined (HAVE_POSIX_GETPWNAME_R) || defined (HAVE_NONPOSIX_GETPWNAME_R)
|
||||
{
|
||||
struct passwd *p;
|
||||
int result;
|
||||
|
|
@ -981,9 +1009,13 @@ _dbus_credentials_from_username (const DBusString *username,
|
|||
struct passwd p_str;
|
||||
|
||||
p = NULL;
|
||||
#ifdef HAVE_POSIX_GETPWNAME_R
|
||||
result = getpwnam_r (username_c_str, &p_str, buf, sizeof (buf),
|
||||
&p);
|
||||
|
||||
#else
|
||||
p = getpwnam_r (username_c_str, &p_str, buf, sizeof (buf));
|
||||
result = 0;
|
||||
#endif
|
||||
if (result == 0 && p == &p_str)
|
||||
{
|
||||
credentials->uid = p->pw_uid;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
## like simplest.message, but doesn't use VALID_HEADER
|
||||
## convenience command. mostly to test the test framework.
|
||||
|
||||
LITTLE_ENDIAN
|
||||
BYTE 'l'
|
||||
BYTE 0
|
||||
BYTE 0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue