diff --git a/src/configfile.c b/src/configfile.c index 0dd7a3e0..51d5faaf 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -73,6 +73,7 @@ CONFIGELEMENT config_elements[] = { { 1,1,0,CONFIG_TYPE_INT,"port",(void*)&config.port,config_emit_int }, { 1,1,0,CONFIG_TYPE_STRING,"admin_pw",(void*)&config.adminpassword,config_emit_string }, { 1,1,0,CONFIG_TYPE_STRING,"mp3_dir",(void*)&config.mp3dir,config_emit_string }, + { 1,1,0,CONFIG_TYPE_STRING,"servername",(void*)&config.servername,config_emit_string }, { 0,0,0,CONFIG_TYPE_SPECIAL,"release",(void*)VERSION,config_emit_literal }, { 0,0,0,CONFIG_TYPE_SPECIAL,"package",(void*)PACKAGE,config_emit_literal }, { 0,0,0,CONFIG_TYPE_SPECIAL,"include",(void*)NULL,config_emit_include }, @@ -187,6 +188,7 @@ int config_read(char *file) { while((pce->config_element != -1)) { if(pce->required && pce->config_element && !pce->changed) { fprintf(stderr,"Required config entry '%s' not specified\n",pce->name); + errno=EINVAL; err=-1; } if((pce->config_element) && (pce->changed)) { diff --git a/src/daap.c b/src/daap.c index 751f2333..ee1bcc37 100644 --- a/src/daap.c +++ b/src/daap.c @@ -346,7 +346,7 @@ DAAP_BLOCK *daap_response_update(int clientver) { * * handle the daap block for the /databases/containers URI */ -DAAP_BLOCK *daap_response_playlists(void) { +DAAP_BLOCK *daap_response_playlists(char *name) { DAAP_BLOCK *root; DAAP_BLOCK *mlcl; DAAP_BLOCK *mlit; @@ -366,7 +366,7 @@ DAAP_BLOCK *daap_response_playlists(void) { if(mlit) { g = g && daap_add_int(mlit,"miid",0x1); g = g && daap_add_long(mlit,"mper",0,2); - g = g && daap_add_string(mlit,"minm","mt-daapd"); + g = g && daap_add_string(mlit,"minm",name); g = g && daap_add_int(mlit,"mimc",db_get_song_count()); } } @@ -389,7 +389,7 @@ DAAP_BLOCK *daap_response_playlists(void) { * handle the daap block for the /databases URI */ -DAAP_BLOCK *daap_response_dbinfo(void) { +DAAP_BLOCK *daap_response_dbinfo(char *name) { DAAP_BLOCK *root; DAAP_BLOCK *mlcl; DAAP_BLOCK *mlit; @@ -409,7 +409,7 @@ DAAP_BLOCK *daap_response_dbinfo(void) { if(mlit) { g = g && daap_add_int(mlit,"miid",0x20); g = g && daap_add_long(mlit,"mper",0,1); - g = g && daap_add_string(mlit,"minm","mt-daapd"); + g = g && daap_add_string(mlit,"minm",name); g = g && daap_add_int(mlit,"mimc",db_get_song_count()); /* songs */ g = g && daap_add_int(mlit,"mctc",0x1); /* playlists */ } @@ -432,7 +432,7 @@ DAAP_BLOCK *daap_response_dbinfo(void) { * * handle the daap block for the /server-info URI */ -DAAP_BLOCK *daap_response_server_info(void) { +DAAP_BLOCK *daap_response_server_info(char *name) { DAAP_BLOCK *root; int g=1; @@ -444,7 +444,7 @@ DAAP_BLOCK *daap_response_server_info(void) { g = (int)daap_add_int(root,"mstt",200); /* result */ g = g && daap_add_int(root,"mpro",2 << 16); /* dmap proto ? */ g = g && daap_add_int(root,"apro",2 << 16); /* daap protocol */ - g = g && daap_add_string(root,"minm","mt-daapd"); /* server name */ + g = g && daap_add_string(root,"minm",name); /* server name */ g = g && daap_add_char(root,"mslr",0); /* logon required */ g = g && daap_add_int(root,"mstm",1800); /* timeout - iTunes=1800 */ g = g && daap_add_char(root,"msal",0); /* autologout */ diff --git a/src/daap.h b/src/daap.h index 867bf8a3..90e8fa3b 100644 --- a/src/daap.h +++ b/src/daap.h @@ -23,13 +23,13 @@ #include "daap-proto.h" -DAAP_BLOCK *daap_response_server_info(void); +DAAP_BLOCK *daap_response_server_info(char *name); DAAP_BLOCK *daap_response_content_codes(void); DAAP_BLOCK *daap_response_login(void); DAAP_BLOCK *daap_response_update(int clientver); DAAP_BLOCK *daap_response_songlist(void); -DAAP_BLOCK *daap_response_playlists(void); -DAAP_BLOCK *daap_response_dbinfo(void); +DAAP_BLOCK *daap_response_playlists(char *name); +DAAP_BLOCK *daap_response_dbinfo(char *name); DAAP_BLOCK *daap_response_playlist_items(int playlist); #endif /* _DAAP_H_ */ diff --git a/src/daapd.h b/src/daapd.h index c178d558..4c4b4720 100644 --- a/src/daapd.h +++ b/src/daapd.h @@ -36,6 +36,7 @@ typedef struct tag_config { char *adminpassword; char *readpassword; char *mp3dir; + char *servername; SONGENTRY songlist; } CONFIG;