- if ((mask.length() > 2) && (mask[0] == 'O') && (mask[1] == ':'))
- {
- if (user->IsOper() && InspIRCd::Match(user->oper->name, mask.substr(2)))
- return MOD_RES_DENY;
- }
+ // Check whether the entry is an extban.
+ if (mask.length() <= 2 || mask[0] != 'O' || mask[1] != ':')
+ return MOD_RES_PASSTHRU;
+
+ // If the user is not an oper they can't match this.
+ if (!user->IsOper())
+ return MOD_RES_PASSTHRU;
+
+ // Replace spaces with underscores as they're prohibited in mode parameters.
+ std::string opername(user->oper->name);
+ stdalgo::string::replace_all(opername, space, underscore);
+ if (InspIRCd::Match(opername, mask.substr(2)))
+ return MOD_RES_DENY;
+