From 0aa89db9471330fd02db395c2eb387ac2dfef54f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 26 Mar 2005 06:52:56 +0000 Subject: 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 ' in order to give back better error messages. (This used to be commit 0e29dc8aa384dfa6d2495beb8a9ffb5371e60a13) --- source3/rpc_server/srv_lsa_nt.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'source3/rpc_server') 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; icount; 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; icount; 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; -- cgit