Skip to content
Snippets Groups Projects
Commit a71d6b2c authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Allow "reserving" names

The SyncTERM cache uses the BBS name as the directory name, so any
system-level caching needs to either be in the cache root directory
or in a directory whose name is guaranteed to not collide with an
entry name.

This leaves two options... either prevent a list of suffixes from
being used on BBS names, or have a separate system cache whose name
cannot be used as a BBS name.

I've taken the second route here... SyncTERM will not load a BBS
entry with the (case insensitive) name "syncterm-system-cache" and
will not allow creating one.  This is the directory where "global"
cache files will be stored (ie: scripts, internet dialing
directories, etc.)
parent a409edb2
No related branches found
No related tags found
No related merge requests found
Pipeline #8004 passed
...@@ -839,6 +839,14 @@ read_item(str_list_t listfile, struct bbslist *entry, char *bbsname, int id, int ...@@ -839,6 +839,14 @@ read_item(str_list_t listfile, struct bbslist *entry, char *bbsname, int id, int
strListFree(&section); strListFree(&section);
} }
bool
is_reserved_bbs_name(const char *name)
{
if (stricmp(name, "syncterm-system-cache") == 0)
return true;
return false;
}
/* /*
* Checks if bbsname already is listed in list * Checks if bbsname already is listed in list
* setting *pos to the position if not NULL. * setting *pos to the position if not NULL.
...@@ -894,7 +902,7 @@ read_list(char *listpath, struct bbslist **list, struct bbslist *defaults, int * ...@@ -894,7 +902,7 @@ read_list(char *listpath, struct bbslist **list, struct bbslist *defaults, int *
read_item(inilines, defaults, NULL, -1, type); read_item(inilines, defaults, NULL, -1, type);
bbses = iniGetSectionList(inilines, NULL); bbses = iniGetSectionList(inilines, NULL);
while ((bbsname = strListRemove(&bbses, 0)) != NULL) { while ((bbsname = strListRemove(&bbses, 0)) != NULL) {
if (!list_name_check(list, bbsname, NULL, false)) { if ((!list_name_check(list, bbsname, NULL, false)) && (!is_reserved_bbs_name(bbsname))) {
if ((list[*i] = (struct bbslist *)malloc(sizeof(struct bbslist))) == NULL) { if ((list[*i] = (struct bbslist *)malloc(sizeof(struct bbslist))) == NULL) {
free(bbsname); free(bbsname);
break; break;
...@@ -1102,6 +1110,12 @@ edit_name(char *itemname, struct bbslist **list, str_list_t inifile, bool edit_t ...@@ -1102,6 +1110,12 @@ edit_name(char *itemname, struct bbslist **list, str_list_t inifile, bool edit_t
uifc.msg("Entry Name Already Exists!"); uifc.msg("Entry Name Already Exists!");
check_exit(false); check_exit(false);
} }
else if(is_reserved_bbs_name(tmp)) {
uifc.helpbuf = "`Reserved Name`\n\n"
"The name you entered is reserved for internal use\n";
uifc.msg("Reserved Name!");
check_exit(false);
}
else { else {
if (tmp[0] == 0) { if (tmp[0] == 0) {
uifc.helpbuf = "`Can Not Use an Empty Name`\n\n" uifc.helpbuf = "`Can Not Use an Empty Name`\n\n"
...@@ -3266,6 +3280,13 @@ show_bbslist(char *current, int connected) ...@@ -3266,6 +3280,13 @@ show_bbslist(char *current, int connected)
check_exit(false); check_exit(false);
break; break;
} }
if(is_reserved_bbs_name(tmp)) {
uifc.helpbuf = "`Reserved Name`\n\n"
"The name you entered is reserved for internal use\n";
uifc.msg("Reserved Name!");
check_exit(false);
break;
}
listcount++; listcount++;
list[listcount] = list[listcount - 1]; list[listcount] = list[listcount - 1];
list[listcount list[listcount
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment