Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b0b0bd6c
Commit
b0b0bd6c
authored
Oct 10, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
USe PyObject_SetString() instead of PyObject_SetObject() in newSSLObject().
parent
2771b5b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
14 deletions
+9
-14
Modules/socketmodule.c
Modules/socketmodule.c
+9
-14
No files found.
Modules/socketmodule.c
View file @
b0b0bd6c
...
...
@@ -2498,11 +2498,11 @@ static SSLObject *
newSSLObject
(
PySocketSockObject
*
Sock
,
char
*
key_file
,
char
*
cert_file
)
{
SSLObject
*
self
;
PyObject
*
erro
r
=
NULL
;
char
*
errst
r
=
NULL
;
self
=
PyObject_New
(
SSLObject
,
&
SSL_Type
);
/* Create new object */
if
(
self
==
NULL
){
err
or
=
PyString_FromString
(
"newSSLObject error"
)
;
err
str
=
"newSSLObject error"
;
goto
fail
;
}
memset
(
self
->
server
,
'\0'
,
sizeof
(
char
)
*
256
);
...
...
@@ -2514,28 +2514,25 @@ newSSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file)
self
->
ctx
=
SSL_CTX_new
(
SSLv23_method
());
/* Set up context */
if
(
self
->
ctx
==
NULL
)
{
err
or
=
PyString_FromString
(
"SSL_CTX_new error"
)
;
err
str
=
"SSL_CTX_new error"
;
goto
fail
;
}
if
((
key_file
&&
!
cert_file
)
||
(
!
key_file
&&
cert_file
))
{
error
=
PyString_FromString
(
"Both the key & certificate files must be specified"
);
errstr
=
"Both the key & certificate files must be specified"
;
goto
fail
;
}
if
(
key_file
&&
cert_file
)
{
if
(
SSL_CTX_use_PrivateKey_file
(
self
->
ctx
,
key_file
,
SSL_FILETYPE_PEM
)
<
1
)
{
error
=
PyString_FromString
(
"SSL_CTX_use_PrivateKey_file error"
);
errstr
=
"SSL_CTX_use_PrivateKey_file error"
;
goto
fail
;
}
if
(
SSL_CTX_use_certificate_chain_file
(
self
->
ctx
,
cert_file
)
<
1
)
{
error
=
PyString_FromString
(
"SSL_CTX_use_certificate_chain_file error"
);
errstr
=
"SSL_CTX_use_certificate_chain_file error"
;
goto
fail
;
}
}
...
...
@@ -2549,7 +2546,7 @@ newSSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file)
/* Actually negotiate SSL connection */
/* XXX If SSL_connect() returns 0, it's also a failure. */
if
((
SSL_connect
(
self
->
ssl
))
==
-
1
)
{
err
or
=
PyString_FromString
(
"SSL_connect error"
)
;
err
str
=
"SSL_connect error"
;
goto
fail
;
}
self
->
ssl
->
debug
=
1
;
...
...
@@ -2564,10 +2561,8 @@ newSSLObject(PySocketSockObject *Sock, char *key_file, char *cert_file)
Py_INCREF
(
self
->
Socket
);
return
self
;
fail:
if
(
error
)
{
PyErr_SetObject
(
SSLErrorObject
,
error
);
Py_DECREF
(
error
);
}
if
(
errstr
)
PyErr_SetString
(
SSLErrorObject
,
errstr
);
Py_DECREF
(
self
);
return
NULL
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment