s3-lsa: implement _lsa_LookupPrivName().
authorGünther Deschner <gd@samba.org>
Thu, 16 Jul 2009 16:32:53 +0000 (18:32 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 16 Jul 2009 22:12:56 +0000 (00:12 +0200)
Guenther

source3/rpc_server/srv_lsa_nt.c

index f5cfc538400213dbe43bef70fb1fd5cd4a8773e6..1243787503181d6b88c7e045ac0992a266cb81a8 100644 (file)
@@ -1916,6 +1916,51 @@ NTSTATUS _lsa_RemovePrivilegesFromAccount(pipes_struct *p,
        return NT_STATUS_OK;
 }
 
        return NT_STATUS_OK;
 }
 
+/***************************************************************************
+ _lsa_LookupPrivName
+ ***************************************************************************/
+
+NTSTATUS _lsa_LookupPrivName(pipes_struct *p,
+                            struct lsa_LookupPrivName *r)
+{
+       struct lsa_info *info = NULL;
+       const char *name;
+       struct lsa_StringLarge *lsa_name;
+
+       /* find the connection policy handle. */
+       if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info)) {
+               return NT_STATUS_INVALID_HANDLE;
+       }
+
+       if (info->type != LSA_HANDLE_POLICY_TYPE) {
+               return NT_STATUS_INVALID_HANDLE;
+       }
+
+       if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION)) {
+               return NT_STATUS_ACCESS_DENIED;
+       }
+
+       name = luid_to_privilege_name((LUID *)r->in.luid);
+       if (!name) {
+               return NT_STATUS_NO_SUCH_PRIVILEGE;
+       }
+
+       lsa_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_StringLarge);
+       if (!lsa_name) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       lsa_name->string = talloc_strdup(lsa_name, name);
+       if (!lsa_name->string) {
+               TALLOC_FREE(lsa_name);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       *r->out.name = lsa_name;
+
+       return NT_STATUS_OK;
+}
+
 /***************************************************************************
  _lsa_QuerySecurity
  ***************************************************************************/
 /***************************************************************************
  _lsa_QuerySecurity
  ***************************************************************************/
@@ -2369,12 +2414,6 @@ NTSTATUS _lsa_QuerySecret(pipes_struct *p, struct lsa_QuerySecret *r)
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r)
-{
-       p->rng_fault_state = True;
-       return NT_STATUS_NOT_IMPLEMENTED;
-}
-
 NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r)
 {
        p->rng_fault_state = True;
 NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r)
 {
        p->rng_fault_state = True;