git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update all copyright messages to cover 1995 - 2009. Remove tab from exim_checkaccess.src
[exim.git]
/
src
/
src
/
host.c
diff --git
a/src/src/host.c
b/src/src/host.c
index 039f58fb219576862ae7f7602d06c8bb4bdc70c5..73f359348e34bfcac729960845119fd322651fa3 100644
(file)
--- a/
src/src/host.c
+++ b/
src/src/host.c
@@
-1,10
+1,10
@@
-/* $Cambridge: exim/src/src/host.c,v 1.
26 2006/10/09 14:36:25 ph10
Exp $ */
+/* $Cambridge: exim/src/src/host.c,v 1.
31 2009/11/16 19:50:37 nm4
Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 200
6
*/
+/* Copyright (c) University of Cambridge 1995 - 200
9
*/
/* See the file NOTICE for conditions of use and distribution. */
/* Functions for finding hosts, either by gethostbyname(), gethostbyaddr(), or
/* See the file NOTICE for conditions of use and distribution. */
/* Functions for finding hosts, either by gethostbyname(), gethostbyaddr(), or
@@
-70,6
+70,9
@@
sprintf(addr, "%d.%d.%d.%d",
very good for the uses to which it is put. When running the regression tests,
start with a fixed seed.
very good for the uses to which it is put. When running the regression tests,
start with a fixed seed.
+If you need better, see pseudo_random_number() which is potentially stronger,
+if a crypto library is available, but might end up just calling this instead.
+
Arguments:
limit: one more than the largest number required
Arguments:
limit: one more than the largest number required
@@
-79,6
+82,8
@@
Returns: a pseudo-random number in the range 0 to limit-1
int
random_number(int limit)
{
int
random_number(int limit)
{
+if (limit < 1)
+ return 0;
if (random_seed == 0)
{
if (running_in_test_harness) random_seed = 42; else
if (random_seed == 0)
{
if (running_in_test_harness) random_seed = 42; else
@@
-1502,7
+1507,7
@@
if (hosts == NULL)
treat this as non-existent. In some operating systems, this is returned as an
empty string; in others as a single dot. */
treat this as non-existent. In some operating systems, this is returned as an
empty string; in others as a single dot. */
-if (hosts->h_name[0] == 0 || hosts->h_name[0] == '.')
+if (hosts->h_name
== NULL || hosts->h_name
[0] == 0 || hosts->h_name[0] == '.')
{
HDEBUG(D_host_lookup) debug_printf("IP address lookup yielded an empty name: "
"treated as non-existent host name\n");
{
HDEBUG(D_host_lookup) debug_printf("IP address lookup yielded an empty name: "
"treated as non-existent host name\n");
@@
-1792,6
+1797,7
@@
for (hname = sender_host_name; hname != NULL; hname = *aliases++)
{
HDEBUG(D_host_lookup) debug_printf("temporary error for host name lookup\n");
host_lookup_deferred = TRUE;
{
HDEBUG(D_host_lookup) debug_printf("temporary error for host name lookup\n");
host_lookup_deferred = TRUE;
+ sender_host_name = NULL;
return DEFER;
}
else
return DEFER;
}
else