]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Use pidl for _lsa_RemoveAccountRights.
authorGünther Deschner <gd@samba.org>
Thu, 14 Feb 2008 14:20:18 +0000 (15:20 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 14 Feb 2008 14:22:33 +0000 (15:22 +0100)
Guenther

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

index 14cf0b3cc9a1a21d67f9ba1b44d09c4555d80c65..dfb33238731cad1e399f3ca508a42c8867fb0ee2 100644 (file)
@@ -285,29 +285,7 @@ static bool api_lsa_add_acct_rights(pipes_struct *p)
 
 static bool api_lsa_remove_acct_rights(pipes_struct *p)
 {
-       LSA_Q_REMOVE_ACCT_RIGHTS q_u;
-       LSA_R_REMOVE_ACCT_RIGHTS 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_remove_acct_rights("", &q_u, data, 0)) {
-               DEBUG(0,("api_lsa_remove_acct_rights: failed to unmarshall LSA_Q_REMOVE_ACCT_RIGHTS.\n"));
-               return False;
-       }
-
-       r_u.status = _lsa_remove_acct_rights(p, &q_u, &r_u);
-
-       /* store the response in the SMB stream */
-       if(!lsa_io_r_remove_acct_rights("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_lsa_remove_acct_rights: Failed to marshall LSA_R_REMOVE_ACCT_RIGHTS.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_lsa_call(p, NDR_LSA_REMOVEACCOUNTRIGHTS);
 }
 
 /***************************************************************************
index a709877d6e0e320bfe5cd44ef489f1a71b3a33c9..027277e8d9af099db9a1f56ac896500e2a62e981 100644 (file)
@@ -2090,19 +2090,19 @@ NTSTATUS _lsa_AddAccountRights(pipes_struct *p,
 }
 
 /***************************************************************************
+ _lsa_RemoveAccountRights
  ***************************************************************************/
 
-NTSTATUS _lsa_remove_acct_rights(pipes_struct *p, LSA_Q_REMOVE_ACCT_RIGHTS *q_u, LSA_R_REMOVE_ACCT_RIGHTS *r_u)
+NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p,
+                                 struct lsa_RemoveAccountRights *r)
 {
        struct lsa_info *info = NULL;
        int i = 0;
        DOM_SID sid;
-       fstring privname;
-       UNISTR4_ARRAY *uni_privnames = q_u->rights;
-
+       const char *privname = NULL;
 
        /* 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;
 
        /* check to see if the pipe_user is a Domain Admin since
@@ -2114,34 +2114,27 @@ NTSTATUS _lsa_remove_acct_rights(pipes_struct *p, LSA_Q_REMOVE_ACCT_RIGHTS *q_u,
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       sid_copy( &sid, &q_u->sid.sid );
+       sid_copy( &sid, r->in.sid );
 
-       if ( q_u->removeall ) {
+       if ( r->in.remove_all ) {
                if ( !revoke_all_privileges( &sid ) )
                        return NT_STATUS_ACCESS_DENIED;
 
                return NT_STATUS_OK;
        }
 
-       /* just a little sanity check */
-
-       if ( q_u->count != uni_privnames->count ) {
-               DEBUG(0,("_lsa_add_acct_rights: count != number of UNISTR2 elements!\n"));
-               return NT_STATUS_INVALID_HANDLE;
-       }
+       for ( i=0; i < r->in.rights->count; i++ ) {
 
-       for ( i=0; i<q_u->count; i++ ) {
-               UNISTR4 *uni4_str = &uni_privnames->strings[i];
+               privname = r->in.rights->names[i].string;
 
                /* only try to add non-null strings */
 
-               if ( !uni4_str->string )
+               if ( !privname )
                        continue;
 
-               rpcstr_pull( privname, uni4_str->string->buffer, sizeof(privname), -1, STR_TERMINATE );
-
                if ( !revoke_privilege_by_name( &sid, privname ) ) {
-                       DEBUG(2,("_lsa_remove_acct_rights: Failed to revoke privilege [%s]\n", privname ));
+                       DEBUG(2,("_lsa_RemoveAccountRights: Failed to revoke privilege [%s]\n",
+                               privname ));
                        return NT_STATUS_NO_SUCH_PRIVILEGE;
                }
        }
@@ -2355,12 +2348,6 @@ NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccounts
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p, struct lsa_RemoveAccountRights *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;