wok-stable diff gpa/stuff/gpa-0.9.0-libassuan2.patch @ rev 11867

up bozohttpd 20111118
author Samuel Trassare <samuel_trassare@yahoo.com>
date Mon Feb 27 12:53:10 2012 -0800 (2012-02-27)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gpa/stuff/gpa-0.9.0-libassuan2.patch	Mon Feb 27 12:53:10 2012 -0800
     1.3 @@ -0,0 +1,389 @@
     1.4 +Index: src/server.c
     1.5 +===================================================================
     1.6 +--- src/server.c.orig	2009-05-13 09:11:11.000000000 +0200
     1.7 ++++ src/server.c	2010-04-08 08:13:27.000000000 +0200
     1.8 +@@ -568,7 +568,7 @@ prepare_io_streams (assuan_context_t ctx
     1.9 +    the last command.  A RESET command undoes the effect of this
    1.10 +    command.
    1.11 + */
    1.12 +-static int
    1.13 ++static gpg_error_t
    1.14 + cmd_session (assuan_context_t ctx, char *line)
    1.15 + {
    1.16 +   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
    1.17 +@@ -594,7 +594,7 @@ cmd_session (assuan_context_t ctx, char
    1.18 +   validity right away; if it does not (as here) all recipients are
    1.19 +   checked at the time of the ENCRYPT command.  All RECIPIENT commands
    1.20 +   are cumulative until a RESET or an successful ENCRYPT command.  */
    1.21 +-static int
    1.22 ++static gpg_error_t
    1.23 + cmd_recipient (assuan_context_t ctx, char *line)
    1.24 + {
    1.25 +   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
    1.26 +@@ -615,7 +615,7 @@ cmd_recipient (assuan_context_t ctx, cha
    1.27 +    Set the file descriptor to read a message which is used with
    1.28 +    detached signatures.
    1.29 +  */
    1.30 +-static int 
    1.31 ++static gpg_error_t
    1.32 + cmd_message (assuan_context_t ctx, char *line)
    1.33 + {
    1.34 +   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
    1.35 +@@ -659,7 +659,7 @@ cont_encrypt (assuan_context_t ctx, gpg_
    1.36 + 
    1.37 +    Encrypt the data received on INPUT to OUTPUT.
    1.38 + */
    1.39 +-static int 
    1.40 ++static gpg_error_t
    1.41 + cmd_encrypt (assuan_context_t ctx, char *line)
    1.42 + {
    1.43 +   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
    1.44 +@@ -755,7 +755,7 @@ cont_prep_encrypt (assuan_context_t ctx,
    1.45 + 
    1.46 +    Dummy encryption command used to check whether the given recipients
    1.47 +    are all valid and to tell the client the preferred protocol.  */
    1.48 +-static int 
    1.49 ++static gpg_error_t
    1.50 + cmd_prep_encrypt (assuan_context_t ctx, char *line)
    1.51 + {
    1.52 +   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
    1.53 +@@ -814,7 +814,7 @@ cmd_prep_encrypt (assuan_context_t ctx,
    1.54 +     @code{RESET} command.  A second command overrides the effect of
    1.55 +     the first one; if EMAIL is not given the server shall use the
    1.56 +     default signing key.  */
    1.57 +-static int
    1.58 ++static gpg_error_t
    1.59 + cmd_sender (assuan_context_t ctx, char *line)
    1.60 + {
    1.61 +   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
    1.62 +@@ -867,7 +867,7 @@ cont_sign (assuan_context_t ctx, gpg_err
    1.63 + 
    1.64 +    Sign the data received on INPUT to OUTPUT.
    1.65 + */
    1.66 +-static int 
    1.67 ++static gpg_error_t
    1.68 + cmd_sign (assuan_context_t ctx, char *line)
    1.69 + {
    1.70 +   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
    1.71 +@@ -943,7 +943,7 @@ cont_decrypt (assuan_context_t ctx, gpg_
    1.72 +    If the option --no-verify is given, the server should not try to
    1.73 +    verify a signature, in case the input data is an OpenPGP combined
    1.74 +    message.  */
    1.75 +-static int 
    1.76 ++static gpg_error_t
    1.77 + cmd_decrypt (assuan_context_t ctx, char *line)
    1.78 + {
    1.79 +   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
    1.80 +@@ -1058,7 +1058,7 @@ cont_verify (assuan_context_t ctx, gpg_e
    1.81 + 
    1.82 +    The DISPLAYSTRING is a percent-and-plus-encoded string with a short
    1.83 +    human readable description of the status.  */
    1.84 +-static int 
    1.85 ++static gpg_error_t
    1.86 + cmd_verify (assuan_context_t ctx, char *line)
    1.87 + {
    1.88 +   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
    1.89 +@@ -1143,7 +1143,7 @@ cmd_verify (assuan_context_t ctx, char *
    1.90 +    manager is brought into the foregound and that this command
    1.91 +    immediatley returns.
    1.92 + */
    1.93 +-static int
    1.94 ++static gpg_error_t
    1.95 + cmd_start_keymanager (assuan_context_t ctx, char *line)
    1.96 + {
    1.97 +   gpa_open_key_manager (NULL, NULL);
    1.98 +@@ -1157,7 +1157,7 @@ cmd_start_keymanager (assuan_context_t c
    1.99 +    manager is brought into the foregound and that this command
   1.100 +    immediatley returns.
   1.101 + */
   1.102 +-static int
   1.103 ++static gpg_error_t
   1.104 + cmd_start_cardmanager (assuan_context_t ctx, char *line)
   1.105 + {
   1.106 +   gpa_open_cardmanager (NULL, NULL);
   1.107 +@@ -1172,7 +1172,7 @@ cmd_start_cardmanager (assuan_context_t
   1.108 +    manager is brought into the foregound and that this command
   1.109 +    immediatley returns.
   1.110 + */
   1.111 +-static int
   1.112 ++static gpg_error_t
   1.113 + cmd_start_confdialog (assuan_context_t ctx, char *line)
   1.114 + {
   1.115 +   gpa_open_settings_dialog (NULL, NULL);
   1.116 +@@ -1191,7 +1191,7 @@ cmd_start_confdialog (assuan_context_t c
   1.117 +      version     - Return the version of the program.
   1.118 +      pid         - Return the process id of the server.
   1.119 +  */
   1.120 +-static int
   1.121 ++static gpg_error_t
   1.122 + cmd_getinfo (assuan_context_t ctx, char *line)
   1.123 + {
   1.124 +   gpg_error_t err;
   1.125 +@@ -1295,7 +1295,7 @@ decode_percent_string (char *str)
   1.126 + 
   1.127 +    Set the files on which to operate.
   1.128 +  */
   1.129 +-static int
   1.130 ++static gpg_error_t
   1.131 + cmd_file (assuan_context_t ctx, char *line)
   1.132 + {
   1.133 +   gpg_error_t err = 0;
   1.134 +@@ -1366,7 +1366,7 @@ impl_encrypt_sign_files (assuan_context_
   1.135 + 
   1.136 + 
   1.137 + /* ENCRYPT_FILES --nohup  */
   1.138 +-static int
   1.139 ++static gpg_error_t
   1.140 + cmd_encrypt_files (assuan_context_t ctx, char *line)
   1.141 + {
   1.142 +   gpg_error_t err;
   1.143 +@@ -1389,7 +1389,7 @@ cmd_encrypt_files (assuan_context_t ctx,
   1.144 + 
   1.145 + 
   1.146 + /* SIGN_FILES --nohup  */
   1.147 +-static int
   1.148 ++static gpg_error_t
   1.149 + cmd_sign_files (assuan_context_t ctx, char *line)
   1.150 + {
   1.151 +   gpg_error_t err;
   1.152 +@@ -1412,7 +1412,7 @@ cmd_sign_files (assuan_context_t ctx, ch
   1.153 + 
   1.154 + 
   1.155 + /* ENCRYPT_SIGN_FILES --nohup  */
   1.156 +-static int
   1.157 ++static gpg_error_t
   1.158 + cmd_encrypt_sign_files (assuan_context_t ctx, char *line)
   1.159 + {
   1.160 +   gpg_error_t err;
   1.161 +@@ -1474,7 +1474,7 @@ impl_decrypt_verify_files (assuan_contex
   1.162 + 
   1.163 + 
   1.164 + /* DECRYPT_FILES --nohup  */
   1.165 +-static int
   1.166 ++static gpg_error_t
   1.167 + cmd_decrypt_files (assuan_context_t ctx, char *line)
   1.168 + {
   1.169 +   gpg_error_t err;
   1.170 +@@ -1497,7 +1497,7 @@ cmd_decrypt_files (assuan_context_t ctx,
   1.171 + 
   1.172 + 
   1.173 + /* VERIFY_FILES --nohup  */
   1.174 +-static int
   1.175 ++static gpg_error_t
   1.176 + cmd_verify_files (assuan_context_t ctx, char *line)
   1.177 + {
   1.178 +   gpg_error_t err;
   1.179 +@@ -1520,7 +1520,7 @@ cmd_verify_files (assuan_context_t ctx,
   1.180 + 
   1.181 + 
   1.182 + /* DECRYPT_VERIFY_FILES --nohup  */
   1.183 +-static int
   1.184 ++static gpg_error_t
   1.185 + cmd_decrypt_verify_files (assuan_context_t ctx, char *line)
   1.186 + {
   1.187 +   gpg_error_t err;
   1.188 +@@ -1543,7 +1543,7 @@ cmd_decrypt_verify_files (assuan_context
   1.189 + 
   1.190 + 
   1.191 + /* IMPORT_FILES --nohup  */
   1.192 +-static int
   1.193 ++static gpg_error_t
   1.194 + cmd_import_files (assuan_context_t ctx, char *line)
   1.195 + {
   1.196 +   gpg_error_t err;
   1.197 +@@ -1567,7 +1567,7 @@ cmd_import_files (assuan_context_t ctx,
   1.198 + 
   1.199 + 
   1.200 + /* CHECKSUM_CREATE_FILES --nohup  */
   1.201 +-static int
   1.202 ++static gpg_error_t
   1.203 + cmd_checksum_create_files (assuan_context_t ctx, char *line)
   1.204 + {
   1.205 +   gpg_error_t err;
   1.206 +@@ -1591,7 +1591,7 @@ cmd_checksum_create_files (assuan_contex
   1.207 + 
   1.208 + 
   1.209 + /* CHECKSUM_VERIFY_FILES --nohup  */
   1.210 +-static int
   1.211 ++static gpg_error_t
   1.212 + cmd_checksum_verify_files (assuan_context_t ctx, char *line)
   1.213 + {
   1.214 +   gpg_error_t err;
   1.215 +@@ -1614,8 +1614,8 @@ cmd_checksum_verify_files (assuan_contex
   1.216 + }
   1.217 + 
   1.218 + 
   1.219 +-static void
   1.220 +-reset_notify (assuan_context_t ctx)
   1.221 ++static gpg_error_t
   1.222 ++reset_notify (assuan_context_t ctx, char *line)
   1.223 + {
   1.224 +   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
   1.225 + 
   1.226 +@@ -1639,6 +1639,7 @@ reset_notify (assuan_context_t ctx)
   1.227 +   ctrl->session_number = 0;
   1.228 +   xfree (ctrl->session_title);
   1.229 +   ctrl->session_title = NULL;
   1.230 ++  return 0;
   1.231 + }
   1.232 + 
   1.233 + 
   1.234 +@@ -1648,7 +1649,7 @@ register_commands (assuan_context_t ctx)
   1.235 + {
   1.236 +   static struct {
   1.237 +     const char *name;
   1.238 +-    int (*handler)(assuan_context_t, char *line);
   1.239 ++    assuan_handler_t handler;
   1.240 +   } table[] = {
   1.241 +     { "SESSION", cmd_session },
   1.242 +     { "RECIPIENT", cmd_recipient },
   1.243 +@@ -1681,7 +1682,8 @@ register_commands (assuan_context_t ctx)
   1.244 + 
   1.245 +   for (i=0; table[i].name; i++)
   1.246 +     {
   1.247 +-      rc = assuan_register_command (ctx, table[i].name, table[i].handler);
   1.248 ++      rc = assuan_register_command (ctx, table[i].name, table[i].handler,
   1.249 ++				    NULL);
   1.250 +       if (rc)
   1.251 +         return rc;
   1.252 +     } 
   1.253 +@@ -1692,7 +1694,7 @@ register_commands (assuan_context_t ctx)
   1.254 + 
   1.255 + /* Prepare for a new connection on descriptor FD.  */
   1.256 + static assuan_context_t
   1.257 +-connection_startup (int fd)
   1.258 ++connection_startup (assuan_fd_t fd)
   1.259 + {
   1.260 +   gpg_error_t err;
   1.261 +   assuan_context_t ctx;
   1.262 +@@ -1700,7 +1702,16 @@ connection_startup (int fd)
   1.263 + 
   1.264 +   /* Get an Assuan context for the already accepted file descriptor
   1.265 +      FD.  Allow descriptor passing.  */
   1.266 +-  err = assuan_init_socket_server_ext (&ctx, ASSUAN_INT2FD(fd), 1|2);
   1.267 ++  err = assuan_new (&ctx);
   1.268 ++  if (err)
   1.269 ++    {
   1.270 ++      g_debug ("failed to initialize the new connection: %s",
   1.271 ++               gpg_strerror (err));
   1.272 ++      return NULL;
   1.273 ++    }
   1.274 ++
   1.275 ++  err = assuan_init_socket_server (ctx, fd, ASSUAN_SOCKET_SERVER_FDPASSING
   1.276 ++				   | ASSUAN_SOCKET_SERVER_ACCEPTED);
   1.277 +   if (err)
   1.278 +     {
   1.279 +       g_debug ("failed to initialize the new connection: %s",
   1.280 +@@ -1712,7 +1723,7 @@ connection_startup (int fd)
   1.281 +     {
   1.282 +       g_debug ("failed to register commands with Assuan: %s",
   1.283 +                gpg_strerror (err));
   1.284 +-      assuan_deinit_server (ctx);
   1.285 ++      assuan_release (ctx);
   1.286 +       return NULL;
   1.287 +     }
   1.288 + 
   1.289 +@@ -1736,8 +1747,8 @@ connection_finish (assuan_context_t ctx)
   1.290 +     {
   1.291 +       conn_ctrl_t ctrl = assuan_get_pointer (ctx);
   1.292 + 
   1.293 +-      reset_notify (ctx);
   1.294 +-      assuan_deinit_server (ctx);
   1.295 ++      reset_notify (ctx, NULL);
   1.296 ++      assuan_release (ctx);
   1.297 +       g_free (ctrl);
   1.298 +       connection_counter--;
   1.299 +       if (!connection_counter && shutdown_pending)
   1.300 +@@ -1805,14 +1816,23 @@ receive_cb (GIOChannel *channel, GIOCond
   1.301 +         }
   1.302 +       else
   1.303 +         {
   1.304 ++	  int done = 0;
   1.305 +           ctrl->in_command++;
   1.306 +-          err = assuan_process_next (ctx);
   1.307 ++          err = assuan_process_next (ctx, &done);
   1.308 +           ctrl->in_command--;
   1.309 ++	  if (err)
   1.310 ++	    {
   1.311 ++	      g_debug ("assuan_process_next returned: %s <%s>",
   1.312 ++		       gpg_strerror (err), gpg_strsource (err));
   1.313 ++	    }
   1.314 ++	  else
   1.315 ++	    {
   1.316 +           g_debug ("assuan_process_next returned: %s",
   1.317 +-                   err == -1? "EOF": gpg_strerror (err));
   1.318 ++		       done ? "done" : "success");
   1.319 ++	    }
   1.320 +           if (gpg_err_code (err) == GPG_ERR_EAGAIN)
   1.321 +             ; /* Ignore.  */
   1.322 +-          else if (gpg_err_code (err) == GPG_ERR_EOF || err == -1)
   1.323 ++          else if (!err && done)
   1.324 +             {
   1.325 +               if (ctrl->cont_cmd)
   1.326 +                 ctrl->client_died = 1; /* Need to delay the cleanup.  */
   1.327 +@@ -1868,14 +1888,14 @@ accept_connection_cb (GIOChannel *listen
   1.328 +       g_debug ("error accepting connection: %s", strerror (errno));
   1.329 +       goto leave;
   1.330 +     }
   1.331 +-  if (assuan_sock_check_nonce (ASSUAN_INT2FD(fd), &socket_nonce))
   1.332 ++  if (assuan_sock_check_nonce ((assuan_fd_t) fd, &socket_nonce))
   1.333 +     {
   1.334 +       g_debug ("new connection at fd %d refused", fd); 
   1.335 +       goto leave;
   1.336 +     }
   1.337 + 
   1.338 +   g_debug ("new connection at fd %d", fd);
   1.339 +-  ctx = connection_startup (fd);
   1.340 ++  ctx = connection_startup ((assuan_fd_t) fd);
   1.341 +   if (!ctx)
   1.342 +     goto leave;
   1.343 + 
   1.344 +@@ -1911,7 +1931,7 @@ accept_connection_cb (GIOChannel *listen
   1.345 + 
   1.346 +  leave:
   1.347 +   if (fd != -1)
   1.348 +-    assuan_sock_close (ASSUAN_INT2FD (fd));
   1.349 ++    assuan_sock_close ((assuan_fd_t) fd);
   1.350 +   return TRUE; /* Keep the listen_fd in the event loop.  */
   1.351 + }
   1.352 + 
   1.353 +@@ -1929,7 +1949,7 @@ gpa_start_server (void)
   1.354 +   GIOChannel *channel;
   1.355 +   unsigned int source_id;
   1.356 + 
   1.357 +-  assuan_set_assuan_err_source (GPG_ERR_SOURCE_DEFAULT);
   1.358 ++  assuan_set_gpg_err_source (GPG_ERR_SOURCE_DEFAULT);
   1.359 +   
   1.360 +   socket_name = g_build_filename (gnupg_homedir, "S.uiserver", NULL);
   1.361 +   if (strlen (socket_name)+1 >= sizeof serv_addr.sun_path ) 
   1.362 +@@ -1974,14 +1994,14 @@ gpa_start_server (void)
   1.363 +   g_free (socket_name);
   1.364 +   socket_name = NULL;
   1.365 + 
   1.366 +-  if (listen (ASSUAN_FD2INT (fd), 5) == -1)
   1.367 ++  if (listen ((int) fd, 5) == -1)
   1.368 +     {
   1.369 +       g_debug ("listen() failed: %s\n", strerror (errno));
   1.370 +       assuan_sock_close (fd);
   1.371 +       return;
   1.372 +     }
   1.373 + #ifdef HAVE_W32_SYSTEM
   1.374 +-  channel = g_io_channel_win32_new_socket (ASSUAN_FD2INT(fd));
   1.375 ++  channel = g_io_channel_win32_new_socket ((int) fd);
   1.376 + #else
   1.377 +   channel = g_io_channel_unix_new (fd);
   1.378 + #endif
   1.379 +Index: configure.ac
   1.380 +===================================================================
   1.381 +--- configure.ac.orig	2009-06-20 00:05:29.000000000 +0200
   1.382 ++++ configure.ac	2010-04-08 08:13:27.000000000 +0200
   1.383 +@@ -37,8 +37,8 @@ AC_INIT([gpa],
   1.384 +         [bug-gpa@gnupg.org])
   1.385 + 
   1.386 + NEED_GPG_ERROR_VERSION=1.4
   1.387 +-NEED_LIBASSUAN_API=1
   1.388 +-NEED_LIBASSUAN_VERSION=1.0.4
   1.389 ++NEED_LIBASSUAN_API=2
   1.390 ++NEED_LIBASSUAN_VERSION=1.1.0
   1.391 + NEED_GPGME_API=1
   1.392 + NEED_GPGME_VERSION=1.2.0