/*
- Unix SMB/Netbios implementation.
- Version 1.9.
+ Unix SMB/CIFS implementation.
Test validity of smb.conf
Copyright (C) Karl Auer 1993, 1994-1998
#include "includes.h"
#include "smb.h"
-/* these live in util.c */
-extern FILE *dbf;
-extern int DEBUGLEVEL;
+extern BOOL AllowDebugChange;
/***********************************************
Here we do a set of 'hard coded' checks for bad
int ret = 0;
SMB_STRUCT_STAT st;
- if (lp_security() == SEC_DOMAIN && !lp_encrypted_passwords()) {
+ if (lp_security() >= SEC_DOMAIN && !lp_encrypted_passwords()) {
printf("ERROR: in 'security=domain' mode the 'encrypt passwords' parameter must also be set to 'true'.\n");
ret = 1;
}
- if (lp_wins_support() && *lp_wins_server()) {
+ if (lp_wins_support() && wins_srv_count()) {
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");
ret = 1;
ret = 1;
}
+ if (!directory_exist(lp_piddir(), &st)) {
+ printf("ERROR: pid directory %s does not exist\n",
+ lp_piddir());
+ ret = 1;
+ }
+
/*
* Password server sanity checks.
*/
- if((lp_security() == SEC_SERVER || lp_security() == SEC_DOMAIN) && !lp_passwordserver()) {
+ if((lp_security() == SEC_SERVER || lp_security() >= SEC_DOMAIN) && !lp_passwordserver()) {
pstring sec_setting;
if(lp_security() == SEC_SERVER)
pstrcpy(sec_setting, "server");
ret = 1;
}
+
+ /*
+ * Check 'hosts equiv' and 'use rhosts' compatibility with 'hostname lookup' value.
+ */
+
+ if(*lp_hosts_equiv() && !lp_hostname_lookups()) {
+ printf("ERROR: The setting 'hosts equiv = %s' requires that 'hostname lookups = yes'.\n", lp_hosts_equiv());
+ ret = 1;
+ }
+
/*
* Password chat sanity checks.
*/
if(lp_security() == SEC_USER && lp_unix_password_sync()) {
/*
- * Check that we have a valid lp_passwd_program().
+ * Check that we have a valid lp_passwd_program() if not using pam.
*/
- if(lp_passwd_program() == NULL) {
- printf("ERROR: the 'unix password sync' parameter is set and there is no valid 'passwd program' \
+#ifdef WITH_PAM
+ if (!lp_pam_password_change()) {
+#endif
+
+ if(lp_passwd_program() == NULL) {
+ printf("ERROR: the 'unix password sync' parameter is set and there is no valid 'passwd program' \
parameter.\n" );
- ret = 1;
- } else {
- pstring passwd_prog;
- pstring truncated_prog;
- char *p;
-
- pstrcpy( passwd_prog, lp_passwd_program());
- p = passwd_prog;
- *truncated_prog = '\0';
- next_token(&p, truncated_prog, NULL, sizeof(pstring));
-
- if(access(truncated_prog, F_OK) == -1) {
- printf("ERROR: the 'unix password sync' parameter is set and the 'passwd program' (%s) \
-cannot be executed (error was %s).\n", truncated_prog, strerror(errno) );
ret = 1;
+ } else {
+ pstring passwd_prog;
+ pstring truncated_prog;
+ char *p;
+
+ pstrcpy( passwd_prog, lp_passwd_program());
+ p = passwd_prog;
+ *truncated_prog = '\0';
+ next_token(&p, truncated_prog, NULL, sizeof(pstring));
+
+ if(access(truncated_prog, F_OK) == -1) {
+ printf("ERROR: the 'unix password sync' parameter is set and the 'passwd program' (%s) \
+cannot be executed (error was %s).\n", truncated_prog, strerror(errno) );
+ ret = 1;
+ }
}
+
+#ifdef WITH_PAM
}
+#endif
if(lp_passwd_chat() == NULL) {
printf("ERROR: the 'unix password sync' parameter is set and there is no valid 'passwd chat' \
}
}
- /*
- * WINS server line sanity checks.
- */
-
- if(*lp_wins_server()) {
- fstring server;
- int count = 0;
- char *p = lp_wins_server();
+ if (strlen(lp_winbind_separator()) != 1) {
+ printf("ERROR: the 'winbind separator' parameter must be a single character.\n");
+ ret = 1;
+ }
- while(next_token(&p,server,LIST_SEP,sizeof(server)))
- count++;
- if(count > 1) {
- printf("ERROR: the 'wins server' parameter must only contain one WINS server.\n");
- ret = -1;
- }
+ if (*lp_winbind_separator() == '+') {
+ printf("'winbind separator = +' might cause problems with group membership.\n");
}
return ret;
printf("\t-s Suppress prompt for enter\n");
printf("\t-h Print usage\n");
printf("\t-L servername Set %%L macro to servername\n");
+ printf("\t-t encoding Print parameters with encoding\n");
printf("\tconfigfilename Configuration file to test\n");
printf("\thostname hostIP. Hostname and Host IP address to test\n");
printf("\t against \"host allow\" and \"host deny\"\n");
int s;
BOOL silent_mode = False;
int ret = 0;
+ pstring term_code;
- TimeInit();
+ *term_code = 0;
setup_logging(argv[0],True);
- charset_initialise();
-
- while ((opt = getopt(argc, argv,"shL:")) != EOF) {
+ while ((opt = getopt(argc, argv,"shL:t:")) != EOF) {
switch (opt) {
case 's':
silent_mode = True;
usage(argv[0]);
exit(0);
break;
+ case 't':
+ pstrcpy(term_code,optarg);
+ break;
default:
printf("Incorrect program usage\n");
usage(argv[0]);
argc += (1 - optind);
if ((argc == 1) || (argc == 3))
- pstrcpy(configfile,CONFIGFILE);
+ pstrcpy(configfile, dyn_CONFIGFILE);
else if ((argc == 2) || (argc == 4))
pstrcpy(configfile,argv[optind]);
- dbf = stdout;
+ dbf = x_stdout;
DEBUGLEVEL = 2;
+ AllowDebugChange = False;
printf("Load smb config files from %s\n",configfile);
for (s=0;s<1000;s++) {
if (VALID_SNUM(s)) {
- char *deny_list = lp_hostsdeny(s);
- char *allow_list = lp_hostsallow(s);
+ char **deny_list = lp_hostsdeny(s);
+ char **allow_list = lp_hostsallow(s);
+ int i;
if(deny_list) {
- char *hasstar = strchr(deny_list, '*');
- char *hasquery = strchr(deny_list, '?');
- if(hasstar || hasquery) {
- printf("Invalid character %c in hosts deny list %s for service %s.\n",
- hasstar ? *hasstar : *hasquery, deny_list, lp_servicename(s) );
+ for (i=0; deny_list[i]; i++) {
+ char *hasstar = strchr_m(deny_list[i], '*');
+ char *hasquery = strchr_m(deny_list[i], '?');
+ if(hasstar || hasquery) {
+ printf("Invalid character %c in hosts deny list (%s) for service %s.\n",
+ hasstar ? *hasstar : *hasquery, deny_list[i], lp_servicename(s) );
+ }
}
}
if(allow_list) {
- char *hasstar = strchr(allow_list, '*');
- char *hasquery = strchr(allow_list, '?');
- if(hasstar || hasquery) {
- printf("Invalid character %c in hosts allow list %s for service %s.\n",
- hasstar ? *hasstar : *hasquery, allow_list, lp_servicename(s) );
+ for (i=0; allow_list[i]; i++) {
+ char *hasstar = strchr_m(allow_list[i], '*');
+ char *hasquery = strchr_m(allow_list[i], '?');
+ if(hasstar || hasquery) {
+ printf("Invalid character %c in hosts allow list (%s) for service %s.\n",
+ hasstar ? *hasstar : *hasquery, allow_list[i], lp_servicename(s) );
+ }
}
}