summaryrefslogtreecommitdiff
path: root/source3/sam
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2002-08-29 07:19:05 +0000
committerJelmer Vernooij <jelmer@samba.org>2002-08-29 07:19:05 +0000
commitfe518a828b36a505772682e4d125cc5559dbeef6 (patch)
treeba92cfbef7d809b59ef86367947a9754642c4e6d /source3/sam
parent790b85f5e21b3dafe5dc3e7835e8f14dfd498462 (diff)
downloadsamba-fe518a828b36a505772682e4d125cc5559dbeef6.tar.gz
samba-fe518a828b36a505772682e4d125cc5559dbeef6.tar.bz2
samba-fe518a828b36a505772682e4d125cc5559dbeef6.zip
Put in patch from metze (Stefan Metzmacher) to:
- Rename user -> account - Add sam_* functions (api.c) - Several small fixes (This used to be commit eafcc387045f4f265631a952297caf3f6db779d8)
Diffstat (limited to 'source3/sam')
-rw-r--r--source3/sam/account.c104
-rw-r--r--source3/sam/api.c311
-rw-r--r--source3/sam/get_set_account.c (renamed from source3/sam/get_set_user.c)257
-rw-r--r--source3/sam/get_set_domain.c45
-rw-r--r--source3/sam/get_set_group.c2
-rw-r--r--source3/sam/interface.c345
6 files changed, 692 insertions, 372 deletions
diff --git a/source3/sam/account.c b/source3/sam/account.c
index 04be8ef162..4d6916c9d8 100644
--- a/source3/sam/account.c
+++ b/source3/sam/account.c
@@ -27,65 +27,70 @@
#define DBGC_CLASS DBGC_SAM
/************************************************************
- Fill the SAM_USER_HANDLE with default values.
+ Fill the SAM_ACCOUNT_HANDLE with default values.
***********************************************************/
-static void sam_fill_default_user(SAM_USER_HANDLE *user)
+static void sam_fill_default_account(SAM_ACCOUNT_HANDLE *account)
{
- ZERO_STRUCT(user->private); /* Don't touch the talloc context */
+ ZERO_STRUCT(account->private); /* Don't touch the talloc context */
/* Don't change these timestamp settings without a good reason.
They are important for NT member server compatibility. */
- user->private.init_flag = FLAG_SAM_UNINIT;
+ account->private.init_flag = FLAG_SAM_UNINIT;
/* FIXME: We should actually call get_nt_time_max() or sthng
* here */
- unix_to_nt_time(&(user->private.logoff_time),get_time_t_max());
- unix_to_nt_time(&(user->private.kickoff_time),get_time_t_max());
- unix_to_nt_time(&(user->private.pass_must_change_time),get_time_t_max());
- user->private.unknown_1 = 0x00ffffff; /* don't know */
- user->private.logon_divs = 168; /* hours per week */
- user->private.hours_len = 21; /* 21 times 8 bits = 168 */
- memset(user->private.hours, 0xff, user->private.hours_len); /* available at all hours */
- user->private.unknown_2 = 0x00000000; /* don't know */
- user->private.unknown_3 = 0x000004ec; /* don't know */
+ unix_to_nt_time(&(account->private.logoff_time),get_time_t_max());
+ unix_to_nt_time(&(account->private.kickoff_time),get_time_t_max());
+ unix_to_nt_time(&(account->private.pass_must_change_time),get_time_t_max());
+ account->private.unknown_1 = 0x00ffffff; /* don't know */
+ account->private.logon_divs = 168; /* hours per week */
+ account->private.hours_len = 21; /* 21 times 8 bits = 168 */
+ memset(account->private.hours, 0xff, account->private.hours_len); /* available at all hours */
+ account->private.unknown_2 = 0x00000000; /* don't know */
+ account->private.unknown_3 = 0x000004ec; /* don't know */
}
-static void destroy_sam_talloc(SAM_USER_HANDLE **user)
+static void destroy_sam_talloc(SAM_ACCOUNT_HANDLE **account)
{
- if (*user) {
- talloc_destroy((*user)->mem_ctx);
- *user = NULL;
+ if (*account) {
+ data_blob_clear_free(&((*account)->private.lm_pw));
+ data_blob_clear_free(&((*account)->private.nt_pw));
+ if((*account)->private.plaintext_pw!=NULL)
+ memset((*account)->private.plaintext_pw,'\0',strlen((*account)->private.plaintext_pw));
+
+ talloc_destroy((*account)->mem_ctx);
+ *account = NULL;
}
}
/**********************************************************************
- Alloc memory and initialises a SAM_USER_HANDLE on supplied mem_ctx.
+ Alloc memory and initialises a SAM_ACCOUNT_HANDLE on supplied mem_ctx.
***********************************************************************/
-NTSTATUS sam_init_user_talloc(TALLOC_CTX *mem_ctx, SAM_USER_HANDLE **user)
+NTSTATUS sam_init_account_talloc(TALLOC_CTX *mem_ctx, SAM_ACCOUNT_HANDLE **account)
{
- SMB_ASSERT(*user != NULL);
+ SMB_ASSERT(*account != NULL);
if (!mem_ctx) {
- DEBUG(0,("sam_init_user_talloc: mem_ctx was NULL!\n"));
+ DEBUG(0,("sam_init_account_talloc: mem_ctx was NULL!\n"));
return NT_STATUS_UNSUCCESSFUL;
}
- *user=(SAM_USER_HANDLE *)talloc(mem_ctx, sizeof(SAM_USER_HANDLE));
+ *account=(SAM_ACCOUNT_HANDLE *)talloc(mem_ctx, sizeof(SAM_ACCOUNT_HANDLE));
- if (*user==NULL) {
- DEBUG(0,("sam_init_user_talloc: error while allocating memory\n"));
+ if (*account==NULL) {
+ DEBUG(0,("sam_init_account_talloc: error while allocating memory\n"));
return NT_STATUS_NO_MEMORY;
}
- (*user)->mem_ctx = mem_ctx;
+ (*account)->mem_ctx = mem_ctx;
- (*user)->free_fn = NULL;
+ (*account)->free_fn = NULL;
- sam_fill_default_user(*user);
+ sam_fill_default_account(*account);
return NT_STATUS_OK;
}
@@ -95,77 +100,78 @@ NTSTATUS sam_init_user_talloc(TALLOC_CTX *mem_ctx, SAM_USER_HANDLE **user)
Alloc memory and initialises a struct sam_passwd.
************************************************************/
-NTSTATUS sam_init_user(SAM_USER_HANDLE **user)
+NTSTATUS sam_init_account(SAM_ACCOUNT_HANDLE **account)
{
TALLOC_CTX *mem_ctx;
NTSTATUS nt_status;
- mem_ctx = talloc_init_named("passdb internal SAM_USER_HANDLE allocation");
+ mem_ctx = talloc_init_named("passdb internal SAM_ACCOUNT_HANDLE allocation");
if (!mem_ctx) {
- DEBUG(0,("sam_init_user: error while doing talloc_init()\n"));
+ DEBUG(0,("sam_init_account: error while doing talloc_init()\n"));
return NT_STATUS_NO_MEMORY;
}
- if (!NT_STATUS_IS_OK(nt_status = sam_init_user_talloc(mem_ctx, user))) {
+ if (!NT_STATUS_IS_OK(nt_status = sam_init_account_talloc(mem_ctx, account))) {
talloc_destroy(mem_ctx);
return nt_status;
}
- (*user)->free_fn = destroy_sam_talloc;
+ (*account)->free_fn = destroy_sam_talloc;
return NT_STATUS_OK;
}
/**
- * Free the contents of the SAM_USER_HANDLE, but not the structure.
+ * Free the contents of the SAM_ACCOUNT_HANDLE, but not the structure.
*
* Also wipes the LM and NT hashes and plaintext password from
* memory.
*
- * @param user SAM_USER_HANDLE to free members of.
+ * @param account SAM_ACCOUNT_HANDLE to free members of.
**/
-static void sam_free_user_contents(SAM_USER_HANDLE *user)
+static void sam_free_account_contents(SAM_ACCOUNT_HANDLE *account)
{
/* Kill off sensitive data. Free()ed by the
talloc mechinism */
- data_blob_clear_free(&(user->private.lm_pw));
- data_blob_clear_free(&(user->private.nt_pw));
- data_blob_clear_free(&(user->private.plaintext_pw));
+ data_blob_clear_free(&(account->private.lm_pw));
+ data_blob_clear_free(&(account->private.nt_pw));
+ if (account->private.plaintext_pw)
+ memset(account->private.plaintext_pw,'\0',strlen(account->private.plaintext_pw));
}
/************************************************************
- Reset the SAM_USER_HANDLE and free the NT/LM hashes.
+ Reset the SAM_ACCOUNT_HANDLE and free the NT/LM hashes.
***********************************************************/
-NTSTATUS sam_reset_sam(SAM_USER_HANDLE *user)
+NTSTATUS sam_reset_sam(SAM_ACCOUNT_HANDLE *account)
{
- SMB_ASSERT(user != NULL);
+ SMB_ASSERT(account != NULL);
- sam_free_user_contents(user);
+ sam_free_account_contents(account);
- sam_fill_default_user(user);
+ sam_fill_default_account(account);
return NT_STATUS_OK;
}
/************************************************************
- Free the SAM_USER_HANDLE and the member pointers.
+ Free the SAM_ACCOUNT_HANDLE and the member pointers.
***********************************************************/
-NTSTATUS sam_free_user(SAM_USER_HANDLE **user)
+NTSTATUS sam_free_account(SAM_ACCOUNT_HANDLE **account)
{
- SMB_ASSERT(*user != NULL);
+ SMB_ASSERT(*account != NULL);
- sam_free_user_contents(*user);
+ sam_free_account_contents(*account);
- if ((*user)->free_fn) {
- (*user)->free_fn(user);
+ if ((*account)->free_fn) {
+ (*account)->free_fn(account);
}
return NT_STATUS_OK;
diff --git a/source3/sam/api.c b/source3/sam/api.c
new file mode 100644
index 0000000000..a941dcb0b9
--- /dev/null
+++ b/source3/sam/api.c
@@ -0,0 +1,311 @@
+/*
+ Unix SMB/CIFS implementation.
+ SAM interface API.
+
+ Copyright (C) Stefan (metze) Metzmacher 2002
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_SAM
+
+/* this function should be used by the rest of SAMBA --metze */
+
+/* General API */
+
+NTSTATUS sam_get_sec_desc(const NT_USER_TOKEN *access_token, const DOM_SID *sid, SEC_DESC **sd)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_get_sec_desc(sam_context, access_token, sid, sd);
+}
+
+NTSTATUS sam_set_sec_desc(const NT_USER_TOKEN *access_token, const DOM_SID *sid, const SEC_DESC *sd)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_set_sec_desc(sam_context, access_token, sid, sd);
+}
+
+NTSTATUS sam_lookup_sid(const NT_USER_TOKEN *access_token, const DOM_SID *sid, char **name, uint32 *type)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_lookup_sid(sam_context, access_token, sid, name, type);
+}
+
+NTSTATUS sam_lookup_name(const NT_USER_TOKEN *access_token, const char *domain, const char *name, DOM_SID **sid, uint32 *type)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_lookup_name(sam_context, access_token, domain, name, sid, type);
+}
+
+/* Domain API */
+
+NTSTATUS sam_update_domain(const SAM_DOMAIN_HANDLE *domain)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_update_domain(sam_context, domain);
+}
+
+NTSTATUS sam_enum_domains(const NT_USER_TOKEN *access_token, int32 *domain_count, DOM_SID **domains, char **domain_names)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_enum_domains(sam_context, access_token, domain_count, domains, domain_names);
+}
+
+NTSTATUS sam_lookup_domain(const NT_USER_TOKEN * access_token, const char *domain, DOM_SID **domainsid)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_lookup_domain(sam_context, access_token, domain, domainsid);
+}
+
+NTSTATUS sam_get_domain_by_sid(const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *domainsid, SAM_DOMAIN_HANDLE **domain)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_get_domain_by_sid(sam_context, access_token, access_desired, domainsid, domain);
+}
+
+/* Account API */
+
+NTSTATUS sam_create_account(const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *domainsid, SAM_ACCOUNT_HANDLE **account)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_create_account(sam_context, access_token, access_desired, domainsid, account);
+}
+
+NTSTATUS sam_add_account(const DOM_SID *domainsid, const SAM_ACCOUNT_HANDLE *account)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_add_account(sam_context, domainsid, account);
+}
+
+NTSTATUS sam_update_account(const SAM_ACCOUNT_HANDLE *account)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_update_account(sam_context, account);
+}
+
+NTSTATUS sam_delete_account(const SAM_ACCOUNT_HANDLE *account)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_delete_account(sam_context, account);
+}
+
+NTSTATUS sam_enum_accounts(const NT_USER_TOKEN *access_token, const DOM_SID *domain, int32 *account_count, SAM_ACCOUNT_ENUM **accounts)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_enum_accounts(sam_context, access_token, domain, account_count, accounts);
+}
+
+NTSTATUS sam_get_account_by_sid(const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *accountsid, SAM_ACCOUNT_HANDLE **account)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_get_account_by_sid(sam_context, access_token, access_desired, accountsid, account);
+}
+
+NTSTATUS sam_get_account_by_name(const NT_USER_TOKEN *access_token, const uint32 access_desired, const char *domain, const char *name, SAM_ACCOUNT_HANDLE **account)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_get_account_by_name(sam_context, access_token, access_desired, domain, name, account);
+}
+
+/* Group API */
+
+NTSTATUS sam_add_group(const DOM_SID *domainsid, const SAM_GROUP_HANDLE *group)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_add_group(sam_context, domainsid, group);
+}
+
+NTSTATUS sam_update_group(const SAM_GROUP_HANDLE *group)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_update_group(sam_context, group);
+}
+
+NTSTATUS sam_delete_group(const SAM_GROUP_HANDLE *group)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_delete_group(sam_context, group);
+}
+
+NTSTATUS sam_enum_groups(const NT_USER_TOKEN *access_token, const DOM_SID *domainsid, const uint32 type, uint32 *groups_count, SAM_GROUP_ENUM **groups)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_enum_groups(sam_context, access_token, domainsid, type, groups_count, groups);
+}
+
+NTSTATUS sam_get_group_by_sid(const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *groupsid, SAM_GROUP_HANDLE **group)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_get_group_by_sid(sam_context, access_token, access_desired, groupsid, group);
+}
+
+NTSTATUS sam_get_group_by_name(const NT_USER_TOKEN *access_token, const uint32 access_desired, const char *domain, const char *name, SAM_GROUP_HANDLE **group)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_get_group_by_name(sam_context, access_token, access_desired, domain, name, group);
+}
+
+NTSTATUS sam_add_member_to_group(const SAM_GROUP_HANDLE *group, const SAM_GROUP_MEMBER *member)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_add_member_to_group(sam_context, group, member);
+}
+
+NTSTATUS sam_delete_member_from_group(const SAM_GROUP_HANDLE *group, const SAM_GROUP_MEMBER *member)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_delete_member_from_group(sam_context, group, member);
+}
+
+NTSTATUS sam_enum_groupmembers(const SAM_GROUP_HANDLE *group, uint32 *members_count, SAM_GROUP_MEMBER **members)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_enum_groupmembers(sam_context, group, members_count, members);
+}
+
+NTSTATUS sam_get_groups_of_account(const SAM_ACCOUNT_HANDLE *account, const uint32 type, uint32 *group_count, SAM_GROUP_ENUM **groups)
+{
+ SAM_CONTEXT *sam_context = sam_get_static_context(False);
+
+ if (!sam_context) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return sam_context->sam_get_groups_of_account(sam_context, account, type, group_count, groups);
+}
+
diff --git a/source3/sam/get_set_user.c b/source3/sam/get_set_account.c
index 753567ac06..b0104fa1c3 100644
--- a/source3/sam/get_set_user.c
+++ b/source3/sam/get_set_account.c
@@ -1,8 +1,8 @@
/*
Unix SMB/CIFS implementation.
- SAM_USER_HANDLE access routines
+ SAM_ACCOUNT_HANDLE access routines
Copyright (C) Andrew Bartlett 2002
- Copyright (C) Stefan (metze) Metzmacher 2002
+ Copyright (C) Stefan (metze) Metzmacher 2002
Copyright (C) Jelmer Vernooij 2002
This program is free software; you can redistribute it and/or modify
@@ -25,35 +25,35 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_SAM
-NTSTATUS sam_get_user_domain_sid (const SAM_USER_HANDLE *sampass, DOM_SID **sid)
+NTSTATUS sam_get_account_domain_sid(const SAM_ACCOUNT_HANDLE *sampass, DOM_SID **sid)
{
NTSTATUS status;
SAM_DOMAIN_HANDLE *domain;
if (!sampass || !sid) return NT_STATUS_UNSUCCESSFUL;
- if (!NT_STATUS_IS_OK(status = sam_get_user_domain(sampass, &domain))){
- DEBUG(0, ("sam_get_user_domain_sid: Can't get domain for user\n"));
+ if (!NT_STATUS_IS_OK(status = sam_get_account_domain(sampass, &domain))){
+ DEBUG(0, ("sam_get_account_domain_sid: Can't get domain for account\n"));
return status;
}
return sam_get_domain_sid(domain, sid);
}
-NTSTATUS sam_get_user_domain_name (const SAM_USER_HANDLE *sampass, char **domain_name)
+NTSTATUS sam_get_account_domain_name(const SAM_ACCOUNT_HANDLE *sampass, char **domain_name)
{
NTSTATUS status;
SAM_DOMAIN_HANDLE *domain;
if (!sampass || !domain_name) return NT_STATUS_UNSUCCESSFUL;
- if (!NT_STATUS_IS_OK(status = sam_get_user_domain(sampass, &domain))){
- DEBUG(0, ("sam_get_user_domain_name: Can't get domain for user\n"));
+ if (!NT_STATUS_IS_OK(status = sam_get_account_domain(sampass, &domain))){
+ DEBUG(0, ("sam_get_account_domain_name: Can't get domain for account\n"));
return status;
}
return sam_get_domain_name(domain, domain_name);
}
-NTSTATUS sam_get_user_acct_ctrl (const SAM_USER_HANDLE *sampass, uint16 *acct_ctrl)
+NTSTATUS sam_get_account_acct_ctrl(const SAM_ACCOUNT_HANDLE *sampass, uint16 *acct_ctrl)
{
if(!sampass || !acct_ctrl) return NT_STATUS_UNSUCCESSFUL;
@@ -62,7 +62,7 @@ NTSTATUS sam_get_user_acct_ctrl (const SAM_USER_HANDLE *sampass, uint16 *acct_ct
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_logon_time (const SAM_USER_HANDLE *sampass, NTTIME *logon_time)
+NTSTATUS sam_get_account_logon_time(const SAM_ACCOUNT_HANDLE *sampass, NTTIME *logon_time)
{
if(!sampass || !logon_time) return NT_STATUS_UNSUCCESSFUL;
@@ -71,7 +71,7 @@ NTSTATUS sam_get_user_logon_time (const SAM_USER_HANDLE *sampass, NTTIME *logon_
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_logoff_time (const SAM_USER_HANDLE *sampass, NTTIME *logoff_time)
+NTSTATUS sam_get_account_logoff_time(const SAM_ACCOUNT_HANDLE *sampass, NTTIME *logoff_time)
{
if(!sampass || !logoff_time) return NT_STATUS_UNSUCCESSFUL;
@@ -80,7 +80,7 @@ NTSTATUS sam_get_user_logoff_time (const SAM_USER_HANDLE *sampass, NTTIME *logof
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_kickoff_time (const SAM_USER_HANDLE *sampass, NTTIME *kickoff_time)
+NTSTATUS sam_get_account_kickoff_time(const SAM_ACCOUNT_HANDLE *sampass, NTTIME *kickoff_time)
{
if (!sampass || !kickoff_time) return NT_STATUS_UNSUCCESSFUL;
@@ -89,7 +89,7 @@ NTSTATUS sam_get_user_kickoff_time (const SAM_USER_HANDLE *sampass, NTTIME *kick
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_pass_last_set_time (const SAM_USER_HANDLE *sampass, NTTIME *pass_last_set_time)
+NTSTATUS sam_get_account_pass_last_set_time(const SAM_ACCOUNT_HANDLE *sampass, NTTIME *pass_last_set_time)
{
if (!sampass || !pass_last_set_time) return NT_STATUS_UNSUCCESSFUL;
@@ -98,7 +98,7 @@ NTSTATUS sam_get_user_pass_last_set_time (const SAM_USER_HANDLE *sampass, NTTIME
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_pass_can_change_time (const SAM_USER_HANDLE *sampass, NTTIME *pass_can_change_time)
+NTSTATUS sam_get_account_pass_can_change_time(const SAM_ACCOUNT_HANDLE *sampass, NTTIME *pass_can_change_time)
{
if (!sampass || !pass_can_change_time) return NT_STATUS_UNSUCCESSFUL;
@@ -107,7 +107,7 @@ NTSTATUS sam_get_user_pass_can_change_time (const SAM_USER_HANDLE *sampass, NTTI
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_pass_must_change_time (const SAM_USER_HANDLE *sampass, NTTIME *pass_must_change_time)
+NTSTATUS sam_get_account_pass_must_change_time(const SAM_ACCOUNT_HANDLE *sampass, NTTIME *pass_must_change_time)
{
if (!sampass || !pass_must_change_time) return NT_STATUS_UNSUCCESSFUL;
@@ -116,7 +116,7 @@ NTSTATUS sam_get_user_pass_must_change_time (const SAM_USER_HANDLE *sampass, NTT
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_logon_divs (const SAM_USER_HANDLE *sampass, uint16 *logon_divs)
+NTSTATUS sam_get_account_logon_divs(const SAM_ACCOUNT_HANDLE *sampass, uint16 *logon_divs)
{
if (!sampass || !logon_divs) return NT_STATUS_UNSUCCESSFUL;
@@ -125,7 +125,7 @@ NTSTATUS sam_get_user_logon_divs (const SAM_USER_HANDLE *sampass, uint16 *logon_
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_hours_len (const SAM_USER_HANDLE *sampass, uint32 *hours_len)
+NTSTATUS sam_get_account_hours_len(const SAM_ACCOUNT_HANDLE *sampass, uint32 *hours_len)
{
if (!sampass || !hours_len) return NT_STATUS_UNSUCCESSFUL;
@@ -134,7 +134,7 @@ NTSTATUS sam_get_user_hours_len (const SAM_USER_HANDLE *sampass, uint32 *hours_l
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_hours (const SAM_USER_HANDLE *sampass, uint8 **hours)
+NTSTATUS sam_get_account_hours(const SAM_ACCOUNT_HANDLE *sampass, uint8 **hours)
{
if (!sampass || !hours) return NT_STATUS_UNSUCCESSFUL;
@@ -143,7 +143,7 @@ NTSTATUS sam_get_user_hours (const SAM_USER_HANDLE *sampass, uint8 **hours)
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_nt_pwd (const SAM_USER_HANDLE *sampass, DATA_BLOB *nt_pwd)
+NTSTATUS sam_get_account_nt_pwd(const SAM_ACCOUNT_HANDLE *sampass, DATA_BLOB *nt_pwd)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -155,7 +155,7 @@ NTSTATUS sam_get_user_nt_pwd (const SAM_USER_HANDLE *sampass, DATA_BLOB *nt_pwd)
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_lm_pwd (const SAM_USER_HANDLE *sampass, DATA_BLOB *lm_pwd)
+NTSTATUS sam_get_account_lm_pwd(const SAM_ACCOUNT_HANDLE *sampass, DATA_BLOB *lm_pwd)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -174,25 +174,25 @@ NTSTATUS sam_get_user_lm_pwd (const SAM_USER_HANDLE *sampass, DATA_BLOB *lm_pwd)
want to store more than just the NTLM hashes.
*/
-NTSTATUS sam_get_user_plaintext_pwd (const SAM_USER_HANDLE *sampass, DATA_BLOB **plain_pwd)
+NTSTATUS sam_get_account_plaintext_pwd(const SAM_ACCOUNT_HANDLE *sampass, char **plain_pwd)
{
if (!sampass || !plain_pwd) return NT_STATUS_UNSUCCESSFUL;
- *plain_pwd = &(sampass->private.plaintext_pw);
+ *plain_pwd = sampass->private.plaintext_pw;
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_sid(const SAM_USER_HANDLE *sampass, DOM_SID **sid)
+NTSTATUS sam_get_account_sid(const SAM_ACCOUNT_HANDLE *sampass, DOM_SID **sid)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
- *sid = &(sampass->private.user_sid);
+ *sid = &(sampass->private.account_sid);
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_pgroup(const SAM_USER_HANDLE *sampass, DOM_SID **sid)
+NTSTATUS sam_get_account_pgroup(const SAM_ACCOUNT_HANDLE *sampass, DOM_SID **sid)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -202,12 +202,12 @@ NTSTATUS sam_get_user_pgroup(const SAM_USER_HANDLE *sampass, DOM_SID **sid)
}
/**
- * Get flags showing what is initalised in the SAM_USER_HANDLE
- * @param sampass the SAM_USER_HANDLE in question
+ * Get flags showing what is initalised in the SAM_ACCOUNT_HANDLE
+ * @param sampass the SAM_ACCOUNT_HANDLE in question
* @return the flags indicating the members initialised in the struct.
**/
-NTSTATUS sam_get_user_init_flag (const SAM_USER_HANDLE *sampass, uint32 *initflag)
+NTSTATUS sam_get_account_init_flag(const SAM_ACCOUNT_HANDLE *sampass, uint32 *initflag)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -216,16 +216,16 @@ NTSTATUS sam_get_user_init_flag (const SAM_USER_HANDLE *sampass, uint32 *initfla
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_name (const SAM_USER_HANDLE *sampass, char **username)
+NTSTATUS sam_get_account_name(const SAM_ACCOUNT_HANDLE *sampass, char **account_name)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
- *username = sampass->private.username;
+ *account_name = sampass->private.account_name;
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_domain (const SAM_USER_HANDLE *sampass, SAM_DOMAIN_HANDLE **domain)
+NTSTATUS sam_get_account_domain(const SAM_ACCOUNT_HANDLE *sampass, SAM_DOMAIN_HANDLE **domain)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -234,7 +234,7 @@ NTSTATUS sam_get_user_domain (const SAM_USER_HANDLE *sampass, SAM_DOMAIN_HANDLE
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_fullname (const SAM_USER_HANDLE *sampass, char **fullname)
+NTSTATUS sam_get_account_fullname(const SAM_ACCOUNT_HANDLE *sampass, char **fullname)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -243,7 +243,7 @@ NTSTATUS sam_get_user_fullname (const SAM_USER_HANDLE *sampass, char **fullname)
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_homedir (const SAM_USER_HANDLE *sampass, char **homedir)
+NTSTATUS sam_get_account_homedir(const SAM_ACCOUNT_HANDLE *sampass, char **homedir)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -252,7 +252,7 @@ NTSTATUS sam_get_user_homedir (const SAM_USER_HANDLE *sampass, char **homedir)
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_unix_home_dir (const SAM_USER_HANDLE *sampass, char **uhomedir)
+NTSTATUS sam_get_account_unix_home_dir(const SAM_ACCOUNT_HANDLE *sampass, char **uhomedir)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -261,7 +261,7 @@ NTSTATUS sam_get_user_unix_home_dir (const SAM_USER_HANDLE *sampass, char **uhom
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_dir_drive (const SAM_USER_HANDLE *sampass, char **dirdrive)
+NTSTATUS sam_get_account_dir_drive(const SAM_ACCOUNT_HANDLE *sampass, char **dirdrive)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -270,7 +270,7 @@ NTSTATUS sam_get_user_dir_drive (const SAM_USER_HANDLE *sampass, char **dirdrive
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_logon_script (const SAM_USER_HANDLE *sampass, char **logon_script)
+NTSTATUS sam_get_account_logon_script(const SAM_ACCOUNT_HANDLE *sampass, char **logon_script)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -279,7 +279,7 @@ NTSTATUS sam_get_user_logon_script (const SAM_USER_HANDLE *sampass, char **logon
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_profile_path (const SAM_USER_HANDLE *sampass, char **profile_path)
+NTSTATUS sam_get_account_profile_path(const SAM_ACCOUNT_HANDLE *sampass, char **profile_path)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -288,7 +288,7 @@ NTSTATUS sam_get_user_profile_path (const SAM_USER_HANDLE *sampass, char **profi
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_description (const SAM_USER_HANDLE *sampass, char **description)
+NTSTATUS sam_get_account_description(const SAM_ACCOUNT_HANDLE *sampass, char **description)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -297,7 +297,7 @@ NTSTATUS sam_get_user_description (const SAM_USER_HANDLE *sampass, char **descri
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_workstations (const SAM_USER_HANDLE *sampass, char **workstations)
+NTSTATUS sam_get_account_workstations(const SAM_ACCOUNT_HANDLE *sampass, char **workstations)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -306,7 +306,7 @@ NTSTATUS sam_get_user_workstations (const SAM_USER_HANDLE *sampass, char **works
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_unknown_str (const SAM_USER_HANDLE *sampass, char **unknown_str)
+NTSTATUS sam_get_account_unknown_str(const SAM_ACCOUNT_HANDLE *sampass, char **unknown_str)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -315,7 +315,7 @@ NTSTATUS sam_get_user_unknown_str (const SAM_USER_HANDLE *sampass, char **unknow
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_munged_dial (const SAM_USER_HANDLE *sampass, char **munged_dial)
+NTSTATUS sam_get_account_munged_dial(const SAM_ACCOUNT_HANDLE *sampass, char **munged_dial)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -324,7 +324,7 @@ NTSTATUS sam_get_user_munged_dial (const SAM_USER_HANDLE *sampass, char **munged
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_unknown_1 (const SAM_USER_HANDLE *sampass, uint32 *unknown1)
+NTSTATUS sam_get_account_unknown_1(const SAM_ACCOUNT_HANDLE *sampass, uint32 *unknown1)
{
if (!sampass || !unknown1) return NT_STATUS_UNSUCCESSFUL;
@@ -333,7 +333,7 @@ NTSTATUS sam_get_user_unknown_1 (const SAM_USER_HANDLE *sampass, uint32 *unknown
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_unknown_2 (const SAM_USER_HANDLE *sampass, uint32 *unknown2)
+NTSTATUS sam_get_account_unknown_2(const SAM_ACCOUNT_HANDLE *sampass, uint32 *unknown2)
{
if (!sampass || !unknown2) return NT_STATUS_UNSUCCESSFUL;
@@ -342,7 +342,7 @@ NTSTATUS sam_get_user_unknown_2 (const SAM_USER_HANDLE *sampass, uint32 *unknown
return NT_STATUS_OK;
}
-NTSTATUS sam_get_user_unknown_3 (const SAM_USER_HANDLE *sampass, uint32 *unknown3)
+NTSTATUS sam_get_account_unknown_3(const SAM_ACCOUNT_HANDLE *sampass, uint32 *unknown3)
{
if (!sampass || !unknown3) return NT_STATUS_UNSUCCESSFUL;
@@ -352,10 +352,10 @@ NTSTATUS sam_get_user_unknown_3 (const SAM_USER_HANDLE *sampass, uint32 *unknown
}
/*********************************************************************
- Collection of set...() functions for SAM_USER_HANDLE_INFO.
+ Collection of set...() functions for SAM_ACCOUNT_HANDLE_INFO.
********************************************************************/
-NTSTATUS sam_set_user_acct_ctrl (SAM_USER_HANDLE *sampass, uint16 flags)
+NTSTATUS sam_set_account_acct_ctrl(SAM_ACCOUNT_HANDLE *sampass, uint16 flags)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -365,7 +365,7 @@ NTSTATUS sam_set_user_acct_ctrl (SAM_USER_HANDLE *sampass, uint16 flags)
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_logon_time (SAM_USER_HANDLE *sampass, NTTIME mytime, BOOL store)
+NTSTATUS sam_set_account_logon_time(SAM_ACCOUNT_HANDLE *sampass, NTTIME mytime, BOOL store)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -373,12 +373,12 @@ NTSTATUS sam_set_user_logon_time (SAM_USER_HANDLE *sampass, NTTIME mytime, BOOL
sampass->private.logon_time = mytime;
if (store)
- sam_set_user_init_flag(sampass, FLAG_SAM_LOGONTIME);
+ sam_set_account_init_flag(sampass, FLAG_SAM_LOGONTIME);
return NT_STATUS_UNSUCCESSFUL;
}
-NTSTATUS sam_set_user_logoff_time (SAM_USER_HANDLE *sampass, NTTIME mytime, BOOL store)
+NTSTATUS sam_set_account_logoff_time(SAM_ACCOUNT_HANDLE *sampass, NTTIME mytime, BOOL store)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -386,12 +386,12 @@ NTSTATUS sam_set_user_logoff_time (SAM_USER_HANDLE *sampass, NTTIME mytime, BOOL
sampass->private.logoff_time = mytime;
if (store)
- sam_set_user_init_flag(sampass, FLAG_SAM_LOGOFFTIME);
+ sam_set_account_init_flag(sampass, FLAG_SAM_LOGOFFTIME);
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_kickoff_time (SAM_USER_HANDLE *sampass, NTTIME mytime, BOOL store)
+NTSTATUS sam_set_account_kickoff_time(SAM_ACCOUNT_HANDLE *sampass, NTTIME mytime, BOOL store)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -399,12 +399,12 @@ NTSTATUS sam_set_user_kickoff_time (SAM_USER_HANDLE *sampass, NTTIME mytime, BOO
sampass->private.kickoff_time = mytime;
if (store)
- sam_set_user_init_flag(sampass, FLAG_SAM_KICKOFFTIME);
+ sam_set_account_init_flag(sampass, FLAG_SAM_KICKOFFTIME);
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_pass_can_change_time (SAM_USER_HANDLE *sampass, NTTIME mytime, BOOL store)
+NTSTATUS sam_set_account_pass_can_change_time(SAM_ACCOUNT_HANDLE *sampass, NTTIME mytime, BOOL store)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -412,12 +412,12 @@ NTSTATUS sam_set_user_pass_can_change_time (SAM_USER_HANDLE *sampass, NTTIME myt
sampass->private.pass_can_change_time = mytime;
if (store)
- sam_set_user_init_flag(sampass, FLAG_SAM_CANCHANGETIME);
+ sam_set_account_init_flag(sampass, FLAG_SAM_CANCHANGETIME);
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_pass_must_change_time (SAM_USER_HANDLE *sampass, NTTIME mytime, BOOL store)
+NTSTATUS sam_set_account_pass_must_change_time(SAM_ACCOUNT_HANDLE *sampass, NTTIME mytime, BOOL store)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -425,12 +425,12 @@ NTSTATUS sam_set_user_pass_must_change_time (SAM_USER_HANDLE *sampass, NTTIME my
sampass->private.pass_must_change_time = mytime;
if (store)
- sam_set_user_init_flag(sampass, FLAG_SAM_MUSTCHANGETIME);
+ sam_set_account_init_flag(sampass, FLAG_SAM_MUSTCHANGETIME);
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_pass_last_set_time (SAM_USER_HANDLE *sampass, NTTIME mytime)
+NTSTATUS sam_set_account_pass_last_set_time(SAM_ACCOUNT_HANDLE *sampass, NTTIME mytime)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -440,7 +440,7 @@ NTSTATUS sam_set_user_pass_last_set_time (SAM_USER_HANDLE *sampass, NTTIME mytim
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_hours_len (SAM_USER_HANDLE *sampass, uint32 len)
+NTSTATUS sam_set_account_hours_len(SAM_ACCOUNT_HANDLE *sampass, uint32 len)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -449,7 +449,7 @@ NTSTATUS sam_set_user_hours_len (SAM_USER_HANDLE *sampass, uint32 len)
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_logon_divs (SAM_USER_HANDLE *sampass, uint16 hours)
+NTSTATUS sam_set_account_logon_divs(SAM_ACCOUNT_HANDLE *sampass, uint16 hours)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -459,13 +459,13 @@ NTSTATUS sam_set_user_logon_divs (SAM_USER_HANDLE *sampass, uint16 hours)
}
/**
- * Set flags showing what is initalised in the SAM_USER_HANDLE
- * @param sampass the SAM_USER_HANDLE in question
+ * Set flags showing what is initalised in the SAM_ACCOUNT_HANDLE
+ * @param sampass the SAM_ACCOUNT_HANDLE in question
* @param flag The *new* flag to be set. Old flags preserved
* this flag is only added.
**/
-NTSTATUS sam_set_user_init_flag (SAM_USER_HANDLE *sampass, uint32 flag)
+NTSTATUS sam_set_account_init_flag(SAM_ACCOUNT_HANDLE *sampass, uint32 flag)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -475,42 +475,42 @@ NTSTATUS sam_set_user_init_flag (SAM_USER_HANDLE *sampass, uint32 flag)
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_sid (SAM_USER_HANDLE *sampass, DOM_SID *u_sid)
+NTSTATUS sam_set_account_sid(SAM_ACCOUNT_HANDLE *sampass, DOM_SID *u_sid)
{
if (!sampass || !u_sid)
return NT_STATUS_UNSUCCESSFUL;
- sid_copy(&sampass->private.user_sid, u_sid);
+ sid_copy(&sampass->private.account_sid, u_sid);
- DEBUG(10, ("sam_set_user_sid: setting user sid %s\n",
- sid_string_static(&sampass->private.user_sid)));
+ DEBUG(10, ("sam_set_account_sid: setting account sid %s\n",
+ sid_string_static(&sampass->private.account_sid)));
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_sid_from_string (SAM_USER_HANDLE *sampass, fstring u_sid)
+NTSTATUS sam_set_account_sid_from_string(SAM_ACCOUNT_HANDLE *sampass, fstring u_sid)
{
DOM_SID new_sid;
if (!sampass || !u_sid)
return NT_STATUS_UNSUCCESSFUL;
- DEBUG(10, ("sam_set_user_sid_from_string: setting user sid %s\n",
+ DEBUG(10, ("sam_set_account_sid_from_string: setting account sid %s\n",
u_sid));
if (!string_to_sid(&new_sid, u_sid)) {
- DEBUG(1, ("sam_set_user_sid_from_string: %s isn't a valid SID!\n", u_sid));
+ DEBUG(1, ("sam_set_account_sid_from_string: %s isn't a valid SID!\n", u_sid));
return NT_STATUS_UNSUCCESSFUL;
}
- if (!NT_STATUS_IS_OK(sam_set_user_sid(sampass, &new_sid))) {
- DEBUG(1, ("sam_set_user_sid_from_string: could not set sid %s on SAM_USER_HANDLE!\n", u_sid));
+ if (!NT_STATUS_IS_OK(sam_set_account_sid(sampass, &new_sid))) {
+ DEBUG(1, ("sam_set_account_sid_from_string: could not set sid %s on SAM_ACCOUNT_HANDLE!\n", u_sid));
return NT_STATUS_UNSUCCESSFUL;
}
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_pgroup_sid (SAM_USER_HANDLE *sampass, DOM_SID *g_sid)
+NTSTATUS sam_set_account_pgroup_sid(SAM_ACCOUNT_HANDLE *sampass, DOM_SID *g_sid)
{
if (!sampass || !g_sid)
return NT_STATUS_UNSUCCESSFUL;
@@ -523,7 +523,7 @@ NTSTATUS sam_set_user_pgroup_sid (SAM_USER_HANDLE *sampass, DOM_SID *g_sid)
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_pgroup_string (SAM_USER_HANDLE *sampass, fstring g_sid)
+NTSTATUS sam_set_account_pgroup_string(SAM_ACCOUNT_HANDLE *sampass, fstring g_sid)
{
DOM_SID new_sid;
if (!sampass || !g_sid)
@@ -537,8 +537,8 @@ NTSTATUS sam_set_user_pgroup_string (SAM_USER_HANDLE *sampass, fstring g_sid)
return NT_STATUS_UNSUCCESSFUL;
}
- if (!NT_STATUS_IS_OK(sam_set_user_pgroup_sid(sampass, &new_sid))) {
- DEBUG(1, ("sam_set_group_sid_from_string: could not set sid %s on SAM_USER_HANDLE!\n", g_sid));
+ if (!NT_STATUS_IS_OK(sam_set_account_pgroup_sid(sampass, &new_sid))) {
+ DEBUG(1, ("sam_set_group_sid_from_string: could not set sid %s on SAM_ACCOUNT_HANDLE!\n", g_sid));
return NT_STATUS_UNSUCCESSFUL;
}
return NT_STATUS_OK;
@@ -548,7 +548,7 @@ NTSTATUS sam_set_user_pgroup_string (SAM_USER_HANDLE *sampass, fstring g_sid)
Set the domain name.
********************************************************************/
-NTSTATUS sam_set_user_domain(SAM_USER_HANDLE *sampass, SAM_DOMAIN_HANDLE *domain)
+NTSTATUS sam_set_account_domain(SAM_ACCOUNT_HANDLE *sampass, SAM_DOMAIN_HANDLE *domain)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -559,31 +559,31 @@ NTSTATUS sam_set_user_domain(SAM_USER_HANDLE *sampass, SAM_DOMAIN_HANDLE *domain
}
/*********************************************************************
- Set the user's NT name.
+ Set the account's NT name.
********************************************************************/
-NTSTATUS sam_set_user_username(SAM_USER_HANDLE *sampass, const char *nt_username)
+NTSTATUS sam_set_account_name(SAM_ACCOUNT_HANDLE *sampass, const char *account_name)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
- DEBUG(10, ("sam_set_user_username: setting nt username %s, was %s\n", nt_username, sampass->private.username));
+ DEBUG(10, ("sam_set_account_name: setting nt account_name %s, was %s\n", account_name, sampass->private.account_name));
- sampass->private.username = talloc_strdup(sampass->mem_ctx, nt_username);
+ sampass->private.account_name = talloc_strdup(sampass->mem_ctx, account_name);
return NT_STATUS_OK;
}
/*********************************************************************
- Set the user's full name.
+ Set the account's full name.
********************************************************************/
-NTSTATUS sam_set_user_fullname(SAM_USER_HANDLE *sampass, const char *full_name)
+NTSTATUS sam_set_account_fullname(SAM_ACCOUNT_HANDLE *sampass, const char *full_name)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
- DEBUG(10, ("sam_set_user_fullname: setting full name %s, was %s\n", full_name, sampass->private.full_name));
+ DEBUG(10, ("sam_set_account_fullname: setting full name %s, was %s\n", full_name, sampass->private.full_name));
sampass->private.full_name = talloc_strdup(sampass->mem_ctx, full_name);
@@ -591,10 +591,10 @@ NTSTATUS sam_set_user_fullname(SAM_USER_HANDLE *sampass, const char *full_name)
}
/*********************************************************************
- Set the user's logon script.
+ Set the account's logon script.
********************************************************************/
-NTSTATUS sam_set_user_logon_script(SAM_USER_HANDLE *sampass, const char *logon_script, BOOL store)
+NTSTATUS sam_set_account_logon_script(SAM_ACCOUNT_HANDLE *sampass, const char *logon_script, BOOL store)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -603,16 +603,16 @@ NTSTATUS sam_set_user_logon_script(SAM_USER_HANDLE *sampass, const char *logon_s
sampass->private.logon_script = talloc_strdup(sampass->mem_ctx, logon_script);
- sam_set_user_init_flag(sampass, FLAG_SAM_LOGONSCRIPT);
+ sam_set_account_init_flag(sampass, FLAG_SAM_LOGONSCRIPT);
return NT_STATUS_OK;
}
/*********************************************************************
- Set the user's profile path.
+ Set the account's profile path.
********************************************************************/
-NTSTATUS sam_set_user_profile_path (SAM_USER_HANDLE *sampass, const char *profile_path, BOOL store)
+NTSTATUS sam_set_account_profile_path(SAM_ACCOUNT_HANDLE *sampass, const char *profile_path, BOOL store)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -623,17 +623,17 @@ NTSTATUS sam_set_user_profile_path (SAM_USER_HANDLE *sampass, const char *profil
if (store) {
DEBUG(10, ("sam_set_profile_path: setting profile path sam flag!\n"));
- sam_set_user_init_flag(sampass, FLAG_SAM_PROFILE);
+ sam_set_account_init_flag(sampass, FLAG_SAM_PROFILE);
}
return NT_STATUS_OK;
}
/*********************************************************************
- Set the user's directory drive.
+ Set the account's directory drive.
********************************************************************/
-NTSTATUS sam_set_user_dir_drive (SAM_USER_HANDLE *sampass, const char *dir_drive, BOOL store)
+NTSTATUS sam_set_account_dir_drive(SAM_ACCOUNT_HANDLE *sampass, const char *dir_drive, BOOL store)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -645,17 +645,17 @@ NTSTATUS sam_set_user_dir_drive (SAM_USER_HANDLE *sampass, const char *dir_drive
if (store) {
DEBUG(10, ("sam_set_dir_drive: setting dir drive sam flag!\n"));
- sam_set_user_init_flag(sampass, FLAG_SAM_DRIVE);
+ sam_set_account_init_flag(sampass, FLAG_SAM_DRIVE);
}
return NT_STATUS_OK;
}
/*********************************************************************
- Set the user's home directory.
+ Set the account's home directory.
********************************************************************/
-NTSTATUS sam_set_user_homedir (SAM_USER_HANDLE *sampass, const char *home_dir, BOOL store)
+NTSTATUS sam_set_account_homedir(SAM_ACCOUNT_HANDLE *sampass, const char *home_dir, BOOL store)
{
if (!sampass) return NT_STATUS_UNSUCCESSFUL;
@@ -666,17 +666,17 @@ NTSTATUS sam_set_user_homedir (SAM_USER_HANDLE *sampass, const char *home_dir, B
if (store) {
DEBUG(10, ("sam_set_homedir: setting home dir sam flag!\n"));
- sam_set_user_init_flag(sampass, FLAG_SAM_SMBHOME);
+ sam_set_account_init_flag(sampass, FLAG_SAM_SMBHOME);
}
return NT_STATUS_OK;
}
/*********************************************************************
- Set the user's unix home directory.
+ Set the account's unix home directory.
********************************************************************/
-NTSTATUS sam_set_user_unix_homedir (SAM_USER_HANDLE *sampass, const char *unix_home_dir)
+NTSTATUS sam_set_account_unix_homedir(SAM_ACCOUNT_HANDLE *sampass, const char *unix_home_dir)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -690,10 +690,10 @@ NTSTATUS sam_set_user_unix_homedir (SAM_USER_HANDLE *sampass, const char *unix_h
}
/*********************************************************************
- Set the user's account description.
+ Set the account's account description.
********************************************************************/
-NTSTATUS sam_set_user_acct_desc (SAM_USER_HANDLE *sampass, const char *acct_desc)
+NTSTATUS sam_set_account_acct_desc(SAM_ACCOUNT_HANDLE *sampass, const char *acct_desc)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -704,10 +704,10 @@ NTSTATUS sam_set_user_acct_desc (SAM_USER_HANDLE *sampass, const char *acct_desc
}
/*********************************************************************
- Set the user's workstation allowed list.
+ Set the account's workstation allowed list.
********************************************************************/
-NTSTATUS sam_set_user_workstations (SAM_USER_HANDLE *sampass, const char *workstations)
+NTSTATUS sam_set_account_workstations(SAM_ACCOUNT_HANDLE *sampass, const char *workstations)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -721,10 +721,10 @@ NTSTATUS sam_set_user_workstations (SAM_USER_HANDLE *sampass, const char *workst
}
/*********************************************************************
- Set the user's 'unknown_str', whatever the heck this actually is...
+ Set the account's 'unknown_str', whatever the heck this actually is...
********************************************************************/
-NTSTATUS sam_set_user_unknown_str (SAM_USER_HANDLE *sampass, const char *unknown_str)
+NTSTATUS sam_set_account_unknown_str(SAM_ACCOUNT_HANDLE *sampass, const char *unknown_str)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -735,10 +735,10 @@ NTSTATUS sam_set_user_unknown_str (SAM_USER_HANDLE *sampass, const char *unknown
}
/*********************************************************************
- Set the user's dial string.
+ Set the account's dial string.
********************************************************************/
-NTSTATUS sam_set_user_munged_dial (SAM_USER_HANDLE *sampass, const char *munged_dial)
+NTSTATUS sam_set_account_munged_dial(SAM_ACCOUNT_HANDLE *sampass, const char *munged_dial)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -748,10 +748,10 @@ NTSTATUS sam_set_user_munged_dial (SAM_USER_HANDLE *sampass, const char *munged_
}
/*********************************************************************
- Set the user's NT hash.
+ Set the account's NT hash.
********************************************************************/
-NTSTATUS sam_set_user_nt_pwd (SAM_USER_HANDLE *sampass, DATA_BLOB data)
+NTSTATUS sam_set_account_nt_pwd(SAM_ACCOUNT_HANDLE *sampass, DATA_BLOB data)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -762,10 +762,10 @@ NTSTATUS sam_set_user_nt_pwd (SAM_USER_HANDLE *sampass, DATA_BLOB data)
}
/*********************************************************************
- Set the user's LM hash.
+ Set the account's LM hash.
********************************************************************/
-NTSTATUS sam_set_user_lm_pwd (SAM_USER_HANDLE *sampass, DATA_BLOB data)
+NTSTATUS sam_set_account_lm_pwd(SAM_ACCOUNT_HANDLE *sampass, DATA_BLOB data)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -776,21 +776,21 @@ NTSTATUS sam_set_user_lm_pwd (SAM_USER_HANDLE *sampass, DATA_BLOB data)
}
/*********************************************************************
- Set the user's plaintext password only (base procedure, see helper
+ Set the account's plaintext password only (base procedure, see helper
below)
********************************************************************/
-NTSTATUS sam_set_user_plaintext_pw_only (SAM_USER_HANDLE *sampass, DATA_BLOB data)
+NTSTATUS sam_set_account_plaintext_pwd(SAM_ACCOUNT_HANDLE *sampass, const char *plain_pwd)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
- sampass->private.plaintext_pw = data;
+ sampass->private.plaintext_pw = talloc_strdup(sampass->mem_ctx, plain_pwd);
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_unknown_1 (SAM_USER_HANDLE *sampass, uint32 unkn)
+NTSTATUS sam_set_account_unknown_1(SAM_ACCOUNT_HANDLE *sampass, uint32 unkn)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -800,7 +800,7 @@ NTSTATUS sam_set_user_unknown_1 (SAM_USER_HANDLE *sampass, uint32 unkn)
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_unknown_2 (SAM_USER_HANDLE *sampass, uint32 unkn)
+NTSTATUS sam_set_account_unknown_2(SAM_ACCOUNT_HANDLE *sampass, uint32 unkn)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -810,7 +810,7 @@ NTSTATUS sam_set_user_unknown_2 (SAM_USER_HANDLE *sampass, uint32 unkn)
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_unknown_3 (SAM_USER_HANDLE *sampass, uint32 unkn)
+NTSTATUS sam_set_account_unknown_3(SAM_ACCOUNT_HANDLE *sampass, uint32 unkn)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -819,7 +819,7 @@ NTSTATUS sam_set_user_unknown_3 (SAM_USER_HANDLE *sampass, uint32 unkn)
return NT_STATUS_OK;
}
-NTSTATUS sam_set_user_hours (SAM_USER_HANDLE *sampass, const uint8 *hours)
+NTSTATUS sam_set_account_hours(SAM_ACCOUNT_HANDLE *sampass, const uint8 *hours)
{
if (!sampass)
return NT_STATUS_UNSUCCESSFUL;
@@ -829,7 +829,7 @@ NTSTATUS sam_set_user_hours (SAM_USER_HANDLE *sampass, const uint8 *hours)
return NT_STATUS_OK;
}
- memcpy (sampass->private.hours, hours, MAX_HOURS_LEN);
+ memcpy(sampass->private.hours, hours, MAX_HOURS_LEN);
return NT_STATUS_OK;
}
@@ -841,7 +841,7 @@ NTSTATUS sam_set_user_hours (SAM_USER_HANDLE *sampass, const uint8 *hours)
password change.
********************************************************************/
-NTSTATUS sam_set_user_pass_changed_now (SAM_USER_HANDLE *sampass)
+NTSTATUS sam_set_account_pass_changed_now(SAM_ACCOUNT_HANDLE *sampass)
{
uint32 expire;
NTTIME temptime;
@@ -850,20 +850,20 @@ NTSTATUS sam_set_user_pass_changed_now (SAM_USER_HANDLE *sampass)
return NT_STATUS_UNSUCCESSFUL;
unix_to_nt_time(&temptime, time(NULL));
- if (!NT_STATUS_IS_OK(sam_set_user_pass_last_set_time (sampass, temptime)))
+ if (!NT_STATUS_IS_OK(sam_set_account_pass_last_set_time(sampass, temptime)))
return NT_STATUS_UNSUCCESSFUL;
if (!account_policy_get(AP_MAX_PASSWORD_AGE, &expire)
|| (expire==(uint32)-1)) {
get_nttime_max(&temptime);
- if (!NT_STATUS_IS_OK(sam_set_user_pass_must_change_time (sampass, temptime, False)))
+ if (!NT_STATUS_IS_OK(sam_set_account_pass_must_change_time(sampass, temptime, False)))
return NT_STATUS_UNSUCCESSFUL;
} else {
/* FIXME: Add expire to temptime */
- if (!NT_STATUS_IS_OK(sam_get_user_pass_last_set_time(sampass,&temptime)) || !NT_STATUS_IS_OK(sam_set_user_pass_must_change_time (sampass, temptime,True)))
+ if (!NT_STATUS_IS_OK(sam_get_account_pass_last_set_time(sampass,&temptime)) || !NT_STATUS_IS_OK(sam_set_account_pass_must_change_time(sampass, temptime,True)))
return NT_STATUS_UNSUCCESSFUL;
}
@@ -871,11 +871,11 @@ NTSTATUS sam_set_user_pass_changed_now (SAM_USER_HANDLE *sampass)
}
/*********************************************************************
- Set the user's PLAINTEXT password. Used as an interface to the above.
+ Set the account's PLAINTEXT password. Used as an interface to the above.
Also sets the last change time to NOW.
********************************************************************/
-NTSTATUS sam_set_plaintext_passwd (SAM_USER_HANDLE *sampass, const char *plaintext)
+NTSTATUS sam_set_account_passwd(SAM_ACCOUNT_HANDLE *sampass, const char *plaintext)
{
DATA_BLOB data;
uchar new_lanman_p16[16];
@@ -884,18 +884,21 @@ NTSTATUS sam_set_plaintext_passwd (SAM_USER_HANDLE *sampass, const char *plainte
if (!sampass || !plaintext)
return NT_STATUS_UNSUCCESSFUL;
- nt_lm_owf_gen (plaintext, new_nt_p16, new_lanman_p16);
+ nt_lm_owf_gen(plaintext, new_nt_p16, new_lanman_p16);
data = data_blob(new_nt_p16, 16);
- if (!NT_STATUS_IS_OK(sam_set_user_nt_pwd (sampass, data)))
+ if (!NT_STATUS_IS_OK(sam_set_account_nt_pwd(sampass, data)))
return NT_STATUS_UNSUCCESSFUL;
data = data_blob(new_lanman_p16, 16);
- if (!NT_STATUS_IS_OK(sam_set_user_lm_pwd (sampass, data)))
+ if (!NT_STATUS_IS_OK(sam_set_account_lm_pwd(sampass, data)))
+ return NT_STATUS_UNSUCCESSFUL;
+
+ if (!NT_STATUS_IS_OK(sam_set_account_plaintext_pwd(sampass, plaintext)))
return NT_STATUS_UNSUCCESSFUL;
- if (!NT_STATUS_IS_OK(sam_set_user_pass_changed_now (sampass)))
+ if (!NT_STATUS_IS_OK(sam_set_account_pass_changed_now(sampass)))
return NT_STATUS_UNSUCCESSFUL;
return NT_STATUS_OK;
diff --git a/source3/sam/get_set_domain.c b/source3/sam/get_set_domain.c
index e9e61119cd..9e4d41a49e 100644
--- a/source3/sam/get_set_domain.c
+++ b/source3/sam/get_set_domain.c
@@ -30,16 +30,16 @@ NTSTATUS sam_get_domain_sid(SAM_DOMAIN_HANDLE *domain, DOM_SID **sid)
{
if (!domain || !sid) return NT_STATUS_UNSUCCESSFUL;
- *sid = &domain->private.sid;
+ *sid = &(domain->private.sid);
return NT_STATUS_OK;
}
-NTSTATUS sam_get_domain_num_users(SAM_DOMAIN_HANDLE *domain, uint32 *num_users)
+NTSTATUS sam_get_domain_num_accounts(SAM_DOMAIN_HANDLE *domain, uint32 *num_accounts)
{
- if (!domain || !num_users) return NT_STATUS_UNSUCCESSFUL;
+ if (!domain || !num_accounts) return NT_STATUS_UNSUCCESSFUL;
- *num_users = domain->private.num_users;
+ *num_accounts = domain->private.num_accounts;
return NT_STATUS_OK;
}
@@ -71,15 +71,6 @@ NTSTATUS sam_get_domain_name(SAM_DOMAIN_HANDLE *domain, char **domain_name)
return NT_STATUS_OK;
}
-NTSTATUS sam_set_domain_name(SAM_DOMAIN_HANDLE *domain, char *domain_name)
-{
- if (!domain) return NT_STATUS_UNSUCCESSFUL;
-
- domain->private.name = talloc_strdup(domain->mem_ctx, domain_name);
-
- return NT_STATUS_OK;
-}
-
NTSTATUS sam_get_domain_server(SAM_DOMAIN_HANDLE *domain, char **server_name)
{
if (!domain || !server_name) return NT_STATUS_UNSUCCESSFUL;
@@ -89,15 +80,6 @@ NTSTATUS sam_get_domain_server(SAM_DOMAIN_HANDLE *domain, char **server_name)
return NT_STATUS_OK;
}
-NTSTATUS sam_set_domain_server(SAM_DOMAIN_HANDLE *domain, char *server_name)
-{
- if (!domain) return NT_STATUS_UNSUCCESSFUL;
-
- domain->private.servername = talloc_strdup(domain->mem_ctx, server_name);
-
- return NT_STATUS_OK;
-}
-
NTSTATUS sam_get_domain_max_pwdage(SAM_DOMAIN_HANDLE *domain, NTTIME *max_passwordage)
{
if (!domain || !max_passwordage) return NT_STATUS_UNSUCCESSFUL;
@@ -182,6 +164,16 @@ NTSTATUS sam_get_domain_login_pwdchange(SAM_DOMAIN_HANDLE *domain, BOOL *login_p
/* Set */
+NTSTATUS sam_set_domain_name(SAM_DOMAIN_HANDLE *domain, char *domain_name)
+{
+ if (!domain) return NT_STATUS_UNSUCCESSFUL;
+
+ domain->private.name = talloc_strdup(domain->mem_ctx, domain_name);
+
+ return NT_STATUS_OK;
+}
+
+
NTSTATUS sam_set_domain_max_pwdage(SAM_DOMAIN_HANDLE *domain, NTTIME max_passwordage)
{
if (!domain) return NT_STATUS_UNSUCCESSFUL;
@@ -261,3 +253,12 @@ NTSTATUS sam_set_domain_login_pwdchange(SAM_DOMAIN_HANDLE *domain, BOOL login_pw
return NT_STATUS_OK;
}
+
+NTSTATUS sam_set_domain_server(SAM_DOMAIN_HANDLE *domain, char *server_name)
+{
+ if (!domain) return NT_STATUS_UNSUCCESSFUL;
+
+ domain->private.servername = talloc_strdup(domain->mem_ctx, server_name);
+
+ return NT_STATUS_OK;
+}
diff --git a/source3/sam/get_set_group.c b/source3/sam/get_set_group.c
index 51f91ada82..dac5ffca9f 100644
--- a/source3/sam/get_set_group.c
+++ b/source3/sam/get_set_group.c
@@ -31,7 +31,7 @@ NTSTATUS sam_get_group_sid(const SAM_GROUP_HANDLE *group, DOM_SID **sid)
{
if (!group || !sid) return NT_STATUS_UNSUCCESSFUL;
- *sid = &group->private.sid;
+ *sid = &(group->private.sid);
return NT_STATUS_OK;
}
diff --git a/source3/sam/interface.c b/source3/sam/interface.c
index e4d4868b1e..3d886d7281 100644
--- a/source3/sam/interface.c
+++ b/source3/sam/interface.c
@@ -3,8 +3,8 @@
Password and authentication handling
Copyright (C) Andrew Bartlett 2002
Copyright (C) Jelmer Vernooij 2002
- Copyright (C) Stefan (metze) Metzmacher 2002
- Copyright (C) Kai Krüger 2002
+ Copyright (C) Stefan (metze) Metzmacher 2002
+ Copyright (C) Kai Krüger 2002
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@
/** List of various built-in sam modules */
const struct sam_init_function_entry builtin_sam_init_functions[] = {
+ { "plugin", sam_init_plugin },
{ NULL, NULL}
};
@@ -41,9 +42,9 @@ const struct sam_init_function_entry builtin_sam_init_functions[] = {
in the selected backend
*******************************************************************/
-NTSTATUS sam_get_methods_by_sid(const struct sam_context *context, struct sam_methods **sam_method, const DOM_SID *domainsid)
+NTSTATUS sam_get_methods_by_sid(const SAM_CONTEXT *context, SAM_METHODS **sam_method, const DOM_SID *domainsid)
{
- struct sam_methods *tmp_methods;
+ SAM_METHODS *tmp_methods;
DEBUG(5,("sam_get_methods_by_sid: %d\n", __LINE__));
@@ -57,7 +58,7 @@ NTSTATUS sam_get_methods_by_sid(const struct sam_context *context, struct sam_me
while (tmp_methods)
{
- if (sid_equal(domainsid, &tmp_methods->domain->private.sid))
+ if (sid_equal(domainsid, &(tmp_methods->domain->private.sid)))
{
(*sam_method) = tmp_methods;
return NT_STATUS_OK;
@@ -70,9 +71,9 @@ NTSTATUS sam_get_methods_by_sid(const struct sam_context *context, struct sam_me
return NT_STATUS_NO_SUCH_DOMAIN;
}
-NTSTATUS sam_get_methods_by_name(const struct sam_context *context, struct sam_methods **sam_method, const char *domainname)
+NTSTATUS sam_get_methods_by_name(const SAM_CONTEXT *context, SAM_METHODS **sam_method, const char *domainname)
{
- struct sam_methods *tmp_methods;
+ SAM_METHODS *tmp_methods;
DEBUG(5,("sam_get_methods_by_name: %d\n", __LINE__));
@@ -99,11 +100,10 @@ NTSTATUS sam_get_methods_by_name(const struct sam_context *context, struct sam_m
return NT_STATUS_NO_SUCH_DOMAIN;
}
-NTSTATUS context_sam_get_sec_desc(const struct sam_context *context, const NT_USER_TOKEN *access_token, const DOM_SID *sid, SEC_DESC **sd)
+NTSTATUS context_sam_get_sec_desc(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const DOM_SID *sid, SEC_DESC **sd)
{
- struct sam_methods *tmp_methods;
-// DOM_SID *domainsid;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
DEBUG(5,("context_sam_get_sec_desc: %d\n", __LINE__));
@@ -125,11 +125,10 @@ NTSTATUS context_sam_get_sec_desc(const struct sam_context *context, const NT_US
return NT_STATUS_OK;
}
-NTSTATUS context_sam_set_sec_desc(const struct sam_context *context, const NT_USER_TOKEN *access_token, const DOM_SID *sid, const SEC_DESC *sd)
+NTSTATUS context_sam_set_sec_desc(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const DOM_SID *sid, const SEC_DESC *sd)
{
- struct sam_methods *tmp_methods;
-// DOM_SID *domainsid;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
DEBUG(5,("context_sam_set_sec_desc: %d\n", __LINE__));
@@ -152,10 +151,10 @@ NTSTATUS context_sam_set_sec_desc(const struct sam_context *context, const NT_US
}
-NTSTATUS context_sam_lookup_name(const struct sam_context *context, const NT_USER_TOKEN *access_token, const char *domain, const char *name, DOM_SID **sid, uint32 *type)
+NTSTATUS context_sam_lookup_name(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const char *domain, const char *name, DOM_SID **sid, uint32 *type)
{
- struct sam_methods *tmp_methods;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
DEBUG(5,("context_sam_lookup_name: %d\n", __LINE__));
@@ -178,12 +177,12 @@ NTSTATUS context_sam_lookup_name(const struct sam_context *context, const NT_USE
return NT_STATUS_OK;
}
-NTSTATUS context_sam_lookup_sid(const struct sam_context *context, const NT_USER_TOKEN *access_token, const DOM_SID *sid, char **name, uint32 *type)
+NTSTATUS context_sam_lookup_sid(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const DOM_SID *sid, char **name, uint32 *type)
{
- struct sam_methods *tmp_methods;
- uint32 rid;
- NTSTATUS nt_status;
- DOM_SID domainsid;
+ SAM_METHODS *tmp_methods;
+ uint32 rid;
+ NTSTATUS nt_status;
+ DOM_SID domainsid;
DEBUG(5,("context_sam_lookup_sid: %d\n", __LINE__));
@@ -213,20 +212,20 @@ NTSTATUS context_sam_lookup_sid(const struct sam_context *context, const NT_USER
}
-NTSTATUS context_sam_update_domain(const struct sam_context *context, const SAM_DOMAIN_HANDLE *domain)
+NTSTATUS context_sam_update_domain(const SAM_CONTEXT *context, const SAM_DOMAIN_HANDLE *domain)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS context_sam_enum_domains(const struct sam_context *context, const NT_USER_TOKEN *access_token, int32 *domain_count, DOM_SID **domains, char ***domain_names)
+NTSTATUS context_sam_enum_domains(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, int32 *domain_count, DOM_SID **domains, char ***domain_names)
{
- struct sam_methods *tmp_methods;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
- SEC_DESC *sd;
- size_t sd_size;
- uint32 acc_granted;
- int i = 0;
+ SEC_DESC *sd;
+ size_t sd_size;
+ uint32 acc_granted;
+ int i = 0;
DEBUG(5,("context_sam_enum_domains: %d\n", __LINE__));
@@ -288,14 +287,14 @@ NTSTATUS context_sam_enum_domains(const struct sam_context *context, const NT_US
return NT_STATUS_OK;
}
-NTSTATUS context_sam_lookup_domain(const struct sam_context *context, const NT_USER_TOKEN *access_token, const char *domain, DOM_SID **domainsid)
+NTSTATUS context_sam_lookup_domain(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const char *domain, DOM_SID **domainsid)
{
- struct sam_methods *tmp_methods;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
- SEC_DESC *sd;
- size_t sd_size;
- uint32 acc_granted;
+ SEC_DESC *sd;
+ size_t sd_size;
+ uint32 acc_granted;
DEBUG(5,("context_sam_lookup_domain: %d\n", __LINE__));
@@ -329,10 +328,10 @@ NTSTATUS context_sam_lookup_domain(const struct sam_context *context, const NT_U
}
-NTSTATUS context_sam_get_domain_by_sid(const struct sam_context *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *domainsid, SAM_DOMAIN_HANDLE **domain)
+NTSTATUS context_sam_get_domain_by_sid(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *domainsid, SAM_DOMAIN_HANDLE **domain)
{
- struct sam_methods *tmp_methods;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
DEBUG(5,("context_sam_get_domain_by_sid: %d\n", __LINE__));
@@ -355,25 +354,25 @@ NTSTATUS context_sam_get_domain_by_sid(const struct sam_context *context, const
return NT_STATUS_OK;
}
-NTSTATUS context_sam_create_user(const struct sam_context *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, DOM_SID *domainsid, SAM_USER_HANDLE **user)
+NTSTATUS context_sam_create_account(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, DOM_SID *domainsid, SAM_ACCOUNT_HANDLE **account)
{
- struct sam_methods *tmp_methods;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
- DEBUG(5,("context_sam_create_user: %d\n", __LINE__));
+ DEBUG(5,("context_sam_create_account: %d\n", __LINE__));
if (!NT_STATUS_IS_OK(nt_status = sam_get_methods_by_sid(context, &tmp_methods, domainsid))) {
DEBUG(4,("sam_get_methods_by_sid failed\n"));
return nt_status;
}
- if (!tmp_methods->sam_create_user) {
- DEBUG(3, ("context_sam_create_user: sam_methods of the domain did not specify sam_create_user\n"));
+ if (!tmp_methods->sam_create_account) {
+ DEBUG(3, ("context_sam_create_account: sam_methods of the domain did not specify sam_create_account\n"));
return NT_STATUS_NOT_IMPLEMENTED;
}
- if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_create_user(tmp_methods, access_token, access_desired, user))) {
- DEBUG(4,("context_sam_create_user in backend %s failed\n",
+ if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_create_account(tmp_methods, access_token, access_desired, account))) {
+ DEBUG(4,("context_sam_create_account in backend %s failed\n",
tmp_methods->backendname));
return nt_status;
}
@@ -381,139 +380,139 @@ NTSTATUS context_sam_create_user(const struct sam_context *context, const NT_USE
return NT_STATUS_OK;
}
-NTSTATUS context_sam_add_user(const struct sam_context *context, const SAM_USER_HANDLE *user)
+NTSTATUS context_sam_add_account(const SAM_CONTEXT *context, const SAM_ACCOUNT_HANDLE *account)
{
DOM_SID domainsid;
- DOM_SID *usersid;
- struct sam_methods *tmp_methods;
+ DOM_SID *accountsid;
+ SAM_METHODS *tmp_methods;
uint32 rid;
- NTSTATUS status;
+ NTSTATUS nt_status;
- if (!NT_STATUS_IS_OK(status = sam_get_user_sid(user, &usersid))) {
- DEBUG(0,("Can't get user SID\n"));
- return status;
+ if (!NT_STATUS_IS_OK(nt_status = sam_get_account_sid(account, &accountsid))) {
+ DEBUG(0,("Can't get account SID\n"));
+ return nt_status;
}
- sid_copy(&domainsid, usersid);
+ sid_copy(&domainsid, accountsid);
if (!sid_split_rid(&domainsid, &rid)) {
- DEBUG(3,("context_sam_get_user_by_sid: failed to split the sid\n"));
+ DEBUG(3,("context_sam_get_account_by_sid: failed to split the sid\n"));
return NT_STATUS_INVALID_SID;
}
- if (!NT_STATUS_IS_OK(status = sam_get_methods_by_sid(context, &tmp_methods, &domainsid))) {
+ if (!NT_STATUS_IS_OK(nt_status = sam_get_methods_by_sid(context, &tmp_methods, &domainsid))) {
DEBUG(4,("sam_get_methods_by_sid failed\n"));
- return status;
+ return nt_status;
}
- if (!tmp_methods->sam_add_user) {
- DEBUG(3, ("context_sam_add_user: sam_methods of the domain did not specify sam_add_user\n"));
+ if (!tmp_methods->sam_add_account) {
+ DEBUG(3, ("context_sam_add_account: sam_methods of the domain did not specify sam_add_account\n"));
return NT_STATUS_NOT_IMPLEMENTED;
}
- if (!NT_STATUS_IS_OK(status = tmp_methods->sam_add_user(tmp_methods, user))){
- DEBUG(4,("context_sam_add_user in backend %s failed\n",
+ if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_add_account(tmp_methods, account))){
+ DEBUG(4,("context_sam_add_account in backend %s failed\n",
tmp_methods->backendname));
- return status;
+ return nt_status;
}
return NT_STATUS_OK;
}
-NTSTATUS context_sam_update_user(const struct sam_context *context, const SAM_USER_HANDLE *user)
+NTSTATUS context_sam_update_account(const SAM_CONTEXT *context, const SAM_ACCOUNT_HANDLE *account)
{
DOM_SID domainsid;
- struct sam_methods *tmp_methods;
- DOM_SID *usersid;
+ SAM_METHODS *tmp_methods;
+ DOM_SID *accountsid;
uint32 rid;
- NTSTATUS status;
+ NTSTATUS nt_status;
- if (!NT_STATUS_IS_OK(status = sam_get_user_sid(user, &usersid))) {
- DEBUG(0,("Can't get user SID\n"));
- return status;
+ if (!NT_STATUS_IS_OK(nt_status = sam_get_account_sid(account, &accountsid))) {
+ DEBUG(0,("Can't get account SID\n"));
+ return nt_status;
}
- sid_copy(&domainsid, usersid);
+ sid_copy(&domainsid, accountsid);
if (!sid_split_rid(&domainsid, &rid)) {
- DEBUG(3,("context_sam_get_user_by_sid: failed to split the sid\n"));
+ DEBUG(3,("context_sam_get_account_by_sid: failed to split the sid\n"));
return NT_STATUS_INVALID_SID;
}
- if (!NT_STATUS_IS_OK(status = sam_get_methods_by_sid(context, &tmp_methods, &domainsid))) {
+ if (!NT_STATUS_IS_OK(nt_status = sam_get_methods_by_sid(context, &tmp_methods, &domainsid))) {
DEBUG(4,("sam_get_methods_by_sid failed\n"));
- return status;
+ return nt_status;
}
- if (!tmp_methods->sam_update_user) {
- DEBUG(3, ("context_sam_update_user: sam_methods of the domain did not specify sam_update_user\n"));
+ if (!tmp_methods->sam_update_account) {
+ DEBUG(3, ("context_sam_update_account: sam_methods of the domain did not specify sam_update_account\n"));
return NT_STATUS_NOT_IMPLEMENTED;
}
- if (!NT_STATUS_IS_OK(status = tmp_methods->sam_update_user(tmp_methods, user))){
- DEBUG(4,("context_sam_update_user in backend %s failed\n",
+ if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_update_account(tmp_methods, account))){
+ DEBUG(4,("context_sam_update_account in backend %s failed\n",
tmp_methods->backendname));
- return status;
+ return nt_status;
}
return NT_STATUS_OK;
}
-NTSTATUS context_sam_delete_user(const struct sam_context *context, SAM_USER_HANDLE *user)
+NTSTATUS context_sam_delete_account(const SAM_CONTEXT *context, const SAM_ACCOUNT_HANDLE *account)
{
DOM_SID domainsid;
- struct sam_methods *tmp_methods;
- DOM_SID *usersid;
+ SAM_METHODS *tmp_methods;
+ DOM_SID *accountsid;
uint32 rid;
- NTSTATUS status;
+ NTSTATUS nt_status;
- if (!NT_STATUS_IS_OK(status = sam_get_user_sid(user, &usersid))) {
- DEBUG(0,("Can't get user SID\n"));
- return status;
+ if (!NT_STATUS_IS_OK(nt_status = sam_get_account_sid(account, &accountsid))) {
+ DEBUG(0,("Can't get account SID\n"));
+ return nt_status;
}
- sid_copy(&domainsid, usersid);
+ sid_copy(&domainsid, accountsid);
if (!sid_split_rid(&domainsid, &rid)) {
- DEBUG(3,("context_sam_get_user_by_sid: failed to split the sid\n"));
+ DEBUG(3,("context_sam_get_account_by_sid: failed to split the sid\n"));
return NT_STATUS_INVALID_SID;
}
- if (!NT_STATUS_IS_OK(status = sam_get_methods_by_sid(context, &tmp_methods, &domainsid))) {
+ if (!NT_STATUS_IS_OK(nt_status = sam_get_methods_by_sid(context, &tmp_methods, &domainsid))) {
DEBUG(4,("sam_get_methods_by_sid failed\n"));
- return status;
+ return nt_status;
}
- if (!tmp_methods->sam_delete_user) {
- DEBUG(3, ("context_sam_delete_user: sam_methods of the domain did not specify sam_delete_user\n"));
+ if (!tmp_methods->sam_delete_account) {
+ DEBUG(3, ("context_sam_delete_account: sam_methods of the domain did not specify sam_delete_account\n"));
return NT_STATUS_NOT_IMPLEMENTED;
}
- if (!NT_STATUS_IS_OK(status = tmp_methods->sam_delete_user(tmp_methods, user))){
- DEBUG(4,("context_sam_delete_user in backend %s failed\n",
+ if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_delete_account(tmp_methods, account))){
+ DEBUG(4,("context_sam_delete_account in backend %s failed\n",
tmp_methods->backendname));
- return status;
+ return nt_status;
}
return NT_STATUS_OK;
}
-NTSTATUS context_sam_enum_users(const struct sam_context *context, const NT_USER_TOKEN *access_token, const DOM_SID *domainsid, int32 *user_count, SAM_USER_ENUM **users)
+NTSTATUS context_sam_enum_accounts(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const DOM_SID *domainsid, int32 *account_count, SAM_ACCOUNT_ENUM **accounts)
{
- struct sam_methods *tmp_methods;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
- DEBUG(5,("context_sam_enum_users: %d\n", __LINE__));
+ DEBUG(5,("context_sam_enum_accounts: %d\n", __LINE__));
if (!NT_STATUS_IS_OK(nt_status = sam_get_methods_by_sid(context, &tmp_methods, domainsid))) {
DEBUG(4,("sam_get_methods_by_sid failed\n"));
return nt_status;
}
- if (!tmp_methods->sam_enum_users) {
- DEBUG(3, ("context_sam_enum_users: sam_methods of the domain did not specify sam_enum_users\n"));
+ if (!tmp_methods->sam_enum_accounts) {
+ DEBUG(3, ("context_sam_enum_accounts: sam_methods of the domain did not specify sam_enum_accounts\n"));
return NT_STATUS_NOT_IMPLEMENTED;
}
- if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_enum_users(tmp_methods, access_token, user_count, users))) {
- DEBUG(4,("context_sam_enum_users for domain %s in backend %s failed\n",
+ if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_enum_accounts(tmp_methods, access_token, account_count, accounts))) {
+ DEBUG(4,("context_sam_enum_accounts for domain %s in backend %s failed\n",
tmp_methods->domain->private.name, tmp_methods->backendname));
return nt_status;
}
@@ -522,18 +521,18 @@ NTSTATUS context_sam_enum_users(const struct sam_context *context, const NT_USER
}
-NTSTATUS context_sam_get_user_by_sid(const struct sam_context *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *usersid, SAM_USER_HANDLE **user)
+NTSTATUS context_sam_get_account_by_sid(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *accountsid, SAM_ACCOUNT_HANDLE **account)
{
- struct sam_methods *tmp_methods;
- uint32 rid;
- DOM_SID domainsid;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ uint32 rid;
+ DOM_SID domainsid;
+ NTSTATUS nt_status;
- DEBUG(5,("context_sam_get_user_by_sid: %d\n", __LINE__));
+ DEBUG(5,("context_sam_get_account_by_sid: %d\n", __LINE__));
- sid_copy(&domainsid, usersid);
+ sid_copy(&domainsid, accountsid);
if (!sid_split_rid(&domainsid, &rid)) {
- DEBUG(3,("context_sam_get_user_by_sid: failed to split the sid\n"));
+ DEBUG(3,("context_sam_get_account_by_sid: failed to split the sid\n"));
return NT_STATUS_INVALID_SID;
}
@@ -543,39 +542,39 @@ NTSTATUS context_sam_get_user_by_sid(const struct sam_context *context, const NT
return nt_status;
}
- if (!tmp_methods->sam_get_user_by_sid) {
- DEBUG(3, ("context_sam_get_user_by_sid: sam_methods of the domain did not specify sam_get_user_by_sid\n"));
+ if (!tmp_methods->sam_get_account_by_sid) {
+ DEBUG(3, ("context_sam_get_account_by_sid: sam_methods of the domain did not specify sam_get_account_by_sid\n"));
return NT_STATUS_NOT_IMPLEMENTED;
}
- if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_get_user_by_sid(tmp_methods, access_token, access_desired, usersid, user))) {
- DEBUG(4,("context_sam_get_user_by_sid for %s in backend %s failed\n",
- sid_string_static(usersid), tmp_methods->backendname));
+ if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_get_account_by_sid(tmp_methods, access_token, access_desired, accountsid, account))) {
+ DEBUG(4,("context_sam_get_account_by_sid for %s in backend %s failed\n",
+ sid_string_static(accountsid), tmp_methods->backendname));
return nt_status;
}
return NT_STATUS_OK;
}
-NTSTATUS context_sam_get_user_by_name(const struct sam_context *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const char *domain, const char *name, SAM_USER_HANDLE **user)
+NTSTATUS context_sam_get_account_by_name(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const char *domain, const char *name, SAM_ACCOUNT_HANDLE **account)
{
- struct sam_methods *tmp_methods;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
- DEBUG(5,("context_sam_get_user_by_name: %d\n", __LINE__));
+ DEBUG(5,("context_sam_get_account_by_name: %d\n", __LINE__));
if (!NT_STATUS_IS_OK(nt_status = sam_get_methods_by_name(context, &tmp_methods, domain))) {
DEBUG(4,("sam_get_methods_by_name failed\n"));
return nt_status;
}
- if (!tmp_methods->sam_get_user_by_name) {
- DEBUG(3, ("context_sam_get_user_by_name: sam_methods of the domain did not specify sam_get_user_by_name\n"));
+ if (!tmp_methods->sam_get_account_by_name) {
+ DEBUG(3, ("context_sam_get_account_by_name: sam_methods of the domain did not specify sam_get_account_by_name\n"));
return NT_STATUS_NOT_IMPLEMENTED;
}
- if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_get_user_by_name(tmp_methods, access_token, access_desired, name, user))) {
- DEBUG(4,("context_sam_get_user_by_name for %s\\%s in backend %s failed\n",
+ if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_get_account_by_name(tmp_methods, access_token, access_desired, name, account))) {
+ DEBUG(4,("context_sam_get_account_by_name for %s\\%s in backend %s failed\n",
domain, name, tmp_methods->backendname));
return nt_status;
}
@@ -583,10 +582,10 @@ NTSTATUS context_sam_get_user_by_name(const struct sam_context *context, const N
return NT_STATUS_OK;
}
-NTSTATUS context_sam_create_group(const struct sam_context *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const uint32 type, DOM_SID *sid, SAM_GROUP_HANDLE **group)
+NTSTATUS context_sam_create_group(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const uint32 type, DOM_SID *sid, SAM_GROUP_HANDLE **group)
{
- struct sam_methods *tmp_methods;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
DEBUG(5,("context_sam_create_group: %d\n", __LINE__));
@@ -609,17 +608,17 @@ NTSTATUS context_sam_create_group(const struct sam_context *context, const NT_US
return NT_STATUS_OK;
}
-NTSTATUS context_sam_add_group(const struct sam_context *context, const SAM_GROUP_HANDLE *group)
+NTSTATUS context_sam_add_group(const SAM_CONTEXT *context, const SAM_GROUP_HANDLE *group)
{
DOM_SID domainsid;
DOM_SID *groupsid;
- struct sam_methods *tmp_methods;
+ SAM_METHODS *tmp_methods;
uint32 rid;
- NTSTATUS status;
+ NTSTATUS nt_status;
- if (!NT_STATUS_IS_OK(status = sam_get_group_sid(group, &groupsid))) {
+ if (!NT_STATUS_IS_OK(nt_status = sam_get_group_sid(group, &groupsid))) {
DEBUG(0,("Can't get group SID\n"));
- return status;
+ return nt_status;
}
sid_copy(&domainsid, groupsid);
@@ -628,9 +627,9 @@ NTSTATUS context_sam_add_group(const struct sam_context *context, const SAM_GROU
return NT_STATUS_INVALID_SID;
}
- if (!NT_STATUS_IS_OK(status = sam_get_methods_by_sid(context, &tmp_methods, &domainsid))) {
+ if (!NT_STATUS_IS_OK(nt_status = sam_get_methods_by_sid(context, &tmp_methods, &domainsid))) {
DEBUG(4,("sam_get_methods_by_sid failed\n"));
- return status;
+ return nt_status;
}
if (!tmp_methods->sam_add_group) {
@@ -638,16 +637,16 @@ NTSTATUS context_sam_add_group(const struct sam_context *context, const SAM_GROU
return NT_STATUS_NOT_IMPLEMENTED;
}
- if (!NT_STATUS_IS_OK(status = tmp_methods->sam_add_group(tmp_methods, group))){
+ if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_add_group(tmp_methods, group))){
DEBUG(4,("context_sam_add_group in backend %s failed\n",
tmp_methods->backendname));
- return status;
+ return nt_status;
}
return NT_STATUS_OK;
}
-NTSTATUS context_sam_update_group(const struct sam_context *context, const DOM_SID *domainsid, const SAM_GROUP_HANDLE *group)
+NTSTATUS context_sam_update_group(const SAM_CONTEXT *context, const DOM_SID *domainsid, const SAM_GROUP_HANDLE *group)
{
DOM_SID domainsid;
DOM_SID *groupsid;
@@ -676,26 +675,26 @@ NTSTATUS context_sam_update_group(const struct sam_context *context, const DOM_S
return NT_STATUS_NOT_IMPLEMENTED;
}
- if (!NT_STATUS_IS_OK(status = tmp_methods->sam_update_group(tmp_methods, group))){
+ if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_update_group(tmp_methods, group))){
DEBUG(4,("context_sam_update_group in backend %s failed\n",
tmp_methods->backendname));
- return status;
+ return nt_status;
}
return NT_STATUS_OK;
}
-NTSTATUS context_sam_delete_group(const struct sam_context *context, SAM_GROUP_HANDLE **groupsid)
+NTSTATUS context_sam_delete_group(const SAM_CONTEXT *context, const SAM_GROUP_HANDLE *group)
{
DOM_SID domainsid;
- struct sam_methods *tmp_methods;
+ SAM_METHODS *tmp_methods;
DOM_SID *groupsid;
uint32 rid;
- NTSTATUS status;
+ NTSTATUS nt_status;
- if (!NT_STATUS_IS_OK(status = sam_get_group_sid(group, &groupsid))) {
+ if (!NT_STATUS_IS_OK(nt_status = sam_get_group_sid(group, &groupsid))) {
DEBUG(0,("Can't get group SID\n"));
- return status;
+ return nt_status;
}
sid_copy(&domainsid, groupsid);
@@ -704,9 +703,9 @@ NTSTATUS context_sam_delete_group(const struct sam_context *context, SAM_GROUP_H
return NT_STATUS_INVALID_SID;
}
- if (!NT_STATUS_IS_OK(status = sam_get_methods_by_sid(context, &tmp_methods, &domainsid))) {
+ if (!NT_STATUS_IS_OK(nt_status = sam_get_methods_by_sid(context, &tmp_methods, &domainsid))) {
DEBUG(4,("sam_get_methods_by_sid failed\n"));
- return status;
+ return nt_status;
}
if (!tmp_methods->sam_delete_group) {
@@ -714,19 +713,19 @@ NTSTATUS context_sam_delete_group(const struct sam_context *context, SAM_GROUP_H
return NT_STATUS_NOT_IMPLEMENTED;
}
- if (!NT_STATUS_IS_OK(status = tmp_methods->sam_delete_group(tmp_methods, group))){
+ if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_delete_group(tmp_methods, group))){
DEBUG(4,("context_sam_delete_group in backend %s failed\n",
tmp_methods->backendname));
- return status;
+ return nt_status;
}
return NT_STATUS_OK;
}
-NTSTATUS context_sam_enum_groups(const struct sam_context *context, const NT_USER_TOKEN *access_token, const DOM_SID *domainsid, const uint32 type, uint32 *groups_count, SAM_GROUP_ENUM **groups)
+NTSTATUS context_sam_enum_groups(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const DOM_SID *domainsid, const uint32 type, uint32 *groups_count, SAM_GROUP_ENUM **groups)
{
- struct sam_methods *tmp_methods;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
DEBUG(5,("context_sam_enum_groups: %d\n", __LINE__));
@@ -735,7 +734,7 @@ NTSTATUS context_sam_enum_groups(const struct sam_context *context, const NT_USE
return nt_status;
}
- if (!tmp_methods->sam_enum_users) {
+ if (!tmp_methods->sam_enum_accounts) {
DEBUG(3, ("context_sam_enum_groups: sam_methods of the domain did not specify sam_enum_groups\n"));
return NT_STATUS_NOT_IMPLEMENTED;
}
@@ -749,12 +748,12 @@ NTSTATUS context_sam_enum_groups(const struct sam_context *context, const NT_USE
return NT_STATUS_OK;
}
-NTSTATUS context_sam_get_group_by_sid(const struct sam_context *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *groupsid, SAM_GROUP_HANDLE **group)
+NTSTATUS context_sam_get_group_by_sid(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *groupsid, SAM_GROUP_HANDLE **group)
{
- struct sam_methods *tmp_methods;
- uint32 rid;
- NTSTATUS nt_status;
- DOM_SID domainsid;
+ SAM_METHODS *tmp_methods;
+ uint32 rid;
+ NTSTATUS nt_status;
+ DOM_SID domainsid;
DEBUG(5,("context_sam_get_group_by_sid: %d\n", __LINE__));
@@ -784,10 +783,10 @@ NTSTATUS context_sam_get_group_by_sid(const struct sam_context *context, const N
return NT_STATUS_OK;
}
-NTSTATUS context_sam_get_group_by_name(const struct sam_context *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const char *domain, const char *name, SAM_GROUP_HANDLE **group)
+NTSTATUS context_sam_get_group_by_name(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, const uint32 access_desired, const char *domain, const char *name, SAM_GROUP_HANDLE **group)
{
- struct sam_methods *tmp_methods;
- NTSTATUS nt_status;
+ SAM_METHODS *tmp_methods;
+ NTSTATUS nt_status;
DEBUG(5,("context_sam_get_group_by_name: %d\n", __LINE__));
@@ -810,21 +809,21 @@ NTSTATUS context_sam_get_group_by_name(const struct sam_context *context, const
return NT_STATUS_OK;
}
-NTSTATUS context_sam_add_member_to_group(const struct sam_context *context, SAM_GROUP_HANDLE *group, SAM_GROUP_MEMBER *member)
+NTSTATUS context_sam_add_member_to_group(const SAM_CONTEXT *context, const SAM_GROUP_HANDLE *group, const SAM_GROUP_MEMBER *member)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS context_sam_delete_member_from_group(const struct sam_context *context, SAM_GROUP_HANDLE *group, SAM_GROUP_MEMBER *member)
+NTSTATUS context_sam_delete_member_from_group(const SAM_CONTEXT *context, const SAM_GROUP_HANDLE *group, const SAM_GROUP_MEMBER *member)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS context_sam_enum_groupmembers(const struct sam_context *context, const SAM_GROUP_HANDLE *group, uint32 *members_count, SAM_GROUP_MEMBER **members)
+NTSTATUS context_sam_enum_groupmembers(const SAM_CONTEXT *context, const SAM_GROUP_HANDLE *group, uint32 *members_count, SAM_GROUP_MEMBER **members)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS context_sam_get_groups_of_user(const struct sam_context *context, const SAM_USER_HANDLE *user, const uint32 type, uint32 *group_count, SAM_GROUP_ENUM **groups)
+NTSTATUS context_sam_get_groups_of_account(const SAM_CONTEXT *context, const SAM_ACCOUNT_HANDLE *account, const uint32 type, uint32 *group_count, SAM_GROUP_ENUM **groups)
{
return NT_STATUS_NOT_IMPLEMENTED;
}
@@ -835,9 +834,9 @@ NTSTATUS context_sam_get_groups_of_user(const struct sam_context *context, const
that the attached modules might have associated.
*******************************************************************/
-void free_sam_context(struct sam_context **context)
+void free_sam_context(SAM_CONTEXT **context)
{
- struct sam_methods *sam_selected = (*context)->methods;
+ SAM_METHODS *sam_selected = (*context)->methods;
while (sam_selected){
if (sam_selected->free_private_data) {
@@ -854,10 +853,10 @@ void free_sam_context(struct sam_context **context)
Make a sam_methods from scratch
*******************************************************************/
-NTSTATUS make_sam_context_list(struct sam_context **context, char **selected)
+NTSTATUS make_sam_context_list(SAM_CONTEXT **context, char **selected)
{
int i = 0;
- struct sam_methods *curmethods, *tmpmethods;
+ SAM_METHODS *curmethods, *tmpmethods;
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
if (!NT_STATUS_IS_OK(nt_status = make_sam_context(context))) {
@@ -878,7 +877,7 @@ NTSTATUS make_sam_context_list(struct sam_context **context, char **selected)
return NT_STATUS_OK;
}
-NTSTATUS make_sam_methods_name(struct sam_methods **methods, struct sam_context *context, const char *selected)
+NTSTATUS make_sam_methods_name(SAM_METHODS **methods, SAM_CONTEXT *context, const char *selected)
{
char *module_name = smb_xstrdup(selected);
char *module_location = NULL, *p;
@@ -922,7 +921,7 @@ NTSTATUS make_sam_methods_name(struct sam_methods **methods, struct sam_context
Make a sam_context from scratch.
*******************************************************************/
-NTSTATUS make_sam_context(struct sam_context **context)
+NTSTATUS make_sam_context(SAM_CONTEXT **context)
{
TALLOC_CTX *mem_ctx;
@@ -958,7 +957,7 @@ NTSTATUS make_sam_context(struct sam_context **context)
struct sam_context *sam_get_static_context(BOOL reload)
{
- static struct sam_context *sam_context = NULL;
+ static SAM_CONTEXT *sam_context = NULL;
if ((sam_context) && (reload)) {
sam_context->free_fn(&sam_context);
@@ -990,7 +989,7 @@ BOOL initialize_sam(BOOL reload)
NTSTATUS make_sam_methods(TALLOC_CTX *mem_ctx, SAM_METHODS **methods)
{
- *methods = talloc(mem_ctx, sizeof(struct sam_methods));
+ *methods = talloc(mem_ctx, sizeof(SAM_METHODS));
if (!*methods) {
return NT_STATUS_NO_MEMORY;