Skip to content

Commit

Permalink
Add additional confirmation if touching security dongle boot.bin
Browse files Browse the repository at this point in the history
  • Loading branch information
israpps authored Feb 11, 2024
1 parent a04117a commit dcf75bf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/filer.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ void pad_psu_header(psu_header *psu)
{
memset((void *)psu, 0xFF, sizeof(psu_header));
}
// functions below are all related to noob-helper checks on COH models
#ifdef SUPPORT_SYSTEM_2X6
int dongleguard(char *filepath) {
if (!strcmp(filepath, "mc0:boot.bin") {
if (ynDialog("you're about to delete/rename/move the security dongle boot file\ndont do this uf you don't know what it is\n\nContinue?") > 0) {
return 0;
} else {return 2;}
} else {return 1; /*not a dongle boot file*/}
}
#endif
//--------------------------------------------------------------
// getHddParty below takes as input the string path and the struct file
// and uses these to calculate the output strings party and dir. If the
Expand Down Expand Up @@ -2172,6 +2182,10 @@ int delete (const char *path, const FILEINFO *file)
}
sprintf(dir, "%s%s", path, file->name);
genLimObjName(dir, 0);
#ifdef SUPPORT_SYSTEM_2X6
if (dongleguard(dir) != 0)
return 0;
#endif
#ifdef ETH
if (!strncmp(dir, "host:/", 6))
makeHostPath(dir + 5, dir + 6);
Expand Down Expand Up @@ -2250,6 +2264,10 @@ int Rename(const char *path, const FILEINFO *file, const char *name)
} else if (!strncmp(path, "mc", 2)) {
sprintf(oldPath, "%s%s", path, file->name);
sprintf(newPath, "%s%s", path, name);
#ifdef SUPPORT_SYSTEM_2X6
if (dongleguard(oldPath) != 0)
return 0;
#endif
if ((test = fileXioDopen(newPath)) >= 0) { //Does folder of same name exist ?
fileXioDclose(test);
ret = -EEXIST;
Expand Down

0 comments on commit dcf75bf

Please sign in to comment.