logging for bad passwords as suggested by mas

This commit is contained in:
Ron Pedde 2007-04-13 23:31:57 +00:00
parent 69ec57328e
commit e991d1ec08
4 changed files with 20 additions and 3 deletions

View File

@ -425,10 +425,16 @@ int config_auth(WS_CONNINFO *pwsc, char *user, char *password) {
return TRUE;
}
if(!password)
if(!password) {
DPRINTF(E_LOG,L_MISC,"admin: Invalid password from %s (null)\n",
pwsc->hostname);
return FALSE;
}
res = !strcmp(password,adminpassword);
if(!res)
DPRINTF(E_LOG,L_MISC,"admin: Invalid password from %s (%s)\n",
pwsc->hostname, password);
free(adminpassword);
return res;
}

View File

@ -136,6 +136,7 @@ typedef struct tag_plugin_input_fn {
int (*ws_fd)(struct tag_ws_conninfo *);
char* (*ws_getrequestheader)(struct tag_ws_conninfo *, char *);
int (*ws_writebinary)(struct tag_ws_conninfo *, char *, int);
char* (*ws_gethostname)(struct tag_ws_conninfo *);
/* misc helpers */
char* (*server_ver)(void);

View File

@ -94,6 +94,7 @@ int _plugin_ssc_transcode(WS_CONNINFO *pwsc, MP3FILE *pmp3, int offset, int head
char *pi_ws_uri(WS_CONNINFO *pwsc);
void pi_ws_will_close(WS_CONNINFO *pwsc);
int pi_ws_fd(WS_CONNINFO *pwsc);
char *pi_ws_gethostname(WS_CONNINFO *pwsc);
/* misc helpers */
char *pi_server_ver(void);
@ -126,6 +127,7 @@ PLUGIN_INPUT_FN pi = {
pi_ws_fd,
ws_getrequestheader,
ws_writebinary,
pi_ws_gethostname,
pi_server_ver,
pi_server_name,
@ -687,6 +689,10 @@ int pi_ws_fd(WS_CONNINFO *pwsc) {
return pwsc->fd;
}
char *pi_ws_gethostname(WS_CONNINFO *pwsc) {
return pwsc->hostname;
}
void pi_log(int level, char *fmt, ...) {
char buf[256];
va_list ap;

View File

@ -212,11 +212,15 @@ int plugin_auth(WS_CONNINFO *pwsc, char *username, char *password) {
return TRUE;
} else {
_ppi->conf_dispose_string(readpassword);
_ppi->log(E_LOG,"out-daap: Invalid password from %s (%s)\n",
_ppi->ws_gethostname(pwsc),password);
return FALSE;
}
} else {
if(strcasecmp(password,readpassword)) {
_ppi->conf_dispose_string(readpassword);
_ppi->log(E_LOG,"out-daap: Invalid password from %s (%s)\n",
_ppi->ws_gethostname(pwsc),password);
return FALSE;
} else {
_ppi->conf_dispose_string(readpassword);