From de154dcf92ebaed23a33b6849af8aa14dc767a7d Mon Sep 17 00:00:00 2001 From: "Gerald W. Carter" Date: Tue, 22 Apr 2008 15:29:53 -0500 Subject: Mark a domain offline in the wbcDomainInfo structure using the domain_flags. Use the existing domain_flags fiueld in wbcDomainInfo to set a bit if the domain is marked as offline by Winbind. (This used to be commit 59cfba2c3d6d4594f08cbe3b7295ab36a7cfb044) --- source3/nsswitch/libwbclient/wbc_util.c | 15 ++++++++- source3/nsswitch/libwbclient/wbclient.h | 1 + source3/nsswitch/wbinfo.c | 58 ++++++++++++++++++++------------- source3/winbindd/winbindd_misc.c | 18 +++++++--- 4 files changed, 64 insertions(+), 28 deletions(-) (limited to 'source3') diff --git a/source3/nsswitch/libwbclient/wbc_util.c b/source3/nsswitch/libwbclient/wbc_util.c index c1b3affc72..3afd8a29d3 100644 --- a/source3/nsswitch/libwbclient/wbc_util.c +++ b/source3/nsswitch/libwbclient/wbc_util.c @@ -373,15 +373,28 @@ static wbcErr process_domain_info_string(TALLOC_CTX *ctx, /* Outgoing */ r = s; - if (r == NULL) { + if ((s = strchr(r, '\\')) == NULL) { wbc_status = WBC_ERR_INVALID_RESPONSE; BAIL_ON_WBC_ERROR(wbc_status); } + *s = '\0'; + s++; if (strcmp(r, "Yes") == 0) { info->trust_flags |= WBC_DOMINFO_TRUST_OUTGOING; } + /* Online/Offline status */ + + r = s; + if (r == NULL) { + wbc_status = WBC_ERR_INVALID_RESPONSE; + BAIL_ON_WBC_ERROR(wbc_status); + } + if ( strcmp(r, "Offline") == 0) { + info->domain_flags |= WBC_DOMINFO_DOMAIN_OFFLINE; + } + wbc_status = WBC_ERR_SUCCESS; done: diff --git a/source3/nsswitch/libwbclient/wbclient.h b/source3/nsswitch/libwbclient/wbclient.h index 67fa25691a..f236c43e11 100644 --- a/source3/nsswitch/libwbclient/wbclient.h +++ b/source3/nsswitch/libwbclient/wbclient.h @@ -139,6 +139,7 @@ struct wbcDomainInfo { #define WBC_DOMINFO_DOMAIN_NATIVE 0x00000001 #define WBC_DOMINFO_DOMAIN_AD 0x00000002 #define WBC_DOMINFO_DOMAIN_PRIMARY 0x00000004 +#define WBC_DOMINFO_DOMAIN_OFFLINE 0x00000008 /* wbcDomainInfo->trust_flags */ diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c index d844e2385e..7bb4abe9b2 100644 --- a/source3/nsswitch/wbinfo.c +++ b/source3/nsswitch/wbinfo.c @@ -419,39 +419,43 @@ static bool wbinfo_list_own_domain(void) /* show sequence numbers */ static bool wbinfo_show_sequence(const char *domain) { - struct winbindd_request request; - struct winbindd_response response; - - ZERO_STRUCT(response); - ZERO_STRUCT(request); - - if ( domain ) - fstrcpy( request.domain_name, domain ); + d_printf("This command has been deprecated. Please use the --online-status option instead.\n"); + return false; +} - /* Send request */ +/* show sequence numbers */ +static bool wbinfo_show_onlinestatus(const char *domain) +{ + struct wbcDomainInfo *domain_list = NULL; + size_t num_domains; + wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; + int i; - if (winbindd_request_response(WINBINDD_SHOW_SEQUENCE, &request, &response) != - NSS_STATUS_SUCCESS) + wbc_status = wbcListTrusts(&domain_list, &num_domains); + if (!WBC_ERROR_IS_OK(wbc_status)) { return false; + } - /* Display response */ + for (i=0; idomain_name); + if (domain) { + is_online = domain->online; + } + if ( !extra_data ) { extra_data = talloc_asprintf(state->mem_ctx, - "%s\\%s\\%s\\%s\\%s\\%s\\%s", + "%s\\%s\\%s\\%s\\%s\\%s\\%s\\%s", d->domain_name, d->dns_name ? d->dns_name : d->domain_name, sid_string_talloc(state->mem_ctx, &d->sid), get_trust_type_string(d), trust_is_transitive(d) ? "Yes" : "No", trust_is_inbound(d) ? "Yes" : "No", - trust_is_outbound(d) ? "Yes" : "No"); + trust_is_outbound(d) ? "Yes" : "No", + is_online ? "Online" : "Offline" ); } else { extra_data = talloc_asprintf(state->mem_ctx, - "%s\n%s\\%s\\%s\\%s\\%s\\%s\\%s", + "%s\n%s\\%s\\%s\\%s\\%s\\%s\\%s\\%s", extra_data, d->domain_name, d->dns_name ? d->dns_name : d->domain_name, @@ -194,7 +203,8 @@ void winbindd_list_trusted_domains(struct winbindd_cli_state *state) get_trust_type_string(d), trust_is_transitive(d) ? "Yes" : "No", trust_is_inbound(d) ? "Yes" : "No", - trust_is_outbound(d) ? "Yes" : "No"); + trust_is_outbound(d) ? "Yes" : "No", + is_online ? "Online" : "Offline" ); } } -- cgit