r4194: added server side implementation of lsa_EnumPrivs
authorAndrew Tridgell <tridge@samba.org>
Tue, 14 Dec 2004 05:20:38 +0000 (05:20 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:07:24 +0000 (13:07 -0500)
source/rpc_server/lsa/dcesrv_lsa.c

index 234071b523a9ef8186eff4fcdfd99c3b24244f49..8ebbca51866d2bbf8dfb3b7d1f3b67d8ffd43cbf 100644 (file)
@@ -98,7 +98,40 @@ static NTSTATUS lsa_Delete(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_c
 static NTSTATUS lsa_EnumPrivs(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                              struct lsa_EnumPrivs *r)
 {
 static NTSTATUS lsa_EnumPrivs(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                              struct lsa_EnumPrivs *r)
 {
-       DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+       struct dcesrv_handle *h;
+       struct lsa_policy_state *state;
+       int i;
+       const char *privname;
+
+       DCESRV_PULL_HANDLE(h, r->in.handle, LSA_HANDLE_POLICY);
+
+       state = h->data;
+
+       i = *r->in.resume_handle;
+       if (i == 0) i = 1;
+
+       while ((privname = sec_privilege_name(i)) &&
+              r->out.privs->count < r->in.max_count) {
+               struct lsa_PrivEntry *e;
+
+               r->out.privs->privs = talloc_realloc_p(r->out.privs,
+                                                      r->out.privs->privs, 
+                                                      struct lsa_PrivEntry, 
+                                                      r->out.privs->count+1);
+               if (r->out.privs->privs == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+               e = &r->out.privs->privs[r->out.privs->count];
+               e->luid_low = i;
+               e->luid_high = 0;
+               e->name.string = privname;
+               r->out.privs->count++;
+               i++;
+       }
+
+       *r->in.resume_handle = i;
+
+       return NT_STATUS_OK;
 }
 
 
 }