Bug#271978: netinst, wep key with spaces w/ patch
Package: debian-installer
(adding to BTS so it doesn't get dropped.)
I recently installed on a friend's network, which had a WEP key with a
space in it. The installer worked, but it wrote a
/etc/network/interfaces file that didn't work. After boot, the key was
set to the substring up to and not including the space in the WEP key.
I _think_ that a backslash before the space solved the problem, but I'm
not certain.
I don't know if there's a more general problem to be solved or whether
the patch below even compiles. It's a proof of concept patch, more than
anything else.
Nice work, BTW. The installer is beautiful.
- chad
Pardon the unsigned e-mail -- I was installing because of a disc crash,
and I haven't fully restored yet.
Index: packages/netcfg/dhcp.c
===================================================================
--- packages/netcfg/dhcp.c (revision 21745)
+++ packages/netcfg/dhcp.c (working copy)
@@ -52,7 +52,17 @@
(mode == MANAGED) ? "managed" : "adhoc");
fprintf(fp, "\twireless-essid %s\n", essid ? essid : "any");
if (wepkey != NULL)
- fprintf(fp, "\twireless-key %s\n", wepkey);
+ {
+ int i;
+ fprintf(fp, "\twireless-key ");
+ for (i = 0; wepkey[i] != '\0'; i++)
+ {
+ if (wepkey[i] == ' ' || wepkey[i] == '\\')
+ { /* escape spaces and backslashes for the shell */
+ fprintf(fp, "\\");
+ }
+ fprintf(fp, "%c", wepkey[i]);
+ }
}
fclose(fp);
}
Index: packages/netcfg/static.c
===================================================================
--- packages/netcfg/static.c (revision 21745)
+++ packages/netcfg/static.c (working copy)
@@ -267,7 +267,18 @@
fprintf(fp, "\twireless-essid %s\n", essid ? essid : "any");
if (wepkey != NULL)
- fprintf(fp, "\twireless-key %s\n", wepkey);
+ {
+ int i;
+ fprintf(fp, "\twireless-key ");
+ for (i = 0; wepkey[i] != '\0'; i++)
+ {
+ if (wepkey[i] == ' ' || wepkey[i] == '\\')
+ { /* escape spaces and backslashes for the shell */
+ fprintf(fp, "\\");
+ }
+ fprintf(fp, "%c", wepkey[i]);
+ }
+ }
}
/*
* Write resolvconf options
Reply to: