tests/krb5: Fix method for creating invalid length zeroed checksum
[Samba.git] / source3 / winbindd / winbindd_change_machine_acct.c
blob83eb99ba64ae7a10c24dadd0e0d0602250144c02
1 /*
2 Unix SMB/CIFS implementation.
3 async implementation of WINBINDD_CHANGE_MACHINE_ACCT
4 Copyright (C) Volker Lendecke 2009
5 Copyright (C) Guenther Deschner 2009
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
22 #include "winbindd.h"
23 #include "librpc/gen_ndr/ndr_winbind_c.h"
25 struct winbindd_change_machine_acct_state {
26 uint8_t dummy;
29 static void winbindd_change_machine_acct_done(struct tevent_req *subreq);
31 struct tevent_req *winbindd_change_machine_acct_send(TALLOC_CTX *mem_ctx,
32 struct tevent_context *ev,
33 struct winbindd_cli_state *cli,
34 struct winbindd_request *request)
36 struct tevent_req *req, *subreq;
37 struct winbindd_change_machine_acct_state *state;
38 struct winbindd_domain *domain;
40 req = tevent_req_create(mem_ctx, &state,
41 struct winbindd_change_machine_acct_state);
42 if (req == NULL) {
43 return NULL;
46 domain = find_domain_from_name(request->domain_name);
47 if (domain == NULL) {
48 tevent_req_nterror(req, NT_STATUS_NO_SUCH_DOMAIN);
49 return tevent_req_post(req, ev);
51 if (domain->internal) {
53 * Internal domains are passdb based, we can always
54 * contact them.
56 * This also protects us from changing the password on
57 * the AD DC without updating all the right databases.
58 * Do not remove this until that code is fixed.
60 tevent_req_done(req);
61 return tevent_req_post(req, ev);
64 subreq = dcerpc_wbint_ChangeMachineAccount_send(state, ev,
65 dom_child_handle(domain));
66 if (tevent_req_nomem(subreq, req)) {
67 return tevent_req_post(req, ev);
69 tevent_req_set_callback(subreq, winbindd_change_machine_acct_done, req);
70 return req;
73 static void winbindd_change_machine_acct_done(struct tevent_req *subreq)
75 struct tevent_req *req = tevent_req_callback_data(
76 subreq, struct tevent_req);
77 struct winbindd_change_machine_acct_state *state = tevent_req_data(
78 req, struct winbindd_change_machine_acct_state);
79 NTSTATUS status, result;
81 status = dcerpc_wbint_ChangeMachineAccount_recv(subreq, state, &result);
82 if (any_nt_status_not_ok(status, result, &status)) {
83 tevent_req_nterror(req, status);
84 return;
86 tevent_req_done(req);
89 NTSTATUS winbindd_change_machine_acct_recv(struct tevent_req *req,
90 struct winbindd_response *presp)
92 return tevent_req_simple_recv_ntstatus(req);