On Mar 6, 2008, at 12:16 AM, Alan DeKok wrote:
Could this be a 64-bit portability issue in rlm_ldap?
Likely. See "net_timeout" in the CONF_PARSER module_config structure. It's parsing integers into a "tv_sec", which is type time_t. The data should really be parsed into an "int" type, and that later assigned to a tv_sec.
Problems. On OpenBSD, a timeval is like this: struct timeval { long tv_sec; /* seconds */ long tv_usec; /* and microseconds */ }; Longs are 8 bytes, so it's writing the value of the configuration parameter into the first 4 bytes of the value. I modified CONF_PARSER like this: {"net_timeout", PW_TYPE_INTEGER, offsetof (ldap_instance,net_timeout.tv_sec)+4, NULL, "10"}, /* wait forever for search results */ {"timeout", PW_TYPE_INTEGER, offsetof (ldap_instance,timeout.tv_sec)+4, NULL, "20"}, /* allow server unlimited time for search (server-side limit) */ An ugly hack, for sure. But it gets the correct values into the struct. Then we have the next problem: if (ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, (void *) & (inst->net_timeout)) != LDAP_OPT_SUCCESS) { radlog(L_ERR, "rlm_ldap: Could not set LDAP_OPT_NETWORK_TIMEOUT %d.%ld", inst->net_timeout.tv_sec, inst-
net_timeout .tv_usec); }
I added this right below the above lines: struct timeval net_timeout_value = {0, 0}; ldap_get_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &net_timeout_value); radlog(L_ERR, "ZBL: LDAP_OPT_NETWORK_TIMEOUT %ld.%ld", net_timeout_value.tv_sec, net_timeout_value.tv_usec); and got this output: ZBL: LDAP_OPT_NETWORK_TIMEOUT 1077901232.0 It certainly seems like something fishy is going on here, any more ideas? Thanks, --Zach