- new prototypes
authorAndrew Tridgell <tridge@samba.org>
Sat, 14 Nov 1998 02:29:38 +0000 (02:29 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 14 Nov 1998 02:29:38 +0000 (02:29 +0000)
- much as I hate doing it I've removed the "commit changes" button for
  users that don't have write access to smb.conf (Jeremy insisted)
(This used to be commit 8e8ab4df1fe77dfcae73a34f4de174afe09cd695)

source3/include/proto.h
source3/web/swat.c

index c742d664069f45ab97313bd37fd6b3d76913051c..d1aa8383c2d3a86ff8b13e4452986476627da7e8 100644 (file)
@@ -2669,7 +2669,7 @@ int smbw_stat(const char *fname, struct stat *st);
 void cgi_load_variables(FILE *f1);
 char *cgi_variable(char *name);
 BOOL am_root(void);
-char *get_user_name(void);
+char *cgi_user_name(void);
 void cgi_setup(char *rootdir, int auth_required);
 char *cgi_baseurl(void);
 char *cgi_pathinfo(void);
index db21fbfbe104ef5e8aa925b4f8135b74fc554003..8f47ced52d8ca75c1b28d2e9c40a8fd91ab02e36 100644 (file)
@@ -30,6 +30,7 @@
 
 static pstring servicesf = CONFIGFILE;
 static BOOL demo_mode = False;
+static BOOL have_write_access = False;
 
 /*
  * Password Management Globals
@@ -469,7 +470,10 @@ static void globals_page(void)
 
        printf("<FORM name=\"swatform\" method=post>\n");
 
-       printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
+       if (have_write_access) {
+               printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
+       }
+
        printf("<input type=reset name=\"Reset Values\" value=\"Reset Values\">\n");
        if (advanced == 0) {
                printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
@@ -549,7 +553,10 @@ static void shares_page(void)
 
 
        if (snum >= 0) {
-               printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
+               if (have_write_access) {
+                       printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
+               }
+
                printf("<input type=submit name=\"Delete\" value=\"Delete Share\">\n");
                if (advanced == 0) {
                        printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
@@ -848,7 +855,9 @@ static void printers_page(void)
 
 
        if (snum >= 0) {
-               printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
+               if (have_write_access) {
+                       printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n");
+               }
                printf("<input type=submit name=\"Delete\" value=\"Delete Printer\">\n");
                if (advanced == 0) {
                        printf("<input type=submit name=\"Advanced\" value=\"Advanced View\">\n");
@@ -917,6 +926,10 @@ static void printers_page(void)
 
        page = cgi_pathinfo();
 
+       /* check if the authenticated user has write access - if not then
+          don't show write options */
+       have_write_access = (access(servicesf,W_OK) == 0);
+
        /* Root gets full functionality */
        if (strcmp(page, "globals")==0) {
                globals_page();