Tiny Core Extensions > TCE Q&A Forum

wifi.tcz

<< < (2/18) > >>

roberts:
I will look at it for v0.3. At the moment I am busy readying Core v3.8rc1.

andrewb:
OK, one step forward: I have solved the problem for passwords with special characters. The function device_setup should be changed to :


--- Code: ---function device_setup(t,d,s,p,c) {
  if (t == "WPA") {
    print p > "/tmp/wpa_ptmp"
    system("wpa_passphrase " s " <  /tmp/wpa_ptmp  > /etc/wpa_supplicant.conf")
    system("rm /tmp/wpa_ptmp")
    system("wpa_supplicant -i " d " -c /etc/wpa_supplicant.conf -B")
  } else {
    system("iwconfig " d " essid " s " key " p" channel " c)
  }
}
--- End code ---

The stdin redirection is the only way to pass special characters to wpa_passphrase with out them being parsed by the shell. Putting the variable 'p' instead allows the shell to parse the password. I have tested this with many combinations of special characters, including those of significance to awk, and it seems to work every time. Even spaces, including those at the start & end of a password are acceptable.

The only problem now is that if the character used as a field separator in wifi.db is used in the password  or ESSID it will cause problems. This can be dealt with by using a non-printing character (e.g. <BEL>) as the field separator in wifi.db. To enable this the following changes need to be made:

Change the line:

--- Code: ---   FS=":"
--- End code ---
to

--- Code: ---   FS="\7"
--- End code ---
and:

--- Code: ---print( sid[selection] ":" password ":" type[selection] ) >> dbfile
--- End code ---
to:

--- Code: ---print( sid[selection] "\7" password "\7" type[selection] ) >> dbfile
--- End code ---

Now to move on to the problems of non-broadcast SSIDs........

andrewb:
I've now found that the above of course is for the original wifi.sh script, not the current one.

Back to the drawing board....

roberts:
See: http://forum.tinycorelinux.net/index.php?topic=5287.0
You seem to want to commandeer my extension.
I should be afforded the same respect as any other extension maker.

andrewb:
Robert,

Sorry, no offence meant. Just got carried away.

Will put brain in gear before typing next time.



Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version