Changeset 335 for branches/samba-3.2.x/source/libnet
- Timestamp:
- Sep 24, 2009, 9:15:13 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/libnet/libnet_join.c
r232 r335 1836 1836 } 1837 1837 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 1838 1844 if (!r->in.dc_name) { 1839 1845 struct netr_DsRGetDCNameInfo *info; … … 1861 1867 } 1862 1868 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 1876 1869 #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) { 1878 1875 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 } 1881 1885 if (!ADS_ERR_OK(ads_status)) { 1882 1886 libnet_unjoin_set_error_string(mem_ctx, r, … … 1885 1889 } else { 1886 1890 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);1890 1891 W_ERROR_HAVE_NO_MEMORY(r->out.dns_domain_name); 1892 libnet_join_unjoindomain_remove_secrets(mem_ctx, r); 1893 return WERR_OK; 1891 1894 } 1892 1895 } 1893 1896 #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 */ 1894 1917 1895 1918 libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
Note:
See TracChangeset
for help on using the changeset viewer.