Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
6857923a
Commit
6857923a
authored
Feb 17, 2011
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua intf: don't print passwords in the logs
This is evil!
parent
deed838e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
1 deletion
+59
-1
modules/misc/lua/intf.c
modules/misc/lua/intf.c
+59
-1
No files found.
modules/misc/lua/intf.c
View file @
6857923a
...
@@ -127,6 +127,58 @@ static char *GetModuleName( intf_thread_t *p_intf )
...
@@ -127,6 +127,58 @@ static char *GetModuleName( intf_thread_t *p_intf )
return
var_CreateGetString
(
p_intf
,
"lua-intf"
);
return
var_CreateGetString
(
p_intf
,
"lua-intf"
);
}
}
static
char
*
StripPasswords
(
const
char
*
psz_config
)
{
unsigned
n
=
0
;
const
char
*
p
=
psz_config
;
while
((
p
=
strstr
(
p
,
"password="
))
!=
NULL
)
{
n
++
;
p
++
;
}
if
(
n
==
0
)
return
strdup
(
psz_config
);
char
*
psz_log
=
malloc
(
strlen
(
psz_config
)
+
n
*
strlen
(
"******"
)
+
1
);
if
(
psz_log
==
NULL
)
return
NULL
;
psz_log
[
0
]
=
'\0'
;
for
(
p
=
psz_config
;
;
)
{
const
char
*
pwd
=
strstr
(
p
,
"password="
);
if
(
pwd
==
NULL
)
{
/* Copy the last, ending bit */
strcat
(
psz_log
,
p
);
break
;
}
pwd
+=
strlen
(
"password="
);
char
delim
[
3
]
=
",}"
;
if
(
*
pwd
==
'\''
||
*
pwd
==
'"'
)
{
delim
[
0
]
=
*
pwd
++
;
delim
[
1
]
=
'\0'
;
}
strncat
(
psz_log
,
p
,
pwd
-
p
);
strcat
(
psz_log
,
"******"
);
/* Advance to the delimiter at the end of the password */
p
=
pwd
-
1
;
do
{
p
=
strpbrk
(
p
+
1
,
delim
);
if
(
p
==
NULL
)
/* Oops, unbalanced quotes or brackets */
return
psz_log
;
}
while
(
*
(
p
-
1
)
==
'\\'
);
}
return
psz_log
;
}
static
const
luaL_Reg
p_reg
[]
=
{
{
NULL
,
NULL
}
};
static
const
luaL_Reg
p_reg
[]
=
{
{
NULL
,
NULL
}
};
int
Open_LuaIntf
(
vlc_object_t
*
p_this
)
int
Open_LuaIntf
(
vlc_object_t
*
p_this
)
...
@@ -314,7 +366,13 @@ int Open_LuaIntf( vlc_object_t *p_this )
...
@@ -314,7 +366,13 @@ int Open_LuaIntf( vlc_object_t *p_this )
char
*
psz_buffer
;
char
*
psz_buffer
;
if
(
asprintf
(
&
psz_buffer
,
"config={%s}"
,
psz_config
)
!=
-
1
)
if
(
asprintf
(
&
psz_buffer
,
"config={%s}"
,
psz_config
)
!=
-
1
)
{
{
msg_Dbg
(
p_intf
,
"Setting config variable: %s"
,
psz_buffer
);
char
*
psz_log
=
StripPasswords
(
psz_buffer
);
if
(
psz_log
!=
NULL
)
{
msg_Dbg
(
p_intf
,
"Setting config variable: %s"
,
psz_log
);
free
(
psz_log
);
}
if
(
luaL_dostring
(
L
,
psz_buffer
)
==
1
)
if
(
luaL_dostring
(
L
,
psz_buffer
)
==
1
)
msg_Err
(
p_intf
,
"Error while parsing
\"
lua-config
\"
."
);
msg_Err
(
p_intf
,
"Error while parsing
\"
lua-config
\"
."
);
free
(
psz_buffer
);
free
(
psz_buffer
);
...
...
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