diff options
author | Günther Deschner <gd@samba.org> | 2008-02-11 12:17:27 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-02-11 19:16:05 +0100 |
commit | 7b502954002dd9b4aa413dbf334aa25d5865656e (patch) | |
tree | c9dc36c73f7673f2d46407e6807496d98b7f2f64 /source3/utils | |
parent | 419ab84b0188b81025d66637415047cc87986792 (diff) | |
download | samba-7b502954002dd9b4aa413dbf334aa25d5865656e.tar.gz samba-7b502954002dd9b4aa413dbf334aa25d5865656e.tar.bz2 samba-7b502954002dd9b4aa413dbf334aa25d5865656e.zip |
Use rpccli_lsa_LookupPrivDisplayName() in net and rpcclient.
Guenther
(This used to be commit be932cbdfa51eefafe79a81fa393ffea1fa4e25e)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_rpc_rights.c | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/source3/utils/net_rpc_rights.c b/source3/utils/net_rpc_rights.c index afa786f0f5..e110c412e0 100644 --- a/source3/utils/net_rpc_rights.c +++ b/source3/utils/net_rpc_rights.c @@ -19,6 +19,11 @@ #include "includes.h" #include "utils/net.h" +static void init_lsa_String(struct lsa_String *name, const char *s) +{ + name->string = s; +} + /******************************************************************** ********************************************************************/ @@ -98,7 +103,7 @@ static NTSTATUS enum_privileges(struct rpc_pipe_client *pipe_hnd, uint16 lang_id=0; uint16 lang_id_sys=0; uint16 lang_id_desc; - fstring description; + struct lsa_StringLarge *description = NULL; struct lsa_PrivArray priv_array; result = rpccli_lsa_EnumPrivs(pipe_hnd, ctx, @@ -113,19 +118,30 @@ static NTSTATUS enum_privileges(struct rpc_pipe_client *pipe_hnd, /* Print results */ for (i = 0; i < priv_array.count; i++) { + + struct lsa_String lsa_name; + d_printf("%30s ", priv_array.privs[i].name.string ? priv_array.privs[i].name.string : "*unknown*" ); /* try to get the description */ - - if ( !NT_STATUS_IS_OK(rpccli_lsa_get_dispname(pipe_hnd, ctx, pol, - priv_array.privs[i].name.string, lang_id, lang_id_sys, description, &lang_id_desc)) ) - { + + init_lsa_String(&lsa_name, priv_array.privs[i].name.string); + + result = rpccli_lsa_LookupPrivDisplayName(pipe_hnd, ctx, + pol, + &lsa_name, + lang_id, + lang_id_sys, + &description, + &lang_id_desc); + + if (!NT_STATUS_IS_OK(result)) { d_printf("??????\n"); continue; } - - d_printf("%s\n", description ); + + d_printf("%s\n", description->string); } return NT_STATUS_OK; @@ -298,7 +314,8 @@ static NTSTATUS rpc_rights_list_internal(const DOM_SID *domain_sid, NTSTATUS result; DOM_SID sid; fstring privname; - fstring description; + struct lsa_String lsa_name; + struct lsa_StringLarge *description = NULL; uint16 lang_id = 0; uint16 lang_id_sys = 0; uint16 lang_id_desc; @@ -326,14 +343,19 @@ static NTSTATUS rpc_rights_list_internal(const DOM_SID *domain_sid, } while ( argv[i] != NULL ) { - fstrcpy( privname, argv[i] ); + fstrcpy(privname, argv[i]); + init_lsa_String(&lsa_name, argv[i]); i++; /* verify that this is a valid privilege for error reporting */ - - result = rpccli_lsa_get_dispname(pipe_hnd, mem_ctx, &pol, privname, lang_id, - lang_id_sys, description, &lang_id_desc); - + result = rpccli_lsa_LookupPrivDisplayName(pipe_hnd, mem_ctx, + &pol, + &lsa_name, + lang_id, + lang_id_sys, + &description, + &lang_id_desc); + if ( !NT_STATUS_IS_OK(result) ) { if ( NT_STATUS_EQUAL( result, NT_STATUS_NO_SUCH_PRIVILEGE ) ) d_fprintf(stderr, "No such privilege exists: %s.\n", privname); |