source: branches/samba-3.5.x/source3/lib/netapi/tests/netserver.c

Last change on this file was 414, checked in by Herwig Bauernfeind, 15 years ago

Samba 3.5.0: Initial import

File size: 1.6 KB
Line 
1/*
2 * Unix SMB/CIFS implementation.
3 * NetServer testsuite
4 * Copyright (C) Guenther Deschner 2008
5 *
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.
10 *
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.
15 *
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/>.
18 */
19
20#include <sys/types.h>
21#include <inttypes.h>
22#include <stdio.h>
23#include <stdlib.h>
24#include <string.h>
25
26#include <netapi.h>
27
28#include "common.h"
29
30NET_API_STATUS netapitest_server(struct libnetapi_ctx *ctx,
31 const char *hostname)
32{
33 NET_API_STATUS status = 0;
34 uint32_t levels[] = { 100, 101, 102, 402, 403, 502, 503, 1005 };
35 int i;
36
37 printf("NetServer tests\n");
38
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]);
43
44 status = NetServerGetInfo(hostname, levels[i], &buffer);
45 if (status && status != 124) {
46 NETAPI_STATUS(ctx, status, "NetServerGetInfo");
47 goto out;
48 }
49 }
50
51 status = 0;
52
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));
58 }
59
60 return status;
61}
Note: See TracBrowser for help on using the repository browser.