return our ads connections structure for a domain. We keep the connection
open to make things faster
*/
-static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
+static ADS_STATUS ads_cached_connection(struct winbindd_domain *domain,
+ ADS_STRUCT **adsp)
{
ADS_STATUS status;
char *password = NULL;
* Make sure we never try to use LDAP against
* a trusted domain as AD DC.
*/
- return NULL;
+ return ADS_ERROR_NT(NT_STATUS_REQUEST_NOT_ACCEPTED);
}
DEBUG(10,("ads_cached_connection\n"));
- ads_cached_connection_reuse(&domain->backend_data.ads_conn);
+ ads_cached_connection_reuse(&domain->backend_data.ads_conn);
if (domain->backend_data.ads_conn != NULL) {
- return domain->backend_data.ads_conn;
+ *adsp = domain->backend_data.ads_conn;
+ return ADS_SUCCESS;
}
/* the machine acct password might have change - fetch it every time */
if (!get_trust_pw_clear(domain->name, &password, NULL, NULL)) {
- return NULL;
+ return ADS_ERROR_NT(NT_STATUS_CANT_ACCESS_DOMAIN_INFO);
}
if ( IS_DC ) {
SMB_ASSERT(domain->alt_name != NULL);
realm = SMB_STRDUP(domain->alt_name);
- }
- else {
+ } else {
struct winbindd_domain *our_domain = domain;
DEBUG(1,("Trying MSRPC methods\n"));
domain->backend = &reconnect_methods;
}
- return NULL;
+ return status;
}
- return domain->backend_data.ads_conn;
+ *adsp = domain->backend_data.ads_conn;
+
+ return status;
}
/* Query display info for a realm. This is the basic user list fn */
return NT_STATUS_OK;
}
- ads = ads_cached_connection(domain);
-
- if (!ads) {
+ rc = ads_cached_connection(domain, &ads);
+ if (!ADS_ERR_OK(rc)) {
domain->last_status = NT_STATUS_SERVER_DISABLED;
goto done;
}
goto done;
}
- ads = ads_cached_connection(domain);
-
- if (!ads) {
+ rc = ads_cached_connection(domain, &ads);
+ if (!ADS_ERR_OK(rc)) {
domain->last_status = NT_STATUS_SERVER_DISABLED;
goto done;
}
LDAPMessage *res = NULL;
LDAPMessage *msg = NULL;
char *ldap_exp;
- ADS_STRUCT *ads;
+ ADS_STRUCT *ads = NULL;
const char *group_attrs[] = {"objectSid", NULL};
char *escaped_dn;
uint32_t num_groups = 0;
return NT_STATUS_OK;
}
- ads = ads_cached_connection(domain);
-
- if (!ads) {
+ rc = ads_cached_connection(domain, &ads);
+ if (!ADS_ERR_OK(rc)) {
domain->last_status = NT_STATUS_SERVER_DISABLED;
goto done;
}
{
ADS_STATUS rc;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
- ADS_STRUCT *ads;
+ ADS_STRUCT *ads = NULL;
const char *attrs[] = {"memberOf", NULL};
uint32_t num_groups = 0;
struct dom_sid *group_sids = NULL;
return NT_STATUS_OK;
}
- ads = ads_cached_connection(domain);
-
- if (!ads) {
+ rc = ads_cached_connection(domain, &ads);
+ if (!ADS_ERR_OK(rc)) {
domain->last_status = NT_STATUS_SERVER_DISABLED;
return NT_STATUS_UNSUCCESSFUL;
}
return NT_STATUS_SYNCHRONIZATION_REQUIRED;
}
- ads = ads_cached_connection(domain);
-
- if (!ads) {
+ rc = ads_cached_connection(domain, &ads);
+ if (!ADS_ERR_OK(rc)) {
domain->last_status = NT_STATUS_SERVER_DISABLED;
status = NT_STATUS_SERVER_DISABLED;
goto done;
return NT_STATUS_OK;
}
- ads = ads_cached_connection(domain);
-
- if (!ads) {
+ rc = ads_cached_connection(domain, &ads);
+ if (!ADS_ERR_OK(rc)) {
domain->last_status = NT_STATUS_SERVER_DISABLED;
goto done;
}