mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-11-03 04:17:17 -05:00
Fix: Fixed segfault in htpasswd auth if no filename is set
This commit is contained in:
parent
cdf63bf5ea
commit
c5201770b6
@ -194,6 +194,11 @@ static auth_result htpasswd_auth (auth_client *auth_user)
|
|||||||
}
|
}
|
||||||
htpasswd_recheckfile (htpasswd);
|
htpasswd_recheckfile (htpasswd);
|
||||||
|
|
||||||
|
if (htpasswd->users == NULL) {
|
||||||
|
ICECAST_LOG_ERROR("No user list.");
|
||||||
|
return AUTH_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
thread_rwlock_rlock (&htpasswd->file_rwlock);
|
thread_rwlock_rlock (&htpasswd->file_rwlock);
|
||||||
entry.name = client->username;
|
entry.name = client->username;
|
||||||
if (avl_get_by_key (htpasswd->users, &entry, &result) == 0)
|
if (avl_get_by_key (htpasswd->users, &entry, &result) == 0)
|
||||||
@ -262,8 +267,18 @@ static auth_result htpasswd_adduser (auth_t *auth, const char *username, const c
|
|||||||
htpasswd_user entry;
|
htpasswd_user entry;
|
||||||
void *result;
|
void *result;
|
||||||
|
|
||||||
|
if (state->filename == NULL) {
|
||||||
|
ICECAST_LOG_ERROR("No filename given in options for authenticator.");
|
||||||
|
return AUTH_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
htpasswd_recheckfile (state);
|
htpasswd_recheckfile (state);
|
||||||
|
|
||||||
|
if (state->filename == NULL) {
|
||||||
|
ICECAST_LOG_ERROR("No user list.");
|
||||||
|
return AUTH_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
thread_rwlock_wlock (&state->file_rwlock);
|
thread_rwlock_wlock (&state->file_rwlock);
|
||||||
|
|
||||||
entry.name = (char*)username;
|
entry.name = (char*)username;
|
||||||
@ -308,6 +323,17 @@ static auth_result htpasswd_deleteuser(auth_t *auth, const char *username)
|
|||||||
struct stat file_info;
|
struct stat file_info;
|
||||||
|
|
||||||
state = auth->state;
|
state = auth->state;
|
||||||
|
|
||||||
|
if (state->filename == NULL) {
|
||||||
|
ICECAST_LOG_ERROR("No filename given in options for authenticator.");
|
||||||
|
return AUTH_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state->users == NULL) {
|
||||||
|
ICECAST_LOG_ERROR("No user list.");
|
||||||
|
return AUTH_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
thread_rwlock_wlock (&state->file_rwlock);
|
thread_rwlock_wlock (&state->file_rwlock);
|
||||||
passwdfile = fopen(state->filename, "rb");
|
passwdfile = fopen(state->filename, "rb");
|
||||||
|
|
||||||
@ -392,8 +418,18 @@ static auth_result htpasswd_userlist(auth_t *auth, xmlNodePtr srcnode)
|
|||||||
|
|
||||||
state = auth->state;
|
state = auth->state;
|
||||||
|
|
||||||
|
if (state->filename == NULL) {
|
||||||
|
ICECAST_LOG_ERROR("No filename given in options for authenticator.");
|
||||||
|
return AUTH_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
htpasswd_recheckfile (state);
|
htpasswd_recheckfile (state);
|
||||||
|
|
||||||
|
if (state->users == NULL) {
|
||||||
|
ICECAST_LOG_ERROR("No user list.");
|
||||||
|
return AUTH_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
thread_rwlock_rlock (&state->file_rwlock);
|
thread_rwlock_rlock (&state->file_rwlock);
|
||||||
node = avl_get_first (state->users);
|
node = avl_get_first (state->users);
|
||||||
while (node)
|
while (node)
|
||||||
|
Loading…
Reference in New Issue
Block a user