[Spice-devel] [PATCH v2] console-kit: Check session-lock just by IdleHint

2017-01-17 Thread Pavel Grunt
gnome-panel in RHEL6 does not emit the Unlock signal when session
is being unlocked making the agent think that the session is locked.

Remove handling of Lock/Unlock signals and keep only IdleHintChanged.

Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1412673

Acked-by: Victor Toso 
---
v2:
 - link to the ConsoleKit issue about "locked-hint" (Victor)
 - s/gnome-shell/gnome-panel/ (Christophe)
---
 src/vdagentd/console-kit.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/vdagentd/console-kit.c b/src/vdagentd/console-kit.c
index 024a260..a939f38 100644
--- a/src/vdagentd/console-kit.c
+++ b/src/vdagentd/console-kit.c
@@ -493,11 +493,11 @@ gboolean session_info_session_is_locked(struct 
session_info *info)
 
 /* Not every system does emit Lock and Unlock signals (for instance, such
  * is the case for RHEL6) but most of the systems seems to emit the
- * IdleHintChanged. So, we give priority to the Lock signal, if it is 
Locked
- * we return that the session is locked, otherwise we double check with the
- * IdleHint value */
+ * IdleHintChanged. So use the IdleHint value.
+ * systemd-login uses locked-hint which is not implemented in ConsoleKit,
+ * see https://github.com/ConsoleKit2/ConsoleKit2/issues/89 */
 si_dbus_read_signals(info);
-locked = (info->session_is_locked || info->session_idle_hint);
+locked = info->session_idle_hint;
 if (info->verbose) {
 syslog(LOG_DEBUG, "(console-kit) session is locked: %s",
locked ? "yes" : "no");
-- 
2.11.0

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


Re: [Spice-devel] [PATCH] console-kit: Check session-lock just by IdleHint

2017-01-17 Thread Christophe Fergeau
On Tue, Jan 17, 2017 at 02:45:58PM +0100, Pavel Grunt wrote:
> gnome-shell in RHEL6 does not emit the Unlock signal when session

Nit: s/gnome-shell/gnome-panel/ I guess? Or maybe even some lower-level
component.

Christophe


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-common] ssl: Use ASN1_STRING_get0_data instead of ASN1_STRING_data

2017-01-17 Thread Victor Toso
Hi,

On Fri, Jan 13, 2017 at 12:12:50PM +0100, Christophe Fergeau wrote:
> From: Sebastian Andrzej Siewior 
>
> The latter is deprecated, so might be removed at  some point in the
> future. This also adds a compatibility wrapper for OpenSSL < 1.1.0.
>
> Signed-off-by: Sebastian Andrzej Siewior 
> ---
>  common/ssl_verify.c | 20 ++--
>  1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/common/ssl_verify.c b/common/ssl_verify.c
> index 601252e..b6a96a7 100644
> --- a/common/ssl_verify.c
> +++ b/common/ssl_verify.c
> @@ -33,6 +33,14 @@
>  #include 
>  #include 
>

I would include a FIXME here, to require >= 1.1.0 in the future, just
make it easier to track this.

I don't have 1.1.0 here to test, but this matches the description at
[0], so

Acked-by: Victor Toso 

[0] 
https://github.com/openssl/openssl/commit/17ebf85abda18c3875b1ba6670fe7b393bc1f297

> +#if OPENSSL_VERSION_NUMBER < 0x1010
> +
> +static const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *asn1)
> +{
> +return M_ASN1_STRING_data(asn1);
> +}
> +#endif
> +
>  static int verify_pubkey(X509* cert, const char *key, size_t key_size)
>  {
>  EVP_PKEY* cert_pubkey = NULL;
> @@ -182,10 +190,10 @@ static int verify_hostname(X509* cert, const char 
> *hostname)
>  const GENERAL_NAME* name = 
> sk_GENERAL_NAME_value(subject_alt_names, i);
>  if (name->type == GEN_DNS) {
>  found_dns_name = 1;
> -if (_gnutls_hostname_compare((char 
> *)ASN1_STRING_data(name->d.dNSName),
> +if (_gnutls_hostname_compare((const char 
> *)ASN1_STRING_get0_data(name->d.dNSName),
>   
> ASN1_STRING_length(name->d.dNSName),
>   hostname)) {
> -spice_debug("alt name match=%s", 
> ASN1_STRING_data(name->d.dNSName));
> +spice_debug("alt name match=%s", 
> ASN1_STRING_get0_data(name->d.dNSName));
>  GENERAL_NAMES_free(subject_alt_names);
>  return 1;
>  }
> @@ -208,11 +216,11 @@ static int verify_hostname(X509* cert, const char 
> *hostname)
>  alt_ip_len = ASN1_STRING_length(name->d.iPAddress);
>  
>  if ((ip_len == alt_ip_len) &&
> -   (memcmp(ASN1_STRING_data(name->d.iPAddress), ip_binary, 
> ip_len)) == 0) {
> +   (memcmp(ASN1_STRING_get0_data(name->d.iPAddress), 
> ip_binary, ip_len)) == 0) {
>  GInetAddress * alt_ip = NULL;
>  gchar * alt_ip_string = NULL;
>  
> -alt_ip = 
> g_inet_address_new_from_bytes(ASN1_STRING_data(name->d.iPAddress),
> +alt_ip = 
> g_inet_address_new_from_bytes(ASN1_STRING_get0_data(name->d.iPAddress),
> 
> g_inet_address_get_family(ip));
>  alt_ip_string = g_inet_address_to_string(alt_ip);
>  spice_debug("alt name IP match=%s", alt_ip_string);
> @@ -253,10 +261,10 @@ static int verify_hostname(X509* cert, const char 
> *hostname)
>  continue;
>  }
>  
> -if (_gnutls_hostname_compare((char*)ASN1_STRING_data(cn_asn1),
> +if (_gnutls_hostname_compare((const 
> char*)ASN1_STRING_get0_data(cn_asn1),
>   ASN1_STRING_length(cn_asn1),
>   hostname)) {
> -spice_debug("common name match=%s", 
> (char*)ASN1_STRING_data(cn_asn1));
> +spice_debug("common name match=%s", 
> (char*)ASN1_STRING_get0_data(cn_asn1));
>  cn_match = 1;
>  break;
>  }
> -- 
> 2.9.3
> 
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] console-kit: Check session-lock just by IdleHint

2017-01-17 Thread Victor Toso
Hi,

On Tue, Jan 17, 2017 at 02:45:58PM +0100, Pavel Grunt wrote:
> gnome-shell in RHEL6 does not emit the Unlock signal when session
> is being unlocked making the agent think that the session is locked.

Yes, my bad in the logic here. Thanks!
Now, for systems that don't rely on systemd, locked signals (or
properties) should be used. Could you please file an issue to
ConsoleKit2 [0], asking for parity with logind in this regard? That is,
being idle is not the same as being locked, so consolekit could/should
have something similar to [1]

[0] https://github.com/ConsoleKit2
[1] https://github.com/systemd/systemd/pull/3238

>
> Remove handling of Lock/Unlock signals and keep only IdleHintChanged.
>
> Resolves:
> https://bugzilla.redhat.com/show_bug.cgi?id=1412673
> ---
> signal handling can be removed as well
> ---
>  src/vdagentd/console-kit.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/src/vdagentd/console-kit.c b/src/vdagentd/console-kit.c
> index 024a260..5230508 100644
> --- a/src/vdagentd/console-kit.c
> +++ b/src/vdagentd/console-kit.c
> @@ -493,11 +493,10 @@ gboolean session_info_session_is_locked(struct 
> session_info *info)
>  
>  /* Not every system does emit Lock and Unlock signals (for instance, such
>   * is the case for RHEL6) but most of the systems seems to emit the
> - * IdleHintChanged. So, we give priority to the Lock signal, if it is 
> Locked
> - * we return that the session is locked, otherwise we double check with 
> the
> - * IdleHint value */
> + * IdleHintChanged. So use the IdleHint value.
> + * systemd-login uses locked-hint which is not implemented in 
> ConsoleKit. */

If you think it is okay to include the #issue number in the comment,
feel free to do it.

Acked-by: Victor Toso 


>  si_dbus_read_signals(info);
> -locked = (info->session_is_locked || info->session_idle_hint);
> +locked = info->session_idle_hint;
>  if (info->verbose) {
>  syslog(LOG_DEBUG, "(console-kit) session is locked: %s",
> locked ? "yes" : "no");
> -- 
> 2.11.0
> 
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] console-kit: Check session-lock just by IdleHint

2017-01-17 Thread Pavel Grunt
gnome-shell in RHEL6 does not emit the Unlock signal when session
is being unlocked making the agent think that the session is locked.

Remove handling of Lock/Unlock signals and keep only IdleHintChanged.

Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1412673
---
signal handling can be removed as well
---
 src/vdagentd/console-kit.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/vdagentd/console-kit.c b/src/vdagentd/console-kit.c
index 024a260..5230508 100644
--- a/src/vdagentd/console-kit.c
+++ b/src/vdagentd/console-kit.c
@@ -493,11 +493,10 @@ gboolean session_info_session_is_locked(struct 
session_info *info)
 
 /* Not every system does emit Lock and Unlock signals (for instance, such
  * is the case for RHEL6) but most of the systems seems to emit the
- * IdleHintChanged. So, we give priority to the Lock signal, if it is 
Locked
- * we return that the session is locked, otherwise we double check with the
- * IdleHint value */
+ * IdleHintChanged. So use the IdleHint value.
+ * systemd-login uses locked-hint which is not implemented in ConsoleKit. 
*/
 si_dbus_read_signals(info);
-locked = (info->session_is_locked || info->session_idle_hint);
+locked = info->session_idle_hint;
 if (info->verbose) {
 syslog(LOG_DEBUG, "(console-kit) session is locked: %s",
locked ? "yes" : "no");
-- 
2.11.0

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