2 Unix SMB/Netbios implementation.
4 Test validity of smb.conf
5 Copyright (C) Karl Auer 1993, 1994-1998
7 Extensively modified by Andrew Tridgell, 1995
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * Testbed for loadparm.c/params.c
27 * This module simply loads a specified configuration file and
28 * if successful, dumps it's contents to stdout. Note that the
29 * operation is performed with DEBUGLEVEL at 3.
31 * Useful for a quick 'syntax check' of a configuration file.
38 /* these live in util.c */
40 extern int DEBUGLEVEL;
41 extern pstring myhostname;
43 /***********************************************
44 Here we do a set of 'hard coded' checks for bad
45 configuration settings.
46 ************************************************/
48 void do_global_checks(void)
50 if(lp_security() > SEC_SHARE && lp_revalidate(-1))
51 printf("WARNING: the 'revalidate' parameter is ignored in all but \
52 'security=share' mode.\n");
54 if( lp_wins_support() && *lp_wins_server() )
55 printf("ERROR: both 'wins support = true' and 'wins server = <server>' \
56 cannot be set in the smb.conf file. nmbd will abort with this setting.\n");
59 int main(int argc, char *argv[])
66 setup_logging(argv[0],True);
71 pstrcpy(configfile,CONFIGFILE);
73 pstrcpy(configfile,argv[1]);
78 printf("Load smb config files from %s\n",configfile);
80 if(!get_myname(myhostname,NULL))
82 printf("Failed to get my hostname.\n");
86 if (!lp_load(configfile,False,True,False))
88 printf("Error loading services.\n");
93 printf("Loaded services file OK.\n");
99 if (strlen(lp_servicename(s)) > 8) {
100 printf("WARNING: You have some share names that are longer than 8 chars\n");
101 printf("These may give errors while browsing or may not be accessible\nto some older clients\n");
107 printf("Press enter to see a dump of your service definitions\n");
110 lp_dump(stdout,False);
115 char *cname = argv[2];
116 char *caddr = argv[3];
118 /* this is totally ugly, a real `quick' hack */
122 if (allow_access(lp_hostsdeny(s),lp_hostsallow(s),cname,caddr))
124 printf("Allow connection from %s (%s) to %s\n",
125 cname,caddr,lp_servicename(s));
129 printf("Deny connection from %s (%s) to %s\n",
130 cname,caddr,lp_servicename(s));