Ignore:
Timestamp:
Sep 24, 2009, 9:15:13 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 to 3.2.14 (final)

File:
1 edited

Legend:

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

    r232 r335  
    18361836        }
    18371837
     1838        if (!(r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) &&
     1839            !r->in.delete_machine_account) {
     1840                libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
     1841                return WERR_OK;
     1842        }
     1843
    18381844        if (!r->in.dc_name) {
    18391845                struct netr_DsRGetDCNameInfo *info;
     
    18611867        }
    18621868
    1863         status = libnet_join_unjoindomain_rpc(mem_ctx, r);
    1864         if (!NT_STATUS_IS_OK(status)) {
    1865                 libnet_unjoin_set_error_string(mem_ctx, r,
    1866                         "failed to disable machine account via rpc: %s",
    1867                         get_friendly_nt_error_msg(status));
    1868                 if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
    1869                         return WERR_SETUP_NOT_JOINED;
    1870                 }
    1871                 return ntstatus_to_werror(status);
    1872         }
    1873 
    1874         r->out.disabled_machine_account = true;
    1875 
    18761869#ifdef WITH_ADS
    1877         if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) {
     1870        /* for net ads leave, try to delete the account.  If it works,
     1871           no sense in disabling.  If it fails, we can still try to
     1872           disable it. jmcd */
     1873
     1874        if (r->in.delete_machine_account) {
    18781875                ADS_STATUS ads_status;
    1879                 libnet_unjoin_connect_ads(mem_ctx, r);
    1880                 ads_status = libnet_unjoin_remove_machine_acct(mem_ctx, r);
     1876                ads_status = libnet_unjoin_connect_ads(mem_ctx, r);
     1877                if (ADS_ERR_OK(ads_status)) {
     1878                        /* dirty hack */
     1879                        r->out.dns_domain_name =
     1880                                talloc_strdup(mem_ctx,
     1881                                              r->in.ads->server.realm);
     1882                        ads_status =
     1883                                libnet_unjoin_remove_machine_acct(mem_ctx, r);
     1884                }
    18811885                if (!ADS_ERR_OK(ads_status)) {
    18821886                        libnet_unjoin_set_error_string(mem_ctx, r,
     
    18851889                } else {
    18861890                        r->out.deleted_machine_account = true;
    1887                         /* dirty hack */
    1888                         r->out.dns_domain_name = talloc_strdup(mem_ctx,
    1889                                                                r->in.ads->server.realm);
    18901891                        W_ERROR_HAVE_NO_MEMORY(r->out.dns_domain_name);
     1892                        libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
     1893                        return WERR_OK;
    18911894                }
    18921895        }
    18931896#endif /* WITH_ADS */
     1897
     1898        /* The WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE flag really means
     1899           "disable".  */
     1900        if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE) {
     1901                status = libnet_join_unjoindomain_rpc(mem_ctx, r);
     1902                if (!NT_STATUS_IS_OK(status)) {
     1903                        libnet_unjoin_set_error_string(mem_ctx, r,
     1904                                "failed to disable machine account via rpc: %s",
     1905                                get_friendly_nt_error_msg(status));
     1906                        if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
     1907                                return WERR_SETUP_NOT_JOINED;
     1908                        }
     1909                        return ntstatus_to_werror(status);
     1910                }
     1911
     1912                r->out.disabled_machine_account = true;
     1913        }
     1914
     1915        /* If disable succeeded or was not requested at all, we
     1916           should be getting rid of our end of things */
    18941917
    18951918        libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
Note: See TracChangeset for help on using the changeset viewer.