s3-lsa: implement _lsa_DeleteTrustedDomain().
authorGünther Deschner <gd@samba.org>
Thu, 16 Jul 2009 00:27:51 +0000 (02:27 +0200)
committerGünther Deschner <gd@samba.org>
Wed, 16 Feb 2011 10:43:28 +0000 (11:43 +0100)
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
source3/rpc_server/lsa/srv_lsa_nt.c

index 8a70a987d6b92643bbd77cc026fc8ea67b4f7c2d..4a8da2f092bf30f25b8c83d2610add4867251f63 100644 (file)
@@ -1622,6 +1622,44 @@ NTSTATUS _lsa_CreateTrustedDomain(struct pipes_struct *p,
        return _lsa_CreateTrustedDomainEx2(p, &c);
 }
 
+/***************************************************************************
+ _lsa_DeleteTrustedDomain
+ ***************************************************************************/
+
+NTSTATUS _lsa_DeleteTrustedDomain(struct pipes_struct *p,
+                                 struct lsa_DeleteTrustedDomain *r)
+{
+       NTSTATUS status;
+       struct lsa_info *handle;
+       struct trustdom_info *info;
+
+       /* find the connection policy handle. */
+       if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle)) {
+               return NT_STATUS_INVALID_HANDLE;
+       }
+
+       if (handle->type != LSA_HANDLE_POLICY_TYPE) {
+               return NT_STATUS_INVALID_HANDLE;
+       }
+
+       if (!(handle->access & LSA_POLICY_TRUST_ADMIN)) {
+               return NT_STATUS_ACCESS_DENIED;
+       }
+
+       status = lsa_lookup_trusted_domain_by_sid(p->mem_ctx,
+                                                 r->in.dom_sid,
+                                                 &info);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (!pdb_del_trusteddom_pw(info->name)) {
+               return NT_STATUS_NO_TRUST_LSA_SECRET;
+       }
+
+       return NT_STATUS_OK;
+}
+
 /***************************************************************************
  ***************************************************************************/
 
@@ -2753,13 +2791,6 @@ NTSTATUS _lsa_SetTrustedDomainInfo(struct pipes_struct *p,
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-NTSTATUS _lsa_DeleteTrustedDomain(struct pipes_struct *p,
-                                 struct lsa_DeleteTrustedDomain *r)
-{
-       p->rng_fault_state = True;
-       return NT_STATUS_NOT_IMPLEMENTED;
-}
-
 NTSTATUS _lsa_StorePrivateData(struct pipes_struct *p,
                               struct lsa_StorePrivateData *r)
 {