Make ares_init(), ares_dup() and ares_init_options() return ARES_ENOTINITIALIZED
if library initialization has not been performed calling ares_library_init().
This commit is contained in:
parent
675d6ec5e6
commit
1c93d9dcfe
10
ares/TODO
10
ares/TODO
@ -6,3 +6,13 @@ ares_gethostbyname
|
|||||||
- When built to support IPv6, it needs to also support PF_UNSPEC or similar,
|
- When built to support IPv6, it needs to also support PF_UNSPEC or similar,
|
||||||
so that an application can ask for any protocol and then c-ares would return
|
so that an application can ask for any protocol and then c-ares would return
|
||||||
all known resolves and not just explicitly IPv4 _or_ IPv6 resolves.
|
all known resolves and not just explicitly IPv4 _or_ IPv6 resolves.
|
||||||
|
|
||||||
|
ares_process
|
||||||
|
|
||||||
|
- Upon next ABI brakage ares_process() could/should be changed to return 'int'
|
||||||
|
and return ARES_ENOTINITIALIZED if ares_library_init() has not been called.
|
||||||
|
|
||||||
|
ares_process_fd
|
||||||
|
|
||||||
|
- Upon next ABI brakage ares_process_fd() could/should be changed to return
|
||||||
|
'int' and return ARES_ENOTINITIALIZED if library has not been initialized.
|
||||||
|
@ -94,9 +94,12 @@ extern "C" {
|
|||||||
#define ARES_ENONAME 19
|
#define ARES_ENONAME 19
|
||||||
#define ARES_EBADHINTS 20
|
#define ARES_EBADHINTS 20
|
||||||
|
|
||||||
|
/* Uninitialized library error code */
|
||||||
|
#define ARES_ENOTINITIALIZED 21
|
||||||
|
|
||||||
/* ares_library_init error codes */
|
/* ares_library_init error codes */
|
||||||
#define ARES_ELOADIPHLPAPI 21
|
#define ARES_ELOADIPHLPAPI 22
|
||||||
#define ARES_EADDRGETNETWORKPARAMS 22
|
#define ARES_EADDRGETNETWORKPARAMS 23
|
||||||
|
|
||||||
/* Flag values */
|
/* Flag values */
|
||||||
#define ARES_FLAG_USEVC (1 << 0)
|
#define ARES_FLAG_USEVC (1 << 0)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.\" $Id$
|
.\" $Id$
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (C) 2007-2008 by Daniel Stenberg
|
.\" Copyright (C) 2004-2009 by Daniel Stenberg
|
||||||
.\"
|
.\"
|
||||||
.\" Permission to use, copy, modify, and distribute this
|
.\" Permission to use, copy, modify, and distribute this
|
||||||
.\" software and its documentation for any purpose and without
|
.\" software and its documentation for any purpose and without
|
||||||
@ -14,7 +14,7 @@
|
|||||||
.\" this software for any purpose. It is provided "as is"
|
.\" this software for any purpose. It is provided "as is"
|
||||||
.\" without express or implied warranty.
|
.\" without express or implied warranty.
|
||||||
.\"
|
.\"
|
||||||
.TH ARES_DUP 3 "2 Dec 2008"
|
.TH ARES_DUP 3 "26 May 2009"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
ares_dup \- Duplicate a resolver channel
|
ares_dup \- Duplicate a resolver channel
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -35,7 +35,8 @@ with additional options set exactly as the \fIsource\fP channel has them
|
|||||||
configured.
|
configured.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR ares_destroy(3),
|
.BR ares_destroy(3),
|
||||||
.BR ares_init(3)
|
.BR ares_init(3),
|
||||||
|
.BR ares_library_init(3)
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
ares_dup(3) was added in c-ares 1.6.0
|
ares_dup(3) was added in c-ares 1.6.0
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
.\" $Id$
|
.\" $Id$
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
||||||
.\" Copyright (C) 2007-2008 by Daniel Stenberg
|
.\" Copyright (C) 2004-2009 by Daniel Stenberg
|
||||||
.\"
|
.\"
|
||||||
.\" Permission to use, copy, modify, and distribute this
|
.\" Permission to use, copy, modify, and distribute this
|
||||||
.\" software and its documentation for any purpose and without
|
.\" software and its documentation for any purpose and without
|
||||||
@ -15,7 +15,7 @@
|
|||||||
.\" this software for any purpose. It is provided "as is"
|
.\" this software for any purpose. It is provided "as is"
|
||||||
.\" without express or implied warranty.
|
.\" without express or implied warranty.
|
||||||
.\"
|
.\"
|
||||||
.TH ARES_INIT 3 "13 May 2008"
|
.TH ARES_INIT 3 "26 May 2009"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
ares_init, ares_init_options \- Initialize a resolver channel
|
ares_init, ares_init_options \- Initialize a resolver channel
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -184,10 +184,16 @@ A configuration file could not be read.
|
|||||||
.TP 14
|
.TP 14
|
||||||
.B ARES_ENOMEM
|
.B ARES_ENOMEM
|
||||||
The process's available memory was exhausted.
|
The process's available memory was exhausted.
|
||||||
|
.TP 14
|
||||||
|
.B ARES_ENOTINITIALIZED
|
||||||
|
c-ares library initialization not yet performed.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR ares_destroy(3),
|
.BR ares_destroy(3),
|
||||||
.BR ares_dup(3)
|
.BR ares_dup(3),
|
||||||
|
.BR ares_library_init(3)
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
Greg Hudson, MIT Information Systems
|
Greg Hudson, MIT Information Systems
|
||||||
.br
|
.br
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
Copyright 1998 by the Massachusetts Institute of Technology.
|
||||||
|
.br
|
||||||
|
Copyright (C) 2004-2009 by Daniel Stenberg.
|
||||||
|
@ -129,6 +129,9 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
|
|||||||
curl_memlimit(atoi(env));
|
curl_memlimit(atoi(env));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (ares_library_initialized() != ARES_SUCCESS)
|
||||||
|
return ARES_ENOTINITIALIZED;
|
||||||
|
|
||||||
channel = malloc(sizeof(struct ares_channeldata));
|
channel = malloc(sizeof(struct ares_channeldata));
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
*channelptr = NULL;
|
*channelptr = NULL;
|
||||||
|
@ -52,7 +52,7 @@ conflict with any other thread that is already using these other libraries.
|
|||||||
.PP
|
.PP
|
||||||
Win32/64 application DLLs shall not call \fIares_library_cleanup(3)\fP from
|
Win32/64 application DLLs shall not call \fIares_library_cleanup(3)\fP from
|
||||||
the DllMain function. Doing so will produce deadlocks and other problems.
|
the DllMain function. Doing so will produce deadlocks and other problems.
|
||||||
.SH NOTES
|
.SH AVAILABILITY
|
||||||
This function was first introduced in c-ares version 1.6.1 along with the
|
This function was first introduced in c-ares version 1.6.1 along with the
|
||||||
definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_CLEANUP\fP as an
|
definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_CLEANUP\fP as an
|
||||||
indication of the availability of this function.
|
indication of the availability of this function.
|
||||||
|
@ -120,3 +120,14 @@ void ares_library_cleanup(void)
|
|||||||
ares_init_flags = ARES_LIB_INIT_NONE;
|
ares_init_flags = ARES_LIB_INIT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ares_library_initialized(void)
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
if (!ares_initialized)
|
||||||
|
return ARES_ENOTINITIALIZED;
|
||||||
|
#endif
|
||||||
|
return ARES_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -310,6 +310,8 @@ int ares__timeadd(struct timeval *now,
|
|||||||
/* return time offset between now and (future) check, in milliseconds */
|
/* return time offset between now and (future) check, in milliseconds */
|
||||||
long ares__timeoffset(struct timeval *now,
|
long ares__timeoffset(struct timeval *now,
|
||||||
struct timeval *check);
|
struct timeval *check);
|
||||||
|
/* returns ARES_SUCCESS if library has been initialized */
|
||||||
|
int ares_library_initialized(void);
|
||||||
void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len);
|
void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len);
|
||||||
void ares__send_query(ares_channel channel, struct query *query,
|
void ares__send_query(ares_channel channel, struct query *query,
|
||||||
struct timeval *now);
|
struct timeval *now);
|
||||||
|
@ -44,6 +44,7 @@ const char *ares_strerror(int code)
|
|||||||
"Illegal flags specified",
|
"Illegal flags specified",
|
||||||
"Given hostname is not numeric",
|
"Given hostname is not numeric",
|
||||||
"Illegal hints flags specified",
|
"Illegal hints flags specified",
|
||||||
|
"c-ares library initialization not yet performed",
|
||||||
"Error loading iphlpapi.dll",
|
"Error loading iphlpapi.dll",
|
||||||
"Could not find GetNetworkParams function"
|
"Could not find GetNetworkParams function"
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user