mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-12 07:23:24 -05:00
add password support
This commit is contained in:
parent
af983110a2
commit
0df8292d6f
25
src/main.c
25
src/main.c
@ -52,6 +52,21 @@
|
|||||||
*/
|
*/
|
||||||
CONFIG config;
|
CONFIG config;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* daap_auth
|
||||||
|
*
|
||||||
|
* Auth handler for the daap server
|
||||||
|
*/
|
||||||
|
int daap_auth(char *username, char *password) {
|
||||||
|
if((password == NULL) && (config.readpassword == NULL))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if(password == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return !strcasecmp(password,config.readpassword);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* daap_handler
|
* daap_handler
|
||||||
*
|
*
|
||||||
@ -387,11 +402,11 @@ int main(int argc, char *argv[]) {
|
|||||||
ws_registerhandler(server, "^.*$",config_handler,config_auth,1);
|
ws_registerhandler(server, "^.*$",config_handler,config_auth,1);
|
||||||
ws_registerhandler(server, "^/server-info$",daap_handler,NULL,0);
|
ws_registerhandler(server, "^/server-info$",daap_handler,NULL,0);
|
||||||
ws_registerhandler(server, "^/content-codes$",daap_handler,NULL,0);
|
ws_registerhandler(server, "^/content-codes$",daap_handler,NULL,0);
|
||||||
ws_registerhandler(server,"^/login$",daap_handler,NULL,0);
|
ws_registerhandler(server,"^/login$",daap_handler,daap_auth,0);
|
||||||
ws_registerhandler(server,"^/update$",daap_handler,NULL,0);
|
ws_registerhandler(server,"^/update$",daap_handler,daap_auth,0);
|
||||||
ws_registerhandler(server,"^/databases$",daap_handler,NULL,0);
|
ws_registerhandler(server,"^/databases$",daap_handler,daap_auth,0);
|
||||||
ws_registerhandler(server,"^/logout$",daap_handler,NULL,0);
|
ws_registerhandler(server,"^/logout$",daap_handler,daap_auth,0);
|
||||||
ws_registerhandler(server,"^/databases/.*",daap_handler,NULL,0);
|
ws_registerhandler(server,"^/databases/.*",daap_handler,daap_auth,0);
|
||||||
|
|
||||||
config.stop=0;
|
config.stop=0;
|
||||||
|
|
||||||
|
@ -4,4 +4,5 @@ admin_pw secret
|
|||||||
mp3_dir mp3
|
mp3_dir mp3
|
||||||
servername Ron's Secret Stash
|
servername Ron's Secret Stash
|
||||||
playlist mt-daapd.playlist
|
playlist mt-daapd.playlist
|
||||||
|
password mp3
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user