1 # This program is free software; you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation; either version 2 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU Library General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program; if not, write to the Free Software
13 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 # Copyright 2005 Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
17 from exceptions
import Exception
19 def canIgnoreSSLError(e
):
21 Identify common network errors that mean we cannot connect to the server
24 # This is a bit complicated by the fact that different versions of
25 # M2Crypto & OpenSSL seem to return different error codes for the
28 if e
[0] == 104: # Connection refused
30 elif e
[0] == 111: # Connection reset by peer
32 elif e
[0] == 61: # Connection refused
34 elif e
[0] == 54: # Connection reset by peer
36 elif s
== "no certificate returned":
38 elif s
== "wrong version number":
40 elif s
== "unexpected eof":
46 def canIgnoreSocketError(e
):
48 Identify common network errors that mean we cannot connect to the server
52 if e
[0] == 111: # Connection refused
54 elif e
[0] == 104: # Connection reset by peer
56 elif e
[0] == 61: # Connection refused
63 # FIXME: is anything using this? remove underscores
64 class CertMaster_Client_Exception(Exception):
65 def __init__(self
, value
=None):
66 Exception.__init
__(self
)
69 return "%s" %(self
.value
,)