1 --- ./src/server.c.orig 2009-05-13 03:11:11.000000000 -0400
2 +++ ./src/server.c 2010-06-22 05:31:57.000000000 -0400
4 the last command. A RESET command undoes the effect of this
9 cmd_session (assuan_context_t ctx, char *line)
11 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
13 validity right away; if it does not (as here) all recipients are
14 checked at the time of the ENCRYPT command. All RECIPIENT commands
15 are cumulative until a RESET or an successful ENCRYPT command. */
18 cmd_recipient (assuan_context_t ctx, char *line)
20 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
22 Set the file descriptor to read a message which is used with
27 cmd_message (assuan_context_t ctx, char *line)
29 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
32 Encrypt the data received on INPUT to OUTPUT.
36 cmd_encrypt (assuan_context_t ctx, char *line)
38 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
41 Dummy encryption command used to check whether the given recipients
42 are all valid and to tell the client the preferred protocol. */
45 cmd_prep_encrypt (assuan_context_t ctx, char *line)
47 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
49 @code{RESET} command. A second command overrides the effect of
50 the first one; if EMAIL is not given the server shall use the
51 default signing key. */
54 cmd_sender (assuan_context_t ctx, char *line)
56 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
59 Sign the data received on INPUT to OUTPUT.
63 cmd_sign (assuan_context_t ctx, char *line)
65 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
67 If the option --no-verify is given, the server should not try to
68 verify a signature, in case the input data is an OpenPGP combined
72 cmd_decrypt (assuan_context_t ctx, char *line)
74 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
77 The DISPLAYSTRING is a percent-and-plus-encoded string with a short
78 human readable description of the status. */
81 cmd_verify (assuan_context_t ctx, char *line)
83 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
85 manager is brought into the foregound and that this command
90 cmd_start_keymanager (assuan_context_t ctx, char *line)
92 gpa_open_key_manager (NULL, NULL);
94 manager is brought into the foregound and that this command
99 cmd_start_cardmanager (assuan_context_t ctx, char *line)
101 gpa_open_cardmanager (NULL, NULL);
102 @@ -1172,7 +1172,7 @@
103 manager is brought into the foregound and that this command
108 cmd_start_confdialog (assuan_context_t ctx, char *line)
110 gpa_open_settings_dialog (NULL, NULL);
111 @@ -1191,7 +1191,7 @@
112 version - Return the version of the program.
113 pid - Return the process id of the server.
117 cmd_getinfo (assuan_context_t ctx, char *line)
120 @@ -1295,7 +1295,7 @@
122 Set the files on which to operate.
126 cmd_file (assuan_context_t ctx, char *line)
129 @@ -1366,7 +1366,7 @@
132 /* ENCRYPT_FILES --nohup */
135 cmd_encrypt_files (assuan_context_t ctx, char *line)
138 @@ -1389,7 +1389,7 @@
141 /* SIGN_FILES --nohup */
144 cmd_sign_files (assuan_context_t ctx, char *line)
147 @@ -1412,7 +1412,7 @@
150 /* ENCRYPT_SIGN_FILES --nohup */
153 cmd_encrypt_sign_files (assuan_context_t ctx, char *line)
156 @@ -1474,7 +1474,7 @@
159 /* DECRYPT_FILES --nohup */
162 cmd_decrypt_files (assuan_context_t ctx, char *line)
165 @@ -1497,7 +1497,7 @@
168 /* VERIFY_FILES --nohup */
171 cmd_verify_files (assuan_context_t ctx, char *line)
174 @@ -1520,7 +1520,7 @@
177 /* DECRYPT_VERIFY_FILES --nohup */
180 cmd_decrypt_verify_files (assuan_context_t ctx, char *line)
183 @@ -1543,7 +1543,7 @@
186 /* IMPORT_FILES --nohup */
189 cmd_import_files (assuan_context_t ctx, char *line)
192 @@ -1567,7 +1567,7 @@
195 /* CHECKSUM_CREATE_FILES --nohup */
198 cmd_checksum_create_files (assuan_context_t ctx, char *line)
201 @@ -1591,7 +1591,7 @@
204 /* CHECKSUM_VERIFY_FILES --nohup */
207 cmd_checksum_verify_files (assuan_context_t ctx, char *line)
210 @@ -1614,8 +1614,8 @@
215 -reset_notify (assuan_context_t ctx)
217 +reset_notify (assuan_context_t ctx, char *line)
219 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
221 @@ -1639,6 +1639,7 @@
222 ctrl->session_number = 0;
223 xfree (ctrl->session_title);
224 ctrl->session_title = NULL;
229 @@ -1648,7 +1649,7 @@
233 - int (*handler)(assuan_context_t, char *line);
234 + assuan_handler_t handler;
236 { "SESSION", cmd_session },
237 { "RECIPIENT", cmd_recipient },
238 @@ -1681,7 +1682,8 @@
240 for (i=0; table[i].name; i++)
242 - rc = assuan_register_command (ctx, table[i].name, table[i].handler);
243 + rc = assuan_register_command (ctx, table[i].name, table[i].handler,
248 @@ -1692,7 +1694,7 @@
250 /* Prepare for a new connection on descriptor FD. */
251 static assuan_context_t
252 -connection_startup (int fd)
253 +connection_startup (assuan_fd_t fd)
256 assuan_context_t ctx;
257 @@ -1700,7 +1702,16 @@
259 /* Get an Assuan context for the already accepted file descriptor
260 FD. Allow descriptor passing. */
261 - err = assuan_init_socket_server_ext (&ctx, ASSUAN_INT2FD(fd), 1|2);
262 + err = assuan_new (&ctx);
265 + g_debug ("failed to initialize the new connection: %s",
266 + gpg_strerror (err));
270 + err = assuan_init_socket_server (ctx, fd, ASSUAN_SOCKET_SERVER_FDPASSING
271 + | ASSUAN_SOCKET_SERVER_ACCEPTED);
274 g_debug ("failed to initialize the new connection: %s",
275 @@ -1712,7 +1723,7 @@
277 g_debug ("failed to register commands with Assuan: %s",
279 - assuan_deinit_server (ctx);
280 + assuan_release (ctx);
284 @@ -1736,8 +1747,8 @@
286 conn_ctrl_t ctrl = assuan_get_pointer (ctx);
288 - reset_notify (ctx);
289 - assuan_deinit_server (ctx);
290 + reset_notify (ctx, NULL);
291 + assuan_release (ctx);
293 connection_counter--;
294 if (!connection_counter && shutdown_pending)
295 @@ -1805,14 +1816,23 @@
301 - err = assuan_process_next (ctx);
302 + err = assuan_process_next (ctx, &done);
304 - g_debug ("assuan_process_next returned: %s",
305 - err == -1? "EOF": gpg_strerror (err));
308 + g_debug ("assuan_process_next returned: %s <%s>",
309 + gpg_strerror (err), gpg_strsource (err));
313 + g_debug ("assuan_process_next returned: %s",
314 + done ? "done" : "success");
316 if (gpg_err_code (err) == GPG_ERR_EAGAIN)
318 - else if (gpg_err_code (err) == GPG_ERR_EOF || err == -1)
319 + else if (!err && done)
322 ctrl->client_died = 1; /* Need to delay the cleanup. */
323 @@ -1868,14 +1888,14 @@
324 g_debug ("error accepting connection: %s", strerror (errno));
327 - if (assuan_sock_check_nonce (ASSUAN_INT2FD(fd), &socket_nonce))
328 + if (assuan_sock_check_nonce ((assuan_fd_t) fd, &socket_nonce))
330 g_debug ("new connection at fd %d refused", fd);
334 g_debug ("new connection at fd %d", fd);
335 - ctx = connection_startup (fd);
336 + ctx = connection_startup ((assuan_fd_t) fd);
340 @@ -1911,7 +1931,7 @@
344 - assuan_sock_close (ASSUAN_INT2FD (fd));
345 + assuan_sock_close ((assuan_fd_t) fd);
346 return TRUE; /* Keep the listen_fd in the event loop. */
349 @@ -1929,7 +1949,7 @@
351 unsigned int source_id;
353 - assuan_set_assuan_err_source (GPG_ERR_SOURCE_DEFAULT);
354 + assuan_set_gpg_err_source (GPG_ERR_SOURCE_DEFAULT);
356 socket_name = g_build_filename (gnupg_homedir, "S.uiserver", NULL);
357 if (strlen (socket_name)+1 >= sizeof serv_addr.sun_path )
358 @@ -1974,14 +1994,14 @@
359 g_free (socket_name);
362 - if (listen (ASSUAN_FD2INT (fd), 5) == -1)
363 + if (listen ((int) fd, 5) == -1)
365 g_debug ("listen() failed: %s\n", strerror (errno));
366 assuan_sock_close (fd);
369 #ifdef HAVE_W32_SYSTEM
370 - channel = g_io_channel_win32_new_socket (ASSUAN_FD2INT(fd));
371 + channel = g_io_channel_win32_new_socket ((int) fd);
373 channel = g_io_channel_unix_new (fd);