[arch-commits] Commit in gnome-online-accounts/trunk (6 files)

Jan de Groot jgc at nymeria.archlinux.org
Mon Aug 5 10:07:45 UTC 2013


    Date: Monday, August 5, 2013 @ 12:07:45
  Author: jgc
Revision: 192044

upgpkg: gnome-online-accounts 3.8.2-2

Add minor fixes from upstream, add backport from ubuntu that implements OAth 2.0 for CALDAV

Added:
  gnome-online-accounts/trunk/drop-google-password-interface-1.patch
  gnome-online-accounts/trunk/drop-google-password-interface-2.patch
  gnome-online-accounts/trunk/drop-google-password-interface-3.patch
  gnome-online-accounts/trunk/imap-smtp.patch
  gnome-online-accounts/trunk/smtp-auth-plain.patch
Modified:
  gnome-online-accounts/trunk/PKGBUILD

----------------------------------------+
 PKGBUILD                               |   28 ++
 drop-google-password-interface-1.patch |   39 ++++
 drop-google-password-interface-2.patch |   74 +++++++
 drop-google-password-interface-3.patch |  296 +++++++++++++++++++++++++++++++
 imap-smtp.patch                        |   20 ++
 smtp-auth-plain.patch                  |   88 +++++++++
 6 files changed, 542 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2013-08-05 08:13:41 UTC (rev 192043)
+++ PKGBUILD	2013-08-05 10:07:45 UTC (rev 192044)
@@ -3,7 +3,7 @@
 
 pkgname=gnome-online-accounts
 pkgver=3.8.2
-pkgrel=1
+pkgrel=2
 pkgdesc="GNOME service to access online accounts"
 arch=(i686 x86_64)
 url="http://www.gnome.org"
@@ -12,9 +12,31 @@
 makedepends=('intltool' 'libxslt' 'gobject-introspection' 'docbook-xsl')
 options=(!libtool)
 install=$pkgname.install
-source=(http://download.gnome.org/sources/$pkgname/${pkgver:0:3}/$pkgname-$pkgver.tar.xz)
-sha256sums=('12611a002043c8acc29e9800ec009e3e19736bdb6237d246e848d7c7909fe826')
+source=(http://download.gnome.org/sources/$pkgname/${pkgver:0:3}/$pkgname-$pkgver.tar.xz
+        imap-smtp.patch
+        smtp-auth-plain.patch
+        drop-google-password-interface-1.patch
+        drop-google-password-interface-2.patch
+        drop-google-password-interface-3.patch)
+sha256sums=('12611a002043c8acc29e9800ec009e3e19736bdb6237d246e848d7c7909fe826'
+            '2b413d1f401647bd143b7dc6dd4b6d6660ff47ef9a11ccbc691b7c13de5cba69'
+            'e7250be7c078053345699250433b7164751d3e457155bd35508c7d1660f459be'
+            '33435c10aa1ba3fbb6fd633dc098cd1da50629f1d602521ca83be5379f2ebe48'
+            'c837f9be4e5e072a06ea44076e6b9a1519c66c95b16d7a55b1dba105fded317f'
+            '18dfad8ed978af1068fd057bbe323006c349ac4ea77c742aa06f1011dc92326e')
 
+prepare() {
+  cd $pkgname-$pkgver
+  # Upstream 3.8 branch
+  patch -Np1 -i ../imap-smtp.patch
+  patch -Np1 -i ../smtp-auth-plain.patch
+  
+  # Backport from Ubuntu
+  patch -Np1 -i ../drop-google-password-interface-1.patch
+  patch -Np1 -i ../drop-google-password-interface-2.patch
+  patch -Np1 -i ../drop-google-password-interface-3.patch
+}
+ 
 build() {
   cd $pkgname-$pkgver
   ./configure --prefix=/usr --libexec=/usr/lib/gnome-online-accounts

Added: drop-google-password-interface-1.patch
===================================================================
--- drop-google-password-interface-1.patch	                        (rev 0)
+++ drop-google-password-interface-1.patch	2013-08-05 10:07:45 UTC (rev 192044)
@@ -0,0 +1,39 @@
+From 9182fb378614abb2ff0245fe71a753f22eaaa906 Mon Sep 17 00:00:00 2001
+From: Debarshi Ray <debarshir at gnome.org>
+Date: Tue, 11 Jun 2013 14:58:21 +0000
+Subject: google: Bump credentials generation
+
+Access to the following were turned on in the Google APIs Console:
+ - Calendar API
+ - Google Calendar CalDAV API
+ - Google Contacts CardDAV API
+
+Of these, only the last two are new. We were already requesting the
+scope for Calendar API, but looks like the APIs Console is the way
+to go now. Interestingly the APIs Console does not list all the other
+services that we are interested in, or it is does but is not obvious
+to me.
+
+In any case we need access to their new CalDAV API which works with
+OAuth2 because that would let us work with 2-factor authenticated
+accounts again.
+
+See: https://bugzilla.gnome.org/show_bug.cgi?id=686804
+     https://bugzilla.gnome.org/show_bug.cgi?id=688364
+---
+(limited to 'src/goabackend/goagoogleprovider.c')
+
+diff --git a/src/goabackend/goagoogleprovider.c b/src/goabackend/goagoogleprovider.c
+index 8271711..79f5f73 100644
+--- a/src/goabackend/goagoogleprovider.c
++++ b/src/goabackend/goagoogleprovider.c
+@@ -148,7 +148,7 @@ get_scope (GoaOAuth2Provider *provider)
+ static guint
+ get_credentials_generation (GoaProvider *provider)
+ {
+-  return 3;
++  return 4;
+ }
+ 
+ static const gchar *
+

Added: drop-google-password-interface-2.patch
===================================================================
--- drop-google-password-interface-2.patch	                        (rev 0)
+++ drop-google-password-interface-2.patch	2013-08-05 10:07:45 UTC (rev 192044)
@@ -0,0 +1,74 @@
+From a0fd4cd595bd0fe6eb4015ea9050170319b16546 Mon Sep 17 00:00:00 2001
+From: Debarshi Ray <debarshir at gnome.org>
+Date: Wed, 19 Jun 2013 15:04:38 +0000
+Subject: google: Export CalDAV and CardDAV endpoints
+
+According to:
+https://developers.google.com/google-apps/calendar/caldav/v2/guide/
+https://developers.google.com/google-apps/carddav/
+
+See: https://bugzilla.gnome.org/show_bug.cgi?id=686804
+     https://bugzilla.gnome.org/show_bug.cgi?id=688364
+---
+(limited to 'src/goabackend/goagoogleprovider.c')
+
+diff --git a/src/goabackend/goagoogleprovider.c b/src/goabackend/goagoogleprovider.c
+index 79f5f73..740c08e 100644
+--- a/src/goabackend/goagoogleprovider.c
++++ b/src/goabackend/goagoogleprovider.c
+@@ -385,6 +385,7 @@ build_object (GoaProvider         *provider,
+   gboolean contacts_enabled;
+   gboolean chat_enabled;
+   gboolean documents_enabled;
++  const gchar *email_address;
+ 
+   account = NULL;
+   mail = NULL;
+@@ -419,6 +420,7 @@ build_object (GoaProvider         *provider,
+     }
+ 
+   account = goa_object_get_account (GOA_OBJECT (object));
++  email_address = goa_account_get_identity (account);
+ 
+   /* Email */
+   mail = goa_object_get_mail (GOA_OBJECT (object));
+@@ -427,8 +429,6 @@ build_object (GoaProvider         *provider,
+     {
+       if (mail == NULL)
+         {
+-          const gchar *email_address;
+-          email_address = goa_account_get_identity (account);
+           mail = goa_mail_skeleton_new ();
+           g_object_set (G_OBJECT (mail),
+                         "email-address",   email_address,
+@@ -457,8 +457,19 @@ build_object (GoaProvider         *provider,
+     {
+       if (calendar == NULL)
+         {
++          gchar *uri_caldav;
++
++          uri_caldav = g_strconcat ("https://apidata.googleusercontent.com/caldav/v2/",
++                                    email_address,
++                                    "/user",
++                                    NULL);
++
+           calendar = goa_calendar_skeleton_new ();
++          g_object_set (G_OBJECT (calendar),
++                        "uri", uri_caldav,
++                        NULL);
+           goa_object_skeleton_set_calendar (object, calendar);
++          g_free (uri_caldav);
+         }
+     }
+   else
+@@ -475,6 +486,9 @@ build_object (GoaProvider         *provider,
+       if (contacts == NULL)
+         {
+           contacts = goa_contacts_skeleton_new ();
++          g_object_set (G_OBJECT (contacts),
++                        "uri", "https://www.googleapis.com/.well-known/carddav",
++                        NULL);
+           goa_object_skeleton_set_contacts (object, contacts);
+         }
+     }
+

Added: drop-google-password-interface-3.patch
===================================================================
--- drop-google-password-interface-3.patch	                        (rev 0)
+++ drop-google-password-interface-3.patch	2013-08-05 10:07:45 UTC (rev 192044)
@@ -0,0 +1,296 @@
+From 365a5a92909fce8dcdd851b5a2b9caf34e0da926 Mon Sep 17 00:00:00 2001
+From: Debarshi Ray <debarshir at gnome.org>
+Date: Fri, 28 Jun 2013 12:22:07 +0000
+Subject: google: Don't offer a PasswordBased interface
+
+This was a temporary measure back when Google did not support OAuth2
+for CalDAV. Now that they do, we can drop this.
+
+In any case, the workaround didn't work with accounts using 2-factor
+authentication. This will make those people happy.
+
+This reverts 89c335479c1bb8409af8296c99ffea602a28b71f
+
+See: https://bugzilla.gnome.org/show_bug.cgi?id=686804
+     https://bugzilla.gnome.org/show_bug.cgi?id=688364
+---
+(limited to 'src/goabackend/goagoogleprovider.c')
+
+Index: gnome-online-accounts-3.8.2/src/goabackend/goagoogleprovider.c
+===================================================================
+--- gnome-online-accounts-3.8.2.orig/src/goabackend/goagoogleprovider.c	2013-07-10 13:29:35.381448621 -0400
++++ gnome-online-accounts-3.8.2/src/goabackend/goagoogleprovider.c	2013-07-10 13:29:35.377448621 -0400
+@@ -32,8 +32,6 @@
+ #include "goaprovider-priv.h"
+ #include "goaoauth2provider.h"
+ #include "goagoogleprovider.h"
+-#include "goahttpclient.h"
+-#include "goautils.h"
+ 
+ /**
+  * GoaGoogleProvider:
+@@ -71,8 +69,6 @@
+ 
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
+-static const gchar *CALDAV_ENDPOINT = "https://www.google.com/calendar/dav/%s/events/";
+-
+ static const gchar *
+ get_provider_type (GoaProvider *_provider)
+ {
+@@ -310,48 +306,8 @@
+   return ret;
+ }
+ 
+-static gboolean
+-is_password_node (GoaOAuth2Provider *provider, WebKitDOMHTMLInputElement *element)
+-{
+-  gboolean ret;
+-  gchar *element_type;
+-  gchar *id;
+-  gchar *name;
+-
+-  element_type = NULL;
+-  id = NULL;
+-  name = NULL;
+-
+-  ret = FALSE;
+-
+-  g_object_get (element, "type", &element_type, NULL);
+-  if (g_strcmp0 (element_type, "password") != 0)
+-    goto out;
+-
+-  id = webkit_dom_html_element_get_id (WEBKIT_DOM_HTML_ELEMENT (element));
+-  if (g_strcmp0 (id, "Passwd") != 0)
+-    goto out;
+-
+-  name = webkit_dom_html_input_element_get_name (element);
+-  if (g_strcmp0 (name, "Passwd") != 0)
+-    goto out;
+-
+-  ret = TRUE;
+-
+- out:
+-  g_free (element_type);
+-  g_free (id);
+-  g_free (name);
+-  return ret;
+-}
+-
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
+-static gboolean on_handle_get_password (GoaPasswordBased      *interface,
+-                                        GDBusMethodInvocation *invocation,
+-                                        const gchar           *id,
+-                                        gpointer               user_data);
+-
+ static gboolean
+ build_object (GoaProvider         *provider,
+               GoaObjectSkeleton   *object,
+@@ -367,7 +323,6 @@
+   GoaContacts *contacts;
+   GoaChat *chat;
+   GoaDocuments *documents;
+-  GoaPasswordBased *password_based;
+   gboolean ret;
+   gboolean mail_enabled;
+   gboolean calendar_enabled;
+@@ -394,20 +349,6 @@
+                                                                             error))
+     goto out;
+ 
+-  password_based = goa_object_get_password_based (GOA_OBJECT (object));
+-  if (password_based == NULL)
+-    {
+-      password_based = goa_password_based_skeleton_new ();
+-      /* Ensure D-Bus method invocations run in their own thread */
+-      g_dbus_interface_skeleton_set_flags (G_DBUS_INTERFACE_SKELETON (password_based),
+-                                           G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD);
+-      goa_object_skeleton_set_password_based (object, password_based);
+-      g_signal_connect (password_based,
+-                        "handle-get-password",
+-                        G_CALLBACK (on_handle_get_password),
+-                        NULL);
+-    }
+-
+   account = goa_object_get_account (GOA_OBJECT (object));
+   email_address = goa_account_get_identity (account);
+ 
+@@ -567,103 +508,6 @@
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
+ static gboolean
+-ensure_credentials_sync (GoaProvider   *provider,
+-                         GoaObject     *object,
+-                         gint          *out_expires_in,
+-                         GCancellable  *cancellable,
+-                         GError       **error)
+-{
+-  GVariant *credentials;
+-  GoaAccount *account;
+-  GoaHttpClient *http_client;
+-  gboolean ret;
+-  const gchar *username;
+-  gchar *password;
+-  gchar *uri_caldav;
+-
+-  credentials = NULL;
+-  http_client = NULL;
+-  password = NULL;
+-  uri_caldav = NULL;
+-
+-  ret = FALSE;
+-
+-  /* Chain up */
+-  if (!GOA_PROVIDER_CLASS (goa_google_provider_parent_class)->ensure_credentials_sync (provider,
+-                                                                                       object,
+-                                                                                       out_expires_in,
+-                                                                                       cancellable,
+-                                                                                       error))
+-    goto out;
+-
+-  credentials = goa_utils_lookup_credentials_sync (provider,
+-                                                   object,
+-                                                   cancellable,
+-                                                   error);
+-  if (credentials == NULL)
+-    {
+-      if (error != NULL)
+-        {
+-          (*error)->domain = GOA_ERROR;
+-          (*error)->code = GOA_ERROR_NOT_AUTHORIZED;
+-        }
+-      goto out;
+-    }
+-
+-  account = goa_object_peek_account (object);
+-  username = goa_account_get_presentation_identity (account);
+-  uri_caldav = g_strdup_printf (CALDAV_ENDPOINT, username);
+-
+-  if (!g_variant_lookup (credentials, "password", "s", &password))
+-    {
+-      if (error != NULL)
+-        {
+-          *error = g_error_new (GOA_ERROR,
+-                                GOA_ERROR_NOT_AUTHORIZED,
+-                                _("Did not find password with identity `%s' in credentials"),
+-                                username);
+-        }
+-      goto out;
+-    }
+-
+-  http_client = goa_http_client_new ();
+-  ret = goa_http_client_check_sync (http_client,
+-                                    uri_caldav,
+-                                    username,
+-                                    password,
+-                                    FALSE,
+-                                    cancellable,
+-                                    error);
+-  if (!ret)
+-    {
+-      if (error != NULL)
+-        {
+-          g_prefix_error (error,
+-                          /* Translators: the first %s is the username
+-                           * (eg., debarshi.ray at gmail.com or rishi), and the
+-                           * (%s, %d) is the error domain and code.
+-                           */
+-                          _("Invalid password with username `%s' (%s, %d): "),
+-                          username,
+-                          g_quark_to_string ((*error)->domain),
+-                          (*error)->code);
+-          (*error)->domain = GOA_ERROR;
+-          (*error)->code = GOA_ERROR_NOT_AUTHORIZED;
+-        }
+-      goto out;
+-    }
+-
+- out:
+-  g_clear_object (&http_client);
+-  g_free (password);
+-  g_free (uri_caldav);
+-  g_clear_pointer (&credentials, (GDestroyNotify) g_variant_unref);
+-  return ret;
+-}
+-
+-/* ---------------------------------------------------------------------------------------------------- */
+-
+-static gboolean
+ get_use_mobile_browser (GoaOAuth2Provider *provider)
+ {
+   return TRUE;
+@@ -744,7 +588,6 @@
+   provider_class->get_provider_name          = get_provider_name;
+   provider_class->get_provider_group         = get_provider_group;
+   provider_class->build_object               = build_object;
+-  provider_class->ensure_credentials_sync    = ensure_credentials_sync;
+   provider_class->show_account               = show_account;
+   provider_class->get_credentials_generation = get_credentials_generation;
+ 
+@@ -758,65 +601,7 @@
+   oauth2_class->get_scope                 = get_scope;
+   oauth2_class->is_deny_node              = is_deny_node;
+   oauth2_class->is_identity_node          = is_identity_node;
+-  oauth2_class->is_password_node          = is_password_node;
+   oauth2_class->get_token_uri             = get_token_uri;
+   oauth2_class->get_use_mobile_browser    = get_use_mobile_browser;
+   oauth2_class->add_account_key_values    = add_account_key_values;
+ }
+-
+-/* ---------------------------------------------------------------------------------------------------- */
+-
+-/* runs in a thread dedicated to handling @invocation */
+-static gboolean
+-on_handle_get_password (GoaPasswordBased      *interface,
+-                        GDBusMethodInvocation *invocation,
+-                        const gchar           *id, /* unused */
+-                        gpointer               user_data)
+-{
+-  GoaObject *object;
+-  GoaAccount *account;
+-  GoaProvider *provider;
+-  GError *error;
+-  GVariant *credentials;
+-  const gchar *identity;
+-  gchar *password;
+-
+-  /* TODO: maybe log what app is requesting access */
+-
+-  password = NULL;
+-  credentials = NULL;
+-
+-  object = GOA_OBJECT (g_dbus_interface_get_object (G_DBUS_INTERFACE (interface)));
+-  account = goa_object_peek_account (object);
+-  identity = goa_account_get_identity (account);
+-  provider = goa_provider_get_for_provider_type (goa_account_get_provider_type (account));
+-
+-  error = NULL;
+-  credentials = goa_utils_lookup_credentials_sync (provider,
+-                                                   object,
+-                                                   NULL, /* GCancellable* */
+-                                                   &error);
+-  if (credentials == NULL)
+-    {
+-      g_dbus_method_invocation_take_error (invocation, error);
+-      goto out;
+-    }
+-
+-  if (!g_variant_lookup (credentials, "password", "s", &password))
+-    {
+-      g_dbus_method_invocation_return_error (invocation,
+-                                             GOA_ERROR,
+-                                             GOA_ERROR_FAILED, /* TODO: more specific */
+-                                             _("Did not find password with identity `%s' in credentials"),
+-                                             identity);
+-      goto out;
+-    }
+-
+-  goa_password_based_complete_get_password (interface, invocation, password);
+-
+- out:
+-  g_free (password);
+-  g_clear_pointer (&credentials, (GDestroyNotify) g_variant_unref);
+-  g_object_unref (provider);
+-  return TRUE; /* invocation was handled */
+-}

Added: imap-smtp.patch
===================================================================
--- imap-smtp.patch	                        (rev 0)
+++ imap-smtp.patch	2013-08-05 10:07:45 UTC (rev 192044)
@@ -0,0 +1,20 @@
+From 034da0871ad78629f9d0df618be494dbb19157e4 Mon Sep 17 00:00:00 2001
+From: Debarshi Ray <debarshir at gnome.org>
+Date: Tue, 18 Jun 2013 10:35:42 +0000
+Subject: imap-smtp: Prevent error messages from expanding the dialog
+
+---
+diff --git a/src/goabackend/goaimapsmtpprovider.c b/src/goabackend/goaimapsmtpprovider.c
+index d10a9d8..841327d 100644
+--- a/src/goabackend/goaimapsmtpprovider.c
++++ b/src/goabackend/goaimapsmtpprovider.c
+@@ -669,6 +669,7 @@ create_account_details_ui (GoaProvider    *provider,
+ 
+   data->cluebar_label = gtk_label_new ("");
+   gtk_label_set_line_wrap (GTK_LABEL (data->cluebar_label), TRUE);
++  gtk_label_set_max_width_chars (GTK_LABEL (data->cluebar_label), 36);
+   gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (data->cluebar))),
+                      data->cluebar_label);
+ 
+--
+cgit v0.9.2

Added: smtp-auth-plain.patch
===================================================================
--- smtp-auth-plain.patch	                        (rev 0)
+++ smtp-auth-plain.patch	2013-08-05 10:07:45 UTC (rev 192044)
@@ -0,0 +1,88 @@
+From 2210bf547dc35adacbc95c0dcf4abe75a73a8368 Mon Sep 17 00:00:00 2001
+From: Debarshi Ray <debarshir at gnome.org>
+Date: Tue, 18 Jun 2013 15:27:55 +0000
+Subject: smtp-auth-plain: Handle multiline SMTP greetings
+
+Fixes: https://bugzilla.gnome.org/702263
+---
+diff --git a/src/goabackend/goasmtpauthplain.c b/src/goabackend/goasmtpauthplain.c
+index bb783bd..77324cf 100644
+--- a/src/goabackend/goasmtpauthplain.c
++++ b/src/goabackend/goasmtpauthplain.c
+@@ -167,6 +167,40 @@ smtp_auth_plain_check_454 (const gchar *response, GError **error)
+ 
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
++static gboolean
++smtp_auth_plain_check_greeting (GDataInputStream *input, GCancellable *cancellable, GError **error)
++{
++  gboolean ret;
++  gchar *response;
++
++  response = NULL;
++  ret = FALSE;
++
++ greeting_again:
++  response = g_data_input_stream_read_line (input, NULL, cancellable, error);
++  if (response == NULL)
++    goto out;
++  g_debug ("< %s", response);
++  if (smtp_auth_plain_check_421 (response, error))
++    goto out;
++  if (smtp_auth_plain_check_not_220 (response, error))
++    goto out;
++
++  if (response[3] == '-')
++    {
++      g_clear_pointer (&response, g_free);
++      goto greeting_again;
++    }
++
++  ret = TRUE;
++
++ out:
++  g_free (response);
++  return ret;
++}
++
++/* ---------------------------------------------------------------------------------------------------- */
++
+ static gchar *
+ smtp_auth_plain_get_domain (GoaSmtpAuthPlain  *auth,
+                             GError           **error)
+@@ -563,15 +597,8 @@ goa_smtp_auth_plain_run_sync (GoaMailAuth         *_auth,
+ 
+   if (!auth->greeting_absent)
+     {
+-      response = g_data_input_stream_read_line (input, NULL, cancellable, error);
+-      if (response == NULL)
+-        goto out;
+-      g_debug ("< %s", response);
+-      if (smtp_auth_plain_check_421 (response, error))
++      if (!smtp_auth_plain_check_greeting (input, cancellable, error))
+         goto out;
+-      if (smtp_auth_plain_check_not_220 (response, error))
+-        goto out;
+-      g_clear_pointer (&response, g_free);
+     }
+ 
+   /* Send EHLO */
+@@ -685,15 +712,8 @@ goa_smtp_auth_plain_starttls_sync (GoaMailAuth         *_auth,
+ 
+   /* Check the greeting */
+ 
+-  response = g_data_input_stream_read_line (input, NULL, cancellable, error);
+-  if (response == NULL)
+-    goto out;
+-  g_debug ("< %s", response);
+-  if (smtp_auth_plain_check_421 (response, error))
++  if (!smtp_auth_plain_check_greeting (input, cancellable, error))
+     goto out;
+-  if (smtp_auth_plain_check_not_220 (response, error))
+-    goto out;
+-  g_clear_pointer (&response, g_free);
+ 
+   /* Send EHLO */
+ 
+--
+cgit v0.9.2




More information about the arch-commits mailing list