2 Unix SMB/CIFS mplementation.
6 Copyright (C) Andrew Tridgell 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include "libcli/cldap/cldap.h"
26 #include "libcli/ldap/ldap.h"
27 #include "lib/events/events.h"
31 test netlogon operations
33 static BOOL test_cldap_netlogon(TALLOC_CTX *mem_ctx, const char *dest)
35 struct cldap_socket *cldap = cldap_socket_init(mem_ctx, NULL);
37 struct cldap_netlogon search;
40 search.in.dest_address = dest;
41 search.in.realm = lp_realm();
42 search.in.host = lp_netbios_name();
43 search.in.version = 6;
44 status = cldap_netlogon(cldap, mem_ctx, &search);
46 if (!NT_STATUS_IS_OK(status)) {
47 printf("netlogon failed - %s\n", nt_errstr(status));
49 NDR_PRINT_DEBUG(nbt_cldap_netlogon, &search.out.netlogon);
53 search.in.version = i;
54 status = cldap_netlogon(cldap, mem_ctx, &search);
55 if (!NT_STATUS_IS_OK(status)) {
56 printf("netlogon[%d] failed - %s\n", i, nt_errstr(status));
58 NDR_PRINT_DEBUG(nbt_cldap_netlogon, &search.out.netlogon);
62 printf("cldap_search gave %s\n", nt_errstr(status));
67 BOOL torture_cldap(void)
71 const char *host = lp_parm_string(-1, "torture", "host");
73 mem_ctx = talloc_init("torture_cldap");
75 ret &= test_cldap_netlogon(mem_ctx, host);