Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passwords with spaces not supported in .sendxmpprc #9

Closed
ben0x4a opened this issue Sep 11, 2014 · 4 comments
Closed

passwords with spaces not supported in .sendxmpprc #9

ben0x4a opened this issue Sep 11, 2014 · 4 comments

Comments

@ben0x4a
Copy link

ben0x4a commented Sep 11, 2014

Since the fields in .sendxmpprc are whitespace seperated, there is no way to enter a password with a space in it.

@matthiasbock
Copy link

Are you sure? Have you tried quotation: "password" or 'password' ?

@ben0x4a
Copy link
Author

ben0x4a commented Sep 12, 2014

I am sure. Adding quotes just makes things worse, the quotes get included as part of the password.

[ben@Nyx:~/projects/sendxmpp] cat /.sendxmpprc
ben@im.office.gdi 'secret hello what' hello
[ben@Nyx:
/projects/sendxmpp] echo "test message" | ./sendxmpp -v --ssl -j im.office.gdi ben@im.office.gdi
Use of uninitialized value $args{"file"} in lc at /usr/share/perl5/Net/XMPP/Debug.pm line 154.
syntax error in line 1 of /home/ben/.sendxmpprc

[ben@Nyx:~/projects/sendxmpp] cat /.sendxmpprc
ben@im.office.gdi "secret hello what" hello
[ben@Nyx:
/projects/sendxmpp] echo "test message" | ./sendxmpp -v --ssl -j im.office.gdi ben@im.office.gdi
Use of uninitialized value $args{"file"} in lc at /usr/share/perl5/Net/XMPP/Debug.pm line 154.
syntax error in line 1 of /home/ben/.sendxmpprc

[ben@Nyx:~/projects/sendxmpp] cat /.sendxmpprc
ben@im.office.gdi "secrethello" there
[ben@Nyx:
/projects/sendxmpp] echo "test message" | ./sendxmpp -v --ssl -j im.office.gdi ben@im.office.gdi
Use of uninitialized value $args{"file"} in lc at /usr/share/perl5/Net/XMPP/Debug.pm line 154.
sendxmpp: config: 'password' => '"secrethello"'
sendxmpp: config: 'component' => 'there'
sendxmpp: config: 'jserver' => 'im.office.gdi'
sendxmpp: config: 'port' => '0'
sendxmpp: config: 'username' => 'ben'
sendxmpp: ssl_verify: 1
sendxmpp: tls_ca_path:
Use of uninitialized value within @_ in lc at /usr/share/perl5/XML/Stream/Parser.pm line 71.
sendxmpp: Connect: 1
Error 'AuthSend': error: not-authorized[?]
sendxmpp: Disconnect

It comes down to the regex here:
if (/([.\w_#-]+)@([-.\w:;]+)\s+(\S+)\s*(\S+)?$/) {
%config = (
'username' => $1,
'jserver' => $2,
'port' => 0,
'password' => $3,
'component' => $4,
);

The password (\S+) matches non-whitespace characters. No quoting or escaping is checked for. Adding support for quoting in the regex would be difficult without breaking passwords with quotation marks in them. Probably the best option would be to put each field on a seperate line, like:
account: user
server: server
password: "password"
component: componentname
and consider everything between the first and last " part of the password, so ""hello there" => "hello there

@lhost
Copy link
Owner

lhost commented Sep 13, 2014

Hi all,

I will check this issue this week and provide a patch. The biggest problem
is backward compatibility but it is not a problem at all. :-)

Thanks for your report.

Regards,
LH
On Sep 12, 2014 5:20 PM, "ben0x4a" notifications@github.com wrote:

I am sure. Adding quotes just makes things worse, the quotes get included
as part of the password.

[ben@Nyx:~/projects/sendxmpp] cat /.sendxmpprc
ben@im.office.gdi 'secret hello what' hello
[ben@Nyx:
/projects/sendxmpp] echo "test message" | ./sendxmpp -v --ssl
-j im.office.gdi ben@im.office.gdi
Use of uninitialized value $args{"file"} in lc at
/usr/share/perl5/Net/XMPP/Debug.pm line 154.
syntax error in line 1 of /home/ben/.sendxmpprc

[ben@Nyx:~/projects/sendxmpp] cat /.sendxmpprc
ben@im.office.gdi "secret hello what" hello
[ben@Nyx:
/projects/sendxmpp] echo "test message" | ./sendxmpp -v --ssl
-j im.office.gdi ben@im.office.gdi
Use of uninitialized value $args{"file"} in lc at
/usr/share/perl5/Net/XMPP/Debug.pm line 154.
syntax error in line 1 of /home/ben/.sendxmpprc

[ben@Nyx:~/projects/sendxmpp] cat /.sendxmpprc
ben@im.office.gdi "secrethello" there
[ben@Nyx:
/projects/sendxmpp] echo "test message" | ./sendxmpp -v --ssl
-j im.office.gdi ben@im.office.gdi
Use of uninitialized value $args{"file"} in lc at
/usr/share/perl5/Net/XMPP/Debug.pm line 154.
sendxmpp: config: 'password' => '"secrethello"'
sendxmpp: config: 'component' => 'there'
sendxmpp: config: 'jserver' => 'im.office.gdi'
sendxmpp: config: 'port' => '0'
sendxmpp: config: 'username' => 'ben'
sendxmpp: ssl_verify: 1
sendxmpp: tls_ca_path:
Use of uninitialized value within @_ in lc at
/usr/share/perl5/XML/Stream/Parser.pm line 71.
sendxmpp: Connect: 1
Error 'AuthSend': error: not-authorized[?]
sendxmpp: Disconnect

It comes down to the regex here:
if (/([.\w_#-]+)@([-.\w:;]+)\s+(\S+)\s*(\S+)?$/) {
%config = (
'username' => $1,
'jserver' => $2,
'port' => 0,
'password' => $3,
'component' => $4,
);

The password (\S+) matches non-whitespace characters. No quoting or
escaping is checked for. Adding support for quoting in the regex would be
difficult without breaking passwords with quotation marks in them. Probably
the best option would be to put each field on a seperate line, like:
account: user
server: server
password: "password"
component: componentname
and consider everything between the first and last " part of the password,
so ""hello there" => "hello there


Reply to this email directly or view it on GitHub
#9 (comment).

@lhost
Copy link
Owner

lhost commented Sep 13, 2014

Fixed

@lhost lhost closed this as completed Sep 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants