FreeBSD Bugzilla – Attachment 10623 Details for
Bug 21245
[PATCH] wicontrol(8)'s WEP key support is buggy/non-standard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.93 KB, created by
brooks
on 2000-09-13 05:40:02 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
brooks
Created:
2000-09-13 05:40:02 UTC
Size:
2.93 KB
patch
obsolete
>Index: wicontrol.8 >=================================================================== >RCS file: /home/ncvs/src/usr.sbin/wicontrol/wicontrol.8,v >retrieving revision 1.15 >diff -u -r1.15 wicontrol.8 >--- wicontrol.8 2000/07/26 12:50:35 1.15 >+++ wicontrol.8 2000/09/13 04:06:15 >@@ -238,14 +238,10 @@ > digits (i.e. "0x1234512345"). For > WaveLAN Turbo Silver cards, the key is restricted to 40 bits, hence > the key can be either a 5 character text string or 10 hex digits. >-For WaveLAN Turbo Gold cards, the key can be up to 128 bits, >-which means the key can be specified as either a 16 character text >-string or 32 hex digits. >-.Pp >-Note: currently, the field in the structure used to program the key >-into the NIC is only 14 bytes long, not 16. >-I'm not sure how this is >-supposed to allow 128 bits of key info for the gold cards. >+For WaveLAN Turbo Gold cards, the key can also be 104 bits, >+which means the key can be specified as either a 13 character text >+string or 26 hex digits in addition to the formats supported by the >+Silver cards. > .It Fl i Ar iface Fl T Ar 1|2|3|4 > Specify which of the four WEP encryption keys will be used to > encrypt transmitted packets. >Index: wicontrol.c >=================================================================== >RCS file: /home/ncvs/src/usr.sbin/wicontrol/wicontrol.c,v >retrieving revision 1.10 >diff -u -r1.10 wicontrol.c >--- wicontrol.c 2000/06/18 23:45:17 1.10 >+++ wicontrol.c 2000/09/13 04:01:01 >@@ -49,6 +49,7 @@ > #include <string.h> > #include <stdlib.h> > #include <unistd.h> >+#include <ctype.h> > #include <errno.h> > #include <err.h> > >@@ -282,6 +283,7 @@ > char *key; > int idx; > { >+ int keylen; > struct wi_req wreq; > struct wi_ltv_keys *keys; > struct wi_key *k; >@@ -301,9 +303,17 @@ > wi_getval(iface, &wreq); > keys = (struct wi_ltv_keys *)&wreq; > >- if (strlen(key) > 14) { >- err(1, "encryption key must be no " >- "more than 14 characters long"); >+ keylen = strlen(key); >+ if (key[0] == '0' && (key[1] == 'x' || key[1] == 'X')) { >+ if(keylen != 2 && keylen != 12 && keylen != 28) { >+ err(1, "encryption key must be 0, 10, or 26 " >+ "hex digits long"); >+ } >+ } else { >+ if (keylen != 0 && keylen != 5 && keylen != 13) { >+ err(1, "encryption key must be 0, 5, or 13 " >+ "bytes long"); >+ } > } > > if (idx > 3) >@@ -323,6 +333,7 @@ > struct wi_req *wreq; > { > int i, j; >+ int isprintable; > struct wi_key *k; > struct wi_ltv_keys *keys; > char *ptr; >@@ -332,12 +343,24 @@ > for (i = 0; i < 4; i++) { > k = &keys->wi_keys[i]; > ptr = (char *)k->wi_keydat; >+ isprintable = 1; > for (j = 0; j < k->wi_keylen; j++) { >- if (ptr[i] == '\0') >- ptr[i] = ' '; >+ if (!isprint(ptr[j])) { >+ isprintable = 0; >+ break; >+ } >+ } >+ if(isprintable) { >+ ptr[j] = '\0'; >+ printf("[ %s ]", ptr); >+ } else { >+ printf("[ 0x"); >+ for (j = 0; j < k->wi_keylen; j++) { >+ printf("%02x", ptr[j] & 0xFF); >+ } >+ printf(" ]"); >+ > } >- ptr[j] = '\0'; >- printf("[ %s ]", ptr); > } > > return;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 21245
: 10623