|
这个是admin插件中的一部分- getAccess(id, name[], authid[], ip[], password[]){
- new index = -1
- new result = 0
- for(new i = 0; i < g_aNum; ++i) {
- if (g_aFlags[i] & FLAG_AUTHID) {
- if (equal(authid, g_aName[i])) {
- index = i
- break
- }
- }
- else if (g_aFlags[i] & FLAG_IP) {
- new c = strlen( g_aName[i] )
- if ( g_aName[i][ c - 1 ] == '.' ) { /* check if this is not a xxx.xxx. format */
- if ( equal( g_aName[i] , ip , c ) ) {
- index = i
- break
- }
- } /* in other case an IP must just match */
- else if ( equal(ip, g_aName[i]) ){
- index = i
- break
- }
- }
- else {
- if (g_aFlags[i] & FLAG_TAG) {
- if (contain(name, g_aName[i])!=-1){
- index = i
- break
- }
- }
- else if (equal(name, g_aName[i])) {
- index = i
- break
- }
- }
- }
- if (index != -1) {
- if (g_aFlags[index] & FLAG_NOPASS){
- result |= 8
- new sflags[32]
- get_flags(g_aAccess[index], sflags, 31)
- set_user_flags(id, g_aAccess[index])
- log_to_file(g_logFile, "Login: ^"%s<%d><%s><>^" become an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")",
- name, get_user_userid(id), authid, g_aName[index] , sflags, ip)
- }
- else if (equal(password, g_aPassword[index])) {
- result |= 12
- set_user_flags(id, g_aAccess[index])
- new sflags[32]
- get_flags(g_aAccess[index], sflags, 31)
- log_to_file(g_logFile, "Login: ^"%s<%d><%s><>^" become an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")",
- name, get_user_userid(id), authid, g_aName[index] , sflags, ip)
- }
- else {
- result |= 1
- if (g_aFlags[index] & FLAG_KICK){
- result |= 2
- log_to_file(g_logFile, "Login: ^"%s<%d><%s><>^" kicked due to invalid password (account ^"%s^") (address ^"%s^")",
- name, get_user_userid(id), authid, g_aName[index], ip)
- }
- }
- }
- else if (get_cvar_float("amx_mode")==2.0) {
- result |= 2
- }
- else {
- new defaccess[32]
- get_cvar_string("amx_default_access", defaccess, 31)
- new idefaccess = read_flags(defaccess)
- if (idefaccess){
- result |= 8
- set_user_flags(id, idefaccess)
- }
- }
-
- return result
- }
复制代码- else if (equal(name, g_aName[i])) {
复制代码 对比用户名的,但是大小写不一致还能进入
例如:
zhangsan在user文件中有权限
但是
ZHANGsan这样大小写不同的id仍然能进入,只是没有权限,但是zhangsan再进入就变成(1)zhangsan ,同样没有权限了!
这个怎么解决呢?
equal这个怎么能不区别大小写呢? |
|