Re: [Spice-devel] [PATCH v2] Check RSA_generate_key_ex return value

2014-03-16 Thread Uri Lublin

On 03/12/2014 03:22 PM, Christophe Fergeau wrote:

This commit will cause the client connection to fail but qemu won't
segfault.
---
Changes since v1:
- don't leak BIO when RSA_generate_key_ex fails

diff --git a/server/reds.c b/server/reds.c
index c38fa40..6706754 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1368,8 +1368,15 @@ static int reds_send_link_ack(RedLinkInfo *link)
  return FALSE;
  }
  
-RSA_generate_key_ex(link-tiTicketing.rsa, SPICE_TICKET_KEY_PAIR_LENGTH, link-tiTicketing.bn,

-NULL);
+if (RSA_generate_key_ex(link-tiTicketing.rsa,
+SPICE_TICKET_KEY_PAIR_LENGTH,
+link-tiTicketing.bn,
+NULL) != 1) {
+spice_warning(Failed to generate %d bits RSA key: %s,
+  SPICE_TICKET_KEY_PAIR_LENGTH,
+  ERR_error_string(ERR_get_error(), NULL));
+goto end;
+}
  link-tiTicketing.rsa_size = RSA_size(link-tiTicketing.rsa);
  
  i2d_RSA_PUBKEY_bio(bio, link-tiTicketing.rsa);

Ack.
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH server] Associate org.spice-space.webdav.0 port to webdav channel

2014-03-16 Thread Alon Levy
On 01/12/2014 07:34 PM, Marc-André Lureau wrote:
 For example, with qemu, a webdav channel can be created this way:
 
  -chardev spiceport,name=org.spice-space.webdav.0,...
 
 And redirected to a virtio port:
 
  -device virtserialport,...,name=org.spice-space.webdav.0

Ack. Still reviewing the gtk part. I've tested this.

 ---
  server/reds.c | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/server/reds.c b/server/reds.c
 index 2a0002b..2c63154 100644
 --- a/server/reds.c
 +++ b/server/reds.c
 @@ -3668,7 +3668,11 @@ static int 
 spice_server_char_device_add_interface(SpiceServer *s,
  dev_state = spicevmc_device_connect(char_device, 
 SPICE_CHANNEL_USBREDIR);
  }
  else if (strcmp(char_device-subtype, SUBTYPE_PORT) == 0) {
 -dev_state = spicevmc_device_connect(char_device, SPICE_CHANNEL_PORT);
 +if (strcmp(char_device-portname, org.spice-space.webdav.0) == 0) {
 +dev_state = spicevmc_device_connect(char_device, 
 SPICE_CHANNEL_WEBDAV);
 +} else {
 +dev_state = spicevmc_device_connect(char_device, 
 SPICE_CHANNEL_PORT);
 +}
  }
  
  if (dev_state) {
 @@ -4206,6 +4210,7 @@ SPICE_GNUC_VISIBLE int 
 spice_server_set_channel_security(SpiceServer *s, const c
  [ SPICE_CHANNEL_SMARTCARD] = smartcard,
  #endif
  [ SPICE_CHANNEL_USBREDIR ] = usbredir,
 +[ SPICE_CHANNEL_WEBDAV ] = webdav,
  };
  int i;
  
 

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel