Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
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
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
1d0eead9
Commit
1d0eead9
authored
11 years ago
by
Steve Holme
Browse files
Options
Downloads
Patches
Plain Diff
sasl: Updated create_digest_md5_message() to use a dynamic buffer
parent
8005e589
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/curl_sasl.c
+17
-10
17 additions, 10 deletions
lib/curl_sasl.c
with
17 additions
and
10 deletions
lib/curl_sasl.c
+
17
−
10
View file @
1d0eead9
...
...
@@ -246,7 +246,7 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,
/* Finalise the digest */
Curl_HMAC_final
(
ctxt
,
digest
);
/*
Prepar
e the response */
/*
Generat
e the response */
response
=
aprintf
(
"%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
,
userp
,
digest
[
0
],
digest
[
1
],
digest
[
2
],
digest
[
3
],
digest
[
4
],
...
...
@@ -255,7 +255,7 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,
if
(
!
response
)
return
CURLE_OUT_OF_MEMORY
;
/* Base64 encode the re
ply
*/
/* Base64 encode the re
sponse
*/
result
=
Curl_base64_encode
(
data
,
response
,
0
,
outptr
,
outlen
);
Curl_safefree
(
response
);
...
...
@@ -354,8 +354,10 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
#ifndef DEBUGBUILD
static
const
char
table16
[]
=
"0123456789abcdef"
;
#endif
CURLcode
result
=
CURLE_OK
;
size_t
i
;
MD5_context
*
ctxt
;
char
*
response
=
NULL
;
unsigned
char
digest
[
MD5_DIGEST_LEN
];
char
HA1_hex
[
2
*
MD5_DIGEST_LEN
+
1
];
char
HA2_hex
[
2
*
MD5_DIGEST_LEN
+
1
];
...
...
@@ -366,7 +368,6 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
char
method
[]
=
"AUTHENTICATE"
;
char
qop
[]
=
"auth"
;
char
uri
[
128
];
char
response
[
512
];
#ifndef DEBUGBUILD
/* Generate 64 bits of random data */
...
...
@@ -451,14 +452,20 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
for
(
i
=
0
;
i
<
MD5_DIGEST_LEN
;
i
++
)
snprintf
(
&
resp_hash_hex
[
2
*
i
],
3
,
"%02x"
,
digest
[
i
]);
snprintf
(
response
,
sizeof
(
response
),
"username=
\"
%s
\"
,realm=
\"
%s
\"
,nonce=
\"
%s
\"
,"
"cnonce=
\"
%s
\"
,nc=
\"
%s
\"
,digest-uri=
\"
%s
\"
,response=%s"
,
userp
,
realm
,
nonce
,
cnonce
,
nonceCount
,
uri
,
resp_hash_hex
);
/* Generate the response */
response
=
aprintf
(
"username=
\"
%s
\"
,realm=
\"
%s
\"
,nonce=
\"
%s
\"
,"
"cnonce=
\"
%s
\"
,nc=
\"
%s
\"
,digest-uri=
\"
%s
\"
,response=%s"
,
userp
,
realm
,
nonce
,
cnonce
,
nonceCount
,
uri
,
resp_hash_hex
);
if
(
!
response
)
return
CURLE_OUT_OF_MEMORY
;
/* Base64 encode the reply */
return
Curl_base64_encode
(
data
,
response
,
0
,
outptr
,
outlen
);
/* Base64 encode the response */
result
=
Curl_base64_encode
(
data
,
response
,
0
,
outptr
,
outlen
);
Curl_safefree
(
response
);
return
result
;
}
#endif
...
...
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