Changeset 309 for branches/samba-3.3.x/source/libnet/libnet_join.c
- Timestamp:
- Aug 4, 2009, 8:51:22 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/libnet/libnet_join.c
r224 r309 1924 1924 } 1925 1925 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 1926 1932 if (!r->in.dc_name) { 1927 1933 struct netr_DsRGetDCNameInfo *info; … … 1949 1955 } 1950 1956 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 1964 1957 #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) { 1966 1963 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 } 1969 1973 if (!ADS_ERR_OK(ads_status)) { 1970 1974 libnet_unjoin_set_error_string(mem_ctx, r, … … 1973 1977 } else { 1974 1978 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);1978 1979 W_ERROR_HAVE_NO_MEMORY(r->out.dns_domain_name); 1980 libnet_join_unjoindomain_remove_secrets(mem_ctx, r); 1981 return WERR_OK; 1979 1982 } 1980 1983 } 1981 1984 #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 */ 1982 2005 1983 2006 libnet_join_unjoindomain_remove_secrets(mem_ctx, r);
Note:
See TracChangeset
for help on using the changeset viewer.