diff --git a/include/capability.h b/include/capability.h index c3caec8d..8857f0a1 100644 --- a/include/capability.h +++ b/include/capability.h @@ -26,6 +26,7 @@ struct CapabilityEntry; extern unsigned int capability_get(struct CapabilityIndex *idx, const char *cap); extern unsigned int capability_put(struct CapabilityIndex *idx, const char *cap); +extern unsigned int capability_put_anonymous(struct CapabilityIndex *idx); extern void capability_orphan(struct CapabilityIndex *idx, const char *cap); extern void capability_require(struct CapabilityIndex *idx, const char *cap); diff --git a/src/capability.c b/src/capability.c index c999d646..edbf1d73 100644 --- a/src/capability.c +++ b/src/capability.c @@ -83,6 +83,21 @@ capability_put(struct CapabilityIndex *idx, const char *cap) return (1 << entry->value); } +unsigned int +capability_put_anonymous(struct CapabilityIndex *idx) +{ + unsigned int value; + + s_assert(idx != NULL); + if (!idx->highest_bit) + return 0xFFFFFFFF; + value = 1 << idx->highest_bit; + idx->highest_bit++; + if (idx->highest_bit % (sizeof(unsigned int) * 8) == 0) + idx->highest_bit = 0; + return value; +} + void capability_orphan(struct CapabilityIndex *idx, const char *cap) { diff --git a/src/s_serv.c b/src/s_serv.c index 2470964d..78eed13b 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -102,6 +102,10 @@ init_builtin_capabs(void) { serv_capindex = capability_index_create("server capabilities"); + /* These two are not set via CAPAB/GCAP keywords. */ + CAP_CAP = capability_put_anonymous(serv_capindex); + CAP_TS6 = capability_put_anonymous(serv_capindex); + CAP_QS = capability_put(serv_capindex, "QS"); CAP_EX = capability_put(serv_capindex, "EX"); CAP_CHW = capability_put(serv_capindex, "CHW");