227 |
|
struct EncCapability * |
228 |
|
check_cipher(struct Client *client_p, struct AccessItem *aconf) |
229 |
|
{ |
230 |
< |
struct EncCapability *epref; |
230 |
> |
struct EncCapability *epref = NULL; |
231 |
|
|
232 |
|
/* Use connect{} specific info if available */ |
233 |
|
if (aconf->cipher_preference) |
234 |
|
epref = aconf->cipher_preference; |
235 |
< |
else |
235 |
> |
else if (ConfigFileEntry.default_cipher_preference) |
236 |
|
epref = ConfigFileEntry.default_cipher_preference; |
237 |
|
|
238 |
< |
/* If the server supports the capability in hand, return the matching |
238 |
> |
/* |
239 |
> |
* If the server supports the capability in hand, return the matching |
240 |
|
* conf struct. Otherwise, return NULL (an error). |
241 |
|
*/ |
242 |
< |
if (IsCapableEnc(client_p, epref->cap)) |
243 |
< |
return(epref); |
242 |
> |
if (epref && IsCapableEnc(client_p, epref->cap)) |
243 |
> |
return epref; |
244 |
|
|
245 |
< |
return(NULL); |
245 |
> |
return NULL; |
246 |
|
} |
247 |
|
#endif /* HAVE_LIBCRYPTO */ |
248 |
|
|
812 |
|
int tl; |
813 |
|
dlink_node *ptr; |
814 |
|
#ifdef HAVE_LIBCRYPTO |
815 |
< |
struct EncCapability *epref; |
815 |
> |
const struct EncCapability *epref = NULL; |
816 |
|
char *capend; |
817 |
|
int sent_cipher = 0; |
818 |
|
#endif |
839 |
|
/* use connect{} specific info if available */ |
840 |
|
if (aconf->cipher_preference) |
841 |
|
epref = aconf->cipher_preference; |
842 |
< |
else |
842 |
> |
else if (ConfigFileEntry.default_cipher_preference) |
843 |
|
epref = ConfigFileEntry.default_cipher_preference; |
844 |
|
|
845 |
< |
if ((epref->cap & enc_can_send)) |
845 |
> |
if (epref && (epref->cap & enc_can_send)) |
846 |
|
{ |
847 |
|
/* Leave the space -- it is removed later. */ |
848 |
|
tl = ircsprintf(t, "%s ", epref->name); |
854 |
|
t = capend; /* truncate string before ENC:, below */ |
855 |
|
} |
856 |
|
#endif |
857 |
< |
*(t-1) = '\0'; |
857 |
> |
*(t - 1) = '\0'; |
858 |
|
sendto_one(client_p, "CAPAB :%s", msgbuf); |
859 |
|
} |
860 |
|
|