summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-14 14:21:49 +0100
committerGünther Deschner <gd@samba.org>2008-02-14 14:40:26 +0100
commitb9bc1ac1b92f993a71f6eb64b15f486538bf50d7 (patch)
treee73cc2a466e4531bfd15916e3b5e9e7dc69d25a4
parent01f5d15b2c0e988e9f9cea36bcdd776be2536b71 (diff)
downloadsamba-b9bc1ac1b92f993a71f6eb64b15f486538bf50d7.tar.gz
samba-b9bc1ac1b92f993a71f6eb64b15f486538bf50d7.tar.bz2
samba-b9bc1ac1b92f993a71f6eb64b15f486538bf50d7.zip
Use pidl for _lsa_AddAccountRights().
Guenther (This used to be commit 253cf1523871f2218e9e59b0a01f47b8bc745ac9)
-rw-r--r--source3/rpc_server/srv_lsa.c24
-rw-r--r--source3/rpc_server/srv_lsa_nt.c34
2 files changed, 11 insertions, 47 deletions
diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c
index ff274473d6..33686e575f 100644
--- a/source3/rpc_server/srv_lsa.c
+++ b/source3/rpc_server/srv_lsa.c
@@ -276,29 +276,7 @@ static bool api_lsa_query_secobj(pipes_struct *p)
static bool api_lsa_add_acct_rights(pipes_struct *p)
{
- LSA_Q_ADD_ACCT_RIGHTS q_u;
- LSA_R_ADD_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_add_acct_rights("", &q_u, data, 0)) {
- DEBUG(0,("api_lsa_add_acct_rights: failed to unmarshall LSA_Q_ADD_ACCT_RIGHTS.\n"));
- return False;
- }
-
- r_u.status = _lsa_add_acct_rights(p, &q_u, &r_u);
-
- /* store the response in the SMB stream */
- if(!lsa_io_r_add_acct_rights("", &r_u, rdata, 0)) {
- DEBUG(0,("api_lsa_add_acct_rights: Failed to marshall LSA_R_ADD_ACCT_RIGHTS.\n"));
- return False;
- }
-
- return True;
+ return proxy_lsa_call(p, NDR_LSA_ADDACCOUNTRIGHTS);
}
/***************************************************************************
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index 10842a1ada..0be72c5d75 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -2042,19 +2042,18 @@ NTSTATUS _lsa_QuerySecurity(pipes_struct *p,
#endif /* AD DC work in ongoing in Samba 4 */
/***************************************************************************
+ _lsa_AddAccountRights
***************************************************************************/
-NTSTATUS _lsa_add_acct_rights(pipes_struct *p, LSA_Q_ADD_ACCT_RIGHTS *q_u, LSA_R_ADD_ACCT_RIGHTS *r_u)
+NTSTATUS _lsa_AddAccountRights(pipes_struct *p,
+ struct lsa_AddAccountRights *r)
{
struct lsa_info *info = NULL;
int i = 0;
DOM_SID sid;
- fstring privname;
- UNISTR4_ARRAY *uni_privnames = q_u->rights;
-
/* 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
@@ -2069,27 +2068,20 @@ NTSTATUS _lsa_add_acct_rights(pipes_struct *p, LSA_Q_ADD_ACCT_RIGHTS *q_u, LSA_R
/* according to an NT4 PDC, you can add privileges to SIDs even without
call_lsa_create_account() first. And you can use any arbitrary SID. */
- sid_copy( &sid, &q_u->sid.sid );
+ sid_copy( &sid, r->in.sid );
- /* 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];
+ const char *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 ( !grant_privilege_by_name( &sid, privname ) ) {
- DEBUG(2,("_lsa_add_acct_rights: Failed to add privilege [%s]\n", privname ));
+ DEBUG(2,("_lsa_AddAccountRights: Failed to add privilege [%s]\n",
+ privname ));
return NT_STATUS_NO_SUCH_PRIVILEGE;
}
}
@@ -2328,12 +2320,6 @@ NTSTATUS _lsa_EnumAccountRights(pipes_struct *p, struct lsa_EnumAccountRights *r
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS _lsa_AddAccountRights(pipes_struct *p, struct lsa_AddAccountRights *r)
-{
- p->rng_fault_state = True;
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p, struct lsa_RemoveAccountRights *r)
{
p->rng_fault_state = True;