]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Use pidl for _lsa_EnumPrivsAccount().
authorGünther Deschner <gd@samba.org>
Thu, 14 Feb 2008 00:53:00 +0000 (01:53 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 14 Feb 2008 00:55:33 +0000 (01:55 +0100)
Guenther

source/rpc_server/srv_lsa.c
source/rpc_server/srv_lsa_nt.c

index a3fe00cced743e8bfd90173cc16451021991c82e..60a3bd3671de81aaf96c705df62a47943b83876f 100644 (file)
@@ -221,29 +221,7 @@ static bool api_lsa_open_account(pipes_struct *p)
 
 static bool api_lsa_enum_privsaccount(pipes_struct *p)
 {
-       LSA_Q_ENUMPRIVSACCOUNT q_u;
-       LSA_R_ENUMPRIVSACCOUNT r_u;
-       
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if(!lsa_io_q_enum_privsaccount("", &q_u, data, 0)) {
-               DEBUG(0,("api_lsa_enum_privsaccount: failed to unmarshall LSA_Q_ENUMPRIVSACCOUNT.\n"));
-               return False;
-       }
-
-       r_u.status = _lsa_enum_privsaccount(p, rdata, &q_u, &r_u);
-
-       /* store the response in the SMB stream */
-       if(!lsa_io_r_enum_privsaccount("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_lsa_enum_privsaccount: Failed to marshall LSA_R_ENUMPRIVSACCOUNT.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_lsa_call(p, NDR_LSA_ENUMPRIVSACCOUNT);
 }
 
 /***************************************************************************
index 275f3d9cb44ccdfce6db34efef3e885e6e2a30ff..4e2884ccdb8c8227e1c794bf09a4156882303b6e 100644 (file)
@@ -1720,38 +1720,69 @@ NTSTATUS _lsa_OpenAccount(pipes_struct *p,
 }
 
 /***************************************************************************
+ _lsa_EnumPrivsAccount
  For a given SID, enumerate all the privilege this account has.
  ***************************************************************************/
 
-NTSTATUS _lsa_enum_privsaccount(pipes_struct *p, prs_struct *ps, LSA_Q_ENUMPRIVSACCOUNT *q_u, LSA_R_ENUMPRIVSACCOUNT *r_u)
+NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p,
+                              struct lsa_EnumPrivsAccount *r)
 {
+       NTSTATUS status = NT_STATUS_OK;
        struct lsa_info *info=NULL;
        SE_PRIV mask;
        PRIVILEGE_SET privileges;
+       struct lsa_PrivilegeSet *priv_set = NULL;
+       struct lsa_LUIDAttribute *luid_attrs = NULL;
+       int i;
 
        /* find the connection policy handle. */
-       if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
+       if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
                return NT_STATUS_INVALID_HANDLE;
 
-       if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) ) 
+       if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) )
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 
        privilege_set_init( &privileges );
 
        if ( se_priv_to_privilege_set( &privileges, &mask ) ) {
 
-               DEBUG(10,("_lsa_enum_privsaccount: %s has %d privileges\n",
+               DEBUG(10,("_lsa_EnumPrivsAccount: %s has %d privileges\n",
                          sid_string_dbg(&info->sid),
                          privileges.count));
 
-               r_u->status = init_lsa_r_enum_privsaccount(ps->mem_ctx, r_u, privileges.set, privileges.count, 0);
+               priv_set = TALLOC_ZERO_P(p->mem_ctx, struct lsa_PrivilegeSet);
+               if (!priv_set) {
+                       status = NT_STATUS_NO_MEMORY;
+                       goto done;
+               }
+
+               luid_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx,
+                                              struct lsa_LUIDAttribute,
+                                              privileges.count);
+               if (!luid_attrs) {
+                       status = NT_STATUS_NO_MEMORY;
+                       goto done;
+               }
+
+               for (i=0; i<privileges.count; i++) {
+                       luid_attrs[i].luid.low = privileges.set[i].luid.low;
+                       luid_attrs[i].luid.high = privileges.set[i].luid.high;
+                       luid_attrs[i].attribute = privileges.set[i].attr;
+               }
+
+               priv_set->count = privileges.count;
+               priv_set->unknown = 0;
+               priv_set->set = luid_attrs;
+
+               *r->out.privs = priv_set;
+       } else {
+               status = NT_STATUS_NO_SUCH_PRIVILEGE;
        }
-       else
-               r_u->status = NT_STATUS_NO_SUCH_PRIVILEGE;
 
+ done:
        privilege_set_free( &privileges );
 
-       return r_u->status;
+       return status;
 }
 
 /***************************************************************************
@@ -2246,12 +2277,6 @@ NTSTATUS _lsa_LookupSids(pipes_struct *p, struct lsa_LookupSids *r)
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p, struct lsa_EnumPrivsAccount *r)
-{
-       p->rng_fault_state = True;
-       return NT_STATUS_NOT_IMPLEMENTED;
-}
-
 NTSTATUS _lsa_AddPrivilegesToAccount(pipes_struct *p, struct lsa_AddPrivilegesToAccount *r)
 {
        p->rng_fault_state = True;