summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-11 12:17:27 +0100
committerGünther Deschner <gd@samba.org>2008-02-11 19:16:05 +0100
commit7b502954002dd9b4aa413dbf334aa25d5865656e (patch)
treec9dc36c73f7673f2d46407e6807496d98b7f2f64 /source3
parent419ab84b0188b81025d66637415047cc87986792 (diff)
downloadsamba-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')
-rw-r--r--source3/rpcclient/cmd_lsarpc.c24
-rw-r--r--source3/utils/net_rpc_rights.c48
2 files changed, 51 insertions, 21 deletions
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index a49dc38ad9..075ba6e118 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -22,6 +22,10 @@
#include "includes.h"
#include "rpcclient.h"
+static void init_lsa_String(struct lsa_String *name, const char *s)
+{
+ name->string = s;
+}
/* useful function to allow entering a name instead of a SID and
* looking it up automatically */
@@ -501,7 +505,8 @@ static NTSTATUS cmd_lsa_get_dispname(struct rpc_pipe_client *cli,
uint16 lang_id=0;
uint16 lang_id_sys=0;
uint16 lang_id_desc;
- fstring description;
+ struct lsa_String lsa_name;
+ struct lsa_StringLarge *description = NULL;
if (argc != 2) {
printf("Usage: %s privilege name\n", argv[0]);
@@ -515,13 +520,21 @@ static NTSTATUS cmd_lsa_get_dispname(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(result))
goto done;
- result = rpccli_lsa_get_dispname(cli, mem_ctx, &pol, argv[1], lang_id, lang_id_sys, description, &lang_id_desc);
+ init_lsa_String(&lsa_name, argv[1]);
+
+ result = rpccli_lsa_LookupPrivDisplayName(cli, mem_ctx,
+ &pol,
+ &lsa_name,
+ lang_id,
+ lang_id_sys,
+ &description,
+ &lang_id_desc);
if (!NT_STATUS_IS_OK(result))
goto done;
/* Print results */
- printf("%s -> %s (language: 0x%x)\n", argv[1], description, lang_id_desc);
+ printf("%s -> %s (language: 0x%x)\n", argv[1], description->string, lang_id_desc);
rpccli_lsa_Close(cli, mem_ctx, &pol);
done:
@@ -983,11 +996,6 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
return result;
}
-static void init_lsa_String(struct lsa_String *name, const char *s)
-{
- name->string = s;
-}
-
static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
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);