Merge lp:~nataliabidart/ubuntuone-client/update-sso into lp:ubuntuone-client
- update-sso
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Natalia Bidart |
Approved revision: | 1149 |
Merged at revision: | 1145 |
Proposed branch: | lp:~nataliabidart/ubuntuone-client/update-sso |
Merge into: | lp:ubuntuone-client |
Diff against target: |
254 lines (+59/-77) 1 file modified
libsyncdaemon/syncdaemon-authentication.c (+59/-77) |
To merge this branch: | bzr merge lp:~nataliabidart/ubuntuone-client/update-sso |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Approve | ||
Review via email:
|
Commit message
- Removing the deprecated SSOCredentials interface (LP: #859635).
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~nataliabidart/ubuntuone-client/update-sso into lp:ubuntuone-client failed. Below is the output from the failed tests.
/usr/bin/
checking for autoconf >= 2.53...
testing autoconf2.50... not found.
testing autoconf... found 2.67
checking for automake >= 1.10...
testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
testing libtoolize... found 2.2.6b
checking for intltool >= 0.30...
testing intltoolize... found 0.41.1
checking for pkg-config >= 0.14.0...
testing pkg-config... found 0.25
checking for gtk-doc >= 1.0...
testing gtkdocize... found 1.17
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to...
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
dobey (dobey) wrote : | # |
Just changing this to needs fixing, because I know you're doing more work on it, and I know I'll need to do a more involved review. :)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
Branch is now updated and ready for re-review. Depends on latest nightlies for ussoc and u1client.
- 1148. By Natalia Bidart
-
Merged trunk in.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
dobey (dobey) wrote : | # |
+ g_cclosure_
This needs to be VOID__VOID for the CredentialsNotFound callback We think. It isn't passing any arguments to the callback.
Also, adding the credentials_
- 1149. By Natalia Bidart
-
Removing CredentialsNotFound signal as per review comment.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
dobey (dobey) : | # |
Preview Diff
1 | === modified file 'libsyncdaemon/syncdaemon-authentication.c' |
2 | --- libsyncdaemon/syncdaemon-authentication.c 2011-04-18 17:45:31 +0000 |
3 | +++ libsyncdaemon/syncdaemon-authentication.c 2011-10-06 13:59:16 +0000 |
4 | @@ -31,7 +31,6 @@ |
5 | struct _SyncdaemonAuthenticationPrivate { |
6 | DBusGConnection *bus; |
7 | DBusGProxy *proxy; |
8 | - DBusGProxy *newer_proxy; |
9 | gboolean has_credentials; |
10 | SyncdaemonCredentials *credentials; |
11 | }; |
12 | @@ -56,8 +55,6 @@ |
13 | g_object_unref (G_OBJECT (auth->priv->credentials)); |
14 | if (auth->priv->proxy != NULL) |
15 | g_object_unref (G_OBJECT (auth->priv->proxy)); |
16 | - if (auth->priv->newer_proxy != NULL) |
17 | - g_object_unref (G_OBJECT (auth->priv->newer_proxy)); |
18 | if (auth->priv->bus != NULL) |
19 | dbus_g_connection_unref (auth->priv->bus); |
20 | |
21 | @@ -101,14 +98,11 @@ |
22 | } |
23 | |
24 | static void |
25 | -credentials_found_cb (DBusGProxy *proxy, const gchar *app_name, GHashTable *result, gpointer user_data) |
26 | +credentials_found_cb (DBusGProxy *proxy, GHashTable *result, gpointer user_data) |
27 | { |
28 | SyncdaemonAuthentication *auth = SYNCDAEMON_AUTHENTICATION (user_data); |
29 | |
30 | - if (g_strcmp0 (app_name, SSO_APP_NAME) != 0) { |
31 | - g_debug ("Credentials are not for '" SSO_APP_NAME "', ignoring"); |
32 | - return; |
33 | - } |
34 | + g_debug ("Authorization completed!"); |
35 | |
36 | if (auth->priv->credentials != NULL) |
37 | g_object_unref (G_OBJECT (auth->priv->credentials)); |
38 | @@ -120,31 +114,35 @@ |
39 | } |
40 | |
41 | static void |
42 | -authorization_denied_cb (DBusGProxy *proxy, const gchar *app_name, gpointer user_data) |
43 | +authorization_denied_cb (DBusGProxy *proxy, gpointer user_data) |
44 | { |
45 | g_debug ("Authorization denied"); |
46 | - if (g_strcmp0 (app_name, SSO_APP_NAME) != 0) { |
47 | - g_debug ("Credentials are not for '" SSO_APP_NAME "', ignoring"); |
48 | - return; |
49 | - } |
50 | |
51 | g_signal_emit (user_data, auth_signals[AUTHORIZATION_CANCELLED_SIGNAL], 0); |
52 | } |
53 | |
54 | static void |
55 | -credentials_error_cb (DBusGProxy *proxy, |
56 | - const gchar *app_name, |
57 | - const gchar *error_message, |
58 | - const gchar *detailed_error, |
59 | - gpointer user_data) |
60 | +credentials_error_cb (DBusGProxy *proxy, GHashTable *error_dict, gpointer user_data) |
61 | { |
62 | g_debug ("Authorization error"); |
63 | - if (g_strcmp0 (app_name, SSO_APP_NAME) != 0) { |
64 | - g_debug ("Credentials are not for '" SSO_APP_NAME "', ignoring"); |
65 | - return; |
66 | - } |
67 | - |
68 | - g_signal_emit (user_data, auth_signals[ERROR_SIGNAL], 0, error_message); |
69 | + |
70 | + g_signal_emit (user_data, auth_signals[ERROR_SIGNAL], 0, |
71 | + g_hash_table_lookup (error_dict, "message")); |
72 | +} |
73 | + |
74 | +static void |
75 | +credentials_not_found_cb (DBusGProxy *proxy, gpointer user_data) |
76 | +{ |
77 | + SyncdaemonAuthentication *auth = SYNCDAEMON_AUTHENTICATION (user_data); |
78 | + |
79 | + g_debug ("Credentials for Ubuntu One not found!"); |
80 | + |
81 | + if (auth->priv->credentials != NULL) |
82 | + g_object_unref (G_OBJECT (auth->priv->credentials)); |
83 | + auth->priv->has_credentials = FALSE; |
84 | + |
85 | + g_signal_emit (auth, auth_signals[ERROR_SIGNAL], 0, |
86 | + "Credentials not found."); |
87 | } |
88 | |
89 | static void |
90 | @@ -161,19 +159,17 @@ |
91 | g_warning ("Couldn't get session bus: %s", error->message); |
92 | g_error_free (error); |
93 | } else { |
94 | - auth->priv->proxy = dbus_g_proxy_new_for_name (auth->priv->bus, "com.ubuntu.sso", |
95 | - "/credentials", "com.ubuntu.sso.ApplicationCredentials"); |
96 | + auth->priv->proxy = dbus_g_proxy_new_for_name (auth->priv->bus, "com.ubuntuone.Credentials", |
97 | + "/credentials", "com.ubuntuone.CredentialsManagement"); |
98 | if (auth->priv->proxy != NULL) { |
99 | - dbus_g_object_register_marshaller (_syncdaemon_marshal_VOID__STRING_POINTER, |
100 | + dbus_g_object_register_marshaller (_syncdaemon_marshal_VOID__POINTER, |
101 | G_TYPE_NONE, |
102 | - G_TYPE_STRING, |
103 | dbus_g_type_get_map ("GHashTable", |
104 | G_TYPE_STRING, |
105 | G_TYPE_STRING), |
106 | G_TYPE_INVALID); |
107 | |
108 | dbus_g_proxy_add_signal (auth->priv->proxy, "CredentialsFound", |
109 | - G_TYPE_STRING, |
110 | dbus_g_type_get_map ("GHashTable", |
111 | G_TYPE_STRING, |
112 | G_TYPE_STRING), |
113 | @@ -181,43 +177,25 @@ |
114 | dbus_g_proxy_connect_signal (auth->priv->proxy, "CredentialsFound", |
115 | G_CALLBACK (credentials_found_cb), auth, NULL); |
116 | |
117 | + dbus_g_proxy_add_signal (auth->priv->proxy, "CredentialsNotFound", |
118 | + G_TYPE_INVALID); |
119 | + dbus_g_proxy_connect_signal (auth->priv->proxy, "CredentialsNotFound", |
120 | + G_CALLBACK (credentials_not_found_cb), auth, NULL); |
121 | + |
122 | dbus_g_proxy_add_signal (auth->priv->proxy, "AuthorizationDenied", |
123 | - G_TYPE_STRING, |
124 | G_TYPE_INVALID); |
125 | dbus_g_proxy_connect_signal (auth->priv->proxy, "AuthorizationDenied", |
126 | G_CALLBACK (authorization_denied_cb), auth, NULL); |
127 | |
128 | dbus_g_proxy_add_signal (auth->priv->proxy, "CredentialsError", |
129 | - G_TYPE_STRING, |
130 | - G_TYPE_STRING, |
131 | - G_TYPE_STRING, |
132 | + dbus_g_type_get_map ("GHashTable", |
133 | + G_TYPE_STRING, |
134 | + G_TYPE_STRING), |
135 | G_TYPE_INVALID); |
136 | dbus_g_proxy_connect_signal (auth->priv->proxy, "CredentialsError", |
137 | G_CALLBACK (credentials_error_cb), auth, NULL); |
138 | } else |
139 | - g_warning ("Couldn't get proxy for com.ubuntu.sso.ApplicationCredentials"); |
140 | - |
141 | - auth->priv->newer_proxy = dbus_g_proxy_new_for_name (auth->priv->bus, "com.ubuntu.sso", |
142 | - "/com/ubuntu/sso/credentials", "com.ubuntu.sso.CredentialsManagement"); |
143 | - if (auth->priv->newer_proxy != NULL) { |
144 | - dbus_g_object_register_marshaller (_syncdaemon_marshal_VOID__STRING_POINTER, |
145 | - G_TYPE_NONE, |
146 | - G_TYPE_STRING, |
147 | - dbus_g_type_get_map ("GHashTable", |
148 | - G_TYPE_STRING, |
149 | - G_TYPE_STRING), |
150 | - G_TYPE_INVALID); |
151 | - |
152 | - dbus_g_proxy_add_signal (auth->priv->newer_proxy, "CredentialsFound", |
153 | - G_TYPE_STRING, |
154 | - dbus_g_type_get_map ("GHashTable", |
155 | - G_TYPE_STRING, |
156 | - G_TYPE_STRING), |
157 | - G_TYPE_INVALID); |
158 | - dbus_g_proxy_connect_signal (auth->priv->newer_proxy, "CredentialsFound", |
159 | - G_CALLBACK (credentials_found_cb), auth, NULL); |
160 | - } else |
161 | - g_warning ("Couldn't get proxy for com.ubuntu.sso.CredentialsManagement"); |
162 | + g_warning ("Couldn't get proxy for com.ubuntuone.CredentialsManagement"); |
163 | |
164 | } |
165 | } |
166 | @@ -228,35 +206,35 @@ |
167 | SyncdaemonCredentials * |
168 | syncdaemon_authentication_find_credentials (SyncdaemonAuthentication *auth) |
169 | { |
170 | + SyncdaemonCredentials *result = NULL; |
171 | g_return_val_if_fail (SYNCDAEMON_IS_AUTHENTICATION (auth), NULL); |
172 | |
173 | if (!auth->priv->has_credentials) { |
174 | GHashTable *credentials; |
175 | GError *error = NULL; |
176 | |
177 | - if (dbus_g_proxy_call (auth->priv->proxy, "find_credentials", &error, |
178 | - G_TYPE_STRING, SSO_APP_NAME, |
179 | + if (dbus_g_proxy_call (auth->priv->proxy, "find_credentials_sync", &error, |
180 | G_TYPE_INVALID, |
181 | dbus_g_type_get_map ("GHashTable", |
182 | - G_TYPE_STRING, |
183 | - G_TYPE_STRING), &credentials, |
184 | + G_TYPE_STRING, |
185 | + G_TYPE_STRING), &credentials, |
186 | G_TYPE_INVALID)) { |
187 | if (g_hash_table_size (credentials) >= 4) { |
188 | auth->priv->credentials = syncdaemon_credentials_new_from_hash_table (credentials); |
189 | auth->priv->has_credentials = TRUE; |
190 | - } else |
191 | - g_warning ("Got less number of items in credentials hash table than expected!"); |
192 | - |
193 | + result = auth->priv->credentials; |
194 | + } else { |
195 | + g_debug ("Got less number of items (%i) in credentials hash table than expected (4)!", |
196 | + g_hash_table_size (credentials)); |
197 | + } |
198 | g_hash_table_destroy (credentials); |
199 | } else { |
200 | - g_warning ("Could not get credentials for '" SSO_APP_NAME "': %s", error->message); |
201 | + g_warning ("Could not get credentials: %s", error->message); |
202 | g_error_free (error); |
203 | - |
204 | - return NULL; |
205 | } |
206 | } |
207 | |
208 | - return auth->priv->credentials; |
209 | + return result; |
210 | } |
211 | |
212 | /** |
213 | @@ -279,15 +257,20 @@ |
214 | void |
215 | syncdaemon_authentication_login_or_register (SyncdaemonAuthentication *auth) |
216 | { |
217 | + GHashTable *params = g_hash_table_new (g_str_hash, g_str_equal); |
218 | + |
219 | g_return_if_fail (SYNCDAEMON_IS_AUTHENTICATION (auth)); |
220 | |
221 | - dbus_g_proxy_call_no_reply (auth->priv->proxy, "login_or_register_to_get_credentials", |
222 | - G_TYPE_STRING, SSO_APP_NAME, |
223 | - G_TYPE_STRING, SSO_TC_URL, |
224 | - G_TYPE_STRING, Q_("Ubuntu One requires an Ubuntu Single Sign On (SSO) account. This process will allow you to create a new account, if you do not yet have one."), |
225 | - G_TYPE_INT64, 0, /* FIXME */ |
226 | + g_hash_table_insert (params, "window_id", "0"); /* FIXME: get window ID */ |
227 | + |
228 | + dbus_g_proxy_call_no_reply (auth->priv->proxy, "register", |
229 | + dbus_g_type_get_map ("GHashTable", |
230 | + G_TYPE_STRING, |
231 | + G_TYPE_STRING), params, |
232 | G_TYPE_INVALID, |
233 | G_TYPE_INVALID); |
234 | + |
235 | + g_hash_table_destroy (params); |
236 | } |
237 | |
238 | /** |
239 | @@ -300,11 +283,10 @@ |
240 | |
241 | g_return_if_fail (SYNCDAEMON_IS_AUTHENTICATION (auth)); |
242 | |
243 | - if (!dbus_g_proxy_call (auth->priv->proxy, "clear_token", &error, |
244 | - G_TYPE_STRING, SSO_APP_NAME, |
245 | - G_TYPE_INVALID, |
246 | - G_TYPE_INVALID)) { |
247 | - g_warning ("Error calling 'clear_token': %s", error->message); |
248 | + if (!dbus_g_proxy_call (auth->priv->proxy, "clear_credentials", &error, |
249 | + G_TYPE_INVALID, |
250 | + G_TYPE_INVALID)) { |
251 | + g_warning ("Error calling 'clear_credentials': %s", error->message); |
252 | g_error_free (error); |
253 | } |
254 | } |
Looks reasonable to me.