summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_drsuapi.c2
-rw-r--r--source3/rpcclient/cmd_lsarpc.c10
-rw-r--r--source3/rpcclient/cmd_netlogon.c12
-rw-r--r--source3/rpcclient/cmd_samr.c12
-rw-r--r--source3/rpcclient/cmd_spoolss.c10
-rw-r--r--source3/rpcclient/rpcclient.c20
6 files changed, 27 insertions, 39 deletions
diff --git a/source3/rpcclient/cmd_drsuapi.c b/source3/rpcclient/cmd_drsuapi.c
index 3f1ecab750..292fa8838b 100644
--- a/source3/rpcclient/cmd_drsuapi.c
+++ b/source3/rpcclient/cmd_drsuapi.c
@@ -40,7 +40,7 @@ static WERROR cracknames(struct rpc_pipe_client *cli,
struct drsuapi_DsNameString *names;
struct dcerpc_binding_handle *b = cli->binding_handle;
- names = TALLOC_ZERO_ARRAY(mem_ctx, struct drsuapi_DsNameString, argc);
+ names = talloc_zero_array(mem_ctx, struct drsuapi_DsNameString, argc);
W_ERROR_HAVE_NO_MEMORY(names);
for (i=0; i<argc; i++) {
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index 4b065d0dd2..3382eb1a5c 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -400,7 +400,7 @@ static NTSTATUS cmd_lsa_lookup_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem
/* Convert arguments to sids */
- sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, argc - 1);
+ sids = talloc_array(mem_ctx, struct dom_sid, argc - 1);
if (!sids) {
printf("could not allocate memory for %d sids\n", argc - 1);
@@ -978,7 +978,7 @@ static NTSTATUS cmd_lsa_add_acct_rights(struct rpc_pipe_client *cli,
goto done;
rights.count = argc-2;
- rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge,
+ rights.names = talloc_array(mem_ctx, struct lsa_StringLarge,
rights.count);
if (!rights.names) {
return NT_STATUS_NO_MEMORY;
@@ -1036,7 +1036,7 @@ static NTSTATUS cmd_lsa_remove_acct_rights(struct rpc_pipe_client *cli,
goto done;
rights.count = argc-2;
- rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge,
+ rights.names = talloc_array(mem_ctx, struct lsa_StringLarge,
rights.count);
if (!rights.names) {
return NT_STATUS_NO_MEMORY;
@@ -1494,7 +1494,7 @@ static NTSTATUS cmd_lsa_add_priv(struct rpc_pipe_client *cli,
}
privs.count++;
- set = TALLOC_REALLOC_ARRAY(mem_ctx, set,
+ set = talloc_realloc(mem_ctx, set,
struct lsa_LUIDAttribute,
privs.count);
if (!set) {
@@ -1592,7 +1592,7 @@ static NTSTATUS cmd_lsa_del_priv(struct rpc_pipe_client *cli,
}
privs.count++;
- set = TALLOC_REALLOC_ARRAY(mem_ctx, set,
+ set = talloc_realloc(mem_ctx, set,
struct lsa_LUIDAttribute,
privs.count);
if (!set) {
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 63057ac368..ad43452bf1 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -583,7 +583,7 @@ static NTSTATUS cmd_netlogon_sam_sync(struct rpc_pipe_client *cli,
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
NTSTATUS status;
const char *logon_server = cli->desthost;
- const char *computername = global_myname();
+ const char *computername = lp_netbios_name();
struct netr_Authenticator credential;
struct netr_Authenticator return_authenticator;
enum netr_SamDatabaseID database_id = SAM_DATABASE_DOMAIN;
@@ -654,7 +654,7 @@ static NTSTATUS cmd_netlogon_sam_deltas(struct rpc_pipe_client *cli,
NTSTATUS status;
uint32_t tmp;
const char *logon_server = cli->desthost;
- const char *computername = global_myname();
+ const char *computername = lp_netbios_name();
struct netr_Authenticator credential;
struct netr_Authenticator return_authenticator;
enum netr_SamDatabaseID database_id = SAM_DATABASE_DOMAIN;
@@ -1121,8 +1121,8 @@ static NTSTATUS cmd_netlogon_database_redo(struct rpc_pipe_client *cli,
status = rpccli_netlogon_setup_creds(cli,
server_name, /* server name */
lp_workgroup(), /* domain */
- global_myname(), /* client name */
- global_myname(), /* machine account name */
+ lp_netbios_name(), /* client name */
+ lp_netbios_name(), /* machine account name */
trust_passwd_hash,
sec_channel_type,
&neg_flags);
@@ -1141,7 +1141,7 @@ static NTSTATUS cmd_netlogon_database_redo(struct rpc_pipe_client *cli,
status = dcerpc_netr_DatabaseRedo(b, mem_ctx,
server_name,
- global_myname(),
+ lp_netbios_name(),
&clnt_creds,
&srv_cred,
e,
@@ -1187,7 +1187,7 @@ static NTSTATUS cmd_netlogon_capabilities(struct rpc_pipe_client *cli,
status = dcerpc_netr_LogonGetCapabilities(b, mem_ctx,
cli->desthost,
- global_myname(),
+ lp_netbios_name(),
&credential,
&return_authenticator,
level,
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 727c9d1456..24bd55abf3 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -284,18 +284,18 @@ static NTSTATUS get_domain_handle(struct rpc_pipe_client *cli,
struct dcerpc_binding_handle *b = cli->binding_handle;
NTSTATUS status = NT_STATUS_INVALID_PARAMETER, result;
- if (StrCaseCmp(sam, "domain") == 0) {
+ if (strcasecmp_m(sam, "domain") == 0) {
status = dcerpc_samr_OpenDomain(b, mem_ctx,
connect_pol,
access_mask,
_domain_sid,
domain_pol,
&result);
- } else if (StrCaseCmp(sam, "builtin") == 0) {
+ } else if (strcasecmp_m(sam, "builtin") == 0) {
status = dcerpc_samr_OpenDomain(b, mem_ctx,
connect_pol,
access_mask,
- CONST_DISCARD(struct dom_sid2 *, &global_sid_Builtin),
+ discard_const_p(struct dom_sid2, &global_sid_Builtin),
domain_pol,
&result);
}
@@ -728,7 +728,7 @@ static NTSTATUS cmd_samr_query_useraliases(struct rpc_pipe_client *cli,
}
if (num_sids) {
- sid_array.sids = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_SidPtr, num_sids);
+ sid_array.sids = talloc_zero_array(mem_ctx, struct lsa_SidPtr, num_sids);
if (sid_array.sids == NULL)
return NT_STATUS_NO_MEMORY;
} else {
@@ -2087,7 +2087,7 @@ static NTSTATUS cmd_samr_lookup_names(struct rpc_pipe_client *cli,
num_names = argc - 2;
- if ((names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names)) == NULL) {
+ if ((names = talloc_array(mem_ctx, struct lsa_String, num_names)) == NULL) {
dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result);
dcerpc_samr_Close(b, mem_ctx, &connect_pol, &result);
status = NT_STATUS_NO_MEMORY;
@@ -2167,7 +2167,7 @@ static NTSTATUS cmd_samr_lookup_rids(struct rpc_pipe_client *cli,
num_rids = argc - 2;
- if ((rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids)) == NULL) {
+ if ((rids = talloc_array(mem_ctx, uint32, num_rids)) == NULL) {
dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result);
dcerpc_samr_Close(b, mem_ctx, &connect_pol, &result);
status = NT_STATUS_NO_MEMORY;
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 712b23724e..0e12201f92 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -27,12 +27,12 @@
#include "../librpc/gen_ndr/ndr_spoolss_c.h"
#include "rpc_client/cli_spoolss.h"
#include "rpc_client/init_spoolss.h"
-#include "registry.h"
#include "registry/reg_objects.h"
#include "nt_printing.h"
#include "../libcli/security/display_sec.h"
#include "../libcli/security/security_descriptor.h"
#include "../libcli/registry/util_reg.h"
+#include "libsmb/libsmb.h"
#define RPCCLIENT_PRINTERNAME(_printername, _cli, _arg) \
{ \
@@ -83,7 +83,7 @@ static const char *cmd_spoolss_get_short_archi(const char *long_archi)
do {
i++;
} while ( (archi_table[i].long_archi!=NULL ) &&
- StrCaseCmp(long_archi, archi_table[i].long_archi) );
+ strcasecmp_m(long_archi, archi_table[i].long_archi) );
if (archi_table[i].long_archi==NULL) {
DEBUGADD(10,("Unknown architecture [%s] !\n", long_archi));
@@ -1616,7 +1616,7 @@ static char *get_driver_3_param(TALLOC_CTX *mem_ctx, char *str,
parameter because two consecutive delimiters
will not return an empty string. See man strtok(3)
for details */
- if (ptr && (StrCaseCmp(ptr, "NULL") == 0)) {
+ if (ptr && (strcasecmp_m(ptr, "NULL") == 0)) {
ptr = NULL;
}
@@ -3263,7 +3263,7 @@ static WERROR cmd_spoolss_rffpcnex(struct rpc_pipe_client *cli,
}
option.types[1].fields[0].field = JOB_NOTIFY_FIELD_PRINTER_NAME;
- clientname = talloc_asprintf(mem_ctx, "\\\\%s", global_myname());
+ clientname = talloc_asprintf(mem_ctx, "\\\\%s", lp_netbios_name());
if (!clientname) {
result = WERR_NOMEM;
goto done;
@@ -3429,7 +3429,7 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
/* first get the connection to the remote server */
- nt_status = cli_full_connection(&cli_server2, global_myname(), argv[2],
+ nt_status = cli_full_connection(&cli_server2, lp_netbios_name(), argv[2],
NULL, 0,
"IPC$", "IPC",
get_cmdline_auth_info_username(rpcclient_auth_info),
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index cebe2a9c6a..542862606b 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -30,7 +30,7 @@
#include "../libcli/smbreadline/smbreadline.h"
#include "../libcli/security/security.h"
#include "passdb.h"
-#include "ntdomain.h"
+#include "libsmb/libsmb.h"
enum pipe_auth_type_spnego {
PIPE_AUTH_TYPE_SPNEGO_NONE = 0,
@@ -240,7 +240,7 @@ static NTSTATUS cmd_listcommands(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
{
tmp_set = tmp->cmd_set;
- if (!StrCaseCmp(argv[1], tmp_set->name))
+ if (!strcasecmp_m(argv[1], tmp_set->name))
{
printf("Available commands on the %s pipe:\n\n", tmp_set->name);
@@ -775,7 +775,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
ntresult = rpccli_netlogon_setup_creds(cmd_entry->rpc_pipe,
cli->desthost, /* server name */
get_cmdline_auth_info_domain(auth_info), /* domain */
- global_myname(), /* client name */
+ lp_netbios_name(), /* client name */
machine_account, /* machine account name */
trust_password,
sec_channel_type,
@@ -892,7 +892,6 @@ out_free:
struct sockaddr_storage server_ss;
NTSTATUS nt_status;
static int opt_port = 0;
- fstring new_workgroup;
int result = 0;
TALLOC_CTX *frame = talloc_stackframe();
uint32_t flags = 0;
@@ -975,22 +974,11 @@ out_free:
goto done;
}
- /* save the workgroup...
-
- FIXME!! do we need to do this for other options as well
- (or maybe a generic way to keep lp_load() from overwriting
- everything)? */
-
- fstrcpy( new_workgroup, lp_workgroup() );
-
/* Load smb.conf file */
if (!lp_load(get_dyn_CONFIGFILE(),True,False,False,True))
fprintf(stderr, "Can't load %s\n", get_dyn_CONFIGFILE());
- if ( strlen(new_workgroup) != 0 )
- set_global_myworkgroup( new_workgroup );
-
/*
* Get password
* from stdin if necessary
@@ -1091,7 +1079,7 @@ out_free:
}
- nt_status = cli_full_connection(&cli, global_myname(), binding->host,
+ nt_status = cli_full_connection(&cli, lp_netbios_name(), binding->host,
opt_ipaddr ? &server_ss : NULL, opt_port,
"IPC$", "IPC",
get_cmdline_auth_info_username(rpcclient_auth_info),