-/* valid_wild_card()
- *
- * input - user buffer, host buffer
- * output - 0 if invalid, 1 if valid
- * side effects -
- */
-static int
-valid_wild_card(struct Client *source_p, const char *luser, const char *lhost)
-{
- const char *p;
- char tmpch;
- int nonwild = 0;
- int bitlen;
-
- /* user has no wildcards, always accept -- jilles */
- if(!strchr(luser, '?') && !strchr(luser, '*'))
- return 1;
-
- /* check there are enough non wildcard chars */
- p = luser;
- while((tmpch = *p++))
- {
- if(!IsKWildChar(tmpch))
- {
- /* found enough chars, return */
- if(++nonwild >= ConfigFileEntry.min_nonwildcard)
- return 1;
- }
- }
-
- /* try host, as user didnt contain enough */
- /* special case for cidr masks -- jilles */
- if((p = strrchr(lhost, '/')) != NULL && IsDigit(p[1]))
- {
- bitlen = atoi(p + 1);
- /* much like non-cidr for ipv6, rather arbitrary for ipv4 */
- if(bitlen > 0
- && bitlen >=
- (strchr(lhost, ':') ? 4 * (ConfigFileEntry.min_nonwildcard - nonwild) : 6 -
- 2 * nonwild))
- return 1;
- }
- else
- {
- p = lhost;
- while((tmpch = *p++))
- {
- if(!IsKWildChar(tmpch))
- if(++nonwild >= ConfigFileEntry.min_nonwildcard)
- return 1;
- }
- }
-
- sendto_one_notice(source_p,
- ":Please include at least %d non-wildcard "
- "characters with the user@host", ConfigFileEntry.min_nonwildcard);
- return 0;
-}
-
-/*
- * valid_comment
- * inputs - pointer to client
- * - pointer to comment
- * output - 0 if no valid comment, 1 if valid
- * side effects - NONE
- */
-static int
-valid_comment(struct Client *source_p, char *comment)
-{
- if(strchr(comment, '"'))
- {
- sendto_one_notice(source_p, ":Invalid character '\"' in comment");
- return 0;
- }
-
- if(strlen(comment) > BANREASONLEN)
- comment[BANREASONLEN] = '\0';
-
- return 1;
-}
-