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