|
Bugzilla – Full Text Bug Listing |
| Summary: | sudoers ldap: wrong sequence of init operations | ||
|---|---|---|---|
| Product: | Sudo | Reporter: | Jan Vcelak <jvcelak> |
| Component: | Sudoers | Assignee: | Todd C. Miller <Todd.Miller> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | low | ||
| Version: | 1.8.4 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Attachments: |
proposed patch
Alternate patch to fix sudo TLS problem |
||
|
Description
Jan Vcelak
2012-04-20 09:31:10 MDT
Created attachment 342 [details]
Alternate patch to fix sudo TLS problem
I'd rather just split up global and per-connection options and apply them separately. Can you try the attached path and verify that it solves the problem?
(In reply to comment #1) > Created attachment 342 [details] > Alternate patch to fix sudo TLS problem > > I'd rather just split up global and per-connection options and apply > them separately. Can you try the attached path and verify that it > solves the problem? I will try and let you know. Hopefully today. (In reply to comment #1) > Created attachment 342 [details] > Alternate patch to fix sudo TLS problem I tried your patch with sudo-1.8.3p1-6.fc17 (from Fedora Rawhide), it applied with a little changes. However the patch is causing a segfault. The segfault is caused by passing uninitialized ld pointer to sudo_ldap_set_options_global() function. In fact, there is no need to pass the LDAP handle because ldap_set_option() should not be given a handle to apply the global options. I suggest this change in your patch: --- sudo-sudoers-ldap.patch +++ sudo-sudoers-ldap.patch.fixed @@ -344,7 +344,7 @@ + * Set LDAP options based on the global config table. + */ +static int -+sudo_ldap_set_options_global(LDAP *ld) ++sudo_ldap_set_options_global(void) +{ + int rc; + debug_decl(sudo_ldap_set_options_global, SUDO_DEBUG_LDAP) @@ -356,7 +356,7 @@ +#endif + + /* Parse global LDAP options table. */ -+ rc = sudo_ldap_set_options_table(ld, ldap_conf_global); ++ rc = sudo_ldap_set_options_table(NULL, ldap_conf_global); + if (rc == -1) + debug_return_int(-1); + debug_return_int(0); @@ -383,7 +383,7 @@ } + /* Set global LDAP options */ -+ if (sudo_ldap_set_options_global(ld) < 0) ++ if (sudo_ldap_set_options_global() < 0) + debug_return_int(-1); + /* Connect to LDAP server */ After this change, it works as expected. If you want to be sure, I can test with latest sudo from the repository. And with OpenLDAP with both OpenSSL and Mozilla NSS crypto backends. Good catch, I had intended to make sudo_ldap_set_options_global() take no arguments but goofed up when splitting things out. I've fixed that in the sudo source repo. This will be part of the next sudo 1.8.5 release candidate. Great! Thank you, Todd. Fixed in sudo 1.8.5. |