| 674 |
|
* style of username |
| 675 |
|
*/ |
| 676 |
|
int |
| 677 |
< |
valid_username(const char *username) |
| 677 |
> |
valid_username(const char *username, int local) |
| 678 |
|
{ |
| 679 |
|
int dots = 0; |
| 680 |
|
const char *p = username; |
| 684 |
|
if (*p == '~') |
| 685 |
|
++p; |
| 686 |
|
|
| 687 |
< |
/* reject usernames that don't start with an alphanum |
| 687 |
> |
/* |
| 688 |
> |
* Reject usernames that don't start with an alphanum |
| 689 |
|
* i.e. reject jokers who have '-@somehost' or '.@somehost' |
| 690 |
|
* or "-hi-@somehost", "h-----@somehost" would still be accepted. |
| 691 |
|
*/ |
| 692 |
|
if (!IsAlNum(*p)) |
| 693 |
|
return 0; |
| 694 |
|
|
| 695 |
< |
while (*++p) |
| 695 |
> |
if (local) |
| 696 |
|
{ |
| 697 |
< |
if ((*p == '.') && ConfigFileEntry.dots_in_ident) |
| 697 |
> |
while (*++p) |
| 698 |
|
{ |
| 699 |
< |
if (++dots > ConfigFileEntry.dots_in_ident) |
| 700 |
< |
return 0; |
| 701 |
< |
if (!IsUserChar(*(p + 1))) |
| 699 |
> |
if ((*p == '.') && ConfigFileEntry.dots_in_ident) |
| 700 |
> |
{ |
| 701 |
> |
if (++dots > ConfigFileEntry.dots_in_ident) |
| 702 |
> |
return 0; |
| 703 |
> |
if (!IsUserChar(*(p + 1))) |
| 704 |
> |
return 0; |
| 705 |
> |
} |
| 706 |
> |
else if (!IsUserChar(*p)) |
| 707 |
|
return 0; |
| 708 |
|
} |
| 709 |
< |
else if (!IsUserChar(*p)) |
| 710 |
< |
return 0; |
| 709 |
> |
} |
| 710 |
> |
else |
| 711 |
> |
{ |
| 712 |
> |
while (*++p) |
| 713 |
> |
if (!IsUserChar(*p)) |
| 714 |
> |
return 0; |
| 715 |
|
} |
| 716 |
|
|
| 717 |
< |
return 1; |
| 717 |
> |
return p - username <= USERLEN;; |
| 718 |
|
} |
| 719 |
|
|
| 720 |
|
/* clean_nick_name() |