| 40 |
|
#include "numeric.h" |
| 41 |
|
#include "packet.h" |
| 42 |
|
#include "conf.h" |
| 43 |
< |
#include "s_serv.h" |
| 43 |
> |
#include "server.h" |
| 44 |
|
#include "log.h" |
| 45 |
< |
#include "s_user.h" |
| 45 |
> |
#include "user.h" |
| 46 |
|
#include "send.h" |
| 47 |
|
#include "memory.h" |
| 48 |
|
#include "channel.h" |
| 159 |
|
struct Client *target_p = NULL; |
| 160 |
|
struct Client *target_tmp = NULL; |
| 161 |
|
dlink_node *ptr; |
| 162 |
– |
int wilds; |
| 162 |
|
|
| 163 |
|
/* Assume it's me, if no server */ |
| 164 |
|
if (parc <= server || EmptyString(parv[server])) |
| 184 |
|
if (target_p->from == source_p->from && !MyConnect(target_p)) |
| 185 |
|
target_p = NULL; |
| 186 |
|
|
| 188 |
– |
wilds = has_wildcards(parv[server]); |
| 189 |
– |
|
| 187 |
|
/* Again, if there are no wild cards involved in the server |
| 188 |
|
* name, use the hash lookup |
| 189 |
|
*/ |
| 190 |
|
if (target_p == NULL) |
| 191 |
|
{ |
| 192 |
< |
if (!wilds) |
| 192 |
> |
if (!has_wildcards(parv[server])) |
| 193 |
|
{ |
| 194 |
|
if (!(target_p = hash_find_server(parv[server]))) |
| 195 |
|
{ |
| 340 |
|
int |
| 341 |
|
valid_servname(const char *name) |
| 342 |
|
{ |
| 343 |
< |
unsigned int length = 0; |
| 347 |
< |
unsigned int dots = 0; |
| 343 |
> |
unsigned int dots = 0; |
| 344 |
|
const char *p = name; |
| 345 |
|
|
| 346 |
|
for (; *p; ++p) |
| 348 |
|
if (!IsServChar(*p)) |
| 349 |
|
return 0; |
| 350 |
|
|
| 355 |
– |
++length; |
| 356 |
– |
|
| 351 |
|
if (*p == '.') |
| 352 |
|
++dots; |
| 353 |
|
} |
| 354 |
|
|
| 355 |
< |
return dots && length <= HOSTLEN; |
| 355 |
> |
return dots && (p - name) <= HOSTLEN; |
| 356 |
|
} |
| 357 |
|
|
| 358 |
|
int |
| 439 |
|
void |
| 440 |
|
add_capability(const char *capab_name, int cap_flag, int add_to_default) |
| 441 |
|
{ |
| 442 |
< |
struct Capability *cap = MyMalloc(sizeof(*cap)); |
| 442 |
> |
struct Capability *cap = MyCalloc(sizeof(*cap)); |
| 443 |
|
|
| 444 |
|
cap->name = xstrdup(capab_name); |
| 445 |
|
cap->cap = cap_flag; |
| 573 |
|
make_server(struct Client *client_p) |
| 574 |
|
{ |
| 575 |
|
if (client_p->serv == NULL) |
| 576 |
< |
client_p->serv = MyMalloc(sizeof(struct Server)); |
| 576 |
> |
client_p->serv = MyCalloc(sizeof(struct Server)); |
| 577 |
|
|
| 578 |
|
return client_p->serv; |
| 579 |
|
} |
| 868 |
|
if ((cert = SSL_get_peer_certificate(client_p->localClient->fd.ssl))) |
| 869 |
|
{ |
| 870 |
|
int res = SSL_get_verify_result(client_p->localClient->fd.ssl); |
| 871 |
< |
char buf[EVP_MAX_MD_SIZE * 2 + 1] = { '\0' }; |
| 872 |
< |
unsigned char md[EVP_MAX_MD_SIZE] = { '\0' }; |
| 871 |
> |
char buf[EVP_MAX_MD_SIZE * 2 + 1] = ""; |
| 872 |
> |
unsigned char md[EVP_MAX_MD_SIZE] = ""; |
| 873 |
|
|
| 874 |
|
if (res == X509_V_OK || res == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN || |
| 875 |
|
res == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE || |
| 876 |
|
res == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) |
| 877 |
|
{ |
| 878 |
< |
unsigned int i = 0, n = 0; |
| 878 |
> |
unsigned int n = 0; |
| 879 |
|
|
| 880 |
|
if (X509_digest(cert, EVP_sha256(), md, &n)) |
| 881 |
|
{ |
| 882 |
< |
for (; i < n; ++i) |
| 882 |
> |
for (unsigned int i = 0; i < n; ++i) |
| 883 |
|
snprintf(buf + 2 * i, 3, "%02X", md[i]); |
| 884 |
|
client_p->certfp = xstrdup(buf); |
| 885 |
|
} |