summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-03 08:28:12 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-03 08:28:12 +0000
commit634c54310c92c48dd4eceec602e230a021bdcfc5 (patch)
tree9f5732a180b8daacf176e42511b0a72c972c7a4b /source3/param
parent47a7f0cfb5006fb41239a6cd81cce5e35fde750a (diff)
downloadsamba-634c54310c92c48dd4eceec602e230a021bdcfc5.tar.gz
samba-634c54310c92c48dd4eceec602e230a021bdcfc5.tar.bz2
samba-634c54310c92c48dd4eceec602e230a021bdcfc5.zip
Merge from HEAD - make Samba compile with -Wwrite-strings without additional
warnings. (Adds a lot of const). Andrew Bartlett (This used to be commit 3a7458f9472432ef12c43008414925fd1ce8ea0c)
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c106
-rw-r--r--source3/param/params.c24
2 files changed, 65 insertions, 65 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index ba6e3f9e47..837fc87fac 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -521,29 +521,29 @@ static int default_server_announce;
#define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
/* prototypes for the special type handlers */
-static BOOL handle_include(char *pszParmValue, char **ptr);
-static BOOL handle_copy(char *pszParmValue, char **ptr);
-static BOOL handle_vfs_object(char *pszParmValue, char **ptr);
-static BOOL handle_source_env(char *pszParmValue, char **ptr);
-static BOOL handle_netbios_name(char *pszParmValue, char **ptr);
-static BOOL handle_winbind_uid(char *pszParmValue, char **ptr);
-static BOOL handle_winbind_gid(char *pszParmValue, char **ptr);
-static BOOL handle_non_unix_account_range(char *pszParmValue, char **ptr);
-static BOOL handle_debug_list( char *pszParmValue, char **ptr );
-static BOOL handle_workgroup( char *pszParmValue, char **ptr );
-static BOOL handle_netbios_aliases( char *pszParmValue, char **ptr );
-static BOOL handle_netbios_scope( char *pszParmValue, char **ptr );
-
-static BOOL handle_ldap_machine_suffix ( char *pszParmValue, char **ptr );
-static BOOL handle_ldap_user_suffix ( char *pszParmValue, char **ptr );
-static BOOL handle_ldap_suffix ( char *pszParmValue, char **ptr );
-
-static BOOL handle_acl_compatibility(char *pszParmValue, char **ptr);
+static BOOL handle_include(const char *pszParmValue, char **ptr);
+static BOOL handle_copy(const char *pszParmValue, char **ptr);
+static BOOL handle_vfs_object(const char *pszParmValue, char **ptr);
+static BOOL handle_source_env(const char *pszParmValue, char **ptr);
+static BOOL handle_netbios_name(const char *pszParmValue, char **ptr);
+static BOOL handle_winbind_uid(const char *pszParmValue, char **ptr);
+static BOOL handle_winbind_gid(const char *pszParmValue, char **ptr);
+static BOOL handle_non_unix_account_range(const char *pszParmValue, char **ptr);
+static BOOL handle_debug_list( const char *pszParmValue, char **ptr );
+static BOOL handle_workgroup( const char *pszParmValue, char **ptr );
+static BOOL handle_netbios_aliases( const char *pszParmValue, char **ptr );
+static BOOL handle_netbios_scope( const char *pszParmValue, char **ptr );
+
+static BOOL handle_ldap_machine_suffix ( const char *pszParmValue, char **ptr );
+static BOOL handle_ldap_user_suffix ( const char *pszParmValue, char **ptr );
+static BOOL handle_ldap_suffix ( const char *pszParmValue, char **ptr );
+
+static BOOL handle_acl_compatibility(const char *pszParmValue, char **ptr);
static void set_server_role(void);
static void set_default_server_announce_type(void);
-static struct enum_list enum_protocol[] = {
+static const struct enum_list enum_protocol[] = {
{PROTOCOL_NT1, "NT1"},
{PROTOCOL_LANMAN2, "LANMAN2"},
{PROTOCOL_LANMAN1, "LANMAN1"},
@@ -553,7 +553,7 @@ static struct enum_list enum_protocol[] = {
{-1, NULL}
};
-static struct enum_list enum_security[] = {
+static const struct enum_list enum_security[] = {
{SEC_SHARE, "SHARE"},
{SEC_USER, "USER"},
{SEC_SERVER, "SERVER"},
@@ -564,7 +564,7 @@ static struct enum_list enum_security[] = {
{-1, NULL}
};
-static struct enum_list enum_printing[] = {
+static const struct enum_list enum_printing[] = {
{PRINT_SYSV, "sysv"},
{PRINT_AIX, "aix"},
{PRINT_HPUX, "hpux"},
@@ -583,7 +583,7 @@ static struct enum_list enum_printing[] = {
{-1, NULL}
};
-static struct enum_list enum_ldap_ssl[] = {
+static const struct enum_list enum_ldap_ssl[] = {
#ifdef WITH_LDAP_SAMCONFIG
{LDAP_SSL_ON, "Yes"},
{LDAP_SSL_ON, "yes"},
@@ -599,7 +599,7 @@ static struct enum_list enum_ldap_ssl[] = {
{-1, NULL}
};
-static struct enum_list enum_ldap_passwd_sync[] = {
+static const struct enum_list enum_ldap_passwd_sync[] = {
{LDAP_PASSWD_SYNC_ON, "Yes"},
{LDAP_PASSWD_SYNC_ON, "yes"},
{LDAP_PASSWD_SYNC_ON, "on"},
@@ -621,7 +621,7 @@ static struct enum_list enum_ldap_passwd_sync[] = {
#define ANNOUNCE_AS_WFW 3
#define ANNOUNCE_AS_NT_WORKSTATION 4
-static struct enum_list enum_announce_as[] = {
+static const struct enum_list enum_announce_as[] = {
{ANNOUNCE_AS_NT_SERVER, "NT"},
{ANNOUNCE_AS_NT_SERVER, "NT Server"},
{ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
@@ -630,13 +630,13 @@ static struct enum_list enum_announce_as[] = {
{-1, NULL}
};
-static struct enum_list enum_case[] = {
+static const struct enum_list enum_case[] = {
{CASE_LOWER, "lower"},
{CASE_UPPER, "upper"},
{-1, NULL}
};
-static struct enum_list enum_bool_auto[] = {
+static const struct enum_list enum_bool_auto[] = {
{False, "No"},
{False, "False"},
{False, "0"},
@@ -653,7 +653,7 @@ static struct enum_list enum_bool_auto[] = {
#define CSC_POLICY_PROGRAMS 2
#define CSC_POLICY_DISABLE 3
-static struct enum_list enum_csc_policy[] = {
+static const struct enum_list enum_csc_policy[] = {
{CSC_POLICY_MANUAL, "manual"},
{CSC_POLICY_DOCUMENTS, "documents"},
{CSC_POLICY_PROGRAMS, "programs"},
@@ -682,7 +682,7 @@ static struct enum_list enum_csc_policy[] = {
level security.
*/
-static struct enum_list enum_map_to_guest[] = {
+static const struct enum_list enum_map_to_guest[] = {
{NEVER_MAP_TO_GUEST, "Never"},
{MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
{MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
@@ -1846,15 +1846,15 @@ char *lp_parm_string(const char *servicename, const char *type, const char *opti
/* local prototypes */
-static int map_parameter(char *pszParmName);
+static int map_parameter(const char *pszParmName);
static BOOL set_boolean(BOOL *pb, char *pszParmValue);
static int getservicebyname(const char *pszServiceName,
service * pserviceDest);
static void copy_service(service * pserviceDest,
service * pserviceSource, BOOL *pcopymapDest);
static BOOL service_ok(int iService);
-static BOOL do_parameter(char *pszParmName, char *pszParmValue);
-static BOOL do_section(char *pszSectionName);
+static BOOL do_parameter(const char *pszParmName, const char *pszParmValue);
+static BOOL do_section(const char *pszSectionName);
static void init_copymap(service * pservice);
@@ -2017,7 +2017,7 @@ int lp_add_service(const char *pszService, int iDefaultService)
Add the IPC service.
***************************************************************************/
-static BOOL lp_add_ipc(char *ipc_name, BOOL guest_ok)
+static BOOL lp_add_ipc(const char *ipc_name, BOOL guest_ok)
{
pstring comment;
int i = add_a_service(&sDefault, ipc_name);
@@ -2087,7 +2087,7 @@ BOOL lp_add_printer(const char *pszPrintername, int iDefaultService)
Returns False if the parameter string is not recognised, else TRUE.
***************************************************************************/
-static int map_parameter(char *pszParmName)
+static int map_parameter(const char *pszParmName)
{
int iIndex;
@@ -2349,7 +2349,7 @@ BOOL lp_file_list_changed(void)
Note: We must *NOT* use string_set() here as ptr points to global_myname.
***************************************************************************/
-static BOOL handle_netbios_name(char *pszParmValue, char **ptr)
+static BOOL handle_netbios_name(const char *pszParmValue, char **ptr)
{
pstring netbios_name;
@@ -2365,17 +2365,17 @@ static BOOL handle_netbios_name(char *pszParmValue, char **ptr)
return (True);
}
-static BOOL handle_workgroup(char *pszParmValue, char **ptr)
+static BOOL handle_workgroup(const char *pszParmValue, char **ptr)
{
return set_global_myworkgroup(pszParmValue);
}
-static BOOL handle_netbios_scope(char *pszParmValue, char **ptr)
+static BOOL handle_netbios_scope(const char *pszParmValue, char **ptr)
{
return set_global_scope(pszParmValue);
}
-static BOOL handle_netbios_aliases(char *pszParmValue, char **ptr)
+static BOOL handle_netbios_aliases(const char *pszParmValue, char **ptr)
{
Globals.szNetbiosAliases = str_list_make(pszParmValue, NULL);
return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
@@ -2435,7 +2435,7 @@ static BOOL source_env(char **lines)
Handle the source environment operation.
***************************************************************************/
-static BOOL handle_source_env(char *pszParmValue, char **ptr)
+static BOOL handle_source_env(const char *pszParmValue, char **ptr)
{
pstring fname;
char *p = fname;
@@ -2475,7 +2475,7 @@ static BOOL handle_source_env(char *pszParmValue, char **ptr)
Handle the interpretation of the vfs object parameter.
*************************************************************************/
-static BOOL handle_vfs_object(char *pszParmValue, char **ptr)
+static BOOL handle_vfs_object(const char *pszParmValue, char **ptr)
{
/* Set string value */
@@ -2491,7 +2491,7 @@ static BOOL handle_vfs_object(char *pszParmValue, char **ptr)
Handle the include operation.
***************************************************************************/
-static BOOL handle_include(char *pszParmValue, char **ptr)
+static BOOL handle_include(const char *pszParmValue, char **ptr)
{
pstring fname;
pstrcpy(fname, pszParmValue);
@@ -2514,7 +2514,7 @@ static BOOL handle_include(char *pszParmValue, char **ptr)
Handle the interpretation of the copy parameter.
***************************************************************************/
-static BOOL handle_copy(char *pszParmValue, char **ptr)
+static BOOL handle_copy(const char *pszParmValue, char **ptr)
{
BOOL bRetval;
int iTemp;
@@ -2610,7 +2610,7 @@ BOOL lp_non_unix_account_range(uint32 *low, uint32 *high)
/* Do some simple checks on "winbind [ug]id" parameter values */
-static BOOL handle_winbind_uid(char *pszParmValue, char **ptr)
+static BOOL handle_winbind_uid(const char *pszParmValue, char **ptr)
{
uint32 low, high;
@@ -2627,7 +2627,7 @@ static BOOL handle_winbind_uid(char *pszParmValue, char **ptr)
return True;
}
-static BOOL handle_winbind_gid(char *pszParmValue, char **ptr)
+static BOOL handle_winbind_gid(const char *pszParmValue, char **ptr)
{
uint32 low, high;
@@ -2648,7 +2648,7 @@ static BOOL handle_winbind_gid(char *pszParmValue, char **ptr)
Do some simple checks on "non unix account range" parameter values.
***************************************************************************/
-static BOOL handle_non_unix_account_range(char *pszParmValue, char **ptr)
+static BOOL handle_non_unix_account_range(const char *pszParmValue, char **ptr)
{
uint32 low, high;
@@ -2669,7 +2669,7 @@ static BOOL handle_non_unix_account_range(char *pszParmValue, char **ptr)
Handle the DEBUG level list.
***************************************************************************/
-static BOOL handle_debug_list( char *pszParmValueIn, char **ptr )
+static BOOL handle_debug_list( const char *pszParmValueIn, char **ptr )
{
pstring pszParmValue;
@@ -2682,7 +2682,7 @@ static BOOL handle_debug_list( char *pszParmValueIn, char **ptr )
Handle the ldap machine suffix option.
***************************************************************************/
-static BOOL handle_ldap_machine_suffix( char *pszParmValue, char **ptr)
+static BOOL handle_ldap_machine_suffix( const char *pszParmValue, char **ptr)
{
pstring suffix;
@@ -2706,7 +2706,7 @@ static BOOL handle_ldap_machine_suffix( char *pszParmValue, char **ptr)
Handle the ldap user suffix option.
***************************************************************************/
-static BOOL handle_ldap_user_suffix( char *pszParmValue, char **ptr)
+static BOOL handle_ldap_user_suffix( const char *pszParmValue, char **ptr)
{
pstring suffix;
@@ -2731,7 +2731,7 @@ static BOOL handle_ldap_user_suffix( char *pszParmValue, char **ptr)
to be set as well.
***************************************************************************/
-static BOOL handle_ldap_suffix( char *pszParmValue, char **ptr)
+static BOOL handle_ldap_suffix( const char *pszParmValue, char **ptr)
{
pstring suffix;
pstring user_suffix;
@@ -2764,7 +2764,7 @@ static BOOL handle_ldap_suffix( char *pszParmValue, char **ptr)
return True;
}
-static BOOL handle_acl_compatibility(char *pszParmValue, char **ptr)
+static BOOL handle_acl_compatibility(const char *pszParmValue, char **ptr)
{
if (strequal(pszParmValue, "auto"))
string_set(ptr, "");
@@ -2810,7 +2810,7 @@ void *lp_local_ptr(int snum, void *ptr)
then assume we are in the globals.
***************************************************************************/
-BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue)
+BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
{
int parmnum, i, slen;
void *parm_ptr = NULL; /* where we are going to store the result */
@@ -2949,7 +2949,7 @@ BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue)
Process a parameter.
***************************************************************************/
-static BOOL do_parameter(char *pszParmName, char *pszParmValue)
+static BOOL do_parameter(const char *pszParmName, const char *pszParmValue)
{
if (!bInGlobalSection && bGlobalOnly)
return (True);
@@ -3090,7 +3090,7 @@ void init_locals(void)
Returns True on success, False on failure.
***************************************************************************/
-static BOOL do_section(char *pszSectionName)
+static BOOL do_section(const char *pszSectionName)
{
BOOL bRetval;
BOOL isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
@@ -3839,7 +3839,7 @@ void lp_remove_service(int snum)
Copy a service.
********************************************************************/
-void lp_copy_service(int snum, char *new_name)
+void lp_copy_service(int snum, const char *new_name)
{
char *oldname = lp_servicename(snum);
do_section(new_name);
diff --git a/source3/param/params.c b/source3/param/params.c
index bc93a1fedf..892e5476cc 100644
--- a/source3/param/params.c
+++ b/source3/param/params.c
@@ -201,7 +201,7 @@ static int Continuation(char *line, int pos )
}
-static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) )
+static BOOL Section( myFILE *InFile, BOOL (*sfunc)(const char *) )
/* ------------------------------------------------------------------------ **
* Scan a section name, and pass the name to function sfunc().
*
@@ -219,7 +219,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) )
int c;
int i;
int end;
- char *func = "params.c:Section() -";
+ const char *func = "params.c:Section() -";
i = 0; /* <i> is the offset of the next free byte in bufr[] and */
end = 0; /* <end> is the current "end of string" offset. In most */
@@ -297,7 +297,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) )
return( False );
} /* Section */
-static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(char *, char *), int c )
+static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(const char *, const char *), int c )
/* ------------------------------------------------------------------------ **
* Scan a parameter name and value, and pass these two fields to pfunc().
*
@@ -325,7 +325,7 @@ static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(char *, char *), int c )
int i = 0; /* Position within bufr. */
int end = 0; /* bufr[end] is current end-of-string. */
int vstart = 0; /* Starting position of the parameter value. */
- char *func = "params.c:Parameter() -";
+ const char *func = "params.c:Parameter() -";
/* Read the parameter name. */
while( 0 == vstart ) /* Loop until we've found the start of the value. */
@@ -445,8 +445,8 @@ static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(char *, char *), int c )
} /* Parameter */
static BOOL Parse( myFILE *InFile,
- BOOL (*sfunc)(char *),
- BOOL (*pfunc)(char *, char *) )
+ BOOL (*sfunc)(const char *),
+ BOOL (*pfunc)(const char *, const char *) )
/* ------------------------------------------------------------------------ **
* Scan & parse the input.
*
@@ -505,7 +505,7 @@ static BOOL Parse( myFILE *InFile,
return( True );
} /* Parse */
-static myFILE *OpenConfFile( char *FileName )
+static myFILE *OpenConfFile( const char *FileName )
/* ------------------------------------------------------------------------ **
* Open a configuration file.
*
@@ -516,7 +516,7 @@ static myFILE *OpenConfFile( char *FileName )
* ------------------------------------------------------------------------ **
*/
{
- char *func = "params.c:OpenConfFile() -";
+ const char *func = "params.c:OpenConfFile() -";
extern BOOL in_client;
int lvl = in_client?1:0;
myFILE *ret;
@@ -538,9 +538,9 @@ static myFILE *OpenConfFile( char *FileName )
return( ret );
} /* OpenConfFile */
-BOOL pm_process( char *FileName,
- BOOL (*sfunc)(char *),
- BOOL (*pfunc)(char *, char *) )
+BOOL pm_process( const char *FileName,
+ BOOL (*sfunc)(const char *),
+ BOOL (*pfunc)(const char *, const char *) )
/* ------------------------------------------------------------------------ **
* Process the named parameter file.
*
@@ -557,7 +557,7 @@ BOOL pm_process( char *FileName,
{
int result;
myFILE *InFile;
- char *func = "params.c:pm_process() -";
+ const char *func = "params.c:pm_process() -";
InFile = OpenConfFile( FileName ); /* Open the config file. */
if( NULL == InFile )