|
|
|
@ -1,3 +1,93 @@
|
|
|
|
|
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
|
|
|
|
@ -132,6 +222,24 @@ diff -u -p -r1.109 -r1.110
|
|
|
|
|
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
|
|
|
|
@ -395,3 +503,353 @@ diff -u -p -r1.14 -r1.15
|
|
|
|
|
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);
|
|
|
|
|