Fixed an error raised during the client registration via proxy when
'X-RHN-IP-Path' header is not set. This regression has been introduced
by commit 251005196b02b.

However I still think commit 251005196b02b should not be reverted. The
previous implementation of UserDict altered the behavior of python's
dict in an undocumented way. This was dangerous because it could lead to
unexpected results both in our own code and, more important of all, into
3rd party libraries. In fact I found this bug while looking into some
errors raised by the 3rd party PostgreSQL library used by rhnSQL.

Cheers
Flavio

-- 
Flavio Castelli
SUSE LINUX Products GmbH
Maxfeldstraße 5, 90409 Nürnberg Germany
>From bc60a8ac7cfee9c3703ca52a629bf2a177830db4 Mon Sep 17 00:00:00 2001
From: Flavio Castelli <fcaste...@suse.com>
Date: Tue, 17 Dec 2013 09:53:54 +0100
Subject: [PATCH] Fixed client registration via proxy

The previous code relied on a wrong behavior of UserDict class which
has been fixed with commit 251005196b02b.

Fixed the code to not crash when the 'X-RHN-IP-Path' header is not set.

---
 proxy/proxy/broker/rhnBroker.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/proxy/proxy/broker/rhnBroker.py b/proxy/proxy/broker/rhnBroker.py
index e77ef13..a9194ca 100644
--- a/proxy/proxy/broker/rhnBroker.py
+++ b/proxy/proxy/broker/rhnBroker.py
@@ -175,7 +175,9 @@ class BrokerHandler(SharedHandler):
         # do that for us
 
         # Add/modify the X-RHN-IP-Path header.
-        ip_path = _oto['X-RHN-IP-Path']
+        ip_path = None
+        if 'X-RHN-IP-Path' in _oto:
+            ip_path = _oto['X-RHN-IP-Path']
         log_debug(4, "X-RHN-IP-Path is: %s" % repr(ip_path))
         client_ip = self.req.connection.remote_ip
         if ip_path is None:
-- 
1.8.4

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to