/[LeafOK_CVS]/lbbs/src/login.c
ViewVC logotype

Diff of /lbbs/src/login.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.61 by sysadm, Wed Oct 22 05:50:13 2025 UTC Revision 1.64 by sysadm, Tue Nov 4 11:20:16 2025 UTC
# Line 32  Line 32 
32  #include <mysql/mysql.h>  #include <mysql/mysql.h>
33  #include <sys/param.h>  #include <sys/param.h>
34    
35    static const int BBS_username_min_len = 3; // common len = 5, special len = 3
36    static const int BBS_password_min_len = 5; // legacy len = 5, current len = 6
37    
38  int bbs_login(void)  int bbs_login(void)
39  {  {
40          char username[BBS_username_max_len + 1];          char username[BBS_username_max_len + 1];
# Line 114  int check_user(const char *username, con Line 117  int check_user(const char *username, con
117          // Verify format          // Verify format
118          for (i = 0; ok && username[i] != '\0'; i++)          for (i = 0; ok && username[i] != '\0'; i++)
119          {          {
120                  if (!(isalpha(username[i]) || (i > 0 && isdigit(username[i]))))                  if (!(isalpha(username[i]) || (i > 0 && (isdigit(username[i]) || username[i] == '_'))))
121                  {                  {
122                          ok = 0;                          ok = 0;
123                  }                  }
124          }          }
125          if (ok && (i < 3 || i > 12))          if (ok && (i < BBS_username_min_len || i > BBS_username_max_len))
126          {          {
127                  ok = 0;                  ok = 0;
128          }          }
# Line 130  int check_user(const char *username, con Line 133  int check_user(const char *username, con
133                          ok = 0;                          ok = 0;
134                  }                  }
135          }          }
136          if (ok && (i < 5 || i > 12))          if (ok && (i < BBS_password_min_len || i > BBS_password_max_len))
137          {          {
138                  ok = 0;                  ok = 0;
139          }          }
# Line 579  int user_online_update(const char *actio Line 582  int user_online_update(const char *actio
582          }          }
583    
584          snprintf(sql, sizeof(sql),          snprintf(sql, sizeof(sql),
585                           "UPDATE user_online SET current_action = '%s', last_tm=NOW() "                           "UPDATE user_online SET current_action = '%s', last_tm = NOW() "
586                           "WHERE SID = 'Telnet_Process_%d'",                           "WHERE SID = 'Telnet_Process_%d'",
587                           BBS_current_action, getpid());                           BBS_current_action, getpid());
588          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1