s3:nmbd: s/struct event_context/struct tevent_context
[Samba/gebeck_regimport.git] / source3 / lib / netapi / tests / netserver.c
blobf7b9286be644ab139b68f21f192ba701ea7912d6
1 /*
2 * Unix SMB/CIFS implementation.
3 * NetServer testsuite
4 * Copyright (C) Guenther Deschner 2008
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include <sys/types.h>
21 #include <inttypes.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
26 #include <netapi.h>
28 #include "common.h"
30 NET_API_STATUS netapitest_server(struct libnetapi_ctx *ctx,
31 const char *hostname)
33 NET_API_STATUS status = 0;
34 uint32_t levels[] = { 100, 101, 102, 402, 403, 502, 503, 1005 };
35 int i;
37 printf("NetServer tests\n");
39 /* basic queries */
40 for (i=0; i<ARRAY_SIZE(levels); i++) {
41 uint8_t *buffer = NULL;
42 printf("testing NetServerGetInfo level %d\n", levels[i]);
44 status = NetServerGetInfo(hostname, levels[i], &buffer);
45 if (status && status != 124) {
46 NETAPI_STATUS(ctx, status, "NetServerGetInfo");
47 goto out;
51 status = 0;
53 printf("NetServer tests succeeded\n");
54 out:
55 if (status != 0) {
56 printf("NetServer testsuite failed with: %s\n",
57 libnetapi_get_error_string(ctx, status));
60 return status;