summaryrefslogtreecommitdiff
path: root/source3/web
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-07-15 14:37:48 -0700
committerJeremy Allison <jra@samba.org>2008-07-15 14:37:48 -0700
commit24eec914c0d5a2ff6b6e8b0ee0bc000a9af13d4f (patch)
tree0da0d85ccbb86f3710fe73b14513bf1ddbf9324a /source3/web
parent1939177582867fb54a416f3ea979ebd8d4335885 (diff)
downloadsamba-24eec914c0d5a2ff6b6e8b0ee0bc000a9af13d4f.tar.gz
samba-24eec914c0d5a2ff6b6e8b0ee0bc000a9af13d4f.tar.bz2
samba-24eec914c0d5a2ff6b6e8b0ee0bc000a9af13d4f.zip
Fix swat. Bug #5613.
Jeremy (This used to be commit 15920f838835f5dbbac8712202267c2a99237686)
Diffstat (limited to 'source3/web')
-rw-r--r--source3/web/swat.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 373ab73127..1502c5bc2f 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -430,7 +430,6 @@ static void show_parameters(int snum, int allparameters, unsigned int parm_filte
****************************************************************************/
static bool load_config(bool save_def)
{
- lp_resetnumservices();
return lp_load(get_dyn_CONFIGFILE(),False,save_def,False,True);
}
@@ -740,12 +739,12 @@ static void wizard_page(void)
load_config(False);
lp_copy_service(GLOBAL_SECTION_SNUM, unix_share);
- iNumNonAutoPrintServices = lp_numservices();
have_home = lp_servicenumber(HOMES_NAME);
lp_do_parameter( have_home, "read only", "No");
lp_do_parameter( have_home, "valid users", "%S");
lp_do_parameter( have_home, "browseable", "No");
commit_parameters(have_home);
+ save_reload(have_home);
}
/* Need to Delete Homes share? */
@@ -908,6 +907,7 @@ static void shares_page(void)
if (cgi_variable("Commit") && snum >= 0) {
commit_parameters(snum);
save_reload(0);
+ snum = lp_servicenumber(share);
}
if (cgi_variable("Delete") && snum >= 0) {
@@ -918,11 +918,14 @@ static void shares_page(void)
}
if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) {
- load_config(False);
- lp_copy_service(GLOBAL_SECTION_SNUM, share);
- iNumNonAutoPrintServices = lp_numservices();
- save_reload(0);
snum = lp_servicenumber(share);
+ if (snum < 0) {
+ load_config(False);
+ lp_copy_service(GLOBAL_SECTION_SNUM, share);
+ snum = lp_servicenumber(share);
+ save_reload(snum);
+ snum = lp_servicenumber(share);
+ }
}
printf("<FORM name=\"swatform\" method=post>\n");
@@ -958,7 +961,6 @@ static void shares_page(void)
(share && strcmp(share,s)==0)?"SELECTED":"",
utf8_s, utf8_s);
SAFE_FREE(utf8_s);
-
}
}
printf("</select></td>\n");
@@ -1261,6 +1263,7 @@ static void printers_page(void)
save_reload(snum);
else
save_reload(0);
+ snum = lp_servicenumber(share);
}
if (cgi_variable("Delete") && snum >= 0) {
@@ -1271,13 +1274,15 @@ static void printers_page(void)
}
if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) {
- load_config(False);
- lp_copy_service(GLOBAL_SECTION_SNUM, share);
- iNumNonAutoPrintServices = lp_numservices();
- snum = lp_servicenumber(share);
- lp_do_parameter(snum, "print ok", "Yes");
- save_reload(0);
snum = lp_servicenumber(share);
+ if (snum < 0 || snum >= iNumNonAutoPrintServices) {
+ load_config(False);
+ lp_copy_service(GLOBAL_SECTION_SNUM, share);
+ snum = lp_servicenumber(share);
+ lp_do_parameter(snum, "print ok", "Yes");
+ save_reload(snum);
+ snum = lp_servicenumber(share);
+ }
}
printf("<FORM name=\"swatform\" method=post>\n");