summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-12 23:20:50 +0000
committerJeremy Allison <jra@samba.org>2002-11-12 23:20:50 +0000
commit2f194322d419350f35a48dff750066894d68eccf (patch)
treeb0501eaf874ca8e740a51a8e0f29d261e32e0093 /source3/passdb
parentf2b669b37fecda2687860eba4a15801dc89855dc (diff)
downloadsamba-2f194322d419350f35a48dff750066894d68eccf.tar.gz
samba-2f194322d419350f35a48dff750066894d68eccf.tar.bz2
samba-2f194322d419350f35a48dff750066894d68eccf.zip
Removed global_myworkgroup, global_myname, global_myscope. Added liberal
dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit f755711df8f74f9b8e8c1a2b0d07d02a931eeb89)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/machine_sid.c7
-rw-r--r--source3/passdb/passdb.c14
-rw-r--r--source3/passdb/pdb_interface.c4
-rw-r--r--source3/passdb/pdb_ldap.c8
-rw-r--r--source3/passdb/util_sam_sid.c11
5 files changed, 19 insertions, 25 deletions
diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c
index e1a1de83a6..071af50877 100644
--- a/source3/passdb/machine_sid.c
+++ b/source3/passdb/machine_sid.c
@@ -79,7 +79,6 @@ static void generate_random_sid(DOM_SID *sid)
static BOOL pdb_generate_sam_sid(void)
{
char *fname = NULL;
- extern pstring global_myname;
BOOL is_dc = False;
if(global_sam_sid==NULL)
@@ -98,7 +97,7 @@ static BOOL pdb_generate_sam_sid(void)
break;
}
- if (secrets_fetch_domain_sid(global_myname, global_sam_sid)) {
+ if (secrets_fetch_domain_sid(global_myname(), global_sam_sid)) {
DOM_SID domain_sid;
/* We got our sid. If not a pdc/bdc, we're done. */
@@ -137,7 +136,7 @@ static BOOL pdb_generate_sam_sid(void)
if (read_sid_from_file(fname, global_sam_sid)) {
/* remember it for future reference and unlink the old MACHINE.SID */
- if (!secrets_store_domain_sid(global_myname, global_sam_sid)) {
+ if (!secrets_store_domain_sid(global_myname(), global_sam_sid)) {
DEBUG(0,("pdb_generate_sam_sid: Failed to store SID from file.\n"));
SAFE_FREE(fname);
return False;
@@ -162,7 +161,7 @@ static BOOL pdb_generate_sam_sid(void)
generate one and save it */
generate_random_sid(global_sam_sid);
- if (!secrets_store_domain_sid(global_myname, global_sam_sid)) {
+ if (!secrets_store_domain_sid(global_myname(), global_sam_sid)) {
DEBUG(0,("pdb_generate_sam_sid: Failed to store generated machine SID.\n"));
return False;
}
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index de737f7df7..ef1c1180dd 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -32,8 +32,6 @@
* responsible.
*/
-extern pstring global_myname;
-
/************************************************************
Fill the SAM_ACCOUNT with default values.
***********************************************************/
@@ -237,28 +235,28 @@ NTSTATUS pdb_fill_sam_pw(SAM_ACCOUNT *sam_account, const struct passwd *pwd)
pdb_set_profile_path(sam_account,
talloc_sub_specified((sam_account)->mem_ctx,
lp_logon_path(),
- pwd->pw_name, global_myname,
+ pwd->pw_name, global_myname(),
pwd->pw_uid, pwd->pw_gid),
PDB_DEFAULT);
pdb_set_homedir(sam_account,
talloc_sub_specified((sam_account)->mem_ctx,
lp_logon_home(),
- pwd->pw_name, global_myname,
+ pwd->pw_name, global_myname(),
pwd->pw_uid, pwd->pw_gid),
PDB_DEFAULT);
pdb_set_dir_drive(sam_account,
talloc_sub_specified((sam_account)->mem_ctx,
lp_logon_drive(),
- pwd->pw_name, global_myname,
+ pwd->pw_name, global_myname(),
pwd->pw_uid, pwd->pw_gid),
PDB_DEFAULT);
pdb_set_logon_script(sam_account,
talloc_sub_specified((sam_account)->mem_ctx,
lp_logon_script(),
- pwd->pw_name, global_myname,
+ pwd->pw_name, global_myname(),
pwd->pw_uid, pwd->pw_gid),
PDB_DEFAULT);
if (!pdb_set_acct_ctrl(sam_account, ACB_NORMAL, PDB_DEFAULT)) {
@@ -625,10 +623,10 @@ BOOL local_lookup_sid(DOM_SID *sid, char *name, enum SID_NAME_USE *psid_name_use
DEBUG(5,("local_lookup_sid: looking up RID %u.\n", (unsigned int)rid));
if (rid == DOMAIN_USER_RID_ADMIN) {
- char **admin_list = lp_admin_users(-1);
+ const char **admin_list = lp_admin_users(-1);
*psid_name_use = SID_NAME_USER;
if (admin_list) {
- char *p = *admin_list;
+ const char *p = *admin_list;
if(!next_token(&p, name, NULL, sizeof(fstring)))
fstrcpy(name, "Administrator");
} else {
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index ca199f8ea6..edc310c0c1 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -458,7 +458,7 @@ static NTSTATUS make_pdb_context(struct pdb_context **context)
Make a pdb_context, given an array of strings
*******************************************************************/
-NTSTATUS make_pdb_context_list(struct pdb_context **context, char **selected)
+NTSTATUS make_pdb_context_list(struct pdb_context **context, const char **selected)
{
int i = 0;
struct pdb_methods *curmethods, *tmpmethods;
@@ -492,7 +492,7 @@ NTSTATUS make_pdb_context_string(struct pdb_context **context, const char *selec
{
NTSTATUS ret;
char **newsel = str_list_make(selected, NULL);
- ret = make_pdb_context_list(context, newsel);
+ ret = make_pdb_context_list(context, (const char **)newsel);
str_list_free(&newsel);
return ret;
}
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index e35775a6da..8097d92364 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -507,7 +507,7 @@ static int ldapsam_retry_open(struct ldapsam_privates *ldap_state, int *attempts
}
-static int ldapsam_search(struct ldapsam_privates *ldap_state, char *base, int scope, char *filter, char *attrs[], int attrsonly, LDAPMessage **res)
+static int ldapsam_search(struct ldapsam_privates *ldap_state, const char *base, int scope, const char *filter, const char *attrs[], int attrsonly, LDAPMessage **res)
{
int rc = LDAP_SERVER_DOWN;
int attempts = 0;
@@ -636,7 +636,7 @@ static int ldapsam_search_one_user (struct ldapsam_privates *ldap_state, const c
DEBUG(2, ("ldapsam_search_one_user: searching for:[%s]\n", filter));
- rc = ldapsam_search(ldap_state, lp_ldap_suffix (), scope, (char *)filter, (char **)attr, 0, result);
+ rc = ldapsam_search(ldap_state, lp_ldap_suffix (), scope, filter, attr, 0, result);
if (rc != LDAP_SUCCESS) {
DEBUG(0,("ldapsam_search_one_user: Problem during the LDAP search: %s\n",
@@ -1412,7 +1412,7 @@ static uint32 search_top_nua_rid(struct ldapsam_privates *ldap_state)
DEBUG(2, ("ldapsam_get_next_available_nua_rid: searching for:[%s]\n", final_filter));
rc = ldapsam_search(ldap_state, lp_ldap_suffix(),
- LDAP_SCOPE_SUBTREE, final_filter, (char **)attr, 0,
+ LDAP_SCOPE_SUBTREE, final_filter, attr, 0,
&result);
if (rc != LDAP_SUCCESS) {
@@ -1486,7 +1486,7 @@ static NTSTATUS ldapsam_setsampwent(struct pdb_methods *my_methods, BOOL update)
all_string_sub(filter, "%u", "*", sizeof(pstring));
rc = ldapsam_search(ldap_state, lp_ldap_suffix(),
- LDAP_SCOPE_SUBTREE, filter, (char **)attr, 0,
+ LDAP_SCOPE_SUBTREE, filter, attr, 0,
&ldap_state->result);
if (rc != LDAP_SUCCESS) {
diff --git a/source3/passdb/util_sam_sid.c b/source3/passdb/util_sam_sid.c
index 60998003f6..0881531db8 100644
--- a/source3/passdb/util_sam_sid.c
+++ b/source3/passdb/util_sam_sid.c
@@ -22,9 +22,6 @@
#include "includes.h"
-extern pstring global_myname;
-extern fstring global_myworkgroup;
-
#define MAX_SID_NAMES 7
typedef struct _known_sid_users {
@@ -98,16 +95,16 @@ static void init_sid_name_map (void)
/* This is not lp_workgroup() for good reason:
it must stay around longer than the lp_*()
strings do */
- sid_name_map[i].name = global_myworkgroup;
+ sid_name_map[i].name = strdup(lp_workgroup());
sid_name_map[i].known_users = NULL;
i++;
sid_name_map[i].sid = get_global_sam_sid();
- sid_name_map[i].name = global_myname;
+ sid_name_map[i].name = strdup(global_myname());
sid_name_map[i].known_users = NULL;
i++;
} else {
sid_name_map[i].sid = get_global_sam_sid();
- sid_name_map[i].name = global_myname;
+ sid_name_map[i].name = strdup(global_myname());
sid_name_map[i].known_users = NULL;
i++;
}
@@ -224,7 +221,7 @@ BOOL map_domain_name_to_sid(DOM_SID *sid, char *nt_domain)
}
if (nt_domain[0] == 0) {
- fstrcpy(nt_domain, global_myname);
+ fstrcpy(nt_domain, global_myname());
DEBUG(5,("map_domain_name_to_sid: overriding blank name to %s\n", nt_domain));
sid_copy(sid, get_global_sam_sid());
return True;