diff options
author | Martin Nagy <mnagy@redhat.com> | 2009-10-06 15:59:16 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-10-22 13:56:21 -0400 |
commit | b8565b19461efc67e4d10d8cafb5979412b4cad6 (patch) | |
tree | d8dca08707970fc067a6cb2969844ec047ac9c0a /server/resolv/async_resolv.h | |
parent | 6a2b3bd9e61336ca12cc7dbb8f2a54c5f53b1f34 (diff) | |
download | sssd-b8565b19461efc67e4d10d8cafb5979412b4cad6.tar.gz sssd-b8565b19461efc67e4d10d8cafb5979412b4cad6.tar.xz sssd-b8565b19461efc67e4d10d8cafb5979412b4cad6.zip |
Use talloc to copy data from c-ares
C-ares either returned a malloc-ed memory or it automatically freed the
memory after out callback has returned. This patch will make sure that
anything that the resolv_* function return is allocated by talloc and
can be safely freed by talloc_free().
This will break the resolv tests to the point they will not be
compilable. This will be addressed in a later patch with other
improvements to the tests.
Diffstat (limited to 'server/resolv/async_resolv.h')
-rw-r--r-- | server/resolv/async_resolv.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/server/resolv/async_resolv.h b/server/resolv/async_resolv.h index aabf871b2..fcea6b85b 100644 --- a/server/resolv/async_resolv.h +++ b/server/resolv/async_resolv.h @@ -51,6 +51,9 @@ int resolv_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx, const char *resolv_strerror(int ares_code); +struct hostent *resolv_copy_hostent(TALLOC_CTX *mem_ctx, + struct hostent *src); + /** Get host by name **/ struct tevent_req *resolv_gethostbyname_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -58,10 +61,11 @@ struct tevent_req *resolv_gethostbyname_send(TALLOC_CTX *mem_ctx, const char *name, int family); -int resolv_gethostbyname_recv(struct tevent_req *req, +int resolv_gethostbyname_recv(TALLOC_CTX *mem_ctx, + struct tevent_req *req, int *status, int *timeouts, - struct hostent const **hostent); + struct hostent **hostent); /** Get SRV record **/ struct tevent_req *resolv_getsrv_send(TALLOC_CTX *mem_ctx, @@ -69,10 +73,11 @@ struct tevent_req *resolv_getsrv_send(TALLOC_CTX *mem_ctx, struct resolv_ctx *ctx, const char *query); -int resolv_getsrv_recv(struct tevent_req *req, +int resolv_getsrv_recv(TALLOC_CTX *mem_ctx, + struct tevent_req *req, int *status, int *timeouts, - struct srv_reply const **reply_list, + struct srv_reply **reply_list, int *num_replies); /** Get TXT record **/ @@ -81,10 +86,11 @@ struct tevent_req *resolv_gettxt_send(TALLOC_CTX *mem_ctx, struct resolv_ctx *ctx, const char *query); -int resolv_gettxt_recv(struct tevent_req *req, +int resolv_gettxt_recv(TALLOC_CTX *mem_ctx, + struct tevent_req *req, int *status, int *timeouts, - struct txt_reply const **reply_list, + struct txt_reply **reply_list, int *num_replies); #endif /* __ASYNC_RESOLV_H__ */ |