summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--dbus/dbus-userdb-util.c10
-rw-r--r--dbus/dbus-userdb.c32
-rw-r--r--dbus/dbus-userdb.h3
-rw-r--r--tools/Makefile.am14
5 files changed, 67 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 5a49f8b2..60c1fa0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-03-22 John (J5) Palmieri <johnp@redhat.com>
+
+ * tools/Makefile.am: Patch by Colin Walters that fixes distcheck
+
+ * dbus/dbus-userdb.c, dbus/dbus-userdb-util.c: Add patch we have
+ had in Red Hat packages for a while but for some reason never
+ got merged upstream
+ (_dbus_is_a_number): New checks if a string
+ can be converted to a number and does the conversion if it can
+ (_dbus_user_database_lookup): Add check to see if the given username
+ is a udi. This allows udi's to be used instead of usernames in the
+ config file.
+ (_dbus_user_database_lookup_group): Add check to see if the given groupname
+ is a gdi. This allows gdi's to be used instead of groupnames in the
+ config file.
+
2005-03-21 John (J5) Palmieri <johnp@redhat.com>
* python/lvalue_cast_post_process.py - added post processor to fix Pyrex
diff --git a/dbus/dbus-userdb-util.c b/dbus/dbus-userdb-util.c
index bd9c2e35..344bd747 100644
--- a/dbus/dbus-userdb-util.c
+++ b/dbus/dbus-userdb-util.c
@@ -195,6 +195,16 @@ _dbus_user_database_lookup_group (DBusUserDatabase *db,
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
+ /* See if the group is really a number */
+ if (gid == DBUS_UID_UNSET)
+ {
+ unsigned long n;
+
+ if (_dbus_is_a_number (groupname, &n))
+ gid = n;
+ }
+
+
if (gid != DBUS_GID_UNSET)
info = _dbus_hash_table_lookup_ulong (db->groups, gid);
else
diff --git a/dbus/dbus-userdb.c b/dbus/dbus-userdb.c
index f1317aa9..83a5769f 100644
--- a/dbus/dbus-userdb.c
+++ b/dbus/dbus-userdb.c
@@ -66,6 +66,27 @@ _dbus_group_info_free_allocated (DBusGroupInfo *info)
}
/**
+ * Checks if a given string is actually a number
+ * and converts it if it is
+ *
+ * @param str the string to check
+ * @param num the memory location of the unsigned long to fill in
+ * @returns TRUE if str is a number and num is filled in
+ */
+dbus_bool_t
+_dbus_is_a_number (const DBusString *str,
+ unsigned long *num)
+{
+ int end;
+
+ if (_dbus_string_parse_int (str, 0, num, &end) &&
+ end == _dbus_string_get_length (str))
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/**
* Looks up a uid or username in the user database. Only one of name
* or UID can be provided. There are wrapper functions for this that
* are better to use, this one does no locking or anything on the
@@ -87,7 +108,16 @@ _dbus_user_database_lookup (DBusUserDatabase *db,
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
_dbus_assert (uid != DBUS_UID_UNSET || username != NULL);
-
+
+ /* See if the username is really a number */
+ if (uid == DBUS_UID_UNSET)
+ {
+ unsigned long n;
+
+ if (_dbus_is_a_number (username, &n))
+ uid = n;
+ }
+
if (uid != DBUS_UID_UNSET)
info = _dbus_hash_table_lookup_ulong (db->users, uid);
else
diff --git a/dbus/dbus-userdb.h b/dbus/dbus-userdb.h
index 316b99b7..7e033b41 100644
--- a/dbus/dbus-userdb.h
+++ b/dbus/dbus-userdb.h
@@ -106,6 +106,9 @@ dbus_bool_t _dbus_credentials_from_uid (dbus_uid_t user_id,
dbus_bool_t _dbus_is_console_user (dbus_uid_t uid,
DBusError *error);
+dbus_bool_t _dbus_is_a_number (const DBusString *str,
+ unsigned long *num);
+
DBUS_END_DECLS
diff --git a/tools/Makefile.am b/tools/Makefile.am
index aeb6d6ce..d1b490c7 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -3,13 +3,13 @@ INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_X_CFLA
if HAVE_GLIB
GLIB_TOOLS=dbus-monitor
-libdbus_glib_HEADERS = dbus-glib-bindings.h
+nodist_libdbus_glib_HEADERS = dbus-glib-bindings.h
libdbus_glibdir = $(includedir)/dbus-1.0/dbus
dbus-glib-bindings.h: dbus-bus-introspect.xml $(top_builddir)/glib/dbus-binding-tool
$(top_builddir)/glib/dbus-binding-tool --ignore-unsupported --mode=glib-client --output=dbus-glib-bindings.h dbus-bus-introspect.xml # FIXME - remove --ignore-unsupported when we can do arrays
-BUILT_SOURCES = dbus-glib-bindings.h
+BUILT_SOURCES = dbus-glib-bindings.h dbus-bus-introspect.xml
else
GLIB_TOOLS=
@@ -26,9 +26,7 @@ noinst_PROGRAMS = print-introspect
print_introspect_SOURCES = print-introspect.c
print_introspect_LDADD = $(top_builddir)/glib/libdbus-glib-1.la
-run-with-tmp-session-bus.sh: $(top_builddir)/bus/dbus-daemon dbus-launch
-
-dbus-bus-introspect.xml: $(srcdir)/run-with-tmp-session-bus.sh print-introspect $(top_builddir)/bus/dbus-daemon
+dbus-bus-introspect.xml: $(top_builddir)/bus/dbus-daemon dbus-launch print-introspect $(top_builddir)/bus/dbus-daemon
DBUS_TOP_BUILDDIR=$(top_builddir) $(srcdir)/run-with-tmp-session-bus.sh ./print-introspect org.freedesktop.DBus /org/freedesktop/DBus > dbus-bus-introspect.xml.tmp && mv dbus-bus-introspect.xml.tmp dbus-bus-introspect.xml
bin_PROGRAMS=dbus-send $(GLIB_TOOLS) dbus-launch dbus-cleanup-sockets $(GTK_TOOLS)
@@ -63,5 +61,7 @@ dbus_viewer_LDADD= $(DBUS_GLIB_TOOL_LIBS) $(top_builddir)/glib/libdbus-gtool.la
man_MANS = dbus-send.1 dbus-monitor.1 dbus-launch.1 dbus-cleanup-sockets.1
EXTRA_DIST = $(man_MANS) run-with-tmp-session-bus.sh
-
-
+CLEANFILES = \
+ run-with-tmp-session-bus.conf \
+ dbus-bus-introspect.xml \
+ dbus-glib-bindings.h