aux/wpa: make sure essid is configured, dont make factotum ask for essid

This commit is contained in:
cinap_lenrek 2013-06-02 00:24:42 +02:00
parent bf2dd0c6bd
commit d3773c4355

View file

@ -398,19 +398,19 @@ main(int argc, char *argv[])
if((fd = dial(addr, nil, devdir, &cfd)) < 0) if((fd = dial(addr, nil, devdir, &cfd)) < 0)
sysfatal("dial: %r"); sysfatal("dial: %r");
if(essid[0] != 0) if(essid[0] != 0){
if(fprint(cfd, "essid %s", essid) < 0) if(fprint(cfd, "essid %s", essid) < 0)
sysfatal("write essid: %r"); sysfatal("write essid: %r");
} else {
getessid();
if(essid[0] == 0)
sysfatal("no essid set");
}
if(prompt){ if(prompt){
char *s; char *s;
if(essid[0] == 0) s = smprint("proto=wpapsk essid=%q !password?", essid);
getessid();
if(essid[0] != 0)
s = smprint("proto=wpapsk essid=%q !password?", essid);
else
s = smprint("proto=wpapsk essid? !password?");
auth_getkey(s); auth_getkey(s);
free(s); free(s);
} }