1/* 2 * Unix SMB/CIFS implementation. 3 * NetApi 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 <popt.h> 21 22void popt_common_callback(poptContext con, 23 enum poptCallbackReason reason, 24 const struct poptOption *opt, 25 const char *arg, const void *data); 26 27extern struct poptOption popt_common_netapi_examples[]; 28 29#define POPT_COMMON_LIBNETAPI_EXAMPLES { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_netapi_examples, 0, "Common samba netapi example options:", NULL }, 30 31NET_API_STATUS test_netuseradd(const char *hostname, 32 const char *username); 33 34NET_API_STATUS netapitest_localgroup(struct libnetapi_ctx *ctx, 35 const char *hostname); 36NET_API_STATUS netapitest_user(struct libnetapi_ctx *ctx, 37 const char *hostname); 38NET_API_STATUS netapitest_group(struct libnetapi_ctx *ctx, 39 const char *hostname); 40NET_API_STATUS netapitest_display(struct libnetapi_ctx *ctx, 41 const char *hostname); 42NET_API_STATUS netapitest_share(struct libnetapi_ctx *ctx, 43 const char *hostname); 44NET_API_STATUS netapitest_file(struct libnetapi_ctx *ctx, 45 const char *hostname); 46NET_API_STATUS netapitest_server(struct libnetapi_ctx *ctx, 47 const char *hostname); 48 49#ifndef ARRAY_SIZE 50#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) 51#endif 52 53#define NETAPI_STATUS(x,y,fn) \ 54 printf("FAILURE: line %d: %s failed with status: %s (%d)\n", \ 55 __LINE__, fn, libnetapi_get_error_string(x,y), y); 56 57#define NETAPI_STATUS_MSG(x,y,fn,z) \ 58 printf("FAILURE: line %d: %s failed with status: %s (%d), %s\n", \ 59 __LINE__, fn, libnetapi_get_error_string(x,y), y, z); 60 61#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) 62