From 1e4514a1edfdd1dde65a7567a7d7328de40e3493 Mon Sep 17 00:00:00 2001 From: bubulle Date: Mon, 6 Jul 2009 18:17:09 +0000 Subject: merge upstream 3.4.0 git-svn-id: svn://svn.debian.org/svn/pkg-samba/trunk/samba@2936 fc4039ab-9d04-0410-8cac-899223bdd6b0 --- source4/utils/testparm.c | 257 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 source4/utils/testparm.c (limited to 'source4/utils/testparm.c') diff --git a/source4/utils/testparm.c b/source4/utils/testparm.c new file mode 100644 index 0000000000..7f53eb5a52 --- /dev/null +++ b/source4/utils/testparm.c @@ -0,0 +1,257 @@ +/* + Unix SMB/CIFS implementation. + Test validity of smb.conf + Copyright (C) Karl Auer 1993, 1994-1998 + + Extensively modified by Andrew Tridgell, 1995 + Converted to popt by Jelmer Vernooij (jelmer@nl.linux.org), 2002 + Updated for Samba4 by Andrew Bartlett 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + * Testbed for loadparm.c/params.c + * + * This module simply loads a specified configuration file and + * if successful, dumps it's contents to stdout. Note that the + * operation is performed with DEBUGLEVEL at 3. + * + * Useful for a quick 'syntax check' of a configuration file. + * + */ + +#include "includes.h" +#include "system/filesys.h" +#include "lib/cmdline/popt_common.h" +#include "lib/socket/socket.h" +#include "param/param.h" +#include "param/loadparm.h" + + +/*********************************************** + Here we do a set of 'hard coded' checks for bad + configuration settings. +************************************************/ + +static int do_global_checks(struct loadparm_context *lp_ctx) +{ + int ret = 0; + + if (!directory_exist(lp_lockdir(lp_ctx))) { + fprintf(stderr, "ERROR: lock directory %s does not exist\n", + lp_lockdir(lp_ctx)); + ret = 1; + } + + if (!directory_exist(lp_piddir(lp_ctx))) { + fprintf(stderr, "ERROR: pid directory %s does not exist\n", + lp_piddir(lp_ctx)); + ret = 1; + } + + if (strlen(lp_winbind_separator(lp_ctx)) != 1) { + fprintf(stderr,"ERROR: the 'winbind separator' parameter must be a single character.\n"); + ret = 1; + } + + if (*lp_winbind_separator(lp_ctx) == '+') { + fprintf(stderr,"'winbind separator = +' might cause problems with group membership.\n"); + } + + return ret; +} + + +static int do_share_checks(struct loadparm_context *lp_ctx, const char *cname, const char *caddr, bool silent_mode, + bool show_defaults, const char *section_name, const char *parameter_name) +{ + int ret = 0; + int s; + + for (s=0;s 12) { + fprintf(stderr, "WARNING: You have some share names that are longer than 12 characters.\n" ); + fprintf(stderr, "These may not be accessible to some older clients.\n" ); + fprintf(stderr, "(Eg. Windows9x, WindowsMe, and not listed in smbclient in Samba 3.0.)\n" ); + break; + } + } + + for (s=0;s