summaryrefslogtreecommitdiff
path: root/source3/web
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-02 09:07:17 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-02 09:07:17 +0000
commit6d66fb308ab85bd9691d541764e683e6040cf724 (patch)
tree10b705921665cb7bafdd332ca53b8a943e13f0e5 /source3/web
parentc105c12d122e599fe57dde8b2b73c52231f0c1d2 (diff)
downloadsamba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.gz
samba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.bz2
samba-6d66fb308ab85bd9691d541764e683e6040cf724.zip
BIG patch...
This patch makes Samba compile cleanly with -Wwrite-strings. - That is, all string literals are marked as 'const'. These strings are always read only, this just marks them as such for passing to other functions. What is most supprising is that I didn't need to change more than a few lines of code (all in 'net', which got a small cleanup of net.h and extern variables). The rest is just adding a lot of 'const'. As far as I can tell, I have not added any new warnings - apart from making all of tdbutil.c's function const (so they warn for adding that const string to struct). Andrew Bartlett (This used to be commit 92a777d0eaa4fb3a1c7835816f93c6bdd456816d)
Diffstat (limited to 'source3/web')
-rw-r--r--source3/web/cgi.c18
-rw-r--r--source3/web/statuspage.c2
-rw-r--r--source3/web/swat.c30
3 files changed, 25 insertions, 25 deletions
diff --git a/source3/web/cgi.c b/source3/web/cgi.c
index 96520c0eef..018dd3602f 100644
--- a/source3/web/cgi.c
+++ b/source3/web/cgi.c
@@ -40,7 +40,7 @@ static int num_variables;
static int content_length;
static int request_post;
static char *query_string;
-static char *baseurl;
+static const char *baseurl;
static char *pathinfo;
static char *C_user;
static BOOL inetd_server;
@@ -205,7 +205,7 @@ void cgi_load_variables(void)
browser. Also doesn't allow for variables[] containing multiple variables
with the same name and the same or different values.
***************************************************************************/
-char *cgi_variable(char *name)
+const char *cgi_variable(const char *name)
{
int i;
@@ -218,7 +218,7 @@ char *cgi_variable(char *name)
/***************************************************************************
tell a browser about a fatal error in the http processing
***************************************************************************/
-static void cgi_setup_error(char *err, char *header, char *info)
+static void cgi_setup_error(const char *err, const char *header, const char *info)
{
if (!got_request) {
/* damn browsers don't like getting cut off before they give a request */
@@ -264,10 +264,10 @@ authenticate when we are running as a CGI
***************************************************************************/
static void cgi_web_auth(void)
{
- char *user = getenv("REMOTE_USER");
+ const char *user = getenv("REMOTE_USER");
struct passwd *pwd;
- char *head = "Content-Type: text/html\r\n\r\n<HTML><BODY><H1>SWAT installation Error</H1>\n";
- char *tail = "</BODY></HTML>\r\n";
+ const char *head = "Content-Type: text/html\r\n\r\n<HTML><BODY><H1>SWAT installation Error</H1>\n";
+ const char *tail = "</BODY></HTML>\r\n";
if (!user) {
printf("%sREMOTE_USER not set. Not authenticated by web server.<br>%s\n",
@@ -296,7 +296,7 @@ decode a base64 string in-place - simple and slow algorithm
***************************************************************************/
static void base64_decode(char *s)
{
- char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int bit_offset, byte_offset, idx, i, n;
unsigned char *d = (unsigned char *)s;
char *p;
@@ -570,7 +570,7 @@ void cgi_setup(const char *rootdir, int auth_required)
/***************************************************************************
return the current pages URL
***************************************************************************/
-char *cgi_baseurl(void)
+const char *cgi_baseurl(void)
{
if (inetd_server) {
return baseurl;
@@ -581,7 +581,7 @@ char *cgi_baseurl(void)
/***************************************************************************
return the current pages path info
***************************************************************************/
-char *cgi_pathinfo(void)
+const char *cgi_pathinfo(void)
{
char *r;
if (inetd_server) {
diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c
index 3b597d44c0..8e41d62cb0 100644
--- a/source3/web/statuspage.c
+++ b/source3/web/statuspage.c
@@ -216,7 +216,7 @@ static int traverse_fn3(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void* st
/* show the current server status */
void status_page(void)
{
- char *v;
+ const char *v;
int autorefresh=0;
int refresh_interval=30;
TDB_CONTEXT *tdb;
diff --git a/source3/web/swat.c b/source3/web/swat.c
index fc38852245..21ae104cef 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -59,7 +59,7 @@ static int iNumNonAutoPrintServices = 0;
/****************************************************************************
****************************************************************************/
-static int enum_index(int value, struct enum_list *enumlist)
+static int enum_index(int value, const struct enum_list *enumlist)
{
int i;
for (i=0;enumlist[i].name;i++)
@@ -67,7 +67,7 @@ static int enum_index(int value, struct enum_list *enumlist)
return(i);
}
-static char *fix_backslash(char *str)
+static char *fix_backslash(const char *str)
{
static char newstring[1024];
char *p = newstring;
@@ -81,7 +81,7 @@ static char *fix_backslash(char *str)
return newstring;
}
-static char *stripspaceupper(char *str)
+static char *stripspaceupper(const char *str)
{
static char newstring[1024];
char *p = newstring;
@@ -94,7 +94,7 @@ static char *stripspaceupper(char *str)
return newstring;
}
-static char *make_parm_name(char *label)
+static char *make_parm_name(const char *label)
{
static char parmname[1024];
char *p = parmname;
@@ -111,7 +111,7 @@ static char *make_parm_name(char *label)
/****************************************************************************
include a lump of html in a page
****************************************************************************/
-static int include_html(char *fname)
+static int include_html(const char *fname)
{
int fd;
char buf[1024];
@@ -303,8 +303,8 @@ static void show_parameters(int snum, int allparameters, unsigned int parm_filte
{
int i = 0;
struct parm_struct *parm;
- char *heading = NULL;
- char *last_heading = NULL;
+ const char *heading = NULL;
+ const char *last_heading = NULL;
while ((parm = lp_next_parameter(snum, &i, allparameters))) {
if (snum < 0 && parm->class == P_LOCAL && !(parm->flags & FLAG_GLOBAL))
@@ -440,7 +440,7 @@ static int save_reload(int snum)
/****************************************************************************
commit one parameter
****************************************************************************/
-static void commit_parameter(int snum, struct parm_struct *parm, char *v)
+static void commit_parameter(int snum, struct parm_struct *parm, const char *v)
{
int i;
char *s;
@@ -468,7 +468,7 @@ static void commit_parameters(int snum)
int i = 0;
struct parm_struct *parm;
pstring label;
- char *v;
+ const char *v;
while ((parm = lp_next_parameter(snum, &i, 1))) {
slprintf(label, sizeof(label)-1, "parm_%s", make_parm_name(parm->label));
@@ -817,7 +817,7 @@ static void globals_page(void)
****************************************************************************/
static void shares_page(void)
{
- char *share = cgi_variable("share");
+ const char *share = cgi_variable("share");
char *s;
int snum = -1;
int i;
@@ -915,8 +915,8 @@ static void shares_page(void)
/*************************************************************
change a password either locally or remotely
*************************************************************/
-static BOOL change_password(const char *remote_machine, char *user_name,
- char *old_passwd, char *new_passwd,
+static BOOL change_password(const char *remote_machine, const char *user_name,
+ const char *old_passwd, const char *new_passwd,
int local_flags)
{
BOOL ret = False;
@@ -957,7 +957,7 @@ static BOOL change_password(const char *remote_machine, char *user_name,
****************************************************************************/
static void chg_passwd(void)
{
- char *host;
+ const char *host;
BOOL rslt;
int local_flags = 0;
@@ -1042,7 +1042,7 @@ static void chg_passwd(void)
****************************************************************************/
static void passwd_page(void)
{
- char *new_name = cgi_user_name();
+ const char *new_name = cgi_user_name();
/*
* After the first time through here be nice. If the user
@@ -1147,7 +1147,7 @@ static void passwd_page(void)
****************************************************************************/
static void printers_page(void)
{
- char *share = cgi_variable("share");
+ const char *share = cgi_variable("share");
char *s;
int snum=-1;
int i;