Ignore:
Timestamp:
Aug 4, 2009, 8:51:22 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.3 to 3.3.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/libnet/libnet_join.c

    r224 r309  
    19241924        }
    19251925
     1926        if (!(r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) &&
     1927            !r->in.delete_machine_account) {
     1928                libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
     1929                return WERR_OK;
     1930        }
     1931
    19261932        if (!r->in.dc_name) {
    19271933                struct netr_DsRGetDCNameInfo *info;
     
    19491955        }
    19501956
    1951         status = libnet_join_unjoindomain_rpc(mem_ctx, r);
    1952         if (!NT_STATUS_IS_OK(status)) {
    1953                 libnet_unjoin_set_error_string(mem_ctx, r,
    1954                         "failed to disable machine account via rpc: %s",
    1955                         get_friendly_nt_error_msg(status));
    1956                 if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
    1957                         return WERR_SETUP_NOT_JOINED;
    1958                 }
    1959                 return ntstatus_to_werror(status);
    1960         }
    1961 
    1962         r->out.disabled_machine_account = true;
    1963 
    19641957#ifdef WITH_ADS
    1965         if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) {
     1958        /* for net ads leave, try to delete the account.  If it works,
     1959           no sense in disabling.  If it fails, we can still try to
     1960           disable it. jmcd */
     1961
     1962        if (r->in.delete_machine_account) {
    19661963                ADS_STATUS ads_status;
    1967                 libnet_unjoin_connect_ads(mem_ctx, r);
    1968                 ads_status = libnet_unjoin_remove_machine_acct(mem_ctx, r);
     1964                ads_status = libnet_unjoin_connect_ads(mem_ctx, r);
     1965                if (ADS_ERR_OK(ads_status)) {
     1966                        /* dirty hack */
     1967                        r->out.dns_domain_name =
     1968                                talloc_strdup(mem_ctx,
     1969                                              r->in.ads->server.realm);
     1970                        ads_status =
     1971                                libnet_unjoin_remove_machine_acct(mem_ctx, r);
     1972                }
    19691973                if (!ADS_ERR_OK(ads_status)) {
    19701974                        libnet_unjoin_set_error_string(mem_ctx, r,
     
    19731977                } else {
    19741978                        r->out.deleted_machine_account = true;
    1975                         /* dirty hack */
    1976                         r->out.dns_domain_name = talloc_strdup(mem_ctx,
    1977                                                                r->in.ads->server.realm);
    19781979                        W_ERROR_HAVE_NO_MEMORY(r->out.dns_domain_name);
     1980                        libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
     1981                        return WERR_OK;
    19791982                }
    19801983        }
    19811984#endif /* WITH_ADS */
     1985
     1986        /* The WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE flag really means
     1987           "disable".  */
     1988        if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) {
     1989                status = libnet_join_unjoindomain_rpc(mem_ctx, r);
     1990                if (!NT_STATUS_IS_OK(status)) {
     1991                        libnet_unjoin_set_error_string(mem_ctx, r,
     1992                                "failed to disable machine account via rpc: %s",
     1993                                get_friendly_nt_error_msg(status));
     1994                        if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
     1995                                return WERR_SETUP_NOT_JOINED;
     1996                        }
     1997                        return ntstatus_to_werror(status);
     1998                }
     1999
     2000                r->out.disabled_machine_account = true;
     2001        }
     2002
     2003        /* If disable succeeded or was not requested at all, we
     2004           should be getting rid of our end of things */
    19822005
    19832006        libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
Note: See TracChangeset for help on using the changeset viewer.