hrkfdn/mpdas

Password doesn't work.

CamilleScholtz opened this issue · 16 comments

Since the last release (when the password switched from md5 to plain) my password no longer works (and yes, I'm using a plain password now :)).

I thing the fact that I use symbols such as [@>:-&... in my password causes this.

https://github.com/hrkfdn/mpdas/blob/master/config.cpp#L13

Looks like I added colons to the token separator list, causing incorrect parsing. I'll have a look at it soon, unfortunately I'm a little busy at the moment due to exams.

Thanks for the report!

Actually, can you build the master branch and test if the latest commit fixes it for you?

This is what I get now:

(14:58:40) [ERROR] Code: 13
(14:58:40) [ERROR] Invalid method signature.

Password with whitespace doesn't work too in the latest release (didn't check master):

[ERROR] Code: 4
[ERROR] Authentication failed. Please check your login data.

There is a new branch (wip) that contains a revamped config system. If you guys could give it a try and see if it fixes your password parsing problems it would help me a lot.

Getting a SIGSEGV (Address boundary error) here.

@hrkfdn I get a segmentation fault on new branch (gcc version 7.1.1 20170630 (GCC)), tried running with both explicit config file (-c option) and implicit one (stored in home dir):

gsnewmark@asgard:~/Projects/open-source/mpdas|wip⚡ 
⇒  make clean
rm -rf main.o md5.o utils.o mpd.o audioscrobbler.o cache.o config.o inih/ini.o mpdas
gsnewmark@asgard:~/Projects/open-source/mpdas|wip 
⇒  make all
g++ `pkg-config --cflags libmpdclient libcurl` -DCONFDIR="\"/usr/local/etc\"" -DVERSION="\"0.4.4\"" -c -o main.o main.cpp
g++ `pkg-config --cflags libmpdclient libcurl` -DCONFDIR="\"/usr/local/etc\"" -DVERSION="\"0.4.4\"" -c -o md5.o md5.cpp
g++ `pkg-config --cflags libmpdclient libcurl` -DCONFDIR="\"/usr/local/etc\"" -DVERSION="\"0.4.4\"" -c -o utils.o utils.cpp
g++ `pkg-config --cflags libmpdclient libcurl` -DCONFDIR="\"/usr/local/etc\"" -DVERSION="\"0.4.4\"" -c -o mpd.o mpd.cpp
g++ `pkg-config --cflags libmpdclient libcurl` -DCONFDIR="\"/usr/local/etc\"" -DVERSION="\"0.4.4\"" -c -o audioscrobbler.o audioscrobbler.cpp
g++ `pkg-config --cflags libmpdclient libcurl` -DCONFDIR="\"/usr/local/etc\"" -DVERSION="\"0.4.4\"" -c -o cache.o cache.cpp
g++ `pkg-config --cflags libmpdclient libcurl` -DCONFDIR="\"/usr/local/etc\"" -DVERSION="\"0.4.4\"" -c -o config.o config.cpp
cc    -c -o inih/ini.o inih/ini.c
g++  main.o md5.o utils.o mpd.o audioscrobbler.o cache.o config.o inih/ini.o `pkg-config --libs libmpdclient libcurl` -o mpdas
gsnewmark@asgard:~/Projects/open-source/mpdas|wip⚡ 
⇒  ./mpdas 
[1]    13769 segmentation fault (core dumped)  ./mpdas

Backtrace:

gsnewmark@asgard:~/Projects/open-source/mpdas|wip⚡ 
⇒  gdb mpdas /tmp/coredump-mpdas.13769 
GNU gdb (GDB) 8.0
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from mpdas...(no debugging symbols found)...done.
[New LWP 13769]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `./mpdas'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000000fc2215ba1a in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_begin() ()
(gdb) bt
#0  0x000000fc2215ba1a in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_begin() ()
#1  0x000000fc22164970 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::lower_bound(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#2  0x000000fc2216462f in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::lower_bound(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#3  0x000000fc2216444f in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#4  0x000000fc22164397 in CConfig::Set(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ()
#5  0x000000fc221639b1 in IniHandler(void*, char const*, char const*, char const*) ()
#6  0x000000fc22165e9a in ini_parse_stream ()
#7  0x000000fc22165f40 in ini_parse_file ()
#8  0x000000fc22165f92 in ini_parse ()
#9  0x000000fc22163a83 in CConfig::LoadConfig(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ()
#10 0x000000fc22164119 in CConfig::CConfig(char*) ()
#11 0x000000fc2215b07a in main ()

Config file:

username = gsnewmark
password = <password>
runas = mpd
debug = 1

Maybe some additional steps are required during compilation? I've only checked out new submodule and run make all.

I tried building mpdas with -g -O0 and running it in gdb, but didn't get any info.

Could you guys pull and build again? I can't reproduce it, yet, but this time it should print the configuration value it fails on.

Config:

#
# /etc/mpdas.conf: mpdas configuration
#

# Last.fm username and password
username = onodera-punpun
password = <password>

# The user mpdas runs as
user "mpd"

# End of file

Output:

[] username: onodera-punpun
fish: './mpdas -c /etc/mpdas.conf' terminated by signal SIGSEGV (Address boundary error)

Could you try one more time?

[] username: onodera-punpun
[] password: <password>
(15:51:57) [ERROR] Code: 13
(15:51:57) [ERROR] Invalid method signature.

Seems to work now. I don't exactly know why Code: 13 happens though, I got this before: #42 (comment)

Thanks for testing! I hope to fix that in the coming days :)

latest version works for me too

@onodera-punpun Could you open a separate issue for the code 13 problem and give me some details (config, ..) on when (authentication, etc.) it occurs?