Skip to content
Snippets Groups Projects
Commit b3962465 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

User aliases can be used as parameters to the "USER" ARS keyword

Caveat: the name parameter cannot contain a space, so excludes spaces or
replace them with '.' or '_': the user's alias will match.
parent fa7e271a
No related branches found
No related tags found
No related merge requests found
Pipeline #7732 passed
......@@ -30,6 +30,7 @@ static BOOL ar_string_arg(int artype)
case AR_PROT:
case AR_HOST:
case AR_IP:
case AR_USERNAME:
return TRUE; /* These ARS Keywords expect a string argument */
}
return FALSE;
......@@ -550,6 +551,8 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
artype=AR_SUBCODE;
if(artype==AR_DIR && !IS_DIGIT(str[i]))
artype=AR_DIRCODE;
if(artype==AR_USER && !IS_DIGIT(str[i]))
artype=AR_USERNAME;
if(artype==AR_INVALID)
artype=AR_LEVEL;
......@@ -630,6 +633,7 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf)
case AR_HOST:
case AR_IP:
case AR_TERM:
case AR_USERNAME:
/* String argument */
for(n=0;n<maxlen
&& str[i]
......@@ -785,6 +789,7 @@ char *decompile_ars(uchar *ars, int len)
break;
case AR_USER:
case AR_USERNAME:
*(out++)='$';
*(out++)='U';
......@@ -1144,6 +1149,7 @@ char *decompile_ars(uchar *ars, int len)
case AR_HOST:
case AR_IP:
case AR_TERM:
case AR_USERNAME:
if(not)
*(out++)='!';
if(equals)
......
......@@ -115,6 +115,7 @@ enum { /* Access requirement binaries */
,AR_ASCII
,AR_UTF8
,AR_CP437
,AR_USERNAME
};
#endif /* Don't add anything after this line */
......@@ -324,6 +324,16 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client)
noaccess_val=i;
}
break;
case AR_USERNAME:
if(!matchusername(&cfg, user->alias, (char*)*ptrptr))
result=_not;
else
result=!_not;
while(*(*ptrptr))
(*ptrptr)++;
if(!result)
noaccess_str=text[NoAccessUser];
break;
case AR_GROUP:
if((equal
&& (cursubnum>=cfg.total_subs
......
......@@ -936,6 +936,7 @@ char *decompile_ars(uchar *ars, int len)
break;
case AR_USER:
case AR_USERNAME:
*(out++)='$';
*(out++)='U';
......@@ -1292,6 +1293,7 @@ char *decompile_ars(uchar *ars, int len)
case AR_PROT:
case AR_HOST:
case AR_IP:
case AR_USERNAME:
if(not)
*(out++)='!';
if(equals)
......
......@@ -2190,6 +2190,14 @@ static bool ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client)
result=!not;
(*ptrptr)++;
break;
case AR_USERNAME:
if(user != NULL && matchusername(cfg, user->alias, (char *)*ptrptr))
result=!not;
else
result=not;
while(*(*ptrptr))
(*ptrptr)++;
break;
case AR_GROUP:
if(user==NULL)
result=not;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment