summaryrefslogtreecommitdiff
path: root/source3/passdb
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/passdb
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/passdb')
-rw-r--r--source3/passdb/passdb.c4
-rw-r--r--source3/passdb/pdb_interface.c6
-rw-r--r--source3/passdb/pdb_ldap.c2
-rw-r--r--source3/passdb/pdb_tdb.c2
-rw-r--r--source3/passdb/secrets.c2
-rw-r--r--source3/passdb/util_sam_sid.c16
6 files changed, 16 insertions, 16 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index ed5ddda4da..e13f0e9dfb 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -304,7 +304,7 @@ NTSTATUS pdb_init_sam_pw(SAM_ACCOUNT **new_sam_acct, const struct passwd *pwd)
/**
* Free the contets of the SAM_ACCOUNT, but not the structure.
*
- * Also wipes the LM and NT hashes and plaintext passwrod from
+ * Also wipes the LM and NT hashes and plaintext password from
* memory.
*
* @param user SAM_ACCOUNT to free members of.
@@ -473,7 +473,7 @@ BOOL pdb_gethexpwd(const char *p, unsigned char *pwd)
{
int i;
unsigned char lonybble, hinybble;
- char *hexchars = "0123456789ABCDEF";
+ const char *hexchars = "0123456789ABCDEF";
char *p1, *p2;
if (!p)
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 891a29148f..778cb9425c 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -25,8 +25,8 @@
#define DBGC_CLASS DBGC_PASSDB
/** List of various built-in passdb modules */
-const struct {
- char *name;
+static const struct {
+ const char *name;
/* Function to create a member of the pdb_methods list */
pdb_init_function init;
} builtin_pdb_init_functions[] = {
@@ -58,7 +58,7 @@ static void lazy_initialize_passdb()
}
}
-BOOL smb_register_passdb(char *name, pdb_init_function init, int version)
+BOOL smb_register_passdb(const char *name, pdb_init_function init, int version)
{
struct pdb_init_function_entry *entry = backends;
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 884db4c26c..7c3c6f1f1f 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -728,7 +728,7 @@ static int ldapsam_search_one_user_by_rid (struct ldapsam_privates *ldap_state,
search an attribute and return the first value found.
******************************************************************/
static BOOL get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
- char *attribute, pstring value)
+ const char *attribute, pstring value)
{
char **values;
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 2aa2e504d7..a1f786c8cd 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -529,7 +529,7 @@ static NTSTATUS tdbsam_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUNT *
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;
TDB_DATA data;
- char *prefix = USERPREFIX;
+ const char *prefix = USERPREFIX;
int prefixlen = strlen (prefix);
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index b93ea74d8b..d30b13c3b6 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -324,7 +324,7 @@ BOOL secrets_store_trust_account_password(const char *domain, uint8 new_pwd[16])
**/
BOOL secrets_store_trusted_domain_password(const char* domain, smb_ucs2_t *uni_dom_name,
- size_t uni_name_len, char* pwd,
+ size_t uni_name_len, const char* pwd,
DOM_SID sid)
{
struct trusted_dom_pass pass;
diff --git a/source3/passdb/util_sam_sid.c b/source3/passdb/util_sam_sid.c
index 0881531db8..6a7675a12a 100644
--- a/source3/passdb/util_sam_sid.c
+++ b/source3/passdb/util_sam_sid.c
@@ -27,14 +27,14 @@
typedef struct _known_sid_users {
uint32 rid;
enum SID_NAME_USE sid_name_use;
- char *known_user_name;
+ const char *known_user_name;
} known_sid_users;
static struct sid_name_map_info
{
DOM_SID *sid;
- char *name;
- known_sid_users *known_users;
+ const char *name;
+ const known_sid_users *known_users;
} sid_name_map[MAX_SID_NAMES];
extern DOM_SID global_sid_Builtin; /* Local well-known domain */
@@ -46,16 +46,16 @@ extern DOM_SID global_sid_NT_Authority; /* NT Authority */
static BOOL sid_name_map_initialized = False;
/* static known_sid_users no_users[] = {{0, 0, NULL}}; */
-static known_sid_users everyone_users[] = {
+static const known_sid_users everyone_users[] = {
{ 0, SID_NAME_WKN_GRP, "Everyone" },
{0, (enum SID_NAME_USE)0, NULL}};
-static known_sid_users creator_owner_users[] = {
+static const known_sid_users creator_owner_users[] = {
{ 0, SID_NAME_WKN_GRP, "Creator Owner" },
{ 1, SID_NAME_WKN_GRP, "Creator Group" },
{0, (enum SID_NAME_USE)0, NULL}};
-static known_sid_users nt_authority_users[] = {
+static const known_sid_users nt_authority_users[] = {
{ 1, SID_NAME_ALIAS, "Dialup" },
{ 2, SID_NAME_ALIAS, "Network"},
{ 3, SID_NAME_ALIAS, "Batch"},
@@ -68,7 +68,7 @@ static known_sid_users nt_authority_users[] = {
{ 18, SID_NAME_ALIAS, "SYSTEM"},
{ 0, (enum SID_NAME_USE)0, NULL}};
-static known_sid_users builtin_groups[] = {
+static const known_sid_users builtin_groups[] = {
{ BUILTIN_ALIAS_RID_ADMINS, SID_NAME_ALIAS, "Administrators" },
{ BUILTIN_ALIAS_RID_USERS, SID_NAME_ALIAS, "Users" },
{ BUILTIN_ALIAS_RID_GUESTS, SID_NAME_ALIAS, "Guests" },
@@ -284,7 +284,7 @@ BOOL map_name_to_wellknown_sid(DOM_SID *sid, enum SID_NAME_USE *use, const char
init_sid_name_map();
for (i=0; sid_name_map[i].sid != NULL; i++) {
- known_sid_users *users = sid_name_map[i].known_users;
+ const known_sid_users *users = sid_name_map[i].known_users;
if (users == NULL)
continue;