Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
e3806197
Commit
e3806197
authored
Jan 11, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exposed mg_authorize_digest()
parent
a4e8dc30
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
mongoose.c
mongoose.c
+6
-5
mongoose.h
mongoose.h
+1
-0
No files found.
mongoose.c
View file @
e3806197
...
...
@@ -2899,8 +2899,9 @@ static int check_password(const char *method, const char *ha1, const char *uri,
// Authorize against the opened passwords file. Return 1 if authorized.
static
int
authorize
(
struct
connection
*
conn
,
FILE
*
fp
)
{
const
char
*
hdr
=
mg_get_header
(
&
conn
->
mg_conn
,
"Authorization"
);
int
mg_authorize_digest
(
struct
mg_connection
*
c
,
FILE
*
fp
)
{
struct
connection
*
conn
=
(
struct
connection
*
)
c
;
const
char
*
hdr
=
mg_get_header
(
c
,
"Authorization"
);
char
line
[
256
],
f_user
[
256
],
ha1
[
256
],
f_domain
[
256
],
user
[
100
],
nonce
[
100
],
uri
[
MAX_REQUEST_SIZE
],
cnonce
[
100
],
resp
[
100
],
qop
[
100
],
nc
[
100
];
...
...
@@ -2918,7 +2919,7 @@ static int authorize(struct connection *conn, FILE *fp) {
!
strcmp
(
user
,
f_user
)
&&
// NOTE(lsm): due to a bug in MSIE, we do not compare URIs
!
strcmp
(
conn
->
server
->
config_options
[
AUTH_DOMAIN
],
f_domain
))
return
check_password
(
c
onn
->
mg_conn
.
request_method
,
ha1
,
uri
,
return
check_password
(
c
->
request_method
,
ha1
,
uri
,
nonce
,
nc
,
cnonce
,
qop
,
resp
);
}
return
0
;
...
...
@@ -2931,7 +2932,7 @@ static int is_authorized(struct connection *conn, const char *path) {
int
authorized
=
1
;
if
((
fp
=
open_auth_file
(
conn
,
path
))
!=
NULL
)
{
authorized
=
authorize
(
conn
,
fp
);
authorized
=
mg_authorize_digest
(
&
conn
->
mg_
conn
,
fp
);
fclose
(
fp
);
}
...
...
@@ -2944,7 +2945,7 @@ static int is_authorized_for_dav(struct connection *conn) {
int
authorized
=
0
;
if
(
auth_file
!=
NULL
&&
(
fp
=
fopen
(
auth_file
,
"r"
))
!=
NULL
)
{
authorized
=
authorize
(
conn
,
fp
);
authorized
=
mg_authorize_digest
(
&
conn
->
mg_
conn
,
fp
);
fclose
(
fp
);
}
...
...
mongoose.h
View file @
e3806197
...
...
@@ -96,6 +96,7 @@ int mg_parse_header(const char *hdr, const char *var_name, char *buf, size_t);
// Utility functions
void
*
mg_start_thread
(
void
*
(
*
func
)(
void
*
),
void
*
param
);
char
*
mg_md5
(
char
buf
[
33
],
...);
int
mg_authorize_digest
(
struct
mg_connection
*
c
,
FILE
*
fp
);
#ifdef __cplusplus
}
...
...
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