support RSFNC indicating type of FNC (e.g. FORCE vs REGAIN) (#406)

This commit is contained in:
Jess Porter 2023-07-01 19:22:40 +01:00 committed by GitHub
parent 5ca20c098a
commit c33da0d24e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -81,6 +81,7 @@ unsigned int CAP_ENCAP;
unsigned int CAP_TS6; unsigned int CAP_TS6;
unsigned int CAP_SERVICE; unsigned int CAP_SERVICE;
unsigned int CAP_RSFNC; unsigned int CAP_RSFNC;
unsigned int CAP_RSFNCF;
unsigned int CAP_SAVE; unsigned int CAP_SAVE;
unsigned int CAP_EUID; unsigned int CAP_EUID;
unsigned int CAP_EOPMOD; unsigned int CAP_EOPMOD;
@ -122,6 +123,7 @@ init_builtin_capabs(void)
CAP_ENCAP = capability_put(serv_capindex, "ENCAP", NULL); CAP_ENCAP = capability_put(serv_capindex, "ENCAP", NULL);
CAP_SERVICE = capability_put(serv_capindex, "SERVICES", NULL); CAP_SERVICE = capability_put(serv_capindex, "SERVICES", NULL);
CAP_RSFNC = capability_put(serv_capindex, "RSFNC", NULL); CAP_RSFNC = capability_put(serv_capindex, "RSFNC", NULL);
CAP_RSFNCF = capability_put(serv_capindex, "RSFNCF", NULL);
CAP_SAVE = capability_put(serv_capindex, "SAVE", NULL); CAP_SAVE = capability_put(serv_capindex, "SAVE", NULL);
CAP_EUID = capability_put(serv_capindex, "EUID", NULL); CAP_EUID = capability_put(serv_capindex, "EUID", NULL);
CAP_EOPMOD = capability_put(serv_capindex, "EOPMOD", NULL); CAP_EOPMOD = capability_put(serv_capindex, "EOPMOD", NULL);

View file

@ -163,6 +163,13 @@ me_login(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
rb_strlcpy(source_p->user->suser, parv[1], sizeof(source_p->user->suser)); rb_strlcpy(source_p->user->suser, parv[1], sizeof(source_p->user->suser));
} }
/* me_rsfnc()
* parv[1] = current user nickname
* parv[2] = target nickname
* parv[3] = new nickts
* parv[4] = current nickts
* parv[5] = optional; 0 (don't override RESVs) or 1 (override RESVs)
*/
static void static void
me_rsfnc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, me_rsfnc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]) int parc, const char *parv[])
@ -198,6 +205,12 @@ me_rsfnc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(target_p->tsinfo != curts) if(target_p->tsinfo != curts)
return; return;
/* received a non-forced RSFNC for a nickname that is RESV.
* silently ignore it. ~jess
*/
if(parc > 5 && atoi(parv[5]) == 0 && find_nick_resv(parv[2]))
return;
if((exist_p = find_named_client(parv[2]))) if((exist_p = find_named_client(parv[2])))
{ {
char buf[BUFSIZE]; char buf[BUFSIZE];