diff options
author | Andrew Bartlett <abartlet@samba.org> | 2002-09-28 14:26:19 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2002-09-28 14:26:19 +0000 |
commit | 120e3854177a3e57308cb88a20611a97f60c6d44 (patch) | |
tree | b4b75a6b65651685a62424d085882842e6830fb0 /source3 | |
parent | ac625a8235bcee8f56d26899c6f0ad7b13deae9a (diff) | |
download | samba-120e3854177a3e57308cb88a20611a97f60c6d44.tar.gz samba-120e3854177a3e57308cb88a20611a97f60c6d44.tar.bz2 samba-120e3854177a3e57308cb88a20611a97f60c6d44.zip |
Back out one of the API changes, now I recall how it was meant to work.
(New accounts are created on thier internal talloc context, not a supplied one
and not the one beloning to the SAM)
Also actaully add the sam_skel to the tree.
I need to work out with Jelmer an appropriate way to ensure we still have an
example external build, and if this should move back out again.
Andrew Bartlett
(This used to be commit dc8b0d23e088d1e7f7fbc6ab0423eaa82f14e258)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/sam/api.c | 4 | ||||
-rw-r--r-- | source3/sam/interface.c | 6 | ||||
-rwxr-xr-x | source3/sam/sam_ads.c | 3 | ||||
-rw-r--r-- | source3/sam/sam_skel.c | 251 |
4 files changed, 258 insertions, 6 deletions
diff --git a/source3/sam/api.c b/source3/sam/api.c index 349c18787c..fd345592ce 100644 --- a/source3/sam/api.c +++ b/source3/sam/api.c @@ -120,7 +120,7 @@ NTSTATUS sam_get_domain_by_sid(const NT_USER_TOKEN *access_token, const uint32 a /* Account API */ -NTSTATUS sam_create_account(const NT_USER_TOKEN *access_token, const uint32 access_desired, TALLOC_CTX *mem_ctx, const DOM_SID *domainsid, const char *account_name, uint16 acct_ctrl, SAM_ACCOUNT_HANDLE **account) +NTSTATUS sam_create_account(const NT_USER_TOKEN *access_token, const uint32 access_desired, const DOM_SID *domainsid, const char *account_name, uint16 acct_ctrl, SAM_ACCOUNT_HANDLE **account) { SAM_CONTEXT *sam_context = sam_get_static_context(False); @@ -128,7 +128,7 @@ NTSTATUS sam_create_account(const NT_USER_TOKEN *access_token, const uint32 acce return NT_STATUS_UNSUCCESSFUL; } - return sam_context->sam_create_account(sam_context, access_token, access_desired, mem_ctx, domainsid, account_name, acct_ctrl, account); + return sam_context->sam_create_account(sam_context, access_token, access_desired, domainsid, account_name, acct_ctrl, account); } NTSTATUS sam_add_account(const DOM_SID *domainsid, const SAM_ACCOUNT_HANDLE *account) diff --git a/source3/sam/interface.c b/source3/sam/interface.c index 5d12cfc999..994e36606a 100644 --- a/source3/sam/interface.c +++ b/source3/sam/interface.c @@ -32,7 +32,9 @@ extern DOM_SID global_sid_Builtin; const struct sam_init_function_entry builtin_sam_init_functions[] = { { "plugin", sam_init_plugin }, +#ifdef HAVE_LDAP { "ads", sam_init_ads }, +#endif { "skel", sam_init_skel }, { NULL, NULL} }; @@ -356,7 +358,7 @@ NTSTATUS context_sam_get_domain_by_sid(const SAM_CONTEXT *context, const NT_USER return NT_STATUS_OK; } -NTSTATUS context_sam_create_account(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, uint32 access_desired, TALLOC_CTX *mem_ctx, const DOM_SID *domainsid, const char *account_name, uint16 acct_ctrl, SAM_ACCOUNT_HANDLE **account) +NTSTATUS context_sam_create_account(const SAM_CONTEXT *context, const NT_USER_TOKEN *access_token, uint32 access_desired, const DOM_SID *domainsid, const char *account_name, uint16 acct_ctrl, SAM_ACCOUNT_HANDLE **account) { SAM_METHODS *tmp_methods; NTSTATUS nt_status; @@ -373,7 +375,7 @@ NTSTATUS context_sam_create_account(const SAM_CONTEXT *context, const NT_USER_TO return NT_STATUS_NOT_IMPLEMENTED; } - if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_create_account(tmp_methods, access_token, access_desired, mem_ctx, account_name, acct_ctrl, account))) { + if (!NT_STATUS_IS_OK(nt_status = tmp_methods->sam_create_account(tmp_methods, access_token, access_desired, account_name, acct_ctrl, account))) { DEBUG(4,("sam_create_account in backend %s failed\n", tmp_methods->backendname)); return nt_status; diff --git a/source3/sam/sam_ads.c b/source3/sam/sam_ads.c index 7f2a901d81..cd24baa1bc 100755 --- a/source3/sam/sam_ads.c +++ b/source3/sam/sam_ads.c @@ -569,7 +569,6 @@ static NTSTATUS sam_ads_get_domain_handle(const SAM_METHODS *sam_method, const N /* Account API */ static NTSTATUS sam_ads_create_account(const SAM_METHODS *sam_method, const NT_USER_TOKEN *access_token, uint32 access_desired, - TALLOC_CTX *mem_ctx, const char *account_name, uint16 acct_ctrl, SAM_ACCOUNT_HANDLE **account) { ADS_STATUS ads_status = ADS_STATUS_NOT_IMPLEMENTED; @@ -586,7 +585,7 @@ static NTSTATUS sam_ads_create_account(const SAM_METHODS *sam_method, if (!ADS_ERR_OK(ads_status)) return ads_ntstatus(ads_status); - ads_status = ADS_ERROR_NT(sam_init_account_talloc(mem_ctx, account)); + ads_status = ADS_ERROR_NT(sam_init_account(account)); if (!ADS_ERR_OK(ads_status)) return ads_ntstatus(ads_status); diff --git a/source3/sam/sam_skel.c b/source3/sam/sam_skel.c new file mode 100644 index 0000000000..8073470716 --- /dev/null +++ b/source3/sam/sam_skel.c @@ -0,0 +1,251 @@ +/* + Unix SMB/CIFS implementation. + this is a skeleton for SAM backend modules. + + Copyright (C) Stefan (metze) Metzmacher 2002 + Copyright (C) Jelmer Vernooij 2002 + Copyright (C) Andrew Bartlett 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" + +static int sam_skel_debug_level = DBGC_SAM; + +#undef DBGC_CLASS +#define DBGC_CLASS sam_skel_debug_level + +/* define the version of the SAM interface */ +SAM_MODULE_VERSIONING_MAGIC + +/* General API */ + +static NTSTATUS sam_skel_get_sec_desc(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, const DOM_SID *sid, SEC_DESC **sd) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_set_sec_desc(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, const DOM_SID *sid, const SEC_DESC *sd) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + + +static NTSTATUS sam_skel_lookup_sid(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, TALLOC_CTX *mem_ctx, const DOM_SID *sid, char **name, uint32 *type) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_lookup_name(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, const char *name, DOM_SID *sid, uint32 *type) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* Domain API */ + +static NTSTATUS sam_skel_update_domain(const SAM_METHODS *sam_methods, const SAM_DOMAIN_HANDLE *domain) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_get_domain_handle(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, uint32 access_desired, SAM_DOMAIN_HANDLE **domain) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* Account API */ + +static NTSTATUS sam_skel_create_account(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, uint32 access_desired, const char *account_name, uint16 acct_ctrl, SAM_ACCOUNT_HANDLE **account) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_add_account(const SAM_METHODS *sam_methods, const SAM_ACCOUNT_HANDLE *account) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_update_account(const SAM_METHODS *sam_methods, const SAM_ACCOUNT_HANDLE *account) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_delete_account(const SAM_METHODS *sam_methods, const SAM_ACCOUNT_HANDLE *account) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_enum_accounts(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, uint16 acct_ctrl, uint32 *account_count, SAM_ACCOUNT_ENUM **accounts) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + + +static NTSTATUS sam_skel_get_account_by_sid(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, uint32 access_desired, const DOM_SID *accountsid, SAM_ACCOUNT_HANDLE **account) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_get_account_by_name(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, uint32 access_desired, const char *name, SAM_ACCOUNT_HANDLE **account) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* Group API */ + +static NTSTATUS sam_skel_create_group(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, uint32 access_desired, const char *account_name, uint16 group_ctrl, SAM_GROUP_HANDLE **group) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_add_group(const SAM_METHODS *sam_methods, const SAM_GROUP_HANDLE *group) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_update_group(const SAM_METHODS *sam_methods, const SAM_GROUP_HANDLE *group) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_delete_group(const SAM_METHODS *sam_methods, const SAM_GROUP_HANDLE *group) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_enum_groups(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, uint16 group_ctrl, uint32 *groups_count, SAM_GROUP_ENUM **groups) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_get_group_by_sid(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, uint32 access_desired, const DOM_SID *groupsid, SAM_GROUP_HANDLE **group) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_get_group_by_name(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, uint32 access_desired, const char *name, SAM_GROUP_HANDLE **group) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + + +static NTSTATUS sam_skel_add_member_to_group(const SAM_METHODS *sam_methods, const SAM_GROUP_HANDLE *group, const SAM_GROUP_MEMBER *member) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_delete_member_from_group(const SAM_METHODS *sam_methods, const SAM_GROUP_HANDLE *group, const SAM_GROUP_MEMBER *member) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +static NTSTATUS sam_skel_enum_groupmembers(const SAM_METHODS *sam_methods, const SAM_GROUP_HANDLE *group, uint32 *members_count, SAM_GROUP_MEMBER **members) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + + +static NTSTATUS sam_skel_get_groups_of_sid(const SAM_METHODS *sam_methods, const NT_USER_TOKEN *access_token, const DOM_SID **sids, uint16 group_ctrl, uint32 *group_count, SAM_GROUP_ENUM **groups) +{ + DEBUG(0,("sam_skel: %s was called!\n",__FUNCTION__)); + return NT_STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS sam_init_skel(SAM_METHODS *sam_methods, const char *module_params) +{ + /* Functions your SAM module doesn't provide should be set + * to NULL */ + + sam_methods->sam_get_sec_desc = sam_skel_get_sec_desc; + sam_methods->sam_set_sec_desc = sam_skel_set_sec_desc; + + sam_methods->sam_lookup_sid = sam_skel_lookup_sid; + sam_methods->sam_lookup_name = sam_skel_lookup_name; + + /* Domain API */ + + sam_methods->sam_update_domain = sam_skel_update_domain; + sam_methods->sam_get_domain_handle = sam_skel_get_domain_handle; + + /* Account API */ + + sam_methods->sam_create_account = sam_skel_create_account; + sam_methods->sam_add_account = sam_skel_add_account; + sam_methods->sam_update_account = sam_skel_update_account; + sam_methods->sam_delete_account = sam_skel_delete_account; + sam_methods->sam_enum_accounts = sam_skel_enum_accounts; + + sam_methods->sam_get_account_by_sid = sam_skel_get_account_by_sid; + sam_methods->sam_get_account_by_name = sam_skel_get_account_by_name; + + /* Group API */ + + sam_methods->sam_create_group = sam_skel_create_group; + sam_methods->sam_add_group = sam_skel_add_group; + sam_methods->sam_update_group = sam_skel_update_group; + sam_methods->sam_delete_group = sam_skel_delete_group; + sam_methods->sam_enum_groups = sam_skel_enum_groups; + sam_methods->sam_get_group_by_sid = sam_skel_get_group_by_sid; + sam_methods->sam_get_group_by_name = sam_skel_get_group_by_name; + + sam_methods->sam_add_member_to_group = sam_skel_add_member_to_group; + sam_methods->sam_delete_member_from_group = sam_skel_delete_member_from_group; + sam_methods->sam_enum_groupmembers = sam_skel_enum_groupmembers; + + sam_methods->sam_get_groups_of_sid = sam_skel_get_groups_of_sid; + + sam_methods->free_private_data = NULL; + + + sam_skel_debug_level = debug_add_class("sam_skel"); + if (sam_skel_debug_level == -1) { + sam_skel_debug_level = DBGC_SAM; + DEBUG(0, ("sam_skel: Couldn't register custom debugging class!\n")); + } else DEBUG(2, ("sam_skel: Debug class number of 'sam_skel': %d\n", sam_skel_debug_level)); + + if(module_params) + DEBUG(0, ("Starting 'sam_skel' with parameters '%s' for domain %s\n", module_params, sam_methods->domain_name)); + else + DEBUG(0, ("Starting 'sam_skel' for domain %s without paramters\n", sam_methods->domain_name)); + + return NT_STATUS_OK; +} |