| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
login.c - description |
/* |
| 3 |
------------------- |
* login |
| 4 |
Copyright : (C) 2004-2025 by Leaflet |
* - user authentication and online status manager |
| 5 |
Email : leaflet@leafok.com |
* |
| 6 |
***************************************************************************/ |
* Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
|
/*************************************************************************** |
|
|
* * |
|
|
* This program is free software; you can redistribute it and/or modify * |
|
|
* it under the terms of the GNU General Public License as published by * |
|
|
* the Free Software Foundation; either version 3 of the License, or * |
|
|
* (at your option) any later version. * |
|
|
* * |
|
|
***************************************************************************/ |
|
| 8 |
|
|
| 9 |
#include "bbs.h" |
#include "bbs.h" |
| 10 |
#include "common.h" |
#include "common.h" |
| 24 |
#include <mysql/mysql.h> |
#include <mysql/mysql.h> |
| 25 |
#include <sys/param.h> |
#include <sys/param.h> |
| 26 |
|
|
| 27 |
|
static const int BBS_username_min_len = 3; // common len = 5, special len = 3 |
| 28 |
|
static const int BBS_password_min_len = 5; // legacy len = 5, current len = 6 |
| 29 |
|
|
| 30 |
int bbs_login(void) |
int bbs_login(void) |
| 31 |
{ |
{ |
| 32 |
char username[BBS_username_max_len + 1]; |
char username[BBS_username_max_len + 1]; |
| 114 |
ok = 0; |
ok = 0; |
| 115 |
} |
} |
| 116 |
} |
} |
| 117 |
if (ok && (i < 5 || i > BBS_username_max_len)) |
if (ok && (i < BBS_username_min_len || i > BBS_username_max_len)) |
| 118 |
{ |
{ |
| 119 |
ok = 0; |
ok = 0; |
| 120 |
} |
} |
| 125 |
ok = 0; |
ok = 0; |
| 126 |
} |
} |
| 127 |
} |
} |
| 128 |
if (ok && (i < 5 || i > BBS_password_max_len)) |
if (ok && (i < BBS_password_min_len || i > BBS_password_max_len)) |
| 129 |
{ |
{ |
| 130 |
ok = 0; |
ok = 0; |
| 131 |
} |
} |