summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/auth/auth_sam.c6
-rw-r--r--source3/auth/pampass.c29
-rw-r--r--source3/lib/replace.c2
-rw-r--r--source3/lib/username.c10
-rw-r--r--source3/lib/util.c6
-rw-r--r--source3/libsmb/smbdes.c10
-rw-r--r--source3/libsmb/smbencrypt.c12
-rw-r--r--source3/nsswitch/wb_client.c8
-rw-r--r--source3/passdb/ldap.c26
-rw-r--r--source3/passdb/nispass.c22
-rw-r--r--source3/passdb/pampass.c29
-rw-r--r--source3/passdb/passdb.c142
-rw-r--r--source3/passdb/pdb_ldap.c12
-rw-r--r--source3/passdb/pdb_nisplus.c28
-rw-r--r--source3/passdb/pdb_smbpasswd.c16
-rw-r--r--source3/passdb/pdb_tdb.c38
-rw-r--r--source3/rpc_parse/parse_net.c12
-rw-r--r--source3/rpc_parse/parse_samr.c22
-rw-r--r--source3/rpc_server/srv_netlog_nt.c2
-rw-r--r--source3/rpc_server/srv_pipe.c2
-rw-r--r--source3/rpc_server/srv_util.c2
-rw-r--r--source3/smbd/auth_smbpasswd.c6
-rw-r--r--source3/smbd/chgpasswd.c20
23 files changed, 204 insertions, 258 deletions
diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c
index 2070f09fd6..6bc3793666 100644
--- a/source3/auth/auth_sam.c
+++ b/source3/auth/auth_sam.c
@@ -65,8 +65,8 @@ static BOOL smb_pwd_check_ntlmv1(const uchar *password,
core of smb password checking routine.
****************************************************************************/
static BOOL smb_pwd_check_ntlmv2(const uchar *password, size_t pwd_len,
- uchar *part_passwd,
- uchar const *c8,
+ const uchar *part_passwd,
+ const uchar *c8,
const char *user, const char *domain,
char user_sess_key[16])
{
@@ -109,7 +109,7 @@ static BOOL smb_pwd_check_ntlmv2(const uchar *password, size_t pwd_len,
****************************************************************************/
NTSTATUS sam_password_ok(SAM_ACCOUNT *sampass, const auth_usersupplied_info *user_info, char user_sess_key[16])
{
- uint8 *nt_pw, *lm_pw;
+ const uint8 *nt_pw, *lm_pw;
uint16 acct_ctrl = pdb_get_acct_ctrl(sampass);
if (!user_info || !sampass)
diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index 0c7c4f1291..6980b14f46 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -47,9 +47,9 @@
*/
struct smb_pam_userdata {
- char *PAM_username;
- char *PAM_password;
- char *PAM_newpassword;
+ const char *PAM_username;
+ const char *PAM_password;
+ const char *PAM_newpassword;
};
typedef int (*smb_pam_conv_fn)(int, const struct pam_message **, struct pam_response **, void *appdata_ptr);
@@ -180,7 +180,7 @@ static void special_char_sub(char *buf)
all_string_sub(buf, "\\t", "\t", 0);
}
-static void pwd_sub(char *buf, char *username, char *oldpass, char *newpass)
+static void pwd_sub(char *buf, const char *username, const char *oldpass, const char *newpass)
{
pstring_sub(buf, "%u", username);
all_string_sub(buf, "%o", oldpass, sizeof(fstring));
@@ -399,8 +399,8 @@ static void smb_free_pam_conv(struct pam_conv *pconv)
Allocate a pam_conv struct.
****************************************************************************/
-static struct pam_conv *smb_setup_pam_conv(smb_pam_conv_fn smb_pam_conv_fnptr, char *user,
- char *passwd, char *newpass)
+static struct pam_conv *smb_setup_pam_conv(smb_pam_conv_fn smb_pam_conv_fnptr, const char *user,
+ const char *passwd, const char *newpass)
{
struct pam_conv *pconv = (struct pam_conv *)malloc(sizeof(struct pam_conv));
struct smb_pam_userdata *udp = (struct smb_pam_userdata *)malloc(sizeof(struct smb_pam_userdata));
@@ -445,9 +445,10 @@ static BOOL smb_pam_end(pam_handle_t *pamh, struct pam_conv *smb_pam_conv_ptr)
* Start PAM authentication for specified account
*/
-static BOOL smb_pam_start(pam_handle_t **pamh, char *user, char *rhost, struct pam_conv *pconv)
+static BOOL smb_pam_start(pam_handle_t **pamh, const char *user, const char *rhost, struct pam_conv *pconv)
{
int pam_error;
+ const char *our_rhost;
*pamh = (pam_handle_t *)NULL;
@@ -460,14 +461,16 @@ static BOOL smb_pam_start(pam_handle_t **pamh, char *user, char *rhost, struct p
}
if (rhost == NULL) {
- rhost = client_name();
+ our_rhost = client_name();
if (strequal(rhost,"UNKNOWN"))
- rhost = client_addr();
+ our_rhost = client_addr();
+ } else {
+ our_rhost = rhost;
}
#ifdef PAM_RHOST
- DEBUG(4,("smb_pam_start: PAM: setting rhost to: %s\n", rhost));
- pam_error = pam_set_item(*pamh, PAM_RHOST, rhost);
+ DEBUG(4,("smb_pam_start: PAM: setting rhost to: %s\n", our_rhost));
+ pam_error = pam_set_item(*pamh, PAM_RHOST, our_rhost);
if(!smb_pam_error_handler(*pamh, pam_error, "set rhost failed", 0)) {
smb_pam_end(*pamh, pconv);
*pamh = (pam_handle_t *)NULL;
@@ -664,7 +667,7 @@ static BOOL smb_internal_pam_session(pam_handle_t *pamh, char *user, char *tty,
* Internal PAM Password Changer.
*/
-static BOOL smb_pam_chauthtok(pam_handle_t *pamh, char * user)
+static BOOL smb_pam_chauthtok(pam_handle_t *pamh, const char * user)
{
int pam_error;
@@ -846,7 +849,7 @@ NTSTATUS smb_pam_passcheck(char * user, char * password)
* PAM Password Change Suite
*/
-BOOL smb_pam_passchange(char * user, char * oldpassword, char * newpassword)
+BOOL smb_pam_passchange(const char * user, const char * oldpassword, const char * newpassword)
{
/* Appropriate quantities of root should be obtained BEFORE calling this function */
struct pam_conv *pconv = NULL;
diff --git a/source3/lib/replace.c b/source3/lib/replace.c
index b972c745b0..4dbcedc93a 100644
--- a/source3/lib/replace.c
+++ b/source3/lib/replace.c
@@ -124,7 +124,7 @@ Corrections by richard.kettlewell@kewill.com
/*
* Search for a match in a netgroup. This replaces it on broken systems.
*/
- int innetgr(char *group,char *host,char *user,char *dom)
+ int innetgr(const char *group,const char *host,const char *user,const char *dom)
{
char *hst, *usr, *dm;
diff --git a/source3/lib/username.c b/source3/lib/username.c
index 074e6c8992..e2ef539cec 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -299,7 +299,7 @@ static BOOL user_in_netgroup_list(const char *user, const char *ngname)
Check if a user is in a winbind group.
****************************************************************************/
-static BOOL user_in_winbind_group_list(char *user,char *gname, BOOL *winbind_answered)
+static BOOL user_in_winbind_group_list(const char *user, const char *gname, BOOL *winbind_answered)
{
int num_groups;
int i;
@@ -407,7 +407,7 @@ static BOOL user_in_unix_group_list(const char *user,const char *gname)
Check if a user is in a group list. Ask winbind first, then use UNIX.
****************************************************************************/
-BOOL user_in_group_list(char *user,char *gname)
+BOOL user_in_group_list(const char *user, const char *gname)
{
BOOL winbind_answered = False;
BOOL ret = user_in_winbind_group_list(user, gname, &winbind_answered);
@@ -423,7 +423,7 @@ BOOL user_in_group_list(char *user,char *gname)
and netgroup lists.
****************************************************************************/
-BOOL user_in_list(char *user,char **list)
+BOOL user_in_list(const char *user,char **list)
{
if (!list || !*list) return False;
@@ -505,7 +505,7 @@ BOOL user_in_list(char *user,char **list)
it assumes the string starts lowercased
****************************************************************************/
-static struct passwd *uname_string_combinations2(char *s,int offset,struct passwd *(*fn)(char *),int N)
+static struct passwd *uname_string_combinations2(char *s,int offset,struct passwd *(*fn)(const char *),int N)
{
ssize_t len = (ssize_t)strlen(s);
int i;
@@ -539,7 +539,7 @@ static struct passwd *uname_string_combinations2(char *s,int offset,struct passw
it assumes the string starts lowercased
****************************************************************************/
-static struct passwd * uname_string_combinations(char *s,struct passwd * (*fn)(char *),int N)
+static struct passwd * uname_string_combinations(char *s,struct passwd * (*fn)(const char *),int N)
{
int n;
struct passwd *ret;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 61da9eb230..af0a6bda71 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -824,7 +824,7 @@ static void strip_mount_options( pstring *str)
*******************************************************************/
#ifdef WITH_NISPLUS_HOME
-char *automount_lookup(char *user_name)
+char *automount_lookup(const char *user_name)
{
static fstring last_key = "";
static pstring last_value = "";
@@ -872,7 +872,7 @@ char *automount_lookup(char *user_name)
return last_value;
}
#else /* WITH_NISPLUS_HOME */
-char *automount_lookup(char *user_name)
+char *automount_lookup(const char *user_name)
{
static fstring last_key = "";
static pstring last_value = "";
@@ -1020,7 +1020,7 @@ uid_t nametouid(char *name)
is present does a shortcut lookup...
********************************************************************/
-gid_t nametogid(char *name)
+gid_t nametogid(const char *name)
{
struct group *grp;
char *p;
diff --git a/source3/libsmb/smbdes.c b/source3/libsmb/smbdes.c
index 30a5746934..866fc0c7e0 100644
--- a/source3/libsmb/smbdes.c
+++ b/source3/libsmb/smbdes.c
@@ -319,19 +319,19 @@ void E_P24(const unsigned char *p21, const unsigned char *c8, unsigned char *p24
smbhash(p24+16, c8, p21+14, 1);
}
-void D_P16(unsigned char *p14, unsigned char *in, unsigned char *out)
+void D_P16(const unsigned char *p14, const unsigned char *in, unsigned char *out)
{
smbhash(out, in, p14, 0);
smbhash(out+8, in+8, p14+7, 0);
}
-void E_old_pw_hash( unsigned char *p14, unsigned char *in, unsigned char *out)
+void E_old_pw_hash( unsigned char *p14, const unsigned char *in, unsigned char *out)
{
smbhash(out, in, p14, 1);
smbhash(out+8, in+8, p14+7, 1);
}
-void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key)
+void cred_hash1(unsigned char *out, const unsigned char *in,unsigned char *key)
{
unsigned char buf[8];
@@ -339,7 +339,7 @@ void cred_hash1(unsigned char *out,unsigned char *in,unsigned char *key)
smbhash(out, buf, key+9, 1);
}
-void cred_hash2(unsigned char *out,unsigned char *in,unsigned char *key)
+void cred_hash2(unsigned char *out, const unsigned char *in,unsigned char *key)
{
unsigned char buf[8];
static unsigned char key2[8];
@@ -358,7 +358,7 @@ void cred_hash3(unsigned char *out,unsigned char *in,unsigned char *key, int for
smbhash(out + 8, in + 8, key2, forw);
}
-void SamOEMhash( unsigned char *data, unsigned char *key, int val)
+void SamOEMhash( unsigned char *data, const unsigned char *key, int val)
{
unsigned char s_box[256];
unsigned char index_i = 0;
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index 4b127051b4..9b0ef37eb6 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -29,13 +29,13 @@
This implements the X/Open SMB password encryption
It takes a password, a 8 byte "crypt key" and puts 24 bytes of
encrypted password into p24 */
-void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24)
+void SMBencrypt(const uchar *passwd, const uchar *c8, uchar *p24)
{
uchar p14[15], p21[21];
memset(p21,'\0',21);
memset(p14,'\0',14);
- StrnCpy((char *)p14,(char *)passwd,14);
+ StrnCpy((char *)p14,(const char *)passwd,14);
strupper((char *)p14);
E_P16(p14, p21);
@@ -45,7 +45,7 @@ void SMBencrypt(uchar *passwd, uchar *c8, uchar *p24)
#ifdef DEBUG_PASSWORD
DEBUG(100,("SMBencrypt: lm#, challenge, response\n"));
dump_data(100, (char *)p21, 16);
- dump_data(100, (char *)c8, 8);
+ dump_data(100, (const char *)c8, 8);
dump_data(100, (char *)p24, 24);
#endif
}
@@ -72,7 +72,7 @@ void E_md4hash(uchar *passwd, uchar *p16)
}
/* Does both the NT and LM owfs of a user's password */
-void nt_lm_owf_gen(char *pwd, uchar nt_p16[16], uchar p16[16])
+void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar p16[16])
{
char passwd[514];
@@ -147,7 +147,7 @@ void SMBOWFencrypt(const uchar passwd[16], const uchar *c8, uchar p24[24])
}
/* Does the des encryption from the FIRST 8 BYTES of the NT or LM MD4 hash. */
-void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24])
+void NTLMSSPOWFencrypt(const uchar passwd[8], const uchar *ntlmchalresp, uchar p24[24])
{
uchar p21[21];
@@ -159,7 +159,7 @@ void NTLMSSPOWFencrypt(uchar passwd[8], uchar *ntlmchalresp, uchar p24[24])
#ifdef DEBUG_PASSWORD
DEBUG(100,("NTLMSSPOWFencrypt: p21, c8, p24\n"));
dump_data(100, (char *)p21, 21);
- dump_data(100, (char *)ntlmchalresp, 8);
+ dump_data(100, (const char *)ntlmchalresp, 8);
dump_data(100, (char *)p24, 24);
#endif
}
diff --git a/source3/nsswitch/wb_client.c b/source3/nsswitch/wb_client.c
index bc76771f9d..9b720e5ea4 100644
--- a/source3/nsswitch/wb_client.c
+++ b/source3/nsswitch/wb_client.c
@@ -249,7 +249,7 @@ BOOL winbind_gid_to_sid(DOM_SID *sid, gid_t gid)
/* Fetch the list of groups a user is a member of from winbindd. This is
used by winbind_initgroups and winbind_getgroups. */
-static int wb_getgroups(char *user, gid_t **groups)
+static int wb_getgroups(const char *user, gid_t **groups)
{
struct winbindd_request request;
struct winbindd_response response;
@@ -357,7 +357,7 @@ int winbind_initgroups(char *user, gid_t gid)
time consuming. If size is zero, list is not modified and the total
number of groups for the user is returned. */
-int winbind_getgroups(char *user, int size, gid_t *list)
+int winbind_getgroups(const char *user, int size, gid_t *list)
{
gid_t *groups = NULL;
int result, i;
@@ -433,7 +433,7 @@ BOOL winbind_gidtoname(fstring name, gid_t gid)
/* Utility function. Convert a name to a uid_t if possible. */
-BOOL winbind_nametouid(uid_t *puid, char *name)
+BOOL winbind_nametouid(uid_t *puid, const char *name)
{
DOM_SID sid;
enum SID_NAME_USE name_type;
@@ -450,7 +450,7 @@ BOOL winbind_nametouid(uid_t *puid, char *name)
/* Utility function. Convert a name to a gid_t if possible. */
-BOOL winbind_nametogid(gid_t *pgid, char *gname)
+BOOL winbind_nametogid(gid_t *pgid, const char *gname)
{
DOM_SID g_sid;
enum SID_NAME_USE name_type;
diff --git a/source3/passdb/ldap.c b/source3/passdb/ldap.c
index 753663a09c..e0ac013fc8 100644
--- a/source3/passdb/ldap.c
+++ b/source3/passdb/ldap.c
@@ -77,7 +77,7 @@ static BOOL ldap_connect_system(LDAP *ldap_struct)
/*******************************************************************
connect to the ldap server under a particular user.
******************************************************************/
-static BOOL ldap_connect_user(LDAP *ldap_struct, char *user, char *password)
+static BOOL ldap_connect_user(LDAP *ldap_struct, const char *user, const char *password)
{
if ( ldap_simple_bind_s(ldap_struct,lp_ldap_root(),lp_ldap_rootpasswd()) ! = LDAP_SUCCESS)
{
@@ -111,7 +111,7 @@ static BOOL ldap_search_one_user(LDAP *ldap_struct, char *filter, LDAPMessage **
/*******************************************************************
run the search by name.
******************************************************************/
-static BOOL ldap_search_one_user_by_name(LDAP *ldap_struct, char *user, LDAPMessage **result)
+static BOOL ldap_search_one_user_by_name(LDAP *ldap_struct, const char *user, LDAPMessage **result)
{
pstring filter;
/*
@@ -374,7 +374,7 @@ static void ldap_get_sam_passwd(LDAP *ldap_struct, LDAPMessage *entry,
manage memory used by the array, by each struct, and values
************************************************************************/
-static void make_a_mod(LDAPMod ***modlist,int modop, char *attribute, char *value)
+static void make_a_mod(LDAPMod ***modlist,int modop, const char *attribute, const char *value)
{
LDAPMod **mods, **tmods;
int i;
@@ -980,21 +980,6 @@ static BOOL del_ldappwd_entry(const char *name)
return False; /* Dummy... */
}
-static struct sam_disp_info *getldapdispnam(char *name)
-{
- return pdb_sam_to_dispinfo(getldap21pwnam(name));
-}
-
-static struct sam_disp_info *getldapdisprid(uint32 rid)
-{
- return pdb_sam_to_dispinfo(getldap21pwrid(rid));
-}
-
-static struct sam_disp_info *getldapdispent(void *vp)
-{
- return pdb_sam_to_dispinfo(getldap21pwent(vp));
-}
-
static struct sam_passwd *getldap21pwuid(uid_t uid)
{
return pdb_smb_to_sam(iterate_getsam21pwuid(pdb_uid_to_user_rid(uid)));
@@ -1018,10 +1003,7 @@ static struct passdb_ops ldap_ops =
iterate_getsam21pwuid, /* From passdb.c */
iterate_getsam21pwrid, /* From passdb.c */
add_ldap21pwd_entry,
- mod_ldap21pwd_entry,
- getldapdispnam,
- getldapdisprid,
- getldapdispent
+ mod_ldap21pwd_entry
};
struct passdb_ops *ldap_initialize_password_db(void)
diff --git a/source3/passdb/nispass.c b/source3/passdb/nispass.c
index a595cabb37..79465982ec 100644
--- a/source3/passdb/nispass.c
+++ b/source3/passdb/nispass.c
@@ -504,7 +504,7 @@ static BOOL setnisppwpos(void *vp, SMB_BIG_UINT tok)
sets a NIS+ attribute
*************************************************************************/
static void set_single_attribute(nis_object *new_obj, int col,
- char *val, int len, int flags)
+ const char *val, int len, int flags)
{
if (new_obj == NULL) return;
@@ -1031,21 +1031,6 @@ static struct smb_passwd *getnisppwuid(uid_t smb_userid)
return pdb_sam_to_smb(getnisp21pwuid(smb_userid));
}
-static struct sam_disp_info *getnispdispnam(char *name)
-{
- return pdb_sam_to_dispinfo(getnisp21pwnam(name));
-}
-
-static struct sam_disp_info *getnispdisprid(uint32 rid)
-{
- return pdb_sam_to_dispinfo(getnisp21pwrid(rid));
-}
-
-static struct sam_disp_info *getnispdispent(void *vp)
-{
- return pdb_sam_to_dispinfo(getnisp21pwent(vp));
-}
-
static struct passdb_ops nispasswd_ops = {
startnisppwent,
endnisppwent,
@@ -1063,10 +1048,7 @@ static struct passdb_ops nispasswd_ops = {
getnisp21pwuid,
getnisp21pwrid,
add_nisp21pwd_entry,
- mod_nisp21pwd_entry,
- getnispdispnam,
- getnispdisprid,
- getnispdispent
+ mod_nisp21pwd_entry
};
struct passdb_ops *nisplus_initialize_password_db(void)
diff --git a/source3/passdb/pampass.c b/source3/passdb/pampass.c
index 0c7c4f1291..6980b14f46 100644
--- a/source3/passdb/pampass.c
+++ b/source3/passdb/pampass.c
@@ -47,9 +47,9 @@
*/
struct smb_pam_userdata {
- char *PAM_username;
- char *PAM_password;
- char *PAM_newpassword;
+ const char *PAM_username;
+ const char *PAM_password;
+ const char *PAM_newpassword;
};
typedef int (*smb_pam_conv_fn)(int, const struct pam_message **, struct pam_response **, void *appdata_ptr);
@@ -180,7 +180,7 @@ static void special_char_sub(char *buf)
all_string_sub(buf, "\\t", "\t", 0);
}
-static void pwd_sub(char *buf, char *username, char *oldpass, char *newpass)
+static void pwd_sub(char *buf, const char *username, const char *oldpass, const char *newpass)
{
pstring_sub(buf, "%u", username);
all_string_sub(buf, "%o", oldpass, sizeof(fstring));
@@ -399,8 +399,8 @@ static void smb_free_pam_conv(struct pam_conv *pconv)
Allocate a pam_conv struct.
****************************************************************************/
-static struct pam_conv *smb_setup_pam_conv(smb_pam_conv_fn smb_pam_conv_fnptr, char *user,
- char *passwd, char *newpass)
+static struct pam_conv *smb_setup_pam_conv(smb_pam_conv_fn smb_pam_conv_fnptr, const char *user,
+ const char *passwd, const char *newpass)
{
struct pam_conv *pconv = (struct pam_conv *)malloc(sizeof(struct pam_conv));
struct smb_pam_userdata *udp = (struct smb_pam_userdata *)malloc(sizeof(struct smb_pam_userdata));
@@ -445,9 +445,10 @@ static BOOL smb_pam_end(pam_handle_t *pamh, struct pam_conv *smb_pam_conv_ptr)
* Start PAM authentication for specified account
*/
-static BOOL smb_pam_start(pam_handle_t **pamh, char *user, char *rhost, struct pam_conv *pconv)
+static BOOL smb_pam_start(pam_handle_t **pamh, const char *user, const char *rhost, struct pam_conv *pconv)
{
int pam_error;
+ const char *our_rhost;
*pamh = (pam_handle_t *)NULL;
@@ -460,14 +461,16 @@ static BOOL smb_pam_start(pam_handle_t **pamh, char *user, char *rhost, struct p
}
if (rhost == NULL) {
- rhost = client_name();
+ our_rhost = client_name();
if (strequal(rhost,"UNKNOWN"))
- rhost = client_addr();
+ our_rhost = client_addr();
+ } else {
+ our_rhost = rhost;
}
#ifdef PAM_RHOST
- DEBUG(4,("smb_pam_start: PAM: setting rhost to: %s\n", rhost));
- pam_error = pam_set_item(*pamh, PAM_RHOST, rhost);
+ DEBUG(4,("smb_pam_start: PAM: setting rhost to: %s\n", our_rhost));
+ pam_error = pam_set_item(*pamh, PAM_RHOST, our_rhost);
if(!smb_pam_error_handler(*pamh, pam_error, "set rhost failed", 0)) {
smb_pam_end(*pamh, pconv);
*pamh = (pam_handle_t *)NULL;
@@ -664,7 +667,7 @@ static BOOL smb_internal_pam_session(pam_handle_t *pamh, char *user, char *tty,
* Internal PAM Password Changer.
*/
-static BOOL smb_pam_chauthtok(pam_handle_t *pamh, char * user)
+static BOOL smb_pam_chauthtok(pam_handle_t *pamh, const char * user)
{
int pam_error;
@@ -846,7 +849,7 @@ NTSTATUS smb_pam_passcheck(char * user, char * password)
* PAM Password Change Suite
*/
-BOOL smb_pam_passchange(char * user, char * oldpassword, char * newpassword)
+BOOL smb_pam_passchange(const char * user, const char * oldpassword, const char * newpassword)
{
/* Appropriate quantities of root should be obtained BEFORE calling this function */
struct pam_conv *pconv = NULL;
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 671f18a7b0..c58afc1f89 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -52,17 +52,6 @@ BOOL initialize_password_db(BOOL reload)
}
-/*************************************************************
- Initialises a struct sam_disp_info.
- **************************************************************/
-
-static void pdb_init_dispinfo(struct sam_disp_info *user)
-{
- if (user == NULL)
- return;
- ZERO_STRUCTP(user);
-}
-
/************************************************************
Fill the SAM_ACCOUNT with default values.
@@ -253,26 +242,6 @@ BOOL pdb_free_sam(SAM_ACCOUNT **user)
}
-/*************************************************************************
- Routine to return the next entry in the sam passwd list.
- *************************************************************************/
-
-struct sam_disp_info *pdb_sam_to_dispinfo(SAM_ACCOUNT *user)
-{
- static struct sam_disp_info disp_info;
-
- if (user == NULL)
- return NULL;
-
- pdb_init_dispinfo(&disp_info);
-
- disp_info.smb_name = user->username;
- disp_info.full_name = user->full_name;
- disp_info.user_rid = user->user_rid;
-
- return &disp_info;
-}
-
/**********************************************************
Encode the account control bits into a string.
length = length of string to encode into (including terminating
@@ -354,7 +323,7 @@ uint16 pdb_decode_acct_ctrl(const char *p)
Routine to set 32 hex password characters from a 16 byte array.
**************************************************************/
-void pdb_sethexpwd(char *p, unsigned char *pwd, uint16 acct_ctrl)
+void pdb_sethexpwd(char *p, const unsigned char *pwd, uint16 acct_ctrl)
{
if (pwd != NULL) {
int i;
@@ -373,7 +342,7 @@ void pdb_sethexpwd(char *p, unsigned char *pwd, uint16 acct_ctrl)
into a 16 byte array.
**************************************************************/
-BOOL pdb_gethexpwd(char *p, unsigned char *pwd)
+BOOL pdb_gethexpwd(const char *p, unsigned char *pwd)
{
int i;
unsigned char lonybble, hinybble;
@@ -405,9 +374,9 @@ BOOL pdb_gethexpwd(char *p, unsigned char *pwd)
Group and User RID username mapping function
********************************************************************/
-BOOL pdb_name_to_rid(char *user_name, uint32 *u_rid, uint32 *g_rid)
+BOOL pdb_name_to_rid(const char *user_name, uint32 *u_rid, uint32 *g_rid)
{
- struct passwd *pw = Get_Pwnam(user_name, False);
+ struct passwd *pw = Get_Pwnam(user_name);
if (u_rid == NULL || g_rid == NULL || user_name == NULL)
return False;
@@ -446,6 +415,15 @@ gid_t pdb_user_rid_to_gid(uint32 user_rid)
}
/*******************************************************************
+ Converts NT group RID to a UNIX gid.
+ ********************************************************************/
+
+gid_t pdb_group_rid_to_gid(uint32 group_rid)
+{
+ return (gid_t)(((group_rid & (~GROUP_RID_TYPE))- 1000)/RID_MULTIPLIER);
+}
+
+/*******************************************************************
converts UNIX uid to an NT User RID.
********************************************************************/
@@ -628,7 +606,7 @@ BOOL local_lookup_name(const char *c_domain, const char *c_user, DOM_SID *psid,
(void)map_username(user);
- if((pass = Get_Pwnam(user, False))) {
+ if((pass = Get_Pwnam(user))) {
sid_append_rid( &local_sid, pdb_uid_to_user_rid(pass->pw_uid));
*psid_name_use = SID_NAME_USER;
} else {
@@ -881,8 +859,8 @@ void copy_sam_passwd(SAM_ACCOUNT *to, const SAM_ACCOUNT *from)
--jerry
*************************************************************/
-BOOL local_password_change(char *user_name, int local_flags,
- char *new_passwd,
+BOOL local_password_change(const char *user_name, int local_flags,
+ const char *new_passwd,
char *err_str, size_t err_str_len,
char *msg_str, size_t msg_str_len)
{
@@ -1042,7 +1020,7 @@ account without a valid local system user.\n", user_name);
Collection of get...() functions for SAM_ACCOUNT_INFO.
********************************************************************/
-uint16 pdb_get_acct_ctrl (SAM_ACCOUNT *sampass)
+uint16 pdb_get_acct_ctrl (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->acct_ctrl);
@@ -1050,7 +1028,7 @@ uint16 pdb_get_acct_ctrl (SAM_ACCOUNT *sampass)
return (ACB_DISABLED);
}
-time_t pdb_get_logon_time (SAM_ACCOUNT *sampass)
+time_t pdb_get_logon_time (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->logon_time);
@@ -1058,7 +1036,7 @@ time_t pdb_get_logon_time (SAM_ACCOUNT *sampass)
return (0);
}
-time_t pdb_get_logoff_time (SAM_ACCOUNT *sampass)
+time_t pdb_get_logoff_time (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->logoff_time);
@@ -1066,7 +1044,7 @@ time_t pdb_get_logoff_time (SAM_ACCOUNT *sampass)
return (-1);
}
-time_t pdb_get_kickoff_time (SAM_ACCOUNT *sampass)
+time_t pdb_get_kickoff_time (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->kickoff_time);
@@ -1074,7 +1052,7 @@ time_t pdb_get_kickoff_time (SAM_ACCOUNT *sampass)
return (-1);
}
-time_t pdb_get_pass_last_set_time (SAM_ACCOUNT *sampass)
+time_t pdb_get_pass_last_set_time (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->pass_last_set_time);
@@ -1082,7 +1060,7 @@ time_t pdb_get_pass_last_set_time (SAM_ACCOUNT *sampass)
return (-1);
}
-time_t pdb_get_pass_can_change_time (SAM_ACCOUNT *sampass)
+time_t pdb_get_pass_can_change_time (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->pass_can_change_time);
@@ -1090,7 +1068,7 @@ time_t pdb_get_pass_can_change_time (SAM_ACCOUNT *sampass)
return (-1);
}
-time_t pdb_get_pass_must_change_time (SAM_ACCOUNT *sampass)
+time_t pdb_get_pass_must_change_time (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->pass_must_change_time);
@@ -1098,7 +1076,7 @@ time_t pdb_get_pass_must_change_time (SAM_ACCOUNT *sampass)
return (-1);
}
-uint16 pdb_get_logon_divs (SAM_ACCOUNT *sampass)
+uint16 pdb_get_logon_divs (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->logon_divs);
@@ -1106,7 +1084,7 @@ uint16 pdb_get_logon_divs (SAM_ACCOUNT *sampass)
return (-1);
}
-uint32 pdb_get_hours_len (SAM_ACCOUNT *sampass)
+uint32 pdb_get_hours_len (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->hours_len);
@@ -1114,7 +1092,7 @@ uint32 pdb_get_hours_len (SAM_ACCOUNT *sampass)
return (-1);
}
-uint8* pdb_get_hours (SAM_ACCOUNT *sampass)
+const uint8* pdb_get_hours (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->hours);
@@ -1122,7 +1100,7 @@ uint8* pdb_get_hours (SAM_ACCOUNT *sampass)
return (NULL);
}
-uint8* pdb_get_nt_passwd (SAM_ACCOUNT *sampass)
+const uint8* pdb_get_nt_passwd (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->nt_pw);
@@ -1130,7 +1108,7 @@ uint8* pdb_get_nt_passwd (SAM_ACCOUNT *sampass)
return (NULL);
}
-uint8* pdb_get_lanman_passwd (SAM_ACCOUNT *sampass)
+const uint8* pdb_get_lanman_passwd (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->lm_pw);
@@ -1138,7 +1116,7 @@ uint8* pdb_get_lanman_passwd (SAM_ACCOUNT *sampass)
return (NULL);
}
-uint32 pdb_get_user_rid (SAM_ACCOUNT *sampass)
+uint32 pdb_get_user_rid (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->user_rid);
@@ -1146,7 +1124,7 @@ uint32 pdb_get_user_rid (SAM_ACCOUNT *sampass)
return (-1);
}
-uint32 pdb_get_group_rid (SAM_ACCOUNT *sampass)
+uint32 pdb_get_group_rid (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->group_rid);
@@ -1154,7 +1132,7 @@ uint32 pdb_get_group_rid (SAM_ACCOUNT *sampass)
return (-1);
}
-uid_t pdb_get_uid (SAM_ACCOUNT *sampass)
+uid_t pdb_get_uid (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->uid);
@@ -1162,7 +1140,7 @@ uid_t pdb_get_uid (SAM_ACCOUNT *sampass)
return ((uid_t)-1);
}
-gid_t pdb_get_gid (SAM_ACCOUNT *sampass)
+gid_t pdb_get_gid (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->gid);
@@ -1170,7 +1148,7 @@ gid_t pdb_get_gid (SAM_ACCOUNT *sampass)
return ((gid_t)-1);
}
-char* pdb_get_username (SAM_ACCOUNT *sampass)
+const char* pdb_get_username (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->username);
@@ -1178,7 +1156,7 @@ char* pdb_get_username (SAM_ACCOUNT *sampass)
return (NULL);
}
-char* pdb_get_domain (SAM_ACCOUNT *sampass)
+const char* pdb_get_domain (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->domain);
@@ -1186,7 +1164,7 @@ char* pdb_get_domain (SAM_ACCOUNT *sampass)
return (NULL);
}
-char* pdb_get_nt_username (SAM_ACCOUNT *sampass)
+const char* pdb_get_nt_username (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->nt_username);
@@ -1194,7 +1172,7 @@ char* pdb_get_nt_username (SAM_ACCOUNT *sampass)
return (NULL);
}
-char* pdb_get_fullname (SAM_ACCOUNT *sampass)
+const char* pdb_get_fullname (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->full_name);
@@ -1202,7 +1180,7 @@ char* pdb_get_fullname (SAM_ACCOUNT *sampass)
return (NULL);
}
-char* pdb_get_homedir (SAM_ACCOUNT *sampass)
+const char* pdb_get_homedir (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->home_dir);
@@ -1210,7 +1188,7 @@ char* pdb_get_homedir (SAM_ACCOUNT *sampass)
return (NULL);
}
-char* pdb_get_dirdrive (SAM_ACCOUNT *sampass)
+const char* pdb_get_dirdrive (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->dir_drive);
@@ -1218,7 +1196,7 @@ char* pdb_get_dirdrive (SAM_ACCOUNT *sampass)
return (NULL);
}
-char* pdb_get_logon_script (SAM_ACCOUNT *sampass)
+const char* pdb_get_logon_script (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->logon_script);
@@ -1226,7 +1204,7 @@ char* pdb_get_logon_script (SAM_ACCOUNT *sampass)
return (NULL);
}
-char* pdb_get_profile_path (SAM_ACCOUNT *sampass)
+const char* pdb_get_profile_path (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->profile_path);
@@ -1234,7 +1212,7 @@ char* pdb_get_profile_path (SAM_ACCOUNT *sampass)
return (NULL);
}
-char* pdb_get_acct_desc (SAM_ACCOUNT *sampass)
+const char* pdb_get_acct_desc (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->acct_desc);
@@ -1242,7 +1220,7 @@ char* pdb_get_acct_desc (SAM_ACCOUNT *sampass)
return (NULL);
}
-char* pdb_get_workstations (SAM_ACCOUNT *sampass)
+const char* pdb_get_workstations (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->workstations);
@@ -1250,7 +1228,7 @@ char* pdb_get_workstations (SAM_ACCOUNT *sampass)
return (NULL);
}
-char* pdb_get_munged_dial (SAM_ACCOUNT *sampass)
+const char* pdb_get_munged_dial (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->munged_dial);
@@ -1258,7 +1236,7 @@ char* pdb_get_munged_dial (SAM_ACCOUNT *sampass)
return (NULL);
}
-uint32 pdb_get_unknown3 (SAM_ACCOUNT *sampass)
+uint32 pdb_get_unknown3 (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->unknown_3);
@@ -1266,7 +1244,7 @@ uint32 pdb_get_unknown3 (SAM_ACCOUNT *sampass)
return (-1);
}
-uint32 pdb_get_unknown5 (SAM_ACCOUNT *sampass)
+uint32 pdb_get_unknown5 (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->unknown_5);
@@ -1274,7 +1252,7 @@ uint32 pdb_get_unknown5 (SAM_ACCOUNT *sampass)
return (-1);
}
-uint32 pdb_get_unknown6 (SAM_ACCOUNT *sampass)
+uint32 pdb_get_unknown6 (const SAM_ACCOUNT *sampass)
{
if (sampass)
return (sampass->unknown_6);
@@ -1411,7 +1389,7 @@ BOOL pdb_set_group_rid (SAM_ACCOUNT *sampass, uint32 grid)
Set the user's UNIX name.
********************************************************************/
-BOOL pdb_set_username(SAM_ACCOUNT *sampass, char *username)
+BOOL pdb_set_username(SAM_ACCOUNT *sampass, const char *username)
{
if (!sampass)
return False;
@@ -1428,7 +1406,7 @@ BOOL pdb_set_username(SAM_ACCOUNT *sampass, char *username)
Set the domain name.
********************************************************************/
-BOOL pdb_set_domain(SAM_ACCOUNT *sampass, char *domain)
+BOOL pdb_set_domain(SAM_ACCOUNT *sampass, const char *domain)
{
if (!sampass)
return False;
@@ -1445,7 +1423,7 @@ BOOL pdb_set_domain(SAM_ACCOUNT *sampass, char *domain)
Set the user's NT name.
********************************************************************/
-BOOL pdb_set_nt_username(SAM_ACCOUNT *sampass, char *nt_username)
+BOOL pdb_set_nt_username(SAM_ACCOUNT *sampass, const char *nt_username)
{
if (!sampass)
return False;
@@ -1462,7 +1440,7 @@ BOOL pdb_set_nt_username(SAM_ACCOUNT *sampass, char *nt_username)
Set the user's full name.
********************************************************************/
-BOOL pdb_set_fullname(SAM_ACCOUNT *sampass, char *fullname)
+BOOL pdb_set_fullname(SAM_ACCOUNT *sampass, const char *fullname)
{
if (!sampass)
return False;
@@ -1479,7 +1457,7 @@ BOOL pdb_set_fullname(SAM_ACCOUNT *sampass, char *fullname)
Set the user's logon script.
********************************************************************/
-BOOL pdb_set_logon_script(SAM_ACCOUNT *sampass, char *logon_script)
+BOOL pdb_set_logon_script(SAM_ACCOUNT *sampass, const char *logon_script)
{
if (!sampass)
return False;
@@ -1496,7 +1474,7 @@ BOOL pdb_set_logon_script(SAM_ACCOUNT *sampass, char *logon_script)
Set the user's profile path.
********************************************************************/
-BOOL pdb_set_profile_path (SAM_ACCOUNT *sampass, char *profile_path)
+BOOL pdb_set_profile_path (SAM_ACCOUNT *sampass, const char *profile_path)
{
if (!sampass)
return False;
@@ -1513,7 +1491,7 @@ BOOL pdb_set_profile_path (SAM_ACCOUNT *sampass, char *profile_path)
Set the user's directory drive.
********************************************************************/
-BOOL pdb_set_dir_drive (SAM_ACCOUNT *sampass, char *dir_drive)
+BOOL pdb_set_dir_drive (SAM_ACCOUNT *sampass, const char *dir_drive)
{
if (!sampass)
return False;
@@ -1530,7 +1508,7 @@ BOOL pdb_set_dir_drive (SAM_ACCOUNT *sampass, char *dir_drive)
Set the user's home directory.
********************************************************************/
-BOOL pdb_set_homedir (SAM_ACCOUNT *sampass, char *homedir)
+BOOL pdb_set_homedir (SAM_ACCOUNT *sampass, const char *homedir)
{
if (!sampass)
return False;
@@ -1547,7 +1525,7 @@ BOOL pdb_set_homedir (SAM_ACCOUNT *sampass, char *homedir)
Set the user's account description.
********************************************************************/
-BOOL pdb_set_acct_desc (SAM_ACCOUNT *sampass, char *acct_desc)
+BOOL pdb_set_acct_desc (SAM_ACCOUNT *sampass, const char *acct_desc)
{
if (!sampass)
return False;
@@ -1564,7 +1542,7 @@ BOOL pdb_set_acct_desc (SAM_ACCOUNT *sampass, char *acct_desc)
Set the user's workstation allowed list.
********************************************************************/
-BOOL pdb_set_workstations (SAM_ACCOUNT *sampass, char *workstations)
+BOOL pdb_set_workstations (SAM_ACCOUNT *sampass, const char *workstations)
{
if (!sampass)
return False;
@@ -1581,7 +1559,7 @@ BOOL pdb_set_workstations (SAM_ACCOUNT *sampass, char *workstations)
Set the user's dial string.
********************************************************************/
-BOOL pdb_set_munged_dial (SAM_ACCOUNT *sampass, char *munged_dial)
+BOOL pdb_set_munged_dial (SAM_ACCOUNT *sampass, const char *munged_dial)
{
if (!sampass)
return False;
@@ -1598,7 +1576,7 @@ BOOL pdb_set_munged_dial (SAM_ACCOUNT *sampass, char *munged_dial)
Set the user's NT hash.
********************************************************************/
-BOOL pdb_set_nt_passwd (SAM_ACCOUNT *sampass, uint8 *pwd)
+BOOL pdb_set_nt_passwd (SAM_ACCOUNT *sampass, const uint8 *pwd)
{
if (!sampass)
return False;
@@ -1626,7 +1604,7 @@ BOOL pdb_set_nt_passwd (SAM_ACCOUNT *sampass, uint8 *pwd)
Set the user's LM hash.
********************************************************************/
-BOOL pdb_set_lanman_passwd (SAM_ACCOUNT *sampass, uint8 *pwd)
+BOOL pdb_set_lanman_passwd (SAM_ACCOUNT *sampass, const uint8 *pwd)
{
if (!sampass)
return False;
@@ -1677,7 +1655,7 @@ BOOL pdb_set_unknown_6 (SAM_ACCOUNT *sampass, uint32 unkn)
return True;
}
-BOOL pdb_set_hours (SAM_ACCOUNT *sampass, uint8 *hours)
+BOOL pdb_set_hours (SAM_ACCOUNT *sampass, const uint8 *hours)
{
if (!sampass)
return False;
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index d44a6133f3..057395a381 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -264,7 +264,7 @@ Routine to manage the LDAPMod structure array
manage memory used by the array, by each struct, and values
************************************************************************/
-static void make_a_mod (LDAPMod *** modlist, int modop, char *attribute, char *value)
+static void make_a_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value)
{
LDAPMod **mods;
int i;
@@ -522,7 +522,7 @@ static BOOL init_sam_from_ldap (SAM_ACCOUNT * sampass,
Initialize SAM_ACCOUNT from an LDAP query
(Based on init_buffer_from_sam in pdb_tdb.c)
*********************************************************************/
-static BOOL init_ldap_from_sam (LDAPMod *** mods, int ldap_state, SAM_ACCOUNT * sampass)
+static BOOL init_ldap_from_sam (LDAPMod *** mods, int ldap_state, const SAM_ACCOUNT * sampass)
{
pstring temp;
@@ -676,7 +676,7 @@ BOOL pdb_getsampwent(SAM_ACCOUNT * user)
/**********************************************************************
Get SAM_ACCOUNT entry from LDAP by username
*********************************************************************/
-BOOL pdb_getsampwnam(SAM_ACCOUNT * user, char *sname)
+BOOL pdb_getsampwnam(SAM_ACCOUNT * user, const char *sname)
{
LDAP *ldap_struct;
LDAPMessage *result;
@@ -820,7 +820,7 @@ BOOL pdb_getsampwuid(SAM_ACCOUNT * user, uid_t uid)
/**********************************************************************
Delete entry from LDAP for username
*********************************************************************/
-BOOL pdb_delete_sam_account(char *sname)
+BOOL pdb_delete_sam_account(const char *sname)
{
int rc;
char *dn;
@@ -871,7 +871,7 @@ BOOL pdb_delete_sam_account(char *sname)
/**********************************************************************
Update SAM_ACCOUNT
*********************************************************************/
-BOOL pdb_update_sam_account(SAM_ACCOUNT * newpwd, BOOL override)
+BOOL pdb_update_sam_account(const SAM_ACCOUNT * newpwd, BOOL override)
{
int rc;
char *dn;
@@ -932,7 +932,7 @@ BOOL pdb_update_sam_account(SAM_ACCOUNT * newpwd, BOOL override)
/**********************************************************************
Add SAM_ACCOUNT to LDAP
*********************************************************************/
-BOOL pdb_add_sam_account(SAM_ACCOUNT * newpwd)
+BOOL pdb_add_sam_account(const SAM_ACCOUNT * newpwd)
{
int rc;
pstring filter;
diff --git a/source3/passdb/pdb_nisplus.c b/source3/passdb/pdb_nisplus.c
index a86d5ecb68..dddab8bdee 100644
--- a/source3/passdb/pdb_nisplus.c
+++ b/source3/passdb/pdb_nisplus.c
@@ -156,7 +156,7 @@ static char *make_nisname_from_uid(int uid, char *pfile)
/***************************************************************
make_nisname_from_name
****************************************************************/
-static char *make_nisname_from_name(char *user_name, char *pfile)
+static char *make_nisname_from_name(const char *user_name, char *pfile)
{
static pstring nisname;
@@ -171,7 +171,7 @@ static char *make_nisname_from_name(char *user_name, char *pfile)
/*************************************************************************
gets a NIS+ attribute
*************************************************************************/
-static void get_single_attribute(nis_object *new_obj, int col,
+static void get_single_attribute(const nis_object *new_obj, int col,
char *val, int len)
{
int entry_len;
@@ -190,7 +190,7 @@ static void get_single_attribute(nis_object *new_obj, int col,
/************************************************************************
makes a struct sam_passwd from a NIS+ object.
************************************************************************/
-static BOOL make_sam_from_nisp_object(SAM_ACCOUNT *pw_buf, nis_object *obj)
+static BOOL make_sam_from_nisp_object(SAM_ACCOUNT *pw_buf, const nis_object *obj)
{
char *ptr;
pstring full_name; /* this must be translated to dos code page */
@@ -405,7 +405,7 @@ static BOOL make_sam_from_nisp_object(SAM_ACCOUNT *pw_buf, nis_object *obj)
/************************************************************************
makes a struct sam_passwd from a NIS+ result.
************************************************************************/
-static BOOL make_sam_from_nisresult(SAM_ACCOUNT *pw_buf, nis_result *result)
+static BOOL make_sam_from_nisresult(SAM_ACCOUNT *pw_buf, const nis_result *result)
{
if (pw_buf == NULL || result == NULL) return False;
@@ -436,7 +436,7 @@ static BOOL make_sam_from_nisresult(SAM_ACCOUNT *pw_buf, nis_result *result)
sets a NIS+ attribute
*************************************************************************/
static void set_single_attribute(nis_object *new_obj, int col,
- char *val, int len, int flags)
+ const char *val, int len, int flags)
{
if (new_obj == NULL) return;
@@ -453,7 +453,7 @@ static void set_single_attribute(nis_object *new_obj, int col,
copy or modify nis object. this object is used to add or update
nisplus table entry.
****************************************************************/
-static BOOL init_nisp_from_sam(nis_object *obj, SAM_ACCOUNT *sampass,
+static BOOL init_nisp_from_sam(nis_object *obj, const SAM_ACCOUNT *sampass,
nis_object *old)
{
/*
@@ -470,7 +470,7 @@ static BOOL init_nisp_from_sam(nis_object *obj, SAM_ACCOUNT *sampass,
* store
*/
BOOL need_to_modify = False;
- char *name; /* from SAM */
+ const char *name = pdb_get_username(sampass); /* from SAM */
/* these must be static or allocate and free entry columns! */
static fstring uid; /* from SAM */
static fstring user_rid; /* from SAM */
@@ -489,8 +489,6 @@ static BOOL init_nisp_from_sam(nis_object *obj, SAM_ACCOUNT *sampass,
static fstring acct_desc; /* from SAM */
static char empty[1]; /* just an empty string */
-
- name = pdb_get_username(sampass);
slprintf(uid, sizeof(uid)-1, "%u", pdb_get_uid(sampass));
slprintf(user_rid, sizeof(user_rid)-1, "%u",
pdb_get_user_rid(sampass)? pdb_get_user_rid(sampass):
@@ -768,7 +766,7 @@ static BOOL init_nisp_from_sam(nis_object *obj, SAM_ACCOUNT *sampass,
pdb_get_hours_len(sampass)-1, EN_MODIFIED);
}
} else {
- char *homedir, *dirdrive, *logon_script, *profile_path, *workstations;
+ const char *homedir, *dirdrive, *logon_script, *profile_path, *workstations;
*empty = '\0'; /* empty string */
@@ -844,7 +842,7 @@ static BOOL init_nisp_from_sam(nis_object *obj, SAM_ACCOUNT *sampass,
/***************************************************************
calls nis_list, returns results.
****************************************************************/
-static nis_result *nisp_get_nis_list(char *nis_name, uint_t flags)
+static nis_result *nisp_get_nis_list(const char *nis_name, uint_t flags)
{
nis_result *result;
int i;
@@ -940,7 +938,7 @@ BOOL pdb_getsampwent(SAM_ACCOUNT *user)
/*************************************************************************
Routine to search the nisplus passwd file for an entry matching the username
*************************************************************************/
-BOOL pdb_getsampwnam(SAM_ACCOUNT * user, char *sname)
+BOOL pdb_getsampwnam(SAM_ACCOUNT * user, const char *sname)
{
/* Static buffers we will return. */
nis_result *result = NULL;
@@ -1056,7 +1054,7 @@ BOOL pdb_getsampwuid(SAM_ACCOUNT * user, uid_t uid)
/*************************************************************************
Routine to remove entry from the nisplus smbpasswd table
*************************************************************************/
-BOOL pdb_delete_sam_account(char *sname)
+BOOL pdb_delete_sam_account(const char *sname)
{
char *pfile = lp_smb_passwd_file();
pstring nisname;
@@ -1112,7 +1110,7 @@ BOOL pdb_delete_sam_account(char *sname)
/************************************************************************
Routine to add an entry to the nisplus passwd file.
*************************************************************************/
-BOOL pdb_add_sam_account(SAM_ACCOUNT * newpwd)
+BOOL pdb_add_sam_account(const SAM_ACCOUNT * newpwd)
{
int local_user = 0;
char *pfile;
@@ -1307,7 +1305,7 @@ BOOL pdb_add_sam_account(SAM_ACCOUNT * newpwd)
/************************************************************************
Routine to modify the nisplus passwd entry.
************************************************************************/
-BOOL pdb_update_sam_account(SAM_ACCOUNT * newpwd, BOOL override)
+BOOL pdb_update_sam_account(const SAM_ACCOUNT * newpwd, BOOL override)
{
nis_result *result, *addresult;
nis_object *obj;
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 85e91bc5ba..8524275f12 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -34,10 +34,10 @@
struct smb_passwd
{
uid_t smb_userid; /* this is actually the unix uid_t */
- char *smb_name; /* username string */
+ const char *smb_name; /* username string */
- unsigned char *smb_passwd; /* Null if no password */
- unsigned char *smb_nt_passwd; /* Null if no password */
+ const unsigned char *smb_passwd; /* Null if no password */
+ const unsigned char *smb_nt_passwd; /* Null if no password */
uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
time_t pass_last_set_time; /* password last set time */
@@ -489,7 +489,7 @@ static struct smb_passwd *getsmbfilepwent(void *vp)
Create a new smbpasswd entry - malloced space returned.
*************************************************************************/
-static char *format_new_smbpasswd_entry(struct smb_passwd *newpwd)
+static char *format_new_smbpasswd_entry(const struct smb_passwd *newpwd)
{
int new_entry_length;
char *new_entry;
@@ -549,7 +549,7 @@ static char *format_new_smbpasswd_entry(struct smb_passwd *newpwd)
Routine to add an entry to the smbpasswd file.
*************************************************************************/
-static BOOL add_smbfilepwd_entry(struct smb_passwd *newpwd)
+static BOOL add_smbfilepwd_entry(const struct smb_passwd *newpwd)
{
char *pfile = lp_smb_passwd_file();
struct smb_passwd *pwd = NULL;
@@ -651,7 +651,7 @@ Error was %s. Password file may be corrupt ! Please examine by hand !\n",
override = True, override XXXXXXXX'd out password or NO PASS
************************************************************************/
-static BOOL mod_smbfilepwd_entry(struct smb_passwd* pwd, BOOL override)
+static BOOL mod_smbfilepwd_entry(const struct smb_passwd* pwd, BOOL override)
{
/* Static buffers we will return. */
static pstring user_name;
@@ -1323,7 +1323,7 @@ BOOL pdb_getsampwent(SAM_ACCOUNT *user)
call getpwnam() for unix account information until we have found
the correct entry
***************************************************************/
-BOOL pdb_getsampwnam(SAM_ACCOUNT *sam_acct, char *username)
+BOOL pdb_getsampwnam(SAM_ACCOUNT *sam_acct, const char *username)
{
struct smb_passwd *smb_pw;
void *fp = NULL;
@@ -1508,7 +1508,7 @@ BOOL pdb_update_sam_account(const SAM_ACCOUNT *sampass, BOOL override)
return True;
}
-BOOL pdb_delete_sam_account (char* username)
+BOOL pdb_delete_sam_account (const char* username)
{
return del_smbfilepwd_entry(username);
}
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 95f66fc671..a170ac1345 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -173,7 +173,7 @@ done:
/**********************************************************************
Intialize a BYTE buffer from a SAM_ACCOUNT struct
*********************************************************************/
-static uint32 init_buffer_from_sam (uint8 **buf, SAM_ACCOUNT *sampass)
+static uint32 init_buffer_from_sam (uint8 **buf, const SAM_ACCOUNT *sampass)
{
size_t len, buflen;
@@ -186,25 +186,25 @@ static uint32 init_buffer_from_sam (uint8 **buf, SAM_ACCOUNT *sampass)
pass_last_set_time,
pass_can_change_time,
pass_must_change_time;
- char *username;
- char *domain;
- char *nt_username;
- char *dir_drive;
- char *unknown_str;
- char *munged_dial;
- char *fullname;
- char *homedir;
- char *logon_script;
- char *profile_path;
- char *acct_desc;
- char *workstations;
+ const char *username;
+ const char *domain;
+ const char *nt_username;
+ const char *dir_drive;
+ const char *unknown_str;
+ const char *munged_dial;
+ const char *fullname;
+ const char *homedir;
+ const char *logon_script;
+ const char *profile_path;
+ const char *acct_desc;
+ const char *workstations;
uint32 username_len, domain_len, nt_username_len,
dir_drive_len, unknown_str_len, munged_dial_len,
fullname_len, homedir_len, logon_script_len,
profile_path_len, acct_desc_len, workstations_len;
- uint8 *lm_pw;
- uint8 *nt_pw;
+ const uint8 *lm_pw;
+ const uint8 *nt_pw;
uint32 lm_pw_len = 16;
uint32 nt_pw_len = 16;
@@ -476,7 +476,7 @@ BOOL pdb_getsampwent(SAM_ACCOUNT *user)
Lookup a name in the SAM TDB
******************************************************************/
-BOOL pdb_getsampwnam (SAM_ACCOUNT *user, char *sname)
+BOOL pdb_getsampwnam (SAM_ACCOUNT *user, const char *sname)
{
TDB_CONTEXT *pwd_tdb;
TDB_DATA data, key;
@@ -624,7 +624,7 @@ BOOL pdb_getsampwrid (SAM_ACCOUNT *user, uint32 rid)
Delete a SAM_ACCOUNT
****************************************************************************/
-BOOL pdb_delete_sam_account(char *sname)
+BOOL pdb_delete_sam_account(const char *sname)
{
SAM_ACCOUNT *sam_pass = NULL;
TDB_CONTEXT *pwd_tdb;
@@ -799,7 +799,7 @@ done:
Modifies an existing SAM_ACCOUNT
****************************************************************************/
-BOOL pdb_update_sam_account (SAM_ACCOUNT *newpwd, BOOL override)
+BOOL pdb_update_sam_account (const SAM_ACCOUNT *newpwd, BOOL override)
{
return (tdb_update_sam(newpwd, override, TDB_MODIFY));
}
@@ -808,7 +808,7 @@ BOOL pdb_update_sam_account (SAM_ACCOUNT *newpwd, BOOL override)
Adds an existing SAM_ACCOUNT
****************************************************************************/
-BOOL pdb_add_sam_account (SAM_ACCOUNT *newpwd)
+BOOL pdb_add_sam_account (const SAM_ACCOUNT *newpwd)
{
return (tdb_update_sam(newpwd, True, TDB_INSERT));
}
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c
index a3ff179605..2ad970a61b 100644
--- a/source3/rpc_parse/parse_net.c
+++ b/source3/rpc_parse/parse_net.c
@@ -1209,12 +1209,12 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam
int len_user_name, len_full_name, len_home_dir,
len_dir_drive, len_logon_script, len_profile_path;
- char* user_name = pdb_get_username(sampw);
- char* full_name = pdb_get_fullname(sampw);
- char* home_dir = pdb_get_homedir(sampw);
- char* dir_drive = pdb_get_dirdrive(sampw);
- char* logon_script = pdb_get_logon_script(sampw);
- char* profile_path = pdb_get_profile_path(sampw);
+ const char* user_name = pdb_get_username(sampw);
+ const char* full_name = pdb_get_fullname(sampw);
+ const char* home_dir = pdb_get_homedir(sampw);
+ const char* dir_drive = pdb_get_dirdrive(sampw);
+ const char* logon_script = pdb_get_logon_script(sampw);
+ const char* profile_path = pdb_get_profile_path(sampw);
int len_logon_srv = strlen(logon_srv);
int len_logon_dom = strlen(logon_dom);
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index c92dbda7ec..3f489f0a2b 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -4978,7 +4978,7 @@ inits a SAM_USER_INFO_12 structure.
********************************************************************/
void init_sam_user_info12(SAM_USER_INFO_12 * usr,
- uint8 lm_pwd[16], uint8 nt_pwd[16])
+ const uint8 lm_pwd[16], const uint8 nt_pwd[16])
{
DEBUG(5, ("init_sam_user_info12\n"));
@@ -5770,15 +5770,15 @@ void init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw)
len_description, len_workstations, len_unknown_str,
len_munged_dial;
- char* user_name = pdb_get_username(pw);
- char* full_name = pdb_get_fullname(pw);
- char* home_dir = pdb_get_homedir(pw);
- char* dir_drive = pdb_get_dirdrive(pw);
- char* logon_script = pdb_get_logon_script(pw);
- char* profile_path = pdb_get_profile_path(pw);
- char* description = pdb_get_acct_desc(pw);
- char* workstations = pdb_get_workstations(pw);
- char* munged_dial = pdb_get_munged_dial(pw);
+ const char* user_name = pdb_get_username(pw);
+ const char* full_name = pdb_get_fullname(pw);
+ const char* home_dir = pdb_get_homedir(pw);
+ const char* dir_drive = pdb_get_dirdrive(pw);
+ const char* logon_script = pdb_get_logon_script(pw);
+ const char* profile_path = pdb_get_profile_path(pw);
+ const char* description = pdb_get_acct_desc(pw);
+ const char* workstations = pdb_get_workstations(pw);
+ const char* munged_dial = pdb_get_munged_dial(pw);
len_user_name = user_name != NULL ? strlen(user_name )+1 : 0;
len_full_name = full_name != NULL ? strlen(full_name )+1 : 0;
@@ -5974,7 +5974,7 @@ static BOOL sam_io_user_info21(char *desc, SAM_USER_INFO_21 * usr,
void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw)
{
int len_munged_dial;
- char* munged_dial = pdb_get_munged_dial(pw);
+ const char* munged_dial = pdb_get_munged_dial(pw);
len_munged_dial = munged_dial != NULL ? strlen(munged_dial )+1 : 0;
init_uni_hdr(&usr->hdr_munged_dial, len_munged_dial);
diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c
index 32a0a02e70..cb54d726b3 100644
--- a/source3/rpc_server/srv_netlog_nt.c
+++ b/source3/rpc_server/srv_netlog_nt.c
@@ -170,7 +170,7 @@ static void init_net_r_srv_pwset(NET_R_SRV_PWSET *r_s,
static BOOL get_md4pw(char *md4pw, char *mach_acct)
{
SAM_ACCOUNT *sampass = NULL;
- uint8 *pass;
+ const uint8 *pass;
BOOL ret;
#if 0
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index 7079cc2ca1..6f3c050519 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -271,7 +271,7 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p, RPC_AUTH_NTLMSSP_RESP *ntlm
BOOL guest_user = False;
SAM_ACCOUNT *sampass = NULL;
uchar null_smb_passwd[16];
- uchar *smb_passwd_ptr = NULL;
+ const uchar *smb_passwd_ptr = NULL;
DEBUG(5,("api_pipe_ntlmssp_verify: checking user details\n"));
diff --git a/source3/rpc_server/srv_util.c b/source3/rpc_server/srv_util.c
index d441758db2..40831cbad7 100644
--- a/source3/rpc_server/srv_util.c
+++ b/source3/rpc_server/srv_util.c
@@ -154,7 +154,7 @@ int make_dom_gids(TALLOC_CTX *ctx, char *gids_str, DOM_GID **ppgids)
/*******************************************************************
gets a domain user's groups
********************************************************************/
-void get_domain_user_groups(char *domain_groups, char *user)
+void get_domain_user_groups(char *domain_groups, const char *user)
{
pstring tmp;
diff --git a/source3/smbd/auth_smbpasswd.c b/source3/smbd/auth_smbpasswd.c
index 2070f09fd6..6bc3793666 100644
--- a/source3/smbd/auth_smbpasswd.c
+++ b/source3/smbd/auth_smbpasswd.c
@@ -65,8 +65,8 @@ static BOOL smb_pwd_check_ntlmv1(const uchar *password,
core of smb password checking routine.
****************************************************************************/
static BOOL smb_pwd_check_ntlmv2(const uchar *password, size_t pwd_len,
- uchar *part_passwd,
- uchar const *c8,
+ const uchar *part_passwd,
+ const uchar *c8,
const char *user, const char *domain,
char user_sess_key[16])
{
@@ -109,7 +109,7 @@ static BOOL smb_pwd_check_ntlmv2(const uchar *password, size_t pwd_len,
****************************************************************************/
NTSTATUS sam_password_ok(SAM_ACCOUNT *sampass, const auth_usersupplied_info *user_info, char user_sess_key[16])
{
- uint8 *nt_pw, *lm_pw;
+ const uint8 *nt_pw, *lm_pw;
uint16 acct_ctrl = pdb_get_acct_ctrl(sampass);
if (!user_info || !sampass)
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index 132a20cf05..286c316b93 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -51,9 +51,9 @@
extern struct passdb_ops pdb_ops;
-static BOOL check_oem_password(char *user,
- uchar * lmdata, uchar * lmhash,
- uchar * ntdata, uchar * nthash,
+static BOOL check_oem_password(const char *user,
+ uchar * lmdata, const uchar * lmhash,
+ const uchar * ntdata, const uchar * nthash,
SAM_ACCOUNT **hnd, char *new_passwd,
int new_passwd_size);
@@ -598,7 +598,7 @@ BOOL check_lanman_password(char *user, uchar * pass1,
uchar unenc_old_pw[16];
SAM_ACCOUNT *sampass = NULL;
uint16 acct_ctrl;
- uint8 *lanman_pw;
+ const uint8 *lanman_pw;
BOOL ret;
become_root();
@@ -663,7 +663,7 @@ BOOL change_lanman_password(SAM_ACCOUNT *sampass, uchar * pass1,
uchar unenc_new_pw[16];
BOOL ret;
uint16 acct_ctrl;
- uint8 *pwd;
+ const uint8 *pwd;
if (sampass == NULL) {
DEBUG(0,("change_lanman_password: no smb password entry.\n"));
@@ -759,16 +759,16 @@ BOOL pass_oem_change(char *user,
but does use the lm OEM password to check the nt hashed-hash.
************************************************************/
-static BOOL check_oem_password(char *user,
- uchar * lmdata, uchar * lmhash,
- uchar * ntdata, uchar * nthash,
+static BOOL check_oem_password(const char *user,
+ uchar * lmdata, const uchar * lmhash,
+ const uchar * ntdata, const uchar * nthash,
SAM_ACCOUNT **hnd, char *new_passwd,
int new_passwd_size)
{
static uchar null_pw[16];
static uchar null_ntpw[16];
SAM_ACCOUNT *sampass = NULL;
- uint8 *lanman_pw, *nt_pw;
+ const uint8 *lanman_pw, *nt_pw;
uint16 acct_ctrl;
int new_pw_len;
uchar new_ntp16[16];
@@ -827,7 +827,7 @@ static BOOL check_oem_password(char *user,
/*
* Call the hash function to get the new password.
*/
- SamOEMhash((uchar *) lmdata, (uchar *)lanman_pw, 516);
+ SamOEMhash( lmdata, lanman_pw, 516);
/*
* The length of the new password is in the last 4 bytes of