summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorHerb Lewis <herb@samba.org>1998-12-10 23:43:16 +0000
committerHerb Lewis <herb@samba.org>1998-12-10 23:43:16 +0000
commit4f9d42ea67814387d9f3ee9c7b0a672ea000b70c (patch)
treeb14d362f25c0ecc9d436dbbbb335edb48092d20d /source
parent2a488031e886b523523e3d607bfcf08425718355 (diff)
downloadsamba-4f9d42ea67814387d9f3ee9c7b0a672ea000b70c.tar.gz
samba-4f9d42ea67814387d9f3ee9c7b0a672ea000b70c.tar.xz
samba-4f9d42ea67814387d9f3ee9c7b0a672ea000b70c.zip
Makefile.in added PRINTER_OBJ to SWAT_OBJ so swat can
enumerate printers param/loadparm.c added parameter to lp_dump to limit number of items dumped. Pulled real dump code into new function lp_dump_one so it can be called by swat utils/testparm.c extra parameter added for lp_dump call web/statuspage.c got rid of extra > being printed when smbd not running web/swat.c allow auto loaded printers to be enumerated in printer page include/proto.h changed number of parameters in lp_dump and new function lp_dump_one defined.
Diffstat (limited to 'source')
-rw-r--r--source/Makefile.in2
-rw-r--r--source/include/proto.h3
-rw-r--r--source/param/loadparm.c26
-rw-r--r--source/utils/testparm.c2
-rw-r--r--source/web/statuspage.c2
-rw-r--r--source/web/swat.c26
6 files changed, 38 insertions, 23 deletions
diff --git a/source/Makefile.in b/source/Makefile.in
index ded8da71359..184165abacc 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -174,7 +174,7 @@ NMBD_OBJ = $(NMBD_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) \
SWAT_OBJ = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \
web/swat.o $(LIBSMB_OBJ) $(LOCKING_OBJ) \
$(PARAM_OBJ) $(PASSDB_OBJ) $(RPC_CLIENT_OBJ) $(RPC_PARSE_OBJ) \
- $(UBIQX_OBJ) $(LIB_OBJ)
+ $(UBIQX_OBJ) $(LIB_OBJ) $(PRINTING_OBJ)
SMBRUN_OBJ = utils/smbrun.o
diff --git a/source/include/proto.h b/source/include/proto.h
index 419e0b6117c..c06d7e51750 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -1155,7 +1155,8 @@ BOOL lp_loaded(void);
void lp_killunused(BOOL (*snumused)(int ));
BOOL lp_load(char *pszFname,BOOL global_only, BOOL save_defaults, BOOL add_ipc);
int lp_numservices(void);
-void lp_dump(FILE *f, BOOL show_defaults);
+void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint);
+void lp_dump_one(FILE *f, BOOL show_defaults, int snum);
int lp_servicenumber(char *pszServiceName);
char *volume_label(int snum);
void lp_remove_service(int snum);
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index 6f270eb0f55..48ddefcccaa 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -2539,7 +2539,7 @@ int lp_numservices(void)
/***************************************************************************
Display the contents of the services array in human-readable form.
***************************************************************************/
-void lp_dump(FILE *f, BOOL show_defaults)
+void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint)
{
int iService;
@@ -2551,15 +2551,21 @@ void lp_dump(FILE *f, BOOL show_defaults)
dump_a_service(&sDefault, f);
- for (iService = 0; iService < iNumServices; iService++)
- {
- if (VALID(iService))
- {
- if (iSERVICE(iService).szService[0] == '\0')
- break;
- dump_a_service(pSERVICE(iService), f);
- }
- }
+ for (iService = 0; iService < maxtoprint; iService++)
+ lp_dump_one(f, show_defaults, iService);
+}
+
+/***************************************************************************
+Display the contents of one service in human-readable form.
+***************************************************************************/
+void lp_dump_one(FILE *f, BOOL show_defaults, int snum)
+{
+ if (VALID(snum))
+ {
+ if (iSERVICE(snum).szService[0] == '\0')
+ return;
+ dump_a_service(pSERVICE(snum), f);
+ }
}
diff --git a/source/utils/testparm.c b/source/utils/testparm.c
index 50e8cc3d74d..5c2d4a4c025 100644
--- a/source/utils/testparm.c
+++ b/source/utils/testparm.c
@@ -161,7 +161,7 @@ cannot be set in the smb.conf file. nmbd will abort with this setting.\n");
fflush(stdout);
getc(stdin);
}
- lp_dump(stdout,True);
+ lp_dump(stdout,True, lp_numservices());
}
if (argc >= 3)
diff --git a/source/web/statuspage.c b/source/web/statuspage.c
index 260e00cb83d..94ca4525b1a 100644
--- a/source/web/statuspage.c
+++ b/source/web/statuspage.c
@@ -173,7 +173,7 @@ void status_page(void)
if (smbd_running()) {
printf("<tr><td>smbd:</td><td>running</td><td><input type=submit name=\"smbd_stop\" value=\"Stop smbd\"></td><td><input type=submit name=\"smbd_restart\" value=\"Restart smbd\"></td></tr>\n");
} else {
- printf("<tr><td>smbd:</td><td>not running</td><td><input type=submit name=\"smbd_start\" value=\"Start smbd\"></td>><td><input type=submit name=\"smbd_restart\" value=\"Restart smbd\"></td></tr>\n");
+ printf("<tr><td>smbd:</td><td>not running</td><td><input type=submit name=\"smbd_start\" value=\"Start smbd\"></td><td><input type=submit name=\"smbd_restart\" value=\"Restart smbd\"></td></tr>\n");
}
fflush(stdout);
diff --git a/source/web/swat.c b/source/web/swat.c
index aa9f8790299..9a0198920c4 100644
--- a/source/web/swat.c
+++ b/source/web/swat.c
@@ -32,6 +32,7 @@ static pstring servicesf = CONFIGFILE;
static BOOL demo_mode = False;
static BOOL have_write_access = False;
static BOOL have_read_access = False;
+static int iNumNonAutoPrintServices = 0;
/*
* Password Management Globals
@@ -309,13 +310,13 @@ static void write_config(FILE *f, BOOL show_defaults)
fprintf(f, "# from %s (%s)\n", cgi_remote_host(), cgi_remote_addr());
fprintf(f, "# Date: %s\n\n", timestring());
- lp_dump(f, show_defaults);
+ lp_dump(f, show_defaults, iNumNonAutoPrintServices);
}
/****************************************************************************
save and reoad the smb.conf config file
****************************************************************************/
-static int save_reload(void)
+static int save_reload(int snum)
{
FILE *f;
@@ -326,6 +327,8 @@ static int save_reload(void)
}
write_config(f, False);
+ if (snum)
+ lp_dump_one(f, False, snum);
fclose(f);
lp_killunused(NULL);
@@ -464,7 +467,7 @@ static void globals_page(void)
if (cgi_variable("Commit")) {
commit_parameters(GLOBALS_SNUM);
- save_reload();
+ save_reload(0);
}
printf("<FORM name=\"swatform\" method=post>\n");
@@ -513,19 +516,19 @@ static void shares_page(void)
if (cgi_variable("Commit") && snum >= 0) {
commit_parameters(snum);
- save_reload();
+ save_reload(0);
}
if (cgi_variable("Delete") && snum >= 0) {
lp_remove_service(snum);
- save_reload();
+ save_reload(0);
share = NULL;
snum = -1;
}
if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) {
lp_copy_service(GLOBALS_SNUM, share);
- save_reload();
+ save_reload(0);
snum = lp_servicenumber(share);
}
@@ -817,12 +820,15 @@ static void printers_page(void)
if (cgi_variable("Commit") && snum >= 0) {
commit_parameters(snum);
- save_reload();
+ if (snum >= iNumNonAutoPrintServices)
+ save_reload(snum);
+ else
+ save_reload(0);
}
if (cgi_variable("Delete") && snum >= 0) {
lp_remove_service(snum);
- save_reload();
+ save_reload(0);
share = NULL;
snum = -1;
}
@@ -831,7 +837,7 @@ static void printers_page(void)
lp_copy_service(GLOBALS_SNUM, share);
snum = lp_servicenumber(share);
lp_do_parameter(snum, "print ok", "Yes");
- save_reload();
+ save_reload(0);
snum = lp_servicenumber(share);
}
@@ -914,6 +920,8 @@ static void printers_page(void)
charset_initialise();
load_config();
+ iNumNonAutoPrintServices = lp_numservices();
+ load_printers();
cgi_setup(SWATDIR, !demo_mode);