Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
4828c07d
Commit
4828c07d
authored
May 26, 2018
by
Philipp Schafft
🦁
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Fixed segfault in htpasswd auth if no filename is set
parent
ee5cce7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
src/auth_htpasswd.c
src/auth_htpasswd.c
+36
-0
No files found.
src/auth_htpasswd.c
View file @
4828c07d
...
...
@@ -191,6 +191,11 @@ static auth_result htpasswd_auth (auth_client *auth_user)
}
htpasswd_recheckfile
(
htpasswd
);
if
(
htpasswd
->
users
)
{
ICECAST_LOG_ERROR
(
"No user list."
);
return
AUTH_NOMATCH
;
}
thread_rwlock_rlock
(
&
htpasswd
->
file_rwlock
);
entry
.
name
=
client
->
username
;
if
(
avl_get_by_key
(
htpasswd
->
users
,
&
entry
,
&
result
)
==
0
)
{
...
...
@@ -257,8 +262,18 @@ static auth_result htpasswd_adduser (auth_t *auth, const char *username, const c
htpasswd_user
entry
;
void
*
result
;
if
(
!
state
->
filename
)
{
ICECAST_LOG_ERROR
(
"No filename given in options for authenticator."
);
return
AUTH_FAILED
;
}
htpasswd_recheckfile
(
state
);
if
(
state
->
users
)
{
ICECAST_LOG_ERROR
(
"No user list."
);
return
AUTH_FAILED
;
}
thread_rwlock_wlock
(
&
state
->
file_rwlock
);
entry
.
name
=
(
char
*
)
username
;
...
...
@@ -301,6 +316,17 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
struct
stat
file_info
;
state
=
auth
->
state
;
if
(
!
state
->
filename
)
{
ICECAST_LOG_ERROR
(
"No filename given in options for authenticator."
);
return
AUTH_FAILED
;
}
if
(
state
->
users
)
{
ICECAST_LOG_ERROR
(
"No user list."
);
return
AUTH_FAILED
;
}
thread_rwlock_wlock
(
&
state
->
file_rwlock
);
passwdfile
=
fopen
(
state
->
filename
,
"rb"
);
...
...
@@ -383,8 +409,18 @@ static auth_result htpasswd_userlist(auth_t *auth, xmlNodePtr srcnode)
state
=
auth
->
state
;
if
(
!
state
->
filename
)
{
ICECAST_LOG_ERROR
(
"No filename given in options for authenticator."
);
return
AUTH_FAILED
;
}
htpasswd_recheckfile
(
state
);
if
(
state
->
users
)
{
ICECAST_LOG_ERROR
(
"No user list."
);
return
AUTH_FAILED
;
}
thread_rwlock_rlock
(
&
state
->
file_rwlock
);
node
=
avl_get_first
(
state
->
users
);
while
(
node
)
{
...
...
Philipp Schafft
🦁
@ph3-der-loewe
mentioned in commit
ea42a12e
·
Jun 19, 2018
mentioned in commit
ea42a12e
mentioned in commit ea42a12efb33edee8703c97017139ce749b9e954
Toggle commit list
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