[Pkg-sugar-commit] [sugar-toolkit] 90/118: check syntax of private key (#1568)

Jonas Smedegaard dr at jones.dk
Thu Apr 16 18:49:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/0.84.10-1
in repository sugar-toolkit.

commit cfcaf4743d1c3eb52a37d5ce4322efd16986f10f
Author: Sascha Silbe <sascha-pgp at silbe.org>
Date:   Tue Mar 9 23:34:59 2010 +0000

    check syntax of private key (#1568)
    
    Check that header and footer of the private key are present in order to detect
    corrupted key files.
    
    Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>
---
 src/sugar/profile.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/sugar/profile.py b/src/sugar/profile.py
index d5012bd..df9237e 100644
--- a/src/sugar/profile.py
+++ b/src/sugar/profile.py
@@ -97,14 +97,18 @@ class Profile(object):
             return None
 
         key = ""
+        begin_found = False
+        end_found = False
         for l in lines:
             l = l.strip()
             if l.startswith("-----BEGIN DSA PRIVATE KEY-----"):
+                begin_found = True
                 continue
             if l.startswith("-----END DSA PRIVATE KEY-----"):
+                end_found = True
                 continue
             key += l
-        if not len(key):
+        if not (len(key) and begin_found and end_found):
             logging.error("Error parsing public key.")
             return None
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit.git



More information about the pkg-sugar-commit mailing list