Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
f52d7c5f
Commit
f52d7c5f
authored
3 months ago
by
Deucе
Browse files
Options
Downloads
Patches
Plain Diff
Fix WITHOUT_CRYPTLIB
parent
751b5891
No related branches found
No related tags found
No related merge requests found
Pipeline
#8076
passed
3 months ago
Stage: build
Stage: test
Stage: cleanup
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/syncterm/webget.c
+14
-0
14 additions, 0 deletions
src/syncterm/webget.c
with
14 additions
and
0 deletions
src/syncterm/webget.c
+
14
−
0
View file @
f52d7c5f
...
...
@@ -2,7 +2,9 @@
#include
<stdarg.h>
#include
<stdbool.h>
#ifndef WITHOUT_CRYPTLIB
#include
<cryptlib.h>
#endif
#include
"bbslist.h"
#include
"conn.h"
...
...
@@ -38,7 +40,9 @@ struct http_session {
struct
bbslist
hacky_list_entry
;
struct
http_cache_info
cache
;
SOCKET
sock
;
#ifndef WITHOUT_CRYPTLIB
CRYPT_SESSION
tls
;
#endif
bool
is_tls
;
bool
is_chunked
;
bool
not_modified
;
...
...
@@ -100,6 +104,7 @@ recv_nbytes(struct http_session *sess, uint8_t *buf, size_t chunk_size, bool *eo
while
(
received
<
chunk_size
)
{
ssize_t
rc
;
if
(
sess
->
is_tls
)
{
#ifndef WITHOUT_CRYPTLIB
int
copied
=
0
;
int
status
=
cryptPopData
(
sess
->
tls
,
&
buf
[
received
],
chunk_size
-
received
,
&
copied
);
if
(
cryptStatusError
(
status
))
{
...
...
@@ -107,6 +112,7 @@ recv_nbytes(struct http_session *sess, uint8_t *buf, size_t chunk_size, bool *eo
goto
error_return
;
}
rc
=
copied
;
#endif
}
else
{
if
(
!
socket_readable
(
sess
->
sock
,
5000
))
{
...
...
@@ -152,11 +158,13 @@ close_socket(struct http_session *sess)
static
void
free_session
(
struct
http_session
*
sess
)
{
#ifndef WITHOUT_CRYPTLIB
if
(
sess
->
is_tls
&&
sess
->
tls
!=
-
1
)
{
cryptSetAttribute
(
sess
->
tls
,
CRYPT_SESSINFO_ACTIVE
,
0
);
cryptDestroySession
(
sess
->
tls
);
sess
->
tls
=
-
1
;
}
#endif
close_socket
(
sess
);
if
(
sess
->
cache_info
)
{
fclose
(
sess
->
cache_info
);
...
...
@@ -228,6 +236,7 @@ send_request(struct http_session *sess)
sess
->
cache
.
request_time
=
time
(
NULL
);
ssize_t
sent
;
if
(
sess
->
is_tls
)
{
#ifndef WITHOUT_CRYPTLIB
int
copied
;
int
ret
=
cryptPushData
(
sess
->
tls
,
reqstr
,
len
,
&
copied
);
if
(
cryptStatusError
(
ret
))
{
...
...
@@ -239,6 +248,7 @@ send_request(struct http_session *sess)
if
(
cryptStatusError
(
ret
))
{
sent
=
-
1
;
}
#endif
}
else
{
sent
=
send
(
sess
->
sock
,
reqstr
,
len
,
0
);
...
...
@@ -955,6 +965,7 @@ error_return:
static
bool
tls_setup
(
struct
http_session
*
sess
)
{
#ifndef WITHOUT_CRYPTLIB
int
status
;
status
=
cryptCreateSession
(
&
sess
->
tls
,
CRYPT_UNUSED
,
CRYPT_SESSION_SSL
);
if
(
cryptStatusError
(
status
))
{
...
...
@@ -983,6 +994,7 @@ tls_setup(struct http_session *sess)
return
true
;
error_return:
#endif
return
false
;
}
...
...
@@ -1114,7 +1126,9 @@ iniReadHttp(struct webget_request *req)
struct
http_session
sess
=
{
.
sock
=
INVALID_SOCKET
,
.
req
=
req
,
#ifndef WITHOUT_CRYPTLIB
.
tls
=
-
1
,
#endif
.
hacky_list_entry
=
{
.
hidepopups
=
true
,
.
address_family
=
PF_UNSPEC
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment