summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-07-16 11:55:09 +0200
committerGünther Deschner <gd@samba.org>2011-02-16 11:35:20 +0100
commit387e37efcec387a1b13014e8bcf9bd8e7786f632 (patch)
treef4e3bd52a601608d8c38644add85c7c00e305181 /source3/rpc_server
parent39c9f59dbab09fb2ce12218dfe798c169e450490 (diff)
downloadsamba-387e37efcec387a1b13014e8bcf9bd8e7786f632.tar.gz
samba-387e37efcec387a1b13014e8bcf9bd8e7786f632.tar.bz2
samba-387e37efcec387a1b13014e8bcf9bd8e7786f632.zip
s3-lsa: add lsa_lookup_trusted_domain_by_name and lsa_lookup_trusted_domain_by_sid.
Guenther Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/lsa/srv_lsa_nt.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c
index 1a43b197aa..4e504cb221 100644
--- a/source3/rpc_server/lsa/srv_lsa_nt.c
+++ b/source3/rpc_server/lsa/srv_lsa_nt.c
@@ -1411,6 +1411,66 @@ NTSTATUS _lsa_Close(struct pipes_struct *p, struct lsa_Close *r)
/***************************************************************************
***************************************************************************/
+static NTSTATUS lsa_lookup_trusted_domain_by_sid(TALLOC_CTX *mem_ctx,
+ const struct dom_sid *sid,
+ struct trustdom_info **info)
+{
+ NTSTATUS status;
+ uint32_t num_domains = 0;
+ struct trustdom_info **domains = NULL;
+ int i;
+
+ status = pdb_enum_trusteddoms(mem_ctx, &num_domains, &domains);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ for (i=0; i < num_domains; i++) {
+ if (dom_sid_equal(&domains[i]->sid, sid)) {
+ break;
+ }
+ }
+
+ if (i == num_domains) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ *info = domains[i];
+
+ return NT_STATUS_OK;
+}
+
+/***************************************************************************
+ ***************************************************************************/
+
+static NTSTATUS lsa_lookup_trusted_domain_by_name(TALLOC_CTX *mem_ctx,
+ const char *netbios_domain_name,
+ struct trustdom_info **info_p)
+{
+ struct dom_sid sid;
+ struct trustdom_info *info;
+
+ if (!pdb_get_trusteddom_pw(netbios_domain_name, NULL, &sid, NULL)) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ info = talloc(mem_ctx, struct trustdom_info);
+ if (!info) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ info->name = talloc_strdup(info, netbios_domain_name);
+ NT_STATUS_HAVE_NO_MEMORY(info->name);
+ info->sid = sid;
+
+ *info_p = info;
+
+ return NT_STATUS_OK;
+}
+
+/***************************************************************************
+ ***************************************************************************/
+
NTSTATUS _lsa_OpenSecret(struct pipes_struct *p, struct lsa_OpenSecret *r)
{
return NT_STATUS_OBJECT_NAME_NOT_FOUND;