wok-next view gpa/stuff/gpa-0.9.0-libassuan2.patch @ rev 11412
Up: postgresql to 9.1.2.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Sat Dec 10 21:31:55 2011 +0000 (2011-12-10) |
parents | |
children |
line source
1 Index: src/server.c
2 ===================================================================
3 --- src/server.c.orig 2009-05-13 09:11:11.000000000 +0200
4 +++ src/server.c 2010-04-08 08:13:27.000000000 +0200
5 @@ -568,7 +568,7 @@ prepare_io_streams (assuan_context_t ctx
6 the last command. A RESET command undoes the effect of this
7 command.
8 */
9 -static int
10 +static gpg_error_t
11 cmd_session (assuan_context_t ctx, char *line)
12 {
13 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
14 @@ -594,7 +594,7 @@ cmd_session (assuan_context_t ctx, char
15 validity right away; if it does not (as here) all recipients are
16 checked at the time of the ENCRYPT command. All RECIPIENT commands
17 are cumulative until a RESET or an successful ENCRYPT command. */
18 -static int
19 +static gpg_error_t
20 cmd_recipient (assuan_context_t ctx, char *line)
21 {
22 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
23 @@ -615,7 +615,7 @@ cmd_recipient (assuan_context_t ctx, cha
24 Set the file descriptor to read a message which is used with
25 detached signatures.
26 */
27 -static int
28 +static gpg_error_t
29 cmd_message (assuan_context_t ctx, char *line)
30 {
31 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
32 @@ -659,7 +659,7 @@ cont_encrypt (assuan_context_t ctx, gpg_
34 Encrypt the data received on INPUT to OUTPUT.
35 */
36 -static int
37 +static gpg_error_t
38 cmd_encrypt (assuan_context_t ctx, char *line)
39 {
40 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
41 @@ -755,7 +755,7 @@ cont_prep_encrypt (assuan_context_t ctx,
43 Dummy encryption command used to check whether the given recipients
44 are all valid and to tell the client the preferred protocol. */
45 -static int
46 +static gpg_error_t
47 cmd_prep_encrypt (assuan_context_t ctx, char *line)
48 {
49 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
50 @@ -814,7 +814,7 @@ cmd_prep_encrypt (assuan_context_t ctx,
51 @code{RESET} command. A second command overrides the effect of
52 the first one; if EMAIL is not given the server shall use the
53 default signing key. */
54 -static int
55 +static gpg_error_t
56 cmd_sender (assuan_context_t ctx, char *line)
57 {
58 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
59 @@ -867,7 +867,7 @@ cont_sign (assuan_context_t ctx, gpg_err
61 Sign the data received on INPUT to OUTPUT.
62 */
63 -static int
64 +static gpg_error_t
65 cmd_sign (assuan_context_t ctx, char *line)
66 {
67 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
68 @@ -943,7 +943,7 @@ cont_decrypt (assuan_context_t ctx, gpg_
69 If the option --no-verify is given, the server should not try to
70 verify a signature, in case the input data is an OpenPGP combined
71 message. */
72 -static int
73 +static gpg_error_t
74 cmd_decrypt (assuan_context_t ctx, char *line)
75 {
76 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
77 @@ -1058,7 +1058,7 @@ cont_verify (assuan_context_t ctx, gpg_e
79 The DISPLAYSTRING is a percent-and-plus-encoded string with a short
80 human readable description of the status. */
81 -static int
82 +static gpg_error_t
83 cmd_verify (assuan_context_t ctx, char *line)
84 {
85 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
86 @@ -1143,7 +1143,7 @@ cmd_verify (assuan_context_t ctx, char *
87 manager is brought into the foregound and that this command
88 immediatley returns.
89 */
90 -static int
91 +static gpg_error_t
92 cmd_start_keymanager (assuan_context_t ctx, char *line)
93 {
94 gpa_open_key_manager (NULL, NULL);
95 @@ -1157,7 +1157,7 @@ cmd_start_keymanager (assuan_context_t c
96 manager is brought into the foregound and that this command
97 immediatley returns.
98 */
99 -static int
100 +static gpg_error_t
101 cmd_start_cardmanager (assuan_context_t ctx, char *line)
102 {
103 gpa_open_cardmanager (NULL, NULL);
104 @@ -1172,7 +1172,7 @@ cmd_start_cardmanager (assuan_context_t
105 manager is brought into the foregound and that this command
106 immediatley returns.
107 */
108 -static int
109 +static gpg_error_t
110 cmd_start_confdialog (assuan_context_t ctx, char *line)
111 {
112 gpa_open_settings_dialog (NULL, NULL);
113 @@ -1191,7 +1191,7 @@ cmd_start_confdialog (assuan_context_t c
114 version - Return the version of the program.
115 pid - Return the process id of the server.
116 */
117 -static int
118 +static gpg_error_t
119 cmd_getinfo (assuan_context_t ctx, char *line)
120 {
121 gpg_error_t err;
122 @@ -1295,7 +1295,7 @@ decode_percent_string (char *str)
124 Set the files on which to operate.
125 */
126 -static int
127 +static gpg_error_t
128 cmd_file (assuan_context_t ctx, char *line)
129 {
130 gpg_error_t err = 0;
131 @@ -1366,7 +1366,7 @@ impl_encrypt_sign_files (assuan_context_
134 /* ENCRYPT_FILES --nohup */
135 -static int
136 +static gpg_error_t
137 cmd_encrypt_files (assuan_context_t ctx, char *line)
138 {
139 gpg_error_t err;
140 @@ -1389,7 +1389,7 @@ cmd_encrypt_files (assuan_context_t ctx,
143 /* SIGN_FILES --nohup */
144 -static int
145 +static gpg_error_t
146 cmd_sign_files (assuan_context_t ctx, char *line)
147 {
148 gpg_error_t err;
149 @@ -1412,7 +1412,7 @@ cmd_sign_files (assuan_context_t ctx, ch
152 /* ENCRYPT_SIGN_FILES --nohup */
153 -static int
154 +static gpg_error_t
155 cmd_encrypt_sign_files (assuan_context_t ctx, char *line)
156 {
157 gpg_error_t err;
158 @@ -1474,7 +1474,7 @@ impl_decrypt_verify_files (assuan_contex
161 /* DECRYPT_FILES --nohup */
162 -static int
163 +static gpg_error_t
164 cmd_decrypt_files (assuan_context_t ctx, char *line)
165 {
166 gpg_error_t err;
167 @@ -1497,7 +1497,7 @@ cmd_decrypt_files (assuan_context_t ctx,
170 /* VERIFY_FILES --nohup */
171 -static int
172 +static gpg_error_t
173 cmd_verify_files (assuan_context_t ctx, char *line)
174 {
175 gpg_error_t err;
176 @@ -1520,7 +1520,7 @@ cmd_verify_files (assuan_context_t ctx,
179 /* DECRYPT_VERIFY_FILES --nohup */
180 -static int
181 +static gpg_error_t
182 cmd_decrypt_verify_files (assuan_context_t ctx, char *line)
183 {
184 gpg_error_t err;
185 @@ -1543,7 +1543,7 @@ cmd_decrypt_verify_files (assuan_context
188 /* IMPORT_FILES --nohup */
189 -static int
190 +static gpg_error_t
191 cmd_import_files (assuan_context_t ctx, char *line)
192 {
193 gpg_error_t err;
194 @@ -1567,7 +1567,7 @@ cmd_import_files (assuan_context_t ctx,
197 /* CHECKSUM_CREATE_FILES --nohup */
198 -static int
199 +static gpg_error_t
200 cmd_checksum_create_files (assuan_context_t ctx, char *line)
201 {
202 gpg_error_t err;
203 @@ -1591,7 +1591,7 @@ cmd_checksum_create_files (assuan_contex
206 /* CHECKSUM_VERIFY_FILES --nohup */
207 -static int
208 +static gpg_error_t
209 cmd_checksum_verify_files (assuan_context_t ctx, char *line)
210 {
211 gpg_error_t err;
212 @@ -1614,8 +1614,8 @@ cmd_checksum_verify_files (assuan_contex
213 }
216 -static void
217 -reset_notify (assuan_context_t ctx)
218 +static gpg_error_t
219 +reset_notify (assuan_context_t ctx, char *line)
220 {
221 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
223 @@ -1639,6 +1639,7 @@ reset_notify (assuan_context_t ctx)
224 ctrl->session_number = 0;
225 xfree (ctrl->session_title);
226 ctrl->session_title = NULL;
227 + return 0;
228 }
231 @@ -1648,7 +1649,7 @@ register_commands (assuan_context_t ctx)
232 {
233 static struct {
234 const char *name;
235 - int (*handler)(assuan_context_t, char *line);
236 + assuan_handler_t handler;
237 } table[] = {
238 { "SESSION", cmd_session },
239 { "RECIPIENT", cmd_recipient },
240 @@ -1681,7 +1682,8 @@ register_commands (assuan_context_t ctx)
242 for (i=0; table[i].name; i++)
243 {
244 - rc = assuan_register_command (ctx, table[i].name, table[i].handler);
245 + rc = assuan_register_command (ctx, table[i].name, table[i].handler,
246 + NULL);
247 if (rc)
248 return rc;
249 }
250 @@ -1692,7 +1694,7 @@ register_commands (assuan_context_t ctx)
252 /* Prepare for a new connection on descriptor FD. */
253 static assuan_context_t
254 -connection_startup (int fd)
255 +connection_startup (assuan_fd_t fd)
256 {
257 gpg_error_t err;
258 assuan_context_t ctx;
259 @@ -1700,7 +1702,16 @@ connection_startup (int fd)
261 /* Get an Assuan context for the already accepted file descriptor
262 FD. Allow descriptor passing. */
263 - err = assuan_init_socket_server_ext (&ctx, ASSUAN_INT2FD(fd), 1|2);
264 + err = assuan_new (&ctx);
265 + if (err)
266 + {
267 + g_debug ("failed to initialize the new connection: %s",
268 + gpg_strerror (err));
269 + return NULL;
270 + }
271 +
272 + err = assuan_init_socket_server (ctx, fd, ASSUAN_SOCKET_SERVER_FDPASSING
273 + | ASSUAN_SOCKET_SERVER_ACCEPTED);
274 if (err)
275 {
276 g_debug ("failed to initialize the new connection: %s",
277 @@ -1712,7 +1723,7 @@ connection_startup (int fd)
278 {
279 g_debug ("failed to register commands with Assuan: %s",
280 gpg_strerror (err));
281 - assuan_deinit_server (ctx);
282 + assuan_release (ctx);
283 return NULL;
284 }
286 @@ -1736,8 +1747,8 @@ connection_finish (assuan_context_t ctx)
287 {
288 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
290 - reset_notify (ctx);
291 - assuan_deinit_server (ctx);
292 + reset_notify (ctx, NULL);
293 + assuan_release (ctx);
294 g_free (ctrl);
295 connection_counter--;
296 if (!connection_counter && shutdown_pending)
297 @@ -1805,14 +1816,23 @@ receive_cb (GIOChannel *channel, GIOCond
298 }
299 else
300 {
301 + int done = 0;
302 ctrl->in_command++;
303 - err = assuan_process_next (ctx);
304 + err = assuan_process_next (ctx, &done);
305 ctrl->in_command--;
306 + if (err)
307 + {
308 + g_debug ("assuan_process_next returned: %s <%s>",
309 + gpg_strerror (err), gpg_strsource (err));
310 + }
311 + else
312 + {
313 g_debug ("assuan_process_next returned: %s",
314 - err == -1? "EOF": gpg_strerror (err));
315 + done ? "done" : "success");
316 + }
317 if (gpg_err_code (err) == GPG_ERR_EAGAIN)
318 ; /* Ignore. */
319 - else if (gpg_err_code (err) == GPG_ERR_EOF || err == -1)
320 + else if (!err && done)
321 {
322 if (ctrl->cont_cmd)
323 ctrl->client_died = 1; /* Need to delay the cleanup. */
324 @@ -1868,14 +1888,14 @@ accept_connection_cb (GIOChannel *listen
325 g_debug ("error accepting connection: %s", strerror (errno));
326 goto leave;
327 }
328 - if (assuan_sock_check_nonce (ASSUAN_INT2FD(fd), &socket_nonce))
329 + if (assuan_sock_check_nonce ((assuan_fd_t) fd, &socket_nonce))
330 {
331 g_debug ("new connection at fd %d refused", fd);
332 goto leave;
333 }
335 g_debug ("new connection at fd %d", fd);
336 - ctx = connection_startup (fd);
337 + ctx = connection_startup ((assuan_fd_t) fd);
338 if (!ctx)
339 goto leave;
341 @@ -1911,7 +1931,7 @@ accept_connection_cb (GIOChannel *listen
343 leave:
344 if (fd != -1)
345 - assuan_sock_close (ASSUAN_INT2FD (fd));
346 + assuan_sock_close ((assuan_fd_t) fd);
347 return TRUE; /* Keep the listen_fd in the event loop. */
348 }
350 @@ -1929,7 +1949,7 @@ gpa_start_server (void)
351 GIOChannel *channel;
352 unsigned int source_id;
354 - assuan_set_assuan_err_source (GPG_ERR_SOURCE_DEFAULT);
355 + assuan_set_gpg_err_source (GPG_ERR_SOURCE_DEFAULT);
357 socket_name = g_build_filename (gnupg_homedir, "S.uiserver", NULL);
358 if (strlen (socket_name)+1 >= sizeof serv_addr.sun_path )
359 @@ -1974,14 +1994,14 @@ gpa_start_server (void)
360 g_free (socket_name);
361 socket_name = NULL;
363 - if (listen (ASSUAN_FD2INT (fd), 5) == -1)
364 + if (listen ((int) fd, 5) == -1)
365 {
366 g_debug ("listen() failed: %s\n", strerror (errno));
367 assuan_sock_close (fd);
368 return;
369 }
370 #ifdef HAVE_W32_SYSTEM
371 - channel = g_io_channel_win32_new_socket (ASSUAN_FD2INT(fd));
372 + channel = g_io_channel_win32_new_socket ((int) fd);
373 #else
374 channel = g_io_channel_unix_new (fd);
375 #endif
376 Index: configure.ac
377 ===================================================================
378 --- configure.ac.orig 2009-06-20 00:05:29.000000000 +0200
379 +++ configure.ac 2010-04-08 08:13:27.000000000 +0200
380 @@ -37,8 +37,8 @@ AC_INIT([gpa],
381 [bug-gpa@gnupg.org])
383 NEED_GPG_ERROR_VERSION=1.4
384 -NEED_LIBASSUAN_API=1
385 -NEED_LIBASSUAN_VERSION=1.0.4
386 +NEED_LIBASSUAN_API=2
387 +NEED_LIBASSUAN_VERSION=1.1.0
388 NEED_GPGME_API=1
389 NEED_GPGME_VERSION=1.2.0