drop upstreamed patch

f38
Matthias Clasen 17 years ago
parent 3b703fbd6f
commit ae7c7539e4

@ -1,104 +0,0 @@
--- desktop-file-utils-0.8/configure.in.embedded 2004-09-02 21:05:32.076847032 +0100
+++ desktop-file-utils-0.8/configure.in 2004-09-02 21:05:43.296141440 +0100
@@ -108,13 +108,11 @@
AC_SUBST(DESKTOP_FILE_UTILS_CFLAGS)
AC_SUBST(DESKTOP_FILE_UTILS_LIBS)
-GNOME_VFS_REQUIRED=2.2.0
-
-PKG_CHECK_MODULES(VFS, gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED gnome-vfs-module-2.0 >= $GNOME_VFS_REQUIRED, have_gnome_vfs=yes, have_gnome_vfs=no)
+VFS_CFLAGS=`PKG_CONFIG_PATH=./; export PKG_CONFIG_PATH; pkgconfig --cflags gnome-vfs2`
+VFS_LIBS=`PKG_CONFIG_PATH=./; export PKG_CONFIG_PATH; pkgconfig --libs gnome-vfs2`
AC_SUBST(VFS_CFLAGS)
AC_SUBST(VFS_LIBS)
-
-AM_CONDITIONAL(HAVE_GNOME_VFS, test x$have_gnome_vfs = xyes)
+AM_CONDITIONAL(HAVE_GNOME_VFS, test xyes = xyes)
AM_PATH_LISPDIR
--- desktop-file-utils-0.8/src/Makefile.am.embedded 2004-09-02 21:09:51.781365944 +0100
+++ desktop-file-utils-0.8/src/Makefile.am 2004-09-02 21:10:57.966304304 +0100
@@ -1,5 +1,6 @@
INCLUDES=$(DESKTOP_FILE_UTILS_CFLAGS) -DDATADIR="\"$(datadir)\"" $(VFS_CFLAGS) \
+ -I../../ \
-DSYSCONFDIR="\"$(sysconfdir)\"" \
-DPREFIX="\"$(prefix)\"" \
-D_FILE_OFFSET_BITS=64 \
@@ -8,21 +9,6 @@
-D_REENTRANT \
-D_POSIX_PTHREAD_SEMANTICS
-## note that TESTS has special meaning (stuff to use in make check)
-## so if adding tests not to be run in make check, don't add them to
-## TESTS
-if DFU_BUILD_TESTS
-TESTS_ENVIRONMENT=
-TESTS=dfu-test
-else
-TESTS=
-endif
-
-## we use noinst_PROGRAMS not check_PROGRAMS so that we build
-## even when not doing "make check"
-noinst_PROGRAMS=$(TESTS)
-
-bin_PROGRAMS=desktop-file-validate desktop-file-install desktop-menu-tool update-desktop-database
noinst_LTLIBRARIES = libmenu_sources.la
menu_sources= \
@@ -49,53 +35,7 @@
libmenu_sources_la_SOURCES= \
$(menu_sources)
-desktop_file_validate_SOURCES= \
- desktop_file.c \
- desktop_file.h \
- validate.c \
- validate.h \
- validator.c
-
-desktop_file_install_SOURCES= \
- desktop_file.c \
- desktop_file.h \
- validate.c \
- validate.h \
- install.c
-
-desktop_menu_tool_SOURCES= \
- desktop_file.c \
- desktop_file.h \
- gen-compat-tree.c \
- validate.c \
- validate.h \
- vfolder-parser.c \
- vfolder-parser.h \
- vfolder-query.c \
- vfolder-query.h
-
-dfu_test_SOURCES= \
- dfu-test.h \
- dfu-test.c
-
-update_desktop_database_SOURCES= \
- update-desktop-database.c \
- eggdesktopentries.c \
- eggdesktopentries.h \
- eggintl.h \
- eggdirfuncs.c \
- eggdirfuncs.h
-
-desktop_file_validate_LDADD=$(DESKTOP_FILE_UTILS_LIBS)
-desktop_file_install_LDADD= $(DESKTOP_FILE_UTILS_LIBS)
-desktop_menu_tool_LDADD=$(DESKTOP_FILE_UTILS_LIBS) libmenu_sources.la
-dfu_test_LDADD=$(DESKTOP_FILE_UTILS_LIBS) libmenu_sources.la
-update_desktop_database_LDADD = $(DESKTOP_FILE_UTILS_LIBS)
-
-
EXTRA_DIST = \
- $(dfu_test_SOURCES) \
- $(update_desktop_database_SOURCES) \
menu-modules.conf
if HAVE_GNOME_VFS

@ -1,11 +0,0 @@
--- desktop-file-utils-0.8/src/menu-tree-cache.c.pleasecreate 2004-08-29 14:38:56.000000000 +0100
+++ desktop-file-utils-0.8/src/menu-tree-cache.c 2004-09-02 21:14:18.728783768 +0100
@@ -760,7 +760,7 @@
menu_verbose ("Getting changes for \"%s\"\n",
menu_file);
- entry = cache_lookup (cache, menu_file, FALSE, NULL);
+ entry = cache_lookup (cache, menu_file, TRUE, NULL);
if (entry == NULL)
return NULL;

@ -1,14 +0,0 @@
--- gnome-vfs-1.9.16/modules/vfolder-desktop-method.c.moved-menu-files Tue Jun 11 17:39:20 2002
+++ gnome-vfs-1.9.16/modules/vfolder-desktop-method.c Tue Jun 11 17:43:17 2002
@@ -1433,9 +1433,8 @@
info->scheme = g_strdup (scheme);
- info->filename = g_strconcat (SYSCONFDIR,
- "/gnome-vfs-2.0/vfolders/",
- scheme, ".vfolder-info",
+ info->filename = g_strconcat (SYSCONFDIR, "/X11/desktop-menus/",
+ scheme, ".menu",
NULL);
info->user_filename = g_strconcat (g_get_home_dir (),
"/" DOT_GNOME "/vfolders/",

@ -1,13 +0,0 @@
--- gnome-vfs-2.0.1/modules/vfolder-desktop-method.c.only-show-in Tue Jul 16 20:11:46 2002
+++ gnome-vfs-2.0.1/modules/vfolder-desktop-method.c Tue Jul 16 20:12:21 2002
@@ -2466,8 +2466,8 @@
*result = g_strdup (p);
- if (*result1 == NULL ||
- (result2 != NULL && *result2 == NULL))
+ if (*result1 != NULL &&
+ (result2 == NULL || *result2 != NULL))
break;
}

@ -1,15 +0,0 @@
--- gnome-vfs-2.0.2/modules/vfolder-desktop-method.c.newstat 2002-08-19 12:45:42.000000000 -0400
+++ gnome-vfs-2.0.2/modules/vfolder-desktop-method.c 2002-08-19 14:49:27.000000000 -0400
@@ -3353,6 +3353,12 @@
invalidate_folder_T (info->root);
info->entries_valid = TRUE;
+
+ /* Update modification time of all folders,
+ * kind of evil, but it will make adding new items work
+ * I hope. This is because rereading usually means
+ * something changed */
+ info->modification_time = time (NULL);
}
return info;
}

@ -1,52 +0,0 @@
--- gnome-vfs-2.0.2/modules/vfolder-desktop-method.c.read-only 2002-08-23 11:45:03.000000000 -0400
+++ gnome-vfs-2.0.2/modules/vfolder-desktop-method.c 2002-08-23 12:09:27.000000000 -0400
@@ -1162,7 +1162,8 @@
folder->entry.type = ENTRY_FOLDER;
folder->entry.name = g_strdup (name);
folder->entry.refcount = 1;
-
+ folder->read_only = TRUE;
+
return folder;
}
@@ -6084,28 +6085,28 @@
static GnomeVFSMethod method = {
sizeof (GnomeVFSMethod),
do_open,
- do_create,
+ NULL, /* do_create, */
do_close,
do_read,
- do_write,
+ NULL, /* do_write, */
do_seek,
do_tell,
- do_truncate_handle,
+ NULL, /* do_truncate_handle, */
do_open_directory,
do_close_directory,
do_read_directory,
do_get_file_info,
do_get_file_info_from_handle,
do_is_local,
- do_make_directory,
- do_remove_directory,
- do_move,
- do_unlink,
+ NULL, /* do_make_directory, */
+ NULL, /* do_remove_directory, */
+ NULL, /* do_move, */
+ NULL, /* do_unlink, */
do_check_same_fs,
- do_set_file_info,
- do_truncate,
- NULL /* find_directory */,
- NULL /* create_symbolic_link */,
+ NULL, /* do_set_file_info, */
+ NULL, /* do_truncate, */
+ NULL /* find_directory */,
+ NULL /* create_symbolic_link */,
do_monitor_add,
do_monitor_cancel
};

@ -1,33 +0,0 @@
--- gnome-vfs-2.1.6/modules/vfolder-desktop-method.c.hide-with-empty-subfolders 2003-01-13 16:08:37.000000000 -0500
+++ gnome-vfs-2.1.6/modules/vfolder-desktop-method.c 2003-01-13 16:09:21.000000000 -0500
@@ -937,8 +937,19 @@
/* Include subfolders */
/* we always whack them onto the beginning */
if (folder->subfolders != NULL) {
- GSList *subfolders = g_slist_copy (folder->subfolders);
- g_slist_foreach (subfolders, (GFunc)entry_ref_alloc, NULL);
+ GSList *li;
+ GSList *subfolders;
+ subfolders = NULL;
+ li = folder->subfolders;
+ for (li = folder->subfolders; li != NULL; li = li->next) {
+ Folder *f = li->data;
+ /* always dont_show_if_empty */
+ if (f->entries != NULL) {
+ entry_ref_alloc (&f->entry);
+ subfolders = g_slist_prepend (subfolders, f);
+ }
+ }
+ subfolders = g_slist_reverse (subfolders);
folder->entries = g_slist_concat (subfolders, folder->entries);
}
@@ -1079,7 +1090,7 @@
GHashTable *entry_hash;
ensure_folder (info, folder,
- FALSE /* subfolders */,
+ TRUE /* subfolders */,
NULL /* except */,
FALSE /* ignore_unallocated */);
if (folder->sorted)

@ -1,10 +0,0 @@
--- gnome-vfs-2.1.6/modules/vfolder-desktop-method.c.never-show-if-empty 2003-01-11 18:12:50.000000000 -0500
+++ gnome-vfs-2.1.6/modules/vfolder-desktop-method.c 2003-01-11 18:12:55.000000000 -0500
@@ -1163,6 +1163,7 @@
folder->entry.name = g_strdup (name);
folder->entry.refcount = 1;
folder->read_only = TRUE;
+ folder->dont_show_if_empty = TRUE;
return folder;
}

@ -1,32 +0,0 @@
--- gnome-vfs-2.1.6/modules/desktop-method.c.no-private-methods 2003-01-11 19:16:29.000000000 -0500
+++ gnome-vfs-2.1.6/modules/desktop-method.c 2003-01-11 19:37:23.000000000 -0500
@@ -627,12 +627,12 @@
gnome_vfs_uri_ref (uri);
file_uri = desktop_uri_to_file_uri (uri);
- result = gnome_vfs_monitor_do_add (parent_method,
- &monitor_handle->handle,
- file_uri,
- monitor_type,
- monitor_notify_cb,
- monitor_handle);
+ result = _gnome_vfs_monitor_do_add (parent_method,
+ &monitor_handle->handle,
+ file_uri,
+ monitor_type,
+ monitor_notify_cb,
+ monitor_handle);
gnome_vfs_uri_unref (file_uri);
if (result != GNOME_VFS_OK) {
@@ -654,8 +654,8 @@
monitor_handle = (DesktopMonitorHandle *) method_handle;
- result = gnome_vfs_monitor_do_cancel (monitor_handle->handle);
-
+ result = _gnome_vfs_monitor_do_cancel (monitor_handle->handle);
+
gnome_vfs_uri_unref (monitor_handle->desktop_uri);
g_free (monitor_handle);

@ -1,30 +0,0 @@
--- gnome-vfs-2.1.6/modules/Makefile.am.old-modules 2003-01-11 16:28:30.000000000 -0500
+++ gnome-vfs-2.1.6/modules/Makefile.am 2003-01-11 16:30:00.000000000 -0500
@@ -60,6 +60,8 @@
$(CDEMENU_LTLIBS) \
libssh.la \
libtar.la \
+ libdesktop.la \
+ libvfolder-desktop-old.la \
$(NULL)
# Not currently supported
@@ -142,6 +144,18 @@
libftp_la_LDFLAGS = $(module_flags)
libftp_la_LIBADD = ../libgnomevfs/libgnomevfs-2.la
+### `desktop' method
+
+libdesktop_la_SOURCES = desktop-method.c
+libdesktop_la_LDFLAGS = $(module_flags)
+libdesktop_la_LIBADD = ../libgnomevfs/libgnomevfs-2.la
+
+### `vfolder-desktop' method
+
+libvfolder_desktop_old_la_SOURCES = vfolder-desktop-method.c
+libvfolder_desktop_old_la_LDFLAGS = $(module_flags)
+libvfolder_desktop_old_la_LIBADD = ../libgnomevfs/libgnomevfs-2.la
+
### `nfs' method
#libnfs_la_SOURCES = \

@ -1,21 +0,0 @@
diff -ur gnome-vfs-2.12.0/libgnomevfs/gnome-vfs-hal-mounts.c gnome-vfs/libgnomevfs/gnome-vfs-hal-mounts.c
--- gnome-vfs-2.12.0/libgnomevfs/gnome-vfs-hal-mounts.c 2005-09-05 04:19:11.000000000 -0400
+++ gnome-vfs/libgnomevfs/gnome-vfs-hal-mounts.c 2005-09-08 14:48:28.000000000 -0400
@@ -1508,7 +1508,7 @@
GnomeVFSDrive *result;
LibHalContext *hal_ctx;
LibHalDrive *hal_drive;
- char path[PATH_MAX] = "/dev/";
+ char path[PATH_MAX + 5] = "/dev/";
char *target = path + 5;
int ret;
@@ -1562,7 +1562,7 @@
GnomeVFSVolume *result;
LibHalContext *hal_ctx;
LibHalDrive *hal_drive;
- char path[PATH_MAX] = "/dev/";
+ char path[PATH_MAX + 5] = "/dev/";
char *target = path + 5;
int ret;

@ -1,11 +0,0 @@
--- gnome-vfs-2.12.0/modules/smb-method.c.use_correct_close 2005-09-28 14:29:32.000000000 -0400
+++ gnome-vfs-2.12.0/modules/smb-method.c 2005-09-28 14:30:11.000000000 -0400
@@ -1486,7 +1486,7 @@
/* Important: perform_authentication leaves and re-enters the lock! */
while (perform_authentication (&actx) > 0) {
- r = smb_context->close (smb_context, handle->file);
+ r = smb_context->close_fn (smb_context, handle->file);
actx.res = (r >= 0) ? GNOME_VFS_OK : gnome_vfs_result_from_errno ();
}

@ -1,22 +0,0 @@
--- gnome-vfs-2.12.1.1/libgnomevfs/xdgmimecache.c.mimecache 2005-04-17 06:37:34.000000000 -0400
+++ gnome-vfs-2.12.1.1/libgnomevfs/xdgmimecache.c 2005-10-19 08:19:13.000000000 -0400
@@ -175,8 +175,8 @@
{
for (j = 0; j < data_length; j++)
{
- if ((cache->buffer[data_offset + j] & cache->buffer[mask_offset + j]) !=
- ((((unsigned char *) data)[j + i]) & cache->buffer[mask_offset + j]))
+ if ((((unsigned char *)cache->buffer)[data_offset + j] & ((unsigned char *)cache->buffer)[mask_offset + j]) !=
+ ((((unsigned char *) data)[j + i]) & ((unsigned char *)cache->buffer)[mask_offset + j]))
{
valid_matchlet = FALSE;
break;
@@ -187,7 +187,7 @@
{
for (j = 0; j < data_length; j++)
{
- if (cache->buffer[data_offset + j] != ((unsigned char *) data)[j + i])
+ if (((unsigned char *)cache->buffer)[data_offset + j] != ((unsigned char *) data)[j + i])
{
valid_matchlet = FALSE;
break;

@ -1,53 +0,0 @@
--- gnome-vfs-2.13.3/libgnomevfs/gnome-vfs-volume-ops.c.gnome-mount 2006-01-09 15:05:47.000000000 -0500
+++ gnome-vfs-2.13.3/libgnomevfs/gnome-vfs-volume-ops.c 2006-01-09 15:16:10.000000000 -0500
@@ -659,8 +659,9 @@
#if defined(USE_HAL) && defined(HAL_EJECT)
if (info->hal_udi != NULL) {
argv[0] = HAL_EJECT;
- argv[1] = info->device_path;
- argv[2] = NULL;
+ argv[1] = "--hal-udi";
+ argv[2] = info->hal_udi;
+ argv[3] = NULL;
if (!g_file_test (argv [0], G_FILE_TEST_IS_EXECUTABLE))
argv[0] = NULL;
@@ -759,7 +760,11 @@
# ifdef USE_HAL
if (hal_udi != NULL) {
+# ifdef HAL_MOUNT
+ name = hal_udi;
+# else
name = device_path;
+# endif
} else
name = mount_point;
# else
@@ -770,9 +775,11 @@
if (should_mount) {
#if defined(USE_HAL) && defined(HAL_MOUNT)
- if (hal_udi != NULL && g_file_test (HAL_MOUNT, G_FILE_TEST_IS_EXECUTABLE))
+ if (hal_udi != NULL && g_file_test (HAL_MOUNT, G_FILE_TEST_IS_EXECUTABLE)) {
command = HAL_MOUNT;
- else
+ argument = "--hal-udi";
+
+ } else
command = find_command (MOUNT_COMMAND);
#else
command = find_command (MOUNT_COMMAND);
@@ -785,9 +792,10 @@
if (should_unmount) {
gboolean is_in_media = g_str_has_prefix (mount_point, "/media");
#if defined(USE_HAL) && defined(HAL_UMOUNT)
- if (hal_udi != NULL && g_file_test (HAL_UMOUNT, G_FILE_TEST_IS_EXECUTABLE))
+ if (hal_udi != NULL && g_file_test (HAL_UMOUNT, G_FILE_TEST_IS_EXECUTABLE)) {
command = HAL_UMOUNT;
- else
+ argument = "--hal-udi";
+ } else
command = find_command (is_in_media ? PUMOUNT_COMMAND : UMOUNT_COMMAND);
#else
command = find_command (is_in_media ? PUMOUNT_COMMAND : UMOUNT_COMMAND);

@ -1,37 +0,0 @@
Index: modules/file-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/file-method.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -p -r1.154 -r1.155
--- modules/file-method.c 27 Feb 2006 08:54:52 -0000 1.154
+++ modules/file-method.c 28 Feb 2006 10:08:18 -0000 1.155
@@ -729,7 +729,6 @@ get_access_info (GnomeVFSFileInfo *file_
* of the access calls
*/
#ifdef G_OS_WIN32
- file_info->permissions = 0;
if (g_access (full_name, R_OK) == 0) {
file_info->permissions |= GNOME_VFS_PERM_ACCESS_READABLE;
}
@@ -745,17 +744,16 @@ get_access_info (GnomeVFSFileInfo *file_
* calls needed
*/
if (g_access (full_name, R_OK|W_OK) == 0) {
- file_info->permissions = GNOME_VFS_PERM_ACCESS_READABLE | GNOME_VFS_PERM_ACCESS_WRITABLE;
+ file_info->permissions |= GNOME_VFS_PERM_ACCESS_READABLE | GNOME_VFS_PERM_ACCESS_WRITABLE;
if (g_access (full_name, X_OK) == 0) {
file_info->permissions |= GNOME_VFS_PERM_ACCESS_EXECUTABLE;
}
} else if (g_access (full_name, R_OK|X_OK) == 0) {
- file_info->permissions = GNOME_VFS_PERM_ACCESS_READABLE | GNOME_VFS_PERM_ACCESS_EXECUTABLE;
+ file_info->permissions |= GNOME_VFS_PERM_ACCESS_READABLE | GNOME_VFS_PERM_ACCESS_EXECUTABLE;
} else {
if (g_access (full_name, R_OK) == 0) {
- file_info->permissions = GNOME_VFS_PERM_ACCESS_READABLE;
+ file_info->permissions |= GNOME_VFS_PERM_ACCESS_READABLE;
} else {
- file_info->permissions = 0;
if (g_access (full_name, W_OK) == 0) {
file_info->permissions |= GNOME_VFS_PERM_ACCESS_WRITABLE;
}

@ -1,217 +0,0 @@
Index: modules/smb-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/smb-method.c,v
retrieving revision 1.35
diff -u -p -r1.35 smb-method.c
--- modules/smb-method.c 20 Oct 2005 16:03:59 -0000 1.35
+++ modules/smb-method.c 28 Feb 2006 12:27:10 -0000
@@ -102,6 +102,9 @@ static guint cache_reap_timeout = 0;
/* The magic "default workgroup" hostname */
#define DEFAULT_WORKGROUP_NAME "X-GNOME-DEFAULT-WORKGROUP"
+/* Guest logins use: */
+#define GUEST_LOGIN "guest"
+
/* 5 minutes before we re-read the workgroup cache again */
#define WORKGROUP_CACHE_TIMEOUT (5*60)
@@ -111,7 +114,8 @@ static time_t workgroups_timestamp = 0;
/* Authentication ----------------------------------------------------------- */
#define SMB_AUTH_STATE_PREFILLED 0x00000010 /* Have asked gnome-auth for prefilled auth */
-#define SMB_AUTH_STATE_PROMPTED 0x00000020 /* Have asked gnome-auth for to prompt user */
+#define SMB_AUTH_STATE_GUEST 0x00000020 /* Have tried 'guest' authentication */
+#define SMB_AUTH_STATE_PROMPTED 0x00000040 /* Have asked gnome-auth for to prompt user */
typedef struct _SmbAuthContext {
@@ -128,6 +132,7 @@ typedef struct _SmbAuthContext {
/* Used in chat between perform_authentication and auth_callback */
gboolean auth_called; /* Set by auth_callback */
+ gboolean preset_user; /* Set when we have a preset user from the URI */
gchar *for_server; /* Set by auth_callback */
gchar *for_share; /* Set by auth_callback */
gchar *use_user; /* Set by perform_authentication */
@@ -774,7 +779,6 @@ initial_authentication (SmbAuthContext *
SmbServerCacheEntry server_lookup;
SmbServerCacheEntry *server;
gboolean found_user = FALSE;
- gboolean preset_user = FALSE;
char *tmp;
DEBUG_SMB(("[auth] Initial authentication lookups\n"));
@@ -794,31 +798,29 @@ initial_authentication (SmbAuthContext *
tmp - toplevel_uri->user_name);
g_free (actx->use_user);
actx->use_user = string_dup_nzero (tmp + 1);
-
- if (actx->use_domain != NULL)
- actx->prompt_flags &= ~GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_DOMAIN;
- if (actx->use_user != NULL)
- actx->prompt_flags &= ~GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_USERNAME;
-
DEBUG_SMB(("[auth] User from URI: %s@%s\n", actx->use_user, actx->use_domain));
} else {
g_free (actx->use_user);
actx->use_user = string_dup_nzero (toplevel_uri->user_name);
g_free (actx->use_domain);
actx->use_domain = NULL;
-
- if (actx->use_user != NULL)
- actx->prompt_flags &= ~GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_USERNAME;
DEBUG_SMB(("[auth] User from URI: %s\n", actx->use_user));
}
- preset_user = TRUE;
+
+ if (actx->use_user != NULL) {
+ actx->preset_user = TRUE;
+ actx->prompt_flags &= ~GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_USERNAME;
+ }
+ if (actx->use_domain != NULL) {
+ actx->prompt_flags &= ~GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_DOMAIN;
+ }
}
if (lookup_user_cache (actx, TRUE) ||
lookup_user_cache (actx, FALSE))
found_user = TRUE;
- if (found_user || preset_user) {
+ if (found_user || actx->preset_user) {
/* Lookup the server in our internal cache */
server_lookup.server_name = (char*)actx->for_server;
server_lookup.share_name = (char*)actx->for_share;
@@ -828,9 +830,9 @@ initial_authentication (SmbAuthContext *
server = g_hash_table_lookup (server_cache, &server_lookup);
if (server == NULL) {
- /* If a blank user, try 'guest' */
+ /* If a blank user, try looking up 'guest' */
if (!actx->use_user) {
- server_lookup.username = "guest";
+ server_lookup.username = GUEST_LOGIN;
server_lookup.domain = NULL;
server = g_hash_table_lookup (server_cache, &server_lookup);
}
@@ -854,6 +856,7 @@ prefill_authentication (SmbAuthContext *
GnomeVFSModuleCallbackFillAuthenticationIn in_args;
GnomeVFSModuleCallbackFillAuthenticationOut out_args;
gboolean invoked;
+ gboolean filled = FALSE;
g_return_val_if_fail (actx != NULL, FALSE);
g_return_val_if_fail (actx->for_server != NULL, FALSE);
@@ -901,24 +904,30 @@ prefill_authentication (SmbAuthContext *
invoked = gnome_vfs_module_callback_invoke
(GNOME_VFS_MODULE_CALLBACK_FILL_AUTHENTICATION,
&in_args, sizeof (in_args),
- &out_args, sizeof (out_args));
+ &out_args, sizeof (out_args));
}
if (invoked && out_args.valid) {
- g_free (actx->use_user);
- actx->use_user = string_dup_nzero (out_args.username);
- g_free (actx->use_domain);
- actx->use_domain = string_dup_nzero (out_args.domain);
- g_free (actx->use_password);
- actx->use_password = g_strdup (out_args.password);
- DEBUG_SMB(("[auth] Prefilled credentials: %s@%s:%s\n", actx->use_user, actx->use_domain, actx->use_password));
+ /* When a preset user make sure we stick to this login */
+ if (!actx->preset_user || string_compare (actx->use_user, out_args.username)) {
+
+ g_free (actx->use_user);
+ actx->use_user = string_dup_nzero (out_args.username);
+ g_free (actx->use_domain);
+ actx->use_domain = string_dup_nzero (out_args.domain);
+ g_free (actx->use_password);
+ actx->use_password = g_strdup (out_args.password);
+
+ filled = TRUE;
+ DEBUG_SMB(("[auth] Prefilled credentials: %s@%s:%s\n", actx->use_user, actx->use_domain, actx->use_password));
+ }
}
g_free (out_args.username);
g_free (out_args.domain);
g_free (out_args.password);
- return invoked && out_args.valid;
+ return filled;
}
static gboolean
@@ -949,7 +958,12 @@ prompt_authentication (SmbAuthContext *a
in_args.domain = (char*)actx->use_domain;
in_args.port = actx->uri ? ((GnomeVFSToplevelURI*)actx->uri)->host_port : 0;
- in_args.default_user = actx->use_user ? actx->use_user : (char*)g_get_user_name ();
+ in_args.default_user = actx->use_user;
+ if (string_compare (in_args.default_user, GUEST_LOGIN))
+ in_args.default_user = NULL;
+ if (!in_args.default_user)
+ in_args.default_user = (char*)g_get_user_name ();
+
in_args.default_domain = actx->use_domain ? actx->use_domain : smb_context->workgroup;
memset (&out_args, 0, sizeof (out_args));
@@ -1198,12 +1212,26 @@ perform_authentication (SmbAuthContext *
cont = FALSE;
UNLOCK_SMB();
-
+
+ /* Do we have gnome-keyring credentials for this? */
if (!(actx->state & SMB_AUTH_STATE_PREFILLED)) {
actx->state |= SMB_AUTH_STATE_PREFILLED;
cont = prefill_authentication (actx);
}
-
+
+ /* Then we try a guest credentials... */
+ if (!cont && !actx->preset_user && !(actx->state & SMB_AUTH_STATE_GUEST)) {
+ g_free (actx->use_user);
+ actx->use_user = strdup(GUEST_LOGIN);
+ g_free (actx->use_domain);
+ actx->use_domain = NULL;
+ g_free (actx->use_password);
+ actx->use_password = strdup("");
+ actx->state |= SMB_AUTH_STATE_GUEST;
+ cont = TRUE;
+ }
+
+ /* And as a last step, prompt */
if (!cont)
cont = prompt_authentication (actx, &auth_cancelled);
@@ -1279,19 +1307,19 @@ auth_callback (const char *server_name,
strncpy (password_out, actx->use_password ? actx->use_password : "", pwmaxlen);
if (actx->use_domain)
strncpy (domain_out, actx->use_domain, domainmaxlen);
- DEBUG_SMB(("[auth] Using credentials: %s:%s@%s\n", username_out, password_out, domain_out));
-
- /* On first login try a guest login */
- } else if (actx->passes == 1) {
- strncpy (username_out, "guest", unmaxlen);
- strncpy (password_out, "", pwmaxlen);
- DEBUG_SMB(("[auth] No credentials, trying 'guest' user login\n"));
-
- /* We have no credentials ... */
+ DEBUG_SMB(("[auth] Using credentials: %s:%s@%s\n", username_out, password_out, domain_out));
+
+ /* We have no credentials ... */
} else {
+ g_assert (!actx->preset_user);
+
+ if (actx->passes == 1)
+ DEBUG_SMB(("[auth] No credentials, trying anonymous user login\n"));
+ else
+ DEBUG_SMB(("[auth] No credentials, returning null values\n"));
+
strncpy (username_out, "", unmaxlen);
strncpy (password_out, "", pwmaxlen);
- DEBUG_SMB(("[auth] No credentials, returning null values\n"));
}
/* Put in the default workgroup if none specified */

@ -1,74 +0,0 @@
--- gnome-vfs-2.15.1/modules/inotify-helper.c.use-sys-inotify 2006-05-17 13:27:10.000000000 -0400
+++ gnome-vfs-2.15.1/modules/inotify-helper.c 2006-05-17 13:27:51.000000000 -0400
@@ -28,19 +28,11 @@
#include <time.h>
#include <string.h>
#include <sys/ioctl.h>
-/* Just include the local header to stop all the pain */
-#include "local_inotify.h"
-#if 0
#ifdef HAVE_SYS_INOTIFY_H
-/* We don't actually include the libc header, because there has been
- * problems with libc versions that was built without inotify support.
- * Instead we use the local version.
- */
-#include "local_inotify.h"
+#include <sys/inotify.h>
#elif defined (HAVE_LINUX_INOTIFY_H)
#include <linux/inotify.h>
#endif
-#endif
#include <libgnomevfs/gnome-vfs-module-shared.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include "inotify-helper.h"
--- gnome-vfs-2.15.1/modules/inotify-kernel.c.use-sys-inotify 2006-05-17 13:27:10.000000000 -0400
+++ gnome-vfs-2.15.1/modules/inotify-kernel.c 2006-05-17 13:28:33.000000000 -0400
@@ -24,22 +24,12 @@
#include <glib.h>
#include "inotify-kernel.h"
-/* Just include the local headers to stop all the pain */
-#include "local_inotify.h"
-#include "local_inotify_syscalls.h"
-#if 0
#ifdef HAVE_SYS_INOTIFY_H
-/* We don't actually include the libc header, because there has been
- * problems with libc versions that was built without inotify support.
- * Instead we use the local version.
- */
-#include "local_inotify.h"
-#include "local_inotify_syscalls.h"
+#include <sys/inotify.h>
#elif defined (HAVE_LINUX_INOTIFY_H)
#include <linux/inotify.h>
#include "local_inotify_syscalls.h"
#endif
-#endif
/* Timings for pairing MOVED_TO / MOVED_FROM events */
#define PROCESS_EVENTS_TIME 125 /* milliseconds */
--- gnome-vfs-2.15.1/modules/inotify-path.c.use-sys-inotify 2006-05-17 13:27:10.000000000 -0400
+++ gnome-vfs-2.15.1/modules/inotify-path.c 2006-05-17 13:50:50.000000000 -0400
@@ -28,18 +28,14 @@
/* Don't put conflicting kernel types in the global namespace: */
#define __KERNEL_STRICT_NAMES
-#include "local_inotify.h"
-#if 0
#ifdef HAVE_SYS_INOTIFY_H
-/* We don't actually include the libc header, because there has been
- * problems with libc versions that was built without inotify support.
- * Instead we use the local version.
- */
-#include "local_inotify.h"
+#include <sys/inotify.h>
+#ifndef IN_ONLYDIR
+#define IN_ONLYDIR 0x01000000
+#endif
#elif defined (HAVE_LINUX_INOTIFY_H)
#include <linux/inotify.h>
#endif
-#endif
#include <string.h>
#include <glib.h>
#include <libgnomevfs/gnome-vfs-module-shared.h>

@ -1,87 +0,0 @@
--- gnome-vfs-2.15.3/daemon/vfs-daemon.c.dbus-deprecated 2006-07-18 19:43:49.000000000 -0400
+++ gnome-vfs-2.15.3/daemon/vfs-daemon.c 2006-07-18 19:45:55.000000000 -0400
@@ -108,7 +108,7 @@
g_warning ("Failed to acquire vfs-daemon service: %s", error.message);
dbus_error_free (&error);
- dbus_connection_disconnect (conn);
+ dbus_connection_close (conn);
/* Remove this, it asserts:
dbus_connection_unref (conn); */
conn = NULL;
@@ -119,7 +119,7 @@
if (ret == DBUS_REQUEST_NAME_REPLY_EXISTS) {
g_printerr ("VFS daemon already running, exiting.\n");
- dbus_connection_disconnect (conn);
+ dbus_connection_close (conn);
/* Remove this, it asserts:
dbus_connection_unref (conn); */
conn = NULL;
@@ -130,7 +130,7 @@
if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
g_printerr ("Not primary owner of the service, exiting.\n");
- dbus_connection_disconnect (conn);
+ dbus_connection_close (conn);
/* Remove this, it asserts:
dbus_connection_unref (conn); */
conn = NULL;
@@ -149,7 +149,7 @@
NULL)) {
g_printerr ("Failed to register object with D-BUS.\n");
- dbus_connection_disconnect (conn);
+ dbus_connection_close (conn);
dbus_connection_unref (conn);
conn = NULL;
@@ -177,7 +177,7 @@
return;
}
- dbus_connection_disconnect (conn);
+ dbus_connection_close (conn);
dbus_connection_unref (conn);
}
--- gnome-vfs-2.15.3/daemon/daemon-connection.c.dbus-deprecated 2006-07-18 19:46:14.000000000 -0400
+++ gnome-vfs-2.15.3/daemon/daemon-connection.c 2006-07-18 19:46:29.000000000 -0400
@@ -218,7 +218,7 @@
d(g_print ("Connection destroy\n"));
if (dbus_connection_get_is_connected (conn->conn)) {
- dbus_connection_disconnect (conn->conn);
+ dbus_connection_close (conn->conn);
}
dbus_connection_unref (conn->conn);
--- gnome-vfs-2.15.3/libgnomevfs/gnome-vfs-daemon-method.c.dbus-deprecated 2006-07-18 19:46:49.000000000 -0400
+++ gnome-vfs-2.15.3/libgnomevfs/gnome-vfs-daemon-method.c 2006-07-18 19:47:16.000000000 -0400
@@ -348,7 +348,7 @@
{
LocalConnection *ret = data;
- dbus_connection_disconnect (ret->connection);
+ dbus_connection_close (ret->connection);
dbus_connection_unref (ret->connection);
g_free (ret);
}
@@ -391,7 +391,7 @@
-1,
&error);
dbus_message_unref (message);
- dbus_connection_disconnect (main_conn);
+ dbus_connection_close (main_conn);
dbus_connection_unref (main_conn);
if (!reply) {
g_warning ("Error while getting peer-to-peer connection: %s",
@@ -421,7 +421,7 @@
&connection_vtable,
NULL)) {
g_warning ("Failed to register client object with the connection.");
- dbus_connection_disconnect (private_conn);
+ dbus_connection_close (private_conn);
dbus_connection_unref (private_conn);
return NULL;
}

@ -1,11 +0,0 @@
--- gnome-vfs-2.15.90/libgnomevfs/gnome-vfs-dbus-utils.c.dbus-spew 2006-08-04 16:14:21.000000000 -0400
+++ gnome-vfs-2.15.90/libgnomevfs/gnome-vfs-dbus-utils.c 2006-08-04 16:14:43.000000000 -0400
@@ -124,7 +124,7 @@
DBUS_TYPE_STRING, &new_owner,
DBUS_TYPE_INVALID);
- g_print ("NameOwnerChanged %s %s->%s\n", service, old_owner, new_owner);
+ d(g_print ("NameOwnerChanged %s %s->%s\n", service, old_owner, new_owner));
if (strcmp (service, DVD_DAEMON_SERVICE) == 0) {
if (strcmp (old_owner, "") != 0 &&

@ -1,58 +0,0 @@
--- gnome-vfs-2.15.91/modules/http-neon-method.c.redirect 2006-08-30 14:30:23.000000000 -0400
+++ gnome-vfs-2.15.91/modules/http-neon-method.c 2006-08-30 14:30:40.000000000 -0400
@@ -1846,8 +1846,11 @@
result = http_follow_redirect (context);
- if (result == GNOME_VFS_OK)
+ if (result == GNOME_VFS_OK) {
goto propfind_start;
+ } else {
+ return result;
+ }
}
req = ne_propfind_get_request (pfh);
@@ -1896,12 +1899,15 @@
res = ne_request_dispatch (req);
if (res == NE_REDIRECT) {
- result = http_follow_redirect (context);
-
+ ne_request_destroy (req);
+ req = NULL;
+
+ result = http_follow_redirect (context);
+
if (result == GNOME_VFS_OK) {
- ne_request_destroy (req);
- req = NULL;
goto head_start;
+ } else {
+ return result;
}
}
@@ -2006,7 +2012,12 @@
if (res == NE_REDIRECT) {
ne_request_destroy (req);
result = http_follow_redirect (hctx);
- goto options_start;
+
+ if (result == GNOME_VFS_OK) {
+ goto options_start;
+ } else {
+ return result;
+ }
}
result = resolve_result (res, req);
@@ -2289,7 +2300,7 @@
if (res == NE_REDIRECT) {
result = http_follow_redirect (hctx);
-
+
if (result == GNOME_VFS_OK)
goto get_start;
}

@ -1,421 +0,0 @@
Index: libgnomevfs/xdgmime.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/xdgmime.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- libgnomevfs/xdgmime.c 1 Dec 2005 19:32:02 -0000 1.13
+++ libgnomevfs/xdgmime.c 13 Sep 2006 09:23:36 -0000 1.14
@@ -60,7 +60,7 @@ static XdgCallbackList *callback_list =
XdgMimeCache **_caches = NULL;
static int n_caches = 0;
-const char *xdg_mime_type_unknown = "application/octet-stream";
+const char xdg_mime_type_unknown[] = "application/octet-stream";
enum
@@ -281,7 +281,8 @@ xdg_run_command_on_dirs (XdgDirectoryFun
* FIXME: This doesn't protect against permission changes.
*/
static int
-xdg_check_file (const char *file_path)
+xdg_check_file (const char *file_path,
+ int *exists)
{
struct stat st;
@@ -290,6 +291,9 @@ xdg_check_file (const char *file_path)
{
XdgDirTimeList *list;
+ if (exists)
+ *exists = TRUE;
+
for (list = dir_time_list; list; list = list->next)
{
if (! strcmp (list->directory_name, file_path) &&
@@ -306,6 +310,9 @@ xdg_check_file (const char *file_path)
return TRUE;
}
+ if (exists)
+ *exists = FALSE;
+
return FALSE;
}
@@ -313,26 +320,30 @@ static int
xdg_check_dir (const char *directory,
int *invalid_dir_list)
{
- int invalid;
+ int invalid, exists;
char *file_name;
assert (directory != NULL);
- /* Check the globs file */
- file_name = malloc (strlen (directory) + strlen ("/mime/globs") + 1);
- strcpy (file_name, directory); strcat (file_name, "/mime/globs");
- invalid = xdg_check_file (file_name);
+ /* Check the mime.cache file */
+ file_name = malloc (strlen (directory) + strlen ("/mime/mime.cache") + 1);
+ strcpy (file_name, directory); strcat (file_name, "/mime/mime.cache");
+ invalid = xdg_check_file (file_name, &exists);
free (file_name);
if (invalid)
{
*invalid_dir_list = TRUE;
return TRUE;
}
+ else if (exists)
+ {
+ return FALSE;
+ }
- /* Check the magic file */
- file_name = malloc (strlen (directory) + strlen ("/mime/magic") + 1);
- strcpy (file_name, directory); strcat (file_name, "/mime/magic");
- invalid = xdg_check_file (file_name);
+ /* Check the globs file */
+ file_name = malloc (strlen (directory) + strlen ("/mime/globs") + 1);
+ strcpy (file_name, directory); strcat (file_name, "/mime/globs");
+ invalid = xdg_check_file (file_name, NULL);
free (file_name);
if (invalid)
{
@@ -340,10 +351,10 @@ xdg_check_dir (const char *directory,
return TRUE;
}
- /* Check the mime.cache file */
- file_name = malloc (strlen (directory) + strlen ("/mime/mime.cache") + 1);
- strcpy (file_name, directory); strcat (file_name, "/mime/mime.cache");
- invalid = xdg_check_file (file_name);
+ /* Check the magic file */
+ file_name = malloc (strlen (directory) + strlen ("/mime/magic") + 1);
+ strcpy (file_name, directory); strcat (file_name, "/mime/magic");
+ invalid = xdg_check_file (file_name, NULL);
free (file_name);
if (invalid)
{
@@ -584,6 +595,17 @@ xdg_mime_shutdown (void)
parent_list = NULL;
}
+ if (_caches)
+ {
+ int i;
+
+ for (i = 0; i < n_caches; i++)
+ _xdg_mime_cache_unref (_caches[i]);
+ free (_caches);
+ _caches = NULL;
+ n_caches = 0;
+ }
+
for (list = callback_list; list; list = list->next)
(list->callback) (list->data);
@@ -602,12 +624,10 @@ xdg_mime_get_max_buffer_extents (void)
}
const char *
-xdg_mime_unalias_mime_type (const char *mime_type)
+_xdg_mime_unalias_mime_type (const char *mime_type)
{
const char *lookup;
- xdg_mime_init ();
-
if (_caches)
return _xdg_mime_cache_unalias_mime_type (mime_type);
@@ -617,16 +637,22 @@ xdg_mime_unalias_mime_type (const char *
return mime_type;
}
+const char *
+xdg_mime_unalias_mime_type (const char *mime_type)
+{
+ xdg_mime_init ();
+
+ return _xdg_mime_unalias_mime_type (mime_type);
+}
+
int
-xdg_mime_mime_type_equal (const char *mime_a,
- const char *mime_b)
+_xdg_mime_mime_type_equal (const char *mime_a,
+ const char *mime_b)
{
const char *unalias_a, *unalias_b;
- xdg_mime_init ();
-
- unalias_a = xdg_mime_unalias_mime_type (mime_a);
- unalias_b = xdg_mime_unalias_mime_type (mime_b);
+ unalias_a = _xdg_mime_unalias_mime_type (mime_a);
+ unalias_b = _xdg_mime_unalias_mime_type (mime_b);
if (strcmp (unalias_a, unalias_b) == 0)
return 1;
@@ -635,6 +661,15 @@ xdg_mime_mime_type_equal (const char *mi
}
int
+xdg_mime_mime_type_equal (const char *mime_a,
+ const char *mime_b)
+{
+ xdg_mime_init ();
+
+ return _xdg_mime_mime_type_equal (mime_a, mime_b);
+}
+
+int
xdg_mime_media_type_equal (const char *mime_a,
const char *mime_b)
{
@@ -650,7 +685,7 @@ xdg_mime_media_type_equal (const char *m
return 0;
}
-#if 0
+#if 1
static int
xdg_mime_is_super_type (const char *mime)
{
@@ -668,24 +703,22 @@ xdg_mime_is_super_type (const char *mime
#endif
int
-xdg_mime_mime_type_subclass (const char *mime,
- const char *base)
+_xdg_mime_mime_type_subclass (const char *mime,
+ const char *base)
{
const char *umime, *ubase;
const char **parents;
- xdg_mime_init ();
-
if (_caches)
return _xdg_mime_cache_mime_type_subclass (mime, base);
- umime = xdg_mime_unalias_mime_type (mime);
- ubase = xdg_mime_unalias_mime_type (base);
+ umime = _xdg_mime_unalias_mime_type (mime);
+ ubase = _xdg_mime_unalias_mime_type (base);
if (strcmp (umime, ubase) == 0)
return 1;
-#if 0
+#if 1
/* Handle supertypes */
if (xdg_mime_is_super_type (ubase) &&
xdg_mime_media_type_equal (umime, ubase))
@@ -703,13 +736,22 @@ xdg_mime_mime_type_subclass (const char
parents = _xdg_mime_parent_list_lookup (parent_list, umime);
for (; parents && *parents; parents++)
{
- if (xdg_mime_mime_type_subclass (*parents, ubase))
+ if (_xdg_mime_mime_type_subclass (*parents, ubase))
return 1;
}
return 0;
}
+int
+xdg_mime_mime_type_subclass (const char *mime,
+ const char *base)
+{
+ xdg_mime_init ();
+
+ return _xdg_mime_mime_type_subclass (mime, base);
+}
+
char **
xdg_mime_list_mime_parents (const char *mime)
{
@@ -741,7 +783,7 @@ xdg_mime_get_mime_parents (const char *m
xdg_mime_init ();
- umime = xdg_mime_unalias_mime_type (mime);
+ umime = _xdg_mime_unalias_mime_type (mime);
return _xdg_mime_parent_list_lookup (parent_list, umime);
}
Index: libgnomevfs/xdgmime.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/xdgmime.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -p -r1.10 -r1.11
--- libgnomevfs/xdgmime.h 19 Oct 2005 12:40:26 -0000 1.10
+++ libgnomevfs/xdgmime.h 13 Sep 2006 09:23:36 -0000 1.11
@@ -59,12 +59,13 @@ typedef void (*XdgMimeDestroy) (void *u
#define xdg_mime_unalias_mime_type XDG_ENTRY(unalias_mime_type)
#define xdg_mime_get_max_buffer_extents XDG_ENTRY(get_max_buffer_extents)
#define xdg_mime_shutdown XDG_ENTRY(shutdown)
+#define xdg_mime_dump XDG_ENTRY(dump)
#define xdg_mime_register_reload_callback XDG_ENTRY(register_reload_callback)
#define xdg_mime_remove_callback XDG_ENTRY(remove_callback)
#define xdg_mime_type_unknown XDG_ENTRY(type_unknown)
#endif
-extern const char *xdg_mime_type_unknown;
+extern const char xdg_mime_type_unknown[];
#define XDG_MIME_TYPE_UNKNOWN xdg_mime_type_unknown
const char *xdg_mime_get_mime_type_for_data (const void *data,
@@ -95,8 +96,17 @@ int xdg_mime_register_reload_ca
XdgMimeDestroy destroy);
void xdg_mime_remove_callback (int callback_id);
+ /* Private versions of functions that don't call xdg_mime_init () */
+int _xdg_mime_mime_type_equal (const char *mime_a,
+ const char *mime_b);
+int _xdg_mime_media_type_equal (const char *mime_a,
+ const char *mime_b);
+int _xdg_mime_mime_type_subclass (const char *mime,
+ const char *base);
+const char *_xdg_mime_unalias_mime_type (const char *mime);
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
-
#endif /* __XDG_MIME_H__ */
Index: libgnomevfs/xdgmimeglob.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/xdgmimeglob.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -p -r1.12 -r1.13
--- libgnomevfs/xdgmimeglob.c 2 Mar 2006 17:13:50 -0000 1.12
+++ libgnomevfs/xdgmimeglob.c 13 Sep 2006 09:23:36 -0000 1.13
@@ -263,7 +263,7 @@ _xdg_glob_hash_insert_text (XdgGlobHashN
{
child = _xdg_glob_hash_node_new ();
child->character = '\000';
- child->mime_type = strdup (mime_type);
+ child->mime_type = mime_type;
child->child = NULL;
child->next = node->child;
node->child = child;
@@ -272,7 +272,7 @@ _xdg_glob_hash_insert_text (XdgGlobHashN
}
else
{
- node->mime_type = strdup (mime_type);
+ node->mime_type = mime_type;
}
}
else
@@ -308,11 +308,13 @@ _xdg_glob_hash_node_lookup_file_name (Xd
if (*file_name == '\000')
{
n = 0;
- mime_types[n++] = node->mime_type;
+ if (node->mime_type)
+ mime_types[n++] = node->mime_type;
node = node->child;
while (n < n_mime_types && node && node->character == 0)
{
- mime_types[n++] = node->mime_type;
+ if (node->mime_type)
+ mime_types[n++] = node->mime_type;
node = node->next;
}
}
@@ -475,7 +477,7 @@ _xdg_glob_hash_append_glob (XdgGlobHash
glob_hash->literal_list = _xdg_glob_list_append (glob_hash->literal_list, strdup (glob), strdup (mime_type));
break;
case XDG_GLOB_SIMPLE:
- glob_hash->simple_node = _xdg_glob_hash_insert_text (glob_hash->simple_node, glob + 1, mime_type);
+ glob_hash->simple_node = _xdg_glob_hash_insert_text (glob_hash->simple_node, glob + 1, strdup (mime_type));
break;
case XDG_GLOB_FULL:
glob_hash->full_list = _xdg_glob_list_append (glob_hash->full_list, strdup (glob), strdup (mime_type));
Index: libgnomevfs/xdgmimemagic.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/xdgmimemagic.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -p -r1.16 -r1.17
--- libgnomevfs/xdgmimemagic.c 13 Jul 2006 19:02:47 -0000 1.16
+++ libgnomevfs/xdgmimemagic.c 13 Sep 2006 09:23:36 -0000 1.17
@@ -671,7 +671,7 @@ _xdg_mime_magic_lookup_data (XdgMimeMagi
if (_xdg_mime_magic_match_compare_to_data (match, data, len))
{
if (!had_match || match->priority > priority ||
- (mime_type != NULL && xdg_mime_mime_type_subclass (match->mime_type, mime_type)))
+ (mime_type != NULL && _xdg_mime_mime_type_subclass (match->mime_type, mime_type)))
{
mime_type = match->mime_type;
priority = match->priority;
@@ -688,7 +688,7 @@ _xdg_mime_magic_lookup_data (XdgMimeMagi
for (n = 0; n < n_mime_types; n++)
{
if (mime_types[n] &&
- xdg_mime_mime_type_equal (mime_types[n], match->mime_type))
+ _xdg_mime_mime_type_equal (mime_types[n], match->mime_type))
mime_types[n] = NULL;
}
}
Index: modules/http-neon-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/http-neon-method.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -p -r1.39 -r1.40
--- modules/http-neon-method.c 1 Sep 2006 19:28:27 -0000 1.39
+++ modules/http-neon-method.c 15 Sep 2006 19:31:00 -0000 1.40
@@ -400,6 +400,7 @@ G_LOCK_DEFINE (auth_cache);
static GHashTable *auth_cache_basic;
static GHashTable *auth_cache_proxy;
static guint cleanup_id;
+static guint module_refcount = 0;
typedef struct {
@@ -3331,20 +3332,24 @@ static GnomeVFSMethod http_method = {
GnomeVFSMethod *
vfs_module_init (const char *method_name, const char *args)
{
- proxy_init ();
- /* ne_debug_init (stdout, 0xfffe); */
- neon_session_pool_init ();
- http_auth_cache_init ();
- quick_allow_lookup_init ();
-
+ if (module_refcount++ == 0) {
+ proxy_init ();
+ /* ne_debug_init (stdout, 0xfffe); */
+ neon_session_pool_init ();
+ http_auth_cache_init ();
+ quick_allow_lookup_init ();
+ }
+
return &http_method;
}
void
vfs_module_shutdown (GnomeVFSMethod *method)
{
- quit_allow_lookup_destroy ();
- http_auth_cache_shutdown ();
- neon_session_pool_shutdown ();
- proxy_shutdown ();
+ if (--module_refcount == 0) {
+ quit_allow_lookup_destroy ();
+ http_auth_cache_shutdown ();
+ neon_session_pool_shutdown ();
+ proxy_shutdown ();
+ }
}

@ -1,72 +0,0 @@
--- gnome-vfs-2.16.2/libgnomevfs/gnome-vfs-dns-sd.c.ipv6 2006-11-30 13:40:48.000000000 +0100
+++ gnome-vfs-2.16.2/libgnomevfs/gnome-vfs-dns-sd.c 2006-11-30 14:28:48.000000000 +0100
@@ -1959,6 +1959,7 @@
struct sync_resolve_data {
AvahiSimplePoll *poll;
gboolean got_data;
+ gboolean got_link_local_ipv6;
char *host;
int port;
char *text;
@@ -1997,6 +1998,13 @@
data = user_data;
if (event == AVAHI_RESOLVER_FOUND) {
+ if (address->proto == AVAHI_PROTO_INET6 &&
+ address->data.ipv6.address[0] == 0xfe &&
+ address->data.ipv6.address[1] == 0x80) {
+ data->got_link_local_ipv6 = TRUE;
+ goto out;
+ }
+
data->got_data = TRUE;
avahi_address_snprint (a, sizeof(a), address);
data->host = g_strdup (a);
@@ -2005,7 +2013,7 @@
data->text = g_malloc (data->text_len);
avahi_string_list_serialize (txt, data->text, data->text_len);
}
-
+ out:
avahi_service_resolver_free (r);
avahi_simple_poll_quit (data->poll);
}
@@ -2090,8 +2098,13 @@
AvahiClient *client = NULL;
AvahiServiceResolver *sr;
int error;
+ AvahiProtocol protocol;
struct sync_resolve_data resolve_data = {0};
+ protocol = AVAHI_PROTO_UNSPEC;
+
+ retry:
+
simple_poll = avahi_simple_poll_new ();
resolve_data.poll = simple_poll;
if (simple_poll == NULL) {
@@ -2109,7 +2122,8 @@
return GNOME_VFS_ERROR_GENERIC;
}
- sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
+ resolve_data.got_link_local_ipv6 = FALSE;
+ sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, protocol,
name, type, domain, AVAHI_PROTO_UNSPEC,
0, avahi_resolve_sync_callback, &resolve_data);
if (sr == NULL) {
@@ -2127,6 +2141,14 @@
avahi_client_free (client);
avahi_simple_poll_free (simple_poll);
+
+ if (resolve_data.got_link_local_ipv6) {
+ /* We ignore non-routable ipv6 link-local addresses here, because our
+ api doesn't give the iface, so they are useless. Prefer ipv4 address instead */
+ protocol = AVAHI_PROTO_INET;
+ goto retry;
+ }
+
if (resolve_data.got_data) {
*host = resolve_data.host;
*port = resolve_data.port;

@ -1,20 +0,0 @@
--- gnome-vfs-2.18.1/modules/ftp-method.c.symlink 2007-05-07 23:27:49.000000000 -0400
+++ gnome-vfs-2.18.1/modules/ftp-method.c 2007-05-07 23:29:20.000000000 -0400
@@ -2229,7 +2229,7 @@ unix_ls_to_file_info (gchar *ls, GnomeVF
if(linkname) {
file_info->symlink_name = linkname;
- file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME;
+ file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME | GNOME_VFS_FILE_INFO_FIELDS_FLAGS;
file_info->flags |= GNOME_VFS_FILE_FLAGS_SYMLINK;
}
@@ -2716,7 +2716,7 @@ do_read_directory (GnomeVFSMethod *metho
gnome_vfs_file_info_copy (file_info, symlink_info);
GNOME_VFS_FILE_INFO_SET_SYMLINK (file_info, TRUE);
- file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME;
+ file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME | GNOME_VFS_FILE_INFO_FIELDS_FLAGS;
file_info->symlink_name = gnome_vfs_unescape_string (uri->text != NULL ? uri->text : "/", "/");
g_free (file_info->name);

@ -1,28 +0,0 @@
--- gnome-vfs-2.5.90/modules/default-modules.conf.modules-conf 2004-03-05 08:40:12.000000000 -0500
+++ gnome-vfs-2.5.90/modules/default-modules.conf 2004-03-11 00:05:55.399947624 -0500
@@ -42,15 +42,15 @@
a ar arj cpio deb hp48 lha mailfs patchfs rar rpm rpms trpm zip zoo: extfs
# vfolder desktop method
-applications: vfolder-desktop
-applications-all-users: vfolder-desktop
-all-applications: vfolder-desktop
-preferences: vfolder-desktop
-preferences-all-users: vfolder-desktop
-all-preferences: vfolder-desktop
-favorites: vfolder-desktop
-start-here: vfolder-desktop
-system-settings: vfolder-desktop
-server-settings: vfolder-desktop
+applications: menu
+applications-all-users: menu
+all-applications: menu
+preferences: menu
+preferences-all-users: menu
+all-preferences: menu
+favorites: desktop
+start-here: desktop
+system-settings: menu
+server-settings: menu
tar: tar

@ -1,43 +0,0 @@
--- gnome-vfs-2.7.90/schemas/desktop_gnome_url_handlers.schemas.in.schema_about 2004-08-04 16:18:21.323425176 +0100
+++ gnome-vfs-2.7.90/schemas/desktop_gnome_url_handlers.schemas.in 2004-08-04 16:25:28.770443352 +0100
@@ -206,6 +206,40 @@
</schema>
<schema>
+ <key>/schemas/desktop/gnome/url-handlers/about/enabled</key>
+ <applyto>/desktop/gnome/url-handlers/about/enabled</applyto>
+ <owner>gnome</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Handle about URLs</short>
+ <long>Set to true to have a program specified in "command" handle about URLs.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/gnome/url-handlers/about/command</key>
+ <applyto>/desktop/gnome/url-handlers/about/command</applyto>
+ <owner>gnome</owner>
+ <type>string</type>
+ <default>mozilla %s</default>
+ <locale name="C">
+ <short>about URL handler</short>
+ <long></long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/desktop/gnome/url-handlers/about/needs_terminal</key>
+ <applyto>/desktop/gnome/url-handlers/about/needs_terminal</applyto>
+ <owner>gnome</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Run program in terminal</short>
+ <long>True if the program to handle this URL should be run in a terminal.</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/desktop/gnome/url-handlers/mailto/enabled</key>
<applyto>/desktop/gnome/url-handlers/mailto/enabled</applyto>
<owner>gnome</owner>

@ -1,855 +0,0 @@
Index: doc/tmpl/gnome-vfs-inet-connection.sgml
===================================================================
RCS file: /cvs/gnome/gnome-vfs/doc/tmpl/gnome-vfs-inet-connection.sgml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- doc/tmpl/gnome-vfs-inet-connection.sgml 16 Aug 2004 08:44:05 -0000 1.4
+++ doc/tmpl/gnome-vfs-inet-connection.sgml 7 Oct 2004 04:36:35 -0000 1.5
@@ -1,11 +1,19 @@
<!-- ##### SECTION Title ##### -->
-gnome-vfs-inet-connection
+Internet connection
<!-- ##### SECTION Short_Description ##### -->
-
+Simple TCP/IP connection functions.
<!-- ##### SECTION Long_Description ##### -->
<para>
+A #GnomeVFSInetConnection represents a TCP/IP connection. You can either use
+#gnome_vfs_inet_connection_create which will use the #gnome_vfs_resolve DNS
+resolution functions internally or you can do the name resolution yourself
+and use #gnome_vfs_inet_connection_create_from_address to connect to a specific
+address.
+
+After a connection has been established all I/O is done through a GnomeVFSSocket
+or a GnomeVFSSocketBuffer.
</para>
Index: doc/tmpl/gnome-vfs-socket-buffer.sgml
===================================================================
RCS file: /cvs/gnome/gnome-vfs/doc/tmpl/gnome-vfs-socket-buffer.sgml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- doc/tmpl/gnome-vfs-socket-buffer.sgml 16 Aug 2004 08:44:05 -0000 1.4
+++ doc/tmpl/gnome-vfs-socket-buffer.sgml 7 Oct 2004 04:36:35 -0000 1.5
@@ -1,11 +1,22 @@
<!-- ##### SECTION Title ##### -->
-gnome-vfs-socket-buffer
+Unified bufferd network I/O
<!-- ##### SECTION Short_Description ##### -->
-
+Posix style buffered network input/output.
<!-- ##### SECTION Long_Description ##### -->
<para>
+The GnomeVFSSocketBuffer functions are very similar to the GnomeVFSSocket
+ones. The only difference is that all input/output is done through an internally
+managed buffer. This might increase I/O performance as well as give you the
+possibility to use some convenient functions like #gnome_vfs_socket_buffer_peekc
+and #gnome_vfs_socket_buffer_read_until.
+
+<para>
+</para>
+
+You can manually force all internally buffered data to get written with
+#gnome_vfs_socket_buffer_flush.
</para>
Index: doc/tmpl/gnome-vfs-socket.sgml
===================================================================
RCS file: /cvs/gnome/gnome-vfs/doc/tmpl/gnome-vfs-socket.sgml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- doc/tmpl/gnome-vfs-socket.sgml 16 Aug 2004 08:44:06 -0000 1.7
+++ doc/tmpl/gnome-vfs-socket.sgml 7 Oct 2004 04:36:35 -0000 1.8
@@ -1,11 +1,16 @@
<!-- ##### SECTION Title ##### -->
-gnome-vfs-socket
+Unified network I/O
<!-- ##### SECTION Short_Description ##### -->
-
+Posix style network input/output functions.
<!-- ##### SECTION Long_Description ##### -->
<para>
+The GnomeVFSSocket function family unifies network I/O through functions
+similar to the standard POSIX read/write functions. The main difference is
+that all operations are cancellable through the standard GnomeVFS cancellation
+mechanism and you can specify a maximum amount of time an operation may take
+through #gnome_vfs_socket_set_timeout.
</para>
Index: imported/neon/ne_gnomevfs.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/imported/neon/ne_gnomevfs.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- imported/neon/ne_gnomevfs.c 21 Sep 2004 08:10:19 -0000 1.4
+++ imported/neon/ne_gnomevfs.c 5 Oct 2004 15:47:10 -0000 1.5
@@ -252,7 +252,7 @@ ne_sock_connect (ne_socket *sock, const
return NE_SOCK_ERROR;
sock->socket = gnome_vfs_inet_connection_to_socket (sock->connection);
- sock->socket_buffer = gnome_vfs_inet_connection_to_socket_buffer (sock->connection);
+ sock->socket_buffer = gnome_vfs_socket_buffer_new (sock->socket);
return 0;
}
@@ -425,8 +425,6 @@ ne_sock_close (ne_socket *sock)
GnomeVFSCancellation *cancellation;
peek_cancellation (cancellation);
-
- gnome_vfs_socket_free (sock->socket);
if (sock->socket_buffer) {
gnome_vfs_socket_buffer_flush (sock->socket_buffer,
Index: libgnomevfs/eggdesktopentries.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/eggdesktopentries.c,v
retrieving revision 1.8
retrieving revision 1.10
diff -u -p -r1.8 -r1.10
--- libgnomevfs/eggdesktopentries.c 3 Sep 2004 18:24:00 -0000 1.8
+++ libgnomevfs/eggdesktopentries.c 28 Sep 2004 03:41:12 -0000 1.10
@@ -224,7 +224,7 @@ egg_find_file_in_data_dirs (const gchar
g_free (path);
if (fd < 0 && file_error == NULL)
- g_set_error (&file_error, G_FILE_ERROR,
+ file_error = g_error_new (G_FILE_ERROR,
g_file_error_from_errno (errno),
_("File could not be opened: %s"),
g_strerror (errno));
@@ -261,10 +261,8 @@ egg_find_file_in_data_dir (const gchar *
gint fd;
gchar **data_dirs;
GError *file_error;
- GError *secondary_error;
file_error = NULL;
- secondary_error = NULL;
data_dirs = g_new0 (char *, 2);
@@ -275,20 +273,18 @@ egg_find_file_in_data_dir (const gchar *
if (fd < 0)
{
data_dirs = egg_get_secondary_data_dirs ();
- fd = egg_find_file_in_data_dirs (file, data_dirs, &secondary_error);
+ fd = egg_find_file_in_data_dirs (file, data_dirs, NULL);
g_strfreev (data_dirs);
if (fd >= 0)
- {
- g_error_free (file_error);
- file_error = NULL;
- }
+ {
+ g_error_free (file_error);
+ file_error = NULL;
+ }
}
if (file_error)
g_propagate_error (error, file_error);
- else if (secondary_error)
- g_propagate_error (error, secondary_error);
return fd;
}
@@ -405,6 +401,7 @@ egg_desktop_entries_free (EggDesktopEntr
g_string_free (entries->parse_buffer, TRUE);
g_strfreev (entries->legal_start_groups);
+ g_free (entries->default_group_name);
tmp = entries->groups;
while (tmp != NULL)
@@ -1912,9 +1909,9 @@ egg_desktop_entries_get_locale_country (
q = strstr (p, "@");
if (!q)
- country_len = q - p;
- else
country_len = strlen (p);
+ else
+ country_len = q - p;
if (country_len <= 0)
return NULL;
@@ -1972,9 +1969,9 @@ egg_desktop_entries_get_locale_encoding
q = strstr (p, "@");
if (!q)
- encoding_len = q - p;
- else
encoding_len = strlen (p);
+ else
+ encoding_len = q - p;
if (encoding_len <= 0)
{
Index: libgnomevfs/gnome-vfs-mime-handlers.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-mime-handlers.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -p -r1.109 -r1.110
--- libgnomevfs/gnome-vfs-mime-handlers.c 7 Sep 2004 15:31:35 -0000 1.109
+++ libgnomevfs/gnome-vfs-mime-handlers.c 5 Oct 2004 09:32:20 -0000 1.110
@@ -98,6 +98,13 @@ gnome_vfs_mime_get_default_action_type (
{
const char *action_type_string;
+ /* TODO: gnome_vfs_mime_get_value below always returns NONE these days.
+ We need to figure out what to really do here. For now, special case folders.
+ */
+ if (g_str_has_prefix (mime_type, "x-directory/")) {
+ return GNOME_VFS_MIME_ACTION_TYPE_COMPONENT;
+ }
+
action_type_string = gnome_vfs_mime_get_value (mime_type, "default_action_type");
if (action_type_string != NULL && g_ascii_strcasecmp (action_type_string, "application") == 0) {
Index: libgnomevfs/gnome-vfs-monitor.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-monitor.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- libgnomevfs/gnome-vfs-monitor.c 20 Jul 2004 21:46:40 -0000 1.11
+++ libgnomevfs/gnome-vfs-monitor.c 7 Oct 2004 15:57:41 -0000 1.12
@@ -331,7 +331,8 @@ send_uri_changes_now (GnomeVFSMonitorHan
l = monitor_handle->pending_callbacks;
while (l != NULL) {
callback_data = l->data;
- if (strcmp (callback_data->info_uri, uri) == 0) {
+ if (callback_data->send_state != CALLBACK_STATE_SENT &&
+ strcmp (callback_data->info_uri, uri) == 0) {
callback_data->send_at = now;
}
l = l->next;
Index: libgnomevfs/gnome-vfs-unix-mounts.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-unix-mounts.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -p -r1.16 -r1.17
--- libgnomevfs/gnome-vfs-unix-mounts.c 21 Sep 2004 07:45:25 -0000 1.16
+++ libgnomevfs/gnome-vfs-unix-mounts.c 22 Sep 2004 08:38:38 -0000 1.17
@@ -91,98 +91,111 @@
* to avoid this...
* Various ugly workarounds can be tried later.
*/
-dev_t
-_gnome_vfs_unix_mount_get_unix_device (GnomeVFSUnixMount *mount)
+GList *
+_gnome_vfs_unix_mount_get_unix_device (GList *mounts)
{
- struct stat statbuf;
- dev_t unix_device;
- pid_t pid;
- int pipes[2];
-#ifdef HAVE_POLL
- struct pollfd poll_fd;
-#else
- struct timeval tv;
- fd_set read_fds;
-#endif
- int res;
- int status;
+ GList *result = NULL;
- if (pipe (pipes) == -1) {
- return 0;
- }
+ while (mounts) {
+ dev_t unix_device = 0;
+ pid_t pid;
+ int pipes[2];
+ int status;
- pid = fork ();
-
- if (pid == -1) {
- close (pipes[0]);
- close (pipes[1]);
- return 0;
- }
-
- unix_device = 0;
-
- if (pid == 0) {
- /* Child */
- close (pipes[0]);
+ if (pipe (pipes) == -1)
+ goto error;
pid = fork ();
+ if (pid == -1) {
+ close (pipes[0]);
+ close (pipes[1]);
+ goto error;
+ }
- /* Fork an intermediate child that immediately exits so
- * we can waitpid it. This means the final process will get
- * owned by init and not go zombie
- */
if (pid == 0) {
- /* Grandchild */
- if (stat (mount->mount_path, &statbuf) == 0) {
- write (pipes[1], (char *)&statbuf.st_dev, sizeof (dev_t));
+ /* Child */
+ close (pipes[0]);
+
+ /* Fork an intermediate child that immediately exits
+ * so we can waitpid it. This means the final process
+ * will get owned by init and not go zombie.
+ */
+ pid = fork ();
+
+ if (pid == 0) {
+ /* Grandchild */
+ struct stat statbuf;
+ while (mounts) {
+ GnomeVFSUnixMount *mount = mounts->data;
+ unix_device =
+ stat (mount->mount_path, &statbuf) == 0
+ ? statbuf.st_dev
+ : 0;
+ write (pipes[1], (char *)&unix_device, sizeof (dev_t));
+ mounts = mounts->next;
+ }
}
- } else {
close (pipes[1]);
+ _exit (0);
+ g_assert_not_reached ();
}
- _exit (0);
- } else {
/* Parent */
close (pipes[1]);
-
- wait_again:
+
+ retry_waitpid:
if (waitpid (pid, &status, 0) < 0) {
if (errno == EINTR)
- goto wait_again;
+ goto retry_waitpid;
else if (errno == ECHILD)
; /* do nothing, child already reaped */
else
g_warning ("waitpid() should not fail in gnome_vfs_unix_mount_get_unix_device");
}
+ while (mounts) {
+ int res;
- do {
+ do {
#ifdef HAVE_POLL
- poll_fd.fd = pipes[0];
- poll_fd.events = POLLIN;
- res = poll (&poll_fd, 1, STAT_TIMEOUT_SECONDS*1000);
+ struct pollfd poll_fd;
+ poll_fd.fd = pipes[0];
+ poll_fd.events = POLLIN;
+ res = poll (&poll_fd, 1, STAT_TIMEOUT_SECONDS * 1000);
#else
- tv.tv_sec = STAT_TIMEOUT_SECONDS;
- tv.tv_usec = 0;
+ struct timeval tv;
+ fd_set read_fds;
+
+ tv.tv_sec = STAT_TIMEOUT_SECONDS;
+ tv.tv_usec = 0;
- FD_ZERO(&read_fds);
- FD_SET(pipes[0], &read_fds);
+ FD_ZERO(&read_fds);
+ FD_SET(pipes[0], &read_fds);
- res = select (pipes[0] + 1,
- &read_fds, NULL, NULL, &tv);
+ res = select (pipes[0] + 1,
+ &read_fds, NULL, NULL, &tv);
#endif
- } while (res == -1 && errno == EINTR);
-
- if (res > 0) {
- if (read (pipes[0], (char *)&unix_device, sizeof (dev_t)) != sizeof (dev_t)) {
- unix_device = 0;
- }
+ } while (res == -1 && errno == EINTR);
+
+ if (res <= 0 ||
+ read (pipes[0], (char *)&unix_device, sizeof (dev_t)) != sizeof (dev_t))
+ break;
+
+ result = g_list_prepend (result, GUINT_TO_POINTER ((gulong)unix_device));
+ mounts = mounts->next;
}
close (pipes[0]);
+
+ error:
+ if (mounts) {
+ unix_device = 0;
+ result = g_list_prepend (result, GUINT_TO_POINTER ((gulong)unix_device));
+ mounts = mounts->next;
+ }
}
-
- return unix_device;
+
+ return g_list_reverse (result);
}
#ifndef HAVE_SETMNTENT
Index: libgnomevfs/gnome-vfs-unix-mounts.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-unix-mounts.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- libgnomevfs/gnome-vfs-unix-mounts.h 5 Nov 2003 15:44:53 -0000 1.2
+++ libgnomevfs/gnome-vfs-unix-mounts.h 22 Sep 2004 08:38:38 -0000 1.3
@@ -59,7 +59,7 @@ gint _gnome_vfs_unix_mount_point_com
GnomeVFSUnixMountPoint *mount_point2);
gboolean _gnome_vfs_get_unix_mount_table (GList **return_list);
gboolean _gnome_vfs_get_current_unix_mounts (GList **return_list);
-dev_t _gnome_vfs_unix_mount_get_unix_device (GnomeVFSUnixMount *mount);
+GList * _gnome_vfs_unix_mount_get_unix_device (GList *mounts);
void _gnome_vfs_monitor_unix_mounts (GnomeVFSUnixMountCallback mount_table_changed,
gpointer mount_table_changed_user_data,
GnomeVFSUnixMountCallback current_mounts_changed,
Index: libgnomevfs/gnome-vfs-volume-monitor-daemon.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-monitor-daemon.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -p -r1.14 -r1.15
--- libgnomevfs/gnome-vfs-volume-monitor-daemon.c 2 Sep 2004 15:51:48 -0000 1.14
+++ libgnomevfs/gnome-vfs-volume-monitor-daemon.c 22 Sep 2004 08:38:38 -0000 1.15
@@ -851,7 +851,7 @@ create_vol_from_mount (GnomeVFSVolumeMon
vol->priv->volume_type = GNOME_VFS_VOLUME_TYPE_MOUNTPOINT;
vol->priv->device_path = g_strdup (mount->device_path);
- vol->priv->unix_device = _gnome_vfs_unix_mount_get_unix_device (mount);
+ vol->priv->unix_device = 0; /* Caller must fill in. */
vol->priv->activation_uri = gnome_vfs_get_uri_from_local_path (mount->mount_path);
vol->priv->filesystem_type = g_strdup (mount->filesystem_type);
vol->priv->is_read_only = mount->is_read_only;
@@ -981,9 +981,8 @@ static void
update_mtab_volumes (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon)
{
GList *new_mtab;
- GList *removed, *added;
- GList *l;
- GnomeVFSUnixMount *mount;
+ GList *removed, *added, *devices;
+ GList *l, *ld;
char *uri;
GnomeVFSVolume *vol;
GnomeVFSVolumeMonitor *volume_monitor;
@@ -998,7 +997,7 @@ update_mtab_volumes (GnomeVFSVolumeMonit
&added, &removed);
for (l = removed; l != NULL; l = l->next) {
- mount = l->data;
+ GnomeVFSUnixMount *mount = l->data;
uri = gnome_vfs_get_uri_from_local_path (mount->mount_path);
vol = _gnome_vfs_volume_monitor_find_mtab_volume_by_activation_uri (volume_monitor, uri);
@@ -1011,15 +1010,22 @@ update_mtab_volumes (GnomeVFSVolumeMonit
g_free (uri);
}
-
- for (l = added; l != NULL; l = l->next) {
- mount = l->data;
+
+ devices = _gnome_vfs_unix_mount_get_unix_device (added);
+
+ for (l = added, ld = devices;
+ l != NULL;
+ l = l->next, ld = ld->next) {
+ GnomeVFSUnixMount *mount = l->data;
+ dev_t unix_device = GPOINTER_TO_UINT (ld->data);
vol = create_vol_from_mount (volume_monitor, mount);
+ vol->priv->unix_device = unix_device;
_gnome_vfs_volume_monitor_mounted (volume_monitor, vol);
gnome_vfs_volume_unref (vol);
}
-
+
+ g_list_free (devices);
g_list_free (added);
g_list_free (removed);
g_list_foreach (volume_monitor_daemon->last_mtab,
Index: modules/http-neon-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/http-neon-method.c,v
retrieving revision 1.14
retrieving revision 1.16
diff -u -p -r1.14 -r1.16
--- modules/http-neon-method.c 21 Sep 2004 13:09:32 -0000 1.14
+++ modules/http-neon-method.c 6 Oct 2004 10:51:45 -0000 1.16
@@ -82,17 +82,17 @@ void vfs_module_shutdown
/* ************************************************************************** */
/* DEBUGING stuff */
+#undef DEBUG_HTTP_ENABLE
+
#ifdef DEBUG_HTTP_ENABLE
-void http_debug_printf(char *func, char *fmt, ...) G_GNUC_PRINTF (2,3);
+void http_debug_printf(const char *func, const char *fmt, ...) G_GNUC_PRINTF (2,3);
-/* #define DEBUG_HTTP_3(fmt, ...) http_debug_printf (__PRETTY_FUNCTION__, fmt, ##__VA_ARGS__) */
-/* #define DEBUG_HTTP_2(fmt, ...) http_debug_printf (__PRETTY_FUNCTION__, fmt, ##__VA_ARGS__) */
+#define DEBUG_HTTP_3(fmt, ...) http_debug_printf (__PRETTY_FUNCTION__, fmt, ##__VA_ARGS__)
+#define DEBUG_HTTP_2(fmt, ...) http_debug_printf (__PRETTY_FUNCTION__, fmt, ##__VA_ARGS__)
#define DEBUG_HTTP(fmt, ...) http_debug_printf (__PRETTY_FUNCTION__, fmt, ##__VA_ARGS__)
#define DEBUG_HTTP_FUNC(_enter) http_debug_printf (_enter ? "+++" : "---", "%s",__PRETTY_FUNCTION__)
-#define DEBUG_HTTP_3(fmt, ...)
-#define DEBUG_HTTP_2(fmt, ...)
#define DEBUG_HTTP_CONTEXT(c) http_debug_printf (__PRETTY_FUNCTION__, \
@@ -100,7 +100,7 @@ void http_debug_printf(char *func, char
c->session, c->path)
void
-http_debug_printf (char *func, char *fmt, ...)
+http_debug_printf (const char *func, const char *fmt, ...)
{
va_list args;
gchar * out;
@@ -1385,10 +1385,12 @@ neon_session_pool_lookup (GnomeVFSURI *u
DEBUG_HTTP ("[Session Pool] Searching (%d)",
g_hash_table_size (neon_session_table));
+ session = NULL;
pool = g_hash_table_lookup (neon_session_table, uri);
/* search in session pool */
if (pool != NULL && pool->unused_sessions) {
+
session = pool->unused_sessions->data;
pool->unused_sessions = g_list_remove (pool->unused_sessions,
session);
@@ -1396,59 +1398,104 @@ neon_session_pool_lookup (GnomeVFSURI *u
g_list_length (pool->unused_sessions));
g_get_current_time (&(pool->last_used));
-
- G_UNLOCK (nst_lock);
- return session;
}
G_UNLOCK (nst_lock);
- return NULL;
+ return session;
}
/* ************************************************************************** */
/* Additional Headers */
-#if 0
-/* Does not work because the neon library doesnt provide as all the headers
- working around that is a bigger thing */
+static int
+neon_return_headers (ne_request *req, void *userdata, const ne_status *status)
+{
+ GnomeVFSModuleCallbackReceivedHeadersIn in_args;
+ GnomeVFSModuleCallbackReceivedHeadersOut out_args;
+ GList **headers, *iter;
+ GnomeVFSURI *uri;
+ ne_session *session;
-typedef struct {
+ DEBUG_HTTP_FUNC (1);
- GnomeVFSURI *uri;
- gboolean sent;
+ session = ne_get_session (req);
+ headers = ne_get_request_private (req, "Headers");
+ uri = ne_get_session_private (session, "GnomeVFSURI");
+
+ memset (&in_args, 0, sizeof (in_args));
+ memset (&out_args, 0, sizeof (out_args));
+
+ in_args.uri = uri;
+ in_args.headers = *headers;
+
+ gnome_vfs_module_callback_invoke (GNOME_VFS_MODULE_CALLBACK_HTTP_RECEIVED_HEADERS,
+ &in_args, sizeof (in_args),
+ &out_args, sizeof (out_args));
-} AddHeadersContext;
+ for (iter = *headers; iter; iter = iter->next) {
+ DEBUG_HTTP_3 ("Headers returned %s,", (char *) iter->data);
+ g_free (iter->data);
+ }
+ g_list_free (*headers);
+ g_free (headers);
+
+ DEBUG_HTTP_FUNC (0);
+
+ return 0;
+}
static void
-neon_handle_additional_headers (ne_request *req,
- void *userdata,
- const char *method,
- const char *requri)
+neon_header_catcher (void *userdata, const char *value)
{
- AddHeadersContext *adhctx = (AddHeadersContext *) userdata;
+ GList **headers = (GList **) userdata;
+
+ *headers = g_list_prepend (*headers, g_strdup (value));
+}
+
+
+static void
+neon_setup_headers (ne_request *req, void *userdata, ne_buffer *header)
+{
+ GnomeVFSModuleCallbackAdditionalHeadersIn in_args;
+ GnomeVFSModuleCallbackAdditionalHeadersOut out_args;
+ GList *iter, **headers;
+ gboolean ret;
+ GnomeVFSURI *uri;
+ ne_session *session;
+
+ DEBUG_HTTP_FUNC (1);
- if (! invoke_callback_send_additional_headers (uri, &list))
- return;
+ headers = g_new0 (GList *, 1);
+
+ ne_set_request_private (req, "Headers", headers);
+ ne_add_response_header_catcher (req, neon_header_catcher, headers);
+
+ session = ne_get_session (req);
+ uri = ne_get_session_private (session, "GnomeVFSURI");
+
+ memset (&in_args, 0, sizeof (in_args));
+ memset (&out_args, 0, sizeof (out_args));
+
+ in_args.uri = uri;
+
+ ret = gnome_vfs_module_callback_invoke (GNOME_VFS_MODULE_CALLBACK_HTTP_SEND_ADDITIONAL_HEADERS,
+ &in_args, sizeof (in_args),
+ &out_args, sizeof (out_args));
- GList *iter;
- for (iter = list; iter; iter = iter->next) {
- char *header = iter->data;
- char *colon = g_strrstr (header, ":");
- AcHeaderContext acctx = g_new0 (AcHeaderContext, 1);
-
- if (colon != NULL) {
- colon = '\0';
- ne_add_request_header (req, header, colon + 1);
- }
+ for (iter = out_args.headers; iter; iter = iter->next) {
- g_free (header);
- iter->data = NULL;
+ if (ret) {
+ ne_buffer_zappend (header, iter->data);
+ DEBUG_HTTP_3 ("Adding header %s,", (char *) iter->data);
+ }
+
+ g_free (iter->data);
}
- g_list_free (list);
-
+ g_list_free (out_args.headers);
+
+ DEBUG_HTTP_FUNC (0);
}
-#endif
/* ************************************************************************** */
/* Http context */
@@ -1488,6 +1535,9 @@ http_aquire_connection (HttpContext *con
session = neon_session_pool_lookup (context->uri);
if (session != NULL) {
+
+ ne_set_session_private (session, "GnomeVFSURI", context->uri);
+
context->session = session;
return GNOME_VFS_OK;
}
@@ -1521,8 +1571,12 @@ http_aquire_connection (HttpContext *con
http_auth_info_free, basic_auth);
ne_redirect_register (session);
-
-
+
+ /* Headers stuff */
+ ne_set_session_private (session, "GnomeVFSURI", context->uri);
+ ne_hook_pre_send (session, neon_setup_headers, NULL);
+ ne_hook_post_send (session, neon_return_headers, NULL);
+
if (proxy_for_uri (top_uri, &proxy)) {
HttpAuthInfo *proxy_auth;
@@ -1669,7 +1723,7 @@ http_follow_redirect (HttpContext *conte
} else {
http_context_set_uri (context, new_uri);
-
+ ne_set_session_private (context->session, "GnomeVFSURI", context->uri);
result = GNOME_VFS_OK;
}
DEBUG_HTTP ("[Redirec] Redirect result: %s",
@@ -2146,6 +2200,7 @@ get_start:
if (res != NE_OK && res != NE_REDIRECT) {
handle->transfer_state = TRANSFER_ERROR;
handle->last_error = result;
+ ne_request_destroy (req);
return result;
}
Index: modules/network-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/network-method.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- modules/network-method.c 24 Jun 2004 14:29:27 -0000 1.5
+++ modules/network-method.c 7 Oct 2004 15:08:38 -0000 1.6
@@ -44,6 +44,7 @@
#define PATH_GCONF_GNOME_VFS_DNS_SD "/system/dns_sd"
#define PATH_GCONF_GNOME_VFS_DNS_SD_DISPLAY_LOCAL "/system/dns_sd/display_local"
#define PATH_GCONF_GNOME_VFS_DNS_SD_EXTRA_DOMAINS "/system/dns_sd/extra_domains"
+#define DEFAULT_WORKGROUP_NAME "X-GNOME-DEFAULT-WORKGROUP"
typedef struct {
char *display_name;
@@ -1219,7 +1220,7 @@ notify_gconf_value_changed (GConfClient
current_workgroup = gconf_client_get_string (client, PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL);
if (current_workgroup == NULL) {
- current_workgroup = g_strdup ("workgroup");
+ current_workgroup = g_strdup (DEFAULT_WORKGROUP_NAME);
}
G_UNLOCK (network);
@@ -1345,7 +1346,7 @@ vfs_module_init (const char *method_name
current_workgroup = gconf_client_get_string (gconf_client, PATH_GCONF_GNOME_VFS_SMB_WORKGROUP, NULL);
if (current_workgroup == NULL) {
- current_workgroup = g_strdup ("workgroup");
+ current_workgroup = g_strdup (DEFAULT_WORKGROUP_NAME);
}
setting = gconf_client_get_string (gconf_client, PATH_GCONF_GNOME_VFS_DNS_SD_DISPLAY_LOCAL, NULL);
Index: modules/smb-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/smb-method.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -r1.9 -r1.10
--- modules/smb-method.c 6 Sep 2004 09:47:37 -0000 1.9
+++ modules/smb-method.c 7 Oct 2004 15:08:38 -0000 1.10
@@ -94,6 +94,9 @@ static GHashTable *server_cache = NULL;
#define SERVER_CACHE_REAP_TIMEOUT (30*60)
static guint server_cache_reap_timeout = 0;
+/* The magic "default workgroup" hostname */
+#define DEFAULT_WORKGROUP_NAME "X-GNOME-DEFAULT-WORKGROUP"
+
/* 5 minutes before we re-read the workgroup cache again */
#define WORKGROUP_CACHE_TIMEOUT (5*60)
@@ -549,7 +552,9 @@ smb_uri_type (GnomeVFSURI *uri)
strcmp (uri->text, "/") == 0) {
/* smb://foo/ */
update_workgroup_cache ();
- if (g_hash_table_lookup (workgroups, toplevel->host_name)) {
+ if (!g_ascii_strcasecmp(toplevel->host_name,
+ DEFAULT_WORKGROUP_NAME) ||
+ g_hash_table_lookup (workgroups, toplevel->host_name)) {
return SMB_URI_WORKGROUP;
} else {
return SMB_URI_SERVER;
@@ -559,7 +564,9 @@ smb_uri_type (GnomeVFSURI *uri)
if (first_slash == NULL) {
/* smb://foo/bar */
update_workgroup_cache ();
- if (g_hash_table_lookup (workgroups, toplevel->host_name)) {
+ if (!g_ascii_strcasecmp(toplevel->host_name,
+ DEFAULT_WORKGROUP_NAME) ||
+ g_hash_table_lookup (workgroups, toplevel->host_name)) {
return SMB_URI_SERVER_LINK;
} else {
return SMB_URI_SHARE;
@@ -1547,6 +1554,8 @@ do_open_directory (GnomeVFSMethod *metho
{
DirectoryHandle *directory_handle;
+ GnomeVFSURI *new_uri = NULL;
+ const char *host_name;
char *path;
SmbUriType type;
SMBCFILE *dir;
@@ -1574,6 +1583,19 @@ do_open_directory (GnomeVFSMethod *metho
type == SMB_URI_SERVER_LINK) {
return GNOME_VFS_ERROR_NOT_A_DIRECTORY;
}
+
+ /* if it is the magic default workgroup name, map it to the
+ * SMBCCTX's workgroup, which comes from the smb.conf file. */
+ host_name = gnome_vfs_uri_get_host_name (uri);
+ if (type == SMB_URI_WORKGROUP && host_name != NULL &&
+ !g_ascii_strcasecmp(host_name, DEFAULT_WORKGROUP_NAME)) {
+ new_uri = gnome_vfs_uri_dup (uri);
+ gnome_vfs_uri_set_host_name (new_uri,
+ smb_context->workgroup
+ ? smb_context->workgroup
+ : "WORKGROUP");
+ uri = new_uri;
+ }
path = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_USER_NAME | GNOME_VFS_URI_HIDE_PASSWORD);
@@ -1590,10 +1612,13 @@ do_open_directory (GnomeVFSMethod *metho
if (dir == NULL) {
UNLOCK_SMB();
g_free (path);
+ if (new_uri) gnome_vfs_uri_unref (new_uri);
return gnome_vfs_result_from_errno ();
}
UNLOCK_SMB();
+
+ if (new_uri) gnome_vfs_uri_unref (new_uri);
/* Construct the handle */
directory_handle = g_new0 (DirectoryHandle, 1);

File diff suppressed because it is too large Load Diff

@ -1,26 +0,0 @@
--- gnome-vfs-2.8.1/libgnomevfs/eggdesktopentries.c 13 Sep 2004 15:26:51 -0000 1.5
+++ gnome-vfs-2.8.1/libgnomevfs/eggdesktopentries.c 28 Sep 2004 03:43:14 -0000 1.7
@@ -2448,9 +2448,9 @@ egg_desktop_entries_get_locale_country (
q = strstr (p, "@");
if (!q)
- country_len = q - p;
- else
country_len = strlen (p);
+ else
+ country_len = q - p;
if (country_len <= 0)
return NULL;
@@ -2508,9 +2508,9 @@ egg_desktop_entries_get_locale_encoding
q = strstr (p, "@");
if (!q)
- encoding_len = q - p;
- else
encoding_len = strlen (p);
+ else
+ encoding_len = q - p;
if (encoding_len <= 0)
{

@ -1,260 +0,0 @@
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-unix-mounts.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- libgnomevfs/gnome-vfs-unix-mounts.h 2003/11/05 15:44:53 1.2
+++ libgnomevfs/gnome-vfs-unix-mounts.h 2004/09/22 08:38:38 1.3
@@ -59,7 +59,7 @@
GnomeVFSUnixMountPoint *mount_point2);
gboolean _gnome_vfs_get_unix_mount_table (GList **return_list);
gboolean _gnome_vfs_get_current_unix_mounts (GList **return_list);
-dev_t _gnome_vfs_unix_mount_get_unix_device (GnomeVFSUnixMount *mount);
+GList * _gnome_vfs_unix_mount_get_unix_device (GList *mounts);
void _gnome_vfs_monitor_unix_mounts (GnomeVFSUnixMountCallback mount_table_changed,
gpointer mount_table_changed_user_data,
GnomeVFSUnixMountCallback current_mounts_changed,
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-unix-mounts.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- libgnomevfs/gnome-vfs-unix-mounts.c 2004/09/21 07:45:25 1.16
+++ libgnomevfs/gnome-vfs-unix-mounts.c 2004/09/22 08:38:38 1.17
@@ -91,98 +91,111 @@
* to avoid this...
* Various ugly workarounds can be tried later.
*/
-dev_t
-_gnome_vfs_unix_mount_get_unix_device (GnomeVFSUnixMount *mount)
+GList *
+_gnome_vfs_unix_mount_get_unix_device (GList *mounts)
{
- struct stat statbuf;
- dev_t unix_device;
- pid_t pid;
- int pipes[2];
-#ifdef HAVE_POLL
- struct pollfd poll_fd;
-#else
- struct timeval tv;
- fd_set read_fds;
-#endif
- int res;
- int status;
-
- if (pipe (pipes) == -1) {
- return 0;
- }
-
- pid = fork ();
+ GList *result = NULL;
- if (pid == -1) {
- close (pipes[0]);
- close (pipes[1]);
- return 0;
- }
+ while (mounts) {
+ dev_t unix_device = 0;
+ pid_t pid;
+ int pipes[2];
+ int status;
- unix_device = 0;
-
- if (pid == 0) {
- /* Child */
- close (pipes[0]);
+ if (pipe (pipes) == -1)
+ goto error;
pid = fork ();
+ if (pid == -1) {
+ close (pipes[0]);
+ close (pipes[1]);
+ goto error;
+ }
- /* Fork an intermediate child that immediately exits so
- * we can waitpid it. This means the final process will get
- * owned by init and not go zombie
- */
if (pid == 0) {
- /* Grandchild */
- if (stat (mount->mount_path, &statbuf) == 0) {
- write (pipes[1], (char *)&statbuf.st_dev, sizeof (dev_t));
+ /* Child */
+ close (pipes[0]);
+
+ /* Fork an intermediate child that immediately exits
+ * so we can waitpid it. This means the final process
+ * will get owned by init and not go zombie.
+ */
+ pid = fork ();
+
+ if (pid == 0) {
+ /* Grandchild */
+ struct stat statbuf;
+ while (mounts) {
+ GnomeVFSUnixMount *mount = mounts->data;
+ unix_device =
+ stat (mount->mount_path, &statbuf) == 0
+ ? statbuf.st_dev
+ : 0;
+ write (pipes[1], (char *)&unix_device, sizeof (dev_t));
+ mounts = mounts->next;
+ }
}
- } else {
close (pipes[1]);
+ _exit (0);
+ g_assert_not_reached ();
}
- _exit (0);
- } else {
/* Parent */
close (pipes[1]);
-
- wait_again:
+
+ retry_waitpid:
if (waitpid (pid, &status, 0) < 0) {
if (errno == EINTR)
- goto wait_again;
+ goto retry_waitpid;
else if (errno == ECHILD)
; /* do nothing, child already reaped */
else
g_warning ("waitpid() should not fail in gnome_vfs_unix_mount_get_unix_device");
}
+ while (mounts) {
+ int res;
- do {
+ do {
#ifdef HAVE_POLL
- poll_fd.fd = pipes[0];
- poll_fd.events = POLLIN;
- res = poll (&poll_fd, 1, STAT_TIMEOUT_SECONDS*1000);
+ struct pollfd poll_fd;
+ poll_fd.fd = pipes[0];
+ poll_fd.events = POLLIN;
+ res = poll (&poll_fd, 1, STAT_TIMEOUT_SECONDS * 1000);
#else
- tv.tv_sec = STAT_TIMEOUT_SECONDS;
- tv.tv_usec = 0;
+ struct timeval tv;
+ fd_set read_fds;
+
+ tv.tv_sec = STAT_TIMEOUT_SECONDS;
+ tv.tv_usec = 0;
- FD_ZERO(&read_fds);
- FD_SET(pipes[0], &read_fds);
+ FD_ZERO(&read_fds);
+ FD_SET(pipes[0], &read_fds);
- res = select (pipes[0] + 1,
- &read_fds, NULL, NULL, &tv);
+ res = select (pipes[0] + 1,
+ &read_fds, NULL, NULL, &tv);
#endif
- } while (res == -1 && errno == EINTR);
-
- if (res > 0) {
- if (read (pipes[0], (char *)&unix_device, sizeof (dev_t)) != sizeof (dev_t)) {
- unix_device = 0;
- }
+ } while (res == -1 && errno == EINTR);
+
+ if (res <= 0 ||
+ read (pipes[0], (char *)&unix_device, sizeof (dev_t)) != sizeof (dev_t))
+ break;
+
+ result = g_list_prepend (result, GUINT_TO_POINTER ((gulong)unix_device));
+ mounts = mounts->next;
}
close (pipes[0]);
+
+ error:
+ if (mounts) {
+ unix_device = 0;
+ result = g_list_prepend (result, GUINT_TO_POINTER ((gulong)unix_device));
+ mounts = mounts->next;
+ }
}
-
- return unix_device;
+
+ return g_list_reverse (result);
}
#ifndef HAVE_SETMNTENT
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-monitor-daemon.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- libgnomevfs/gnome-vfs-volume-monitor-daemon.c 2004/09/02 15:51:48 1.14
+++ libgnomevfs/gnome-vfs-volume-monitor-daemon.c 2004/09/22 08:38:38 1.15
@@ -851,7 +851,7 @@
vol->priv->volume_type = GNOME_VFS_VOLUME_TYPE_MOUNTPOINT;
vol->priv->device_path = g_strdup (mount->device_path);
- vol->priv->unix_device = _gnome_vfs_unix_mount_get_unix_device (mount);
+ vol->priv->unix_device = 0; /* Caller must fill in. */
vol->priv->activation_uri = gnome_vfs_get_uri_from_local_path (mount->mount_path);
vol->priv->filesystem_type = g_strdup (mount->filesystem_type);
vol->priv->is_read_only = mount->is_read_only;
@@ -981,9 +981,8 @@
update_mtab_volumes (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon)
{
GList *new_mtab;
- GList *removed, *added;
- GList *l;
- GnomeVFSUnixMount *mount;
+ GList *removed, *added, *devices;
+ GList *l, *ld;
char *uri;
GnomeVFSVolume *vol;
GnomeVFSVolumeMonitor *volume_monitor;
@@ -998,7 +997,7 @@
&added, &removed);
for (l = removed; l != NULL; l = l->next) {
- mount = l->data;
+ GnomeVFSUnixMount *mount = l->data;
uri = gnome_vfs_get_uri_from_local_path (mount->mount_path);
vol = _gnome_vfs_volume_monitor_find_mtab_volume_by_activation_uri (volume_monitor, uri);
@@ -1011,15 +1010,22 @@
g_free (uri);
}
-
- for (l = added; l != NULL; l = l->next) {
- mount = l->data;
+
+ devices = _gnome_vfs_unix_mount_get_unix_device (added);
+
+ for (l = added, ld = devices;
+ l != NULL;
+ l = l->next, ld = ld->next) {
+ GnomeVFSUnixMount *mount = l->data;
+ dev_t unix_device = GPOINTER_TO_UINT (ld->data);
vol = create_vol_from_mount (volume_monitor, mount);
+ vol->priv->unix_device = unix_device;
_gnome_vfs_volume_monitor_mounted (volume_monitor, vol);
gnome_vfs_volume_unref (vol);
}
-
+
+ g_list_free (devices);
g_list_free (added);
g_list_free (removed);
g_list_foreach (volume_monitor_daemon->last_mtab,

@ -1,19 +0,0 @@
Index: libgnomevfs/gnome-vfs-socket-buffer.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-socket-buffer.c,v
retrieving revision 1.11
diff -u -p -r1.11 gnome-vfs-socket-buffer.c
--- libgnomevfs/gnome-vfs-socket-buffer.c 7 Jul 2004 15:04:30 -0000 1.11
+++ libgnomevfs/gnome-vfs-socket-buffer.c 13 Oct 2004 11:51:08 -0000
@@ -412,7 +412,10 @@ flush (GnomeVFSSocketBuffer *socket_buff
if (result != GNOME_VFS_OK) {
return result;
}
-
+
+ memmove (output_buffer->data,
+ output_buffer->data + bytes_written,
+ output_buffer->byte_count - bytes_written);
output_buffer->byte_count -= bytes_written;
}

@ -1,151 +0,0 @@
Index: libgnomevfs/gnome-vfs-unix-mounts.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-unix-mounts.c,v
retrieving revision 1.17
diff -u -p -r1.17 gnome-vfs-unix-mounts.c
--- libgnomevfs/gnome-vfs-unix-mounts.c 22 Sep 2004 08:38:38 -0000 1.17
+++ libgnomevfs/gnome-vfs-unix-mounts.c 15 Oct 2004 08:14:01 -0000
@@ -235,6 +235,7 @@ gboolean
_gnome_vfs_get_current_unix_mounts (GList **return_list)
{
static time_t last_mtime = 0;
+ static off_t last_size = 0;
struct mntent *mntent;
FILE *file;
char *read_file;
@@ -254,11 +255,12 @@ _gnome_vfs_get_current_unix_mounts (GLis
return TRUE;
}
- if (sb.st_mtime == last_mtime) {
+ if (sb.st_mtime == last_mtime && sb.st_size == last_size) {
return FALSE;
}
last_mtime = sb.st_mtime;
+ last_size = sb.st_size;
file = setmntent (read_file, "r");
if (file == NULL) {
@@ -332,6 +334,7 @@ gboolean
_gnome_vfs_get_current_unix_mounts (GList **return_list)
{
static time_t last_mtime = 0;
+ static off_t last_size = 0;
struct mnttab mntent;
FILE *file;
char *read_file;
@@ -350,11 +353,12 @@ _gnome_vfs_get_current_unix_mounts (GLis
return TRUE;
}
- if (sb.st_mtime == last_mtime) {
+ if (sb.st_mtime == last_mtime && sb.st_size == last_size) {
return FALSE;
}
last_mtime = sb.st_mtime;
+ last_size = sb.st_size;
file = setmntent (read_file, "r");
if (file == NULL) {
@@ -526,6 +530,7 @@ gboolean
_gnome_vfs_get_unix_mount_table (GList **return_list)
{
static time_t last_mtime = 0;
+ static off_t last_size = 0;
struct mntent *mntent;
FILE *file;
char *read_file;
@@ -544,11 +549,12 @@ _gnome_vfs_get_unix_mount_table (GList *
return TRUE;
}
- if (sb.st_mtime == last_mtime) {
+ if (sb.st_mtime == last_mtime && sb.st_size == last_size) {
return FALSE;
}
last_mtime = sb.st_mtime;
+ last_size = sb.st_size;
file = setmntent (read_file, "r");
if (file == NULL) {
@@ -613,6 +619,7 @@ gboolean
_gnome_vfs_get_unix_mount_table (GList **return_list)
{
static time_t last_mtime = 0;
+ static off_t last_size = 0;
struct mnttab mntent;
FILE *file;
char *read_file;
@@ -630,11 +637,12 @@ _gnome_vfs_get_unix_mount_table (GList *
return TRUE;
}
- if (sb.st_mtime == last_mtime) {
+ if (sb.st_mtime == last_mtime && sb.st_size == last_size) {
return FALSE;
}
last_mtime = sb.st_mtime;
+ last_size = sb.st_size;
file = setmntent (read_file, "r");
if (file == NULL) {
@@ -801,6 +809,7 @@ gboolean
_gnome_vfs_get_unix_mount_table (GList **return_list)
{
static time_t last_mtime = 0;
+ static off_t last_size = 0;
struct mntent *mntent;
FILE *file;
char *read_file;
@@ -813,17 +822,17 @@ _gnome_vfs_get_unix_mount_table (GList *
*return_list = NULL;
- if (last_mtime != 0) {
- if (stat (stat_file, &sb) < 0) {
- g_warning ("Unable to stat %s: %s", stat_file,
- g_strerror (errno));
- return TRUE;
- }
+ if (stat (stat_file, &sb) < 0) {
+ g_warning ("Unable to stat %s: %s", stat_file,
+ g_strerror (errno));
+ return TRUE;
+ }
- if (sb.st_mtime == last_mtime) {
- return FALSE;
- }
+ if (last_mtime != 0 && fsb.st_mtime == last_mtime && fsb.st_size == last_size) {
+ return FALSE;
}
+ last_mtime = fsb.st_mtime;
+ last_size = fsb.st_size;
file = setmntent (read_file, "r");
if (file == NULL) {
@@ -857,6 +866,7 @@ gboolean
_gnome_vfs_get_unix_mount_table (GList **return_list)
{
static time_t last_mtime = 0;
+ static off_t last_size = 0;
struct fstab *fstab = NULL;
char *stat_file;
struct stat fsb;
@@ -875,10 +885,11 @@ _gnome_vfs_get_unix_mount_table (GList *
return TRUE;
}
- if (last_mtime != 0 && fsb.st_mtime == last_mtime) {
+ if (last_mtime != 0 && fsb.st_mtime == last_mtime && fsb.st_size == last_size) {
return FALSE;
}
last_mtime = fsb.st_mtime;
+ last_size = fsb.st_size;
*return_list = NULL;

@ -1,23 +0,0 @@
--- gnome-vfs-2.9.90/modules/Makefile.am.old-modules 2005-01-10 11:22:41.000000000 -0500
+++ gnome-vfs-2.9.90/modules/Makefile.am 2005-01-31 10:11:41.564778000 -0500
@@ -67,6 +67,7 @@
$(SMB_LTLIBS) \
libsftp.la \
libtar.la \
+ libdesktop.la \
$(NULL)
# Not currently supported
@@ -161,6 +162,12 @@
libftp_la_LDFLAGS = $(module_flags)
libftp_la_LIBADD = $(MODULES_LIBS) $(GSSAPI_LIBS) ../libgnomevfs/libgnomevfs-2.la
+### `desktop' method
+
+libdesktop_la_SOURCES = desktop-method.c
+libdesktop_la_LDFLAGS = $(module_flags)
+libdesktop_la_LIBADD = ../libgnomevfs/libgnomevfs-2.la
+
### `nfs' method
#libnfs_la_SOURCES = \

@ -1,31 +0,0 @@
--- libgnomevfs/gnome-vfs-handle.c.orig 2005-03-07 20:34:58.000000000 -0500
+++ libgnomevfs/gnome-vfs-handle.c 2005-03-07 20:40:01.000000000 -0500
@@ -129,6 +129,8 @@ _gnome_vfs_handle_do_read (GnomeVFSHandl
GnomeVFSFileSize *bytes_read,
GnomeVFSContext *context)
{
+/* workaround to build to build with gcc 4.0 */
+#undef read
INVOKE_AND_RETURN (handle, read, (handle->uri->method, handle->method_handle,
buffer, num_bytes, bytes_read,
context));
--- modules/translate-method.c.orig 2005-03-07 21:05:39.000000000 -0500
+++ modules/translate-method.c 2005-03-07 21:06:25.000000000 -0500
@@ -572,6 +572,7 @@
GnomeVFSFileSize * bytes_read_return, GnomeVFSContext * context)
{
TranslateMethod *tm = (TranslateMethod *) method;
+#undef read
return tm->real_method->read(tm->real_method, method_handle,
buffer, num_bytes, bytes_read_return,
context);
--- modules/smb-method.c.orig 2005-03-07 21:11:06.000000000 -0500
+++ modules/smb-method.c 2005-03-07 21:07:14.000000000 -0500
@@ -1433,6 +1433,7 @@
/* Important: perform_authentication leaves and re-enters the lock! */
while (perform_authentication (&actx) > 0) {
+#undef read
n = smb_context->read (smb_context, handle->file, buffer, num_bytes);
actx.res = (n >= 0) ? GNOME_VFS_OK : gnome_vfs_result_from_errno ();
}

@ -1,637 +0,0 @@
--- libgnomevfs/gnome-vfs-hal-mounts.c.orig 2005-02-26 17:51:58.000000000 -0500
+++ libgnomevfs/gnome-vfs-hal-mounts.c 2005-02-26 16:46:28.000000000 -0500
@@ -49,16 +49,9 @@
typedef struct {
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
- HalStoragePolicy *hal_storage_policy;
+ LibHalStoragePolicy *hal_storage_policy;
} GnomeVFSHalUserData;
-static void
-_hal_mainloop_integration (LibHalContext *ctx,
- DBusConnection * dbus_connection)
-{
- dbus_connection_setup_with_g_main (dbus_connection, NULL);
-}
-
static void
_hal_device_added (LibHalContext *hal_ctx,
const char *udi)
@@ -66,16 +59,16 @@ _hal_device_added (LibHalContext *hal_ct
GnomeVFSHalUserData *hal_userdata;
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
- hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
+ hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
/* Handle optical discs without data since these are not handled
* by GNOME VFS
*/
- if (hal_device_get_property_bool (hal_ctx, udi, "volume.is_disc")) {
+ if (libhal_device_get_property_bool (hal_ctx, udi, "volume.is_disc", NULL)) {
const char *storage_udi;
- storage_udi = hal_device_get_property_string (hal_ctx, udi, "block.storage_device");
+ storage_udi = libhal_device_get_property_string (hal_ctx, udi, "block.storage_device", NULL);
if (storage_udi != NULL) {
GnomeVFSDrive *drive;
@@ -97,7 +90,7 @@ _hal_device_removed (LibHalContext *hal_
GnomeVFSHalUserData *hal_userdata;
GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
- hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
+ hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
drive = _gnome_vfs_volume_monitor_find_drive_by_hal_udi (
@@ -122,153 +115,93 @@ _hal_device_removed (LibHalContext *hal_
}
}
-static void
-_hal_device_new_capability (LibHalContext *hal_ctx,
- const char *udi,
- const char *capability)
-{
- GnomeVFSHalUserData *hal_userdata;
- GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
-
- hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
- volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
-
- /* do nothing */
-}
-
-static void
-_hal_device_lost_capability (LibHalContext *hal_ctx,
- const char *udi,
- const char *capability)
-{
- GnomeVFSHalUserData *hal_userdata;
- GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
-
- hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
- volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
- /* do nothing */
-}
-static void
-_hal_device_property_modified (LibHalContext *hal_ctx,
- const char *udi,
- const char *key,
- dbus_bool_t is_removed,
- dbus_bool_t is_added)
-{
- GnomeVFSHalUserData *hal_userdata;
- GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
-
- hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
- volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
-
- /* do nothing */
-}
-
-static void
-_hal_device_condition (LibHalContext *hal_ctx,
- const char *udi,
- const char *condition_name,
- DBusMessage *message)
-{
- GnomeVFSHalUserData *hal_userdata;
- GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
-
- hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
- volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
-
- /* do nothing */
-}
-
-static LibHalFunctions
-hal_functions = { _hal_mainloop_integration,
- _hal_device_added,
- _hal_device_removed,
- _hal_device_new_capability,
- _hal_device_lost_capability,
- _hal_device_property_modified,
- _hal_device_condition };
-
-static HalStoragePolicyIconPair icon_mapping[] = {
- {HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IDE, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_SCSI, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_USB, "gnome-dev-removable-usb"},
- {HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IEEE1394, "gnome-dev-removable-1394"},
- {HAL_STORAGE_ICON_DRIVE_DISK, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_DISK_IDE, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_DISK_SCSI, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_DISK_USB, "gnome-dev-removable-usb"},
- {HAL_STORAGE_ICON_DRIVE_DISK_IEEE1394, "gnome-dev-removable-1394"},
- {HAL_STORAGE_ICON_DRIVE_CDROM, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_CDROM_IDE, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_CDROM_SCSI, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_CDROM_USB, "gnome-dev-removable-usb"},
- {HAL_STORAGE_ICON_DRIVE_CDROM_IEEE1394, "gnome-dev-removable-1394"},
- {HAL_STORAGE_ICON_DRIVE_FLOPPY, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_FLOPPY_IDE, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_FLOPPY_SCSI, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_FLOPPY_USB, "gnome-dev-removable-usb"},
- {HAL_STORAGE_ICON_DRIVE_FLOPPY_IEEE1394, "gnome-dev-removable-1394"},
- {HAL_STORAGE_ICON_DRIVE_TAPE, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_COMPACT_FLASH, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_MEMORY_STICK, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_SMART_MEDIA, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_SD_MMC, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_CAMERA, "gnome-dev-removable"},
- {HAL_STORAGE_ICON_DRIVE_PORTABLE_AUDIO_PLAYER, "gnome-dev-removable"},
-
- {HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK, "gnome-dev-harddisk"},
- {HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IDE, "gnome-dev-harddisk"},
- {HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_SCSI, "gnome-dev-harddisk"},
- {HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_USB, "gnome-dev-harddisk-usb"},
- {HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IEEE1394, "gnome-dev-harddisk-1394"},
- {HAL_STORAGE_ICON_VOLUME_DISK, "gnome-dev-harddisk"},
- {HAL_STORAGE_ICON_VOLUME_DISK_IDE, "gnome-dev-harddisk"},
- {HAL_STORAGE_ICON_VOLUME_DISK_SCSI, "gnome-dev-harddisk"},
- {HAL_STORAGE_ICON_VOLUME_DISK_USB, "gnome-dev-harddisk-usb"},
- {HAL_STORAGE_ICON_VOLUME_DISK_IEEE1394, "gnome-dev-harddisk-1394"},
- {HAL_STORAGE_ICON_VOLUME_CDROM, "gnome-dev-cdrom"},
- {HAL_STORAGE_ICON_VOLUME_CDROM_IDE, "gnome-dev-cdrom"},
- {HAL_STORAGE_ICON_VOLUME_CDROM_SCSI, "gnome-dev-cdrom"},
- {HAL_STORAGE_ICON_VOLUME_CDROM_USB, "gnome-dev-cdrom"},
- {HAL_STORAGE_ICON_VOLUME_CDROM_IEEE1394, "gnome-dev-cdrom"},
- {HAL_STORAGE_ICON_VOLUME_FLOPPY, "gnome-dev-floppy"},
- {HAL_STORAGE_ICON_VOLUME_FLOPPY_IDE, "gnome-dev-floppy"},
- {HAL_STORAGE_ICON_VOLUME_FLOPPY_SCSI, "gnome-dev-floppy"},
- {HAL_STORAGE_ICON_VOLUME_FLOPPY_USB, "gnome-dev-floppy"},
- {HAL_STORAGE_ICON_VOLUME_FLOPPY_IEEE1394, "gnome-dev-floppy"},
- {HAL_STORAGE_ICON_VOLUME_TAPE, "gnome-dev-harddisk"},
- {HAL_STORAGE_ICON_VOLUME_COMPACT_FLASH, "gnome-dev-media-cf"},
- {HAL_STORAGE_ICON_VOLUME_MEMORY_STICK, "gnome-dev-media-ms"},
- {HAL_STORAGE_ICON_VOLUME_SMART_MEDIA, "gnome-dev-media-sm"},
- {HAL_STORAGE_ICON_VOLUME_SD_MMC, "gnome-dev-media-sdmmc"},
- {HAL_STORAGE_ICON_VOLUME_CAMERA, "camera"},
- {HAL_STORAGE_ICON_VOLUME_PORTABLE_AUDIO_PLAYER, "gnome-dev-ipod"},
-
- {HAL_STORAGE_ICON_DISC_CDROM, "gnome-dev-cdrom"},
- {HAL_STORAGE_ICON_DISC_CDR, "gnome-dev-cdrom"},
- {HAL_STORAGE_ICON_DISC_CDRW, "gnome-dev-cdrom"},
- {HAL_STORAGE_ICON_DISC_DVDROM, "gnome-dev-dvd"},
- {HAL_STORAGE_ICON_DISC_DVDRAM, "gnome-dev-dvd"},
- {HAL_STORAGE_ICON_DISC_DVDR, "gnome-dev-dvd"},
- {HAL_STORAGE_ICON_DISC_DVDRW, "gnome-dev-dvd"},
- {HAL_STORAGE_ICON_DISC_DVDPLUSR, "gnome-dev-dvd"},
- {HAL_STORAGE_ICON_DISC_DVDPLUSRW, "gnome-dev-dvd"},
+static LibHalStoragePolicyIconPair icon_mapping[] = {
+ {LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IDE, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_SCSI, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_USB, "gnome-dev-removable-usb"},
+ {LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IEEE1394, "gnome-dev-removable-1394"},
+ {LIBHAL_STORAGE_ICON_DRIVE_DISK, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_DISK_IDE, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_DISK_SCSI, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_DISK_USB, "gnome-dev-removable-usb"},
+ {LIBHAL_STORAGE_ICON_DRIVE_DISK_IEEE1394, "gnome-dev-removable-1394"},
+ {LIBHAL_STORAGE_ICON_DRIVE_CDROM, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_CDROM_IDE, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_CDROM_SCSI, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_CDROM_USB, "gnome-dev-removable-usb"},
+ {LIBHAL_STORAGE_ICON_DRIVE_CDROM_IEEE1394, "gnome-dev-removable-1394"},
+ {LIBHAL_STORAGE_ICON_DRIVE_FLOPPY, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_IDE, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_SCSI, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_USB, "gnome-dev-removable-usb"},
+ {LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_IEEE1394, "gnome-dev-removable-1394"},
+ {LIBHAL_STORAGE_ICON_DRIVE_TAPE, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_COMPACT_FLASH, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_MEMORY_STICK, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_SMART_MEDIA, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_SD_MMC, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_CAMERA, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_PORTABLE_AUDIO_PLAYER, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_ZIP, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_JAZ, "gnome-dev-removable"},
+ {LIBHAL_STORAGE_ICON_DRIVE_FLASH_KEY, "gnome-dev-removable"},
+
+ {LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK, "gnome-dev-harddisk"},
+ {LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IDE, "gnome-dev-harddisk"},
+ {LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_SCSI, "gnome-dev-harddisk"},
+ {LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_USB, "gnome-dev-harddisk-usb"},
+ {LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IEEE1394, "gnome-dev-harddisk-1394"},
+ {LIBHAL_STORAGE_ICON_VOLUME_DISK, "gnome-dev-harddisk"},
+ {LIBHAL_STORAGE_ICON_VOLUME_DISK_IDE, "gnome-dev-harddisk"},
+ {LIBHAL_STORAGE_ICON_VOLUME_DISK_SCSI, "gnome-dev-harddisk"},
+ {LIBHAL_STORAGE_ICON_VOLUME_DISK_USB, "gnome-dev-harddisk-usb"},
+ {LIBHAL_STORAGE_ICON_VOLUME_DISK_IEEE1394, "gnome-dev-harddisk-1394"},
+ {LIBHAL_STORAGE_ICON_VOLUME_CDROM, "gnome-dev-cdrom"},
+ {LIBHAL_STORAGE_ICON_VOLUME_CDROM_IDE, "gnome-dev-cdrom"},
+ {LIBHAL_STORAGE_ICON_VOLUME_CDROM_SCSI, "gnome-dev-cdrom"},
+ {LIBHAL_STORAGE_ICON_VOLUME_CDROM_USB, "gnome-dev-cdrom"},
+ {LIBHAL_STORAGE_ICON_VOLUME_CDROM_IEEE1394, "gnome-dev-cdrom"},
+ {LIBHAL_STORAGE_ICON_VOLUME_FLOPPY, "gnome-dev-floppy"},
+ {LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_IDE, "gnome-dev-floppy"},
+ {LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_SCSI, "gnome-dev-floppy"},
+ {LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_USB, "gnome-dev-floppy"},
+ {LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_IEEE1394, "gnome-dev-floppy"},
+ {LIBHAL_STORAGE_ICON_VOLUME_TAPE, "gnome-dev-harddisk"},
+ {LIBHAL_STORAGE_ICON_VOLUME_COMPACT_FLASH, "gnome-dev-media-cf"},
+ {LIBHAL_STORAGE_ICON_VOLUME_MEMORY_STICK, "gnome-dev-media-ms"},
+ {LIBHAL_STORAGE_ICON_VOLUME_SMART_MEDIA, "gnome-dev-media-sm"},
+ {LIBHAL_STORAGE_ICON_VOLUME_SD_MMC, "gnome-dev-media-sdmmc"},
+ {LIBHAL_STORAGE_ICON_VOLUME_CAMERA, "camera"},
+ {LIBHAL_STORAGE_ICON_VOLUME_PORTABLE_AUDIO_PLAYER, "gnome-dev-ipod"},
+ {LIBHAL_STORAGE_ICON_VOLUME_ZIP, "gnome-dev-zipdisk"},
+ {LIBHAL_STORAGE_ICON_VOLUME_JAZ, "gnome-dev-jazdisk"},
+ {LIBHAL_STORAGE_ICON_VOLUME_FLASH_KEY, "gnome-dev-harddisk"},
/*
- {HAL_STORAGE_ICON_DISC_CDROM, "gnome-dev-disc-cdrom"},
- {HAL_STORAGE_ICON_DISC_CDR, "gnome-dev-disc-cdr"},
- {HAL_STORAGE_ICON_DISC_CDRW, "gnome-dev-disc-cdrw"},
- {HAL_STORAGE_ICON_DISC_DVDROM, "gnome-dev-disc-dvdrom"},
- {HAL_STORAGE_ICON_DISC_DVDRAM, "gnome-dev-disc-dvdram"},
- {HAL_STORAGE_ICON_DISC_DVDR, "gnome-dev-disc-dvdr"},
- {HAL_STORAGE_ICON_DISC_DVDRW, "gnome-dev-disc-dvdrw"},
- {HAL_STORAGE_ICON_DISC_DVDPLUSR, "gnome-dev-disc-dvdr-plus"},
- {HAL_STORAGE_ICON_DISC_DVDPLUSRW, "gnome-dev-disc-dvdrw-plus"},
+ {LIBHAL_STORAGE_ICON_DISC_CDROM, "gnome-dev-cdrom"},
+ {LIBHAL_STORAGE_ICON_DISC_CDR, "gnome-dev-cdrom"},
+ {LIBHAL_STORAGE_ICON_DISC_CDRW, "gnome-dev-cdrom"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDROM, "gnome-dev-dvd"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDRAM, "gnome-dev-dvd"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDR, "gnome-dev-dvd"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDRW, "gnome-dev-dvd"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDPLUSR, "gnome-dev-dvd"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDPLUSRW, "gnome-dev-dvd"},
*/
+ {LIBHAL_STORAGE_ICON_DISC_CDROM, "gnome-dev-cdrom"},
+ {LIBHAL_STORAGE_ICON_DISC_CDR, "gnome-dev-disc-cdr"},
+ {LIBHAL_STORAGE_ICON_DISC_CDRW, "gnome-dev-disc-cdrw"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDROM, "gnome-dev-disc-dvdrom"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDRAM, "gnome-dev-disc-dvdram"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDR, "gnome-dev-disc-dvdr"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDRW, "gnome-dev-disc-dvdrw"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDPLUSR, "gnome-dev-disc-dvdr-plus"},
+ {LIBHAL_STORAGE_ICON_DISC_DVDPLUSRW, "gnome-dev-disc-dvdrw"}, /* missing -plus icon here! */
+
{0x00, NULL}
};
@@ -276,26 +209,52 @@ static HalStoragePolicyIconPair icon_map
gboolean
_gnome_vfs_hal_mounts_init (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon)
{
+ DBusError error;
+ DBusConnection *dbus_connection;
GnomeVFSHalUserData *hal_userdata;
- HalStoragePolicy *hal_storage_policy;
+ LibHalStoragePolicy *hal_storage_policy;
/* Initialise the connection to the hal daemon */
if ((volume_monitor_daemon->hal_ctx =
- hal_initialize (&hal_functions, FALSE)) == NULL) {
- g_warning ("hal_initialize failed\n");
+ libhal_ctx_new ()) == NULL) {
+ g_warning ("libhal_ctx_new failed\n");
+ return FALSE;
+ }
+
+ dbus_error_init (&error);
+ dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (dbus_error_is_set (&error)) {
+ g_warning ("Error connecting to D-BUS system bus: %s\n",
+ error.message);
+ dbus_error_free (&error);
+ return FALSE;
+ }
+ dbus_connection_setup_with_g_main (dbus_connection, NULL);
+
+ libhal_ctx_set_dbus_connection (volume_monitor_daemon->hal_ctx,
+ dbus_connection);
+
+ libhal_ctx_set_device_added (volume_monitor_daemon->hal_ctx,
+ _hal_device_added);
+ libhal_ctx_set_device_removed (volume_monitor_daemon->hal_ctx,
+ _hal_device_removed);
+
+ if (!libhal_ctx_init (volume_monitor_daemon->hal_ctx, &error)) {
+ g_warning ("libhal_ctx_init failed: %s\n", error.message);
+ dbus_error_free (&error);
return FALSE;
}
/* Setup GNOME specific policy - right now this is only icons */
- hal_storage_policy = hal_storage_policy_new ();
- hal_storage_policy_set_icon_mapping (hal_storage_policy, icon_mapping);
+ hal_storage_policy = libhal_storage_policy_new ();
+ libhal_storage_policy_set_icon_mapping (hal_storage_policy, icon_mapping);
/* Tie some data with the libhal context */
hal_userdata = g_new0 (GnomeVFSHalUserData, 1);
hal_userdata->volume_monitor_daemon = volume_monitor_daemon;
hal_userdata->hal_storage_policy = hal_storage_policy;
- hal_ctx_set_user_data (volume_monitor_daemon->hal_ctx,
+ libhal_ctx_set_user_data (volume_monitor_daemon->hal_ctx,
hal_userdata);
return TRUE;
}
@@ -304,13 +263,22 @@ void
_gnome_vfs_hal_mounts_shutdown (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon)
{
GnomeVFSHalUserData *hal_userdata;
+ DBusError error;
+
+ hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (volume_monitor_daemon->hal_ctx);
+ libhal_storage_policy_free (hal_userdata->hal_storage_policy);
- hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (volume_monitor_daemon->hal_ctx);
- hal_storage_policy_free (hal_userdata->hal_storage_policy);
+ dbus_error_init (&error);
+ if (!libhal_ctx_shutdown (volume_monitor_daemon->hal_ctx, &error)) {
+ g_warning ("hal_shutdown failed: %s\n", error.message);
+ dbus_error_free (&error);
+ return;
+ }
- if (hal_shutdown (volume_monitor_daemon->hal_ctx) != 0) {
- g_warning ("hal_shutdown failed\n");
+ if (!libhal_ctx_free (volume_monitor_daemon->hal_ctx)) {
+ g_warning ("hal_shutdown failed - unable to free hal context\n");
}
+
}
/**************************************************************************/
@@ -330,10 +298,10 @@ _gnome_vfs_hal_mounts_modify_drive (Gnom
char *drive_icon;
char *unique_drive_name;
LibHalContext *hal_ctx;
- HalDrive *hal_drive;
- HalVolume *hal_volume;
+ LibHalDrive *hal_drive;
+ LibHalVolume *hal_volume;
GnomeVFSHalUserData *hal_userdata;
- HalStoragePolicy *hal_storage_policy;
+ LibHalStoragePolicy *hal_storage_policy;
char *target_mount_point;
hal_drive = NULL;
@@ -342,7 +310,7 @@ _gnome_vfs_hal_mounts_modify_drive (Gnom
if ((hal_ctx = volume_monitor_daemon->hal_ctx) == NULL)
goto out;
- hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
+ hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
hal_storage_policy = hal_userdata->hal_storage_policy;
if (drive == NULL || drive->priv == NULL || drive->priv->device_path == NULL)
@@ -352,21 +320,21 @@ _gnome_vfs_hal_mounts_modify_drive (Gnom
* /dev/sda1 etc, however we get the Drive object for the parent if
* that is the case. This is a feature of libhal-storage.
*/
- if ((hal_drive = hal_drive_from_device_file (hal_ctx, drive->priv->device_path)) == NULL) {
+ if ((hal_drive = libhal_drive_from_device_file (hal_ctx, drive->priv->device_path)) == NULL) {
g_warning ("%s: no hal drive for device=%s", __FUNCTION__, drive->priv->device_path);
goto out;
}
/* There may not be a volume object associated, so hal_volume may be NULL */
- hal_volume = hal_volume_from_device_file (hal_ctx, drive->priv->device_path);
+ hal_volume = libhal_volume_from_device_file (hal_ctx, drive->priv->device_path);
/* For optical discs, we manually add/remove GnomeVFSVolume optical discs without
* data (e.g. blank and pure audio) since these don't appear in the mounted filesystems
* file /etc/mtab
*/
if (hal_volume != NULL &&
- hal_drive_get_type (hal_drive) == HAL_DRIVE_TYPE_CDROM &&
- hal_volume_is_disc (hal_volume) && !hal_volume_disc_has_data (hal_volume)) {
+ libhal_drive_get_type (hal_drive) == LIBHAL_DRIVE_TYPE_CDROM &&
+ libhal_volume_is_disc (hal_volume) && !libhal_volume_disc_has_data (hal_volume)) {
GnomeVFSVolume *volume;
char *volume_name;
char *volume_icon;
@@ -377,35 +345,35 @@ _gnome_vfs_hal_mounts_modify_drive (Gnom
gnome_vfs_volume_unref (volume);
} else {
- volume_name = hal_volume_policy_compute_display_name (
+ volume_name = libhal_volume_policy_compute_display_name (
hal_drive, hal_volume, hal_storage_policy);
/* set icon name; try dedicated icon name first... */
- if (hal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
- volume_icon = strdup (hal_drive_get_dedicated_icon_volume (hal_drive));
+ if (libhal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
+ volume_icon = strdup (libhal_drive_get_dedicated_icon_volume (hal_drive));
else
- volume_icon = hal_volume_policy_compute_icon_name (
+ volume_icon = libhal_volume_policy_compute_icon_name (
hal_drive, hal_volume, hal_storage_policy);
volume = g_object_new (GNOME_VFS_TYPE_VOLUME, NULL);
- volume->priv->hal_udi = g_strdup (hal_volume_get_udi (hal_volume));
+ volume->priv->hal_udi = g_strdup (libhal_volume_get_udi (hal_volume));
volume->priv->volume_type = GNOME_VFS_VOLUME_TYPE_MOUNTPOINT;
- if (hal_volume_disc_is_blank (hal_volume)) {
+ if (libhal_volume_disc_is_blank (hal_volume)) {
/* Blank discs should open the burn:/// location */
- volume->priv->device_path = g_strdup (hal_volume_get_device_file (hal_volume));
+ volume->priv->device_path = g_strdup (libhal_volume_get_device_file (hal_volume));
volume->priv->activation_uri = g_strdup ("burn:///");
- volume->priv->unix_device = makedev (hal_volume_get_device_major (hal_volume),
- hal_volume_get_device_minor (hal_volume));
- volume->priv->filesystem_type = g_strdup (hal_volume_get_fstype (hal_volume));
- } else if (hal_volume_disc_has_audio (hal_volume)) {
+ volume->priv->unix_device = makedev (libhal_volume_get_device_major (hal_volume),
+ libhal_volume_get_device_minor (hal_volume));
+ volume->priv->filesystem_type = g_strdup (libhal_volume_get_fstype (hal_volume));
+ } else if (libhal_volume_disc_has_audio (hal_volume)) {
/* Audio discs with data should open the cdda:///dev/cdrom location */
- volume->priv->device_path = g_strdup (hal_volume_get_device_file (hal_volume));
+ volume->priv->device_path = g_strdup (libhal_volume_get_device_file (hal_volume));
volume->priv->activation_uri = g_strdup_printf (
- "cdda://%s", hal_volume_get_device_file (hal_volume));
- volume->priv->unix_device = makedev (hal_volume_get_device_major (hal_volume),
- hal_volume_get_device_minor (hal_volume));
- volume->priv->filesystem_type = g_strdup (hal_volume_get_fstype (hal_volume));
+ "cdda://%s", libhal_volume_get_device_file (hal_volume));
+ volume->priv->unix_device = makedev (libhal_volume_get_device_major (hal_volume),
+ libhal_volume_get_device_minor (hal_volume));
+ volume->priv->filesystem_type = g_strdup (libhal_volume_get_fstype (hal_volume));
}
volume->priv->is_read_only = TRUE;
@@ -419,6 +387,7 @@ _gnome_vfs_hal_mounts_modify_drive (Gnom
volume->priv->is_user_visible = TRUE;
volume->priv->drive = drive;
+
_gnome_vfs_drive_add_mounted_volume (drive, volume);
_gnome_vfs_volume_monitor_mounted (GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), volume);
@@ -427,7 +396,7 @@ _gnome_vfs_hal_mounts_modify_drive (Gnom
free (volume_name);
free (volume_icon);
}
- } else if (hal_volume == NULL && hal_drive_get_type (hal_drive) == HAL_DRIVE_TYPE_CDROM) {
+ } else if (hal_volume == NULL && libhal_drive_get_type (hal_drive) == LIBHAL_DRIVE_TYPE_CDROM) {
GnomeVFSVolume *volume;
/* Remove GnomeVFSVolume with same device file */
@@ -444,10 +413,10 @@ _gnome_vfs_hal_mounts_modify_drive (Gnom
goto out;
/* set whether we need to eject */
- drive->priv->must_eject_at_unmount = hal_drive_requires_eject (hal_drive);
+ drive->priv->must_eject_at_unmount = libhal_drive_requires_eject (hal_drive);
/* set display name */
- drive_name = hal_drive_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
+ drive_name = libhal_drive_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
unique_drive_name = _gnome_vfs_volume_monitor_uniquify_drive_name (
GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), drive_name);
if (drive->priv->display_name != NULL)
@@ -456,10 +425,10 @@ _gnome_vfs_hal_mounts_modify_drive (Gnom
free (drive_name);
/* set icon name; try dedicated icon name first... */
- if (hal_drive_get_dedicated_icon_drive (hal_drive) != NULL)
- drive_icon = strdup (hal_drive_get_dedicated_icon_drive (hal_drive));
+ if (libhal_drive_get_dedicated_icon_drive (hal_drive) != NULL)
+ drive_icon = strdup (libhal_drive_get_dedicated_icon_drive (hal_drive));
else
- drive_icon = hal_drive_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
+ drive_icon = libhal_drive_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
if (drive->priv->icon != NULL)
g_free (drive->priv->icon);
drive->priv->icon = g_strdup (drive_icon);
@@ -469,7 +438,7 @@ _gnome_vfs_hal_mounts_modify_drive (Gnom
target_mount_point = NULL;
if (hal_volume != NULL) {
const char *str;
- str = hal_volume_get_mount_point (hal_volume);
+ str = libhal_volume_get_mount_point (hal_volume);
if (str != NULL)
target_mount_point = g_strdup (str);
}
@@ -479,18 +448,18 @@ _gnome_vfs_hal_mounts_modify_drive (Gnom
target_mount_point = gnome_vfs_get_local_path_from_uri (drive->priv->activation_uri);
/* if we don't use removable media and the volume shouldn't be visible, then hide the drive */
- if(!hal_drive_uses_removable_media (hal_drive) &&
- !hal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point))
+ if(!libhal_drive_uses_removable_media (hal_drive) &&
+ !libhal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point))
drive->priv->is_user_visible = FALSE;
g_free (target_mount_point);
/* set hal udi */
- drive->priv->hal_udi = g_strdup (hal_drive_get_udi (hal_drive));
+ drive->priv->hal_udi = g_strdup (libhal_drive_get_udi (hal_drive));
out:
- hal_volume_free (hal_volume);
- hal_drive_free (hal_drive);
+ libhal_volume_free (hal_volume);
+ libhal_drive_free (hal_drive);
}
void
@@ -501,10 +470,10 @@ _gnome_vfs_hal_mounts_modify_volume (Gno
char *volume_icon;
char *unique_volume_name;
LibHalContext *hal_ctx;
- HalDrive *hal_drive;
- HalVolume *hal_volume;
+ LibHalDrive *hal_drive;
+ LibHalVolume *hal_volume;
GnomeVFSHalUserData *hal_userdata;
- HalStoragePolicy *hal_storage_policy;
+ LibHalStoragePolicy *hal_storage_policy;
char *target_mount_point;
hal_volume = NULL;
@@ -515,7 +484,7 @@ _gnome_vfs_hal_mounts_modify_volume (Gno
if (volume == NULL || volume->priv == NULL || volume->priv->device_path == NULL)
goto out;
- hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
+ hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
hal_storage_policy = hal_userdata->hal_storage_policy;
/* Now, modify the drive with the hal stuff, unless we've already done so */
@@ -526,17 +495,17 @@ _gnome_vfs_hal_mounts_modify_volume (Gno
* /dev/sda1 etc, however we get the Drive object for the parent if
* that is the case. This is a feature of libhal-storage.
*/
- if ((hal_drive = hal_drive_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
+ if ((hal_drive = libhal_drive_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
g_warning ("%s: no hal drive for device=%s", __FUNCTION__, volume->priv->device_path);
goto out;
}
- if ((hal_volume = hal_volume_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
+ if ((hal_volume = libhal_volume_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
g_warning ("%s: no hal volume for device=%s", __FUNCTION__, volume->priv->device_path);
goto out;
}
/* set display name */
- volume_name = hal_volume_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
+ volume_name = libhal_volume_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
unique_volume_name = _gnome_vfs_volume_monitor_uniquify_volume_name (
GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), volume_name);
if (volume->priv->display_name != NULL)
@@ -545,10 +514,10 @@ _gnome_vfs_hal_mounts_modify_volume (Gno
free (volume_name);
/* set icon name; try dedicated icon name first... */
- if (hal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
- volume_icon = strdup (hal_drive_get_dedicated_icon_volume (hal_drive));
+ if (libhal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
+ volume_icon = strdup (libhal_drive_get_dedicated_icon_volume (hal_drive));
else
- volume_icon = hal_volume_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
+ volume_icon = libhal_volume_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
if (volume->priv->icon != NULL)
g_free (volume->priv->icon);
volume->priv->icon = g_strdup (volume_icon);
@@ -558,7 +527,7 @@ _gnome_vfs_hal_mounts_modify_volume (Gno
target_mount_point = NULL;
{
const char *str;
- str = hal_volume_get_mount_point (hal_volume);
+ str = libhal_volume_get_mount_point (hal_volume);
if (str != NULL)
target_mount_point = g_strdup (str);
}
@@ -569,16 +538,16 @@ _gnome_vfs_hal_mounts_modify_volume (Gno
/* set whether it's visible on the desktop */
volume->priv->is_user_visible =
- hal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point) &&
- (hal_drive_is_hotpluggable (hal_drive) || hal_drive_uses_removable_media (hal_drive));
+ libhal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point) &&
+ (libhal_drive_is_hotpluggable (hal_drive) || libhal_drive_uses_removable_media (hal_drive));
g_free (target_mount_point);
/* set hal udi */
- volume->priv->hal_udi = g_strdup (hal_volume_get_udi (hal_volume));
+ volume->priv->hal_udi = g_strdup (libhal_volume_get_udi (hal_volume));
out:
- hal_drive_free (hal_drive);
- hal_volume_free (hal_volume);
+ libhal_drive_free (hal_drive);
+ libhal_volume_free (hal_volume);
}
#endif /* USE_HAL */

@ -1,36 +0,0 @@
Index: libgnomevfs/gnome-vfs-module-callback.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-module-callback.c,v
retrieving revision 1.10
diff -u -p -r1.10 gnome-vfs-module-callback.c
--- libgnomevfs/gnome-vfs-module-callback.c 14 Nov 2005 11:41:13 -0000 1.10
+++ libgnomevfs/gnome-vfs-module-callback.c 7 Nov 2006 09:03:37 -0000
@@ -411,11 +411,17 @@ stack_table_destroy (gpointer specific)
stack_table = specific;
g_static_mutex_lock (&callback_table_lock);
- g_hash_table_remove (stack_tables_to_free, stack_table);
+ if (stack_tables_to_free != NULL) {
+ g_hash_table_remove (stack_tables_to_free, stack_table);
+ } else {
+ stack_table = NULL;
+ }
g_static_mutex_unlock (&callback_table_lock);
- clear_stack_table (stack_table);
- g_hash_table_destroy (stack_table);
+ if (stack_table) {
+ clear_stack_table (stack_table);
+ g_hash_table_destroy (stack_table);
+ }
}
static gboolean
@@ -440,6 +446,7 @@ free_stack_tables_to_free (void)
g_static_mutex_lock (&callback_table_lock);
g_hash_table_foreach_remove (stack_tables_to_free, stack_table_free_hr_func , NULL);
g_hash_table_destroy (stack_tables_to_free);
+ stack_tables_to_free = NULL;
g_static_mutex_unlock (&callback_table_lock);
}

@ -1,661 +0,0 @@
--- gnome-vfs-2.13.1/modules/dns-sd-method.c.avahi 2005-12-02 13:32:54.000000000 -0500
+++ gnome-vfs-2.13.1/modules/dns-sd-method.c 2005-12-02 13:33:07.000000000 -0500
@@ -31,7 +31,9 @@
#ifdef HAVE_AVAHI
#include <avahi-client/client.h>
+#include <avahi-client/lookup.h>
#include <avahi-common/error.h>
+#include <avahi-common/timeval.h>
#include <avahi-common/simple-watch.h>
#include <avahi-glib/glib-watch.h>
#endif
@@ -320,7 +322,7 @@
AvahiSimplePoll *poll;
poll = user_data;
- if (state == AVAHI_CLIENT_DISCONNECTED) {
+ if (state == AVAHI_CLIENT_FAILURE) {
avahi_simple_poll_quit (poll);
}
}
@@ -333,12 +335,18 @@
const char *name,
const char *type,
const char *domain,
+ AvahiLookupResultFlags flags,
void *user_data)
{
+ AvahiSimplePoll *poll = user_data;
+
if (event == AVAHI_BROWSER_NEW)
local_browse (TRUE, name, type, domain);
else if (event == AVAHI_BROWSER_REMOVE)
local_browse (FALSE, name, type, domain);
+ else if (event == AVAHI_BROWSER_ALL_FOR_NOW)
+ avahi_simple_poll_quit (poll);
+
}
static void
@@ -385,7 +393,7 @@
}
poll = avahi_simple_poll_get (simple_poll);
- client = avahi_client_new (poll,
+ client = avahi_client_new (poll, 0,
avahi_client_callback, simple_poll, &error);
/* Check wether creating the client object succeeded */
@@ -400,7 +408,8 @@
for (i = 0; i < G_N_ELEMENTS (dns_sd_types); i++) {
sb[i] = avahi_service_browser_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
dns_sd_types[i].type, "local",
- local_browse_callback_sync, NULL);
+ AVAHI_LOOKUP_USE_MULTICAST,
+ local_browse_callback_sync, simple_poll);
}
--- gnome-vfs-2.13.1/libgnomevfs/gnome-vfs-dns-sd.c.avahi 2005-12-02 13:32:36.000000000 -0500
+++ gnome-vfs-2.13.1/libgnomevfs/gnome-vfs-dns-sd.c 2005-12-02 13:33:21.000000000 -0500
@@ -36,6 +36,15 @@
#include <gconf/gconf-client.h>
#include <unistd.h>
+#ifdef HAVE_AVAHI
+#include <avahi-client/client.h>
+#include <avahi-client/lookup.h>
+#include <avahi-common/error.h>
+#include <avahi-common/simple-watch.h>
+#include <avahi-common/timeval.h>
+#include <avahi-glib/glib-watch.h>
+#endif
+
#ifdef HAVE_HOWL
/* Need to work around howl exporting its config file... */
#undef PACKAGE
@@ -722,6 +731,60 @@
/* multicast DNS functions */
+#ifdef HAVE_AVAHI
+static AvahiClient *global_client = NULL;
+static gboolean avahi_initialized = FALSE;
+
+static AvahiClient *get_global_avahi_client (void);
+
+/* Callback for state changes on the Client */
+static void
+avahi_client_callback (AvahiClient *client, AvahiClientState state, void *userdata)
+{
+ if (state == AVAHI_CLIENT_FAILURE) {
+ if (avahi_client_errno (client) == AVAHI_ERR_DISCONNECTED) {
+ /* Destroy old client */
+ avahi_client_free (client);
+ global_client = NULL;
+ avahi_initialized = FALSE;
+
+ /* Reconnect */
+ get_global_avahi_client ();
+ }
+ }
+}
+
+static AvahiClient *
+get_global_avahi_client (void) {
+ static AvahiGLibPoll *glib_poll = NULL;
+ int error;
+
+ if (!avahi_initialized) {
+ if (glib_poll == NULL) {
+ glib_poll = avahi_glib_poll_new (NULL, G_PRIORITY_DEFAULT);
+ }
+
+ /* Create a new AvahiClient instance */
+ global_client = avahi_client_new (avahi_glib_poll_get (glib_poll),
+ AVAHI_CLIENT_NO_FAIL,
+ avahi_client_callback,
+ glib_poll,
+ &error);
+
+ if (global_client == NULL) {
+ /* Print out the error string */
+ g_warning ("Error initializing Avahi: %s", avahi_strerror (error));
+ avahi_glib_poll_free (glib_poll);
+ glib_poll = NULL;
+ return NULL;
+ }
+ avahi_initialized = TRUE;
+ }
+
+ return global_client;
+}
+#endif
+
#ifdef HAVE_HOWL
static gboolean
@@ -788,6 +851,10 @@
/* multicast: */
+#ifdef HAVE_AVAHI
+ AvahiServiceBrowser *avahi_sb;
+#endif
+
#ifdef HAVE_HOWL
sw_discovery_oid howl_id;
#endif
@@ -864,6 +931,41 @@
return NULL;
}
+#ifdef HAVE_AVAHI
+static void
+avahi_browse_callback (AvahiServiceBrowser *b,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiBrowserEvent event,
+ const char *name,
+ const char *type,
+ const char *domain,
+ AvahiLookupResultFlags flags,
+ void *userdata)
+{
+ GnomeVFSDNSSDBrowseHandle *handle;
+ GnomeVFSDNSSDService service;
+ handle = userdata;
+
+ service.name = (char *)name;
+ service.type = (char *)type;
+ service.domain = (char *)domain;
+
+ if (event == AVAHI_BROWSER_FAILURE ||
+ event == AVAHI_BROWSER_ALL_FOR_NOW ||
+ event == AVAHI_BROWSER_CACHE_EXHAUSTED) {
+ return;
+ }
+
+ if (!handle->cancelled) {
+ handle->callback (handle,
+ (event == AVAHI_BROWSER_NEW) ? GNOME_VFS_DNS_SD_SERVICE_ADDED : GNOME_VFS_DNS_SD_SERVICE_REMOVED,
+ &service,
+ handle->callback_data);
+ }
+}
+#endif
+
#ifdef HAVE_HOWL
struct howl_browse_idle_data {
@@ -1012,7 +1114,25 @@
handle->callback_data_destroy_func = callback_data_destroy_func;
if (strcmp (domain, "local") == 0) {
-#ifdef HAVE_HOWL
+#ifdef HAVE_AVAHI
+ AvahiClient *client;
+ AvahiServiceBrowser *sb;
+
+ handle->is_local = TRUE;
+ client = get_global_avahi_client ();
+ if (client) {
+ sb = avahi_service_browser_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, type, NULL,
+ AVAHI_LOOKUP_USE_MULTICAST,
+ avahi_browse_callback, handle);
+ if (sb != NULL) {
+ handle->avahi_sb = sb;
+ *handle_out = handle;
+ return GNOME_VFS_OK;
+ }
+ g_warning ("Failed to create service browser: %s\n", avahi_strerror( avahi_client_errno (client)));
+ }
+ return GNOME_VFS_ERROR_GENERIC;
+#elif defined (HAVE_HOWL)
sw_result res;
sw_discovery session;
@@ -1063,6 +1183,11 @@
gnome_vfs_dns_sd_stop_browse (GnomeVFSDNSSDBrowseHandle *handle)
{
if (handle->is_local) {
+#ifdef HAVE_AVAHI
+ handle->cancelled = TRUE;
+ avahi_service_browser_free (handle->avahi_sb);
+ free_browse_handle (handle);
+#endif
#ifdef HAVE_HOWL
handle->cancelled = TRUE;
sw_discovery_cancel (get_global_howl_session (), handle->howl_id);
@@ -1093,6 +1218,10 @@
int text_len;
/* multicast: */
+#ifdef HAVE_AVAHI
+ AvahiServiceResolver *avahi_sr;
+#endif
+
#ifdef HAVE_HOWL
sw_discovery_oid howl_id;
guint timeout_tag;
@@ -1174,6 +1303,71 @@
return NULL;
}
+#ifdef HAVE_AVAHI
+static void
+avahi_resolve_async_callback (AvahiServiceResolver *r,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiResolverEvent event,
+ const char *name,
+ const char *type,
+ const char *domain,
+ const char *host_name,
+ const AvahiAddress *address,
+ uint16_t port,
+ AvahiStringList *txt,
+ AvahiLookupResultFlags flags,
+ void *user_data)
+{
+ GnomeVFSDNSSDResolveHandle *handle;
+ GnomeVFSDNSSDService service;
+ GHashTable *hash;
+ size_t text_len;
+ char *text;
+ char host[128];
+
+ handle = user_data;
+ if (event == AVAHI_RESOLVER_FOUND) {
+ text_len = avahi_string_list_serialize (txt, NULL, 0);
+ text = g_malloc (text_len);
+ text_len = avahi_string_list_serialize (txt, text, text_len);
+
+ hash = decode_txt_record (text, text_len);
+
+ service.name = (char *)name;
+ service.type = (char *)type;
+ service.domain = (char *)domain;
+
+ avahi_address_snprint (host, sizeof(host), address);
+ handle->callback (handle,
+ GNOME_VFS_OK,
+ &service,
+ host,
+ port,
+ hash,
+ handle->text_len,
+ handle->text,
+ handle->callback_data);
+ if (hash) {
+ g_hash_table_destroy (hash);
+ }
+ g_free (text);
+
+ } else if (event == AVAHI_RESOLVER_FAILURE) {
+ handle->callback (handle,
+ GNOME_VFS_ERROR_HOST_NOT_FOUND,
+ NULL,
+ NULL, 0,
+ NULL, 0, NULL,
+ handle->callback_data);
+ }
+
+ avahi_service_resolver_free (r);
+ free_resolve_handle (handle);
+}
+
+#endif
+
#ifdef HAVE_HOWL
static gboolean
@@ -1329,7 +1523,25 @@
handle->callback_data_destroy_func = callback_data_destroy_func;
if (strcmp (domain, "local") == 0) {
-#ifdef HAVE_HOWL
+#ifdef HAVE_AVAHI
+ AvahiClient *client;
+ AvahiServiceResolver *sr;
+
+ handle->is_local = TRUE;
+ client = get_global_avahi_client ();
+ if (client) {
+ sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
+ name, type, domain, AVAHI_PROTO_UNSPEC,
+ AVAHI_LOOKUP_USE_MULTICAST,
+ avahi_resolve_async_callback, handle);
+ if (sr != NULL) {
+ handle->avahi_sr = sr;
+ *handle_out = handle;
+ return GNOME_VFS_OK;
+ }
+ }
+ return GNOME_VFS_ERROR_GENERIC;
+#elif defined (HAVE_HOWL)
sw_result res;
sw_discovery session;
@@ -1386,6 +1598,10 @@
gnome_vfs_dns_sd_cancel_resolve (GnomeVFSDNSSDResolveHandle *handle)
{
if (handle->is_local) {
+#ifdef HAVE_AVAHI
+ avahi_service_resolver_free (handle->avahi_sr);
+ free_resolve_handle (handle);
+#endif
#ifdef HAVE_HOWL
g_source_remove (handle->timeout_tag);
if (handle->idle_tag) {
@@ -1408,8 +1624,7 @@
}
}
-
-#ifdef HAVE_HOWL
+#if defined(HAVE_AVAHI) || defined(HAVE_HOWL)
static int
find_existing_service (GArray *array,
const char *name,
@@ -1430,6 +1645,89 @@
return -1;
}
+#endif
+
+
+#ifdef HAVE_AVAHI
+struct sync_browse_data {
+ AvahiSimplePoll *poll;
+ GArray *array;
+};
+
+static void
+avahi_browse_sync_client_callback (AvahiClient *client, AvahiClientState state, void *user_data)
+{
+ struct sync_browse_data *data;
+
+ data = user_data;
+ if (state == AVAHI_CLIENT_FAILURE) {
+ avahi_simple_poll_quit (data->poll);
+ }
+}
+
+static void
+avahi_browse_sync_callback (AvahiServiceBrowser *b,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiBrowserEvent event,
+ const char *name,
+ const char *type,
+ const char *domain,
+ AvahiLookupResultFlags flags,
+ void *user_data)
+{
+ struct sync_browse_data *data;
+ GnomeVFSDNSSDService service, *existing;
+ int i;
+ gboolean free_service;
+
+ data = user_data;
+
+ free_service = TRUE;
+ service.name = g_strdup (name);
+ service.type = g_strdup (type);
+ service.domain = g_strdup (domain);
+
+ if (event == AVAHI_BROWSER_NEW) {
+ if (find_existing_service (data->array, service.name, service.type,
+ service.domain) == -1) {
+ free_service = FALSE;
+ g_array_append_val (data->array, service);
+ }
+ } else if (event == AVAHI_BROWSER_REMOVE) {
+ i = find_existing_service (data->array, service.name, service.type,
+ service.domain);
+ if (i != -1) {
+ existing = &g_array_index (data->array, GnomeVFSDNSSDService, i);
+ g_free (existing->name);
+ g_free (existing->type);
+ g_free (existing->domain);
+ g_array_remove_index (data->array, i);
+ }
+ } else if (event == AVAHI_BROWSER_ALL_FOR_NOW) {
+ avahi_simple_poll_quit (data->poll);
+ }
+
+
+ if (free_service) {
+ g_free (service.name);
+ g_free (service.type);
+ g_free (service.domain);
+ }
+}
+
+static void
+stop_poll_timeout (AvahiTimeout *timeout, void *user_data)
+{
+ AvahiSimplePoll *poll = user_data;
+
+ avahi_simple_poll_quit (poll);
+}
+
+#endif
+
+
+#ifdef HAVE_HOWL
static sw_result
@@ -1530,7 +1828,66 @@
*services = NULL;
if (strcmp (domain, "local") == 0) {
-#ifdef HAVE_HOWL
+#ifdef HAVE_AVAHI
+ AvahiSimplePoll *simple_poll;
+ const AvahiPoll *poll;
+ AvahiClient *client = NULL;
+ AvahiServiceBrowser *sb;
+ int error;
+ GArray *array;
+ struct sync_browse_data data;
+ struct timeval tv;
+
+ simple_poll = avahi_simple_poll_new ();
+ data.poll = simple_poll;
+ if (simple_poll == NULL) {
+ g_warning ("Failed to create simple poll object");
+ return GNOME_VFS_ERROR_GENERIC;
+ }
+
+ poll = avahi_simple_poll_get (simple_poll);
+ client = avahi_client_new (poll, 0,
+ avahi_browse_sync_client_callback, &data, &error);
+
+ /* Check wether creating the client object succeeded */
+ if (client == NULL) {
+ g_warning ("Failed to create client: %s\n", avahi_strerror (error));
+ avahi_simple_poll_free (simple_poll);
+ return GNOME_VFS_ERROR_GENERIC;
+ }
+
+
+ array = g_array_new (FALSE, FALSE, sizeof (GnomeVFSDNSSDService));
+ data.array = array;
+ sb = avahi_service_browser_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, type, NULL,
+ AVAHI_LOOKUP_USE_MULTICAST, avahi_browse_sync_callback, &data);
+ if (sb == NULL) {
+ g_warning ("Failed to create service browser: %s\n", avahi_strerror (avahi_client_errno (client)));
+ g_array_free (array, TRUE);
+ avahi_client_free (client);
+ avahi_simple_poll_free (simple_poll);
+ return GNOME_VFS_ERROR_GENERIC;
+ }
+
+
+ avahi_elapse_time (&tv, timeout_msec, 0);
+ poll->timeout_new (poll, &tv, stop_poll_timeout, (void *)simple_poll);
+
+ /* Run the main loop util reply or timeout */
+ for (;;)
+ if (avahi_simple_poll_iterate (simple_poll, -1) != 0)
+ break;
+
+
+ avahi_service_browser_free (sb);
+ avahi_client_free (client);
+ avahi_simple_poll_free (simple_poll);
+
+ *n_services = array->len;
+ *services = (GnomeVFSDNSSDService *)g_array_free (array, FALSE);
+
+ return GNOME_VFS_OK;
+#elif defined (HAVE_HOWL)
sw_discovery session;
sw_salt salt;
sw_result res;
@@ -1599,6 +1956,63 @@
}
}
+#ifdef HAVE_AVAHI
+struct sync_resolve_data {
+ AvahiSimplePoll *poll;
+ gboolean got_data;
+ char *host;
+ int port;
+ char *text;
+ int text_len;
+};
+
+
+static void
+avahi_resolve_sync_client_callback (AvahiClient *c, AvahiClientState state, void *user_data)
+{
+ struct sync_resolve_data *data;
+
+ data = user_data;
+ if (state == AVAHI_CLIENT_FAILURE) {
+ avahi_simple_poll_quit (data->poll);
+ }
+}
+
+static void
+avahi_resolve_sync_callback (AvahiServiceResolver *r,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiResolverEvent event,
+ const char *name,
+ const char *type,
+ const char *domain,
+ const char *host_name,
+ const AvahiAddress *address,
+ uint16_t port,
+ AvahiStringList *txt,
+ AvahiLookupResultFlags flags,
+ void *user_data)
+{
+ struct sync_resolve_data *data;
+ char a[128];
+
+ data = user_data;
+ if (event == AVAHI_RESOLVER_FOUND) {
+ data->got_data = TRUE;
+ avahi_address_snprint (a, sizeof(a), address);
+ data->host = g_strdup (a);
+ data->port = port;
+ data->text_len = avahi_string_list_serialize (txt, NULL, 0);
+ data->text = g_malloc (data->text_len);
+ avahi_string_list_serialize (txt, data->text, data->text_len);
+ }
+
+ avahi_service_resolver_free (r);
+ avahi_simple_poll_quit (data->poll);
+}
+
+#endif
+
#ifdef HAVE_HOWL
struct sync_resolve_data {
gboolean got_data;
@@ -1672,7 +2086,65 @@
GnomeVFSResult res;
if (strcmp (domain, "local") == 0) {
-#ifdef HAVE_HOWL
+#ifdef HAVE_AVAHI
+ AvahiSimplePoll *simple_poll;
+ AvahiClient *client = NULL;
+ AvahiServiceResolver *sr;
+ int error;
+ struct sync_resolve_data resolve_data = {0};
+
+ simple_poll = avahi_simple_poll_new ();
+ resolve_data.poll = simple_poll;
+ if (simple_poll == NULL) {
+ g_warning ("Failed to create simple poll object");
+ return GNOME_VFS_ERROR_GENERIC;
+ }
+
+ client = avahi_client_new (avahi_simple_poll_get (simple_poll), 0,
+ avahi_resolve_sync_client_callback, &resolve_data, &error);
+
+ /* Check wether creating the client object succeeded */
+ if (client == NULL) {
+ g_warning ("Failed to create client: %s\n", avahi_strerror (error));
+ avahi_simple_poll_free (simple_poll);
+ return GNOME_VFS_ERROR_GENERIC;
+ }
+
+ sr = avahi_service_resolver_new (client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
+ name, type, domain, AVAHI_PROTO_UNSPEC,
+ AVAHI_LOOKUP_USE_MULTICAST,
+ avahi_resolve_sync_callback, &resolve_data);
+ if (sr == NULL) {
+ g_warning ("Failed to resolve service '%s': %s\n", name, avahi_strerror (avahi_client_errno (client)));
+ avahi_client_free (client);
+ avahi_simple_poll_free (simple_poll);
+ return GNOME_VFS_ERROR_GENERIC;
+ }
+
+ /* Run the main loop util reply or timeout */
+ for (;;)
+ if (avahi_simple_poll_iterate (simple_poll, -1) != 0)
+ break;
+
+ avahi_client_free (client);
+ avahi_simple_poll_free (simple_poll);
+
+ if (resolve_data.got_data) {
+ *host = resolve_data.host;
+ *port = resolve_data.port;
+ if (text != NULL)
+ *text = decode_txt_record (resolve_data.text, resolve_data.text_len);
+ if (text_raw_len_out != NULL && text_raw_out) {
+ *text_raw_len_out = resolve_data.text_len;
+ *text_raw_out = resolve_data.text;
+ } else {
+ g_free (resolve_data.text);
+ }
+ return GNOME_VFS_OK;
+ }
+
+ return GNOME_VFS_ERROR_HOST_NOT_FOUND;
+#elif defined (HAVE_HOWL)
sw_discovery session;
sw_salt salt;
sw_result res;
--- gnome-vfs-2.13.1/configure.in.avahi 2005-12-02 13:34:02.000000000 -0500
+++ gnome-vfs-2.13.1/configure.in 2005-12-02 13:34:27.000000000 -0500
@@ -662,7 +662,7 @@
AC_ARG_ENABLE(avahi, [ --disable-avahi build without avahi support])
msg_avahi=no
if test "x$enable_avahi" != "xno"; then
- PKG_CHECK_MODULES(AVAHI, avahi-glib avahi-client,
+ PKG_CHECK_MODULES(AVAHI, avahi-glib >= 0.6 avahi-client >= 0.6,
[AM_CONDITIONAL(HAVE_AVAHI, true)
AC_DEFINE(HAVE_AVAHI, [], [Set if we can use avahi])]
msg_avahi=yes,

@ -1,32 +0,0 @@
Index: libgnomevfs/gnome-vfs-hal-mounts.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-hal-mounts.c,v
retrieving revision 1.15
diff -u -p -r1.15 gnome-vfs-hal-mounts.c
--- libgnomevfs/gnome-vfs-hal-mounts.c 23 Jul 2005 22:28:15 -0000 1.15
+++ libgnomevfs/gnome-vfs-hal-mounts.c 10 Aug 2005 20:50:50 -0000
@@ -1475,6 +1475,24 @@ _gnome_vfs_hal_mounts_modify_volume (Gno
*/
hal_drive = libhal_drive_from_device_file (hal_ctx, volume->priv->device_path);
if (hal_drive != NULL) {
+
+ /* handle drives that HAL can't poll and the user can still mount */
+ if (libhal_device_get_property_bool (hal_ctx,
+ libhal_drive_get_udi (hal_drive),
+ "storage.media_check_enabled",
+ NULL) == FALSE) {
+ GnomeVFSDrive *drive;
+
+ if ((drive = _gnome_vfs_volume_monitor_find_drive_by_hal_udi (
+ GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon),
+ libhal_drive_get_udi (hal_drive))) != NULL) {
+ volume->priv->drive = drive;
+ _gnome_vfs_drive_add_mounted_volume (drive, volume);
+
+ goto out;
+ }
+ }
+
/* ok, this device file is in HAL and thus managed by this backend */
gnome_vfs_volume_unref (volume);
result = NULL;

@ -1,12 +0,0 @@
diff -up gnome-vfs-2.20.1/configure.in.mime-cache gnome-vfs-2.20.1/configure.in
--- gnome-vfs-2.20.1/configure.in.mime-cache 2007-12-03 00:45:24.000000000 -0500
+++ gnome-vfs-2.20.1/configure.in 2007-12-03 00:41:43.000000000 -0500
@@ -158,7 +158,7 @@ AC_SEARCH_LIBS(setsockopt, socket)
AC_SEARCH_LIBS(login_tty, util, [AC_DEFINE([HAVE_LOGIN_TTY],[],[Whether login_tty is available])])
AC_FUNC_ALLOCA
-AC_CHECK_FUNCS(getdtablesize open64 lseek64 statfs statvfs seteuid setegid setresuid setresgid readdir_r mbrtowc inet_pton getdelim sysctlbyname poll posix_fadvise fchmod atoll)
+AC_CHECK_FUNCS(getdtablesize open64 lseek64 statfs statvfs seteuid setegid setresuid setresgid readdir_r mbrtowc inet_pton getdelim sysctlbyname poll posix_fadvise fchmod atoll mmap)
AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
AC_STRUCT_ST_BLOCKS

@ -1,550 +0,0 @@
--- gnome-vfs-2.5.5/libgnomevfs/Makefile.am.vfolder-hacks 2004-01-08 03:31:06.000000000 -0500
+++ gnome-vfs-2.5.5/libgnomevfs/Makefile.am 2004-01-29 18:44:53.000000000 -0500
@@ -19,6 +19,7 @@
-DGNOMEVFS_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" \
-DSYSCONFDIR=\"$(sysconfdir)\" \
-DG_LOG_DOMAIN=\"libgnomevfs\" \
+ -I/usr/kerberos/include \
$(NULL)
libgnomevfs_headers_to_scan_for_enums = \
--- gnome-vfs-2.5.5/modules/vfolder/vfolder-common.c.vfolder-hacks 2003-04-24 11:46:24.000000000 -0400
+++ gnome-vfs-2.5.5/modules/vfolder/vfolder-common.c 2004-01-29 18:44:53.000000000 -0500
@@ -61,7 +61,8 @@
entry->weight = weight;
entry->dirty = TRUE;
-
+ entry->not_shown = FALSE;
+
/*
* Lame-O special case .directory handling, as we don't want them
* showing up for all-applications:///.
@@ -201,7 +202,7 @@
entry_reload_if_needed (Entry *entry)
{
gboolean changed = FALSE;
- gchar *keywords, *deprecates;
+ gchar *keywords, *deprecates, *onlyshowin;
int i;
if (!entry->dirty)
@@ -211,8 +212,17 @@
"Categories",
&keywords,
"Deprecates",
- &deprecates);
-
+ &deprecates,
+ "OnlyShowIn",
+ &onlyshowin);
+
+#if 0
+ g_printerr ("Read cats=%s onlyshowin=%s from entry %s\n",
+ keywords ? keywords : "none",
+ onlyshowin ? onlyshowin : "none",
+ entry->filename);
+#endif
+
/*
* Clear keywords from file, leaving only ones added from
* the directory.
@@ -269,8 +279,28 @@
g_strfreev (parsed);
}
+ if (onlyshowin) {
+ char **parsed = g_strsplit (onlyshowin, ";", -1);
+
+ /* If OnlyShowIn exists, then the default is
+ * that we don't show the entry, unless the
+ * value includes "GNOME"
+ */
+ entry->not_shown = TRUE;
+
+ for (i = 0; parsed[i] != NULL; i++) {
+ if (strcmp (parsed[i], "GNOME") == 0)
+ entry->not_shown = FALSE;
+ }
+
+ /* FIXME do we need to emit some kind of notification here? */
+
+ g_strfreev (parsed);
+ }
+
g_free (keywords);
g_free (deprecates);
+ g_free (onlyshowin);
entry->dirty = FALSE;
}
@@ -380,7 +410,9 @@
const gchar *key1,
gchar **result1,
const gchar *key2,
- gchar **result2)
+ gchar **result2,
+ const gchar *key3,
+ gchar **result3)
{
GnomeVFSHandle *handle;
GnomeVFSFileSize readlen;
@@ -389,7 +421,9 @@
*result1 = NULL;
if (key2)
- *result2 = NULL;
+ *result2 = NULL;
+ if (key3)
+ *result3 = NULL;
if (gnome_vfs_open (&handle,
entry_get_filename (entry),
@@ -416,6 +450,9 @@
if (key2)
entry_key_val_from_string (fullbuf->str, key2, result2);
+ if (key3)
+ entry_key_val_from_string (fullbuf->str, key3, result3);
+
g_string_free (fullbuf, TRUE);
}
@@ -458,7 +495,7 @@
folder->refcnt = 1;
folder->dirty = TRUE;
-
+
return folder;
}
@@ -832,6 +869,10 @@
{
Query *query = folder_get_query (folder);
+#if 0
+ g_printerr ("reading one extended entry %s\n", file_uri ? file_uri : "null");
+#endif
+
if (is_excluded (folder, file_uri, file_info->name))
return FALSE;
@@ -897,6 +938,13 @@
result = gnome_vfs_directory_open (&handle,
extend_uri,
GNOME_VFS_FILE_INFO_DEFAULT);
+
+#if 0
+ g_printerr ("reading extended entries from %s result = %s\n"<
+ extend_uri ? extend_uri : "null",
+ result == GNOME_VFS_OK ? "ok" : "failed");
+#endif
+
if (result != GNOME_VFS_OK)
return FALSE;
@@ -1038,6 +1086,11 @@
{
gboolean changed = FALSE;
+#if 0
+ g_printerr ("folder maybe reload dirty = %d loading = %d\n",
+ folder->dirty, folder->loading);
+#endif
+
if (!folder->dirty || folder->loading)
return;
@@ -1066,6 +1119,11 @@
folder_get_extend_uri (folder),
folder_extend_monitor_cb,
folder);
+ } else {
+#if 0
+ g_printerr ("folder %s has no extend uri, not reading\n",
+ folder->name);
+#endif
}
if (folder_get_query (folder))
@@ -1123,6 +1181,12 @@
void
folder_set_extend_uri (Folder *folder, const gchar *uri)
{
+#if 0
+ g_printerr ("setting extend URI of %s to %s\n",
+ folder->name,
+ uri ? uri : "null");
+#endif
+
g_free (folder->extend_uri);
folder->extend_uri = g_strdup (uri);
@@ -1262,6 +1326,9 @@
if (query && !query_try_match (query, folder, entry))
continue;
+ if (entry->not_shown)
+ continue;
+
g_hash_table_insert (
name_hash,
(gchar *) entry_get_displayname (entry),
@@ -1276,6 +1343,8 @@
"SortOrder",
&sortorder,
NULL,
+ NULL,
+ NULL,
NULL);
if (sortorder) {
list = child_list_prepend_sorted (sortorder,
@@ -1527,6 +1596,9 @@
if (entry_is_allocated (entry))
continue;
+ if (entry->not_shown)
+ continue;
+
if (query && !query_try_match (query, folder, entry))
continue;
@@ -1601,9 +1673,12 @@
{
GSList *li;
+ if (efile->not_shown)
+ return FALSE;
+
if (query == NULL)
return TRUE;
-
+
switch (query->type) {
case QUERY_OR:
for (li = query->val.queries; li != NULL; li = li->next) {
--- gnome-vfs-2.5.5/modules/vfolder/vfolder-common.h.vfolder-hacks 2002-10-25 01:54:43.000000000 -0400
+++ gnome-vfs-2.5.5/modules/vfolder/vfolder-common.h 2004-01-29 18:44:53.000000000 -0500
@@ -82,6 +82,7 @@
guint dirty : 1;
guint user_private : 1;
+ guint not_shown : 1; /* OnlyShowIn=SomeOtherDesktop */
} Entry;
Entry *entry_new (VFolderInfo *info,
@@ -120,7 +121,9 @@
const gchar *key1,
gchar **value1,
const gchar *key2,
- gchar **value2);
+ gchar **value2,
+ const gchar *key3,
+ gchar **value3);
void entry_dump (Entry *entry, int indent);
--- gnome-vfs-2.5.5/modules/vfolder/vfolder-info.c.vfolder-hacks 2003-10-31 06:17:59.000000000 -0500
+++ gnome-vfs-2.5.5/modules/vfolder/vfolder-info.c 2004-01-29 18:52:06.000000000 -0500
@@ -193,12 +193,15 @@
folder_get_name (folder) /* content */);
extend_uri = folder_get_extend_uri (folder);
+#if 0
+ /* this would confuse KDE, just use hardcoded value. */
if (extend_uri) {
xmlNewChild (folder_node /* parent */,
NULL /* ns */,
folder->is_link ? "ParentLink" : "Parent",
extend_uri /* content */);
}
+#endif
if (folder->user_private) {
const gchar *desktop_file;
@@ -274,12 +277,17 @@
NULL /* content */);
doc->xmlRootNode = topnode;
+#if 0
+ /* Never write the WriteDir field, it will
+ * break KDE menus. Just use the hardcoded one.
+ */
if (info->write_dir != NULL) {
xmlNewChild (topnode /* parent */,
NULL /* ns */,
"WriteDir" /* name */,
info->write_dir /* content */);
}
+#endif
/* Deprecated */
if (info->desktop_dir != NULL) {
@@ -539,8 +547,10 @@
gchar *esc_parent;
esc_parent = vfolder_escape_home (parent);
- folder_set_extend_uri (folder, esc_parent);
- folder->is_link = FALSE;
+ if (*esc_parent != '\0') {
+ folder_set_extend_uri (folder, esc_parent);
+ folder->is_link = FALSE;
+ }
xmlFree (parent);
g_free (esc_parent);
@@ -553,8 +563,10 @@
gchar *esc_parent;
esc_parent = vfolder_escape_home (parent);
- folder_set_extend_uri (folder, esc_parent);
- folder->is_link = TRUE;
+ if (*esc_parent != '\0') {
+ folder_set_extend_uri (folder, esc_parent);
+ folder->is_link = TRUE;
+ }
xmlFree (parent);
g_free (esc_parent);
@@ -734,6 +746,53 @@
g_free (itemdir);
}
+static void
+set_hardcoded_extend_uri_recursive (Folder *parent,
+ const char *parent_uri)
+{
+ GSList *subfolders;
+ GSList *tmp;
+
+ /* we set the extend URI unconditionally,
+ * ignoring anything in the file
+ */
+ folder_set_extend_uri (parent, parent_uri);
+
+ subfolders = (GSList*) folder_list_subfolders (parent);
+ tmp = subfolders;
+ while (tmp != NULL) {
+ Folder *sub = tmp->data;
+ char *child_uri;
+
+ child_uri = g_strconcat (parent_uri, folder_get_name (sub),
+ "/", NULL);
+
+ set_hardcoded_extend_uri_recursive (sub, child_uri);
+
+ g_free (child_uri);
+
+ tmp = tmp->next;
+ }
+}
+
+static void
+set_hardcoded_extend_uri (VFolderInfo *info)
+{
+ gchar *all_user_scheme;
+
+ /*
+ * Set the extend uri for the root folder to the -all-users version of
+ * the scheme, in case the user doesn't have a private .vfolder-info
+ * file yet.
+ */
+ if (!g_str_has_suffix (info->scheme,
+ "-all-users")) {
+ all_user_scheme = g_strconcat (info->scheme, "-all-users:///", NULL);
+ set_hardcoded_extend_uri_recursive (info->root, all_user_scheme);
+ g_free (all_user_scheme);
+ }
+}
+
static gboolean
read_vfolder_from_file (VFolderInfo *info,
const gchar *filename,
@@ -829,6 +888,7 @@
folder_unref (info->root);
info->root = folder;
+ set_hardcoded_extend_uri (info);
}
}
else if (g_ascii_strcasecmp (node->name, "ReadOnly") == 0) {
@@ -1723,23 +1783,45 @@
GnomeVFSURI *file_uri;
gboolean exists;
- /*
- * FIXME: load from gconf
+ /* Here we're finding the primary XML file
+ * that this URI will write changes to.
+ * It's the .menu file for -all-users,
+ * and the ~/.gnome2/vfolders/scheme.vfolder-info
+ * file otherwise.
*/
+
+ if (g_str_has_suffix (info->scheme,
+ "-all-users")) {
+ /* The all-users scheme uses the
+ * .menu files
+ */
+ const char *suffix;
+ char *single_scheme;
+
+ suffix = g_strrstr (info->scheme, "-all-users");
+ g_assert (suffix != NULL);
+ single_scheme = g_strndup (info->scheme,
+ suffix - info->scheme);
+
+ info->filename = g_strconcat (SYSCONFDIR,
+ "/X11/desktop-menus/",
+ single_scheme,
+ ".menu",
+ NULL);
+ g_free (single_scheme);
- /*
- * 1st: Try mandatory system-global file located at
- * /etc/gnome-vfs-2.0/vfolders/scheme.vfolder-info. Writability will
- * depend on permissions of this file.
- */
- info->filename = g_strconcat (SYSCONFDIR,
- "/gnome-vfs-2.0/vfolders/",
- scheme, ".vfolder-info",
- NULL);
- file_uri = gnome_vfs_uri_new (info->filename);
+ file_uri = gnome_vfs_uri_new (info->filename);
+
+ exists = gnome_vfs_uri_exists (file_uri);
+ gnome_vfs_uri_unref (file_uri);
- exists = gnome_vfs_uri_exists (file_uri);
- gnome_vfs_uri_unref (file_uri);
+#if 0
+ g_printerr ("all-users filename %s exists = %d\n",
+ info->filename, exists);
+#endif
+ } else {
+ exists = FALSE;
+ }
if (!exists) {
/*
@@ -1751,37 +1833,6 @@
scheme, ".vfolder-info",
NULL);
}
-
- /*
- * Special case for applications-all-users where we want to add any
- * paths specified in $GNOME2_PATH, for people installing in strange
- * places.
- */
- if (!strcmp (scheme, "applications-all-users")) {
- int i;
- const char *path;
- char *dir, **ppath;
- ItemDir *id;
- int weight = 800;
-
- path = g_getenv ("GNOME2_PATH");
- if (path) {
- ppath = g_strsplit (path, ":", -1);
-
- for (i = 0; ppath[i] != NULL; i++) {
- dir = g_build_filename (ppath[i],
- "/share/applications/",
- NULL);
- id = itemdir_new (info,
- dir,
- ITEM_DIR,
- weight--);
- g_free (dir);
- }
-
- g_strfreev (ppath);
- }
- }
}
static gboolean
@@ -1811,25 +1862,16 @@
static gboolean
vfolder_info_init (VFolderInfo *info)
{
- gchar *all_user_scheme;
-
info->loading = TRUE;
info->entries_ht = g_hash_table_new (g_str_case_hash, g_str_case_equal);
info->root = folder_new (info, "Root", TRUE);
+ set_hardcoded_extend_uri (info);
+
/*
- * Set the extend uri for the root folder to the -all-users version of
- * the scheme, in case the user doesn't have a private .vfolder-info
- * file yet.
- */
- all_user_scheme = g_strconcat (info->scheme, "-all-users:///", NULL);
- folder_set_extend_uri (info->root, all_user_scheme);
- g_free (all_user_scheme);
-
- /*
- * Set the default writedir, in case there is no .vfolder-info for this
- * scheme yet. Otherwise this will be overwritten when we read our
- * source.
+ * Set the default writedir, in case there is no .vfolder-info
+ * for this scheme yet. Otherwise this will be overwritten
+ * when we read our source.
*/
info->write_dir = g_strconcat (g_get_home_dir (),
"/" DOT_GNOME "/vfolders/",
@@ -1839,29 +1881,6 @@
/* Figure out which .vfolder-info to read */
vfolder_info_find_filenames (info);
- if (g_getenv ("GNOME_VFS_VFOLDER_INFODIR")) {
- gchar *filename = g_strconcat (info->scheme,
- ".vfolder-info",
- NULL);
-
- g_free (info->filename);
- info->filename =
- vfolder_build_uri (
- g_getenv ("GNOME_VFS_VFOLDER_INFODIR"),
- filename,
- NULL);
- g_free (filename);
- }
-
- if (g_getenv ("GNOME_VFS_VFOLDER_WRITEDIR")) {
- g_free (info->write_dir);
- info->write_dir =
- vfolder_build_uri (
- g_getenv ("GNOME_VFS_VFOLDER_WRITEDIR"),
- info->scheme,
- NULL);
- }
-
info->filename_monitor =
vfolder_monitor_file_new (info->filename,
filename_monitor_cb,
--- gnome-vfs-2.5.5/modules/vfolder/vfolder-util.c.vfolder-hacks 2002-10-10 00:46:29.000000000 -0400
+++ gnome-vfs-2.5.5/modules/vfolder/vfolder-util.c 2004-01-29 18:44:53.000000000 -0500
@@ -207,6 +207,7 @@
{
GnomeVFSResult result;
VFolderMonitor *monitor;
+#if 0
GnomeVFSFileInfo *info;
/* Check the file exists so we don't get a bogus DELETED event */
@@ -218,7 +219,8 @@
if (result != GNOME_VFS_OK)
return NULL;
-
+#endif
+
monitor = g_new0 (VFolderMonitor, 1);
monitor->callback = callback;
monitor->user_data = user_data;

@ -64,8 +64,6 @@ Patch104: gnome-vfs-2.8.2-browser_default.patch
Patch201: gnome-vfs-2.8.1-console-mount-opt.patch
Patch4: gnome-vfs-2.15.1-use-sys-inotify.patch
# RH bug #197868
Patch6: gnome-vfs-2.15.91-mailto-command.patch
@ -75,9 +73,6 @@ Patch8: gnome-vfs-2.16.0-no-dbus.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=427958
Patch9: glob-leak.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=501160
Patch10: gnome-vfs-mime-cache.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=333041
# https://bugzilla.redhat.com/show_bug.cgi?id=335241
Patch300: gnome-vfs-2.20.0-ignore-certain-mountpoints.patch
@ -122,8 +117,6 @@ shares (SMB) to applications using GNOME VFS.
%patch3 -p1 -b .modules-conf
%patch4 -p1 -b .use-sys-inotify
%patch6 -p1 -b .mailto-command
# send to upstream
@ -134,7 +127,6 @@ shares (SMB) to applications using GNOME VFS.
%patch8 -p1 -b .no-dbus
%patch9 -p1 -b .glob-leak
%patch10 -p1 -b .mime-cache
%patch300 -p1 -b .ignore-certain-mount-points

@ -1,516 +0,0 @@
Update to the GSSAPI implementation from HEAD.
--- imported/neon/ne_auth.c (revision 309)
+++ imported/neon/ne_auth.c (working copy)
@@ -161,8 +161,11 @@
/* This used for Basic auth */
char *basic;
#ifdef HAVE_GSSAPI
- /* This used for GSSAPI auth */
+ /* for the GSSAPI/Negotiate scheme: */
char *gssapi_token;
+ gss_ctx_id_t gssctx;
+ gss_name_t gssname;
+ gss_OID gssmech;
#endif
/* These all used for Digest auth */
char *realm;
@@ -202,7 +205,7 @@
struct ne_md5_ctx response_body;
/* Results of response-header callbacks */
- char *auth_hdr, *auth_info_hdr;
+ ne_buffer *auth_hdr, *auth_info_hdr;
};
static void clean_session(auth_session *sess)
@@ -214,6 +217,17 @@
NE_FREE(sess->opaque);
NE_FREE(sess->realm);
#ifdef HAVE_GSSAPI
+ {
+ int major;
+
+ if (sess->gssctx != GSS_C_NO_CONTEXT)
+ gss_delete_sec_context(&major, sess->gssctx, GSS_C_NO_BUFFER);
+
+ if (sess->gssmech != GSS_C_NO_OID) {
+ gss_release_oid(&major, &sess->gssmech);
+ sess->gssmech = GSS_C_NO_OID;
+ }
+ }
NE_FREE(sess->gssapi_token);
#endif
}
@@ -321,69 +335,162 @@
/* Add GSSAPI authentication credentials to a request */
static char *request_gssapi(auth_session *sess)
{
- return ne_concat("Negotiate ", sess->gssapi_token, "\r\n", NULL);
+ if (sess->gssapi_token)
+ return ne_concat("Negotiate ", sess->gssapi_token, "\r\n", NULL);
+ else
+ return NULL;
}
-static int get_gss_name(gss_name_t *server, auth_session *sess)
+/* Create an GSSAPI name for server HOSTNAME; returns non-zero on
+ * error. */
+static void get_gss_name(gss_name_t *server, const char *hostname)
{
- unsigned int major_status, minor_status;
+ unsigned int major, minor;
gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
- token.value = ne_concat("HTTP@", sess->sess->server.hostname, NULL);
+ token.value = ne_concat("HTTP@", hostname, NULL);
token.length = strlen(token.value);
- major_status = gss_import_name(&minor_status, &token,
- GSS_C_NT_HOSTBASED_SERVICE,
- server);
- return GSS_ERROR(major_status) ? -1 : 0;
+ major = gss_import_name(&minor, &token, GSS_C_NT_HOSTBASED_SERVICE,
+ server);
+ ne_free(token.value);
+
+ if (GSS_ERROR(major)) {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: gss_import_name failed.\n");
+ *server = GSS_C_NO_NAME;
+ }
}
-/* Examine a GSSAPI auth challenge; returns 0 if a valid challenge,
- * else non-zero. */
-static int
-gssapi_challenge(auth_session *sess, struct auth_challenge *parms)
+/* Append GSSAPI error(s) for STATUS of type TYPE to BUF; prepending
+ * ": " to each error if *FLAG is non-zero, setting *FLAG after an
+ * error has been appended. */
+static void make_gss_error(ne_buffer *buf, int *flag,
+ unsigned int status, int type)
{
- gss_ctx_id_t context;
- gss_name_t server_name;
- unsigned int major_status, minor_status;
- gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER;
- gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER;
+ int major, minor;
+ int context = 0;
+
+ do {
+ gss_buffer_desc msg;
+ major = gss_display_status(&minor, status, type,
+ GSS_C_NO_OID, &context, &msg);
+ if (major == GSS_S_COMPLETE && msg.length) {
+ if ((*flag)++) ne_buffer_append(buf, ": ", 2);
+ ne_buffer_append(buf, msg.value, msg.length);
+ }
+ if (msg.length) gss_release_buffer(&minor, &msg);
+ } while (context);
+}
- clean_session(sess);
+/* Continue a GSS-API Negotiate exchange, using input TOKEN if
+ * non-NULL. Returns non-zero on error. */
+static int continue_negotiate(auth_session *sess, const char *token)
+{
+ unsigned int major, minor;
+ gss_buffer_desc input = GSS_C_EMPTY_BUFFER;
+ gss_buffer_desc output = GSS_C_EMPTY_BUFFER;
+ unsigned char *bintoken = NULL;
+ int ret;
+ gss_OID mech = sess->gssmech;
- if (get_gss_name(&server_name, sess))
+ if (token) {
+ input.length = ne_unbase64(token, &bintoken);
+ if (input.length == 0) {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Invalid input [%s].\n",
+ token);
+ return -1;
+ }
+ input.value = bintoken;
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Continuation token [%s]\n", token);
+ }
+ else if (sess->gssctx != GSS_C_NO_CONTEXT) {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Reset incomplete context.\n");
+ gss_delete_sec_context(&minor, &sess->gssctx, GSS_C_NO_BUFFER);
+ }
+
+ major = gss_init_sec_context(&minor, GSS_C_NO_CREDENTIAL, &sess->gssctx,
+ sess->gssname, mech,
+ GSS_C_MUTUAL_FLAG, GSS_C_INDEFINITE,
+ GSS_C_NO_CHANNEL_BINDINGS,
+ &input, &sess->gssmech, &output, NULL, NULL);
+
+ /* done with the input token. */
+ if (bintoken) ne_free(bintoken);
+
+ if (GSS_ERROR(major)) {
+ ne_buffer *err = ne_buffer_create();
+ int flag = 0;
+
+ make_gss_error(err, &flag, major, GSS_C_GSS_CODE);
+ make_gss_error(err, &flag, minor, GSS_C_MECH_CODE);
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Error: %s\n", err->data);
+ ne_set_error(sess->sess, _("GSSAPI authentication error (%s)"),
+ err->data);
+ ne_buffer_destroy(err);
return -1;
+ }
- major_status = gss_init_sec_context(&minor_status,
- GSS_C_NO_CREDENTIAL,
- &context,
- server_name,
- GSS_C_NO_OID,
- 0,
- GSS_C_INDEFINITE,
- GSS_C_NO_CHANNEL_BINDINGS,
- &input_token,
- NULL,
- &output_token,
- NULL,
- NULL);
- gss_release_name(&minor_status, &server_name);
+ if (major == GSS_S_CONTINUE_NEEDED || major == GSS_S_COMPLETE) {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: init_sec_context OK. (major=%d)\n",
+ major);
+ ret = 0;
+ }
+ else {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Init failure %d.\n", major);
+ ret = -1;
+ }
- if (GSS_ERROR(major_status)) {
- NE_DEBUG(NE_DBG_HTTPAUTH, "gss_init_sec_context failed.\n");
+ if (major != GSS_S_CONTINUE_NEEDED) {
+ /* context no longer needed: destroy it */
+ gss_delete_sec_context(&minor, &sess->gssctx, GSS_C_NO_BUFFER);
+ }
+
+ if (output.length) {
+ sess->gssapi_token = ne_base64(output.value, output.length);
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Output token: [%s]\n",
+ sess->gssapi_token);
+ gss_release_buffer(&minor, &output);
+ } else {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: No output token.\n");
+ }
+
+ return ret;
+}
+
+/* Process a Negotiate challange CHALL in session SESS; returns zero
+ * if challenge is accepted. */
+static int gssapi_challenge(auth_session *sess, struct auth_challenge *chall)
+{
+ int ret = continue_negotiate(sess, chall->opaque);
+ if (ret == 0)
+ sess->scheme = auth_scheme_gssapi;
+ return ret;
+}
+
+/* Verify the header HDR in a Negotiate response. */
+static int verify_negotiate_response(auth_session *sess, char *hdr)
+{
+ char *sep, *ptr = strchr(hdr, ' ');
+
+ if (strncmp(hdr, "Negotiate", ptr - hdr) != 0) {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Not a Negotiate response!\n");
return -1;
}
- if (output_token.length == 0)
- return -1;
+ ptr++;
- sess->gssapi_token = ne_base64(output_token.value, output_token.length);
- gss_release_buffer(&major_status, &output_token);
+ if (strlen(ptr) == 0) {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: No token in Negotiate response!\n");
+ return 0;
+ }
- NE_DEBUG(NE_DBG_HTTPAUTH,
- "Base64 encoded GSSAPI challenge: %s.\n", sess->gssapi_token);
- sess->scheme = auth_scheme_gssapi;
- return 0;
+ if ((sep = strchr(ptr, ',')) != NULL)
+ *sep = '\0';
+ if ((sep = strchr(ptr, ' ')) != NULL)
+ *sep = '\0';
+
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Negotiate response token [%s]\n", ptr);
+ return continue_negotiate(sess, ptr);
}
#endif
@@ -637,7 +744,8 @@
*pnt = '\0';
*value = pnt + 1;
state = AFTER_EQ;
- } else if (*pnt == ' ' && ischall && *key != NULL) {
+ } else if ((*pnt == ' ' || *pnt == ',')
+ && ischall && *key != NULL) {
*value = NULL;
*pnt = '\0';
*hdr = pnt + 1;
@@ -679,8 +787,8 @@
* 0 if it gives a valid authentication for the server
* non-zero otherwise (don't believe the response in this case!).
*/
-static int verify_response(struct auth_request *req, auth_session *sess,
- const char *value)
+static int verify_digest_response(struct auth_request *req, auth_session *sess,
+ const char *value)
{
char *hdr, *pnt, *key, *val;
auth_qop qop = auth_qop_none;
@@ -842,36 +950,39 @@
while (!tokenize(&pnt, &key, &val, 1)) {
if (val == NULL) {
- /* We have a new challenge */
- NE_DEBUG(NE_DBG_HTTPAUTH, "New challenge for scheme [%s]\n", key);
- chall = ne_calloc(sizeof *chall);
+ auth_scheme scheme;
- chall->next = challenges;
- challenges = chall;
- /* Initialize the challenge parameters */
- /* Which auth-scheme is it (case-insensitive matching) */
if (strcasecmp(key, "basic") == 0) {
- NE_DEBUG(NE_DBG_HTTPAUTH, "Basic scheme.\n");
- chall->scheme = auth_scheme_basic;
+ scheme = auth_scheme_basic;
} else if (strcasecmp(key, "digest") == 0) {
- NE_DEBUG(NE_DBG_HTTPAUTH, "Digest scheme.\n");
- chall->scheme = auth_scheme_digest;
-#ifdef HAVE_GSSAPI
+ scheme = auth_scheme_digest;
+ }
+#ifdef HAVE_GSSAPI
+ /* cope with a Negotiate parameter which doesn't match the
+ * auth-param due to the broken spec. */
+ else if (chall && chall->scheme == auth_scheme_gssapi
+ && chall->opaque == NULL) {
+ chall->opaque = key;
+ continue;
} else if (strcasecmp(key, "negotiate") == 0) {
- NE_DEBUG(NE_DBG_HTTPAUTH, "GSSAPI scheme.\n");
- chall->scheme = auth_scheme_gssapi;
+ scheme = auth_scheme_gssapi;
+ }
#endif
- } else {
- NE_DEBUG(NE_DBG_HTTPAUTH, "Unknown scheme.\n");
- ne_free(chall);
- challenges = NULL;
- break;
+ else {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "Ignoring challenge '%s'.\n", key);
+ chall = NULL;
+ continue;
}
+
+ NE_DEBUG(NE_DBG_HTTPAUTH, "New '%s' challenge.\n", key);
+ chall = ne_calloc(sizeof *chall);
+ chall->scheme = scheme;
+ chall->next = challenges;
+ challenges = chall;
continue;
} else if (chall == NULL) {
- /* If we haven't got an auth-scheme, and we're
- * haven't yet found a challenge, skip this pair.
- */
+ /* Ignore pairs for an unknown challenge. */
+ NE_DEBUG(NE_DBG_HTTPAUTH, "Ignored pair: %s = %s\n", key, val);
continue;
}
@@ -924,15 +1035,17 @@
success = 0;
#ifdef HAVE_GSSAPI
- if (strcmp(ne_get_scheme(sess->sess), "https") == 0) {
+ /* Ignore Negotiate challenges from origin servers which don't
+ * come over SSL. */
+ if (sess->spec == &ah_proxy_class || sess->context != AUTH_ANY) {
NE_DEBUG(NE_DBG_HTTPAUTH, "Looking for GSSAPI.\n");
/* Try a GSSAPI challenge */
for (chall = challenges; chall != NULL; chall = chall->next) {
if (chall->scheme == auth_scheme_gssapi) {
- if (!gssapi_challenge(sess, chall)) {
- success = 1;
- break;
- }
+ if (!gssapi_challenge(sess, chall)) {
+ success = 1;
+ break;
+ }
}
}
}
@@ -993,6 +1106,14 @@
ne_md5_process_bytes(block, length, ctx);
}
+/* Collect auth challenges into an ne_buffer */
+static void ah_collect_header(void *userdata, const char *value)
+{
+ ne_buffer *ar = userdata;
+ if (ne_buffer_size(ar)) ne_buffer_append(ar, ", ", 2);
+ ne_buffer_zappend(ar, value);
+}
+
static void ah_create(ne_request *req, void *session, const char *method,
const char *uri)
{
@@ -1009,14 +1130,14 @@
areq->method = method;
areq->uri = uri;
areq->request = req;
+ areq->auth_hdr = ne_buffer_create();
+ areq->auth_info_hdr = ne_buffer_create();
ne_add_response_header_handler(req, sess->spec->resp_hdr,
- ne_duplicate_header, &areq->auth_hdr);
-
+ ah_collect_header, areq->auth_hdr);
ne_add_response_header_handler(req, sess->spec->resp_info_hdr,
- ne_duplicate_header,
- &areq->auth_info_hdr);
+ ah_collect_header, areq->auth_info_hdr);
sess->attempt = 0;
@@ -1035,7 +1156,7 @@
} else {
char *value;
- NE_DEBUG(NE_DBG_HTTPAUTH, "Handling.");
+ NE_DEBUG(NE_DBG_HTTPAUTH, "Handling auth session.\n");
req->will_handle = 1;
if (sess->qop == auth_qop_auth_int) {
@@ -1082,22 +1203,44 @@
if (!areq) return NE_OK;
+#ifdef HAVE_GSSAPI
+ /* whatever happens: forget the GSSAPI token cached thus far */
+ if (sess->gssapi_token) {
+ ne_free(sess->gssapi_token);
+ sess->gssapi_token = NULL;
+ }
+#endif
+
NE_DEBUG(NE_DBG_HTTPAUTH,
"ah_post_send (#%d), code is %d (want %d), %s is %s\n",
sess->attempt, status->code, sess->spec->status_code,
- sess->spec->resp_hdr, SAFELY(areq->auth_hdr));
- if (areq->auth_info_hdr != NULL &&
- verify_response(areq, sess, areq->auth_info_hdr)) {
- NE_DEBUG(NE_DBG_HTTPAUTH, "Response authentication invalid.\n");
- ne_set_error(sess->sess, "%s", _(sess->spec->fail_msg));
- ret = NE_ERROR;
- } else if ((status->code == sess->spec->status_code ||
- (status->code == 401 && sess->context == AUTH_CONNECT)) &&
- areq->auth_hdr != NULL) {
+ sess->spec->resp_hdr, areq->auth_hdr->data);
+ if (ne_buffer_size(areq->auth_info_hdr)
+ && sess->scheme == auth_scheme_digest) {
+ if (verify_digest_response(areq, sess, areq->auth_info_hdr->data)) {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "Response authentication invalid.\n");
+ ne_set_error(sess->sess, "%s", _(sess->spec->fail_msg));
+ ret = NE_ERROR;
+ }
+ }
+#ifdef HAVE_GSSAPI
+ /* one must wonder... has Mr Brezak actually read RFC2617? */
+ else if (sess->scheme == auth_scheme_gssapi
+ && (status->klass == 2 || status->klass == 3)
+ && ne_buffer_size(areq->auth_hdr)) {
+ if (verify_negotiate_response(sess, areq->auth_hdr->data)) {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "gssapi: Mutual auth failed.\n");
+ ret = NE_ERROR;
+ }
+ }
+#endif /* HAVE_GSSAPI */
+ else if ((status->code == sess->spec->status_code ||
+ (status->code == 401 && sess->context == AUTH_CONNECT)) &&
+ ne_buffer_size(areq->auth_hdr)) {
/* note above: allow a 401 in response to a CONNECT request
* from a proxy since some buggy proxies send that. */
- NE_DEBUG(NE_DBG_HTTPAUTH, "Got challenge with code %d.\n", status->code);
- if (!auth_challenge(sess, areq->auth_hdr)) {
+ NE_DEBUG(NE_DBG_HTTPAUTH, "Got challenge (code %d).\n", status->code);
+ if (!auth_challenge(sess, areq->auth_hdr->data)) {
ret = NE_RETRY;
} else {
clean_session(sess);
@@ -1105,9 +1248,9 @@
}
}
- NE_FREE(areq->auth_info_hdr);
- NE_FREE(areq->auth_hdr);
-
+ ne_buffer_clear(areq->auth_hdr);
+ ne_buffer_clear(areq->auth_info_hdr);
+
return ret;
}
@@ -1115,13 +1258,25 @@
{
auth_session *sess = session;
struct auth_request *areq = ne_get_request_private(req, sess->spec->id);
- if (areq) ne_free(areq);
+
+ if (areq) {
+ ne_buffer_destroy(areq->auth_info_hdr);
+ ne_buffer_destroy(areq->auth_hdr);
+ ne_free(areq);
+ }
}
static void free_auth(void *cookie)
{
auth_session *sess = cookie;
+#ifdef HAVE_GSSAPI
+ if (sess->gssname != GSS_C_NO_NAME) {
+ int major;
+ gss_release_name(&major, sess->gssname);
+ }
+#endif
+
clean_session(sess);
ne_free(sess);
}
@@ -1137,10 +1292,17 @@
ahs->sess = sess;
ahs->spec = ahc;
- if (strcmp(ne_get_scheme(sess), "https") == 0)
+ if (strcmp(ne_get_scheme(sess), "https") == 0) {
ahs->context = isproxy ? AUTH_CONNECT : AUTH_NOTCONNECT;
- else
+ } else {
ahs->context = AUTH_ANY;
+ }
+#ifdef HAVE_GSSAPI
+ get_gss_name(&ahs->gssname, (isproxy ? sess->proxy.hostname
+ : sess->server.hostname));
+ ahs->gssctx = GSS_C_NO_CONTEXT;
+ ahs->gssmech = GSS_C_NO_OID;
+#endif
/* Register hooks */
ne_hook_create_request(sess, ah_create, ahs);

@ -1,19 +0,0 @@
Index: modules/inotify-path.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/inotify-path.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- modules/inotify-path.c 10 Dec 2005 23:50:19 -0000 1.1
+++ modules/inotify-path.c 12 Dec 2005 16:03:49 -0000 1.2
@@ -24,6 +24,10 @@
*/
#include "config.h"
+
+/* Don't put conflicting kernel types in the global namespace: */
+#define __KERNEL_STRICT_NAMES
+
#include "local_inotify.h"
#if 0
#ifdef HAVE_SYS_INOTIFY_H
Loading…
Cancel
Save