tyilo/auprint

Bash special characters are not properly escaped in password.

Robotto opened this issue · 12 comments

A password containing '!' renders the script inoperable with the error message:

"Invalid auid/password combination"

I am assuming that this is the case for all of the bash special chars.

tyilo commented

I'm actually not sure that smbclient / lpadmin support special characters, but maybe you can try the following, as I don't want to change my own password to contain special characters.

Try running the following two commands trying different escapings of your password and see if any works:

smbclient -I print.uni.au.dk -L print.uni.au.dk -U uni\\auXXXXXX%password
lpadmin -p test_printer -E -P /usr/share/ppd/cupsfilters/Generic-PDF_Printer-PDF.ppd -v smb://uni\\auXXXXXX:password@10.88.1.141/5343-120-c-1

To see if the second one works, you need to try to print using the printer.

My best guess would be percent encoding for the second command.

Alternatively you may try to create a file called auth.txt with the following contents:

username = auXXXXXX
password = password
domain = uni

and then run

smbclient -I print.uni.au.dk -L print.uni.au.dk -A auth.txt

instead of the first command.

tyilo commented

I have tried to fix it in the latest commit (750d3e3).

Could you check if both searching, installing and using a printer work?

tyilo commented

Are you sure that lpadmin -p Stibitz -E -P /usr/share/ppd/cupsfilters/Generic-PDF_Printer-PDF.ppd -v smb://uni\\au123456:PaSsWoRd\!@10.88.1.141/5365-123-c-1 works when printing?

tyilo commented

Ah, but that is because you need to escape it for bash, which auprint shouldn't do.

Could you test if using %21 instead of ! in your password works for the lpadmin command and that you can print with that?

tyilo commented

Cool, could you try the latest commit to see if everything works?

It works!
I made sure to run a little reset script before testing:

keyring.delete_password('auprint', 'auid')

Nicely done!

tyilo commented

Yay :)