summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/auth/auth.c2
-rw-r--r--source3/auth/auth_rhosts.c25
-rw-r--r--source3/auth/auth_sam.c18
-rw-r--r--source3/auth/auth_unix.c10
-rw-r--r--source3/auth/auth_util.c54
-rw-r--r--source3/include/auth.h2
-rw-r--r--source3/include/passdb.h128
-rw-r--r--source3/pam_smbpass/pam_smb_acct.c2
-rw-r--r--source3/pam_smbpass/pam_smb_auth.c16
-rw-r--r--source3/pam_smbpass/pam_smb_passwd.c22
-rw-r--r--source3/pam_smbpass/support.c4
-rw-r--r--source3/pam_smbpass/support.h4
-rw-r--r--source3/passdb/login_cache.c8
-rw-r--r--source3/passdb/passdb.c343
-rw-r--r--source3/passdb/pdb_compat.c10
-rw-r--r--source3/passdb/pdb_get_set.c476
-rw-r--r--source3/passdb/pdb_interface.c90
-rw-r--r--source3/passdb/pdb_ldap.c72
-rw-r--r--source3/passdb/pdb_nds.c4
-rw-r--r--source3/passdb/pdb_smbpasswd.c44
-rw-r--r--source3/passdb/pdb_tdb.c102
-rw-r--r--source3/rpc_parse/parse_samr.c4
-rw-r--r--source3/rpc_server/srv_netlog_nt.c24
-rw-r--r--source3/rpc_server/srv_samr_nt.c124
-rw-r--r--source3/rpc_server/srv_samr_util.c12
-rw-r--r--source3/smbd/chgpasswd.c50
-rw-r--r--source3/smbd/lanman.c6
-rw-r--r--source3/utils/net_rpc_samsync.c18
-rw-r--r--source3/utils/net_sam.c16
-rw-r--r--source3/utils/pdbedit.c50
-rw-r--r--source3/utils/smbpasswd.c8
31 files changed, 831 insertions, 917 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index 6dc30383d5..5329e736ff 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -196,7 +196,7 @@ static BOOL check_domain_match(const char *user, const char *domain)
* function auth_get_challenge().
*
* @param server_info If successful, contains information about the authentication,
- * including a SAM_ACCOUNT struct describing the user.
+ * including a struct samu struct describing the user.
*
* @return An NTSTATUS with NT_STATUS_OK or an appropriate error.
*
diff --git a/source3/auth/auth_rhosts.c b/source3/auth/auth_rhosts.c
index e310fa80fd..7068fa2e88 100644
--- a/source3/auth/auth_rhosts.c
+++ b/source3/auth/auth_rhosts.c
@@ -24,16 +24,17 @@
#define DBGC_CLASS DBGC_AUTH
/****************************************************************************
- Create a SAM_ACCOUNT - either by looking in the pdb, or by faking it up from
+ Create a struct samu - either by looking in the pdb, or by faking it up from
unix info.
****************************************************************************/
-static NTSTATUS auth_get_sam_account(const char *user, SAM_ACCOUNT **account)
+static NTSTATUS auth_get_sam_account(const char *user, struct samu **account)
{
BOOL pdb_ret;
NTSTATUS nt_status;
- if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam(account))) {
- return nt_status;
+
+ if ( !(*account = samu_new( NULL )) ) {
+ return NT_STATUS_NO_MEMORY;
}
become_root();
@@ -161,7 +162,7 @@ static BOOL check_user_equiv(const char *user, const char *remote, const char *e
check for a possible hosts equiv or rhosts entry for the user
****************************************************************************/
-static BOOL check_hosts_equiv(SAM_ACCOUNT *account)
+static BOOL check_hosts_equiv(struct samu *account)
{
uid_t uid;
char *fname = NULL;
@@ -191,7 +192,7 @@ static NTSTATUS check_hostsequiv_security(const struct auth_context *auth_contex
auth_serversupplied_info **server_info)
{
NTSTATUS nt_status;
- SAM_ACCOUNT *account = NULL;
+ struct samu *account = NULL;
if (!NT_STATUS_IS_OK(nt_status =
auth_get_sam_account(user_info->internal_username,
&account))) {
@@ -203,10 +204,10 @@ static NTSTATUS check_hostsequiv_security(const struct auth_context *auth_contex
if (check_hosts_equiv(account)) {
nt_status = make_server_info_sam(server_info, account);
if (!NT_STATUS_IS_OK(nt_status)) {
- pdb_free_sam(&account);
+ TALLOC_FREE(account);
}
} else {
- pdb_free_sam(&account);
+ TALLOC_FREE(account);
nt_status = NT_STATUS_NOT_IMPLEMENTED;
}
@@ -237,7 +238,7 @@ static NTSTATUS check_rhosts_security(const struct auth_context *auth_context,
auth_serversupplied_info **server_info)
{
NTSTATUS nt_status;
- SAM_ACCOUNT *account = NULL;
+ struct samu *account = NULL;
pstring rhostsfile;
const char *home;
@@ -257,14 +258,14 @@ static NTSTATUS check_rhosts_security(const struct auth_context *auth_context,
if (check_user_equiv(pdb_get_username(account),client_name(),rhostsfile)) {
nt_status = make_server_info_sam(server_info, account);
if (!NT_STATUS_IS_OK(nt_status)) {
- pdb_free_sam(&account);
+ TALLOC_FREE(account);
}
} else {
- pdb_free_sam(&account);
+ TALLOC_FREE(account);
}
unbecome_root();
} else {
- pdb_free_sam(&account);
+ TALLOC_FREE(account);
nt_status = NT_STATUS_NOT_IMPLEMENTED;
}
diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c
index 2ab42f7e11..6f8ca387d2 100644
--- a/source3/auth/auth_sam.c
+++ b/source3/auth/auth_sam.c
@@ -35,7 +35,7 @@ extern struct timeval smb_last_time;
static NTSTATUS sam_password_ok(const struct auth_context *auth_context,
TALLOC_CTX *mem_ctx,
- SAM_ACCOUNT *sampass,
+ struct samu *sampass,
const auth_usersupplied_info *user_info,
DATA_BLOB *user_sess_key,
DATA_BLOB *lm_sess_key)
@@ -73,7 +73,7 @@ static NTSTATUS sam_password_ok(const struct auth_context *auth_context,
bitmask.
****************************************************************************/
-static BOOL logon_hours_ok(SAM_ACCOUNT *sampass)
+static BOOL logon_hours_ok(struct samu *sampass)
{
/* In logon hours first bit is Sunday from 12AM to 1AM */
const uint8 *hours;
@@ -108,12 +108,12 @@ static BOOL logon_hours_ok(SAM_ACCOUNT *sampass)
}
/****************************************************************************
- Do a specific test for a SAM_ACCOUNT being vaild for this connection
+ Do a specific test for a struct samu being vaild for this connection
(ie not disabled, expired and the like).
****************************************************************************/
static NTSTATUS sam_account_ok(TALLOC_CTX *mem_ctx,
- SAM_ACCOUNT *sampass,
+ struct samu *sampass,
const auth_usersupplied_info *user_info)
{
uint16 acct_ctrl = pdb_get_acct_ctrl(sampass);
@@ -236,7 +236,7 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
const auth_usersupplied_info *user_info,
auth_serversupplied_info **server_info)
{
- SAM_ACCOUNT *sampass=NULL;
+ struct samu *sampass=NULL;
BOOL ret;
NTSTATUS nt_status;
NTSTATUS update_login_attempts_status;
@@ -263,7 +263,7 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
if (ret == False) {
DEBUG(3,("check_sam_security: Couldn't find user '%s' in "
"passdb.\n", user_info->internal_username));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_NO_SUCH_USER;
}
@@ -301,7 +301,7 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
}
data_blob_free(&user_sess_key);
data_blob_free(&lm_sess_key);
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return nt_status;
}
@@ -322,7 +322,7 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
nt_status = sam_account_ok(mem_ctx, sampass, user_info);
if (!NT_STATUS_IS_OK(nt_status)) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
data_blob_free(&user_sess_key);
data_blob_free(&lm_sess_key);
return nt_status;
@@ -334,7 +334,7 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0,("check_sam_security: make_server_info_sam() failed with '%s'\n", nt_errstr(nt_status)));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
data_blob_free(&user_sess_key);
data_blob_free(&lm_sess_key);
return nt_status;
diff --git a/source3/auth/auth_unix.c b/source3/auth/auth_unix.c
index df0703d348..1d29389716 100644
--- a/source3/auth/auth_unix.c
+++ b/source3/auth/auth_unix.c
@@ -30,7 +30,7 @@
**/
static BOOL update_smbpassword_file(const char *user, const char *password)
{
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
BOOL ret;
pdb_init_sam(&sampass);
@@ -41,7 +41,7 @@ static BOOL update_smbpassword_file(const char *user, const char *password)
if(ret == False) {
DEBUG(0,("pdb_getsampwnam returned NULL\n"));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return False;
}
@@ -50,12 +50,12 @@ static BOOL update_smbpassword_file(const char *user, const char *password)
* users password from a login.
*/
if (!pdb_set_acct_ctrl(sampass, pdb_get_acct_ctrl(sampass) & ~ACB_DISABLED, PDB_CHANGED)) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return False;
}
if (!pdb_set_plaintext_passwd (sampass, password)) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return False;
}
@@ -70,7 +70,7 @@ static BOOL update_smbpassword_file(const char *user, const char *password)
DEBUG(3,("pdb_update_sam_account returned %d\n",ret));
}
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return ret;
}
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 3e7c520fc5..7e6ab021b4 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -514,7 +514,7 @@ static int server_info_dtor(void *p)
talloc_get_type_abort(p, auth_serversupplied_info);
if (server_info->sam_account != NULL) {
- pdb_free_sam(&server_info->sam_account);
+ TALLOC_FREE(server_info->sam_account);
}
ZERO_STRUCTP(server_info);
@@ -547,11 +547,11 @@ static auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx)
}
/***************************************************************************
- Make (and fill) a user_info struct from a SAM_ACCOUNT
+ Make (and fill) a user_info struct from a struct samu
***************************************************************************/
NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info,
- SAM_ACCOUNT *sampass)
+ struct samu *sampass)
{
NTSTATUS status;
struct passwd *pwd;
@@ -949,7 +949,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
/* This is a passdb user, so ask passdb */
- SAM_ACCOUNT *sam_acct = NULL;
+ struct samu *sam_acct = NULL;
result = pdb_init_sam_talloc(tmp_ctx, &sam_acct);
if (!NT_STATUS_IS_OK(result)) {
@@ -1086,7 +1086,7 @@ BOOL user_in_group(const char *username, const char *groupname)
/***************************************************************************
Make (and fill) a user_info struct from a Kerberos PAC logon_info by
- conversion to a SAM_ACCOUNT
+ conversion to a struct samu
***************************************************************************/
NTSTATUS make_server_info_pac(auth_serversupplied_info **server_info,
@@ -1095,7 +1095,7 @@ NTSTATUS make_server_info_pac(auth_serversupplied_info **server_info,
PAC_LOGON_INFO *logon_info)
{
NTSTATUS status;
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
DOM_SID user_sid, group_sid;
fstring dom_name;
auth_serversupplied_info *result;
@@ -1108,7 +1108,7 @@ NTSTATUS make_server_info_pac(auth_serversupplied_info **server_info,
result = make_server_info(NULL);
if (result == NULL) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_NO_MEMORY;
}
@@ -1145,7 +1145,7 @@ NTSTATUS make_server_info_pac(auth_serversupplied_info **server_info,
/***************************************************************************
Make (and fill) a user_info struct from a 'struct passwd' by conversion
- to a SAM_ACCOUNT
+ to a struct samu
***************************************************************************/
NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
@@ -1153,7 +1153,7 @@ NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
struct passwd *pwd)
{
NTSTATUS status;
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
gid_t *gids;
auth_serversupplied_info *result;
@@ -1166,7 +1166,7 @@ NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
result = make_server_info(NULL);
if (!NT_STATUS_IS_OK(status)) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return status;
}
@@ -1206,7 +1206,7 @@ NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_info)
{
NTSTATUS status;
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
DOM_SID guest_sid;
BOOL ret;
static const char zeros[16];
@@ -1225,13 +1225,13 @@ static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_inf
unbecome_root();
if (!ret) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_NO_SUCH_USER;
}
status = make_server_info_sam(server_info, sampass);
if (!NT_STATUS_IS_OK(status)) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return status;
}
@@ -1311,7 +1311,7 @@ static NTSTATUS fill_sam_account(TALLOC_CTX *mem_ctx,
const char *username,
char **found_username,
uid_t *uid, gid_t *gid,
- SAM_ACCOUNT **sam_account)
+ struct samu **sam_account)
{
NTSTATUS nt_status;
fstring dom_user, lower_username;
@@ -1453,7 +1453,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
const char *nt_domain;
const char *nt_username;
- SAM_ACCOUNT *sam_account = NULL;
+ struct samu *sam_account = NULL;
DOM_SID user_sid;
DOM_SID group_sid;
@@ -1532,74 +1532,74 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
}
if (!pdb_set_nt_username(sam_account, nt_username, PDB_CHANGED)) {
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_NO_MEMORY;
}
if (!pdb_set_username(sam_account, nt_username, PDB_CHANGED)) {
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_NO_MEMORY;
}
if (!pdb_set_domain(sam_account, nt_domain, PDB_CHANGED)) {
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_NO_MEMORY;
}
if (!pdb_set_user_sid(sam_account, &user_sid, PDB_CHANGED)) {
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_UNSUCCESSFUL;
}
if (!pdb_set_group_sid(sam_account, &group_sid, PDB_CHANGED)) {
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_UNSUCCESSFUL;
}
if (!pdb_set_fullname(sam_account,
unistr2_static(&(info3->uni_full_name)),
PDB_CHANGED)) {
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_NO_MEMORY;
}
if (!pdb_set_logon_script(sam_account,
unistr2_static(&(info3->uni_logon_script)),
PDB_CHANGED)) {
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_NO_MEMORY;
}
if (!pdb_set_profile_path(sam_account,
unistr2_static(&(info3->uni_profile_path)),
PDB_CHANGED)) {
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_NO_MEMORY;
}
if (!pdb_set_homedir(sam_account,
unistr2_static(&(info3->uni_home_dir)),
PDB_CHANGED)) {
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_NO_MEMORY;
}
if (!pdb_set_dir_drive(sam_account,
unistr2_static(&(info3->uni_dir_drive)),
PDB_CHANGED)) {
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_NO_MEMORY;
}
result = make_server_info(NULL);
if (result == NULL) {
DEBUG(4, ("make_server_info failed!\n"));
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_NO_MEMORY;
}
/* save this here to _net_sam_logon() doesn't fail (it assumes a
- valid SAM_ACCOUNT) */
+ valid struct samu) */
result->sam_account = sam_account;
result->unix_name = talloc_strdup(result, found_username);
diff --git a/source3/include/auth.h b/source3/include/auth.h
index 79fbb93895..465892905a 100644
--- a/source3/include/auth.h
+++ b/source3/include/auth.h
@@ -63,7 +63,7 @@ typedef struct auth_serversupplied_info {
char *login_server; /* which server authorized the login? */
- SAM_ACCOUNT *sam_account;
+ struct samu *sam_account;
void *pam_handle;
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 79ba391867..68165ca3d5 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -62,7 +62,7 @@
#define ACCT_OWF_PWD 0x20000000
/*
- * bit flags representing initialized fields in SAM_ACCOUNT
+ * bit flags representing initialized fields in struct samu
*/
enum pdb_elements {
PDB_UNINIT,
@@ -135,70 +135,62 @@ typedef struct logon_cache_struct {
time_t bad_password_time;
} LOGIN_CACHE;
-typedef struct sam_passwd {
- TALLOC_CTX *mem_ctx;
-
- void (*free_fn)(struct sam_passwd **);
-
+struct samu {
struct pdb_methods *methods;
- struct user_data {
- /* initialization flags */
- struct bitmap *change_flags;
- struct bitmap *set_flags;
-
- time_t logon_time; /* logon time */
- time_t logoff_time; /* logoff time */
- time_t kickoff_time; /* kickoff time */
- time_t bad_password_time; /* last bad password entered */
- time_t pass_last_set_time; /* password last set time */
- time_t pass_can_change_time; /* password can change time */
- time_t pass_must_change_time; /* password must change time */
+ /* initialization flags */
+ struct bitmap *change_flags;
+ struct bitmap *set_flags;
+
+ time_t logon_time; /* logon time */
+ time_t logoff_time; /* logoff time */
+ time_t kickoff_time; /* kickoff time */
+ time_t bad_password_time; /* last bad password entered */
+ time_t pass_last_set_time; /* password last set time */
+ time_t pass_can_change_time; /* password can change time */
+ time_t pass_must_change_time; /* password must change time */
- const char * username; /* UNIX username string */
- const char * domain; /* Windows Domain name */
- const char * nt_username; /* Windows username string */
- const char * full_name; /* user's full name string */
- const char * unix_home_dir; /* UNIX home directory string */
- const char * home_dir; /* home directory string */
- const char * dir_drive; /* home directory drive string */
- const char * logon_script; /* logon script string */
- const char * profile_path; /* profile path string */
- const char * acct_desc; /* user description string */
- const char * workstations; /* login from workstations string */
- const char * unknown_str; /* don't know what this is, yet. */
- const char * munged_dial; /* munged path name and dial-back tel number */
+ const char *username; /* UNIX username string */
+ const char *domain; /* Windows Domain name */
+ const char *nt_username; /* Windows username string */
+ const char *full_name; /* user's full name string */
+ const char *unix_home_dir; /* UNIX home directory string */
+ const char *home_dir; /* home directory string */
+ const char *dir_drive; /* home directory drive string */
+ const char *logon_script; /* logon script string */
+ const char *profile_path; /* profile path string */
+ const char *acct_desc; /* user description string */
+ const char *workstations; /* login from workstations string */
+ const char *unknown_str; /* don't know what this is, yet. */
+ const char *munged_dial; /* munged path name and dial-back tel number */
- DOM_SID user_sid; /* Primary User SID */
- DOM_SID group_sid; /* Primary Group SID */
+ DOM_SID user_sid; /* Primary User SID */
+ DOM_SID group_sid; /* Primary Group SID */
- DATA_BLOB lm_pw; /* .data is Null if no password */
- DATA_BLOB nt_pw; /* .data is Null if no password */
- DATA_BLOB nt_pw_his; /* nt hashed password history .data is Null if not available */
- char* plaintext_pw; /* is Null if not available */
+ DATA_BLOB lm_pw; /* .data is Null if no password */
+ DATA_BLOB nt_pw; /* .data is Null if no password */
+ DATA_BLOB nt_pw_his; /* nt hashed password history .data is Null if not available */
+ char* plaintext_pw; /* is Null if not available */
- uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
- uint32 fields_present; /* 0x00ff ffff */
+ uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
+ uint32 fields_present; /* 0x00ff ffff */
- uint16 logon_divs; /* 168 - number of hours in a week */
- uint32 hours_len; /* normally 21 bytes */
- uint8 hours[MAX_HOURS_LEN];
-
- /* Was unknown_5. */
- uint16 bad_password_count;
- uint16 logon_count;
-
- uint32 unknown_6; /* 0x0000 04ec */
- /* a tag for who added the private methods */
- const struct pdb_methods *backend_private_methods;
- void *backend_private_data;
- void (*backend_private_data_free_fn)(void **);
- } private_u;
-
- /* Lets see if the remaining code can get the hint that you
- are meant to use the pdb_...() functions. */
+ uint16 logon_divs; /* 168 - number of hours in a week */
+ uint32 hours_len; /* normally 21 bytes */
+ uint8 hours[MAX_HOURS_LEN];
-} SAM_ACCOUNT;
+ /* Was unknown_5. */
+ uint16 bad_password_count;
+ uint16 logon_count;
+
+ uint32 unknown_6; /* 0x0000 04ec */
+
+ /* a tag for who added the private methods */
+ const struct pdb_methods *backend_private_methods;
+ void *backend_private_data;
+ void (*backend_private_data_free_fn)(void **);
+
+};
struct acct_info {
fstring acct_name; /* account name */
@@ -257,28 +249,28 @@ struct pdb_methods
void (*endsampwent)(struct pdb_methods *);
- NTSTATUS (*getsampwent)(struct pdb_methods *, SAM_ACCOUNT *user);
+ NTSTATUS (*getsampwent)(struct pdb_methods *, struct samu *user);
- NTSTATUS (*getsampwnam)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const char *username);
+ NTSTATUS (*getsampwnam)(struct pdb_methods *, struct samu *sam_acct, const char *username);
- NTSTATUS (*getsampwsid)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const DOM_SID *sid);
+ NTSTATUS (*getsampwsid)(struct pdb_methods *, struct samu *sam_acct, const DOM_SID *sid);
NTSTATUS (*create_user)(struct pdb_methods *, TALLOC_CTX *tmp_ctx,
const char *name, uint32 acct_flags,
uint32 *rid);
NTSTATUS (*delete_user)(struct pdb_methods *, TALLOC_CTX *tmp_ctx,
- SAM_ACCOUNT *sam_acct);
+ struct samu *sam_acct);
- NTSTATUS (*add_sam_account)(struct pdb_methods *, SAM_ACCOUNT *sampass);
+ NTSTATUS (*add_sam_account)(struct pdb_methods *, struct samu *sampass);
- NTSTATUS (*update_sam_account)(struct pdb_methods *, SAM_ACCOUNT *sampass);
+ NTSTATUS (*update_sam_account)(struct pdb_methods *, struct samu *sampass);
- NTSTATUS (*delete_sam_account)(struct pdb_methods *, SAM_ACCOUNT *username);
+ NTSTATUS (*delete_sam_account)(struct pdb_methods *, struct samu *username);
- NTSTATUS (*rename_sam_account)(struct pdb_methods *, SAM_ACCOUNT *oldname, const char *newname);
+ NTSTATUS (*rename_sam_account)(struct pdb_methods *, struct samu *oldname, const char *newname);
- NTSTATUS (*update_login_attempts)(struct pdb_methods *methods, SAM_ACCOUNT *sam_acct, BOOL success);
+ NTSTATUS (*update_login_attempts)(struct pdb_methods *methods, struct samu *sam_acct, BOOL success);
NTSTATUS (*getgrsid)(struct pdb_methods *methods, GROUP_MAP *map, DOM_SID sid);
@@ -315,13 +307,13 @@ struct pdb_methods
NTSTATUS (*enum_group_memberships)(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
- SAM_ACCOUNT *user,
+ struct samu *user,
DOM_SID **pp_sids, gid_t **pp_gids,
size_t *p_num_groups);
NTSTATUS (*set_unix_primary_group)(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
- SAM_ACCOUNT *user);
+ struct samu *user);
NTSTATUS (*add_groupmem)(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
diff --git a/source3/pam_smbpass/pam_smb_acct.c b/source3/pam_smbpass/pam_smb_acct.c
index 2ea7eea7d8..8d5882bc93 100644
--- a/source3/pam_smbpass/pam_smb_acct.c
+++ b/source3/pam_smbpass/pam_smb_acct.c
@@ -46,7 +46,7 @@ int pam_sm_acct_mgmt( pam_handle_t *pamh, int flags,
int retval;
const char *name;
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
void (*oldsig_handler)(int);
extern BOOL in_client;
diff --git a/source3/pam_smbpass/pam_smb_auth.c b/source3/pam_smbpass/pam_smb_auth.c
index f604d42449..3de752cd30 100644
--- a/source3/pam_smbpass/pam_smb_auth.c
+++ b/source3/pam_smbpass/pam_smb_auth.c
@@ -47,7 +47,7 @@ do { \
} while (0)
static int _smb_add_user(pam_handle_t *pamh, unsigned int ctrl,
- const char *name, SAM_ACCOUNT *sampass, BOOL exist);
+ const char *name, struct samu *sampass, BOOL exist);
/*
@@ -64,7 +64,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
{
unsigned int ctrl;
int retval, *ret_data = NULL;
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
extern BOOL in_client;
const char *name;
void (*oldsig_handler)(int) = NULL;
@@ -113,14 +113,14 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
if (on( SMB_MIGRATE, ctrl )) {
retval = _smb_add_user(pamh, ctrl, name, sampass, found);
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
AUTH_RETURN;
}
if (!found) {
_log_err(LOG_ALERT, "Failed to find entry for user %s.", name);
retval = PAM_USER_UNKNOWN;
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
sampass = NULL;
AUTH_RETURN;
}
@@ -128,7 +128,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
/* if this user does not have a password... */
if (_smb_blankpasswd( ctrl, sampass )) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
retval = PAM_SUCCESS;
AUTH_RETURN;
}
@@ -139,14 +139,14 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
if (retval != PAM_SUCCESS ) {
_log_err(LOG_CRIT, "auth: no password provided for [%s]"
, name);
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
AUTH_RETURN;
}
/* verify the password of this user */
retval = _smb_verify_password( pamh, sampass, p, ctrl );
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
p = NULL;
AUTH_RETURN;
}
@@ -176,7 +176,7 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags,
/* Helper function for adding a user to the db. */
static int _smb_add_user(pam_handle_t *pamh, unsigned int ctrl,
- const char *name, SAM_ACCOUNT *sampass, BOOL exist)
+ const char *name, struct samu *sampass, BOOL exist)
{
pstring err_str;
pstring msg_str;
diff --git a/source3/pam_smbpass/pam_smb_passwd.c b/source3/pam_smbpass/pam_smb_passwd.c
index 176b278c04..f0a94bd49c 100644
--- a/source3/pam_smbpass/pam_smb_passwd.c
+++ b/source3/pam_smbpass/pam_smb_passwd.c
@@ -96,7 +96,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
extern BOOL in_client;
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
void (*oldsig_handler)(int);
const char *user;
char *pass_old;
@@ -158,7 +158,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
if (_smb_blankpasswd( ctrl, sampass )) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return PAM_SUCCESS;
}
@@ -172,7 +172,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
Announce = SMB_MALLOC_ARRAY(char, sizeof(greeting)+strlen(user));
if (Announce == NULL) {
_log_err(LOG_CRIT, "password: out of memory");
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return PAM_BUF_ERR;
}
@@ -188,7 +188,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
if (retval != PAM_SUCCESS) {
_log_err( LOG_NOTICE
, "password - (old) token not obtained" );
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
}
@@ -203,7 +203,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
}
pass_old = NULL;
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
@@ -233,7 +233,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
if (retval != PAM_SUCCESS) {
_log_err( LOG_NOTICE, "password: user not authenticated" );
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
}
@@ -261,7 +261,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
, "password: new password not obtained" );
}
pass_old = NULL; /* tidy up */
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
}
@@ -281,7 +281,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
if (retval != PAM_SUCCESS) {
_log_err(LOG_NOTICE, "new password not acceptable");
pass_new = pass_old = NULL; /* tidy up */
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
}
@@ -313,7 +313,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
pass_old = pass_new = NULL;
if (sampass) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
sampass = NULL;
}
@@ -325,11 +325,11 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
}
if (sampass) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
sampass = NULL;
}
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
CatchSignal(SIGPIPE, SIGNAL_CAST oldsig_handler);
return retval;
}
diff --git a/source3/pam_smbpass/support.c b/source3/pam_smbpass/support.c
index add74acc5d..c318a5c3ed 100644
--- a/source3/pam_smbpass/support.c
+++ b/source3/pam_smbpass/support.c
@@ -305,7 +305,7 @@ void _cleanup_failures( pam_handle_t * pamh, void *fl, int err )
}
}
-int _smb_verify_password( pam_handle_t * pamh, SAM_ACCOUNT *sampass,
+int _smb_verify_password( pam_handle_t * pamh, struct samu *sampass,
const char *p, unsigned int ctrl )
{
uchar lm_pw[16];
@@ -437,7 +437,7 @@ int _smb_verify_password( pam_handle_t * pamh, SAM_ACCOUNT *sampass,
* - to avoid prompting for one in such cases (CG)
*/
-int _smb_blankpasswd( unsigned int ctrl, SAM_ACCOUNT *sampass )
+int _smb_blankpasswd( unsigned int ctrl, struct samu *sampass )
{
int retval;
diff --git a/source3/pam_smbpass/support.h b/source3/pam_smbpass/support.h
index a13a2d0aeb..0b2863d7b9 100644
--- a/source3/pam_smbpass/support.h
+++ b/source3/pam_smbpass/support.h
@@ -26,7 +26,7 @@ extern BOOL strequal(const char *, const char *);
extern struct smb_passwd *
_my_get_smbpwnam(FILE *, const char *, BOOL *, BOOL *, long *);
-extern int _smb_verify_password( pam_handle_t *pamh , SAM_ACCOUNT *sampass,
+extern int _smb_verify_password( pam_handle_t *pamh , struct samu *sampass,
const char *p, unsigned int ctrl );
/*
@@ -39,7 +39,7 @@ extern int _smb_get_user(pam_handle_t *, unsigned int,
/* _smb_blankpasswd() is a quick check for a blank password */
-extern int _smb_blankpasswd(unsigned int, SAM_ACCOUNT *);
+extern int _smb_blankpasswd(unsigned int, struct samu *);
/* obtain a password from the user */
diff --git a/source3/passdb/login_cache.c b/source3/passdb/login_cache.c
index d82cfcc560..fba5990d81 100644
--- a/source3/passdb/login_cache.c
+++ b/source3/passdb/login_cache.c
@@ -1,6 +1,6 @@
/*
Unix SMB/CIFS implementation.
- SAM_ACCOUNT local cache for
+ struct samu local cache for
Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2004.
This program is free software; you can redistribute it and/or modify
@@ -64,7 +64,7 @@ BOOL login_cache_shutdown(void)
}
/* if we can't read the cache, oh well, no need to return anything */
-LOGIN_CACHE * login_cache_read(SAM_ACCOUNT *sampass)
+LOGIN_CACHE * login_cache_read(struct samu *sampass)
{
TDB_DATA keybuf, databuf;
LOGIN_CACHE *entry;
@@ -108,7 +108,7 @@ LOGIN_CACHE * login_cache_read(SAM_ACCOUNT *sampass)
return entry;
}
-BOOL login_cache_write(const SAM_ACCOUNT *sampass, LOGIN_CACHE entry)
+BOOL login_cache_write(const struct samu *sampass, LOGIN_CACHE entry)
{
TDB_DATA keybuf, databuf;
@@ -155,7 +155,7 @@ BOOL login_cache_write(const SAM_ACCOUNT *sampass, LOGIN_CACHE entry)
return ret == 0;
}
-BOOL login_cache_delentry(const SAM_ACCOUNT *sampass)
+BOOL login_cache_delentry(const struct samu *sampass)
{
int ret;
TDB_DATA keybuf;
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 97cccbf2a5..1632d222d4 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -48,49 +48,47 @@ const char *get_default_sam_name(void)
}
/************************************************************
- Fill the SAM_ACCOUNT with default values.
+ Fill the struct samu with default values.
***********************************************************/
-void pdb_fill_default_sam(SAM_ACCOUNT *user)
+void pdb_fill_default_sam(struct samu *user)
{
- ZERO_STRUCT(user->private_u); /* Don't touch the talloc context */
-
/* no initial methods */
user->methods = NULL;
/* Don't change these timestamp settings without a good reason.
They are important for NT member server compatibility. */
- user->private_u.logon_time = (time_t)0;
- user->private_u.pass_last_set_time = (time_t)0;
- user->private_u.pass_can_change_time = (time_t)0;
- user->private_u.logoff_time =
- user->private_u.kickoff_time =
- user->private_u.pass_must_change_time = get_time_t_max();
- user->private_u.fields_present = 0x00ffffff;
- user->private_u.logon_divs = 168; /* hours per week */
- user->private_u.hours_len = 21; /* 21 times 8 bits = 168 */
- memset(user->private_u.hours, 0xff, user->private_u.hours_len); /* available at all hours */
- user->private_u.bad_password_count = 0;
- user->private_u.logon_count = 0;
- user->private_u.unknown_6 = 0x000004ec; /* don't know */
+ user->logon_time = (time_t)0;
+ user->pass_last_set_time = (time_t)0;
+ user->pass_can_change_time = (time_t)0;
+ user->logoff_time =
+ user->kickoff_time =
+ user->pass_must_change_time = get_time_t_max();
+ user->fields_present = 0x00ffffff;
+ user->logon_divs = 168; /* hours per week */
+ user->hours_len = 21; /* 21 times 8 bits = 168 */
+ memset(user->hours, 0xff, user->hours_len); /* available at all hours */
+ user->bad_password_count = 0;
+ user->logon_count = 0;
+ user->unknown_6 = 0x000004ec; /* don't know */
/* Some parts of samba strlen their pdb_get...() returns,
so this keeps the interface unchanged for now. */
- user->private_u.username = "";
- user->private_u.domain = "";
- user->private_u.nt_username = "";
- user->private_u.full_name = "";
- user->private_u.home_dir = "";
- user->private_u.logon_script = "";
- user->private_u.profile_path = "";
- user->private_u.acct_desc = "";
- user->private_u.workstations = "";
- user->private_u.unknown_str = "";
- user->private_u.munged_dial = "";
-
- user->private_u.plaintext_pw = NULL;
+ user->username = "";
+ user->domain = "";
+ user->nt_username = "";
+ user->full_name = "";
+ user->home_dir = "";
+ user->logon_script = "";
+ user->profile_path = "";
+ user->acct_desc = "";
+ user->workstations = "";
+ user->unknown_str = "";
+ user->munged_dial = "";
+
+ user->plaintext_pw = NULL;
/*
Unless we know otherwise have a Account Control Bit
@@ -98,56 +96,70 @@ void pdb_fill_default_sam(SAM_ACCOUNT *user)
asks for a filtered list of users.
*/
- user->private_u.acct_ctrl = ACB_NORMAL;
+ user->acct_ctrl = ACB_NORMAL;
}
-static void destroy_pdb_talloc(SAM_ACCOUNT **user)
+/**********************************************************************
+***********************************************************************/
+
+static int samu_destroy(void *p)
{
- if (*user) {
- data_blob_clear_free(&((*user)->private_u.lm_pw));
- data_blob_clear_free(&((*user)->private_u.nt_pw));
+ struct samu *user = p;
- if((*user)->private_u.plaintext_pw!=NULL)
- memset((*user)->private_u.plaintext_pw,'\0',strlen((*user)->private_u.plaintext_pw));
- talloc_destroy((*user)->mem_ctx);
- *user = NULL;
- }
-}
+ data_blob_clear_free( &user->lm_pw );
+ data_blob_clear_free( &user->nt_pw );
+ if ( user->plaintext_pw )
+ memset( user->plaintext_pw, 0x0, strlen(user->plaintext_pw) );
+
+ return 0;
+}
/**********************************************************************
- Allocates memory and initialises a struct sam_passwd on supplied mem_ctx.
***********************************************************************/
-NTSTATUS pdb_init_sam_talloc(TALLOC_CTX *mem_ctx, SAM_ACCOUNT **user)
+BOOL samu_init( struct samu *user )
{
- if (*user != NULL) {
- DEBUG(0,("pdb_init_sam_talloc: SAM_ACCOUNT was non NULL\n"));
-#if 0
- smb_panic("non-NULL pointer passed to pdb_init_sam\n");
-#endif
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- if (!mem_ctx) {
- DEBUG(0,("pdb_init_sam_talloc: mem_ctx was NULL!\n"));
- return NT_STATUS_UNSUCCESSFUL;
- }
+ pdb_fill_default_sam( user );
+
+ return True;
+}
- *user=TALLOC_P(mem_ctx, SAM_ACCOUNT);
+/**********************************************************************
+ generate a new struct samuser
+***********************************************************************/
- if (*user==NULL) {
- DEBUG(0,("pdb_init_sam_talloc: error while allocating memory\n"));
- return NT_STATUS_NO_MEMORY;
+struct samu* samu_new( TALLOC_CTX *ctx )
+{
+ struct samu *user;
+
+ if ( !(user = TALLOC_ZERO_P( ctx, struct samu )) ) {
+ DEBUG(0,("samuser_new: Talloc failed!\n"));
+ return NULL;
}
+
+ if ( !samu_init( user ) ) {
+ DEBUG(0,("samuser_new: initialization failed!\n"));
+ TALLOC_FREE( user );
+ return NULL;
+ }
+
+ talloc_set_destructor( user, samu_destroy );
+
+ return user;
+}
- (*user)->mem_ctx = mem_ctx;
-
- (*user)->free_fn = NULL;
+/**********************************************************************
+ Allocates memory and initialises a struct sam_passwd on supplied mem_ctx.
+***********************************************************************/
- pdb_fill_default_sam(*user);
+NTSTATUS pdb_init_sam_talloc(TALLOC_CTX *mem_ctx, struct samu **user)
+{
+ if ( !*user )
+ return NT_STATUS_UNSUCCESSFUL;
- return NT_STATUS_OK;
+ *user = samu_new( mem_ctx );
+ return *user ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
}
@@ -155,26 +167,10 @@ NTSTATUS pdb_init_sam_talloc(TALLOC_CTX *mem_ctx, SAM_ACCOUNT **user)
Allocates memory and initialises a struct sam_passwd.
************************************************************/
-NTSTATUS pdb_init_sam(SAM_ACCOUNT **user)
+NTSTATUS pdb_init_sam(struct samu **user)
{
- TALLOC_CTX *mem_ctx;
- NTSTATUS nt_status;
-
- mem_ctx = talloc_init("passdb internal SAM_ACCOUNT allocation");
-
- if (!mem_ctx) {
- DEBUG(0,("pdb_init_sam: error while doing talloc_init()\n"));
- return NT_STATUS_NO_MEMORY;
- }
-
- if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam_talloc(mem_ctx, user))) {
- talloc_destroy(mem_ctx);
- return nt_status;
- }
-
- (*user)->free_fn = destroy_pdb_talloc;
-
- return NT_STATUS_OK;
+ *user = samu_new( NULL );
+ return *user ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
}
/**************************************************************************
@@ -186,7 +182,7 @@ NTSTATUS pdb_init_sam(SAM_ACCOUNT **user)
* SSS
***************************************************************************/
-static NTSTATUS pdb_set_sam_sids(SAM_ACCOUNT *account_data, const struct passwd *pwd)
+static NTSTATUS pdb_set_sam_sids(struct samu *account_data, const struct passwd *pwd)
{
const char *guest_account = lp_guestaccount();
GROUP_MAP map;
@@ -256,7 +252,7 @@ static NTSTATUS pdb_set_sam_sids(SAM_ACCOUNT *account_data, const struct passwd
Initialises a struct sam_passwd with sane values.
************************************************************/
-NTSTATUS pdb_fill_sam_pw(SAM_ACCOUNT *sam_account, const struct passwd *pwd)
+NTSTATUS pdb_fill_sam_pw(struct samu *sam_account, const struct passwd *pwd)
{
NTSTATUS ret;
@@ -290,28 +286,28 @@ NTSTATUS pdb_fill_sam_pw(SAM_ACCOUNT *sam_account, const struct passwd *pwd)
if (pwd->pw_name[strlen(pwd->pw_name)-1] != '$')
{
pdb_set_profile_path(sam_account,
- talloc_sub_specified((sam_account)->mem_ctx,
+ talloc_sub_specified(sam_account,
lp_logon_path(),
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,
+ talloc_sub_specified(sam_account,
lp_logon_home(),
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,
+ talloc_sub_specified(sam_account,
lp_logon_drive(),
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,
+ talloc_sub_specified(sam_account,
lp_logon_script(),
pwd->pw_name, global_myname(),
pwd->pw_uid, pwd->pw_gid),
@@ -334,7 +330,7 @@ NTSTATUS pdb_fill_sam_pw(SAM_ACCOUNT *sam_account, const struct passwd *pwd)
Initialises a struct sam_passwd with sane values.
************************************************************/
-NTSTATUS pdb_init_sam_pw(SAM_ACCOUNT **new_sam_acct, const struct passwd *pwd)
+NTSTATUS pdb_init_sam_pw(struct samu **new_sam_acct, const struct passwd *pwd)
{
NTSTATUS nt_status;
@@ -349,7 +345,7 @@ NTSTATUS pdb_init_sam_pw(SAM_ACCOUNT **new_sam_acct, const struct passwd *pwd)
}
if (!NT_STATUS_IS_OK(nt_status = pdb_fill_sam_pw(*new_sam_acct, pwd))) {
- pdb_free_sam(new_sam_acct);
+ TALLOC_FREE(new_sam_acct);
new_sam_acct = NULL;
return nt_status;
}
@@ -359,11 +355,11 @@ NTSTATUS pdb_init_sam_pw(SAM_ACCOUNT **new_sam_acct, const struct passwd *pwd)
/*************************************************************
- Initialises a SAM_ACCOUNT ready to add a new account, based
+ Initialises a struct samu ready to add a new account, based
on the UNIX user. Pass in a RID if you have one
************************************************************/
-NTSTATUS pdb_init_sam_new(SAM_ACCOUNT **new_sam_acct, const char *username)
+NTSTATUS pdb_init_sam_new(struct samu **new_sam_acct, const char *username)
{
NTSTATUS result;
struct passwd *pwd;
@@ -481,7 +477,7 @@ NTSTATUS pdb_init_sam_new(SAM_ACCOUNT **new_sam_acct, const char *username)
done:
if (!NT_STATUS_IS_OK(result) && (*new_sam_acct != NULL)) {
- pdb_free_sam(new_sam_acct);
+ TALLOC_FREE(new_sam_acct);
}
TALLOC_FREE(mem_ctx);
@@ -489,77 +485,6 @@ NTSTATUS pdb_init_sam_new(SAM_ACCOUNT **new_sam_acct, const char *username)
}
-/**
- * Free the contets of the SAM_ACCOUNT, but not the structure.
- *
- * Also wipes the LM and NT hashes and plaintext password from
- * memory.
- *
- * @param user SAM_ACCOUNT to free members of.
- **/
-
-static void pdb_free_sam_contents(SAM_ACCOUNT *user)
-{
-
- /* Kill off sensitive data. Free()ed by the
- talloc mechinism */
-
- data_blob_clear_free(&(user->private_u.lm_pw));
- data_blob_clear_free(&(user->private_u.nt_pw));
- if (user->private_u.plaintext_pw!=NULL)
- memset(user->private_u.plaintext_pw,'\0',strlen(user->private_u.plaintext_pw));
-
- if (user->private_u.backend_private_data && user->private_u.backend_private_data_free_fn) {
- user->private_u.backend_private_data_free_fn(&user->private_u.backend_private_data);
- }
-}
-
-
-/************************************************************
- Reset the SAM_ACCOUNT and free the NT/LM hashes.
- ***********************************************************/
-
-NTSTATUS pdb_reset_sam(SAM_ACCOUNT *user)
-{
- if (user == NULL) {
- DEBUG(0,("pdb_reset_sam: SAM_ACCOUNT was NULL\n"));
-#if 0
- smb_panic("NULL pointer passed to pdb_free_sam\n");
-#endif
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- pdb_free_sam_contents(user);
-
- pdb_fill_default_sam(user);
-
- return NT_STATUS_OK;
-}
-
-
-/************************************************************
- Free the SAM_ACCOUNT and the member pointers.
- ***********************************************************/
-
-NTSTATUS pdb_free_sam(SAM_ACCOUNT **user)
-{
- if (*user == NULL) {
- DEBUG(0,("pdb_free_sam: SAM_ACCOUNT was NULL\n"));
-#if 0
- smb_panic("NULL pointer passed to pdb_free_sam\n");
-#endif
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- pdb_free_sam_contents(*user);
-
- if ((*user)->free_fn) {
- (*user)->free_fn(user);
- }
-
- return NT_STATUS_OK;
-}
-
/**********************************************************
Encode the account control bits into a string.
length = length of string to encode into (including terminating
@@ -864,7 +789,7 @@ BOOL lookup_global_sam_name(const char *user, int flags, uint32_t *rid,
* is set, don't look for users at all. */
if ((flags & LOOKUP_NAME_GROUP) == 0) {
- SAM_ACCOUNT *sam_account = NULL;
+ struct samu *sam_account = NULL;
DOM_SID user_sid;
if (!NT_STATUS_IS_OK(pdb_init_sam(&sam_account))) {
@@ -879,7 +804,7 @@ BOOL lookup_global_sam_name(const char *user, int flags, uint32_t *rid,
sid_copy(&user_sid, pdb_get_user_sid(sam_account));
}
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
if (ret) {
if (!sid_check_is_in_our_domain(&user_sid)) {
@@ -929,7 +854,7 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
char *err_str, size_t err_str_len,
char *msg_str, size_t msg_str_len)
{
- SAM_ACCOUNT *sam_pass=NULL;
+ struct samu *sam_pass=NULL;
uint16 other_acb;
NTSTATUS result;
@@ -942,7 +867,7 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
become_root();
if(!pdb_getsampwnam(sam_pass, user_name)) {
unbecome_root();
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
if ((local_flags & LOCAL_ADD_USER) || (local_flags & LOCAL_DELETE_USER)) {
int tmp_debug = DEBUGLEVEL;
@@ -981,19 +906,19 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
if (local_flags & LOCAL_TRUST_ACCOUNT) {
if (!pdb_set_acct_ctrl(sam_pass, ACB_WSTRUST | other_acb, PDB_CHANGED) ) {
slprintf(err_str, err_str_len - 1, "Failed to set 'trusted workstation account' flags for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
} else if (local_flags & LOCAL_INTERDOM_ACCOUNT) {
if (!pdb_set_acct_ctrl(sam_pass, ACB_DOMTRUST | other_acb, PDB_CHANGED)) {
slprintf(err_str, err_str_len - 1, "Failed to set 'domain trust account' flags for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
} else {
if (!pdb_set_acct_ctrl(sam_pass, ACB_NORMAL | other_acb, PDB_CHANGED)) {
slprintf(err_str, err_str_len - 1, "Failed to set 'normal account' flags for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
}
@@ -1006,13 +931,13 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
if (local_flags & LOCAL_DISABLE_USER) {
if (!pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)|ACB_DISABLED, PDB_CHANGED)) {
slprintf(err_str, err_str_len-1, "Failed to set 'disabled' flag for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
} else if (local_flags & LOCAL_ENABLE_USER) {
if (!pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)&(~ACB_DISABLED), PDB_CHANGED)) {
slprintf(err_str, err_str_len-1, "Failed to unset 'disabled' flag for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
}
@@ -1020,7 +945,7 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
if (local_flags & LOCAL_SET_NO_PASSWORD) {
if (!pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)|ACB_PWNOTREQ, PDB_CHANGED)) {
slprintf(err_str, err_str_len-1, "Failed to set 'no password required' flag for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
} else if (local_flags & LOCAL_SET_PASSWORD) {
@@ -1036,19 +961,19 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
if ((pdb_get_lanman_passwd(sam_pass)==NULL) && (pdb_get_acct_ctrl(sam_pass)&ACB_DISABLED)) {
if (!pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)&(~ACB_DISABLED), PDB_CHANGED)) {
slprintf(err_str, err_str_len-1, "Failed to unset 'disabled' flag for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
}
if (!pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)&(~ACB_PWNOTREQ), PDB_CHANGED)) {
slprintf(err_str, err_str_len-1, "Failed to unset 'no password required' flag for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
if (!pdb_set_plaintext_passwd (sam_pass, new_passwd)) {
slprintf(err_str, err_str_len-1, "Failed to set password for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
}
@@ -1056,17 +981,17 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
if (local_flags & LOCAL_ADD_USER) {
if (NT_STATUS_IS_OK(pdb_add_sam_account(sam_pass))) {
slprintf(msg_str, msg_str_len-1, "Added user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_OK;
} else {
slprintf(err_str, err_str_len-1, "Failed to add entry for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
} else if (local_flags & LOCAL_DELETE_USER) {
if (!NT_STATUS_IS_OK(pdb_delete_sam_account(sam_pass))) {
slprintf(err_str,err_str_len-1, "Failed to delete entry for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_UNSUCCESSFUL;
}
slprintf(msg_str, msg_str_len-1, "Deleted user %s.\n", user_name);
@@ -1074,7 +999,7 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
result = pdb_update_sam_account(sam_pass);
if(!NT_STATUS_IS_OK(result)) {
slprintf(err_str, err_str_len-1, "Failed to modify entry for user %s.\n", user_name);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return result;
}
if(local_flags & LOCAL_DISABLE_USER)
@@ -1085,12 +1010,12 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
slprintf(msg_str, msg_str_len-1, "User %s password set to none.\n", user_name);
}
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_OK;
}
/**********************************************************************
- Marshall/unmarshall SAM_ACCOUNT structs.
+ Marshall/unmarshall struct samu structs.
*********************************************************************/
#define TDB_FORMAT_STRING_V0 "ddddddBBBBBBBBBBBBddBBwdwdBwwd"
@@ -1098,25 +1023,25 @@ NTSTATUS local_password_change(const char *user_name, int local_flags,
#define TDB_FORMAT_STRING_V2 "dddddddBBBBBBBBBBBBddBBBwwdBwwd"
/**********************************************************************
- Intialize a SAM_ACCOUNT struct from a BYTE buffer of size len
+ Intialize a struct samu struct from a BYTE buffer of size len
*********************************************************************/
-BOOL init_sam_from_buffer(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
+BOOL init_sam_from_buffer(struct samu *sampass, uint8 *buf, uint32 buflen)
{
return(init_sam_from_buffer_v2(sampass, buf, buflen));
}
/**********************************************************************
- Intialize a BYTE buffer from a SAM_ACCOUNT struct
+ Intialize a BYTE buffer from a struct samu struct
*********************************************************************/
-uint32 init_buffer_from_sam (uint8 **buf, const SAM_ACCOUNT *sampass, BOOL size_only)
+uint32 init_buffer_from_sam (uint8 **buf, const struct samu *sampass, BOOL size_only)
{
return(init_buffer_from_sam_v2(buf, sampass, size_only));
}
-BOOL init_sam_from_buffer_v0(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
+BOOL init_sam_from_buffer_v0(struct samu *sampass, uint8 *buf, uint32 buflen)
{
/* times are stored as 32bit integer
@@ -1216,7 +1141,7 @@ BOOL init_sam_from_buffer_v0(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
}
else {
pdb_set_homedir(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_home()),
+ talloc_sub_basic(sampass, username, lp_logon_home()),
PDB_DEFAULT);
}
@@ -1224,7 +1149,7 @@ BOOL init_sam_from_buffer_v0(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
pdb_set_dir_drive(sampass, dir_drive, PDB_SET);
else {
pdb_set_dir_drive(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_drive()),
+ talloc_sub_basic(sampass, username, lp_logon_drive()),
PDB_DEFAULT);
}
@@ -1232,7 +1157,7 @@ BOOL init_sam_from_buffer_v0(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
pdb_set_logon_script(sampass, logon_script, PDB_SET);
else {
pdb_set_logon_script(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_script()),
+ talloc_sub_basic(sampass, username, lp_logon_script()),
PDB_DEFAULT);
}
@@ -1240,7 +1165,7 @@ BOOL init_sam_from_buffer_v0(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
pdb_set_profile_path(sampass, profile_path, PDB_SET);
} else {
pdb_set_profile_path(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_path()),
+ talloc_sub_basic(sampass, username, lp_logon_path()),
PDB_DEFAULT);
}
@@ -1294,7 +1219,7 @@ done:
return ret;
}
-BOOL init_sam_from_buffer_v1(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
+BOOL init_sam_from_buffer_v1(struct samu *sampass, uint8 *buf, uint32 buflen)
{
/* times are stored as 32bit integer
@@ -1400,7 +1325,7 @@ BOOL init_sam_from_buffer_v1(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
}
else {
pdb_set_homedir(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_home()),
+ talloc_sub_basic(sampass, username, lp_logon_home()),
PDB_DEFAULT);
}
@@ -1408,7 +1333,7 @@ BOOL init_sam_from_buffer_v1(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
pdb_set_dir_drive(sampass, dir_drive, PDB_SET);
else {
pdb_set_dir_drive(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_drive()),
+ talloc_sub_basic(sampass, username, lp_logon_drive()),
PDB_DEFAULT);
}
@@ -1416,7 +1341,7 @@ BOOL init_sam_from_buffer_v1(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
pdb_set_logon_script(sampass, logon_script, PDB_SET);
else {
pdb_set_logon_script(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_script()),
+ talloc_sub_basic(sampass, username, lp_logon_script()),
PDB_DEFAULT);
}
@@ -1424,7 +1349,7 @@ BOOL init_sam_from_buffer_v1(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
pdb_set_profile_path(sampass, profile_path, PDB_SET);
} else {
pdb_set_profile_path(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_path()),
+ talloc_sub_basic(sampass, username, lp_logon_path()),
PDB_DEFAULT);
}
@@ -1480,7 +1405,7 @@ done:
}
-BOOL init_sam_from_buffer_v2(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
+BOOL init_sam_from_buffer_v2(struct samu *sampass, uint8 *buf, uint32 buflen)
{
/* times are stored as 32bit integer
@@ -1593,7 +1518,7 @@ BOOL init_sam_from_buffer_v2(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
}
else {
pdb_set_homedir(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_home()),
+ talloc_sub_basic(sampass, username, lp_logon_home()),
PDB_DEFAULT);
}
@@ -1612,7 +1537,7 @@ BOOL init_sam_from_buffer_v2(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
}
else {
pdb_set_logon_script(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_script()),
+ talloc_sub_basic(sampass, username, lp_logon_script()),
PDB_DEFAULT);
}
@@ -1626,7 +1551,7 @@ BOOL init_sam_from_buffer_v2(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
}
else {
pdb_set_profile_path(sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_path()),
+ talloc_sub_basic(sampass, username, lp_logon_path()),
PDB_DEFAULT);
}
@@ -1709,7 +1634,7 @@ done:
return ret;
}
-uint32 init_buffer_from_sam_v2 (uint8 **buf, const SAM_ACCOUNT *sampass, BOOL size_only)
+uint32 init_buffer_from_sam_v2 (uint8 **buf, const struct samu *sampass, BOOL size_only)
{
size_t len, buflen;
@@ -1751,9 +1676,9 @@ uint32 init_buffer_from_sam_v2 (uint8 **buf, const SAM_ACCOUNT *sampass, BOOL si
uint32 nt_pw_hist_len;
uint32 pwHistLen = 0;
- /* do we have a valid SAM_ACCOUNT pointer? */
+ /* do we have a valid struct samu pointer? */
if (sampass == NULL) {
- DEBUG(0, ("init_buffer_from_sam: SAM_ACCOUNT is NULL!\n"));
+ DEBUG(0, ("init_buffer_from_sam: struct samu is NULL!\n"));
return -1;
}
@@ -1981,7 +1906,7 @@ uint32 init_buffer_from_sam_v2 (uint8 **buf, const SAM_ACCOUNT *sampass, BOOL si
return (buflen);
}
-BOOL pdb_copy_sam_account(const SAM_ACCOUNT *src, SAM_ACCOUNT **dst)
+BOOL pdb_copy_sam_account(const struct samu *src, struct samu **dst)
{
BOOL result;
uint8 *buf;
@@ -2007,7 +1932,7 @@ BOOL pdb_copy_sam_account(const SAM_ACCOUNT *src, SAM_ACCOUNT **dst)
Update the bad password count checking the AP_RESET_COUNT_TIME
*********************************************************************/
-BOOL pdb_update_bad_password_count(SAM_ACCOUNT *sampass, BOOL *updated)
+BOOL pdb_update_bad_password_count(struct samu *sampass, BOOL *updated)
{
time_t LastBadPassword;
uint16 BadPasswordCount;
@@ -2050,7 +1975,7 @@ BOOL pdb_update_bad_password_count(SAM_ACCOUNT *sampass, BOOL *updated)
Update the ACB_AUTOLOCK flag checking the AP_LOCK_ACCOUNT_DURATION
*********************************************************************/
-BOOL pdb_update_autolock_flag(SAM_ACCOUNT *sampass, BOOL *updated)
+BOOL pdb_update_autolock_flag(struct samu *sampass, BOOL *updated)
{
uint32 duration;
time_t LastBadPassword;
@@ -2103,7 +2028,7 @@ bad password time. Leaving locked out.\n",
Increment the bad_password_count
*********************************************************************/
-BOOL pdb_increment_bad_password_count(SAM_ACCOUNT *sampass)
+BOOL pdb_increment_bad_password_count(struct samu *sampass)
{
uint32 account_policy_lockout;
BOOL autolock_updated = False, badpw_updated = False;
diff --git a/source3/passdb/pdb_compat.c b/source3/passdb/pdb_compat.c
index abd572a7c1..900fcc29fa 100644
--- a/source3/passdb/pdb_compat.c
+++ b/source3/passdb/pdb_compat.c
@@ -1,6 +1,6 @@
/*
Unix SMB/CIFS implementation.
- SAM_ACCOUNT access routines
+ struct samu access routines
Copyright (C) Jeremy Allison 1996-2001
Copyright (C) Luke Kenneth Casson Leighton 1996-1998
Copyright (C) Gerald (Jerry) Carter 2000-2001
@@ -27,7 +27,7 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
-uint32 pdb_get_user_rid (const SAM_ACCOUNT *sampass)
+uint32 pdb_get_user_rid (const struct samu *sampass)
{
uint32 u_rid;
@@ -38,7 +38,7 @@ uint32 pdb_get_user_rid (const SAM_ACCOUNT *sampass)
return (0);
}
-uint32 pdb_get_group_rid (const SAM_ACCOUNT *sampass)
+uint32 pdb_get_group_rid (const struct samu *sampass)
{
uint32 g_rid;
@@ -48,7 +48,7 @@ uint32 pdb_get_group_rid (const SAM_ACCOUNT *sampass)
return (0);
}
-BOOL pdb_set_user_sid_from_rid (SAM_ACCOUNT *sampass, uint32 rid, enum pdb_value_state flag)
+BOOL pdb_set_user_sid_from_rid (struct samu *sampass, uint32 rid, enum pdb_value_state flag)
{
DOM_SID u_sid;
const DOM_SID *global_sam_sid;
@@ -75,7 +75,7 @@ BOOL pdb_set_user_sid_from_rid (SAM_ACCOUNT *sampass, uint32 rid, enum pdb_value
return True;
}
-BOOL pdb_set_group_sid_from_rid (SAM_ACCOUNT *sampass, uint32 grid, enum pdb_value_state flag)
+BOOL pdb_set_group_sid_from_rid (struct samu *sampass, uint32 grid, enum pdb_value_state flag)
{
DOM_SID g_sid;
const DOM_SID *global_sam_sid;
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 046e658d2b..c39eb71162 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -1,6 +1,6 @@
/*
Unix SMB/CIFS implementation.
- SAM_ACCOUNT access routines
+ struct samu access routines
Copyright (C) Jeremy Allison 1996-2001
Copyright (C) Luke Kenneth Casson Leighton 1996-1998
Copyright (C) Gerald (Jerry) Carter 2000-2001
@@ -37,126 +37,126 @@
#define PDB_NOT_QUITE_NULL ""
/*********************************************************************
- Collection of get...() functions for SAM_ACCOUNT.
+ Collection of get...() functions for struct samu.
********************************************************************/
-uint16 pdb_get_acct_ctrl (const SAM_ACCOUNT *sampass)
+uint16 pdb_get_acct_ctrl (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.acct_ctrl);
+ return (sampass->acct_ctrl);
else
return (ACB_DISABLED);
}
-time_t pdb_get_logon_time (const SAM_ACCOUNT *sampass)
+time_t pdb_get_logon_time (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.logon_time);
+ return (sampass->logon_time);
else
return (0);
}
-time_t pdb_get_logoff_time (const SAM_ACCOUNT *sampass)
+time_t pdb_get_logoff_time (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.logoff_time);
+ return (sampass->logoff_time);
else
return (-1);
}
-time_t pdb_get_kickoff_time (const SAM_ACCOUNT *sampass)
+time_t pdb_get_kickoff_time (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.kickoff_time);
+ return (sampass->kickoff_time);
else
return (-1);
}
-time_t pdb_get_bad_password_time (const SAM_ACCOUNT *sampass)
+time_t pdb_get_bad_password_time (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.bad_password_time);
+ return (sampass->bad_password_time);
else
return (-1);
}
-time_t pdb_get_pass_last_set_time (const SAM_ACCOUNT *sampass)
+time_t pdb_get_pass_last_set_time (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.pass_last_set_time);
+ return (sampass->pass_last_set_time);
else
return (-1);
}
-time_t pdb_get_pass_can_change_time (const SAM_ACCOUNT *sampass)
+time_t pdb_get_pass_can_change_time (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.pass_can_change_time);
+ return (sampass->pass_can_change_time);
else
return (-1);
}
-time_t pdb_get_pass_must_change_time (const SAM_ACCOUNT *sampass)
+time_t pdb_get_pass_must_change_time (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.pass_must_change_time);
+ return (sampass->pass_must_change_time);
else
return (-1);
}
-uint16 pdb_get_logon_divs (const SAM_ACCOUNT *sampass)
+uint16 pdb_get_logon_divs (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.logon_divs);
+ return (sampass->logon_divs);
else
return (-1);
}
-uint32 pdb_get_hours_len (const SAM_ACCOUNT *sampass)
+uint32 pdb_get_hours_len (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.hours_len);
+ return (sampass->hours_len);
else
return (-1);
}
-const uint8* pdb_get_hours (const SAM_ACCOUNT *sampass)
+const uint8* pdb_get_hours (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.hours);
+ return (sampass->hours);
else
return (NULL);
}
-const uint8* pdb_get_nt_passwd (const SAM_ACCOUNT *sampass)
+const uint8* pdb_get_nt_passwd (const struct samu *sampass)
{
if (sampass) {
- SMB_ASSERT((!sampass->private_u.nt_pw.data)
- || sampass->private_u.nt_pw.length == NT_HASH_LEN);
- return ((uint8*)sampass->private_u.nt_pw.data);
+ SMB_ASSERT((!sampass->nt_pw.data)
+ || sampass->nt_pw.length == NT_HASH_LEN);
+ return ((uint8*)sampass->nt_pw.data);
}
else
return (NULL);
}
-const uint8* pdb_get_lanman_passwd (const SAM_ACCOUNT *sampass)
+const uint8* pdb_get_lanman_passwd (const struct samu *sampass)
{
if (sampass) {
- SMB_ASSERT((!sampass->private_u.lm_pw.data)
- || sampass->private_u.lm_pw.length == LM_HASH_LEN);
- return ((uint8*)sampass->private_u.lm_pw.data);
+ SMB_ASSERT((!sampass->lm_pw.data)
+ || sampass->lm_pw.length == LM_HASH_LEN);
+ return ((uint8*)sampass->lm_pw.data);
}
else
return (NULL);
}
-const uint8* pdb_get_pw_history (const SAM_ACCOUNT *sampass, uint32 *current_hist_len)
+const uint8* pdb_get_pw_history (const struct samu *sampass, uint32 *current_hist_len)
{
if (sampass) {
- SMB_ASSERT((!sampass->private_u.nt_pw_his.data)
- || ((sampass->private_u.nt_pw_his.length % PW_HISTORY_ENTRY_LEN) == 0));
- *current_hist_len = sampass->private_u.nt_pw_his.length / PW_HISTORY_ENTRY_LEN;
- return ((uint8*)sampass->private_u.nt_pw_his.data);
+ SMB_ASSERT((!sampass->nt_pw_his.data)
+ || ((sampass->nt_pw_his.length % PW_HISTORY_ENTRY_LEN) == 0));
+ *current_hist_len = sampass->nt_pw_his.length / PW_HISTORY_ENTRY_LEN;
+ return ((uint8*)sampass->nt_pw_his.data);
} else {
*current_hist_len = 0;
return (NULL);
@@ -169,49 +169,49 @@ const uint8* pdb_get_pw_history (const SAM_ACCOUNT *sampass, uint32 *current_his
Used to pass the plaintext to passdb backends that might
want to store more than just the NTLM hashes.
*/
-const char* pdb_get_plaintext_passwd (const SAM_ACCOUNT *sampass)
+const char* pdb_get_plaintext_passwd (const struct samu *sampass)
{
if (sampass) {
- return (sampass->private_u.plaintext_pw);
+ return (sampass->plaintext_pw);
}
else
return (NULL);
}
-const DOM_SID *pdb_get_user_sid(const SAM_ACCOUNT *sampass)
+const DOM_SID *pdb_get_user_sid(const struct samu *sampass)
{
if (sampass)
- return &sampass->private_u.user_sid;
+ return &sampass->user_sid;
else
return (NULL);
}
-const DOM_SID *pdb_get_group_sid(const SAM_ACCOUNT *sampass)
+const DOM_SID *pdb_get_group_sid(const struct samu *sampass)
{
if (sampass)
- return &sampass->private_u.group_sid;
+ return &sampass->group_sid;
else
return (NULL);
}
/**
- * Get flags showing what is initalised in the SAM_ACCOUNT
- * @param sampass the SAM_ACCOUNT in question
+ * Get flags showing what is initalised in the struct samu
+ * @param sampass the struct samu in question
* @return the flags indicating the members initialised in the struct.
**/
-enum pdb_value_state pdb_get_init_flags (const SAM_ACCOUNT *sampass, enum pdb_elements element)
+enum pdb_value_state pdb_get_init_flags (const struct samu *sampass, enum pdb_elements element)
{
enum pdb_value_state ret = PDB_DEFAULT;
- if (!sampass || !sampass->private_u.change_flags || !sampass->private_u.set_flags)
+ if (!sampass || !sampass->change_flags || !sampass->set_flags)
return ret;
- if (bitmap_query(sampass->private_u.set_flags, element)) {
+ if (bitmap_query(sampass->set_flags, element)) {
DEBUG(11, ("element %d: SET\n", element));
ret = PDB_SET;
}
- if (bitmap_query(sampass->private_u.change_flags, element)) {
+ if (bitmap_query(sampass->change_flags, element)) {
DEBUG(11, ("element %d: CHANGED\n", element));
ret = PDB_CHANGED;
}
@@ -223,270 +223,270 @@ enum pdb_value_state pdb_get_init_flags (const SAM_ACCOUNT *sampass, enum pdb_el
return ret;
}
-const char* pdb_get_username (const SAM_ACCOUNT *sampass)
+const char* pdb_get_username (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.username);
+ return (sampass->username);
else
return (NULL);
}
-const char* pdb_get_domain (const SAM_ACCOUNT *sampass)
+const char* pdb_get_domain (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.domain);
+ return (sampass->domain);
else
return (NULL);
}
-const char* pdb_get_nt_username (const SAM_ACCOUNT *sampass)
+const char* pdb_get_nt_username (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.nt_username);
+ return (sampass->nt_username);
else
return (NULL);
}
-const char* pdb_get_fullname (const SAM_ACCOUNT *sampass)
+const char* pdb_get_fullname (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.full_name);
+ return (sampass->full_name);
else
return (NULL);
}
-const char* pdb_get_homedir (const SAM_ACCOUNT *sampass)
+const char* pdb_get_homedir (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.home_dir);
+ return (sampass->home_dir);
else
return (NULL);
}
-const char* pdb_get_unix_homedir (const SAM_ACCOUNT *sampass)
+const char* pdb_get_unix_homedir (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.unix_home_dir);
+ return (sampass->unix_home_dir);
else
return (NULL);
}
-const char* pdb_get_dir_drive (const SAM_ACCOUNT *sampass)
+const char* pdb_get_dir_drive (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.dir_drive);
+ return (sampass->dir_drive);
else
return (NULL);
}
-const char* pdb_get_logon_script (const SAM_ACCOUNT *sampass)
+const char* pdb_get_logon_script (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.logon_script);
+ return (sampass->logon_script);
else
return (NULL);
}
-const char* pdb_get_profile_path (const SAM_ACCOUNT *sampass)
+const char* pdb_get_profile_path (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.profile_path);
+ return (sampass->profile_path);
else
return (NULL);
}
-const char* pdb_get_acct_desc (const SAM_ACCOUNT *sampass)
+const char* pdb_get_acct_desc (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.acct_desc);
+ return (sampass->acct_desc);
else
return (NULL);
}
-const char* pdb_get_workstations (const SAM_ACCOUNT *sampass)
+const char* pdb_get_workstations (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.workstations);
+ return (sampass->workstations);
else
return (NULL);
}
-const char* pdb_get_unknown_str (const SAM_ACCOUNT *sampass)
+const char* pdb_get_unknown_str (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.unknown_str);
+ return (sampass->unknown_str);
else
return (NULL);
}
-const char* pdb_get_munged_dial (const SAM_ACCOUNT *sampass)
+const char* pdb_get_munged_dial (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.munged_dial);
+ return (sampass->munged_dial);
else
return (NULL);
}
-uint16 pdb_get_bad_password_count(const SAM_ACCOUNT *sampass)
+uint16 pdb_get_bad_password_count(const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.bad_password_count);
+ return (sampass->bad_password_count);
else
return 0;
}
-uint16 pdb_get_logon_count(const SAM_ACCOUNT *sampass)
+uint16 pdb_get_logon_count(const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.logon_count);
+ return (sampass->logon_count);
else
return 0;
}
-uint32 pdb_get_unknown_6 (const SAM_ACCOUNT *sampass)
+uint32 pdb_get_unknown_6 (const struct samu *sampass)
{
if (sampass)
- return (sampass->private_u.unknown_6);
+ return (sampass->unknown_6);
else
return (-1);
}
-void *pdb_get_backend_private_data (const SAM_ACCOUNT *sampass, const struct pdb_methods *my_methods)
+void *pdb_get_backend_private_data (const struct samu *sampass, const struct pdb_methods *my_methods)
{
- if (sampass && my_methods == sampass->private_u.backend_private_methods)
- return sampass->private_u.backend_private_data;
+ if (sampass && my_methods == sampass->backend_private_methods)
+ return sampass->backend_private_data;
else
return NULL;
}
/*********************************************************************
- Collection of set...() functions for SAM_ACCOUNT.
+ Collection of set...() functions for struct samu.
********************************************************************/
-BOOL pdb_set_acct_ctrl (SAM_ACCOUNT *sampass, uint16 acct_ctrl, enum pdb_value_state flag)
+BOOL pdb_set_acct_ctrl (struct samu *sampass, uint16 acct_ctrl, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.acct_ctrl = acct_ctrl;
+ sampass->acct_ctrl = acct_ctrl;
return pdb_set_init_flags(sampass, PDB_ACCTCTRL, flag);
}
-BOOL pdb_set_logon_time (SAM_ACCOUNT *sampass, time_t mytime, enum pdb_value_state flag)
+BOOL pdb_set_logon_time (struct samu *sampass, time_t mytime, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.logon_time = mytime;
+ sampass->logon_time = mytime;
return pdb_set_init_flags(sampass, PDB_LOGONTIME, flag);
}
-BOOL pdb_set_logoff_time (SAM_ACCOUNT *sampass, time_t mytime, enum pdb_value_state flag)
+BOOL pdb_set_logoff_time (struct samu *sampass, time_t mytime, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.logoff_time = mytime;
+ sampass->logoff_time = mytime;
return pdb_set_init_flags(sampass, PDB_LOGOFFTIME, flag);
}
-BOOL pdb_set_kickoff_time (SAM_ACCOUNT *sampass, time_t mytime, enum pdb_value_state flag)
+BOOL pdb_set_kickoff_time (struct samu *sampass, time_t mytime, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.kickoff_time = mytime;
+ sampass->kickoff_time = mytime;
return pdb_set_init_flags(sampass, PDB_KICKOFFTIME, flag);
}
-BOOL pdb_set_bad_password_time (SAM_ACCOUNT *sampass, time_t mytime,
+BOOL pdb_set_bad_password_time (struct samu *sampass, time_t mytime,
enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.bad_password_time = mytime;
+ sampass->bad_password_time = mytime;
return pdb_set_init_flags(sampass, PDB_BAD_PASSWORD_TIME, flag);
}
-BOOL pdb_set_pass_can_change_time (SAM_ACCOUNT *sampass, time_t mytime, enum pdb_value_state flag)
+BOOL pdb_set_pass_can_change_time (struct samu *sampass, time_t mytime, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.pass_can_change_time = mytime;
+ sampass->pass_can_change_time = mytime;
return pdb_set_init_flags(sampass, PDB_CANCHANGETIME, flag);
}
-BOOL pdb_set_pass_must_change_time (SAM_ACCOUNT *sampass, time_t mytime, enum pdb_value_state flag)
+BOOL pdb_set_pass_must_change_time (struct samu *sampass, time_t mytime, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.pass_must_change_time = mytime;
+ sampass->pass_must_change_time = mytime;
return pdb_set_init_flags(sampass, PDB_MUSTCHANGETIME, flag);
}
-BOOL pdb_set_pass_last_set_time (SAM_ACCOUNT *sampass, time_t mytime, enum pdb_value_state flag)
+BOOL pdb_set_pass_last_set_time (struct samu *sampass, time_t mytime, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.pass_last_set_time = mytime;
+ sampass->pass_last_set_time = mytime;
return pdb_set_init_flags(sampass, PDB_PASSLASTSET, flag);
}
-BOOL pdb_set_hours_len (SAM_ACCOUNT *sampass, uint32 len, enum pdb_value_state flag)
+BOOL pdb_set_hours_len (struct samu *sampass, uint32 len, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.hours_len = len;
+ sampass->hours_len = len;
return pdb_set_init_flags(sampass, PDB_HOURSLEN, flag);
}
-BOOL pdb_set_logon_divs (SAM_ACCOUNT *sampass, uint16 hours, enum pdb_value_state flag)
+BOOL pdb_set_logon_divs (struct samu *sampass, uint16 hours, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.logon_divs = hours;
+ sampass->logon_divs = hours;
return pdb_set_init_flags(sampass, PDB_LOGONDIVS, flag);
}
/**
- * Set flags showing what is initalised in the SAM_ACCOUNT
- * @param sampass the SAM_ACCOUNT in question
+ * Set flags showing what is initalised in the struct samu
+ * @param sampass the struct samu in question
* @param flag The *new* flag to be set. Old flags preserved
* this flag is only added.
**/
-BOOL pdb_set_init_flags (SAM_ACCOUNT *sampass, enum pdb_elements element, enum pdb_value_state value_flag)
+BOOL pdb_set_init_flags (struct samu *sampass, enum pdb_elements element, enum pdb_value_state value_flag)
{
- if (!sampass || !sampass->mem_ctx)
+ if (!sampass || !sampass)
return False;
- if (!sampass->private_u.set_flags) {
- if ((sampass->private_u.set_flags =
- bitmap_talloc(sampass->mem_ctx,
+ if (!sampass->set_flags) {
+ if ((sampass->set_flags =
+ bitmap_talloc(sampass,
PDB_COUNT))==NULL) {
DEBUG(0,("bitmap_talloc failed\n"));
return False;
}
}
- if (!sampass->private_u.change_flags) {
- if ((sampass->private_u.change_flags =
- bitmap_talloc(sampass->mem_ctx,
+ if (!sampass->change_flags) {
+ if ((sampass->change_flags =
+ bitmap_talloc(sampass,
PDB_COUNT))==NULL) {
DEBUG(0,("bitmap_talloc failed\n"));
return False;
@@ -495,22 +495,22 @@ BOOL pdb_set_init_flags (SAM_ACCOUNT *sampass, enum pdb_elements element, enum p
switch(value_flag) {
case PDB_CHANGED:
- if (!bitmap_set(sampass->private_u.change_flags, element)) {
+ if (!bitmap_set(sampass->change_flags, element)) {
DEBUG(0,("Can't set flag: %d in change_flags.\n",element));
return False;
}
- if (!bitmap_set(sampass->private_u.set_flags, element)) {
+ if (!bitmap_set(sampass->set_flags, element)) {
DEBUG(0,("Can't set flag: %d in set_flags.\n",element));
return False;
}
DEBUG(11, ("element %d -> now CHANGED\n", element));
break;
case PDB_SET:
- if (!bitmap_clear(sampass->private_u.change_flags, element)) {
+ if (!bitmap_clear(sampass->change_flags, element)) {
DEBUG(0,("Can't set flag: %d in change_flags.\n",element));
return False;
}
- if (!bitmap_set(sampass->private_u.set_flags, element)) {
+ if (!bitmap_set(sampass->set_flags, element)) {
DEBUG(0,("Can't set flag: %d in set_flags.\n",element));
return False;
}
@@ -518,11 +518,11 @@ BOOL pdb_set_init_flags (SAM_ACCOUNT *sampass, enum pdb_elements element, enum p
break;
case PDB_DEFAULT:
default:
- if (!bitmap_clear(sampass->private_u.change_flags, element)) {
+ if (!bitmap_clear(sampass->change_flags, element)) {
DEBUG(0,("Can't set flag: %d in change_flags.\n",element));
return False;
}
- if (!bitmap_clear(sampass->private_u.set_flags, element)) {
+ if (!bitmap_clear(sampass->set_flags, element)) {
DEBUG(0,("Can't set flag: %d in set_flags.\n",element));
return False;
}
@@ -533,20 +533,20 @@ BOOL pdb_set_init_flags (SAM_ACCOUNT *sampass, enum pdb_elements element, enum p
return True;
}
-BOOL pdb_set_user_sid (SAM_ACCOUNT *sampass, const DOM_SID *u_sid, enum pdb_value_state flag)
+BOOL pdb_set_user_sid (struct samu *sampass, const DOM_SID *u_sid, enum pdb_value_state flag)
{
if (!sampass || !u_sid)
return False;
- sid_copy(&sampass->private_u.user_sid, u_sid);
+ sid_copy(&sampass->user_sid, u_sid);
DEBUG(10, ("pdb_set_user_sid: setting user sid %s\n",
- sid_string_static(&sampass->private_u.user_sid)));
+ sid_string_static(&sampass->user_sid)));
return pdb_set_init_flags(sampass, PDB_USERSID, flag);
}
-BOOL pdb_set_user_sid_from_string (SAM_ACCOUNT *sampass, fstring u_sid, enum pdb_value_state flag)
+BOOL pdb_set_user_sid_from_string (struct samu *sampass, fstring u_sid, enum pdb_value_state flag)
{
DOM_SID new_sid;
@@ -562,14 +562,14 @@ BOOL pdb_set_user_sid_from_string (SAM_ACCOUNT *sampass, fstring u_sid, enum pdb
}
if (!pdb_set_user_sid(sampass, &new_sid, flag)) {
- DEBUG(1, ("pdb_set_user_sid_from_string: could not set sid %s on SAM_ACCOUNT!\n", u_sid));
+ DEBUG(1, ("pdb_set_user_sid_from_string: could not set sid %s on struct samu!\n", u_sid));
return False;
}
return True;
}
-BOOL pdb_set_group_sid (SAM_ACCOUNT *sampass, const DOM_SID *g_sid, enum pdb_value_state flag)
+BOOL pdb_set_group_sid (struct samu *sampass, const DOM_SID *g_sid, enum pdb_value_state flag)
{
gid_t gid;
@@ -580,19 +580,19 @@ BOOL pdb_set_group_sid (SAM_ACCOUNT *sampass, const DOM_SID *g_sid, enum pdb_val
store DOMAIN_USERS as the primary groupSID */
if ( sid_to_gid( g_sid, &gid ) ) {
- sid_copy(&sampass->private_u.group_sid, g_sid);
+ sid_copy(&sampass->group_sid, g_sid);
} else {
- sid_copy( &sampass->private_u.group_sid, get_global_sam_sid() );
- sid_append_rid( &sampass->private_u.group_sid, DOMAIN_GROUP_RID_USERS );
+ sid_copy( &sampass->group_sid, get_global_sam_sid() );
+ sid_append_rid( &sampass->group_sid, DOMAIN_GROUP_RID_USERS );
}
DEBUG(10, ("pdb_set_group_sid: setting group sid %s\n",
- sid_string_static(&sampass->private_u.group_sid)));
+ sid_string_static(&sampass->group_sid)));
return pdb_set_init_flags(sampass, PDB_GROUPSID, flag);
}
-BOOL pdb_set_group_sid_from_string (SAM_ACCOUNT *sampass, fstring g_sid, enum pdb_value_state flag)
+BOOL pdb_set_group_sid_from_string (struct samu *sampass, fstring g_sid, enum pdb_value_state flag)
{
DOM_SID new_sid;
if (!sampass || !g_sid)
@@ -607,7 +607,7 @@ BOOL pdb_set_group_sid_from_string (SAM_ACCOUNT *sampass, fstring g_sid, enum pd
}
if (!pdb_set_group_sid(sampass, &new_sid, flag)) {
- DEBUG(1, ("pdb_set_group_sid_from_string: could not set sid %s on SAM_ACCOUNT!\n", g_sid));
+ DEBUG(1, ("pdb_set_group_sid_from_string: could not set sid %s on struct samu!\n", g_sid));
return False;
}
return True;
@@ -617,24 +617,24 @@ BOOL pdb_set_group_sid_from_string (SAM_ACCOUNT *sampass, fstring g_sid, enum pd
Set the user's UNIX name.
********************************************************************/
-BOOL pdb_set_username(SAM_ACCOUNT *sampass, const char *username, enum pdb_value_state flag)
+BOOL pdb_set_username(struct samu *sampass, const char *username, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (username) {
DEBUG(10, ("pdb_set_username: setting username %s, was %s\n", username,
- (sampass->private_u.username)?(sampass->private_u.username):"NULL"));
+ (sampass->username)?(sampass->username):"NULL"));
- sampass->private_u.username = talloc_strdup(sampass->mem_ctx, username);
+ sampass->username = talloc_strdup(sampass, username);
- if (!sampass->private_u.username) {
+ if (!sampass->username) {
DEBUG(0, ("pdb_set_username: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.username = PDB_NOT_QUITE_NULL;
+ sampass->username = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_USERNAME, flag);
@@ -644,24 +644,24 @@ BOOL pdb_set_username(SAM_ACCOUNT *sampass, const char *username, enum pdb_value
Set the domain name.
********************************************************************/
-BOOL pdb_set_domain(SAM_ACCOUNT *sampass, const char *domain, enum pdb_value_state flag)
+BOOL pdb_set_domain(struct samu *sampass, const char *domain, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (domain) {
DEBUG(10, ("pdb_set_domain: setting domain %s, was %s\n", domain,
- (sampass->private_u.domain)?(sampass->private_u.domain):"NULL"));
+ (sampass->domain)?(sampass->domain):"NULL"));
- sampass->private_u.domain = talloc_strdup(sampass->mem_ctx, domain);
+ sampass->domain = talloc_strdup(sampass, domain);
- if (!sampass->private_u.domain) {
+ if (!sampass->domain) {
DEBUG(0, ("pdb_set_domain: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.domain = PDB_NOT_QUITE_NULL;
+ sampass->domain = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_DOMAIN, flag);
@@ -671,24 +671,24 @@ BOOL pdb_set_domain(SAM_ACCOUNT *sampass, const char *domain, enum pdb_value_sta
Set the user's NT name.
********************************************************************/
-BOOL pdb_set_nt_username(SAM_ACCOUNT *sampass, const char *nt_username, enum pdb_value_state flag)
+BOOL pdb_set_nt_username(struct samu *sampass, const char *nt_username, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (nt_username) {
DEBUG(10, ("pdb_set_nt_username: setting nt username %s, was %s\n", nt_username,
- (sampass->private_u.nt_username)?(sampass->private_u.nt_username):"NULL"));
+ (sampass->nt_username)?(sampass->nt_username):"NULL"));
- sampass->private_u.nt_username = talloc_strdup(sampass->mem_ctx, nt_username);
+ sampass->nt_username = talloc_strdup(sampass, nt_username);
- if (!sampass->private_u.nt_username) {
+ if (!sampass->nt_username) {
DEBUG(0, ("pdb_set_nt_username: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.nt_username = PDB_NOT_QUITE_NULL;
+ sampass->nt_username = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_NTUSERNAME, flag);
@@ -698,24 +698,24 @@ BOOL pdb_set_nt_username(SAM_ACCOUNT *sampass, const char *nt_username, enum pdb
Set the user's full name.
********************************************************************/
-BOOL pdb_set_fullname(SAM_ACCOUNT *sampass, const char *full_name, enum pdb_value_state flag)
+BOOL pdb_set_fullname(struct samu *sampass, const char *full_name, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (full_name) {
DEBUG(10, ("pdb_set_full_name: setting full name %s, was %s\n", full_name,
- (sampass->private_u.full_name)?(sampass->private_u.full_name):"NULL"));
+ (sampass->full_name)?(sampass->full_name):"NULL"));
- sampass->private_u.full_name = talloc_strdup(sampass->mem_ctx, full_name);
+ sampass->full_name = talloc_strdup(sampass, full_name);
- if (!sampass->private_u.full_name) {
+ if (!sampass->full_name) {
DEBUG(0, ("pdb_set_fullname: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.full_name = PDB_NOT_QUITE_NULL;
+ sampass->full_name = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_FULLNAME, flag);
@@ -725,24 +725,24 @@ BOOL pdb_set_fullname(SAM_ACCOUNT *sampass, const char *full_name, enum pdb_valu
Set the user's logon script.
********************************************************************/
-BOOL pdb_set_logon_script(SAM_ACCOUNT *sampass, const char *logon_script, enum pdb_value_state flag)
+BOOL pdb_set_logon_script(struct samu *sampass, const char *logon_script, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (logon_script) {
DEBUG(10, ("pdb_set_logon_script: setting logon script %s, was %s\n", logon_script,
- (sampass->private_u.logon_script)?(sampass->private_u.logon_script):"NULL"));
+ (sampass->logon_script)?(sampass->logon_script):"NULL"));
- sampass->private_u.logon_script = talloc_strdup(sampass->mem_ctx, logon_script);
+ sampass->logon_script = talloc_strdup(sampass, logon_script);
- if (!sampass->private_u.logon_script) {
+ if (!sampass->logon_script) {
DEBUG(0, ("pdb_set_logon_script: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.logon_script = PDB_NOT_QUITE_NULL;
+ sampass->logon_script = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_LOGONSCRIPT, flag);
@@ -752,24 +752,24 @@ BOOL pdb_set_logon_script(SAM_ACCOUNT *sampass, const char *logon_script, enum p
Set the user's profile path.
********************************************************************/
-BOOL pdb_set_profile_path (SAM_ACCOUNT *sampass, const char *profile_path, enum pdb_value_state flag)
+BOOL pdb_set_profile_path (struct samu *sampass, const char *profile_path, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (profile_path) {
DEBUG(10, ("pdb_set_profile_path: setting profile path %s, was %s\n", profile_path,
- (sampass->private_u.profile_path)?(sampass->private_u.profile_path):"NULL"));
+ (sampass->profile_path)?(sampass->profile_path):"NULL"));
- sampass->private_u.profile_path = talloc_strdup(sampass->mem_ctx, profile_path);
+ sampass->profile_path = talloc_strdup(sampass, profile_path);
- if (!sampass->private_u.profile_path) {
+ if (!sampass->profile_path) {
DEBUG(0, ("pdb_set_profile_path: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.profile_path = PDB_NOT_QUITE_NULL;
+ sampass->profile_path = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_PROFILE, flag);
@@ -779,24 +779,24 @@ BOOL pdb_set_profile_path (SAM_ACCOUNT *sampass, const char *profile_path, enum
Set the user's directory drive.
********************************************************************/
-BOOL pdb_set_dir_drive (SAM_ACCOUNT *sampass, const char *dir_drive, enum pdb_value_state flag)
+BOOL pdb_set_dir_drive (struct samu *sampass, const char *dir_drive, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (dir_drive) {
DEBUG(10, ("pdb_set_dir_drive: setting dir drive %s, was %s\n", dir_drive,
- (sampass->private_u.dir_drive)?(sampass->private_u.dir_drive):"NULL"));
+ (sampass->dir_drive)?(sampass->dir_drive):"NULL"));
- sampass->private_u.dir_drive = talloc_strdup(sampass->mem_ctx, dir_drive);
+ sampass->dir_drive = talloc_strdup(sampass, dir_drive);
- if (!sampass->private_u.dir_drive) {
+ if (!sampass->dir_drive) {
DEBUG(0, ("pdb_set_dir_drive: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.dir_drive = PDB_NOT_QUITE_NULL;
+ sampass->dir_drive = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_DRIVE, flag);
@@ -806,24 +806,24 @@ BOOL pdb_set_dir_drive (SAM_ACCOUNT *sampass, const char *dir_drive, enum pdb_va
Set the user's home directory.
********************************************************************/
-BOOL pdb_set_homedir (SAM_ACCOUNT *sampass, const char *home_dir, enum pdb_value_state flag)
+BOOL pdb_set_homedir (struct samu *sampass, const char *home_dir, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (home_dir) {
DEBUG(10, ("pdb_set_homedir: setting home dir %s, was %s\n", home_dir,
- (sampass->private_u.home_dir)?(sampass->private_u.home_dir):"NULL"));
+ (sampass->home_dir)?(sampass->home_dir):"NULL"));
- sampass->private_u.home_dir = talloc_strdup(sampass->mem_ctx, home_dir);
+ sampass->home_dir = talloc_strdup(sampass, home_dir);
- if (!sampass->private_u.home_dir) {
+ if (!sampass->home_dir) {
DEBUG(0, ("pdb_set_home_dir: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.home_dir = PDB_NOT_QUITE_NULL;
+ sampass->home_dir = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_SMBHOME, flag);
@@ -833,25 +833,25 @@ BOOL pdb_set_homedir (SAM_ACCOUNT *sampass, const char *home_dir, enum pdb_value
Set the user's unix home directory.
********************************************************************/
-BOOL pdb_set_unix_homedir (SAM_ACCOUNT *sampass, const char *unix_home_dir, enum pdb_value_state flag)
+BOOL pdb_set_unix_homedir (struct samu *sampass, const char *unix_home_dir, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (unix_home_dir) {
DEBUG(10, ("pdb_set_unix_homedir: setting home dir %s, was %s\n", unix_home_dir,
- (sampass->private_u.unix_home_dir)?(sampass->private_u.unix_home_dir):"NULL"));
+ (sampass->unix_home_dir)?(sampass->unix_home_dir):"NULL"));
- sampass->private_u.unix_home_dir = talloc_strdup(sampass->mem_ctx,
+ sampass->unix_home_dir = talloc_strdup(sampass,
unix_home_dir);
- if (!sampass->private_u.unix_home_dir) {
+ if (!sampass->unix_home_dir) {
DEBUG(0, ("pdb_set_unix_home_dir: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.unix_home_dir = PDB_NOT_QUITE_NULL;
+ sampass->unix_home_dir = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_UNIXHOMEDIR, flag);
@@ -861,21 +861,21 @@ BOOL pdb_set_unix_homedir (SAM_ACCOUNT *sampass, const char *unix_home_dir, enum
Set the user's account description.
********************************************************************/
-BOOL pdb_set_acct_desc (SAM_ACCOUNT *sampass, const char *acct_desc, enum pdb_value_state flag)
+BOOL pdb_set_acct_desc (struct samu *sampass, const char *acct_desc, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (acct_desc) {
- sampass->private_u.acct_desc = talloc_strdup(sampass->mem_ctx, acct_desc);
+ sampass->acct_desc = talloc_strdup(sampass, acct_desc);
- if (!sampass->private_u.acct_desc) {
+ if (!sampass->acct_desc) {
DEBUG(0, ("pdb_set_acct_desc: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.acct_desc = PDB_NOT_QUITE_NULL;
+ sampass->acct_desc = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_ACCTDESC, flag);
@@ -885,24 +885,24 @@ BOOL pdb_set_acct_desc (SAM_ACCOUNT *sampass, const char *acct_desc, enum pdb_va
Set the user's workstation allowed list.
********************************************************************/
-BOOL pdb_set_workstations (SAM_ACCOUNT *sampass, const char *workstations, enum pdb_value_state flag)
+BOOL pdb_set_workstations (struct samu *sampass, const char *workstations, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (workstations) {
DEBUG(10, ("pdb_set_workstations: setting workstations %s, was %s\n", workstations,
- (sampass->private_u.workstations)?(sampass->private_u.workstations):"NULL"));
+ (sampass->workstations)?(sampass->workstations):"NULL"));
- sampass->private_u.workstations = talloc_strdup(sampass->mem_ctx, workstations);
+ sampass->workstations = talloc_strdup(sampass, workstations);
- if (!sampass->private_u.workstations) {
+ if (!sampass->workstations) {
DEBUG(0, ("pdb_set_workstations: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.workstations = PDB_NOT_QUITE_NULL;
+ sampass->workstations = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_WORKSTATIONS, flag);
@@ -912,21 +912,21 @@ BOOL pdb_set_workstations (SAM_ACCOUNT *sampass, const char *workstations, enum
Set the user's 'unknown_str', whatever the heck this actually is...
********************************************************************/
-BOOL pdb_set_unknown_str (SAM_ACCOUNT *sampass, const char *unknown_str, enum pdb_value_state flag)
+BOOL pdb_set_unknown_str (struct samu *sampass, const char *unknown_str, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (unknown_str) {
- sampass->private_u.unknown_str = talloc_strdup(sampass->mem_ctx, unknown_str);
+ sampass->unknown_str = talloc_strdup(sampass, unknown_str);
- if (!sampass->private_u.unknown_str) {
+ if (!sampass->unknown_str) {
DEBUG(0, ("pdb_set_unknown_str: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.unknown_str = PDB_NOT_QUITE_NULL;
+ sampass->unknown_str = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_UNKNOWNSTR, flag);
@@ -936,21 +936,21 @@ BOOL pdb_set_unknown_str (SAM_ACCOUNT *sampass, const char *unknown_str, enum pd
Set the user's dial string.
********************************************************************/
-BOOL pdb_set_munged_dial (SAM_ACCOUNT *sampass, const char *munged_dial, enum pdb_value_state flag)
+BOOL pdb_set_munged_dial (struct samu *sampass, const char *munged_dial, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (munged_dial) {
- sampass->private_u.munged_dial = talloc_strdup(sampass->mem_ctx, munged_dial);
+ sampass->munged_dial = talloc_strdup(sampass, munged_dial);
- if (!sampass->private_u.munged_dial) {
+ if (!sampass->munged_dial) {
DEBUG(0, ("pdb_set_munged_dial: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.munged_dial = PDB_NOT_QUITE_NULL;
+ sampass->munged_dial = PDB_NOT_QUITE_NULL;
}
return pdb_set_init_flags(sampass, PDB_MUNGEDDIAL, flag);
@@ -960,18 +960,18 @@ BOOL pdb_set_munged_dial (SAM_ACCOUNT *sampass, const char *munged_dial, enum pd
Set the user's NT hash.
********************************************************************/
-BOOL pdb_set_nt_passwd (SAM_ACCOUNT *sampass, const uint8 pwd[NT_HASH_LEN], enum pdb_value_state flag)
+BOOL pdb_set_nt_passwd (struct samu *sampass, const uint8 pwd[NT_HASH_LEN], enum pdb_value_state flag)
{
if (!sampass)
return False;
- data_blob_clear_free(&sampass->private_u.nt_pw);
+ data_blob_clear_free(&sampass->nt_pw);
if (pwd) {
- sampass->private_u.nt_pw =
- data_blob_talloc(sampass->mem_ctx, pwd, NT_HASH_LEN);
+ sampass->nt_pw =
+ data_blob_talloc(sampass, pwd, NT_HASH_LEN);
} else {
- sampass->private_u.nt_pw = data_blob(NULL, 0);
+ sampass->nt_pw = data_blob(NULL, 0);
}
return pdb_set_init_flags(sampass, PDB_NTPASSWD, flag);
@@ -981,18 +981,18 @@ BOOL pdb_set_nt_passwd (SAM_ACCOUNT *sampass, const uint8 pwd[NT_HASH_LEN], enum
Set the user's LM hash.
********************************************************************/
-BOOL pdb_set_lanman_passwd (SAM_ACCOUNT *sampass, const uint8 pwd[LM_HASH_LEN], enum pdb_value_state flag)
+BOOL pdb_set_lanman_passwd (struct samu *sampass, const uint8 pwd[LM_HASH_LEN], enum pdb_value_state flag)
{
if (!sampass)
return False;
- data_blob_clear_free(&sampass->private_u.lm_pw);
+ data_blob_clear_free(&sampass->lm_pw);
if (pwd) {
- sampass->private_u.lm_pw =
- data_blob_talloc(sampass->mem_ctx, pwd, LM_HASH_LEN);
+ sampass->lm_pw =
+ data_blob_talloc(sampass, pwd, LM_HASH_LEN);
} else {
- sampass->private_u.lm_pw = data_blob(NULL, 0);
+ sampass->lm_pw = data_blob(NULL, 0);
}
return pdb_set_init_flags(sampass, PDB_LMPASSWD, flag);
@@ -1005,20 +1005,20 @@ BOOL pdb_set_lanman_passwd (SAM_ACCOUNT *sampass, const uint8 pwd[LM_HASH_LEN],
in pwd.
********************************************************************/
-BOOL pdb_set_pw_history (SAM_ACCOUNT *sampass, const uint8 *pwd, uint32 historyLen, enum pdb_value_state flag)
+BOOL pdb_set_pw_history (struct samu *sampass, const uint8 *pwd, uint32 historyLen, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (historyLen && pwd){
- sampass->private_u.nt_pw_his = data_blob_talloc(sampass->mem_ctx,
+ sampass->nt_pw_his = data_blob_talloc(sampass,
pwd, historyLen*PW_HISTORY_ENTRY_LEN);
- if (!sampass->private_u.nt_pw_his.length) {
+ if (!sampass->nt_pw_his.length) {
DEBUG(0, ("pdb_set_pw_history: data_blob_talloc() failed!\n"));
return False;
}
} else {
- sampass->private_u.nt_pw_his = data_blob_talloc(sampass->mem_ctx, NULL, 0);
+ sampass->nt_pw_his = data_blob_talloc(sampass, NULL, 0);
}
return pdb_set_init_flags(sampass, PDB_PWHISTORY, flag);
@@ -1029,75 +1029,75 @@ BOOL pdb_set_pw_history (SAM_ACCOUNT *sampass, const uint8 *pwd, uint32 historyL
below)
********************************************************************/
-BOOL pdb_set_plaintext_pw_only (SAM_ACCOUNT *sampass, const char *password, enum pdb_value_state flag)
+BOOL pdb_set_plaintext_pw_only (struct samu *sampass, const char *password, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (password) {
- if (sampass->private_u.plaintext_pw!=NULL)
- memset(sampass->private_u.plaintext_pw,'\0',strlen(sampass->private_u.plaintext_pw)+1);
+ if (sampass->plaintext_pw!=NULL)
+ memset(sampass->plaintext_pw,'\0',strlen(sampass->plaintext_pw)+1);
- sampass->private_u.plaintext_pw = talloc_strdup(sampass->mem_ctx, password);
+ sampass->plaintext_pw = talloc_strdup(sampass, password);
- if (!sampass->private_u.plaintext_pw) {
+ if (!sampass->plaintext_pw) {
DEBUG(0, ("pdb_set_unknown_str: talloc_strdup() failed!\n"));
return False;
}
} else {
- sampass->private_u.plaintext_pw = NULL;
+ sampass->plaintext_pw = NULL;
}
return pdb_set_init_flags(sampass, PDB_PLAINTEXT_PW, flag);
}
-BOOL pdb_set_bad_password_count(SAM_ACCOUNT *sampass, uint16 bad_password_count, enum pdb_value_state flag)
+BOOL pdb_set_bad_password_count(struct samu *sampass, uint16 bad_password_count, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.bad_password_count = bad_password_count;
+ sampass->bad_password_count = bad_password_count;
return pdb_set_init_flags(sampass, PDB_BAD_PASSWORD_COUNT, flag);
}
-BOOL pdb_set_logon_count(SAM_ACCOUNT *sampass, uint16 logon_count, enum pdb_value_state flag)
+BOOL pdb_set_logon_count(struct samu *sampass, uint16 logon_count, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.logon_count = logon_count;
+ sampass->logon_count = logon_count;
return pdb_set_init_flags(sampass, PDB_LOGON_COUNT, flag);
}
-BOOL pdb_set_unknown_6 (SAM_ACCOUNT *sampass, uint32 unkn, enum pdb_value_state flag)
+BOOL pdb_set_unknown_6 (struct samu *sampass, uint32 unkn, enum pdb_value_state flag)
{
if (!sampass)
return False;
- sampass->private_u.unknown_6 = unkn;
+ sampass->unknown_6 = unkn;
return pdb_set_init_flags(sampass, PDB_UNKNOWN6, flag);
}
-BOOL pdb_set_hours (SAM_ACCOUNT *sampass, const uint8 *hours, enum pdb_value_state flag)
+BOOL pdb_set_hours (struct samu *sampass, const uint8 *hours, enum pdb_value_state flag)
{
if (!sampass)
return False;
if (!hours) {
- memset ((char *)sampass->private_u.hours, 0, MAX_HOURS_LEN);
+ memset ((char *)sampass->hours, 0, MAX_HOURS_LEN);
return True;
}
- memcpy (sampass->private_u.hours, hours, MAX_HOURS_LEN);
+ memcpy (sampass->hours, hours, MAX_HOURS_LEN);
return pdb_set_init_flags(sampass, PDB_HOURS, flag);
}
-BOOL pdb_set_backend_private_data (SAM_ACCOUNT *sampass, void *private_data,
+BOOL pdb_set_backend_private_data (struct samu *sampass, void *private_data,
void (*free_fn)(void **),
const struct pdb_methods *my_methods,
enum pdb_value_state flag)
@@ -1105,15 +1105,15 @@ BOOL pdb_set_backend_private_data (SAM_ACCOUNT *sampass, void *private_data,
if (!sampass)
return False;
- if (sampass->private_u.backend_private_data &&
- sampass->private_u.backend_private_data_free_fn) {
- sampass->private_u.backend_private_data_free_fn(
- &sampass->private_u.backend_private_data);
+ if (sampass->backend_private_data &&
+ sampass->backend_private_data_free_fn) {
+ sampass->backend_private_data_free_fn(
+ &sampass->backend_private_data);
}
- sampass->private_u.backend_private_data = private_data;
- sampass->private_u.backend_private_data_free_fn = free_fn;
- sampass->private_u.backend_private_methods = my_methods;
+ sampass->backend_private_data = private_data;
+ sampass->backend_private_data_free_fn = free_fn;
+ sampass->backend_private_methods = my_methods;
return pdb_set_init_flags(sampass, PDB_BACKEND_PRIVATE_DATA, flag);
}
@@ -1126,7 +1126,7 @@ BOOL pdb_set_backend_private_data (SAM_ACCOUNT *sampass, void *private_data,
password change.
********************************************************************/
-BOOL pdb_set_pass_changed_now (SAM_ACCOUNT *sampass)
+BOOL pdb_set_pass_changed_now (struct samu *sampass)
{
uint32 expire;
uint32 min_age;
@@ -1166,7 +1166,7 @@ BOOL pdb_set_pass_changed_now (SAM_ACCOUNT *sampass)
Also sets the last change time to NOW.
********************************************************************/
-BOOL pdb_set_plaintext_passwd (SAM_ACCOUNT *sampass, const char *plaintext)
+BOOL pdb_set_plaintext_passwd (struct samu *sampass, const char *plaintext)
{
uchar new_lanman_p16[LM_HASH_LEN];
uchar new_nt_p16[NT_HASH_LEN];
@@ -1208,11 +1208,11 @@ BOOL pdb_set_plaintext_passwd (SAM_ACCOUNT *sampass, const char *plaintext)
uint32 current_history_len;
/* We need to make sure we don't have a race condition here - the
account policy history length can change between when the pw_history
- was first loaded into the SAM_ACCOUNT struct and now.... JRA. */
+ was first loaded into the struct samu struct and now.... JRA. */
pwhistory = (uchar *)pdb_get_pw_history(sampass, &current_history_len);
if (current_history_len != pwHistLen) {
- /* After closing and reopening SAM_ACCOUNT the history
+ /* After closing and reopening struct samu the history
values will sync up. We can't do this here. */
/* current_history_len > pwHistLen is not a problem - we
@@ -1220,7 +1220,7 @@ BOOL pdb_set_plaintext_passwd (SAM_ACCOUNT *sampass, const char *plaintext)
if (current_history_len < pwHistLen) {
/* Ensure we have space for the needed history. */
- uchar *new_history = TALLOC(sampass->mem_ctx,
+ uchar *new_history = TALLOC(sampass,
pwHistLen*PW_HISTORY_ENTRY_LEN);
/* And copy it into the new buffer. */
if (current_history_len) {
@@ -1261,7 +1261,7 @@ BOOL pdb_set_plaintext_passwd (SAM_ACCOUNT *sampass, const char *plaintext)
}
/* check for any PDB_SET/CHANGED field and fill the appropriate mask bit */
-uint32 pdb_build_fields_present (SAM_ACCOUNT *sampass)
+uint32 pdb_build_fields_present (struct samu *sampass)
{
/* value set to all for testing */
return 0x00ffffff;
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index e2035296cc..7f85c4d7c4 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -28,7 +28,7 @@
/* Cache of latest SAM lookup query */
-static SAM_ACCOUNT *csamuser = NULL;
+static struct samu *csamuser = NULL;
static struct pdb_init_function_entry *backends = NULL;
@@ -54,7 +54,7 @@ static BOOL lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32 rid,
time, such LDAP with a missing attribute would produce.
********************************************************************/
-static void pdb_force_pw_initialization(SAM_ACCOUNT *pass)
+static void pdb_force_pw_initialization(struct samu *pass)
{
const uint8 *lm_pwd, *nt_pwd;
@@ -239,7 +239,7 @@ void pdb_endsampwent(void)
pdb->endsampwent(pdb);
}
-BOOL pdb_getsampwent(SAM_ACCOUNT *user)
+BOOL pdb_getsampwent(struct samu *user)
{
struct pdb_methods *pdb = pdb_get_methods(False);
@@ -256,7 +256,7 @@ BOOL pdb_getsampwent(SAM_ACCOUNT *user)
return True;
}
-BOOL pdb_getsampwnam(SAM_ACCOUNT *sam_acct, const char *username)
+BOOL pdb_getsampwnam(struct samu *sam_acct, const char *username)
{
struct pdb_methods *pdb = pdb_get_methods(False);
@@ -269,7 +269,7 @@ BOOL pdb_getsampwnam(SAM_ACCOUNT *sam_acct, const char *username)
}
if (csamuser != NULL) {
- pdb_free_sam(&csamuser);
+ TALLOC_FREE(csamuser);
csamuser = NULL;
}
@@ -282,7 +282,7 @@ BOOL pdb_getsampwnam(SAM_ACCOUNT *sam_acct, const char *username)
/**********************************************************************
**********************************************************************/
-BOOL guest_user_info( SAM_ACCOUNT *user )
+BOOL guest_user_info( struct samu *user )
{
struct passwd *pwd;
NTSTATUS ntstatus;
@@ -305,7 +305,7 @@ BOOL guest_user_info( SAM_ACCOUNT *user )
/**********************************************************************
**********************************************************************/
-BOOL pdb_getsampwsid(SAM_ACCOUNT *sam_acct, const DOM_SID *sid)
+BOOL pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid)
{
struct pdb_methods *pdb;
uint32 rid;
@@ -336,7 +336,7 @@ static NTSTATUS pdb_default_create_user(struct pdb_methods *methods,
TALLOC_CTX *tmp_ctx, const char *name,
uint32 acb_info, uint32 *rid)
{
- SAM_ACCOUNT *sam_pass = NULL;
+ struct samu *sam_pass = NULL;
NTSTATUS status;
if (Get_Pwnam_alloc(tmp_ctx, name) == NULL) {
@@ -388,7 +388,7 @@ static NTSTATUS pdb_default_create_user(struct pdb_methods *methods,
status = pdb_add_sam_account(sam_pass);
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return status;
}
@@ -427,7 +427,7 @@ static int smb_delete_user(const char *unix_user)
static NTSTATUS pdb_default_delete_user(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
- SAM_ACCOUNT *sam_acct)
+ struct samu *sam_acct)
{
NTSTATUS status;
@@ -447,7 +447,7 @@ static NTSTATUS pdb_default_delete_user(struct pdb_methods *methods,
return status;
}
-NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, SAM_ACCOUNT *sam_acct)
+NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, struct samu *sam_acct)
{
struct pdb_methods *pdb = pdb_get_methods(False);
@@ -458,7 +458,7 @@ NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, SAM_ACCOUNT *sam_acct)
return pdb->delete_user(pdb, mem_ctx, sam_acct);
}
-NTSTATUS pdb_add_sam_account(SAM_ACCOUNT *sam_acct)
+NTSTATUS pdb_add_sam_account(struct samu *sam_acct)
{
struct pdb_methods *pdb = pdb_get_methods(False);
@@ -469,7 +469,7 @@ NTSTATUS pdb_add_sam_account(SAM_ACCOUNT *sam_acct)
return pdb->add_sam_account(pdb, sam_acct);
}
-NTSTATUS pdb_update_sam_account(SAM_ACCOUNT *sam_acct)
+NTSTATUS pdb_update_sam_account(struct samu *sam_acct)
{
struct pdb_methods *pdb = pdb_get_methods(False);
@@ -478,14 +478,14 @@ NTSTATUS pdb_update_sam_account(SAM_ACCOUNT *sam_acct)
}
if (csamuser != NULL) {
- pdb_free_sam(&csamuser);
+ TALLOC_FREE(csamuser);
csamuser = NULL;
}
return pdb->update_sam_account(pdb, sam_acct);
}
-NTSTATUS pdb_delete_sam_account(SAM_ACCOUNT *sam_acct)
+NTSTATUS pdb_delete_sam_account(struct samu *sam_acct)
{
struct pdb_methods *pdb = pdb_get_methods(False);
@@ -494,14 +494,14 @@ NTSTATUS pdb_delete_sam_account(SAM_ACCOUNT *sam_acct)
}
if (csamuser != NULL) {
- pdb_free_sam(&csamuser);
+ TALLOC_FREE(csamuser);
csamuser = NULL;
}
return pdb->delete_sam_account(pdb, sam_acct);
}
-NTSTATUS pdb_rename_sam_account(SAM_ACCOUNT *oldname, const char *newname)
+NTSTATUS pdb_rename_sam_account(struct samu *oldname, const char *newname)
{
struct pdb_methods *pdb = pdb_get_methods(False);
@@ -510,14 +510,14 @@ NTSTATUS pdb_rename_sam_account(SAM_ACCOUNT *oldname, const char *newname)
}
if (csamuser != NULL) {
- pdb_free_sam(&csamuser);
+ TALLOC_FREE(csamuser);
csamuser = NULL;
}
return pdb->rename_sam_account(pdb, oldname, newname);
}
-NTSTATUS pdb_update_login_attempts(SAM_ACCOUNT *sam_acct, BOOL success)
+NTSTATUS pdb_update_login_attempts(struct samu *sam_acct, BOOL success)
{
struct pdb_methods *pdb = pdb_get_methods(False);
@@ -731,7 +731,7 @@ NTSTATUS pdb_enum_group_members(TALLOC_CTX *mem_ctx,
pp_member_rids, p_num_members);
}
-NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, SAM_ACCOUNT *user,
+NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, struct samu *user,
DOM_SID **pp_sids, gid_t **pp_gids,
size_t *p_num_groups)
{
@@ -748,7 +748,7 @@ NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, SAM_ACCOUNT *user,
static NTSTATUS pdb_default_set_unix_primary_group(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
- SAM_ACCOUNT *sampass)
+ struct samu *sampass)
{
struct group *grp;
gid_t gid;
@@ -766,7 +766,7 @@ static NTSTATUS pdb_default_set_unix_primary_group(struct pdb_methods *methods,
return NT_STATUS_OK;
}
-NTSTATUS pdb_set_unix_primary_group(TALLOC_CTX *mem_ctx, SAM_ACCOUNT *user)
+NTSTATUS pdb_set_unix_primary_group(TALLOC_CTX *mem_ctx, struct samu *user)
{
struct pdb_methods *pdb = pdb_get_methods(False);
@@ -783,7 +783,7 @@ NTSTATUS pdb_set_unix_primary_group(TALLOC_CTX *mem_ctx, SAM_ACCOUNT *user)
* fulfil.
*/
-static BOOL pdb_user_in_group(TALLOC_CTX *mem_ctx, SAM_ACCOUNT *account,
+static BOOL pdb_user_in_group(TALLOC_CTX *mem_ctx, struct samu *account,
const DOM_SID *group_sid)
{
DOM_SID *sids;
@@ -810,7 +810,7 @@ static NTSTATUS pdb_default_add_groupmem(struct pdb_methods *methods,
uint32 member_rid)
{
DOM_SID group_sid, member_sid;
- SAM_ACCOUNT *account = NULL;
+ struct samu *account = NULL;
GROUP_MAP map;
struct group *grp;
struct passwd *pwd;
@@ -878,7 +878,7 @@ static NTSTATUS pdb_default_del_groupmem(struct pdb_methods *methods,
uint32 member_rid)
{
DOM_SID group_sid, member_sid;
- SAM_ACCOUNT *account = NULL;
+ struct samu *account = NULL;
GROUP_MAP map;
struct group *grp;
struct passwd *pwd;
@@ -1206,38 +1206,38 @@ BOOL initialize_password_db(BOOL reload)
Default implementations of some functions.
****************************************************************************/
-static NTSTATUS pdb_default_getsampwnam (struct pdb_methods *methods, SAM_ACCOUNT *user, const char *sname)
+static NTSTATUS pdb_default_getsampwnam (struct pdb_methods *methods, struct samu *user, const char *sname)
{
return NT_STATUS_NO_SUCH_USER;
}
-static NTSTATUS pdb_default_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, const DOM_SID *sid)
+static NTSTATUS pdb_default_getsampwsid(struct pdb_methods *my_methods, struct samu * user, const DOM_SID *sid)
{
return NT_STATUS_NO_SUCH_USER;
}
-static NTSTATUS pdb_default_add_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *newpwd)
+static NTSTATUS pdb_default_add_sam_account (struct pdb_methods *methods, struct samu *newpwd)
{
DEBUG(0,("this backend (%s) should not be listed as the first passdb backend! You can't add users to it.\n", methods->name));
return NT_STATUS_NOT_IMPLEMENTED;
}
-static NTSTATUS pdb_default_update_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *newpwd)
+static NTSTATUS pdb_default_update_sam_account (struct pdb_methods *methods, struct samu *newpwd)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
-static NTSTATUS pdb_default_delete_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *pwd)
+static NTSTATUS pdb_default_delete_sam_account (struct pdb_methods *methods, struct samu *pwd)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
-static NTSTATUS pdb_default_rename_sam_account (struct pdb_methods *methods, SAM_ACCOUNT *pwd, const char *newname)
+static NTSTATUS pdb_default_rename_sam_account (struct pdb_methods *methods, struct samu *pwd, const char *newname)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
-static NTSTATUS pdb_default_update_login_attempts (struct pdb_methods *methods, SAM_ACCOUNT *newpwd, BOOL success)
+static NTSTATUS pdb_default_update_login_attempts (struct pdb_methods *methods, struct samu *newpwd, BOOL success)
{
return NT_STATUS_OK;
}
@@ -1247,7 +1247,7 @@ static NTSTATUS pdb_default_setsampwent(struct pdb_methods *methods, BOOL update
return NT_STATUS_NOT_IMPLEMENTED;
}
-static NTSTATUS pdb_default_getsampwent(struct pdb_methods *methods, SAM_ACCOUNT *user)
+static NTSTATUS pdb_default_getsampwent(struct pdb_methods *methods, struct samu *user)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
@@ -1276,7 +1276,7 @@ static NTSTATUS pdb_default_get_seq_num(struct pdb_methods *methods, time_t *seq
static BOOL pdb_default_uid_to_rid(struct pdb_methods *methods, uid_t uid,
uint32 *rid)
{
- SAM_ACCOUNT *sampw = NULL;
+ struct samu *sampw = NULL;
struct passwd *unix_pw;
BOOL ret;
@@ -1290,7 +1290,7 @@ static BOOL pdb_default_uid_to_rid(struct pdb_methods *methods, uid_t uid,
if ( !NT_STATUS_IS_OK(pdb_init_sam(&sampw)) ) {
DEBUG(0,("pdb_default_uid_to_rid: failed to allocate "
- "SAM_ACCOUNT object\n"));
+ "struct samu object\n"));
return False;
}
@@ -1302,7 +1302,7 @@ static BOOL pdb_default_uid_to_rid(struct pdb_methods *methods, uid_t uid,
if (!ret) {
DEBUG(5, ("pdb_default_uid_to_rid: Did not find user "
"%s (%d)\n", unix_pw->pw_name, uid));
- pdb_free_sam(&sampw);
+ TALLOC_FREE(sampw);
return False;
}
@@ -1314,7 +1314,7 @@ static BOOL pdb_default_uid_to_rid(struct pdb_methods *methods, uid_t uid,
sid_string_static(pdb_get_user_sid(sampw))));
}
- pdb_free_sam(&sampw);
+ TALLOC_FREE(sampw);
return ret;
}
@@ -1491,7 +1491,7 @@ NTSTATUS pdb_default_enum_group_members(struct pdb_methods *methods,
NTSTATUS pdb_default_enum_group_memberships(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
- SAM_ACCOUNT *user,
+ struct samu *user,
DOM_SID **pp_sids,
gid_t **pp_gids,
size_t *p_num_groups)
@@ -1551,7 +1551,7 @@ static BOOL lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32 rid,
enum SID_NAME_USE *psid_name_use,
union unid_t *unix_id)
{
- SAM_ACCOUNT *sam_account = NULL;
+ struct samu *sam_account = NULL;
GROUP_MAP map;
BOOL ret;
DOM_SID sid;
@@ -1578,7 +1578,7 @@ static BOOL lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32 rid,
*name = talloc_strdup(mem_ctx, pdb_get_username(sam_account));
*psid_name_use = SID_NAME_USER;
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
if (unix_id == NULL) {
return True;
@@ -1591,7 +1591,7 @@ static BOOL lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32 rid,
unix_id->uid = pw->pw_uid;
return True;
}
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
ret = pdb_getgrsid(&map, sid);
unbecome_root();
@@ -1812,7 +1812,7 @@ static BOOL next_entry_users(struct pdb_search *s,
struct samr_displayentry *entry)
{
struct user_search *state = s->private_data;
- SAM_ACCOUNT *user = NULL;
+ struct samu *user = NULL;
NTSTATUS status;
next:
@@ -1823,13 +1823,13 @@ static BOOL next_entry_users(struct pdb_search *s,
}
if (!pdb_getsampwent(user)) {
- pdb_free_sam(&user);
+ TALLOC_FREE(user);
return False;
}
if ((state->acct_flags != 0) &&
((pdb_get_acct_ctrl(user) & state->acct_flags) == 0)) {
- pdb_free_sam(&user);
+ TALLOC_FREE(user);
goto next;
}
@@ -1838,7 +1838,7 @@ static BOOL next_entry_users(struct pdb_search *s,
pdb_get_fullname(user), pdb_get_acct_desc(user),
entry);
- pdb_free_sam(&user);
+ TALLOC_FREE(user);
return True;
}
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 9abd668d6f..3344b17888 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -30,7 +30,7 @@
* Clean up SSL stuff, compile on OpenLDAP 1.x, 2.x, and Netscape SDK
*
* Other LDAP based login attributes: accountExpires, etc.
-* (should be the domain of Samba proper, but the sam_password/SAM_ACCOUNT
+* (should be the domain of Samba proper, but the sam_password/struct samu
* structures don't have fields for some of these attributes)
*
* SSL is done, but can't get the certificate based authentication to work
@@ -77,10 +77,6 @@
#endif
-#ifndef SAM_ACCOUNT
-#define SAM_ACCOUNT struct sam_passwd
-#endif
-
#include "smbldap.h"
/**********************************************************************
@@ -450,10 +446,10 @@ static int ldapsam_delete_entry(struct ldapsam_privates *priv,
#if 0 /* JERRY - not uesed anymore */
/**********************************************************************
-Initialize SAM_ACCOUNT from an LDAP query (unix attributes only)
+Initialize struct samu from an LDAP query (unix attributes only)
*********************************************************************/
static BOOL get_unix_attributes (struct ldapsam_privates *ldap_state,
- SAM_ACCOUNT * sampass,
+ struct samu * sampass,
LDAPMessage * entry,
gid_t *gid)
{
@@ -521,12 +517,12 @@ static time_t ldapsam_get_entry_timestamp(
}
/**********************************************************************
- Initialize SAM_ACCOUNT from an LDAP query.
+ Initialize struct samu from an LDAP query.
(Based on init_sam_from_buffer in pdb_tdb.c)
*********************************************************************/
static BOOL init_sam_from_ldap(struct ldapsam_privates *ldap_state,
- SAM_ACCOUNT * sampass,
+ struct samu * sampass,
LDAPMessage * entry)
{
time_t logon_time,
@@ -734,7 +730,7 @@ static BOOL init_sam_from_ldap(struct ldapsam_privates *ldap_state,
get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_HOME_PATH), homedir))
{
pdb_set_homedir( sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_home()),
+ talloc_sub_basic(sampass, username, lp_logon_home()),
PDB_DEFAULT );
} else {
pstrcpy( tmpstring, homedir );
@@ -749,7 +745,7 @@ static BOOL init_sam_from_ldap(struct ldapsam_privates *ldap_state,
get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_LOGON_SCRIPT), logon_script))
{
pdb_set_logon_script( sampass,
- talloc_sub_basic(sampass->mem_ctx, username, lp_logon_script()),
+ talloc_sub_basic(sampass, username, lp_logon_script()),
PDB_DEFAULT );
} else {
pstrcpy( tmpstring, logon_script );
@@ -764,7 +760,7 @@ static BOOL init_sam_from_ldap(struct ldapsam_privates *ldap_state,
get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_PROFILE_PATH), profile_path))
{
pdb_set_profile_path( sampass,
- talloc_sub_basic( sampass->mem_ctx, username, lp_logon_path()),
+ talloc_sub_basic( sampass, username, lp_logon_path()),
PDB_DEFAULT );
} else {
pstrcpy( tmpstring, profile_path );
@@ -1003,14 +999,14 @@ static BOOL init_sam_from_ldap(struct ldapsam_privates *ldap_state,
}
/**********************************************************************
- Initialize the ldap db from a SAM_ACCOUNT. Called on update.
+ Initialize the ldap db from a struct samu. Called on update.
(Based on init_buffer_from_sam in pdb_tdb.c)
*********************************************************************/
static BOOL init_ldap_from_sam (struct ldapsam_privates *ldap_state,
LDAPMessage *existing,
- LDAPMod *** mods, SAM_ACCOUNT * sampass,
- BOOL (*need_update)(const SAM_ACCOUNT *,
+ LDAPMod *** mods, struct samu * sampass,
+ BOOL (*need_update)(const struct samu *,
enum pdb_elements))
{
pstring temp;
@@ -1392,7 +1388,7 @@ Get the next entry in the LDAP password database.
*********************************************************************/
static NTSTATUS ldapsam_getsampwent(struct pdb_methods *my_methods,
- SAM_ACCOUNT *user)
+ struct samu *user)
{
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
struct ldapsam_privates *ldap_state =
@@ -1434,10 +1430,10 @@ static void append_attr(TALLOC_CTX *mem_ctx, const char ***attr_list,
}
/**********************************************************************
-Get SAM_ACCOUNT entry from LDAP by username.
+Get struct samu entry from LDAP by username.
*********************************************************************/
-static NTSTATUS ldapsam_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT *user, const char *sname)
+static NTSTATUS ldapsam_getsampwnam(struct pdb_methods *my_methods, struct samu *user, const char *sname)
{
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
@@ -1447,11 +1443,11 @@ static NTSTATUS ldapsam_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT
const char ** attr_list;
int rc;
- attr_list = get_userattr_list( user->mem_ctx, ldap_state->schema_ver );
- append_attr(user->mem_ctx, &attr_list,
+ attr_list = get_userattr_list( user, ldap_state->schema_ver );
+ append_attr(user, &attr_list,
get_userattr_key2string(ldap_state->schema_ver,
LDAP_ATTR_MOD_TIMESTAMP));
- append_attr(user->mem_ctx, &attr_list, "uidNumber");
+ append_attr(user, &attr_list, "uidNumber");
rc = ldapsam_search_suffix_by_name(ldap_state, sname, &result,
attr_list);
TALLOC_FREE( attr_list );
@@ -1480,7 +1476,7 @@ static NTSTATUS ldapsam_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT
}
pdb_set_backend_private_data(user, result, NULL,
my_methods, PDB_CHANGED);
- talloc_autofree_ldapmsg(user->mem_ctx, result);
+ talloc_autofree_ldapmsg(user, result);
ret = NT_STATUS_OK;
} else {
ldap_msgfree(result);
@@ -1536,10 +1532,10 @@ static int ldapsam_get_ldap_user_by_sid(struct ldapsam_privates *ldap_state,
}
/**********************************************************************
- Get SAM_ACCOUNT entry from LDAP by SID.
+ Get struct samu entry from LDAP by SID.
*********************************************************************/
-static NTSTATUS ldapsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, const DOM_SID *sid)
+static NTSTATUS ldapsam_getsampwsid(struct pdb_methods *my_methods, struct samu * user, const DOM_SID *sid)
{
struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
LDAPMessage *result = NULL;
@@ -1581,7 +1577,7 @@ static NTSTATUS ldapsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT
pdb_set_backend_private_data(user, result, NULL,
my_methods, PDB_CHANGED);
- talloc_autofree_ldapmsg(user->mem_ctx, result);
+ talloc_autofree_ldapmsg(user, result);
return NT_STATUS_OK;
}
@@ -1596,9 +1592,9 @@ static BOOL ldapsam_can_pwchange_exop(struct smbldap_state *ldap_state)
**********************************************************************/
static NTSTATUS ldapsam_modify_entry(struct pdb_methods *my_methods,
- SAM_ACCOUNT *newpwd, char *dn,
+ struct samu *newpwd, char *dn,
LDAPMod **mods, int ldap_op,
- BOOL (*need_update)(const SAM_ACCOUNT *, enum pdb_elements))
+ BOOL (*need_update)(const struct samu *, enum pdb_elements))
{
struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
int rc;
@@ -1731,7 +1727,7 @@ static NTSTATUS ldapsam_modify_entry(struct pdb_methods *my_methods,
*********************************************************************/
static NTSTATUS ldapsam_delete_sam_account(struct pdb_methods *my_methods,
- SAM_ACCOUNT * sam_acct)
+ struct samu * sam_acct)
{
struct ldapsam_privates *priv =
(struct ldapsam_privates *)my_methods->private_data;
@@ -1792,17 +1788,17 @@ static NTSTATUS ldapsam_delete_sam_account(struct pdb_methods *my_methods,
we need LDAP modification.
*********************************************************************/
-static BOOL element_is_changed(const SAM_ACCOUNT *sampass,
+static BOOL element_is_changed(const struct samu *sampass,
enum pdb_elements element)
{
return IS_SAM_CHANGED(sampass, element);
}
/**********************************************************************
- Update SAM_ACCOUNT.
+ Update struct samu.
*********************************************************************/
-static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, SAM_ACCOUNT * newpwd)
+static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, struct samu * newpwd)
{
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
@@ -1823,7 +1819,7 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, SAM_A
}
pdb_set_backend_private_data(newpwd, result, NULL,
my_methods, PDB_CHANGED);
- talloc_autofree_ldapmsg(newpwd->mem_ctx, result);
+ talloc_autofree_ldapmsg(newpwd, result);
}
if (ldap_count_entries(ldap_state->smbldap_state->ldap_struct, result) == 0) {
@@ -1869,12 +1865,12 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, SAM_A
}
/***************************************************************************
- Renames a SAM_ACCOUNT
+ Renames a struct samu
- The "rename user script" has full responsibility for changing everything
***************************************************************************/
static NTSTATUS ldapsam_rename_sam_account(struct pdb_methods *my_methods,
- SAM_ACCOUNT *old_acct,
+ struct samu *old_acct,
const char *newname)
{
const char *oldname;
@@ -1919,7 +1915,7 @@ static NTSTATUS ldapsam_rename_sam_account(struct pdb_methods *my_methods,
we need LDAP modification.
*********************************************************************/
-static BOOL element_is_set_or_changed(const SAM_ACCOUNT *sampass,
+static BOOL element_is_set_or_changed(const struct samu *sampass,
enum pdb_elements element)
{
return (IS_SAM_SET(sampass, element) ||
@@ -1927,10 +1923,10 @@ static BOOL element_is_set_or_changed(const SAM_ACCOUNT *sampass,
}
/**********************************************************************
- Add SAM_ACCOUNT to LDAP.
+ Add struct samu to LDAP.
*********************************************************************/
-static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCOUNT * newpwd)
+static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, struct samu * newpwd)
{
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
@@ -2561,7 +2557,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods,
static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
- SAM_ACCOUNT *user,
+ struct samu *user,
DOM_SID **pp_sids,
gid_t **pp_gids,
size_t *p_num_groups)
diff --git a/source3/passdb/pdb_nds.c b/source3/passdb/pdb_nds.c
index 4bbdeb4dbb..34e550d413 100644
--- a/source3/passdb/pdb_nds.c
+++ b/source3/passdb/pdb_nds.c
@@ -741,7 +741,7 @@ int pdb_nds_set_password(
*********************************************************************/
static NTSTATUS pdb_nds_update_login_attempts(struct pdb_methods *methods,
- SAM_ACCOUNT *sam_acct, BOOL success)
+ struct samu *sam_acct, BOOL success)
{
struct ldapsam_privates *ldap_state;
@@ -780,7 +780,7 @@ static NTSTATUS pdb_nds_update_login_attempts(struct pdb_methods *methods,
}
pdb_set_backend_private_data(sam_acct, result, NULL,
methods, PDB_CHANGED);
- talloc_autofree_ldapmsg(sam_acct->mem_ctx, result);
+ talloc_autofree_ldapmsg(sam_acct, result);
}
if (ldap_count_entries(ldap_state->smbldap_state->ldap_struct, result) == 0) {
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 1837b4fcee..ebd5de2258 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -1137,12 +1137,12 @@ Error was %s\n", pwd->smb_name, pfile2, strerror(errno)));
}
/*********************************************************************
- Create a smb_passwd struct from a SAM_ACCOUNT.
+ Create a smb_passwd struct from a struct samu.
We will not allocate any new memory. The smb_passwd struct
- should only stay around as long as the SAM_ACCOUNT does.
+ should only stay around as long as the struct samu does.
********************************************************************/
-static BOOL build_smb_pass (struct smb_passwd *smb_pw, const SAM_ACCOUNT *sampass)
+static BOOL build_smb_pass (struct smb_passwd *smb_pw, const struct samu *sampass)
{
uint32 rid;
@@ -1182,16 +1182,16 @@ static BOOL build_smb_pass (struct smb_passwd *smb_pw, const SAM_ACCOUNT *sampas
}
/*********************************************************************
- Create a SAM_ACCOUNT from a smb_passwd struct
+ Create a struct samu from a smb_passwd struct
********************************************************************/
static BOOL build_sam_account(struct smbpasswd_privates *smbpasswd_state,
- SAM_ACCOUNT *sam_pass, const struct smb_passwd *pw_buf)
+ struct samu *sam_pass, const struct smb_passwd *pw_buf)
{
struct passwd *pwfile;
if (sam_pass==NULL) {
- DEBUG(5,("build_sam_account: SAM_ACCOUNT is NULL\n"));
+ DEBUG(5,("build_sam_account: struct samu is NULL\n"));
return False;
}
@@ -1263,7 +1263,7 @@ static void smbpasswd_endsampwent (struct pdb_methods *my_methods)
/*****************************************************************
****************************************************************/
-static NTSTATUS smbpasswd_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUNT *user)
+static NTSTATUS smbpasswd_getsampwent(struct pdb_methods *my_methods, struct samu *user)
{
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
@@ -1285,7 +1285,7 @@ static NTSTATUS smbpasswd_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUN
if (pw_buf == NULL)
return nt_status;
- /* build the SAM_ACCOUNT entry from the smb_passwd struct.
+ /* build the struct samu entry from the smb_passwd struct.
We loop in case the user in the pdb does not exist in
the local system password file */
if (build_sam_account(smbpasswd_state, user, pw_buf))
@@ -1305,7 +1305,7 @@ static NTSTATUS smbpasswd_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUN
***************************************************************/
static NTSTATUS smbpasswd_getsampwnam(struct pdb_methods *my_methods,
- SAM_ACCOUNT *sam_acct, const char *username)
+ struct samu *sam_acct, const char *username)
{
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
@@ -1337,14 +1337,14 @@ static NTSTATUS smbpasswd_getsampwnam(struct pdb_methods *my_methods,
DEBUG(10, ("getsampwnam (smbpasswd): found by name: %s\n", smb_pw->smb_name));
if (!sam_acct) {
- DEBUG(10,("getsampwnam (smbpasswd): SAM_ACCOUNT is NULL\n"));
+ DEBUG(10,("getsampwnam (smbpasswd): struct samu is NULL\n"));
#if 0
smb_panic("NULL pointer passed to pdb_getsampwnam\n");
#endif
return nt_status;
}
- /* now build the SAM_ACCOUNT */
+ /* now build the struct samu */
if (!build_sam_account(smbpasswd_state, sam_acct, smb_pw))
return nt_status;
@@ -1352,7 +1352,7 @@ static NTSTATUS smbpasswd_getsampwnam(struct pdb_methods *my_methods,
return NT_STATUS_OK;
}
-static NTSTATUS smbpasswd_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT *sam_acct, const DOM_SID *sid)
+static NTSTATUS smbpasswd_getsampwsid(struct pdb_methods *my_methods, struct samu *sam_acct, const DOM_SID *sid)
{
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
@@ -1397,14 +1397,14 @@ static NTSTATUS smbpasswd_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUN
DEBUG(10, ("getsampwrid (smbpasswd): found by name: %s\n", smb_pw->smb_name));
if (!sam_acct) {
- DEBUG(10,("getsampwrid: (smbpasswd) SAM_ACCOUNT is NULL\n"));
+ DEBUG(10,("getsampwrid: (smbpasswd) struct samu is NULL\n"));
#if 0
smb_panic("NULL pointer passed to pdb_getsampwrid\n");
#endif
return nt_status;
}
- /* now build the SAM_ACCOUNT */
+ /* now build the struct samu */
if (!build_sam_account (smbpasswd_state, sam_acct, smb_pw))
return nt_status;
@@ -1420,12 +1420,12 @@ static NTSTATUS smbpasswd_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUN
return NT_STATUS_OK;
}
-static NTSTATUS smbpasswd_add_sam_account(struct pdb_methods *my_methods, SAM_ACCOUNT *sampass)
+static NTSTATUS smbpasswd_add_sam_account(struct pdb_methods *my_methods, struct samu *sampass)
{
struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
struct smb_passwd smb_pw;
- /* convert the SAM_ACCOUNT */
+ /* convert the struct samu */
if (!build_smb_pass(&smb_pw, sampass)) {
return NT_STATUS_UNSUCCESSFUL;
}
@@ -1438,12 +1438,12 @@ static NTSTATUS smbpasswd_add_sam_account(struct pdb_methods *my_methods, SAM_AC
return NT_STATUS_OK;
}
-static NTSTATUS smbpasswd_update_sam_account(struct pdb_methods *my_methods, SAM_ACCOUNT *sampass)
+static NTSTATUS smbpasswd_update_sam_account(struct pdb_methods *my_methods, struct samu *sampass)
{
struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
struct smb_passwd smb_pw;
- /* convert the SAM_ACCOUNT */
+ /* convert the struct samu */
if (!build_smb_pass(&smb_pw, sampass)) {
DEBUG(0, ("smbpasswd_update_sam_account: build_smb_pass failed!\n"));
return NT_STATUS_UNSUCCESSFUL;
@@ -1458,7 +1458,7 @@ static NTSTATUS smbpasswd_update_sam_account(struct pdb_methods *my_methods, SAM
return NT_STATUS_OK;
}
-static NTSTATUS smbpasswd_delete_sam_account (struct pdb_methods *my_methods, SAM_ACCOUNT *sampass)
+static NTSTATUS smbpasswd_delete_sam_account (struct pdb_methods *my_methods, struct samu *sampass)
{
struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
@@ -1471,11 +1471,11 @@ static NTSTATUS smbpasswd_delete_sam_account (struct pdb_methods *my_methods, SA
}
static NTSTATUS smbpasswd_rename_sam_account (struct pdb_methods *my_methods,
- SAM_ACCOUNT *old_acct,
+ struct samu *old_acct,
const char *newname)
{
pstring rename_script;
- SAM_ACCOUNT *new_acct = NULL;
+ struct samu *new_acct = NULL;
BOOL interim_account = False;
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
@@ -1520,7 +1520,7 @@ done:
smbpasswd_delete_sam_account(my_methods, new_acct);
if (new_acct)
- pdb_free_sam(&new_acct);
+ TALLOC_FREE(new_acct);
return (ret);
}
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index e7f5e0cac9..a5e2f7ae02 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -68,7 +68,6 @@ static pstring tdbsam_filename;
static BOOL tdbsam_convert(int32 from)
{
const char *vstring = TDBSAM_VERSION_STRING;
- SAM_ACCOUNT *user = NULL;
const char *prefix = USERPREFIX;
TDB_DATA data, key, old_key;
uint8 *buf = NULL;
@@ -77,11 +76,6 @@ static BOOL tdbsam_convert(int32 from)
/* handle a Samba upgrade */
tdb_lock_bystring(tdbsam, vstring, 0);
- if ( !NT_STATUS_IS_OK(pdb_init_sam(&user)) ) {
- DEBUG(0,("tdbsam_convert: cannot initialized a SAM_ACCOUNT.\n"));
- return False;
- }
-
/* Enumerate all records and convert them */
key = tdb_firstkey(tdbsam);
@@ -96,7 +90,8 @@ static BOOL tdbsam_convert(int32 from)
}
if (key.dptr) {
-
+ struct samu *user = NULL;
+
/* read from tdbsam */
data = tdb_fetch(tdbsam, key);
if (!data.dptr) {
@@ -104,13 +99,8 @@ static BOOL tdbsam_convert(int32 from)
return False;
}
- if (!NT_STATUS_IS_OK(pdb_reset_sam(user))) {
- DEBUG(0,("tdbsam_convert: cannot reset SAM_ACCOUNT.\n"));
- SAFE_FREE(data.dptr);
- return False;
- }
-
/* unpack the buffer from the former format */
+ pdb_init_sam( &user );
DEBUG(10,("tdbsam_convert: Try unpacking a record with (key:%s) (version:%d)\n", key.dptr, from));
switch (from) {
case 0:
@@ -127,8 +117,9 @@ static BOOL tdbsam_convert(int32 from)
ret = False;
}
if (!ret) {
- DEBUG(0,("tdbsam_convert: Bad SAM_ACCOUNT entry returned from TDB (key:%s) (version:%d)\n", key.dptr, from));
+ DEBUG(0,("tdbsam_convert: Bad struct samu entry returned from TDB (key:%s) (version:%d)\n", key.dptr, from));
SAFE_FREE(data.dptr);
+ TALLOC_FREE(user );
return False;
}
@@ -136,17 +127,20 @@ static BOOL tdbsam_convert(int32 from)
SAFE_FREE(data.dptr);
/* pack from the buffer into the new format */
+
DEBUG(10,("tdbsam_convert: Try packing a record (key:%s) (version:%d)\n", key.dptr, from));
- if ((data.dsize=init_buffer_from_sam (&buf, user, False)) == -1) {
- DEBUG(0,("tdbsam_convert: cannot pack the SAM_ACCOUNT into the new format\n"));
- SAFE_FREE(data.dptr);
+ data.dsize = init_buffer_from_sam (&buf, user, False);
+ TALLOC_FREE(user );
+
+ if ( data.dsize == -1 ) {
+ DEBUG(0,("tdbsam_convert: cannot pack the struct samu into the new format\n"));
return False;
}
data.dptr = (char *)buf;
/* Store the buffer inside the TDBSAM */
if (tdb_store(tdbsam, key, data, TDB_MODIFY) != TDB_SUCCESS) {
- DEBUG(0,("tdbsam_convert: cannot store the SAM_ACCOUNT (key:%s) in new format\n",key.dptr));
+ DEBUG(0,("tdbsam_convert: cannot store the struct samu (key:%s) in new format\n",key.dptr));
SAFE_FREE(data.dptr);
return False;
}
@@ -161,7 +155,6 @@ static BOOL tdbsam_convert(int32 from)
}
- pdb_free_sam(&user);
/* upgrade finished */
tdb_store_int32(tdbsam, vstring, TDBSAM_VERSION);
@@ -293,8 +286,13 @@ static int tdbsam_traverse_setpwent(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data,
static NTSTATUS tdbsam_setsampwent(struct pdb_methods *my_methods, BOOL update, uint16 acb_mask)
{
+ if ( !tdbsam_open( tdbsam_filename ) ) {
+ DEBUG(0,("tdbsam_getsampwnam: failed to open %s!\n", tdbsam_filename));
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
tdb_traverse( tdbsam, tdbsam_traverse_setpwent, NULL );
-
+
return NT_STATUS_OK;
}
@@ -317,20 +315,22 @@ static void tdbsam_endsampwent(struct pdb_methods *my_methods)
}
DEBUG(7, ("endtdbpwent: closed sam database.\n"));
+
+ tdbsam_close();
}
/*****************************************************************
- Get one SAM_ACCOUNT from the TDB (next in line)
+ Get one struct samu from the TDB (next in line)
*****************************************************************/
-static NTSTATUS tdbsam_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUNT *user)
+static NTSTATUS tdbsam_getsampwent(struct pdb_methods *my_methods, struct samu *user)
{
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
TDB_DATA data;
struct pwent_list *pkey;
if ( !user ) {
- DEBUG(0,("tdbsam_getsampwent: SAM_ACCOUNT is NULL.\n"));
+ DEBUG(0,("tdbsam_getsampwent: struct samu is NULL.\n"));
return nt_status;
}
@@ -355,7 +355,7 @@ static NTSTATUS tdbsam_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUNT *
}
if ( !init_sam_from_buffer(user, (unsigned char *)data.dptr, data.dsize) ) {
- DEBUG(0,("pdb_getsampwent: Bad SAM_ACCOUNT entry returned from TDB!\n"));
+ DEBUG(0,("pdb_getsampwent: Bad struct samu entry returned from TDB!\n"));
}
SAFE_FREE( data.dptr );
@@ -367,7 +367,7 @@ static NTSTATUS tdbsam_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUNT *
Lookup a name in the SAM TDB
******************************************************************/
-static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods, SAM_ACCOUNT *user, const char *sname)
+static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods, struct samu *user, const char *sname)
{
NTSTATUS result;
TDB_DATA data, key;
@@ -375,7 +375,7 @@ static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods, SAM_ACCOUNT
fstring name;
if ( !user ) {
- DEBUG(0,("pdb_getsampwnam: SAM_ACCOUNT is NULL.\n"));
+ DEBUG(0,("pdb_getsampwnam: struct samu is NULL.\n"));
return NT_STATUS_NO_MEMORY;
}
@@ -409,7 +409,7 @@ static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods, SAM_ACCOUNT
/* unpack the buffer */
if (!init_sam_from_buffer(user, (unsigned char *)data.dptr, data.dsize)) {
- DEBUG(0,("pdb_getsampwent: Bad SAM_ACCOUNT entry returned from TDB!\n"));
+ DEBUG(0,("pdb_getsampwent: Bad struct samu entry returned from TDB!\n"));
SAFE_FREE(data.dptr);
result = NT_STATUS_NO_MEMORY;
goto done;
@@ -428,7 +428,7 @@ static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods, SAM_ACCOUNT
Search by rid
**************************************************************************/
-static NTSTATUS tdbsam_getsampwrid (struct pdb_methods *my_methods, SAM_ACCOUNT *user, uint32 rid)
+static NTSTATUS tdbsam_getsampwrid (struct pdb_methods *my_methods, struct samu *user, uint32 rid)
{
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
TDB_DATA data, key;
@@ -436,7 +436,7 @@ static NTSTATUS tdbsam_getsampwrid (struct pdb_methods *my_methods, SAM_ACCOUNT
fstring name;
if ( !user ) {
- DEBUG(0,("pdb_getsampwrid: SAM_ACCOUNT is NULL.\n"));
+ DEBUG(0,("pdb_getsampwrid: struct samu is NULL.\n"));
return nt_status;
}
@@ -476,7 +476,7 @@ static NTSTATUS tdbsam_getsampwrid (struct pdb_methods *my_methods, SAM_ACCOUNT
return nt_status;
}
-static NTSTATUS tdbsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, const DOM_SID *sid)
+static NTSTATUS tdbsam_getsampwsid(struct pdb_methods *my_methods, struct samu * user, const DOM_SID *sid)
{
uint32 rid;
@@ -486,7 +486,7 @@ static NTSTATUS tdbsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT *
return tdbsam_getsampwrid(my_methods, user, rid);
}
-static BOOL tdb_delete_samacct_only( SAM_ACCOUNT *sam_pass )
+static BOOL tdb_delete_samacct_only( struct samu *sam_pass )
{
TDB_DATA key;
fstring keystr;
@@ -513,10 +513,10 @@ static BOOL tdb_delete_samacct_only( SAM_ACCOUNT *sam_pass )
}
/***************************************************************************
- Delete a SAM_ACCOUNT records for the username and RID key
+ Delete a struct samu records for the username and RID key
****************************************************************************/
-static NTSTATUS tdbsam_delete_sam_account(struct pdb_methods *my_methods, SAM_ACCOUNT *sam_pass)
+static NTSTATUS tdbsam_delete_sam_account(struct pdb_methods *my_methods, struct samu *sam_pass)
{
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
TDB_DATA key;
@@ -587,7 +587,7 @@ static NTSTATUS tdbsam_delete_sam_account(struct pdb_methods *my_methods, SAM_AC
Update the TDB SAM account record only
Assumes that the tdbsam is already open
****************************************************************************/
-static BOOL tdb_update_samacct_only( SAM_ACCOUNT* newpwd, int flag )
+static BOOL tdb_update_samacct_only( struct samu* newpwd, int flag )
{
TDB_DATA key, data;
uint8 *buf = NULL;
@@ -595,10 +595,10 @@ static BOOL tdb_update_samacct_only( SAM_ACCOUNT* newpwd, int flag )
fstring name;
BOOL ret = True;
- /* copy the SAM_ACCOUNT struct into a BYTE buffer for storage */
+ /* copy the struct samu struct into a BYTE buffer for storage */
if ( (data.dsize=init_buffer_from_sam (&buf, newpwd, False)) == -1 ) {
- DEBUG(0,("tdb_update_sam: ERROR - Unable to copy SAM_ACCOUNT info BYTE buffer!\n"));
+ DEBUG(0,("tdb_update_sam: ERROR - Unable to copy struct samu info BYTE buffer!\n"));
ret = False;
goto done;
}
@@ -638,7 +638,7 @@ done:
Update the TDB SAM RID record only
Assumes that the tdbsam is already open
****************************************************************************/
-static BOOL tdb_update_ridrec_only( SAM_ACCOUNT* newpwd, int flag )
+static BOOL tdb_update_ridrec_only( struct samu* newpwd, int flag )
{
TDB_DATA key, data;
fstring keystr;
@@ -672,7 +672,7 @@ static BOOL tdb_update_ridrec_only( SAM_ACCOUNT* newpwd, int flag )
Update the TDB SAM
****************************************************************************/
-static BOOL tdb_update_sam(struct pdb_methods *my_methods, SAM_ACCOUNT* newpwd, int flag)
+static BOOL tdb_update_sam(struct pdb_methods *my_methods, struct samu* newpwd, int flag)
{
uint32 user_rid;
BOOL result = True;
@@ -682,13 +682,13 @@ static BOOL tdb_update_sam(struct pdb_methods *my_methods, SAM_ACCOUNT* newpwd,
tdbsam_endsampwent( my_methods );
if ( !pdb_get_group_rid(newpwd) ) {
- DEBUG (0,("tdb_update_sam: Failing to store a SAM_ACCOUNT for [%s] "
+ DEBUG (0,("tdb_update_sam: Failing to store a struct samu for [%s] "
"without a primary group RID\n", pdb_get_username(newpwd)));
return False;
}
if ( !(user_rid = pdb_get_user_rid(newpwd)) ) {
- DEBUG(0,("tdb_update_sam: SAM_ACCOUNT (%s) with no RID!\n", pdb_get_username(newpwd)));
+ DEBUG(0,("tdb_update_sam: struct samu (%s) with no RID!\n", pdb_get_username(newpwd)));
return False;
}
@@ -711,10 +711,10 @@ static BOOL tdb_update_sam(struct pdb_methods *my_methods, SAM_ACCOUNT* newpwd,
}
/***************************************************************************
- Modifies an existing SAM_ACCOUNT
+ Modifies an existing struct samu
****************************************************************************/
-static NTSTATUS tdbsam_update_sam_account (struct pdb_methods *my_methods, SAM_ACCOUNT *newpwd)
+static NTSTATUS tdbsam_update_sam_account (struct pdb_methods *my_methods, struct samu *newpwd)
{
if ( !tdb_update_sam(my_methods, newpwd, TDB_MODIFY) )
return NT_STATUS_UNSUCCESSFUL;
@@ -723,10 +723,10 @@ static NTSTATUS tdbsam_update_sam_account (struct pdb_methods *my_methods, SAM_A
}
/***************************************************************************
- Adds an existing SAM_ACCOUNT
+ Adds an existing struct samu
****************************************************************************/
-static NTSTATUS tdbsam_add_sam_account (struct pdb_methods *my_methods, SAM_ACCOUNT *newpwd)
+static NTSTATUS tdbsam_add_sam_account (struct pdb_methods *my_methods, struct samu *newpwd)
{
if ( !tdb_update_sam(my_methods, newpwd, TDB_INSERT) )
return NT_STATUS_UNSUCCESSFUL;
@@ -735,7 +735,7 @@ static NTSTATUS tdbsam_add_sam_account (struct pdb_methods *my_methods, SAM_ACCO
}
/***************************************************************************
- Renames a SAM_ACCOUNT
+ Renames a struct samu
- check for the posix user/rename user script
- Add and lock the new user record
- rename the posix user
@@ -744,10 +744,10 @@ static NTSTATUS tdbsam_add_sam_account (struct pdb_methods *my_methods, SAM_ACCO
- unlock the new user record
***************************************************************************/
static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods,
- SAM_ACCOUNT *old_acct,
+ struct samu *old_acct,
const char *newname)
{
- SAM_ACCOUNT *new_acct = NULL;
+ struct samu *new_acct = NULL;
pstring rename_script;
BOOL interim_account = False;
int rename_ret;
@@ -773,7 +773,7 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods,
if ( !pdb_copy_sam_account(old_acct, &new_acct)
|| !pdb_set_username(new_acct, newname, PDB_CHANGED))
{
- pdb_free_sam( &new_acct );
+ TALLOC_FREE(new_acct );
return NT_STATUS_NO_MEMORY;
}
@@ -781,7 +781,7 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods,
if ( !tdbsam_open( tdbsam_filename ) ) {
DEBUG(0,("tdbsam_getsampwnam: failed to open %s!\n", tdbsam_filename));
- pdb_free_sam( &new_acct );
+ TALLOC_FREE(new_acct );
return NT_STATUS_ACCESS_DENIED;
}
@@ -820,7 +820,7 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods,
tdbsam_close();
- pdb_free_sam( &new_acct );
+ TALLOC_FREE(new_acct );
return NT_STATUS_OK;
done:
@@ -833,7 +833,7 @@ done:
tdbsam_close();
if (new_acct)
- pdb_free_sam(&new_acct);
+ TALLOC_FREE(new_acct);
return NT_STATUS_ACCESS_DENIED;
}
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index 53c92acb43..fc4d7a3ab3 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -5976,7 +5976,7 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr,
*************************************************************************/
-NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, SAM_ACCOUNT *pw, DOM_SID *domain_sid)
+NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID *domain_sid)
{
NTTIME logon_time, logoff_time, kickoff_time,
pass_last_set_time, pass_can_change_time,
@@ -6242,7 +6242,7 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr,
return True;
}
-void init_sam_user_info20A(SAM_USER_INFO_20 *usr, SAM_ACCOUNT *pw)
+void init_sam_user_info20A(SAM_USER_INFO_20 *usr, struct samu *pw)
{
const char *munged_dial = pdb_get_munged_dial(pw);
DATA_BLOB blob = base64_decode_data_blob(munged_dial);
diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c
index 737729a4ce..ea0685f41b 100644
--- a/source3/rpc_server/srv_netlog_nt.c
+++ b/source3/rpc_server/srv_netlog_nt.c
@@ -206,7 +206,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;
+ struct samu *sampass = NULL;
const uint8 *pass;
BOOL ret;
uint32 acct_ctrl;
@@ -239,7 +239,7 @@ static BOOL get_md4pw(char *md4pw, char *mach_acct)
if (ret==False) {
DEBUG(0,("get_md4pw: Workstation %s: no account in domain\n", mach_acct));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return False;
}
@@ -251,12 +251,12 @@ static BOOL get_md4pw(char *md4pw, char *mach_acct)
((pass=pdb_get_nt_passwd(sampass)) != NULL)) {
memcpy(md4pw, pass, 16);
dump_data(5, md4pw, 16);
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return True;
}
DEBUG(0,("get_md4pw: Workstation %s: no account in domain\n", mach_acct));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return False;
}
@@ -462,7 +462,7 @@ NTSTATUS _net_srv_pwset(pipes_struct *p, NET_Q_SRV_PWSET *q_u, NET_R_SRV_PWSET *
{
NTSTATUS status = NT_STATUS_ACCESS_DENIED;
fstring remote_machine;
- SAM_ACCOUNT *sampass=NULL;
+ struct samu *sampass=NULL;
BOOL ret = False;
unsigned char pwd[16];
int i;
@@ -529,12 +529,12 @@ NTSTATUS _net_srv_pwset(pipes_struct *p, NET_Q_SRV_PWSET *q_u, NET_R_SRV_PWSET *
&& (acct_ctrl & ACB_WSTRUST ||
acct_ctrl & ACB_SVRTRUST ||
acct_ctrl & ACB_DOMTRUST))) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_NO_SUCH_USER;
}
if (pdb_get_acct_ctrl(sampass) & ACB_DISABLED) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_ACCOUNT_DISABLED;
}
@@ -557,17 +557,17 @@ NTSTATUS _net_srv_pwset(pipes_struct *p, NET_Q_SRV_PWSET *q_u, NET_R_SRV_PWSET *
/* LM password should be NULL for machines */
if (!pdb_set_lanman_passwd(sampass, NULL, PDB_CHANGED)) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_NO_MEMORY;
}
if (!pdb_set_nt_passwd(sampass, pwd, PDB_CHANGED)) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_NO_MEMORY;
}
if (!pdb_set_pass_changed_now(sampass)) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
/* Not quite sure what this one qualifies as, but this will do */
return NT_STATUS_UNSUCCESSFUL;
}
@@ -580,7 +580,7 @@ NTSTATUS _net_srv_pwset(pipes_struct *p, NET_Q_SRV_PWSET *q_u, NET_R_SRV_PWSET *
/* set up the LSA Server Password Set response */
init_net_r_srv_pwset(r_u, &cred_out, status);
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return r_u->status;
}
@@ -696,7 +696,7 @@ static NTSTATUS _net_sam_logon_internal(pipes_struct *p,
fstring nt_username, nt_domain, nt_workstation;
auth_usersupplied_info *user_info = NULL;
auth_serversupplied_info *server_info = NULL;
- SAM_ACCOUNT *sampw;
+ struct samu *sampw;
struct auth_context *auth_context = NULL;
if ( (lp_server_schannel() == True) && (p->auth.auth_type != PIPE_AUTH_TYPE_SCHANNEL) ) {
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index bc73c9ef87..f9a28f1272 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -470,7 +470,7 @@ static void force_flush_samr_cache(DISP_INFO *disp_info)
Ensure password info is never given out. Paranioa... JRA.
********************************************************************/
-static void samr_clear_sam_passwd(SAM_ACCOUNT *sam_pass)
+static void samr_clear_sam_passwd(struct samu *sam_pass)
{
if (!sam_pass)
@@ -1667,7 +1667,7 @@ NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOK
NTSTATUS _samr_open_user(pipes_struct *p, SAMR_Q_OPEN_USER *q_u, SAMR_R_OPEN_USER *r_u)
{
- SAM_ACCOUNT *sampass=NULL;
+ struct samu *sampass=NULL;
DOM_SID sid;
POLICY_HND domain_pol = q_u->domain_pol;
POLICY_HND *user_pol = &r_u->user_pol;
@@ -1727,7 +1727,7 @@ NTSTATUS _samr_open_user(pipes_struct *p, SAMR_Q_OPEN_USER *q_u, SAMR_R_OPEN_USE
return NT_STATUS_NO_SUCH_USER;
}
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
/* associate the user's SID and access bits with the new handle. */
if ((info = get_samr_info_by_sid(&sid)) == NULL)
@@ -1747,7 +1747,7 @@ NTSTATUS _samr_open_user(pipes_struct *p, SAMR_Q_OPEN_USER *q_u, SAMR_R_OPEN_USE
static NTSTATUS get_user_info_7(TALLOC_CTX *mem_ctx, SAM_USER_INFO_7 *id7, DOM_SID *user_sid)
{
- SAM_ACCOUNT *smbpass=NULL;
+ struct samu *smbpass=NULL;
BOOL ret;
NTSTATUS nt_status;
@@ -1771,7 +1771,7 @@ static NTSTATUS get_user_info_7(TALLOC_CTX *mem_ctx, SAM_USER_INFO_7 *id7, DOM_S
ZERO_STRUCTP(id7);
init_sam_user_info7(id7, pdb_get_username(smbpass) );
- pdb_free_sam(&smbpass);
+ TALLOC_FREE(smbpass);
return NT_STATUS_OK;
}
@@ -1781,7 +1781,7 @@ static NTSTATUS get_user_info_7(TALLOC_CTX *mem_ctx, SAM_USER_INFO_7 *id7, DOM_S
*************************************************************************/
static NTSTATUS get_user_info_9(TALLOC_CTX *mem_ctx, SAM_USER_INFO_9 * id9, DOM_SID *user_sid)
{
- SAM_ACCOUNT *smbpass=NULL;
+ struct samu *smbpass=NULL;
BOOL ret;
NTSTATUS nt_status;
@@ -1805,7 +1805,7 @@ static NTSTATUS get_user_info_9(TALLOC_CTX *mem_ctx, SAM_USER_INFO_9 * id9, DOM_
ZERO_STRUCTP(id9);
init_sam_user_info9(id9, pdb_get_group_rid(smbpass) );
- pdb_free_sam(&smbpass);
+ TALLOC_FREE(smbpass);
return NT_STATUS_OK;
}
@@ -1816,7 +1816,7 @@ static NTSTATUS get_user_info_9(TALLOC_CTX *mem_ctx, SAM_USER_INFO_9 * id9, DOM_
static NTSTATUS get_user_info_16(TALLOC_CTX *mem_ctx, SAM_USER_INFO_16 *id16, DOM_SID *user_sid)
{
- SAM_ACCOUNT *smbpass=NULL;
+ struct samu *smbpass=NULL;
BOOL ret;
NTSTATUS nt_status;
@@ -1840,7 +1840,7 @@ static NTSTATUS get_user_info_16(TALLOC_CTX *mem_ctx, SAM_USER_INFO_16 *id16, DO
ZERO_STRUCTP(id16);
init_sam_user_info16(id16, pdb_get_acct_ctrl(smbpass) );
- pdb_free_sam(&smbpass);
+ TALLOC_FREE(smbpass);
return NT_STATUS_OK;
}
@@ -1853,7 +1853,7 @@ static NTSTATUS get_user_info_16(TALLOC_CTX *mem_ctx, SAM_USER_INFO_16 *id16, DO
static NTSTATUS get_user_info_18(pipes_struct *p, TALLOC_CTX *mem_ctx, SAM_USER_INFO_18 * id18, DOM_SID *user_sid)
{
- SAM_ACCOUNT *smbpass=NULL;
+ struct samu *smbpass=NULL;
BOOL ret;
NTSTATUS nt_status;
@@ -1879,21 +1879,21 @@ static NTSTATUS get_user_info_18(pipes_struct *p, TALLOC_CTX *mem_ctx, SAM_USER_
if (ret == False) {
DEBUG(4, ("User %s not found\n", sid_string_static(user_sid)));
- pdb_free_sam(&smbpass);
+ TALLOC_FREE(smbpass);
return (geteuid() == (uid_t)0) ? NT_STATUS_NO_SUCH_USER : NT_STATUS_ACCESS_DENIED;
}
DEBUG(3,("User:[%s] 0x%x\n", pdb_get_username(smbpass), pdb_get_acct_ctrl(smbpass) ));
if ( pdb_get_acct_ctrl(smbpass) & ACB_DISABLED) {
- pdb_free_sam(&smbpass);
+ TALLOC_FREE(smbpass);
return NT_STATUS_ACCOUNT_DISABLED;
}
ZERO_STRUCTP(id18);
init_sam_user_info18(id18, pdb_get_lanman_passwd(smbpass), pdb_get_nt_passwd(smbpass));
- pdb_free_sam(&smbpass);
+ TALLOC_FREE(smbpass);
return NT_STATUS_OK;
}
@@ -1904,7 +1904,7 @@ static NTSTATUS get_user_info_18(pipes_struct *p, TALLOC_CTX *mem_ctx, SAM_USER_
static NTSTATUS get_user_info_20(TALLOC_CTX *mem_ctx, SAM_USER_INFO_20 *id20, DOM_SID *user_sid)
{
- SAM_ACCOUNT *sampass=NULL;
+ struct samu *sampass=NULL;
BOOL ret;
pdb_init_sam_talloc(mem_ctx, &sampass);
@@ -1925,7 +1925,7 @@ static NTSTATUS get_user_info_20(TALLOC_CTX *mem_ctx, SAM_USER_INFO_20 *id20, DO
ZERO_STRUCTP(id20);
init_sam_user_info20A(id20, sampass);
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_OK;
}
@@ -1937,7 +1937,7 @@ static NTSTATUS get_user_info_20(TALLOC_CTX *mem_ctx, SAM_USER_INFO_20 *id20, DO
static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx, SAM_USER_INFO_21 *id21,
DOM_SID *user_sid, DOM_SID *domain_sid)
{
- SAM_ACCOUNT *sampass=NULL;
+ struct samu *sampass=NULL;
BOOL ret;
NTSTATUS nt_status;
@@ -1962,7 +1962,7 @@ static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx, SAM_USER_INFO_21 *id21,
ZERO_STRUCTP(id21);
nt_status = init_sam_user_info21A(id21, sampass, domain_sid);
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_OK;
}
@@ -2073,7 +2073,7 @@ NTSTATUS _samr_query_userinfo(pipes_struct *p, SAMR_Q_QUERY_USERINFO *q_u, SAMR_
NTSTATUS _samr_query_usergroups(pipes_struct *p, SAMR_Q_QUERY_USERGROUPS *q_u, SAMR_R_QUERY_USERGROUPS *r_u)
{
- SAM_ACCOUNT *sam_pass=NULL;
+ struct samu *sam_pass=NULL;
DOM_SID sid;
DOM_SID *sids;
DOM_GID dom_gid;
@@ -2150,7 +2150,7 @@ NTSTATUS _samr_query_usergroups(pipes_struct *p, SAMR_Q_QUERY_USERGROUPS *q_u, S
DEBUG(5, ("Group sid %s for user %s not in our domain\n",
sid_string_static(pdb_get_group_sid(sam_pass)),
pdb_get_username(sam_pass)));
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@@ -2951,20 +2951,20 @@ NTSTATUS _samr_open_alias(pipes_struct *p, SAMR_Q_OPEN_ALIAS *q_u, SAMR_R_OPEN_A
set_user_info_7
********************************************************************/
static NTSTATUS set_user_info_7(TALLOC_CTX *mem_ctx,
- const SAM_USER_INFO_7 *id7, SAM_ACCOUNT *pwd)
+ const SAM_USER_INFO_7 *id7, struct samu *pwd)
{
fstring new_name;
NTSTATUS rc;
if (id7 == NULL) {
DEBUG(5, ("set_user_info_7: NULL id7\n"));
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
if(!rpcstr_pull(new_name, id7->uni_name.buffer, sizeof(new_name), id7->uni_name.uni_str_len*2, 0)) {
DEBUG(5, ("set_user_info_7: failed to get new username\n"));
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
@@ -2984,7 +2984,7 @@ static NTSTATUS set_user_info_7(TALLOC_CTX *mem_ctx,
rc = pdb_rename_sam_account(pwd, new_name);
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return rc;
}
@@ -2992,26 +2992,26 @@ static NTSTATUS set_user_info_7(TALLOC_CTX *mem_ctx,
set_user_info_16
********************************************************************/
-static BOOL set_user_info_16(const SAM_USER_INFO_16 *id16, SAM_ACCOUNT *pwd)
+static BOOL set_user_info_16(const SAM_USER_INFO_16 *id16, struct samu *pwd)
{
if (id16 == NULL) {
DEBUG(5, ("set_user_info_16: NULL id16\n"));
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
/* FIX ME: check if the value is really changed --metze */
if (!pdb_set_acct_ctrl(pwd, id16->acb_info, PDB_CHANGED)) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return True;
}
@@ -3020,34 +3020,34 @@ static BOOL set_user_info_16(const SAM_USER_INFO_16 *id16, SAM_ACCOUNT *pwd)
set_user_info_18
********************************************************************/
-static BOOL set_user_info_18(SAM_USER_INFO_18 *id18, SAM_ACCOUNT *pwd)
+static BOOL set_user_info_18(SAM_USER_INFO_18 *id18, struct samu *pwd)
{
if (id18 == NULL) {
DEBUG(2, ("set_user_info_18: id18 is NULL\n"));
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
if (!pdb_set_lanman_passwd (pwd, id18->lm_pwd, PDB_CHANGED)) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
if (!pdb_set_nt_passwd (pwd, id18->nt_pwd, PDB_CHANGED)) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
if (!pdb_set_pass_changed_now (pwd)) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return True;
}
@@ -3055,7 +3055,7 @@ static BOOL set_user_info_18(SAM_USER_INFO_18 *id18, SAM_ACCOUNT *pwd)
set_user_info_20
********************************************************************/
-static BOOL set_user_info_20(SAM_USER_INFO_20 *id20, SAM_ACCOUNT *pwd)
+static BOOL set_user_info_20(SAM_USER_INFO_20 *id20, struct samu *pwd)
{
if (id20 == NULL) {
DEBUG(5, ("set_user_info_20: NULL id20\n"));
@@ -3066,11 +3066,11 @@ static BOOL set_user_info_20(SAM_USER_INFO_20 *id20, SAM_ACCOUNT *pwd)
/* write the change out */
if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return True;
}
@@ -3079,7 +3079,7 @@ static BOOL set_user_info_20(SAM_USER_INFO_20 *id20, SAM_ACCOUNT *pwd)
********************************************************************/
static NTSTATUS set_user_info_21(TALLOC_CTX *mem_ctx, SAM_USER_INFO_21 *id21,
- SAM_ACCOUNT *pwd)
+ struct samu *pwd)
{
NTSTATUS status;
@@ -3105,11 +3105,11 @@ static NTSTATUS set_user_info_21(TALLOC_CTX *mem_ctx, SAM_USER_INFO_21 *id21,
/* write the change out */
if(!NT_STATUS_IS_OK(status = pdb_update_sam_account(pwd))) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return status;
}
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return NT_STATUS_OK;
}
@@ -3119,7 +3119,7 @@ static NTSTATUS set_user_info_21(TALLOC_CTX *mem_ctx, SAM_USER_INFO_21 *id21,
********************************************************************/
static NTSTATUS set_user_info_23(TALLOC_CTX *mem_ctx, SAM_USER_INFO_23 *id23,
- SAM_ACCOUNT *pwd)
+ struct samu *pwd)
{
pstring plaintext_buf;
uint32 len;
@@ -3137,12 +3137,12 @@ static NTSTATUS set_user_info_23(TALLOC_CTX *mem_ctx, SAM_USER_INFO_23 *id23,
acct_ctrl = pdb_get_acct_ctrl(pwd);
if (!decode_pw_buffer(id23->pass, plaintext_buf, 256, &len, STR_UNICODE)) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return NT_STATUS_INVALID_PARAMETER;
}
if (!pdb_set_plaintext_passwd (pwd, plaintext_buf)) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
@@ -3162,7 +3162,7 @@ static NTSTATUS set_user_info_23(TALLOC_CTX *mem_ctx, SAM_USER_INFO_23 *id23,
}
if(!chgpasswd(pdb_get_username(pwd), passwd, "", plaintext_buf, True)) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
}
@@ -3173,16 +3173,16 @@ static NTSTATUS set_user_info_23(TALLOC_CTX *mem_ctx, SAM_USER_INFO_23 *id23,
if (IS_SAM_CHANGED(pwd, PDB_GROUPSID) &&
(!NT_STATUS_IS_OK(status = pdb_set_unix_primary_group(mem_ctx,
pwd)))) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return status;
}
if(!NT_STATUS_IS_OK(status = pdb_update_sam_account(pwd))) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return status;
}
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return NT_STATUS_OK;
}
@@ -3191,7 +3191,7 @@ static NTSTATUS set_user_info_23(TALLOC_CTX *mem_ctx, SAM_USER_INFO_23 *id23,
set_user_info_pw
********************************************************************/
-static BOOL set_user_info_pw(uint8 *pass, SAM_ACCOUNT *pwd)
+static BOOL set_user_info_pw(uint8 *pass, struct samu *pwd)
{
uint32 len;
pstring plaintext_buf;
@@ -3205,12 +3205,12 @@ static BOOL set_user_info_pw(uint8 *pass, SAM_ACCOUNT *pwd)
ZERO_STRUCT(plaintext_buf);
if (!decode_pw_buffer(pass, plaintext_buf, 256, &len, STR_UNICODE)) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
if (!pdb_set_plaintext_passwd (pwd, plaintext_buf)) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
@@ -3228,7 +3228,7 @@ static BOOL set_user_info_pw(uint8 *pass, SAM_ACCOUNT *pwd)
}
if(!chgpasswd(pdb_get_username(pwd), passwd, "", plaintext_buf, True)) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
}
@@ -3240,11 +3240,11 @@ static BOOL set_user_info_pw(uint8 *pass, SAM_ACCOUNT *pwd)
/* update the SAMBA password */
if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return False;
}
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return True;
}
@@ -3255,7 +3255,7 @@ static BOOL set_user_info_pw(uint8 *pass, SAM_ACCOUNT *pwd)
NTSTATUS _samr_set_userinfo(pipes_struct *p, SAMR_Q_SET_USERINFO *q_u, SAMR_R_SET_USERINFO *r_u)
{
- SAM_ACCOUNT *pwd = NULL;
+ struct samu *pwd = NULL;
DOM_SID sid;
POLICY_HND *pol = &q_u->pol;
uint16 switch_value = q_u->switch_value;
@@ -3297,7 +3297,7 @@ NTSTATUS _samr_set_userinfo(pipes_struct *p, SAMR_Q_SET_USERINFO *q_u, SAMR_R_SE
unbecome_root();
if ( !ret ) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return NT_STATUS_NO_SUCH_USER;
}
@@ -3401,7 +3401,7 @@ NTSTATUS _samr_set_userinfo(pipes_struct *p, SAMR_Q_SET_USERINFO *q_u, SAMR_R_SE
NTSTATUS _samr_set_userinfo2(pipes_struct *p, SAMR_Q_SET_USERINFO2 *q_u, SAMR_R_SET_USERINFO2 *r_u)
{
- SAM_ACCOUNT *pwd = NULL;
+ struct samu *pwd = NULL;
DOM_SID sid;
SAM_USERINFO_CTR *ctr = q_u->ctr;
POLICY_HND *pol = &q_u->pol;
@@ -3445,7 +3445,7 @@ NTSTATUS _samr_set_userinfo2(pipes_struct *p, SAMR_Q_SET_USERINFO2 *q_u, SAMR_R_
unbecome_root();
if ( !ret ) {
- pdb_free_sam(&pwd);
+ TALLOC_FREE(pwd);
return NT_STATUS_NO_SUCH_USER;
}
@@ -3897,7 +3897,7 @@ NTSTATUS _samr_del_groupmem(pipes_struct *p, SAMR_Q_DEL_GROUPMEM *q_u, SAMR_R_DE
NTSTATUS _samr_delete_dom_user(pipes_struct *p, SAMR_Q_DELETE_DOM_USER *q_u, SAMR_R_DELETE_DOM_USER *r_u )
{
DOM_SID user_sid;
- SAM_ACCOUNT *sam_pass=NULL;
+ struct samu *sam_pass=NULL;
uint32 acc_granted;
BOOL can_add_accounts;
DISP_INFO *disp_info = NULL;
@@ -3920,7 +3920,7 @@ NTSTATUS _samr_delete_dom_user(pipes_struct *p, SAMR_Q_DELETE_DOM_USER *q_u, SAM
if(!pdb_getsampwsid(sam_pass, &user_sid)) {
DEBUG(5,("_samr_delete_dom_user:User %s doesn't exist.\n",
sid_string_static(&user_sid)));
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return NT_STATUS_NO_SUCH_USER;
}
@@ -3942,12 +3942,12 @@ NTSTATUS _samr_delete_dom_user(pipes_struct *p, SAMR_Q_DELETE_DOM_USER *q_u, SAM
DEBUG(5,("_samr_delete_dom_user: Failed to delete entry for "
"user %s: %s.\n", pdb_get_username(sam_pass),
nt_errstr(r_u->status)));
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
return r_u->status;
}
- pdb_free_sam(&sam_pass);
+ TALLOC_FREE(sam_pass);
if (!close_policy_hnd(p, &q_u->user_pol))
return NT_STATUS_OBJECT_NAME_INVALID;
diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c
index 1d9a8ecd1d..03a726dd92 100644
--- a/source3/rpc_server/srv_samr_util.c
+++ b/source3/rpc_server/srv_samr_util.c
@@ -36,10 +36,10 @@
((s1) && (s2) && (strcmp((s1), (s2)) != 0))
/*************************************************************
- Copies a SAM_USER_INFO_20 to a SAM_ACCOUNT
+ Copies a SAM_USER_INFO_20 to a struct samu
**************************************************************/
-void copy_id20_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_20 *from)
+void copy_id20_to_sam_passwd(struct samu *to, SAM_USER_INFO_20 *from)
{
const char *old_string;
char *new_string;
@@ -63,10 +63,10 @@ void copy_id20_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_20 *from)
}
/*************************************************************
- Copies a SAM_USER_INFO_21 to a SAM_ACCOUNT
+ Copies a SAM_USER_INFO_21 to a struct samu
**************************************************************/
-void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
+void copy_id21_to_sam_passwd(struct samu *to, SAM_USER_INFO_21 *from)
{
time_t unix_time, stored_time;
const char *old_string, *new_string;
@@ -312,10 +312,10 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
/*************************************************************
- Copies a SAM_USER_INFO_23 to a SAM_ACCOUNT
+ Copies a SAM_USER_INFO_23 to a struct samu
**************************************************************/
-void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
+void copy_id23_to_sam_passwd(struct samu *to, SAM_USER_INFO_23 *from)
{
time_t unix_time, stored_time;
const char *old_string, *new_string;
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index 8f3e7236c4..f8ae7233c6 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -55,7 +55,7 @@ static NTSTATUS check_oem_password(const char *user,
const uchar old_lm_hash_encrypted[16],
uchar password_encrypted_with_nt_hash[516],
const uchar old_nt_hash_encrypted[16],
- SAM_ACCOUNT **hnd, char *new_passwd,
+ struct samu **hnd, char *new_passwd,
int new_passwd_size);
#if ALLOW_CHANGE_PASSWORD
@@ -570,11 +570,11 @@ BOOL chgpasswd(const char *name, const struct passwd *pass,
************************************************************/
BOOL check_lanman_password(char *user, uchar * pass1,
- uchar * pass2, SAM_ACCOUNT **hnd)
+ uchar * pass2, struct samu **hnd)
{
uchar unenc_new_pw[16];
uchar unenc_old_pw[16];
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
uint16 acct_ctrl;
const uint8 *lanman_pw;
BOOL ret;
@@ -585,7 +585,7 @@ BOOL check_lanman_password(char *user, uchar * pass1,
if (ret == False) {
DEBUG(0,("check_lanman_password: getsampwnam returned NULL\n"));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return False;
}
@@ -594,7 +594,7 @@ BOOL check_lanman_password(char *user, uchar * pass1,
if (acct_ctrl & ACB_DISABLED) {
DEBUG(0,("check_lanman_password: account %s disabled.\n", user));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return False;
}
@@ -605,7 +605,7 @@ BOOL check_lanman_password(char *user, uchar * pass1,
return True;
} else {
DEBUG(0, ("check_lanman_password: no lanman password !\n"));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return False;
}
}
@@ -619,7 +619,7 @@ BOOL check_lanman_password(char *user, uchar * pass1,
/* Check that the two old passwords match. */
if (memcmp(lanman_pw, unenc_old_pw, 16)) {
DEBUG(0,("check_lanman_password: old password doesn't match.\n"));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return False;
}
@@ -636,7 +636,7 @@ BOOL check_lanman_password(char *user, uchar * pass1,
is correct before calling. JRA.
************************************************************/
-BOOL change_lanman_password(SAM_ACCOUNT *sampass, uchar *pass2)
+BOOL change_lanman_password(struct samu *sampass, uchar *pass2)
{
static uchar null_pw[16];
uchar unenc_new_pw[16];
@@ -684,7 +684,7 @@ BOOL change_lanman_password(SAM_ACCOUNT *sampass, uchar *pass2)
}
if (!pdb_set_pass_changed_now (sampass)) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
/* Not quite sure what this one qualifies as, but this will do */
return False;
}
@@ -707,7 +707,7 @@ NTSTATUS pass_oem_change(char *user,
uint32 *reject_reason)
{
pstring new_passwd;
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
NTSTATUS nt_status = check_oem_password(user, password_encrypted_with_lm_hash,
old_lm_hash_encrypted,
password_encrypted_with_nt_hash,
@@ -724,7 +724,7 @@ NTSTATUS pass_oem_change(char *user,
memset(new_passwd, 0, sizeof(new_passwd));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return nt_status;
}
@@ -746,12 +746,12 @@ static NTSTATUS check_oem_password(const char *user,
const uchar old_lm_hash_encrypted[16],
uchar password_encrypted_with_nt_hash[516],
const uchar old_nt_hash_encrypted[16],
- SAM_ACCOUNT **hnd, char *new_passwd,
+ struct samu **hnd, char *new_passwd,
int new_passwd_size)
{
static uchar null_pw[16];
static uchar null_ntpw[16];
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
uint8 *password_encrypted;
const uint8 *encryption_key;
const uint8 *lanman_pw, *nt_pw;
@@ -776,7 +776,7 @@ static NTSTATUS check_oem_password(const char *user,
if (ret == False) {
DEBUG(0, ("check_oem_password: getsmbpwnam returned NULL\n"));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_NO_SUCH_USER;
}
@@ -784,7 +784,7 @@ static NTSTATUS check_oem_password(const char *user,
if (acct_ctrl & ACB_DISABLED) {
DEBUG(2,("check_lanman_password: account %s disabled.\n", user));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_ACCOUNT_DISABLED;
}
@@ -819,7 +819,7 @@ static NTSTATUS check_oem_password(const char *user,
} else if (nt_pass_set) {
DEBUG(1, ("NT password change supplied for user %s, but we have no NT password to check it with\n",
user));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_WRONG_PASSWORD;
} else if (lm_pass_set) {
if (lp_lanman_auth()) {
@@ -829,12 +829,12 @@ static NTSTATUS check_oem_password(const char *user,
DEBUG(1, ("LM password change supplied for user %s, but we have disabled LanMan authentication\n",
user));
}
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_WRONG_PASSWORD;
} else {
DEBUG(1, ("password change requested for user %s, but no password supplied!\n",
user));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_WRONG_PASSWORD;
}
@@ -845,7 +845,7 @@ static NTSTATUS check_oem_password(const char *user,
if ( !decode_pw_buffer(password_encrypted, new_passwd, new_passwd_size, &new_pw_len,
nt_pass_set ? STR_UNICODE : STR_ASCII)) {
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_WRONG_PASSWORD;
}
@@ -868,7 +868,7 @@ static NTSTATUS check_oem_password(const char *user,
E_old_pw_hash(new_nt_hash, nt_pw, verifier);
if (memcmp(verifier, old_nt_hash_encrypted, 16)) {
DEBUG(0,("check_oem_password: old lm password doesn't match.\n"));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_WRONG_PASSWORD;
}
@@ -896,7 +896,7 @@ static NTSTATUS check_oem_password(const char *user,
E_old_pw_hash(new_nt_hash, lanman_pw, verifier);
if (memcmp(verifier, old_lm_hash_encrypted, 16)) {
DEBUG(0,("check_oem_password: old lm password doesn't match.\n"));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_WRONG_PASSWORD;
}
#ifdef DEBUG_PASSWORD
@@ -918,7 +918,7 @@ static NTSTATUS check_oem_password(const char *user,
E_old_pw_hash(new_lm_hash, lanman_pw, verifier);
if (memcmp(verifier, old_lm_hash_encrypted, 16)) {
DEBUG(0,("check_oem_password: old lm password doesn't match.\n"));
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_WRONG_PASSWORD;
}
@@ -931,7 +931,7 @@ static NTSTATUS check_oem_password(const char *user,
}
/* should not be reached */
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
return NT_STATUS_WRONG_PASSWORD;
}
@@ -941,7 +941,7 @@ static NTSTATUS check_oem_password(const char *user,
found in the history list.
************************************************************/
-static BOOL check_passwd_history(SAM_ACCOUNT *sampass, const char *plaintext)
+static BOOL check_passwd_history(struct samu *sampass, const char *plaintext)
{
uchar new_nt_p16[NT_HASH_LEN];
uchar zero_md5_nt_pw[SALTED_MD5_HASH_LEN];
@@ -1008,7 +1008,7 @@ static BOOL check_passwd_history(SAM_ACCOUNT *sampass, const char *plaintext)
is correct before calling. JRA.
************************************************************/
-NTSTATUS change_oem_password(SAM_ACCOUNT *hnd, char *old_passwd, char *new_passwd, BOOL as_root, uint32 *samr_reject_reason)
+NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passwd, BOOL as_root, uint32 *samr_reject_reason)
{
uint32 min_len, min_age;
struct passwd *pass = NULL;
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 3f10ba41b2..03f7f8e5c8 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -1920,7 +1920,7 @@ static BOOL api_NetUserGetGroups(connection_struct *conn,uint16 vuid, char *para
int uLevel = SVAL(p,0);
const char *level_string;
int count=0;
- SAM_ACCOUNT *sampw = NULL;
+ struct samu *sampw = NULL;
BOOL ret = False;
DOM_SID *sids;
gid_t *gids;
@@ -2235,7 +2235,7 @@ static BOOL api_SetUserPassword(connection_struct *conn,uint16 vuid, char *param
*/
if(SVAL(*rparam,0) != NERR_Success) {
- SAM_ACCOUNT *hnd = NULL;
+ struct samu *hnd = NULL;
if (check_lanman_password(user,(unsigned char *)pass1,(unsigned char *)pass2, &hnd)) {
become_root();
@@ -2243,7 +2243,7 @@ static BOOL api_SetUserPassword(connection_struct *conn,uint16 vuid, char *param
SSVAL(*rparam,0,NERR_Success);
}
unbecome_root();
- pdb_free_sam(&hnd);
+ TALLOC_FREE(hnd);
}
}
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index f8cd0e090d..d3b9a9a8a8 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -300,12 +300,12 @@ NTSTATUS rpc_samdump_internals(const DOM_SID *domain_sid,
return NT_STATUS_OK;
}
-/* Convert a SAM_ACCOUNT_DELTA to a SAM_ACCOUNT. */
+/* Convert a struct samu_DELTA to a struct samu. */
#define STRING_CHANGED (old_string && !new_string) ||\
(!old_string && new_string) ||\
(old_string && new_string && (strcmp(old_string, new_string) != 0))
-static NTSTATUS sam_account_from_delta(SAM_ACCOUNT *account, SAM_ACCOUNT_INFO *delta)
+static NTSTATUS sam_account_from_delta(struct samu *account, SAM_ACCOUNT_INFO *delta)
{
const char *old_string, *new_string;
time_t unix_time, stored_time;
@@ -497,7 +497,7 @@ static NTSTATUS fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta)
NTSTATUS nt_ret;
fstring account;
pstring add_script;
- SAM_ACCOUNT *sam_account=NULL;
+ struct samu *sam_account=NULL;
GROUP_MAP map;
struct group *grp;
DOM_SID user_sid;
@@ -562,7 +562,7 @@ static NTSTATUS fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta)
if (!NT_STATUS_IS_OK(pdb_update_sam_account(sam_account))) {
DEBUG(1, ("SAM Account for %s failed to be updated in the passdb!\n",
account));
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return NT_STATUS_ACCESS_DENIED;
}
}
@@ -589,7 +589,7 @@ static NTSTATUS fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta)
}
done:
- pdb_free_sam(&sam_account);
+ TALLOC_FREE(sam_account);
return nt_ret;
}
@@ -691,7 +691,7 @@ static NTSTATUS fetch_group_mem_info(uint32 rid, SAM_GROUP_MEM_INFO *delta)
for (i=0; i<delta->num_members; i++) {
NTSTATUS nt_status;
- SAM_ACCOUNT *member = NULL;
+ struct samu *member = NULL;
DOM_SID member_sid;
if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam_talloc(t, &member))) {
@@ -705,19 +705,19 @@ static NTSTATUS fetch_group_mem_info(uint32 rid, SAM_GROUP_MEM_INFO *delta)
if (!pdb_getsampwsid(member, &member_sid)) {
DEBUG(1, ("Found bogus group member: %d (member_sid=%s group=%s)\n",
delta->rids[i], sid_string_static(&member_sid), grp->gr_name));
- pdb_free_sam(&member);
+ TALLOC_FREE(member);
continue;
}
if (pdb_get_group_rid(member) == rid) {
d_printf("%s(primary),", pdb_get_username(member));
- pdb_free_sam(&member);
+ TALLOC_FREE(member);
continue;
}
d_printf("%s,", pdb_get_username(member));
nt_members[i] = talloc_strdup(t, pdb_get_username(member));
- pdb_free_sam(&member);
+ TALLOC_FREE(member);
}
d_printf("\n");
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c
index ba3ec5c57f..ae0aef5960 100644
--- a/source3/utils/net_sam.c
+++ b/source3/utils/net_sam.c
@@ -27,10 +27,10 @@
*/
static int net_sam_userset(int argc, const char **argv, const char *field,
- BOOL (*fn)(SAM_ACCOUNT *, const char *,
+ BOOL (*fn)(struct samu *, const char *,
enum pdb_value_state))
{
- SAM_ACCOUNT *sam_acct = NULL;
+ struct samu *sam_acct = NULL;
DOM_SID sid;
enum SID_NAME_USE type;
const char *dom, *name;
@@ -76,7 +76,7 @@ static int net_sam_userset(int argc, const char **argv, const char *field,
return -1;
}
- pdb_free_sam(&sam_acct);
+ TALLOC_FREE(sam_acct);
d_printf("Updated %s for %s\\%s to %s\n", field, dom, name, argv[1]);
return 0;
@@ -125,7 +125,7 @@ static int net_sam_set_workstations(int argc, const char **argv)
static int net_sam_set_userflag(int argc, const char **argv, const char *field,
uint16 flag)
{
- SAM_ACCOUNT *sam_acct = NULL;
+ struct samu *sam_acct = NULL;
DOM_SID sid;
enum SID_NAME_USE type;
const char *dom, *name;
@@ -178,7 +178,7 @@ static int net_sam_set_userflag(int argc, const char **argv, const char *field,
return -1;
}
- pdb_free_sam(&sam_acct);
+ TALLOC_FREE(sam_acct);
d_fprintf(stderr, "Updated flag %s for %s\\%s to %s\n", field, dom,
name, argv[1]);
@@ -210,10 +210,10 @@ static int net_sam_set_pwnoexp(int argc, const char **argv)
*/
static int net_sam_set_time(int argc, const char **argv, const char *field,
- BOOL (*fn)(SAM_ACCOUNT *, time_t,
+ BOOL (*fn)(struct samu *, time_t,
enum pdb_value_state))
{
- SAM_ACCOUNT *sam_acct = NULL;
+ struct samu *sam_acct = NULL;
DOM_SID sid;
enum SID_NAME_USE type;
const char *dom, *name;
@@ -276,7 +276,7 @@ static int net_sam_set_time(int argc, const char **argv, const char *field,
return -1;
}
- pdb_free_sam(&sam_acct);
+ TALLOC_FREE(sam_acct);
d_printf("Updated %s for %s\\%s to %s\n", field, dom, name, argv[1]);
return 0;
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 2e7fbc1812..d517783e85 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -86,7 +86,7 @@ static int reinit_account_policies (void)
Print info from sam structure
**********************************************************/
-static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdstyle)
+static int print_sam_info (struct samu *sam_pwent, BOOL verbosity, BOOL smbpwdstyle)
{
uid_t uid;
time_t tmp;
@@ -172,7 +172,7 @@ static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdst
static int print_user_info (struct pdb_methods *in, const char *username, BOOL verbosity, BOOL smbpwdstyle)
{
- SAM_ACCOUNT *sam_pwent=NULL;
+ struct samu *sam_pwent=NULL;
BOOL ret;
if (!NT_STATUS_IS_OK(pdb_init_sam (&sam_pwent))) {
@@ -183,12 +183,12 @@ static int print_user_info (struct pdb_methods *in, const char *username, BOOL v
if (ret==False) {
fprintf (stderr, "Username not found!\n");
- pdb_free_sam(&sam_pwent);
+ TALLOC_FREE(sam_pwent);
return -1;
}
ret=print_sam_info (sam_pwent, verbosity, smbpwdstyle);
- pdb_free_sam(&sam_pwent);
+ TALLOC_FREE(sam_pwent);
return ret;
}
@@ -198,7 +198,7 @@ static int print_user_info (struct pdb_methods *in, const char *username, BOOL v
**********************************************************/
static int print_users_list (struct pdb_methods *in, BOOL verbosity, BOOL smbpwdstyle)
{
- SAM_ACCOUNT *sam_pwent=NULL;
+ struct samu *sam_pwent=NULL;
BOOL check;
check = NT_STATUS_IS_OK(in->setsampwent(in, False, 0));
@@ -213,10 +213,10 @@ static int print_users_list (struct pdb_methods *in, BOOL verbosity, BOOL smbpwd
if (verbosity)
printf ("---------------\n");
print_sam_info (sam_pwent, verbosity, smbpwdstyle);
- pdb_free_sam(&sam_pwent);
+ TALLOC_FREE(sam_pwent);
check = NT_STATUS_IS_OK(pdb_init_sam(&sam_pwent));
}
- if (check) pdb_free_sam(&sam_pwent);
+ if (check) TALLOC_FREE(sam_pwent);
in->endsampwent(in);
return 0;
@@ -227,7 +227,7 @@ static int print_users_list (struct pdb_methods *in, BOOL verbosity, BOOL smbpwd
**********************************************************/
static int fix_users_list (struct pdb_methods *in)
{
- SAM_ACCOUNT *sam_pwent=NULL;
+ struct samu *sam_pwent=NULL;
BOOL check;
check = NT_STATUS_IS_OK(in->setsampwent(in, False, 0));
@@ -244,14 +244,14 @@ static int fix_users_list (struct pdb_methods *in)
if (!NT_STATUS_IS_OK(pdb_update_sam_account(sam_pwent))) {
printf("Update of user %s failed!\n", pdb_get_username(sam_pwent));
}
- pdb_free_sam(&sam_pwent);
+ TALLOC_FREE(sam_pwent);
check = NT_STATUS_IS_OK(pdb_init_sam(&sam_pwent));
if (!check) {
- fprintf(stderr, "Failed to initialise new SAM_ACCOUNT structure (out of memory?)\n");
+ fprintf(stderr, "Failed to initialise new struct samu structure (out of memory?)\n");
}
}
- if (check) pdb_free_sam(&sam_pwent);
+ if (check) TALLOC_FREE(sam_pwent);
in->endsampwent(in);
return 0;
@@ -272,7 +272,7 @@ static int set_user_info (struct pdb_methods *in, const char *username,
time_t pwd_can_change, time_t pwd_must_change)
{
BOOL updated_autolock = False, updated_badpw = False;
- SAM_ACCOUNT *sam_pwent=NULL;
+ struct samu *sam_pwent=NULL;
BOOL ret;
pdb_init_sam(&sam_pwent);
@@ -280,7 +280,7 @@ static int set_user_info (struct pdb_methods *in, const char *username,
ret = NT_STATUS_IS_OK(in->getsampwnam (in, sam_pwent, username));
if (ret==False) {
fprintf (stderr, "Username not found!\n");
- pdb_free_sam(&sam_pwent);
+ TALLOC_FREE(sam_pwent);
return -1;
}
@@ -333,7 +333,7 @@ static int set_user_info (struct pdb_methods *in, const char *username,
if (newflag & not_settable) {
fprintf(stderr, "Can only set [NDHLX] flags\n");
- pdb_free_sam(&sam_pwent);
+ TALLOC_FREE(sam_pwent);
return -1;
}
@@ -381,10 +381,10 @@ static int set_user_info (struct pdb_methods *in, const char *username,
print_user_info (in, username, True, False);
else {
fprintf (stderr, "Unable to modify entry!\n");
- pdb_free_sam(&sam_pwent);
+ TALLOC_FREE(sam_pwent);
return -1;
}
- pdb_free_sam(&sam_pwent);
+ TALLOC_FREE(sam_pwent);
return 0;
}
@@ -397,7 +397,7 @@ static int new_user (struct pdb_methods *in, const char *username,
const char *profile, char *user_sid, char *group_sid,
BOOL stdin_get)
{
- SAM_ACCOUNT *sam_pwent=NULL;
+ struct samu *sam_pwent=NULL;
char *password1, *password2;
int rc_pwd_cmp;
@@ -413,7 +413,7 @@ static int new_user (struct pdb_methods *in, const char *username,
password2 = get_pass( "retype new password:", stdin_get);
if ((rc_pwd_cmp = strcmp (password1, password2))) {
fprintf (stderr, "Passwords do not match!\n");
- pdb_free_sam (&sam_pwent);
+ TALLOC_FREE(sam_pwent);
} else {
pdb_set_plaintext_passwd(sam_pwent, password1);
}
@@ -474,10 +474,10 @@ static int new_user (struct pdb_methods *in, const char *username,
print_user_info (in, username, True, False);
} else {
fprintf (stderr, "Unable to add user! (does it already exist?)\n");
- pdb_free_sam (&sam_pwent);
+ TALLOC_FREE(sam_pwent);
return -1;
}
- pdb_free_sam (&sam_pwent);
+ TALLOC_FREE(sam_pwent);
return 0;
}
@@ -487,7 +487,7 @@ static int new_user (struct pdb_methods *in, const char *username,
static int new_machine (struct pdb_methods *in, const char *machine_in)
{
- SAM_ACCOUNT *sam_pwent=NULL;
+ struct samu *sam_pwent=NULL;
fstring machinename;
fstring machineaccount;
struct passwd *pwd = NULL;
@@ -531,10 +531,10 @@ static int new_machine (struct pdb_methods *in, const char *machine_in)
print_user_info (in, machineaccount, True, False);
} else {
fprintf (stderr, "Unable to add machine! (does it already exist?)\n");
- pdb_free_sam (&sam_pwent);
+ TALLOC_FREE(sam_pwent);
return -1;
}
- pdb_free_sam (&sam_pwent);
+ TALLOC_FREE(sam_pwent);
return 0;
}
@@ -544,7 +544,7 @@ static int new_machine (struct pdb_methods *in, const char *machine_in)
static int delete_user_entry (struct pdb_methods *in, const char *username)
{
- SAM_ACCOUNT *samaccount = NULL;
+ struct samu *samaccount = NULL;
if (!NT_STATUS_IS_OK(pdb_init_sam (&samaccount))) {
return -1;
@@ -569,7 +569,7 @@ static int delete_user_entry (struct pdb_methods *in, const char *username)
static int delete_machine_entry (struct pdb_methods *in, const char *machinename)
{
fstring name;
- SAM_ACCOUNT *samaccount = NULL;
+ struct samu *samaccount = NULL;
fstrcpy(name, machinename);
name[15] = '\0';
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index a42361780e..61e97fd692 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -401,7 +401,7 @@ static int process_root(int local_flags)
*/
if(local_flags & LOCAL_ENABLE_USER) {
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
BOOL ret;
pdb_init_sam(&sampass);
@@ -410,7 +410,7 @@ static int process_root(int local_flags)
(pdb_get_lanman_passwd(sampass) == NULL)) {
local_flags |= LOCAL_SET_PASSWORD;
}
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
}
}
@@ -435,7 +435,7 @@ static int process_root(int local_flags)
if(remote_machine) {
printf("Password changed for user %s on %s.\n", user_name, remote_machine );
} else if(!(local_flags & (LOCAL_ADD_USER|LOCAL_DISABLE_USER|LOCAL_ENABLE_USER|LOCAL_DELETE_USER|LOCAL_SET_NO_PASSWORD|LOCAL_SET_PASSWORD))) {
- SAM_ACCOUNT *sampass = NULL;
+ struct samu *sampass = NULL;
BOOL ret;
pdb_init_sam(&sampass);
@@ -447,7 +447,7 @@ static int process_root(int local_flags)
if((ret != False) && (pdb_get_acct_ctrl(sampass) & ACB_PWNOTREQ) )
printf(" User has no password flag set.");
printf("\n");
- pdb_free_sam(&sampass);
+ TALLOC_FREE(sampass);
}
done: