Opened 6 years ago

Closed 4 years ago

#8642 closed defect (fixed)

Bug in WPA key dialog prevents certain passwords from being accepted

Reported by: Eben Owned by: cscott
Priority: high Milestone: 8.2.0 (was Update.2)
Component: sugar Version: not specified
Keywords: 8.2.0:? blocks-:8.2.0 r+ polish:8.2.0 8.2-764:? Cc: mstone, marco, erikos, holt
Blocked By: Blocking:
Deployments affected: Action Needed: test in release
Verified: no

Description

I've been trying to connect to my access point with 763, but when I press enter (or click the OK button) nothing happens. Looking at the logs, I see two strange things. It reports:

(s, 0) = commands.getstatusoutput(command)
if s != 0:
    raise RuntimeError("Error hashing passphrase: %s" % o)

global RuntimeError = undefined
o = ''

So, first of all I have no idea why RuntimeError is undefined. That aside, the real problem is that the passphrase string passed to /usr/bin/wpa_passphrase isn't properly escaped or quoted (my passphrase includes a single quote), which is causing it to crap out and return nothing.

I tried running the script directly with my passphrase properly quoted and/or escaped and it ran fine.

It seems this is easy to fix, but a big win to fix for G1G1.

Attachments (1)

fix-wpa-passphrase.patch (1.1 KB) - added by cscott 6 years ago.
Patch fixing the problem.

Download all attachments as: .zip

Change History (17)

Changed 6 years ago by cscott

Patch fixing the problem.

comment:1 Changed 6 years ago by cscott

  • Action Needed changed from code to review
  • Cc mstone added; m_stone removed
  • Keywords r? added

The use of commands.getstatusoutput is very sketchy. In the attached patch, I've replaced this with subprocess.Popen, which is the preferred way to invoke other programs these days.

comment:2 Changed 6 years ago by cscott

(Reviewers: the import should be moved to the top of the file, and I'll do that before I commit if the patch is approved, but I was trying to make this easy for Eben to type in my hand to get his machine on the network.)

comment:3 Changed 6 years ago by Eben

I just "patched" my machine by hand, and succeeded in connecting to my network without a problem. Thanks for the lightning fast fix, Scott!

comment:4 Changed 6 years ago by mstone

I would be willing to consider accepting this fix as WPA polish which is certainly important to us pending packaging and acceptance in joyride. It remains to be seen whether we will make any more 8.2.0 builds.

comment:5 Changed 6 years ago by mstone

  • Cc marco erikos added

comment:6 Changed 6 years ago by mstone

  • Keywords blocks-:8.2.0 polish:8.2.0 added; blocks?:8.2.0 removed

Greg and I believe that this is not a blocker (though internet connectivity is really important to us.)

comment:7 Changed 6 years ago by holt

  • Cc holt added

comment:8 Changed 6 years ago by marco

  • Keywords r+ added; r? removed

comment:9 Changed 6 years ago by cscott

For fun, try using

'; /bin/rm -rf '~

as your WPA password!

Obligatory xkcd: http://xkcd.com/327/

comment:10 Changed 6 years ago by cscott

  • Action Needed changed from review to package

Pushed to sucrose-0.82 and master.

comment:11 Changed 6 years ago by marco

  • Action Needed changed from package to test in build
  • Keywords 8.2-764:? added

comment:13 Changed 6 years ago by cscott

  • Action Needed changed from test in build to approve for release

In joyride-2485 and later. Eben, please retest? Michael, consider for next stable build.

comment:14 Changed 6 years ago by mstone

  • Action Needed changed from approve for release to add to release

comment:15 Changed 6 years ago by cscott

  • Action Needed changed from add to release to test in release

Packages added to stable repository in commit 59fd5419 for build 764. Please confirm the package versions are correct and test in stable build 764 or later.

comment:16 Changed 4 years ago by dsd

  • Resolution set to fixed
  • Status changed from new to closed

Looks like this was correctly fixed for 8.2, and for later releases all this stuff changed anyway.

Note: See TracTickets for help on using tickets.