Juan Hernandez has uploaded a new change for review.

Change subject: sdk: No new lines in basic auth token
......................................................................

sdk: No new lines in basic auth token

Currently we generate the value of the basic authentication header using
the "encodestring" method of the "base64" module, but the output of this
method may contain many new lines, depending on the length of the user
name and password. When more than one newline is included we only delete
the last, and as a result we generate a header with a new line, which is
interpreted by the web server as two headers, thus breaking the
authentication mechanism. This patch changes the SDK so that all the new
lines are removed.

Change-Id: I02bb66b5bed9c152fcba95ab577373b66f19be05
Bug-Url: https://bugzilla.redhat.com/1085837
Signed-off-by: Juan Hernandez <[email protected]>
---
M src/ovirtsdk/web/connection.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/52/26752/1

diff --git a/src/ovirtsdk/web/connection.py b/src/ovirtsdk/web/connection.py
index 5bd84d7..8af27e2 100644
--- a/src/ovirtsdk/web/connection.py
+++ b/src/ovirtsdk/web/connection.py
@@ -243,7 +243,7 @@
               )
 
     def __createStaticHeaders(self, username, password):
-        auth = base64.encodestring("%s:%s" % (username, password)).strip()
+        auth = base64.encodestring("%s:%s" % (username, 
password)).replace("\n", "")
         return {"Content-type" : "application/xml",
                 "Accept"       : "application/xml",
                 "Authorization": "Basic %s" % auth}


-- 
To view, visit http://gerrit.ovirt.org/26752
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02bb66b5bed9c152fcba95ab577373b66f19be05
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to