commit - f07f0e329fe30d5e4cad62a9a4fee2ec44be0d29
commit + 847a764e741f52506e09e4dd0b0b3e449f32ab29
blob - 6aaa66f66c88293911d6d0f23d1311ce4e8a8415
blob + 5533dbf98170513c86a77d1e89814ba60e265c07
--- FICS/gamedb.c
+++ FICS/gamedb.c
return 0;
}
-/* Helper function to validate login names for file path usage */
-static int
-is_valid_login_name(const char *login)
-{
- if (login == NULL || login[0] == '\0' ||
- strstr(login, "..") || strchr(login, '/') || strchr(login, '\\')) {
- return 0;
- }
- for (const char *p = login; *p; ++p) {
- if (!((*p >= 'a' && *p <= 'z') ||
- (*p >= 'A' && *p <= 'Z') ||
- (*p >= '0' && *p <= '9') ||
- *p == '_')) {
- return 0;
- }
- }
- return 1;
-}
-
PRIVATE long int
OldestHistGame(char *login)
{
blob - ae5e1fa0070fc33678a3355475af45c448e8b50c
blob + 4e47b8f0abc0fb4d2a080a627254e2dcda50585c
--- FICS/utils.c
+++ FICS/utils.c
return true;
}
+/*
+ * Function to validate login names for file path usage
+ */
+PUBLIC bool
+is_valid_login_name(const char *login)
+{
+ if (login == NULL || login[0] == '\0' ||
+ strstr(login, "..") || strchr(login, '/') || strchr(login, '\\'))
+ return false;
+
+ for (const char *p = login; *p; ++p) {
+ if (!((*p >= 'a' && *p <= 'z') ||
+ (*p >= 'A' && *p <= 'Z') ||
+ (*p >= '0' && *p <= '9') ||
+ *p == '_'))
+ return false;
+ }
+
+ return true;
+}
+
PUBLIC int
count_lines(FILE *fp)
{
blob - b35527b7c9dffa92d2a49dedf413675c39278d78
blob + e376a03eba58a2acd9c18a8efda50db9d6d3e8cf
--- FICS/utils.h
+++ FICS/utils.h
__FICS_BEGIN_DECLS
extern bool is_valid_filename(const char *, const bool);
+extern bool is_valid_login_name(const char *);
extern char *dotQuad(unsigned int);
extern char *eattailwhite(char *);
extern char *eatwhite(char *);