summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-03-26 06:52:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:20 -0500
commit0aa89db9471330fd02db395c2eb387ac2dfef54f (patch)
treec4cf899e4aeb15bc926c2e4e470ee32f14b2bba4 /source3/rpc_server
parent404fa5636ddae8caa0a46bb68b796d23ec3f5a0e (diff)
downloadsamba-0aa89db9471330fd02db395c2eb387ac2dfef54f.tar.gz
samba-0aa89db9471330fd02db395c2eb387ac2dfef54f.tar.bz2
samba-0aa89db9471330fd02db395c2eb387ac2dfef54f.zip
r6071: * clean up UNISTR2_ARRAY ( really just an array of UNISTR4 + count )
* add some backwards compatibility to 'net rpc rights list' * verify privilege name in 'net rpc rights privileges <name>' in order to give back better error messages. (This used to be commit 0e29dc8aa384dfa6d2495beb8a9ffb5371e60a13)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_lsa_nt.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index 7ea35a91fa..db1aa57ea9 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -1337,7 +1337,7 @@ NTSTATUS _lsa_add_acct_rights(pipes_struct *p, LSA_Q_ADD_ACCT_RIGHTS *q_u, LSA_R
int i = 0;
DOM_SID sid;
fstring privname;
- UNISTR2_ARRAY *uni_privnames = &q_u->rights;
+ UNISTR4_ARRAY *uni_privnames = q_u->rights;
struct current_user user;
@@ -1368,11 +1368,16 @@ NTSTATUS _lsa_add_acct_rights(pipes_struct *p, LSA_Q_ADD_ACCT_RIGHTS *q_u, LSA_R
}
for ( i=0; i<q_u->count; i++ ) {
- unistr2_to_ascii( privname, &uni_privnames->strings[i].string, sizeof(fstring)-1 );
-
+ UNISTR4 *uni4_str = &uni_privnames->strings[i];
+
/* only try to add non-null strings */
+
+ if ( !uni4_str->string )
+ continue;
+
+ rpcstr_pull( privname, uni4_str->string->buffer, sizeof(privname), -1, STR_TERMINATE );
- if ( *privname && !grant_privilege_by_name( &sid, privname ) ) {
+ if ( !grant_privilege_by_name( &sid, privname ) ) {
DEBUG(2,("_lsa_add_acct_rights: Failed to add privilege [%s]\n", privname ));
return NT_STATUS_NO_SUCH_PRIVILEGE;
}
@@ -1390,7 +1395,7 @@ NTSTATUS _lsa_remove_acct_rights(pipes_struct *p, LSA_Q_REMOVE_ACCT_RIGHTS *q_u,
int i = 0;
DOM_SID sid;
fstring privname;
- UNISTR2_ARRAY *uni_privnames = &q_u->rights;
+ UNISTR4_ARRAY *uni_privnames = q_u->rights;
struct current_user user;
@@ -1425,11 +1430,16 @@ NTSTATUS _lsa_remove_acct_rights(pipes_struct *p, LSA_Q_REMOVE_ACCT_RIGHTS *q_u,
}
for ( i=0; i<q_u->count; i++ ) {
- unistr2_to_ascii( privname, &uni_privnames->strings[i].string, sizeof(fstring)-1 );
-
+ UNISTR4 *uni4_str = &uni_privnames->strings[i];
+
/* only try to add non-null strings */
+
+ if ( !uni4_str->string )
+ continue;
+
+ rpcstr_pull( privname, uni4_str->string->buffer, sizeof(privname), -1, STR_TERMINATE );
- if ( *privname && !revoke_privilege_by_name( &sid, privname ) ) {
+ if ( !revoke_privilege_by_name( &sid, privname ) ) {
DEBUG(2,("_lsa_remove_acct_rights: Failed to revoke privilege [%s]\n", privname ));
return NT_STATUS_NO_SUCH_PRIVILEGE;
}
@@ -1439,6 +1449,9 @@ NTSTATUS _lsa_remove_acct_rights(pipes_struct *p, LSA_Q_REMOVE_ACCT_RIGHTS *q_u,
}
+/***************************************************************************
+ ***************************************************************************/
+
NTSTATUS _lsa_enum_acct_rights(pipes_struct *p, LSA_Q_ENUM_ACCT_RIGHTS *q_u, LSA_R_ENUM_ACCT_RIGHTS *r_u)
{
struct lsa_info *info = NULL;
@@ -1478,6 +1491,9 @@ NTSTATUS _lsa_enum_acct_rights(pipes_struct *p, LSA_Q_ENUM_ACCT_RIGHTS *q_u, LSA
}
+/***************************************************************************
+ ***************************************************************************/
+
NTSTATUS _lsa_lookup_priv_value(pipes_struct *p, LSA_Q_LOOKUP_PRIV_VALUE *q_u, LSA_R_LOOKUP_PRIV_VALUE *r_u)
{
struct lsa_info *info = NULL;