Expects that patch from "resolv_gethostbyname_send: talloc_strdup hostname on state" thread is applied.
Dne pondělí 16 července 2012 16:01:46, Pavel Březina napsal(a):
Expects that patch from "resolv_gethostbyname_send: talloc_strdup hostname on state" thread is applied.
Nack, please don't use talloc_realloc () in sdap_sudo_get_hostnames_send(), it's confusing. Allocating an array for three elements with talloc_zero_array() will save you couple lines of code (all those reallocs and NULL assignments).
This is of course based on two observations I've made in the code are that before allocation: - the state->hostnames is NULL when calling sdap_sudo_get_hostnames_send() - in there is no error, the state->hostnames will contain two records and NULL
You are not checking if talloc_strdup() calls returned non-NULL pointer.
I suspect you should use CONFDB_DOMAIN_RESOLV_OP_TIMEOUT instead of CONFDB_DOMAIN_RESOLV_TIMEOUT. I'm not sure though, please take a look at data_provider_fo.c:106 and provide a comment.
Functionally the patch is fine, I tried both with hostname being fqdn and simple name.
Thanks Jan
On 19.7.2012 13:18, Jan Zelený wrote:
Dne pondělí 16 července 2012 16:01:46, Pavel Březina napsal(a):
Expects that patch from "resolv_gethostbyname_send: talloc_strdup hostname on state" thread is applied.
Nack, please don't use talloc_realloc () in sdap_sudo_get_hostnames_send(), it's confusing. Allocating an array for three elements with talloc_zero_array() will save you couple lines of code (all those reallocs and NULL assignments).
This is of course based on two observations I've made in the code are that before allocation:
- the state->hostnames is NULL when calling sdap_sudo_get_hostnames_send()
- in there is no error, the state->hostnames will contain two records and NULL
You are not checking if talloc_strdup() calls returned non-NULL pointer.
Thanks. New patch is attached.
I suspect you should use CONFDB_DOMAIN_RESOLV_OP_TIMEOUT instead of CONFDB_DOMAIN_RESOLV_TIMEOUT. I'm not sure though, please take a look at data_provider_fo.c:106 and provide a comment.
Well, I don't know. What's the difference between those two? I was following ipa_dyndns.c and the shorter version is used there (see line 148).
Functionally the patch is fine, I tried both with hostname being fqdn and simple name.
On Thu, Jul 19, 2012 at 07:28:18PM +0200, Pavel Březina wrote:
On 19.7.2012 13:18, Jan Zelený wrote:
Dne pondělí 16 července 2012 16:01:46, Pavel Březina napsal(a):
Expects that patch from "resolv_gethostbyname_send: talloc_strdup hostname on state" thread is applied.
Nack, please don't use talloc_realloc () in sdap_sudo_get_hostnames_send(), it's confusing. Allocating an array for three elements with talloc_zero_array() will save you couple lines of code (all those reallocs and NULL assignments).
This is of course based on two observations I've made in the code are that before allocation:
- the state->hostnames is NULL when calling sdap_sudo_get_hostnames_send()
- in there is no error, the state->hostnames will contain two records and NULL
You are not checking if talloc_strdup() calls returned non-NULL pointer.
Thanks. New patch is attached.
I suspect you should use CONFDB_DOMAIN_RESOLV_OP_TIMEOUT instead of CONFDB_DOMAIN_RESOLV_TIMEOUT. I'm not sure though, please take a look at data_provider_fo.c:106 and provide a comment.
Well, I don't know. What's the difference between those two? I was following ipa_dyndns.c and the shorter version is used there (see line 148).
CONFDB_DOMAIN_RESOLV_OP_TIMEOUT (aka dns_resolver_op_timeout) is a very low-level setting that fine-tunes how long should c-ares talk to individual nameservers before giving up and trying the next DNS server. It is not documented and left out of configAPI.
CONFDB_DOMAIN_RESOLV_TIMEOUT (aka dns_resolver_timeout) is a fail over setting that tunes how long should a service resolution take. Keep in mind that "service resolution" might involve talking to different DNS servers.
Unless you want to control timeouts related to a single DNS server, CONFDB_DOMAIN_RESOLV_TIMEOUT is what you'd want to use.
https://fedorahosted.org/sssd/ticket/976 has more details.
On 07/20/2012 10:47 AM, Jakub Hrozek wrote:
On Thu, Jul 19, 2012 at 07:28:18PM +0200, Pavel Březina wrote:
On 19.7.2012 13:18, Jan Zelený wrote:
Dne pondělí 16 července 2012 16:01:46, Pavel Březina napsal(a):
Expects that patch from "resolv_gethostbyname_send: talloc_strdup hostname on state" thread is applied.
Nack, please don't use talloc_realloc () in sdap_sudo_get_hostnames_send(), it's confusing. Allocating an array for three elements with talloc_zero_array() will save you couple lines of code (all those reallocs and NULL assignments).
This is of course based on two observations I've made in the code are that before allocation:
- the state->hostnames is NULL when calling sdap_sudo_get_hostnames_send()
- in there is no error, the state->hostnames will contain two records and NULL
You are not checking if talloc_strdup() calls returned non-NULL pointer.
Thanks. New patch is attached.
I suspect you should use CONFDB_DOMAIN_RESOLV_OP_TIMEOUT instead of CONFDB_DOMAIN_RESOLV_TIMEOUT. I'm not sure though, please take a look at data_provider_fo.c:106 and provide a comment.
Well, I don't know. What's the difference between those two? I was following ipa_dyndns.c and the shorter version is used there (see line 148).
CONFDB_DOMAIN_RESOLV_OP_TIMEOUT (aka dns_resolver_op_timeout) is a very low-level setting that fine-tunes how long should c-ares talk to individual nameservers before giving up and trying the next DNS server. It is not documented and left out of configAPI.
CONFDB_DOMAIN_RESOLV_TIMEOUT (aka dns_resolver_timeout) is a fail over setting that tunes how long should a service resolution take. Keep in mind that "service resolution" might involve talking to different DNS servers.
Unless you want to control timeouts related to a single DNS server, CONFDB_DOMAIN_RESOLV_TIMEOUT is what you'd want to use.
https://fedorahosted.org/sssd/ticket/976 has more details.
Thank you for the explanation. Than I believe it is OK to use CONFDB_DOMAIN_RESOLV_TIMEOUT in this case.
Dne pondělí 23 července 2012 09:46:07, Pavel Březina napsal(a):
On 07/20/2012 10:47 AM, Jakub Hrozek wrote:
On Thu, Jul 19, 2012 at 07:28:18PM +0200, Pavel Březina wrote:
On 19.7.2012 13:18, Jan Zelený wrote:
Dne pondělí 16 července 2012 16:01:46, Pavel Březina napsal(a):
Expects that patch from "resolv_gethostbyname_send: talloc_strdup hostname on state" thread is applied.
Nack, please don't use talloc_realloc () in sdap_sudo_get_hostnames_send(), it's confusing. Allocating an array for three elements with talloc_zero_array() will save you couple lines of code (all those reallocs and NULL assignments).
This is of course based on two observations I've made in the code are that before allocation:
- the state->hostnames is NULL when calling
sdap_sudo_get_hostnames_send()
- in there is no error, the state->hostnames will contain two records
and NULL
You are not checking if talloc_strdup() calls returned non-NULL pointer.
Thanks. New patch is attached.
I suspect you should use CONFDB_DOMAIN_RESOLV_OP_TIMEOUT instead of CONFDB_DOMAIN_RESOLV_TIMEOUT. I'm not sure though, please take a look at data_provider_fo.c:106 and provide a comment.
Well, I don't know. What's the difference between those two? I was following ipa_dyndns.c and the shorter version is used there (see line 148).
CONFDB_DOMAIN_RESOLV_OP_TIMEOUT (aka dns_resolver_op_timeout) is a very low-level setting that fine-tunes how long should c-ares talk to individual nameservers before giving up and trying the next DNS server. It is not documented and left out of configAPI.
CONFDB_DOMAIN_RESOLV_TIMEOUT (aka dns_resolver_timeout) is a fail over setting that tunes how long should a service resolution take. Keep in mind that "service resolution" might involve talking to different DNS servers.
Unless you want to control timeouts related to a single DNS server, CONFDB_DOMAIN_RESOLV_TIMEOUT is what you'd want to use.
https://fedorahosted.org/sssd/ticket/976 has more details.
Thank you for the explanation. Than I believe it is OK to use CONFDB_DOMAIN_RESOLV_TIMEOUT in this case.
I agree, Ack
Jan
On Mon, Jul 23, 2012 at 01:09:13PM +0200, Jan Zelený wrote:
Dne pondělí 23 července 2012 09:46:07, Pavel Březina napsal(a):
On 07/20/2012 10:47 AM, Jakub Hrozek wrote:
On Thu, Jul 19, 2012 at 07:28:18PM +0200, Pavel Březina wrote:
On 19.7.2012 13:18, Jan Zelený wrote:
Dne pondělí 16 července 2012 16:01:46, Pavel Březina napsal(a):
Expects that patch from "resolv_gethostbyname_send: talloc_strdup hostname on state" thread is applied.
Nack, please don't use talloc_realloc () in sdap_sudo_get_hostnames_send(), it's confusing. Allocating an array for three elements with talloc_zero_array() will save you couple lines of code (all those reallocs and NULL assignments).
This is of course based on two observations I've made in the code are that before allocation:
- the state->hostnames is NULL when calling
sdap_sudo_get_hostnames_send()
- in there is no error, the state->hostnames will contain two records
and NULL
You are not checking if talloc_strdup() calls returned non-NULL pointer.
Thanks. New patch is attached.
I suspect you should use CONFDB_DOMAIN_RESOLV_OP_TIMEOUT instead of CONFDB_DOMAIN_RESOLV_TIMEOUT. I'm not sure though, please take a look at data_provider_fo.c:106 and provide a comment.
Well, I don't know. What's the difference between those two? I was following ipa_dyndns.c and the shorter version is used there (see line 148).
CONFDB_DOMAIN_RESOLV_OP_TIMEOUT (aka dns_resolver_op_timeout) is a very low-level setting that fine-tunes how long should c-ares talk to individual nameservers before giving up and trying the next DNS server. It is not documented and left out of configAPI.
CONFDB_DOMAIN_RESOLV_TIMEOUT (aka dns_resolver_timeout) is a fail over setting that tunes how long should a service resolution take. Keep in mind that "service resolution" might involve talking to different DNS servers.
Unless you want to control timeouts related to a single DNS server, CONFDB_DOMAIN_RESOLV_TIMEOUT is what you'd want to use.
https://fedorahosted.org/sssd/ticket/976 has more details.
Thank you for the explanation. Than I believe it is OK to use CONFDB_DOMAIN_RESOLV_TIMEOUT in this case.
I agree, Ack
Jan
Nack,
+#include <unistd.h> +#include <bits/local_lim.h> // HOST_NAME_MAX +#include <string.h>
Please include only <limits.h> here, HOST_NAME_MAX will be included from local_lim.h (via another header called posix_lim.h or similarly..)
Also don't use C++ comments.
+ char hostname[HOST_NAME_MAX + 1]; + errno = 0; + ret = gethostname(hostname, sizeof(hostname)); + if (ret != EOK) {
This looks like a potential buffer overrun to me for cases when the host name is HOST_NAME_MAX+1 long, I think you should use HOST_NAME_MAX as the size parameter and also unconditionally set hostname[HOST_NAME_MAX] to '\0' to make sure the buffer is NULL-terminated.
The rest looks good, I'm just wondering that maybe it would be nice to create a utility function to initialize resolver with the defaults that could be reused in data_provider_fo.c and this code.
On 23.7.2012 19:00, Jakub Hrozek wrote:
On Mon, Jul 23, 2012 at 01:09:13PM +0200, Jan Zelený wrote:
Dne pondělí 23 července 2012 09:46:07, Pavel Březina napsal(a):
On 07/20/2012 10:47 AM, Jakub Hrozek wrote:
On Thu, Jul 19, 2012 at 07:28:18PM +0200, Pavel Březina wrote:
On 19.7.2012 13:18, Jan Zelený wrote:
Dne pondělí 16 července 2012 16:01:46, Pavel Březina napsal(a): > Expects that patch from "resolv_gethostbyname_send: talloc_strdup > hostname on state" thread is applied.
Nack, please don't use talloc_realloc () in sdap_sudo_get_hostnames_send(), it's confusing. Allocating an array for three elements with talloc_zero_array() will save you couple lines of code (all those reallocs and NULL assignments).
This is of course based on two observations I've made in the code are that before allocation:
- the state->hostnames is NULL when calling
sdap_sudo_get_hostnames_send()
- in there is no error, the state->hostnames will contain two records
and NULL
You are not checking if talloc_strdup() calls returned non-NULL pointer.
Thanks. New patch is attached.
I suspect you should use CONFDB_DOMAIN_RESOLV_OP_TIMEOUT instead of CONFDB_DOMAIN_RESOLV_TIMEOUT. I'm not sure though, please take a look at data_provider_fo.c:106 and provide a comment.
Well, I don't know. What's the difference between those two? I was following ipa_dyndns.c and the shorter version is used there (see line 148).
CONFDB_DOMAIN_RESOLV_OP_TIMEOUT (aka dns_resolver_op_timeout) is a very low-level setting that fine-tunes how long should c-ares talk to individual nameservers before giving up and trying the next DNS server. It is not documented and left out of configAPI.
CONFDB_DOMAIN_RESOLV_TIMEOUT (aka dns_resolver_timeout) is a fail over setting that tunes how long should a service resolution take. Keep in mind that "service resolution" might involve talking to different DNS servers.
Unless you want to control timeouts related to a single DNS server, CONFDB_DOMAIN_RESOLV_TIMEOUT is what you'd want to use.
https://fedorahosted.org/sssd/ticket/976 has more details.
Thank you for the explanation. Than I believe it is OK to use CONFDB_DOMAIN_RESOLV_TIMEOUT in this case.
I agree, Ack
Jan
Nack,
+#include <unistd.h> +#include <bits/local_lim.h> // HOST_NAME_MAX +#include <string.h>
Please include only <limits.h> here, HOST_NAME_MAX will be included from local_lim.h (via another header called posix_lim.h or similarly..)
Done.
Also don't use C++ comments.
Removed.
- char hostname[HOST_NAME_MAX + 1];
- errno = 0;
- ret = gethostname(hostname, sizeof(hostname));
- if (ret != EOK) {
This looks like a potential buffer overrun to me for cases when the host name is HOST_NAME_MAX+1 long, I think you should use HOST_NAME_MAX as the size parameter and also unconditionally set hostname[HOST_NAME_MAX] to '\0' to make sure the buffer is NULL-terminated.
Done.
The rest looks good, I'm just wondering that maybe it would be nice to create a utility function to initialize resolver with the defaults that could be reused in data_provider_fo.c and this code.
+1
On 24.7.2012 14:11, Simo Sorce wrote:
On Tue, 2012-07-24 at 12:21 +0200, Pavel Březina wrote:
+#include <unistd.h> +#include <bits/local_lim.h> // HOST_NAME_MAX +#include <string.h>
I guess you attached the old patch.
Simo.
Not exactly. I didn't commit the changes. Thanks. :-) The correct patch is attached.
On 07/24/2012 02:16 PM, Pavel Březina wrote:
On 24.7.2012 14:11, Simo Sorce wrote:
On Tue, 2012-07-24 at 12:21 +0200, Pavel Březina wrote:
+#include <unistd.h> +#include <bits/local_lim.h> // HOST_NAME_MAX +#include <string.h>
I guess you attached the old patch.
Simo.
Not exactly. I didn't commit the changes. Thanks. :-) The correct patch is attached.
I'm sending this patch one more time. Now with updated manual page.
Dne středa 25 července 2012 10:34:15, Pavel Březina napsal(a):
On 07/24/2012 02:16 PM, Pavel Březina wrote:
On 24.7.2012 14:11, Simo Sorce wrote:
On Tue, 2012-07-24 at 12:21 +0200, Pavel Březina wrote:
+#include <unistd.h> +#include <bits/local_lim.h> // HOST_NAME_MAX +#include <string.h>
I guess you attached the old patch.
Simo.
Not exactly. I didn't commit the changes. Thanks. :-) The correct patch is attached.
I'm sending this patch one more time. Now with updated manual page.
I assume you are going to implement the function to initialize resolver separately? If yes, either create a ticket for that or send another patch right now so we don't forget it.
The rest of the patch is ok, all previous concerns are addressed.
Thanks Jan
On Wed, Jul 25, 2012 at 01:29:26PM +0200, Jan Zelený wrote:
Dne středa 25 července 2012 10:34:15, Pavel Březina napsal(a):
On 07/24/2012 02:16 PM, Pavel Březina wrote:
On 24.7.2012 14:11, Simo Sorce wrote:
On Tue, 2012-07-24 at 12:21 +0200, Pavel Březina wrote:
+#include <unistd.h> +#include <bits/local_lim.h> // HOST_NAME_MAX +#include <string.h>
I guess you attached the old patch.
Simo.
Not exactly. I didn't commit the changes. Thanks. :-) The correct patch is attached.
I'm sending this patch one more time. Now with updated manual page.
I assume you are going to implement the function to initialize resolver separately? If yes, either create a ticket for that or send another patch right now so we don't forget it.
The rest of the patch is ok, all previous concerns are addressed.
Thanks Jan
Sorry, still a nack. The patch violates the tevent_req style.
The steps of sdap_sudo_get_hostnames are named sdap_sudo_get_hostnames_send sdap_sudo_get_hostnames_resolv_done and sdap_sudo_get_hostnames_recv. Moreover, sdap_sudo_get_hostnames_done, which is just callback attached to the async request created by sdap_sudo_get_hostnames_send calls sdap_sudo_get_hostnames_recv. That's very confusing, it looks like some circular request.
The asynchronous functions that perform "foo" must be named "foo_send", "foo_done", and "foo_recv" and should be placed in this order in the source file. If the request consists of multiple steps, they may be named differently, but when the request ends, there should be foo_done callback called. This may seem like nitpicking, but the asynchronous processing is hard to follow as it is..
Also, please check lines that are over the 80-characters limit.
On 07/25/2012 04:14 PM, Jakub Hrozek wrote:
On Wed, Jul 25, 2012 at 01:29:26PM +0200, Jan Zelený wrote:
Dne středa 25 července 2012 10:34:15, Pavel Březina napsal(a):
On 07/24/2012 02:16 PM, Pavel Březina wrote:
On 24.7.2012 14:11, Simo Sorce wrote:
On Tue, 2012-07-24 at 12:21 +0200, Pavel Březina wrote:
+#include <unistd.h> +#include <bits/local_lim.h> // HOST_NAME_MAX +#include <string.h>
I guess you attached the old patch.
Simo.
Not exactly. I didn't commit the changes. Thanks. :-) The correct patch is attached.
I'm sending this patch one more time. Now with updated manual page.
I assume you are going to implement the function to initialize resolver separately? If yes, either create a ticket for that or send another patch right now so we don't forget it.
The rest of the patch is ok, all previous concerns are addressed.
Thanks Jan
Sorry, still a nack. The patch violates the tevent_req style.
The steps of sdap_sudo_get_hostnames are named sdap_sudo_get_hostnames_send sdap_sudo_get_hostnames_resolv_done and sdap_sudo_get_hostnames_recv. Moreover, sdap_sudo_get_hostnames_done, which is just callback attached to the async request created by sdap_sudo_get_hostnames_send calls sdap_sudo_get_hostnames_recv. That's very confusing, it looks like some circular request.
The asynchronous functions that perform "foo" must be named "foo_send", "foo_done", and "foo_recv" and should be placed in this order in the source file. If the request consists of multiple steps, they may be named differently, but when the request ends, there should be foo_done callback called. This may seem like nitpicking, but the asynchronous processing is hard to follow as it is..
Also, please check lines that are over the 80-characters limit.
Done.
After a discussion with Jakub, it seems that CONFDB_DOMAIN_RESOLV_OP_TIMEOUT should be used after all.
I have created a ticket to create utility functions to create a new context and to handle CONFDB_DOMAIN_RESOLV_TIMEOUT timeout.
On Thu, Jul 26, 2012 at 11:37:21AM +0200, Pavel Březina wrote:
On 07/25/2012 04:14 PM, Jakub Hrozek wrote:
On Wed, Jul 25, 2012 at 01:29:26PM +0200, Jan Zelený wrote:
Dne středa 25 července 2012 10:34:15, Pavel Březina napsal(a):
On 07/24/2012 02:16 PM, Pavel Březina wrote:
On 24.7.2012 14:11, Simo Sorce wrote:
On Tue, 2012-07-24 at 12:21 +0200, Pavel Březina wrote: >+#include <unistd.h> >+#include <bits/local_lim.h> // HOST_NAME_MAX >+#include <string.h>
I guess you attached the old patch.
Simo.
Not exactly. I didn't commit the changes. Thanks. :-) The correct patch is attached.
I'm sending this patch one more time. Now with updated manual page.
I assume you are going to implement the function to initialize resolver separately? If yes, either create a ticket for that or send another patch right now so we don't forget it.
The rest of the patch is ok, all previous concerns are addressed.
Thanks Jan
Sorry, still a nack. The patch violates the tevent_req style.
The steps of sdap_sudo_get_hostnames are named sdap_sudo_get_hostnames_send sdap_sudo_get_hostnames_resolv_done and sdap_sudo_get_hostnames_recv. Moreover, sdap_sudo_get_hostnames_done, which is just callback attached to the async request created by sdap_sudo_get_hostnames_send calls sdap_sudo_get_hostnames_recv. That's very confusing, it looks like some circular request.
The asynchronous functions that perform "foo" must be named "foo_send", "foo_done", and "foo_recv" and should be placed in this order in the source file. If the request consists of multiple steps, they may be named differently, but when the request ends, there should be foo_done callback called. This may seem like nitpicking, but the asynchronous processing is hard to follow as it is..
Also, please check lines that are over the 80-characters limit.
Done.
After a discussion with Jakub, it seems that CONFDB_DOMAIN_RESOLV_OP_TIMEOUT should be used after all.
I have created a ticket to create utility functions to create a new context and to handle CONFDB_DOMAIN_RESOLV_TIMEOUT timeout.
Ack and pushed to master.
sssd-devel@lists.fedorahosted.org