efivar: Attempt to fix setting/printing/deleting EFI vars with '-' in their name
Due to how we're parsing UUIDs, we were disallowing setting, printing or deleting any UEFI variable with a '-' in it when you attempted to do that operation with the exact name (wildcard reporting was unaffected). Fix the parser to loop over all the dashes in the name and only give up when all possible matches are exhausted. Reviewed by: markj@ Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D29620
This commit is contained in:
parent
3c0dcbfc85
commit
0292a5c95f
@ -118,15 +118,24 @@ rep_errx(int eval, const char *fmt, ...)
|
||||
static void
|
||||
breakdown_name(char *name, efi_guid_t *guid, char **vname)
|
||||
{
|
||||
char *cp;
|
||||
char *cp, *ocp;
|
||||
|
||||
cp = strrchr(name, '-');
|
||||
if (cp == NULL)
|
||||
rep_errx(1, "Invalid name: %s", name);
|
||||
*vname = cp + 1;
|
||||
*cp = '\0';
|
||||
if (efi_name_to_guid(name, guid) < 0)
|
||||
rep_errx(1, "Invalid guid %s", name);
|
||||
ocp = NULL;
|
||||
while (true) {
|
||||
cp = strrchr(name, '-');
|
||||
if (cp == NULL) {
|
||||
if (ocp != NULL)
|
||||
*ocp = '-';
|
||||
rep_errx(1, "Invalid guid in: %s", name);
|
||||
}
|
||||
if (ocp != NULL)
|
||||
*ocp = '-';
|
||||
*vname = cp + 1;
|
||||
*cp = '\0';
|
||||
ocp = cp;
|
||||
if (efi_name_to_guid(name, guid) >= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t *
|
||||
|
Loading…
x
Reference in New Issue
Block a user