[evolution-patches] e-d-s/servers/exchange Win32 patches
- From: Tor Lillqvist <tml novell com>
- To: patches <evolution-patches gnome org>
- Subject: [evolution-patches] e-d-s/servers/exchange Win32 patches
- Date: Wed, 30 Nov 2005 01:41:53 +0000
This is not quite so "trivial" as the camel and e-d-s/calendar diffs,
but still nothing really complex. Still, this has been quite little
tested, so please somebody check out that nothing breaks.
* lib/Makefile.am: Drop unused CONNECTOR_LOCALEDIR.
* lib/e2k-global-catalog.c: Remove duplicate inclusion of ldap.h,
it's already included by e2k-global-catalog-ldap.h. Define
LDAP_ROOT_DSE if necessary.
(finalize): g_free() works fine on NULL pointers.
(connect_ldap, get_ldap_connection): Rename ldap_connect() to
connect_ldap() to avoid clash with the function in the LDAP API.
(connect_ldap): Use WINNT authentication on Windows.
* lib/e2k-global-catalog-ldap.h: Include winldap.h on Windows. Add
some OpenLDAP macros that aren't present in winldap.h.
* lib/e2k-autoconfig.c
* lib/e2k-context.c: Include appropriate headers on Win32.
* lib/e2k-autoconfig.c: Drop inclusion of
libedataserver/e-account.h and libedataserver/e-account-list.h,
that API is not used here.
(find_global_catalog): Add Win32 implementation.
(find_olson_timezone): Use g_win32_getlocale() on Win32 instead of
the usually nonexistent LANG environment variable.
(read_config): Form path to connector.conf at run-time for the
benefit of Win32 freely chosen end-user install location. Use
gstdio wrappers.
* lib/e2k-context.c: Define strtok_r() using strtok() on Windows,
where strtok() is MT-safe. Wrap socket API calls with simple
macros for Unix/winsock portability. Use
g_io_channel_win32_new_socket() on Windows.
* lib/e2k-path.c (find_folders_recursive):
* storage/exchange-account.c (setup_account_hierarchies): Use
g_dir* instead of dirent API for portability.
* storage/Makefile.am: Use NO_UNDEFINED (meaning -no-undefined on
Windows). Link with all needed libraries for the benefit of
-no-undefined.
* storage/exchange-account.c (exchange_account_set_password):
Do compile eve if not HAVE_KRB5, but always return failure. Means
less ifdefs elsewhere.
(e_filename_make_safe): Remove this function which isn't used,
especially as there is an exact duplicate in
evolution/e-util/e-util.c. If it eventually is needed also here in
e-d-s, move it to libedataserver instead.
* storage/e-folder-exchange.c: Remove duplicate e_mkdir_hier()
implementation, already have it in libedataserver/e-util.c, and
g_mkdir_with_parents() is what should be used anyway.
(e_folder_exchange_get_storage_file): Use g_mkdir_with_parents()
instead of e_mkdir_hier().
(sanitize_path): Must return something in the error case, this
function is not void.
* storage/e-folder-exchange.c (e_folder_exchange_new_from_file)
* storage/exchange-hierarchy-foreign.c
(exchange_hierarchy_foreign_new_from_dir): Use GMappedFile API and
xmlParseMemory() for portability, as xmlParseFile() on Windows
doesn't take a UTF-8 filename.
--tml
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.37
diff -p -u -2 -r1.37 ChangeLog
--- ChangeLog 26 Nov 2005 09:21:00 -0000 1.37
+++ ChangeLog 30 Nov 2005 01:35:13 -0000
@@ -1,2 +1,65 @@
+2005-11-29 Tor Lillqvist <tml novell com>
+
+ * lib/Makefile.am: Drop unused CONNECTOR_LOCALEDIR.
+
+ * lib/e2k-global-catalog.c: Remove duplicate inclusion of ldap.h,
+ it's already included by e2k-global-catalog-ldap.h. Define
+ LDAP_ROOT_DSE if necessary.
+ (finalize): g_free() works fine on NULL pointers.
+ (connect_ldap, get_ldap_connection): Rename ldap_connect() to
+ connect_ldap() to avoid clash with the function in the LDAP API.
+ (connect_ldap): Use WINNT authentication on Windows.
+
+ * lib/e2k-global-catalog-ldap.h: Include winldap.h on Windows. Add
+ some OpenLDAP macros that aren't present in winldap.h.
+
+ * lib/e2k-autoconfig.c
+ * lib/e2k-context.c: Include appropriate headers on Win32.
+
+ * lib/e2k-autoconfig.c: Drop inclusion of
+ libedataserver/e-account.h and libedataserver/e-account-list.h,
+ that API is not used here.
+ (find_global_catalog): Add Win32 implementation.
+ (find_olson_timezone): Use g_win32_getlocale() on Win32 instead of
+ the usually nonexistent LANG environment variable.
+ (read_config): Form path to connector.conf at run-time for the
+ benefit of Win32 freely chosen end-user install location. Use
+ gstdio wrappers.
+
+ * lib/e2k-context.c: Define strtok_r() using strtok() on Windows,
+ where strtok() is MT-safe. Wrap socket API calls with simple
+ macros for Unix/winsock portability. Use
+ g_io_channel_win32_new_socket() on Windows.
+
+ * lib/e2k-path.c (find_folders_recursive):
+ * storage/exchange-account.c (setup_account_hierarchies): Use
+ g_dir* instead of dirent API for portability.
+
+ * storage/Makefile.am: Use NO_UNDEFINED (meaning -no-undefined on
+ Windows). Link with all needed libraries for the benefit of
+ -no-undefined.
+
+ * storage/exchange-account.c (exchange_account_set_password):
+ Do compile eve if not HAVE_KRB5, but always return failure. Means
+ less ifdefs elsewhere.
+ (e_filename_make_safe): Remove this function which isn't used,
+ especially as there is an exact duplicate in
+ evolution/e-util/e-util.c. If it eventually is needed also here in
+ e-d-s, move it to libedataserver instead.
+
+ * storage/e-folder-exchange.c: Remove duplicate e_mkdir_hier()
+ implementation, already have it in libedataserver/e-util.c, and
+ g_mkdir_with_parents() is what should be used anyway.
+ (e_folder_exchange_get_storage_file): Use g_mkdir_with_parents()
+ instead of e_mkdir_hier().
+ (sanitize_path): Must return something in the error case, this
+ function is not void.
+
+ * storage/e-folder-exchange.c (e_folder_exchange_new_from_file)
+ * storage/exchange-hierarchy-foreign.c
+ (exchange_hierarchy_foreign_new_from_dir): Use GMappedFile API and
+ xmlParseMemory() for portability, as xmlParseFile() on Windows
+ doesn't take a UTF-8 filename.
+
2005-11-26 Sushma Rai <rsushma novell com>
@@ -10,6 +73,5 @@
* lib/e2k-uri.c (e2k_uri_new)
* storage/exchange-oof.c (find_str_case): Use
- g_ascii_strncasecmp() instead of strncasecmp() for
- portability.
+ g_ascii_strncasecmp() instead of strncasecmp() for portability.
2005-10-21 Sarfraaz Ahmed <asarfraaz novell com>
Index: lib/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/Makefile.am,v
retrieving revision 1.9
diff -p -u -2 -r1.9 Makefile.am
--- lib/Makefile.am 25 Oct 2005 10:51:21 -0000 1.9
+++ lib/Makefile.am 30 Nov 2005 01:35:13 -0000
@@ -3,5 +3,4 @@
INCLUDES = \
-DCONNECTOR_PREFIX=\""$(prefix)"\" \
- -DCONNECTOR_LOCALEDIR=\""$(localedir)"\" \
$(LDAP_CFLAGS) \
$(KRB5_CFLAGS) \
Index: lib/e2k-autoconfig.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-autoconfig.c,v
retrieving revision 1.5
diff -p -u -2 -r1.5 e2k-autoconfig.c
--- lib/e2k-autoconfig.c 28 Sep 2005 13:35:18 -0000 1.5
+++ lib/e2k-autoconfig.c 30 Nov 2005 01:35:14 -0000
@@ -38,8 +38,19 @@
#include <sys/stat.h>
#include <unistd.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+#ifndef G_OS_WIN32
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
+#else
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <windns.h>
+#ifndef DNS_TYPE_SRV
+#define DNS_TYPE_SRV 33
+#endif
+#endif
#include "e2k-autoconfig.h"
@@ -53,10 +64,6 @@
#include "xntlm.h"
-//#include <e-util/e-account.h>
-//#include <e-util/e-account-list.h>
-#include <libedataserver/e-account.h>
-#include <libedataserver/e-account-list.h>
+#include <libedataserver/e-util.h>
#include <libedataserverui/e-passwords.h>
-//#include <e-util/e-dialog-utils.h>
#include <gconf/gconf-client.h>
#include <libxml/tree.h>
@@ -65,4 +72,9 @@
#include <gtk/gtk.h>
+#ifdef G_OS_WIN32
+#undef CONNECTOR_PREFIX
+#define CONNECTOR_PREFIX e_util_get_prefix ()
+#endif
+
static char *find_olson_timezone (const char *windows_timezone);
static void set_account_uri_string (E2kAutoconfig *ac);
@@ -769,4 +781,5 @@ static void
find_global_catalog (E2kAutoconfig *ac)
{
+#ifndef G_OS_WIN32
int count, len;
unsigned char answer[1024], namebuf[1024], *end, *p;
@@ -821,4 +834,33 @@ find_global_catalog (E2kAutoconfig *ac)
return;
+#else
+ gchar *name, *casefolded_name;
+ PDNS_RECORD dnsrecp, rover;
+
+ name = g_strconcat ("_gc._tcp.", ac->w2k_domain, NULL);
+ casefolded_name = g_utf8_strdown (name, -1);
+ g_free (name);
+
+ if (DnsQuery_UTF8 (casefolded_name, DNS_TYPE_SRV, DNS_QUERY_STANDARD,
+ NULL, &dnsrecp, NULL) != ERROR_SUCCESS) {
+ g_free (casefolded_name);
+ return;
+ }
+
+ for (rover = dnsrecp; rover != NULL; rover = rover->pNext) {
+ if (rover->wType != DNS_TYPE_SRV ||
+ strcmp (rover->pName, casefolded_name) != 0)
+ continue;
+ ac->gc_server = g_strdup (rover->Data.SRV.pNameTarget);
+ ac->gc_server_autodetected = TRUE;
+ g_free (casefolded_name);
+ DnsRecordListFree (dnsrecp, DnsFreeRecordList);
+ return;
+ }
+
+ g_free (casefolded_name);
+ DnsRecordListFree (dnsrecp, DnsFreeRecordList);
+ return;
+#endif
}
@@ -1283,5 +1325,9 @@ find_olson_timezone (const char *windows
/* Find our language/country (hopefully). */
+#ifndef G_OS_WIN32
locale = getenv ("LANG");
+#else
+ locale = g_win32_getlocale ();
+#endif
if (locale) {
strncpy (lang, locale, 2);
@@ -1290,4 +1336,7 @@ find_olson_timezone (const char *windows
strncpy (country, locale, 2);
}
+#ifdef G_OS_WIN32
+ g_free ((char *) locale);
+#endif
/* Look for an entry where either the country or the
@@ -1320,12 +1369,20 @@ read_config (void)
char *p, *name, *value;
char *config_data;
- int fd;
+ int fd = -1;
config_options = g_hash_table_new (e2k_ascii_strcase_hash,
e2k_ascii_strcase_equal);
- fd = open ("/etc/ximian/connector.conf", O_RDONLY);
- if (fd == -1)
- fd = open (CONNECTOR_PREFIX "/etc/connector.conf", O_RDONLY);
+#ifndef G_OS_WIN32
+ fd = g_open ("/etc/ximian/connector.conf", O_RDONLY, 0);
+#endif
+ if (fd == -1) {
+ gchar *filename = g_build_filename (CONNECTOR_PREFIX,
+ "etc/connector.conf",
+ NULL);
+
+ fd = g_open (filename, O_RDONLY, 0);
+ g_free (filename);
+ }
if (fd == -1)
return;
Index: lib/e2k-context.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-context.c,v
retrieving revision 1.5
diff -p -u -2 -r1.5 e2k-context.c
--- lib/e2k-context.c 23 Sep 2005 10:57:04 -0000 1.5
+++ lib/e2k-context.c 30 Nov 2005 01:35:16 -0000
@@ -29,7 +29,15 @@
#include <unistd.h>
#include <sys/types.h>
+#include <glib.h>
+
+#ifndef G_OS_WIN32
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#else
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#include <windns.h>
+#endif
#include "e2k-context.h"
@@ -52,4 +60,23 @@
#include <libxml/xmlmemory.h>
+#ifdef G_OS_WIN32
+/* The strtok() in Microsoft's C library is MT-safe (not stateless,
+ * but that is not needed here).
+ */
+#define strtok_r(s,sep,lasts ) (*(lasts) = strtok((s),(sep)))
+#endif
+
+#ifdef G_OS_WIN32
+#define CLOSE_SOCKET(socket) closesocket (socket)
+#define STATUS_IS_SOCKET_ERROR(status) ((status) == SOCKET_ERROR)
+#define SOCKET_IS_INVALID(socket) ((socket) == INVALID_SOCKET)
+#define BIND_STATUS_IS_ADDRINUSE() (WSAGetLastError () == WSAEADDRINUSE)
+#else
+#define CLOSE_SOCKET(socket) close (socket)
+#define STATUS_IS_SOCKET_ERROR(status) ((status) == -1)
+#define SOCKET_IS_INVALID(socket) ((socket) < 0)
+#define BIND_STATUS_IS_ADDRINUSE() (errno == EADDRINUSE)
+#endif
+
#define PARENT_TYPE G_TYPE_OBJECT
static GObjectClass *parent_class;
@@ -223,5 +250,5 @@ got_connection (SoupSocket *sock, guint
s = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
- if (s == -1)
+ if (SOCKET_IS_INVALID (s))
goto done;
@@ -236,12 +263,16 @@ got_connection (SoupSocket *sock, guint
sin.sin_port = htons (port);
ret = bind (s, (struct sockaddr *)&sin, sizeof (sin));
- } while (ret == -1 && errno == EADDRINUSE);
+ } while (STATUS_IS_SOCKET_ERROR (ret) && BIND_STATUS_IS_ADDRINUSE ());
if (ret == -1) {
- close (s);
+ CLOSE_SOCKET (s);
goto done;
}
+#ifndef G_OS_WIN32
ctx->priv->listener_channel = g_io_channel_unix_new (s);
+#else
+ ctx->priv->listener_channel = g_io_channel_win32_new_socket (s);
+#endif
g_io_channel_set_encoding (ctx->priv->listener_channel, NULL, NULL);
g_io_channel_set_buffered (ctx->priv->listener_channel, FALSE);
Index: lib/e2k-global-catalog-ldap.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-global-catalog-ldap.h,v
retrieving revision 1.1
diff -p -u -2 -r1.1 e2k-global-catalog-ldap.h
--- lib/e2k-global-catalog-ldap.h 13 Jun 2005 10:49:57 -0000 1.1
+++ lib/e2k-global-catalog-ldap.h 30 Nov 2005 01:35:16 -0000
@@ -5,5 +5,18 @@
#define __E2K_GLOBAL_CATALOG_LDAP_H__
+#include <glib.h>
+#ifndef G_OS_WIN32
#include <ldap.h>
+#else
+#define interface windows_interface
+#include <windows.h>
+#undef interface
+#include <winldap.h>
+#define LDAP_ROOT_DSE ""
+#define LDAP_RANGE(n,x,y) (((x) <= (n)) && ((n) <= (y)))
+#define LDAP_NAME_ERROR(n) LDAP_RANGE((n),0x20,0x24) /* 32-34,36 */
+#define ldap_msgtype(lm) (lm)->lm_msgtype
+#define ldap_msgid(lm) (lm)->lm_msgid
+#endif
#include "e2k-global-catalog.h"
Index: lib/e2k-global-catalog.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-global-catalog.c,v
retrieving revision 1.4
diff -p -u -2 -r1.4 e2k-global-catalog.c
--- lib/e2k-global-catalog.c 31 Aug 2005 04:26:08 -0000 1.4
+++ lib/e2k-global-catalog.c 30 Nov 2005 01:35:17 -0000
@@ -31,6 +31,4 @@
#include <sys/time.h>
-#include <ldap.h>
-
#ifdef HAVE_LDAP_NTLM_BIND
#include "xntlm.h"
@@ -148,10 +146,7 @@ finalize (GObject *object)
g_hash_table_destroy (gc->priv->server_cache);
- if (gc->priv->server)
- g_free (gc->priv->server);
- if (gc->priv->user)
- g_free (gc->priv->user);
- if (gc->priv->nt_domain)
- g_free (gc->priv->nt_domain);
+ g_free (gc->priv->server);
+ g_free (gc->priv->user);
+ g_free (gc->priv->nt_domain);
if (gc->priv->password) {
memset (gc->priv->password, 0, strlen (gc->priv->password));
@@ -165,8 +160,6 @@ finalize (GObject *object)
}
- if (gc->domain) {
- g_free (gc->domain);
- gc->domain = NULL;
- }
+ g_free (gc->domain);
+ gc->domain = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -312,9 +305,12 @@ ntlm_bind (E2kGlobalCatalog *gc, E2kOper
static int
-ldap_connect (E2kGlobalCatalog *gc, E2kOperation *op, LDAP *ldap)
+connect_ldap (E2kGlobalCatalog *gc, E2kOperation *op, LDAP *ldap)
{
int ldap_error;
#ifndef HAVE_LDAP_NTLM_BIND
char *nt_name;
+#ifdef G_OS_WIN32
+ SEC_WINNT_AUTH_IDENTITY_W auth;
+#endif
#endif
@@ -326,5 +322,21 @@ ldap_connect (E2kGlobalCatalog *gc, E2kO
g_strdup_printf ("%s\\%s", gc->priv->nt_domain, gc->priv->user) :
g_strdup (gc->priv->user);
+#ifndef G_OS_WIN32
ldap_error = ldap_simple_bind_s (ldap, nt_name, gc->priv->password);
+#else
+ auth.User = g_utf8_to_utf16 (gc->priv->user, -1, NULL, NULL, NULL);
+ auth.UserLength = wcslen (auth.User);
+ auth.Domain = gc->priv->nt_domain ?
+ g_utf8_to_utf16 (gc->priv->nt_domain, -1, NULL, NULL, NULL) :
+ g_utf8_to_utf16 ("", -1, NULL, NULL, NULL);
+ auth.DomainLength = wcslen (auth.Domain);
+ auth.Password = g_utf8_to_utf16 (gc->priv->password, -1, NULL, NULL, NULL);
+ auth.PasswordLength = wcslen (auth.Password);
+ auth.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
+ ldap_error = ldap_bind_s (ldap, nt_name, &auth, LDAP_AUTH_NTLM);
+ g_free (auth.Password);
+ g_free (auth.Domain);
+ g_free (auth.User);
+#endif
g_free (nt_name);
#endif
@@ -362,5 +374,5 @@ get_ldap_connection (E2kGlobalCatalog *g
ldap_set_option (*ldap, LDAP_OPT_PROTOCOL_VERSION, &ldap_opt);
- ldap_error = ldap_connect (gc, op, *ldap);
+ ldap_error = connect_ldap (gc, op, *ldap);
if (ldap_error != LDAP_SUCCESS) {
ldap_unbind (*ldap);
@@ -380,5 +392,5 @@ get_gc_connection (E2kGlobalCatalog *gc,
return LDAP_SUCCESS;
- return ldap_connect (gc, op, gc->priv->ldap);
+ return connect_ldap (gc, op, gc->priv->ldap);
} else {
return get_ldap_connection (gc, op,
Index: lib/e2k-path.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-path.c,v
retrieving revision 1.3
diff -p -u -2 -r1.3 e2k-path.c
--- lib/e2k-path.c 31 Aug 2005 04:26:08 -0000 1.3
+++ lib/e2k-path.c 30 Nov 2005 01:35:17 -0000
@@ -22,9 +22,9 @@
#include <sys/types.h>
-#include <dirent.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <glib.h>
+#include <glib/gstdio.h>
#include "e2k-path.h"
@@ -128,5 +128,5 @@ find_folders_recursive (const char *phys
EPathFindFoldersCallback callback, gpointer data)
{
- DIR *dir;
+ GDir *dir;
char *subfolder_directory_path;
gboolean ok;
@@ -146,5 +146,5 @@ find_folders_recursive (const char *phys
/* Now scan the subfolders and load them. */
- dir = opendir (subfolder_directory_path);
+ dir = g_dir_open (subfolder_directory_path, 0, NULL);
if (dir == NULL) {
g_free (subfolder_directory_path);
@@ -155,19 +155,16 @@ find_folders_recursive (const char *phys
while (ok) {
struct stat file_stat;
- struct dirent *dirent;
+ const char *dirent;
char *file_path;
char *new_path;
- dirent = readdir (dir);
+ dirent = g_dir_read_name (dir);
if (dirent == NULL)
break;
- if (strcmp (dirent->d_name, ".") == 0 || strcmp (dirent->d_name, "..") == 0)
- continue;
-
file_path = g_strdup_printf ("%s/%s", subfolder_directory_path,
- dirent->d_name);
+ dirent);
- if (stat (file_path, &file_stat) < 0 ||
+ if (g_stat (file_path, &file_stat) < 0 ||
! S_ISDIR (file_stat.st_mode)) {
g_free (file_path);
@@ -175,5 +172,5 @@ find_folders_recursive (const char *phys
}
- new_path = g_strdup_printf ("%s/%s", path, dirent->d_name);
+ new_path = g_strdup_printf ("%s/%s", path, dirent);
ok = find_folders_recursive (file_path, new_path, callback, data);
@@ -183,5 +180,5 @@ find_folders_recursive (const char *phys
}
- closedir (dir);
+ g_dir_close (dir);
g_free (subfolder_directory_path);
Index: storage/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/Makefile.am,v
retrieving revision 1.10
diff -p -u -2 -r1.10 Makefile.am
--- storage/Makefile.am 21 Jul 2005 14:45:56 -0000 1.10
+++ storage/Makefile.am 30 Nov 2005 01:35:18 -0000
@@ -1,4 +1,9 @@
# Fix the code to not use E_DATA_SERVER_UI_CFLAGS
+if OS_WIN32
+WIN32_BOOTSTRAP_LIBS = \
+ $(top_builddir)/win32/libedataserverui-1.2.la
+endif
+
INCLUDES = \
-DG_LOG_DOMAIN=\"evolution-exchange-storage\" \
@@ -17,5 +22,4 @@ INCLUDES = \
-I$(top_srcdir)/servers/exchange/lib \
-I$(top_srcdir)/servers/exchange/xntlm
-
lib_LTLIBRARIES = \
libexchange-storage-1.2.la
@@ -72,13 +76,17 @@ NODIST_FILES = $(MARSHAL_GENERATED)
libexchange_storage_1_2_la_LIBADD = \
+ $(WIN32_BOOTSTRAP_LIBS) \
+ $(top_builddir)/servers/exchange/lib/libexchange.la \
+ $(top_builddir)/servers/exchange/xntlm/libxntlm.la \
+ $(top_builddir)/libedataserver/libedataserver-1.2.la \
$(E_DATA_SERVER_LIBS) \
$(E_DATA_SERVER_UI_LIBS) \
$(LDAP_LIBS) \
- $(SOUP_LIBS)
+ $(SOUP_LIBS) \
+ $(SOCKET_LIBS)
libexchange_storage_1_2_la_LDFLAGS = \
$(KRB5_LDFLAGS) \
- $(top_builddir)/servers/exchange/lib/libexchange.la \
- $(top_builddir)/servers/exchange/xntlm/libxntlm.la \
+ $(NO_UNDEFINED) \
-version-info $(LIBEXCHANGE_STORAGE_CURRENT):$(LIBEXCHANGE_STORAGE_REVISION):$(LIBEXCHANGE_STORAGE_AGE)
Index: storage/e-folder-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/e-folder-exchange.c,v
retrieving revision 1.7
diff -p -u -2 -r1.7 e-folder-exchange.c
--- storage/e-folder-exchange.c 28 Sep 2005 13:35:18 -0000 1.7
+++ storage/e-folder-exchange.c 30 Nov 2005 01:35:18 -0000
@@ -107,46 +107,4 @@ finalize (GObject *object)
E2K_MAKE_TYPE (e_folder_exchange, EFolderExchange, class_init, init, PARENT_TYPE)
-/**
- * Added from gal/util/e-util.c
- * e_mkdir_hier:
- * @path: a directory path
- * @mode: a mode, as for mkdir(2)
- *
- * This creates the named directory with the given @mode, creating
- * any necessary intermediate directories (with the same @mode).
- *
- * Return value: 0 on success, -1 on error, in which case errno will
- * be set as for mkdir(2).
- **/
-static int
-e_mkdir_hier(const char *path, mode_t mode)
-{
- char *copy, *p;
-
- if (path[0] == '/') {
- p = copy = g_strdup (path);
- } else {
- gchar *current_dir = g_get_current_dir();
- p = copy = g_build_filename (current_dir, path, NULL);
- }
-
- do {
- p = strchr (p + 1, '/');
- if (p)
- *p = '\0';
- if (access (copy, F_OK) == -1) {
- if (mkdir (copy, mode) == -1) {
- g_free (copy);
- return -1;
- }
- }
- if (p)
- *p = '/';
- } while (p);
-
- g_free (copy);
- return 0;
-}
-
static char *
sanitize_path (const char *path)
@@ -156,5 +114,5 @@ sanitize_path (const char *path)
if (!path)
- return;
+ return ""; /* ??? or NULL? */
comps = g_strsplit (path, ";", 2);
@@ -445,5 +403,5 @@ e_folder_exchange_get_storage_file (EFol
efe->priv->hier->account->storage_dir,
efe->priv->path);
- e_mkdir_hier (efe->priv->storage_dir, 0755);
+ g_mkdir_with_parents (efe->priv->storage_dir, 0755);
}
@@ -546,6 +504,13 @@ e_folder_exchange_new_from_file (Exchang
char *permanent_uri = NULL;
char *folder_size = NULL;
+ GMappedFile *mapped_file;
+
+ mapped_file = g_mapped_file_new (filename, FALSE, NULL);
+ if (!mapped_file)
+ return NULL;
+ doc = xmlParseMemory (g_mapped_file_get_contents (mapped_file),
+ g_mapped_file_get_length (mapped_file));
+ g_mapped_file_free (mapped_file);
- doc = xmlParseFile (filename);
if (!doc)
return NULL;
Index: storage/exchange-account.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-account.c,v
retrieving revision 1.20
diff -p -u -2 -r1.20 exchange-account.c
--- storage/exchange-account.c 26 Nov 2005 09:21:01 -0000 1.20
+++ storage/exchange-account.c 30 Nov 2005 01:35:20 -0000
@@ -52,5 +52,4 @@
#include <gtk/gtklabel.h>
-#include <dirent.h>
#include <stdlib.h>
#include <string.h>
@@ -1135,8 +1134,8 @@ exchange_account_forget_password (Exchan
}
-#ifdef HAVE_KRB5
ExchangeAccountResult
exchange_account_set_password (ExchangeAccount *account, char *old_pass, char *new_pass)
{
+#ifdef HAVE_KRB5
E2kKerberosResult result;
char *domain;
@@ -1184,6 +1183,9 @@ exchange_account_set_password (ExchangeA
return EXCHANGE_ACCOUNT_PASSWORD_CHANGE_SUCCESS;
-}
+#else
+ g_warning ("exchange_account_set_password: Not implemented (no KRB5)");
+ return EXCHANGE_ACCOUNT_PASSWORD_CHANGE_FAILED;
#endif
+}
/**
@@ -1252,27 +1254,4 @@ exchange_account_is_offline (ExchangeAcc
}
-// SURF : Picked this from gal/util/e-util.c
-/* This only makes a filename safe for usage as a filename. It still may have shell meta-characters in it. */
-static void
-e_filename_make_safe (gchar *string)
-{
- gchar *p, *ts;
- gunichar c;
-
- g_return_if_fail (string != NULL);
- p = string;
-
- while(p && *p) {
- c = g_utf8_get_char (p);
- ts = p;
- p = g_utf8_next_char (p);
- if (!g_unichar_isprint(c) || ( c < 0xff && strchr (" /'\"`&();|<>$%{}!", c&0xff ))) {
- while (ts<p)
- *ts++ = '_';
- }
- }
-}
-
-
static gboolean
setup_account_hierarchies (ExchangeAccount *account)
@@ -1281,6 +1260,6 @@ setup_account_hierarchies (ExchangeAccou
ExchangeAccountFolderResult fresult;
char *phys_uri_prefix, *dir;
- DIR *d;
- struct dirent *dent;
+ GDir *d;
+ const char *dent;
int offline;
@@ -1350,11 +1329,10 @@ setup_account_hierarchies (ExchangeAccou
/* Other users' folders */
- d = opendir (account->storage_dir);
+ d = g_dir_open (account->storage_dir, 0, NULL);
if (d) {
- while ((dent = readdir (d))) {
- if (!strchr (dent->d_name, '@'))
+ while ((dent = g_dir_read_name (d))) {
+ if (!strchr (dent, '@'))
continue;
- dir = g_strdup_printf ("%s/%s", account->storage_dir,
- dent->d_name);
+ dir = g_strdup_printf ("%s/%s", account->storage_dir, dent);
hier = exchange_hierarchy_foreign_new_from_dir (account, dir);
g_free (dir);
@@ -1364,5 +1342,5 @@ setup_account_hierarchies (ExchangeAccou
setup_hierarchy_foreign (account, hier);
}
- closedir (d);
+ g_dir_close (d);
}
Index: storage/exchange-hierarchy-foreign.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-hierarchy-foreign.c,v
retrieving revision 1.5
diff -p -u -2 -r1.5 exchange-hierarchy-foreign.c
--- storage/exchange-hierarchy-foreign.c 31 Aug 2005 04:26:09 -0000 1.5
+++ storage/exchange-hierarchy-foreign.c 30 Nov 2005 01:35:20 -0000
@@ -219,5 +219,4 @@ find_folder (ExchangeHierarchy *hier, co
EFolder *folder;
const char *access;
- int offline;
status = e2k_context_propfind (ctx, NULL, uri,
@@ -272,5 +271,4 @@ create_internal (ExchangeHierarchy *hier
const char *home_uri;
int i;
- int offline;
/* For now, no nesting */
@@ -564,4 +562,5 @@ exchange_hierarchy_foreign_new_from_dir
GHashTable *props;
xmlDoc *doc;
+ GMappedFile *mapped_file;
g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), NULL);
@@ -569,6 +568,13 @@ exchange_hierarchy_foreign_new_from_dir
mf_path = g_build_filename (folder_path, "hierarchy.xml", NULL);
- doc = xmlParseFile (mf_path);
+
+ mapped_file = g_mapped_file_new (mf_path, FALSE, NULL);
+ if (!mapped_file)
+ return NULL;
+ doc = xmlParseMemory (g_mapped_file_get_contents (mapped_file),
+ g_mapped_file_get_length (mapped_file));
+ g_mapped_file_free (mapped_file);
g_free (mf_path);
+
if (!doc)
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]