diff options
Diffstat (limited to 'source/utils/testparm.c')
-rw-r--r-- | source/utils/testparm.c | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/source/utils/testparm.c b/source/utils/testparm.c index e1f070a4b83..6697dc7fd9d 100644 --- a/source/utils/testparm.c +++ b/source/utils/testparm.c @@ -2,7 +2,7 @@ Unix SMB/Netbios implementation. Version 1.9. Test validity of smb.conf - Copyright (C) Karl Auer 1993, 1994 + Copyright (C) Karl Auer 1993, 1994-1998 Extensively modified by Andrew Tridgell, 1995 @@ -34,33 +34,66 @@ #include "includes.h" #include "smb.h" -#include "params.h" -#include "loadparm.h" /* these live in util.c */ extern FILE *dbf; extern int DEBUGLEVEL; +extern pstring myhostname; -int main(int argc, char *argv[]) +/*********************************************** + Here we do a set of 'hard coded' checks for bad + configuration settings. +************************************************/ +static void do_global_checks(void) +{ + SMB_STRUCT_STAT st; + if (lp_security() > SEC_SHARE && lp_revalidate(-1)) { + printf("WARNING: the 'revalidate' parameter is ignored in all but \ +'security=share' mode.\n"); + } + + if (lp_wins_support() && *lp_wins_server()) { + printf("ERROR: both 'wins support = true' and 'wins server = <server>' \ +cannot be set in the smb.conf file. nmbd will abort with this setting.\n"); + } + + if (!directory_exist(lp_lockdir(), &st)) { + printf("ERROR: lock directory %s does not exist\n", + lp_lockdir()); + } else if ((st.st_mode & 0777) != 0755) { + printf("WARNING: lock directory %s should have permissions 0755 for browsing to work\n", + lp_lockdir()); + } +} + + int main(int argc, char *argv[]) { pstring configfile; int s; + TimeInit(); + setup_logging(argv[0],True); charset_initialise(); if (argc < 2) - strcpy(configfile,CONFIGFILE); + pstrcpy(configfile,CONFIGFILE); else - strcpy(configfile,argv[1]); + pstrcpy(configfile,argv[1]); dbf = stdout; DEBUGLEVEL = 2; printf("Load smb config files from %s\n",configfile); - if (!lp_load(configfile,False)) + if(!get_myname(myhostname,NULL)) + { + printf("Failed to get my hostname.\n"); + return(1); + } + + if (!lp_load(configfile,False,True,False)) { printf("Error loading services.\n"); return(1); @@ -69,6 +102,8 @@ int main(int argc, char *argv[]) printf("Loaded services file OK.\n"); + do_global_checks(); + for (s=0;s<1000;s++) if (VALID_SNUM(s)) if (strlen(lp_servicename(s)) > 8) { @@ -82,28 +117,27 @@ int main(int argc, char *argv[]) printf("Press enter to see a dump of your service definitions\n"); fflush(stdout); getc(stdin); - lp_dump(); + lp_dump(stdout,True); } if (argc == 4) { - struct from_host f; - f.name = argv[2]; - f.addr = argv[3]; + char *cname = argv[2]; + char *caddr = argv[3]; /* this is totally ugly, a real `quick' hack */ for (s=0;s<1000;s++) if (VALID_SNUM(s)) { - if (allow_access(lp_hostsdeny(s),lp_hostsallow(s),&f)) + if (allow_access(lp_hostsdeny(s),lp_hostsallow(s),cname,caddr)) { printf("Allow connection from %s (%s) to %s\n", - f.name,f.addr,lp_servicename(s)); + cname,caddr,lp_servicename(s)); } else { printf("Deny connection from %s (%s) to %s\n", - f.name,f.addr,lp_servicename(s)); + cname,caddr,lp_servicename(s)); } } } |