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
d72645bf
Commit
d72645bf
authored
May 15, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using local var in open_auth_file
parent
7d5bcec9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
mongoose.c
mongoose.c
+4
-1
No files found.
mongoose.c
View file @
d72645bf
...
@@ -2257,13 +2257,16 @@ static void open_auth_file(struct mg_connection *conn, const char *path,
...
@@ -2257,13 +2257,16 @@ static void open_auth_file(struct mg_connection *conn, const char *path,
struct
file
*
filep
)
{
struct
file
*
filep
)
{
char
name
[
PATH_MAX
];
char
name
[
PATH_MAX
];
const
char
*
p
,
*
e
,
*
gpass
=
conn
->
ctx
->
config
[
GLOBAL_PASSWORDS_FILE
];
const
char
*
p
,
*
e
,
*
gpass
=
conn
->
ctx
->
config
[
GLOBAL_PASSWORDS_FILE
];
struct
file
file
=
STRUCT_FILE_INITIALIZER
;
if
(
gpass
!=
NULL
)
{
if
(
gpass
!=
NULL
)
{
// Use global passwords file
// Use global passwords file
if
(
!
mg_fopen
(
conn
,
gpass
,
"r"
,
filep
))
{
if
(
!
mg_fopen
(
conn
,
gpass
,
"r"
,
filep
))
{
cry
(
conn
,
"fopen(%s): %s"
,
gpass
,
strerror
(
ERRNO
));
cry
(
conn
,
"fopen(%s): %s"
,
gpass
,
strerror
(
ERRNO
));
}
}
}
else
if
(
mg_stat
(
conn
,
path
,
filep
)
&&
filep
->
is_directory
)
{
// Important: using local struct file to test path for is_directory flag.
// If filep is used, mg_stat() makes it appear as if auth file was opened.
}
else
if
(
mg_stat
(
conn
,
path
,
&
file
)
&&
file
.
is_directory
)
{
mg_snprintf
(
conn
,
name
,
sizeof
(
name
),
"%s%c%s"
,
mg_snprintf
(
conn
,
name
,
sizeof
(
name
),
"%s%c%s"
,
path
,
'/'
,
PASSWORDS_FILE_NAME
);
path
,
'/'
,
PASSWORDS_FILE_NAME
);
mg_fopen
(
conn
,
name
,
"r"
,
filep
);
mg_fopen
(
conn
,
name
,
"r"
,
filep
);
...
...
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