summaryrefslogtreecommitdiff
path: root/source3/passdb/pdb_nisplus.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-10-29 07:35:11 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-10-29 07:35:11 +0000
commitd9d7f023d8d11943ca0375e1573e6ec9921889bc (patch)
tree05cc98ee549f6d8d52711172c6fdcd3564d7ef55 /source3/passdb/pdb_nisplus.c
parent2038649e51f48a489aeec49947e1b791f0b3df43 (diff)
downloadsamba-d9d7f023d8d11943ca0375e1573e6ec9921889bc.tar.gz
samba-d9d7f023d8d11943ca0375e1573e6ec9921889bc.tar.bz2
samba-d9d7f023d8d11943ca0375e1573e6ec9921889bc.zip
This commit is number 4 of 4.
In particular this commit focuses on: Actually adding the 'const' to the passdb interface, and the flow-on changes. Also kill off the 'disp_info' stuff, as its no longer used. While these changes have been mildly tested, and are pretty small, any assistance in this is appreciated. ---- These changes introduces a large dose of 'const' to the Samba tree. There are a number of good reasons to do this: - I want to allow the SAM_ACCOUNT structure to move from wasteful pstrings and fstrings to allocated strings. We can't do that if people are modifying these outputs, as they may well make assumptions about getting pstrings and fstrings - I want --with-pam_smbpass to compile with a slightly sane volume of warnings, currently its pretty bad, even in 2.2 where is compiles at all. - Tridge assures me that he no longer opposes 'const religion' based on the ability to #define const the problem away. - Changed Get_Pwnam(x,y) into two variants (so that the const parameter can work correctly): - Get_Pwnam(const x) and Get_Pwnam_Modify(x). - Reworked smbd/chgpasswd.c to work with these mods, passing around a 'struct passwd' rather than the modified username --- This finishes this line of commits off, your tree should now compile again :-) Andrew Bartlett (This used to be commit c95f5aeb9327347674589ae313b75bee3bf8e317)
Diffstat (limited to 'source3/passdb/pdb_nisplus.c')
-rw-r--r--source3/passdb/pdb_nisplus.c28
1 files changed, 13 insertions, 15 deletions
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;