Hi, Here are some of the patches that were still in my queue:
pdb_test.diff - Some extra comments
pdb_init_sam_talloc.diff - Change names used in DEBUG() statements
pdb_fix.diff - Always fail when initialising one of the pdb backends
fails
These are not 100% tested:
lp_passdb_backend_list.diff - Make the 'passdb backend' parameter a
list instead of a string
pdb_smbpasswd.diff - Make pdb_smbpasswd use pdb_sethexpwd and
pdb_gethexpwd
testparm_popt1.diff - POPT'ify testparm
Jelmer
--
Jelmer Vernooij <[EMAIL PROTECTED]> - http://nl.linux.org/~jelmer/
Development And Underdevelopment: http://library.thinkquest.org/C0110231/
Listening to Radio 3FM
17:02:25 up 23:15, 8 users, load average: 0.19, 0.11, 0.04
Index: source/passdb/pdb_interface.c
===================================================================
RCS file: /cvsroot/samba/source/passdb/pdb_interface.c,v
retrieving revision 1.16
diff -u -3 -p -r1.16 pdb_interface.c
--- source/passdb/pdb_interface.c 26 May 2002 19:11:52 -0000 1.16
+++ source/passdb/pdb_interface.c 13 Jun 2002 15:03:58 -0000
@@ -252,22 +252,17 @@ static NTSTATUS make_pdb_methods_name(st
if (NT_STATUS_IS_OK(nt_status
=
builtin_pdb_init_functions[i].init(context, methods, module_location))) {
DEBUG(5,("pdb backend %s has a valid init\n",
selected));
+ return nt_status;
} else {
DEBUG(0,("pdb backend %s did not correctly init (error
was %s)\n", selected, nt_errstr(nt_status)));
+ return nt_status;
}
break;
}
}
- if (!*methods) {
- DEBUG(0,("failed to select passdb backed!\n"));
- if (NT_STATUS_IS_OK(nt_status)) {
- return NT_STATUS_INVALID_PARAMETER;
- } else {
- return nt_status;
- }
- }
- return NT_STATUS_OK;
+ /* No such backend found */
+ return NT_STATUS_UNSUCCESSFUL;
}
/******************************************************************
@@ -304,11 +299,8 @@ static NTSTATUS make_pdb_context(struct
(*context)->pdb_update_sam_account = context_update_sam_account;
(*context)->pdb_delete_sam_account = context_delete_sam_account;
- (*context)->pdb_methods = NULL;
- (*context)->pwent_methods = NULL;
-
(*context)->free_fn = free_pdb_context;
return NT_STATUS_OK;
}
Index: examples/pdb/pdb_test.c
===================================================================
RCS file: /cvsroot/samba/examples/pdb/pdb_test.c,v
retrieving revision 1.2
diff -u -3 -p -r1.2 pdb_test.c
--- examples/pdb/pdb_test.c 24 May 2002 09:57:47 -0000 1.2
+++ examples/pdb/pdb_test.c 13 Jun 2002 15:03:55 -0000
@@ -23,6 +23,10 @@ static int testsam_debug_level = DBGC_AL
#undef DBGC_CLASS
#define DBGC_CLASS testsam_debug_level
+/***************************************************************
+ Start enumeration of the passwd list.
+****************************************************************/
+
static BOOL testsam_setsampwent(struct pdb_methods *methods, BOOL update)
{
DEBUG(10, ("testsam_setsampwent called\n"));
@@ -107,6 +111,9 @@ NTSTATUS pdb_init(PDB_CONTEXT *pdb_conte
}
(*pdb_method)->name = "testsam";
+
+ /* Functions your pdb module doesn't provide should be set
+ * to NULL */
(*pdb_method)->setsampwent = testsam_setsampwent;
(*pdb_method)->endsampwent = testsam_endsampwent;
Index: source/passdb/pdb_smbpasswd.c
===================================================================
RCS file: /cvsroot/samba/source/passdb/pdb_smbpasswd.c,v
retrieving revision 1.48
diff -u -3 -p -r1.48 pdb_smbpasswd.c
--- source/passdb/pdb_smbpasswd.c 13 Jun 2002 14:06:08 -0000 1.48
+++ source/passdb/pdb_smbpasswd.c 13 Jun 2002 15:20:50 -0000
@@ -510,7 +510,6 @@ static char *format_new_smbpasswd_entry(
int new_entry_length;
char *new_entry;
char *p;
- int i;
new_entry_length = strlen(newpwd->smb_name) + 1 + 15 + 1 + 32 + 1 + 32 + 1 +
NEW_PW_FORMAT_SPACE_PADDED_LEN + 1 + 13 + 2;
@@ -520,43 +519,22 @@ static char *format_new_smbpasswd_entry(
}
slprintf(new_entry, new_entry_length - 1, "%s:%u:", newpwd->smb_name,
(unsigned)newpwd->smb_userid);
- p = &new_entry[strlen(new_entry)];
- if(newpwd->smb_passwd != NULL) {
- for( i = 0; i < 16; i++) {
- slprintf((char *)&p[i*2], new_entry_length - (p - new_entry) - 1, "%02X",
newpwd->smb_passwd[i]);
- }
- } else {
- i=0;
- if(newpwd->acct_ctrl & ACB_PWNOTREQ)
- safe_strcpy((char *)p, "NO PASSWORDXXXXXXXXXXXXXXXXXXXXX", new_entry_length - 1
- (p - new_entry));
- else
- safe_strcpy((char *)p, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new_entry_length - 1
- (p - new_entry));
- }
+ p = new_entry+strlen(new_entry);
- p += 32;
+ pdb_sethexpwd(p, newpwd->smb_passwd, newpwd->acct_ctrl);
- *p++ = ':';
-
- if(newpwd->smb_nt_passwd != NULL) {
- for( i = 0; i < 16; i++) {
- slprintf((char *)&p[i*2], new_entry_length - 1 - (p - new_entry), "%02X",
newpwd->smb_nt_passwd[i]);
- }
- } else {
- if(newpwd->acct_ctrl & ACB_PWNOTREQ)
- safe_strcpy((char *)p, "NO PASSWORDXXXXXXXXXXXXXXXXXXXXX", new_entry_length - 1
- (p - new_entry));
- else
- safe_strcpy((char *)p, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new_entry_length - 1
- (p - new_entry));
- }
+ p+=strlen(p); *p =':';
- p += 32;
+ pdb_sethexpwd(p, newpwd->smb_nt_passwd, newpwd->acct_ctrl);
- *p++ = ':';
+ p+=strlen(p); *p++ = ':';
/* Add the account encoding and the last change time. */
slprintf((char *)p, new_entry_length - 1 - (p - new_entry), "%s:LCT-%08X:\n",
pdb_encode_acct_ctrl(newpwd->acct_ctrl, NEW_PW_FORMAT_SPACE_PADDED_LEN),
(uint32)newpwd->pass_last_set_time);
+ printf("%s\n", new_entry);
return new_entry;
}
@@ -959,30 +937,12 @@ static BOOL mod_smbfilepwd_entry(struct
/* Entry is correctly formed. */
/* Create the 32 byte representation of the new p16 */
- if(pwd->smb_passwd != NULL) {
- for (i = 0; i < 16; i++) {
- slprintf(&ascii_p16[i*2], sizeof(fstring) - 1, "%02X", (uchar)
pwd->smb_passwd[i]);
- }
- } else {
- if(pwd->acct_ctrl & ACB_PWNOTREQ)
- fstrcpy(ascii_p16, "NO PASSWORDXXXXXXXXXXXXXXXXXXXXX");
- else
- fstrcpy(ascii_p16, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
- }
+ pdb_sethexpwd(ascii_p16, pwd->smb_passwd, pwd->acct_ctrl);
/* Add on the NT md4 hash */
ascii_p16[32] = ':';
wr_len = 66;
- if (pwd->smb_nt_passwd != NULL) {
- for (i = 0; i < 16; i++) {
- slprintf(&ascii_p16[(i*2)+33], sizeof(fstring) - 1, "%02X", (uchar)
pwd->smb_nt_passwd[i]);
- }
- } else {
- if(pwd->acct_ctrl & ACB_PWNOTREQ)
- fstrcpy(&ascii_p16[33], "NO PASSWORDXXXXXXXXXXXXXXXXXXXXX");
- else
- fstrcpy(&ascii_p16[33], "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
- }
+ pdb_sethexpwd(ascii_p16+33, pwd->smb_nt_passwd, pwd->acct_ctrl);
ascii_p16[65] = ':';
ascii_p16[66] = '\0'; /* null-terminate the string so that strlen works */
Index: source/passdb/passdb.c
===================================================================
RCS file: /cvsroot/samba/source/passdb/passdb.c,v
retrieving revision 1.158
diff -u -3 -p -r1.158 passdb.c
--- source/passdb/passdb.c 13 Jun 2002 14:06:08 -0000 1.158
+++ source/passdb/passdb.c 13 Jun 2002 15:03:58 -0000
@@ -93,7 +93,7 @@ static void destroy_pdb_talloc(SAM_ACCOU
NTSTATUS pdb_init_sam_talloc(TALLOC_CTX *mem_ctx, SAM_ACCOUNT **user)
{
if (*user != NULL) {
- DEBUG(0,("pdb_init_sam: SAM_ACCOUNT was non NULL\n"));
+ DEBUG(0,("pdb_init_sam_talloc: SAM_ACCOUNT was non NULL\n"));
#if 0
smb_panic("non-NULL pointer passed to pdb_init_sam\n");
#endif
@@ -108,7 +108,7 @@ NTSTATUS pdb_init_sam_talloc(TALLOC_CTX
*user=(SAM_ACCOUNT *)talloc(mem_ctx, sizeof(SAM_ACCOUNT));
if (*user==NULL) {
- DEBUG(0,("pdb_init_sam: error while allocating memory\n"));
+ DEBUG(0,("pdb_init_sam_talloc: error while allocating memory\n"));
return NT_STATUS_NO_MEMORY;
}
Index: source/param/loadparm.c
===================================================================
RCS file: /cvsroot/samba/source/param/loadparm.c,v
retrieving revision 1.410
diff -u -3 -p -r1.410 loadparm.c
--- source/param/loadparm.c 11 Jun 2002 22:54:06 -0000 1.410
+++ source/param/loadparm.c 13 Jun 2002 15:20:49 -0000
@@ -110,7 +110,7 @@ typedef struct
char *szConfigFile;
char *szSMBPasswdFile;
char *szPrivateDir;
- char *szPassdbBackend;
+ char **szPassdbBackend;
char *szPasswordServer;
char *szSocketOptions;
char *szWorkGroup;
@@ -690,7 +690,7 @@ static struct parm_struct parm_table[] =
{"password server", P_STRING, P_GLOBAL, &Globals.szPasswordServer, NULL, NULL,
0},
{"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL,
0},
{"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, 0},
- {"passdb backend", P_STRING, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL,
0},
+ {"passdb backend", P_LIST, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, 0},
{"non unix account range", P_STRING, P_GLOBAL, &Globals.szNonUnixAccountRange,
handle_non_unix_account_range, NULL, 0},
{"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.bAlgorithmicRidBase,
NULL, NULL, 0},
{"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, 0},
@@ -1186,7 +1186,7 @@ static void init_globals(void)
string_set(&Globals.szSMBPasswdFile, dyn_SMB_PASSWD_FILE);
string_set(&Globals.szPrivateDir, dyn_PRIVATE_DIR);
- string_set(&Globals.szPassdbBackend, "smbpasswd unixsam");
+ Globals.szPassdbBackend = lp_list_make("smbpasswd unixsam");
/* use the new 'hash2' method by default */
string_set(&Globals.szManglingMethod, "hash2");
@@ -1446,7 +1446,6 @@ FN_GLOBAL_STRING(lp_logfile, &Globals.sz
FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
-FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
FN_GLOBAL_STRING(lp_printcapname, &Globals.szPrintcapname)
FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
@@ -1488,6 +1487,7 @@ FN_GLOBAL_STRING(lp_socket_address, &Glo
FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
+FN_GLOBAL_LIST(lp_passdb_backend, &Globals.szPassdbBackend)
FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
Index: source/passdb/pdb_interface.c
===================================================================
RCS file: /cvsroot/samba/source/passdb/pdb_interface.c,v
retrieving revision 1.16
diff -u -3 -p -r1.16 pdb_interface.c
--- source/passdb/pdb_interface.c 26 May 2002 19:11:52 -0000 1.16
+++ source/passdb/pdb_interface.c 13 Jun 2002 15:20:50 -0000
@@ -312,12 +299,10 @@ static NTSTATUS make_pdb_context(struct
/******************************************************************
- Make a pdb_context, given a text string.
+ Make a pdb_context, given an array of strings
*******************************************************************/
-NTSTATUS make_pdb_context_name(struct pdb_context **context, const char *selected)
+NTSTATUS make_pdb_context_list(struct pdb_context **context, char **selected)
{
- /* HINT: Don't store 'selected' becouse its often an lp_ string and will 'go
away' */
- char *conf = smb_xstrdup(selected);
- char *confcur = conf, *confnext;
+ int i = 0;
struct pdb_methods *curmethods, *tmpmethods;
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
@@ -329,31 +318,34 @@ NTSTATUS make_pdb_context_name(struct pd
return nt_status;
}
- while(confcur){
- if(strchr(confcur, ' ')){
- confnext = strchr(confcur,' ');
- *confnext = '\0';
- confnext++;
- }else confnext = NULL;
-
+ while(selected[i]){
/* Try to initialise pdb */
- DEBUG(5,("Trying to load: %s\n", confcur));
- if(!NT_STATUS_IS_OK(make_pdb_methods_name(&curmethods, *context,
confcur))){
- DEBUG(5, ("Loading %s failed!\n", confcur));
+ DEBUG(5,("Trying to load: %s\n", selected[i]));
+ if(!NT_STATUS_IS_OK(nt_status = make_pdb_methods_name(&curmethods,
+*context, selected[i]))){
+ DEBUG(5, ("Loading %s failed!\n", selected[i]));
SAFE_FREE(curmethods);
- continue;
+ free_pdb_context(context);
+ return nt_status;
}
curmethods->parent = *context;
DLIST_ADD_END((*context)->pdb_methods, curmethods, tmpmethods);
-
- if(!confnext)break;
- confcur = confnext;
+ i++;
}
- SAFE_FREE(conf);
- nt_status = NT_STATUS_OK;
+ return NT_STATUS_OK;
+}
+
+/******************************************************************
+ Make a pdb_context, given a text string.
+ *******************************************************************/
- return nt_status;
+NTSTATUS make_pdb_context_string(struct pdb_context **context, const char *selected)
+{
+ NTSTATUS ret;
+ char **newsel = lp_list_make(selected);
+ ret = make_pdb_context_list(context, newsel);
+ lp_list_free(&newsel);
+ return ret;
}
/******************************************************************
@@ -367,13 +359,13 @@ static struct pdb_context *pdb_get_stati
if ((pdb_context) && (reload)) {
pdb_context->free_fn(&pdb_context);
- if (!NT_STATUS_IS_OK(make_pdb_context_name(&pdb_context,
lp_passdb_backend()))) {
+ if (!NT_STATUS_IS_OK(make_pdb_context_list(&pdb_context,
+lp_passdb_backend()))) {
return NULL;
}
}
if (!pdb_context) {
- if (!NT_STATUS_IS_OK(make_pdb_context_name(&pdb_context,
lp_passdb_backend()))) {
+ if (!NT_STATUS_IS_OK(make_pdb_context_list(&pdb_context,
+lp_passdb_backend()))) {
return NULL;
}
}
Index: source/utils/pdbedit.c
===================================================================
RCS file: /cvsroot/samba/source/utils/pdbedit.c,v
retrieving revision 1.47
diff -u -3 -p -r1.47 pdbedit.c
--- source/utils/pdbedit.c 13 Jun 2002 14:06:08 -0000 1.47
+++ source/utils/pdbedit.c 13 Jun 2002 15:20:51 -0000
@@ -34,7 +34,7 @@ int export_database (struct pdb_context
struct pdb_context *context;
SAM_ACCOUNT *user = NULL;
- if (!NT_STATUS_IS_OK(make_pdb_context_name(&context, db))){
+ if (!NT_STATUS_IS_OK(make_pdb_context_string(&context, db))){
fprintf(stderr, "Can't initialize %s.\n", db);
return 1;
}
@@ -457,10 +457,6 @@ int main (int argc, char **argv)
}
- if (!backend_in) {
- backend_in = lp_passdb_backend();
- }
-
setparms = (full_name || home_dir || home_drive || logon_script ||
profile_path);
if (((add_user?1:0) + (delete_user?1:0) + (list_users?1:0) + (import?1:0) +
(setparms?1:0)) + (backend_out?1:0) > 1) {
@@ -468,10 +464,16 @@ int main (int argc, char **argv)
exit(1);
}
-
- if (!NT_STATUS_IS_OK(make_pdb_context_name(&in, backend_in))){
- fprintf(stderr, "Can't initialize %s.\n", backend_in);
- return 1;
+ if (!backend_in) {
+ if (!NT_STATUS_IS_OK(make_pdb_context_list(&in, lp_passdb_backend()))){
+ fprintf(stderr, "Can't initialize passdb backend.\n");
+ return 1;
+ }
+ } else {
+ if (!NT_STATUS_IS_OK(make_pdb_context_string(&in, backend_in))){
+ fprintf(stderr, "Can't initialize passdb backend.\n");
+ return 1;
+ }
}
if (add_user) {
Index: source/utils/testparm.c
===================================================================
RCS file: /cvsroot/samba/source/utils/testparm.c,v
retrieving revision 1.47
diff -u -3 -p -r1.47 testparm.c
--- source/utils/testparm.c 9 May 2002 04:07:49 -0000 1.47
+++ source/utils/testparm.c 13 Jun 2002 15:20:51 -0000
@@ -4,6 +4,7 @@
Copyright (C) Karl Auer 1993, 1994-1998
Extensively modified by Andrew Tridgell, 1995
+ Converted to popt by Jelmer Vernooij ([EMAIL PROTECTED]), 2002
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
@@ -170,158 +171,124 @@ via the %%o substitution. With encrypted
return ret;
}
-static void usage(char *pname)
+int main(int argc, char *argv[])
{
- printf("Usage: %s [-sh] [-L servername] [configfilename] [hostname hostIP]\n",
pname);
- 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");
- printf("\n");
-}
+ extern char *optarg;
+ extern int optind;
+ extern fstring local_machine;
+ char *config_file = dyn_CONFIGFILE;
+ int s;
+ BOOL silent_mode = False;
+ int ret = 0;
+ int opt;
+ poptContext pc;
+ static char *term_code = "";
+ static char *new_local_machine = local_machine;
+ const char *cname;
+ const char *caddr;
+
+ struct poptOption long_options[] = {
+ POPT_AUTOHELP
+ {"suppress-prompt", 's', POPT_ARG_VAL, &silent_mode, 1, "Suppress
+prompt for enter"},
+ {"server", 'L',POPT_ARG_STRING, &new_local_machine, 0, "Set %%L macro
+to servername\n"},
+ {"encoding", 't', POPT_ARG_STRING, &term_code, 0, "Print parameters
+with encoding"},
+ {0,0,0,0}
+ };
+
+ pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
+ POPT_CONTEXT_KEEP_FIRST);
+
+ while((opt = poptGetNextOpt(pc)) != -1);
+
+ setup_logging((char *)poptGetArg(pc), True);
+
+ if(poptPeekArg(pc))config_file = poptGetArg(pc);
+ cname = poptGetArg(pc);
+ caddr = poptGetArg(pc);
+
+ fstrcpy(local_machine,new_local_machine);
+
+ dbf = x_stdout;
+ DEBUGLEVEL = 2;
+ AllowDebugChange = False;
+
+ printf("Load smb config files from %s\n",config_file);
+
+ if (!lp_load(config_file,False,True,False)) {
+ printf("Error loading services.\n");
+ return(1);
+ }
+ printf("Loaded services file OK.\n");
-int main(int argc, char *argv[])
-{
- extern char *optarg;
- extern int optind;
- extern fstring local_machine;
- pstring configfile;
- int opt;
- int s;
- BOOL silent_mode = False;
- int ret = 0;
- pstring term_code;
-
- *term_code = 0;
-
- setup_logging(argv[0],True);
-
- while ((opt = getopt(argc, argv,"shL:t:")) != EOF) {
- switch (opt) {
- case 's':
- silent_mode = True;
- break;
- case 'L':
- fstrcpy(local_machine,optarg);
- break;
- case 'h':
- usage(argv[0]);
- exit(0);
- break;
- case 't':
- pstrcpy(term_code,optarg);
- break;
- default:
- printf("Incorrect program usage\n");
- usage(argv[0]);
- exit(1);
- break;
- }
- }
-
- argc += (1 - optind);
-
- if ((argc == 1) || (argc == 3))
- pstrcpy(configfile, dyn_CONFIGFILE);
- else if ((argc == 2) || (argc == 4))
- pstrcpy(configfile,argv[optind]);
-
- dbf = x_stdout;
- DEBUGLEVEL = 2;
- AllowDebugChange = False;
-
- printf("Load smb config files from %s\n",configfile);
-
- if (!lp_load(configfile,False,True,False)) {
- printf("Error loading services.\n");
- return(1);
- }
-
- printf("Loaded services file OK.\n");
-
- ret = do_global_checks();
-
- for (s=0;s<1000;s++) {
- if (VALID_SNUM(s))
- if (strlen(lp_servicename(s)) > 8) {
- printf("WARNING: You have some share names that are longer than 8 chars\n");
- printf("These may give errors while browsing or may not be accessible\nto
some older clients\n");
- break;
- }
- }
-
- for (s=0;s<1000;s++) {
- if (VALID_SNUM(s)) {
- char **deny_list = lp_hostsdeny(s);
- char **allow_list = lp_hostsallow(s);
- int i;
- if(deny_list) {
- 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) {
- 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) );
- }
- }
- }
-
- if(lp_level2_oplocks(s) && !lp_oplocks(s)) {
- printf("Invalid combination of parameters for service %s. \
-Level II oplocks can only be set if oplocks are also set.\n",
- lp_servicename(s) );
- }
- }
- }
-
- if (argc < 3) {
- if (!silent_mode) {
- printf("Press enter to see a dump of your service definitions\n");
- fflush(stdout);
- getc(stdin);
- }
- lp_dump(stdout,True, lp_numservices());
- }
-
- if (argc >= 3) {
- char *cname;
- char *caddr;
-
- if (argc == 3) {
- cname = argv[optind];
- caddr = argv[optind+1];
- } else {
- cname = argv[optind+1];
- caddr = argv[optind+2];
- }
-
- /* 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),cname,caddr)) {
- printf("Allow connection from %s (%s) to %s\n",
- cname,caddr,lp_servicename(s));
- } else {
- printf("Deny connection from %s (%s) to %s\n",
- cname,caddr,lp_servicename(s));
- }
- }
- }
- }
- return(ret);
+ ret = do_global_checks();
+
+ for (s=0;s<1000;s++) {
+ if (VALID_SNUM(s))
+ if (strlen(lp_servicename(s)) > 8) {
+ printf("WARNING: You have some share names that are
+longer than 8 chars\n");
+ printf("These may give errors while browsing or may
+not be accessible\nto some older clients\n");
+ break;
+ }
+ }
+
+ for (s=0;s<1000;s++) {
+ if (VALID_SNUM(s)) {
+ char **deny_list = lp_hostsdeny(s);
+ char **allow_list = lp_hostsallow(s);
+ int i;
+ if(deny_list) {
+ 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) {
+ 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) );
+ }
+ }
+ }
+
+ if(lp_level2_oplocks(s) && !lp_oplocks(s)) {
+ printf("Invalid combination of parameters for service
+%s. \
+ Level II oplocks can only be set if oplocks
+are also set.\n",
+ lp_servicename(s) );
+ }
+ }
+ }
+
+ if (!cname) {
+ if (!silent_mode) {
+ printf("Press enter to see a dump of your service
+definitions\n");
+ fflush(stdout);
+ getc(stdin);
+ }
+ lp_dump(stdout,True, lp_numservices());
+ }
+
+ if(cname && caddr){
+ /* 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),cname,caddr)) {
+ printf("Allow connection from %s (%s) to %s\n",
+ cname,caddr,lp_servicename(s));
+ } else {
+ printf("Deny connection from %s (%s) to %s\n",
+ cname,caddr,lp_servicename(s));
+ }
+ }
+ }
+ }
+ return(ret);
}
msg01394/pgp00000.pgp
Description: PGP signature
