mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-14 00:10:10 -04:00
implement password handling for rsp
This commit is contained in:
parent
93ef128cfb
commit
bb9c3fe75b
@ -134,6 +134,7 @@ int daap_auth(WS_CONNINFO *pwsc, char *username, char *password) {
|
|||||||
|
|
||||||
if(password == NULL) {
|
if(password == NULL) {
|
||||||
if((readpassword == NULL)||(strlen(readpassword) == 0)) {
|
if((readpassword == NULL)||(strlen(readpassword) == 0)) {
|
||||||
|
if(readpassword) free(readpassword);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
free(readpassword);
|
free(readpassword);
|
||||||
|
@ -24,7 +24,7 @@ typedef struct tag_rsp_privinfo {
|
|||||||
/* Forwards */
|
/* Forwards */
|
||||||
PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *);
|
PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *);
|
||||||
void plugin_handler(WS_CONNINFO *pwsc);
|
void plugin_handler(WS_CONNINFO *pwsc);
|
||||||
int plugin_auth(WS_CONNINFO *pwsc, char *username, char *pw);
|
int plugin_auth(WS_CONNINFO *pwsc, char *username, char *password);
|
||||||
void rsp_info(WS_CONNINFO *pwsc, PRIVINFO *ppi);
|
void rsp_info(WS_CONNINFO *pwsc, PRIVINFO *ppi);
|
||||||
void rsp_db(WS_CONNINFO *pwsc, PRIVINFO *ppi);
|
void rsp_db(WS_CONNINFO *pwsc, PRIVINFO *ppi);
|
||||||
void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi);
|
void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi);
|
||||||
@ -153,11 +153,31 @@ PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check for auth
|
* check for auth. Kind of a ham-handed implementation, but
|
||||||
|
* works.
|
||||||
*/
|
*/
|
||||||
int plugin_auth(WS_CONNINFO *pwsc, char *username, char *pw) {
|
int plugin_auth(WS_CONNINFO *pwsc, char *username, char *password) {
|
||||||
/* disable passwords for now */
|
char *readpassword;
|
||||||
return 1;
|
|
||||||
|
readpassword = _ppi->conf_alloc_string("general","password",NULL);
|
||||||
|
if(password == NULL) { /* testing to see if we need a pw */
|
||||||
|
if((readpassword == NULL) || (strlen(readpassword)==0)) {
|
||||||
|
if(readpassword) free(readpassword);
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
free(readpassword);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(strcasecmp(password,readpassword)) {
|
||||||
|
free(readpassword);
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
free(readpassword);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE; /* ?? */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user