summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_ads_gpo.c4
-rw-r--r--source3/utils/net_conf.c34
-rw-r--r--source3/utils/net_dns.c2
-rw-r--r--source3/utils/net_rap.c2
-rw-r--r--source3/utils/net_registry.c30
-rw-r--r--source3/utils/net_rpc.c10
-rw-r--r--source3/utils/net_rpc_printer.c28
-rw-r--r--source3/utils/net_rpc_samsync.c15
-rw-r--r--source3/utils/net_rpc_service.c32
-rw-r--r--source3/utils/net_sam.c2
-rw-r--r--source3/utils/ntlm_auth.c18
-rw-r--r--source3/utils/pdbedit.c4
-rw-r--r--source3/utils/smbpasswd.c4
13 files changed, 102 insertions, 83 deletions
diff --git a/source3/utils/net_ads_gpo.c b/source3/utils/net_ads_gpo.c
index 3c66325abe..181cba221d 100644
--- a/source3/utils/net_ads_gpo.c
+++ b/source3/utils/net_ads_gpo.c
@@ -107,7 +107,7 @@ static int net_ads_gpo_refresh(struct net_context *c, int argc, const char **arg
WERROR werr = gp_reg_state_store(mem_ctx, flags, dn,
token, gpo_list);
if (!W_ERROR_IS_OK(werr)) {
- d_printf("failed: %s\n", dos_errstr(werr));
+ d_printf("failed: %s\n", win_errstr(werr));
goto out;
}
}
@@ -152,7 +152,7 @@ static int net_ads_gpo_refresh(struct net_context *c, int argc, const char **arg
&token->user_sids[0],
&read_list);
if (!W_ERROR_IS_OK(werr)) {
- d_printf("failed: %s\n", dos_errstr(werr));
+ d_printf("failed: %s\n", win_errstr(werr));
goto out;
}
}
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index ab1b0f3df7..31e87ca804 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -249,7 +249,7 @@ static int net_conf_list(struct net_context *c, struct smbconf_ctx *conf_ctx,
werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &shares);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error getting config: %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
@@ -322,7 +322,7 @@ static int net_conf_import(struct net_context *c, struct smbconf_ctx *conf_ctx,
werr = smbconf_init(mem_ctx, &txt_ctx, conf_source);
if (!W_ERROR_IS_OK(werr)) {
d_printf("error loading file '%s': %s\n", filename,
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
@@ -425,7 +425,7 @@ static int net_conf_drop(struct net_context *c, struct smbconf_ctx *conf_ctx,
werr = smbconf_drop(conf_ctx);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error deleting configuration: %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
@@ -462,7 +462,7 @@ static int net_conf_showshare(struct net_context *c,
werr = smbconf_get_share(conf_ctx, mem_ctx, sharename, &service);
if (!W_ERROR_IS_OK(werr)) {
d_printf("error getting share parameters: %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
@@ -626,7 +626,7 @@ static int net_conf_addshare(struct net_context *c,
werr = smbconf_create_share(conf_ctx, sharename);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error creating share %s: %s\n",
- sharename, dos_errstr(werr));
+ sharename, win_errstr(werr));
goto done;
}
@@ -637,7 +637,7 @@ static int net_conf_addshare(struct net_context *c,
werr = smbconf_set_parameter(conf_ctx, sharename, "path", path);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error setting parameter %s: %s\n",
- "path", dos_errstr(werr));
+ "path", win_errstr(werr));
goto done;
}
@@ -646,7 +646,7 @@ static int net_conf_addshare(struct net_context *c,
comment);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error setting parameter %s: %s\n",
- "comment", dos_errstr(werr));
+ "comment", win_errstr(werr));
goto done;
}
}
@@ -654,7 +654,7 @@ static int net_conf_addshare(struct net_context *c,
werr = smbconf_set_parameter(conf_ctx, sharename, "guest ok", guest_ok);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error setting parameter %s: %s\n",
- "'guest ok'", dos_errstr(werr));
+ "'guest ok'", win_errstr(werr));
goto done;
}
@@ -662,7 +662,7 @@ static int net_conf_addshare(struct net_context *c,
writeable);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error setting parameter %s: %s\n",
- "writeable", dos_errstr(werr));
+ "writeable", win_errstr(werr));
goto done;
}
@@ -695,7 +695,7 @@ static int net_conf_delshare(struct net_context *c,
werr = smbconf_delete_share(conf_ctx, sharename);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error deleting share %s: %s\n",
- sharename, dos_errstr(werr));
+ sharename, win_errstr(werr));
goto done;
}
@@ -735,7 +735,7 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
werr = smbconf_create_share(conf_ctx, service);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error creating share '%s': %s\n",
- service, dos_errstr(werr));
+ service, win_errstr(werr));
goto done;
}
}
@@ -744,7 +744,7 @@ static int net_conf_setparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error setting value '%s': %s\n",
- param, dos_errstr(werr));
+ param, win_errstr(werr));
goto done;
}
@@ -796,7 +796,7 @@ static int net_conf_getparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
goto done;
} else if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error getting value '%s': %s.\n",
- param, dos_errstr(werr));
+ param, win_errstr(werr));
goto done;
}
@@ -846,7 +846,7 @@ static int net_conf_delparm(struct net_context *c, struct smbconf_ctx *conf_ctx,
goto done;
} else if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "Error deleting value '%s': %s.\n",
- param, dos_errstr(werr));
+ param, win_errstr(werr));
goto done;
}
@@ -883,7 +883,7 @@ static int net_conf_getincludes(struct net_context *c,
werr = smbconf_get_includes(conf_ctx, mem_ctx, service,
&num_includes, &includes);
if (!W_ERROR_IS_OK(werr)) {
- d_printf("error getting includes: %s\n", dos_errstr(werr));
+ d_printf("error getting includes: %s\n", win_errstr(werr));
goto done;
}
@@ -929,7 +929,7 @@ static int net_conf_setincludes(struct net_context *c,
werr = smbconf_set_includes(conf_ctx, service, num_includes, includes);
if (!W_ERROR_IS_OK(werr)) {
- d_printf("error setting includes: %s\n", dos_errstr(werr));
+ d_printf("error setting includes: %s\n", win_errstr(werr));
goto done;
}
@@ -962,7 +962,7 @@ static int net_conf_delincludes(struct net_context *c,
werr = smbconf_delete_includes(conf_ctx, service);
if (!W_ERROR_IS_OK(werr)) {
- d_printf("error deleting includes: %s\n", dos_errstr(werr));
+ d_printf("error deleting includes: %s\n", win_errstr(werr));
goto done;
}
diff --git a/source3/utils/net_dns.c b/source3/utils/net_dns.c
index 4e617a1968..f4ad6f7b47 100644
--- a/source3/utils/net_dns.c
+++ b/source3/utils/net_dns.c
@@ -169,7 +169,7 @@ int get_my_ip_address( struct sockaddr_storage **pp_ss )
continue;
/* Don't register loopback addresses */
- if (is_loopback_addr(nic_sa_storage)) {
+ if (is_loopback_addr((struct sockaddr *)nic_sa_storage)) {
continue;
}
diff --git a/source3/utils/net_rap.c b/source3/utils/net_rap.c
index 32f4dd31b4..570e951aee 100644
--- a/source3/utils/net_rap.c
+++ b/source3/utils/net_rap.c
@@ -1024,7 +1024,7 @@ int net_rap_groupmember_usage(struct net_context *c, int argc, const char **argv
"net rap groupmember LIST <group> [misc. options] [targets]"
"\n\t Enumerate users in a group\n"
"\nnet rap groupmember DELETE <group> <user> [misc. options] "
- "[targets]\n\t Delete sepcified user from specified group\n"
+ "[targets]\n\t Delete specified user from specified group\n"
"\nnet rap groupmember ADD <group> <user> [misc. options] [targets]"
"\n\t Add specified user to specified group\n");
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index 26710b3580..64a0d8ac40 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -91,14 +91,14 @@ static WERROR open_key(TALLOC_CTX *ctx, const char *path,
werr = open_hive(tmp_ctx, path, desired_access, &hive, &subkey_name);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_hive failed: %s\n", dos_errstr(werr));
+ d_fprintf(stderr, "open_hive failed: %s\n", win_errstr(werr));
goto done;
}
werr = reg_openkey(ctx, hive, subkey_name, desired_access, key);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "reg_openkey failed: %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
@@ -137,7 +137,7 @@ static int net_registry_enumerate(struct net_context *c, int argc,
werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_key failed: %s\n", dos_errstr(werr));
+ d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
goto done;
}
@@ -193,7 +193,7 @@ static int net_registry_createkey(struct net_context *c, int argc,
werr = open_hive(ctx, argv[0], REG_KEY_WRITE, &hivekey, &subkeyname);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_hive failed: %s\n", dos_errstr(werr));
+ d_fprintf(stderr, "open_hive failed: %s\n", win_errstr(werr));
goto done;
}
@@ -201,7 +201,7 @@ static int net_registry_createkey(struct net_context *c, int argc,
&subkey, &action);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "reg_createkey failed: %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
switch (action) {
@@ -245,14 +245,14 @@ static int net_registry_deletekey(struct net_context *c, int argc,
werr = open_hive(ctx, argv[0], REG_KEY_WRITE, &hivekey, &subkeyname);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_hive failed: %s\n", dos_errstr(werr));
+ d_fprintf(stderr, "open_hive failed: %s\n", win_errstr(werr));
goto done;
}
werr = reg_deletekey(hivekey, subkeyname);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "reg_deletekey failed: %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
@@ -280,14 +280,14 @@ static int net_registry_getvalue_internal(struct net_context *c, int argc,
werr = open_key(ctx, argv[0], REG_KEY_READ, &key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_key failed: %s\n", dos_errstr(werr));
+ d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
goto done;
}
werr = reg_queryvalue(ctx, key, argv[1], &value);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "reg_queryvalue failed: %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
@@ -346,14 +346,14 @@ static int net_registry_setvalue(struct net_context *c, int argc,
werr = open_key(ctx, argv[0], REG_KEY_WRITE, &key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_key failed: %s\n", dos_errstr(werr));
+ d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
goto done;
}
werr = reg_setvalue(key, argv[1], &value);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "reg_setvalue failed: %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
@@ -380,14 +380,14 @@ static int net_registry_deletevalue(struct net_context *c, int argc,
werr = open_key(ctx, argv[0], REG_KEY_WRITE, &key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_key failed: %s\n", dos_errstr(werr));
+ d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
goto done;
}
werr = reg_deletevalue(key, argv[1]);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "reg_deletekey failed: %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
@@ -429,14 +429,14 @@ static int net_registry_getsd(struct net_context *c, int argc,
werr = open_key(ctx, argv[0], access_mask, &key);
if (!W_ERROR_IS_OK(werr)) {
- d_fprintf(stderr, "open_key failed: %s\n", dos_errstr(werr));
+ d_fprintf(stderr, "open_key failed: %s\n", win_errstr(werr));
goto done;
}
werr = reg_getkeysecurity(ctx, key, &secdesc);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr, "reg_getkeysecurity failed: %s\n",
- dos_errstr(werr));
+ win_errstr(werr));
goto done;
}
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index ad22a55cdb..10f2a324a3 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -3133,7 +3133,7 @@ static NTSTATUS rpc_share_migrate_shares_internals(struct net_context *c,
}
if (!NT_STATUS_IS_OK(nt_status) || !W_ERROR_IS_OK(result)) {
- printf("cannot add share: %s\n", dos_errstr(result));
+ printf("cannot add share: %s\n", win_errstr(result));
goto done;
}
@@ -3580,7 +3580,7 @@ static NTSTATUS rpc_share_migrate_security_internals(struct net_context *c,
&parm_error,
&result);
if (!NT_STATUS_IS_OK(nt_status) || !W_ERROR_IS_OK(result)) {
- printf("cannot set share-acl: %s\n", dos_errstr(result));
+ printf("cannot set share-acl: %s\n", win_errstr(result));
goto done;
}
@@ -5075,7 +5075,7 @@ NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
if ( W_ERROR_EQUAL(werr, WERR_MACHINE_LOCKED) )
d_fprintf(stderr, "\nMachine locked, use -f switch to force\n");
else
- d_fprintf(stderr, "\nresult was: %s\n", dos_errstr(werr));
+ d_fprintf(stderr, "\nresult was: %s\n", win_errstr(werr));
}
return result;
@@ -6113,7 +6113,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
/* SamrConnect2 */
nt_status = rpccli_samr_Connect2(pipe_hnd, mem_ctx,
pipe_hnd->desthost,
- SA_RIGHT_SAM_OPEN_DOMAIN,
+ SAMR_ACCESS_OPEN_DOMAIN,
&connect_hnd);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("Couldn't open SAMR policy handle. Error was %s\n",
@@ -6127,7 +6127,7 @@ static int rpc_trustdom_list(struct net_context *c, int argc, const char **argv)
able to enumerate accounts*/
nt_status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
&connect_hnd,
- SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
+ SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS,
queried_dom_sid,
&domain_hnd);
if (!NT_STATUS_IS_OK(nt_status)) {
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index ddd18a7b9f..c750e46b67 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -711,7 +711,7 @@ static bool net_spoolss_enum_printers(struct rpc_pipe_client *pipe_hnd,
level, num_printers, ctr);
if (!W_ERROR_IS_OK(result)) {
- printf("cannot enum printers: %s\n", dos_errstr(result));
+ printf("cannot enum printers: %s\n", win_errstr(result));
return false;
}
@@ -752,7 +752,7 @@ static bool net_spoolss_open_printer_ex(struct rpc_pipe_client *pipe_hnd,
if (!W_ERROR_IS_OK(result)) {
d_fprintf(stderr, "cannot open printer %s on server %s: %s\n",
- printername2, servername, dos_errstr(result));
+ printername2, servername, win_errstr(result));
return false;
}
@@ -774,7 +774,7 @@ static bool net_spoolss_getprinter(struct rpc_pipe_client *pipe_hnd,
result = rpccli_spoolss_getprinter(pipe_hnd, mem_ctx, hnd, level, ctr);
if (!W_ERROR_IS_OK(result)) {
- printf("cannot get printer-info: %s\n", dos_errstr(result));
+ printf("cannot get printer-info: %s\n", win_errstr(result));
return false;
}
@@ -793,7 +793,7 @@ static bool net_spoolss_setprinter(struct rpc_pipe_client *pipe_hnd,
result = rpccli_spoolss_setprinter(pipe_hnd, mem_ctx, hnd, level, ctr, 0);
if (!W_ERROR_IS_OK(result)) {
- printf("cannot set printer-info: %s\n", dos_errstr(result));
+ printf("cannot set printer-info: %s\n", win_errstr(result));
return false;
}
@@ -812,7 +812,7 @@ static bool net_spoolss_setprinterdata(struct rpc_pipe_client *pipe_hnd,
result = rpccli_spoolss_setprinterdata(pipe_hnd, mem_ctx, hnd, value);
if (!W_ERROR_IS_OK(result)) {
- printf ("unable to set printerdata: %s\n", dos_errstr(result));
+ printf ("unable to set printerdata: %s\n", win_errstr(result));
return false;
}
@@ -832,7 +832,7 @@ static bool net_spoolss_enumprinterkey(struct rpc_pipe_client *pipe_hnd,
result = rpccli_spoolss_enumprinterkey(pipe_hnd, mem_ctx, hnd, keyname, keylist, NULL);
if (!W_ERROR_IS_OK(result)) {
- printf("enumprinterkey failed: %s\n", dos_errstr(result));
+ printf("enumprinterkey failed: %s\n", win_errstr(result));
return false;
}
@@ -852,7 +852,7 @@ static bool net_spoolss_enumprinterdataex(struct rpc_pipe_client *pipe_hnd,
result = rpccli_spoolss_enumprinterdataex(pipe_hnd, mem_ctx, hnd, keyname, ctr);
if (!W_ERROR_IS_OK(result)) {
- printf("enumprinterdataex failed: %s\n", dos_errstr(result));
+ printf("enumprinterdataex failed: %s\n", win_errstr(result));
return false;
}
@@ -873,7 +873,7 @@ static bool net_spoolss_setprinterdataex(struct rpc_pipe_client *pipe_hnd,
keyname, value);
if (!W_ERROR_IS_OK(result)) {
- printf("could not set printerdataex: %s\n", dos_errstr(result));
+ printf("could not set printerdataex: %s\n", win_errstr(result));
return false;
}
@@ -893,7 +893,7 @@ static bool net_spoolss_enumforms(struct rpc_pipe_client *pipe_hnd,
result = rpccli_spoolss_enumforms(pipe_hnd, mem_ctx, hnd, level, num_forms, forms);
if (!W_ERROR_IS_OK(result)) {
- printf("could not enum forms: %s\n", dos_errstr(result));
+ printf("could not enum forms: %s\n", win_errstr(result));
return false;
}
@@ -914,7 +914,7 @@ static bool net_spoolss_enumprinterdrivers (struct rpc_pipe_client *pipe_hnd,
env, num_drivers, ctr);
if (!W_ERROR_IS_OK(result)) {
- printf("cannot enum drivers: %s\n", dos_errstr(result));
+ printf("cannot enum drivers: %s\n", win_errstr(result));
return false;
}
@@ -936,10 +936,10 @@ static bool net_spoolss_getprinterdriver(struct rpc_pipe_client *pipe_hnd,
if (!W_ERROR_IS_OK(result)) {
DEBUG(1,("cannot get driver (for architecture: %s): %s\n",
- env, dos_errstr(result)));
+ env, win_errstr(result)));
if (W_ERROR_V(result) != W_ERROR_V(WERR_UNKNOWN_PRINTER_DRIVER) &&
W_ERROR_V(result) != W_ERROR_V(WERR_INVALID_ENVIRONMENT)) {
- printf("cannot get driver: %s\n", dos_errstr(result));
+ printf("cannot get driver: %s\n", win_errstr(result));
}
return false;
}
@@ -963,7 +963,7 @@ static bool net_spoolss_addprinterdriver(struct rpc_pipe_client *pipe_hnd,
return false;
}
if (!W_ERROR_IS_OK(result)) {
- printf("cannot add driver: %s\n", dos_errstr(result));
+ printf("cannot add driver: %s\n", win_errstr(result));
return false;
}
@@ -1231,7 +1231,7 @@ static NTSTATUS rpc_printer_publish_internals_args(struct rpc_pipe_client *pipe_
result = rpccli_spoolss_setprinter(pipe_hnd, mem_ctx, &hnd, level, &ctr_pub, 0);
if (!W_ERROR_IS_OK(result) && (W_ERROR_V(result) != W_ERROR_V(WERR_IO_PENDING))) {
- printf("cannot set printer-info: %s\n", dos_errstr(result));
+ printf("cannot set printer-info: %s\n", win_errstr(result));
goto done;
}
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index c0922efe6b..73e6dd03cb 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -249,7 +249,10 @@ NTSTATUS rpc_vampire_keytab_internals(struct net_context *c,
return status;
}
- if (argc >= 1) {
+ if (argc < 1) {
+ /* the caller should ensure that a filename is provided */
+ return NT_STATUS_INVALID_PARAMETER;
+ } else {
ctx->output_filename = argv[0];
}
@@ -299,9 +302,13 @@ static NTSTATUS rpc_vampire_keytab_ds_internals(struct net_context *c,
ctx->force_full_replication = c->opt_force_full_repl ? true : false;
ctx->clean_old_entries = c->opt_clean_old_entries ? true : false;
- if (argc >= 1) {
+ if (argc < 1) {
+ /* the caller should ensure that a filename is provided */
+ return NT_STATUS_INVALID_PARAMETER;
+ } else {
ctx->output_filename = argv[0];
}
+
if (argc >= 2) {
ctx->object_dns = &argv[1];
ctx->object_count = argc - 1;
@@ -342,9 +349,9 @@ int rpc_vampire_keytab(struct net_context *c, int argc, const char **argv)
{
int ret = 0;
- if (c->display_usage) {
+ if (c->display_usage || (argc < 1)) {
d_printf("Usage:\n"
- "net rpc vampire keytab\n"
+ "net rpc vampire keytab <keytabfile>\n"
" Dump remote SAM database to Kerberos keytab file\n");
return 0;
}
diff --git a/source3/utils/net_rpc_service.c b/source3/utils/net_rpc_service.c
index 133173116c..7d1c4860aa 100644
--- a/source3/utils/net_rpc_service.c
+++ b/source3/utils/net_rpc_service.c
@@ -79,7 +79,7 @@ static WERROR query_service_state(struct rpc_pipe_client *pipe_hnd,
&hService,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result) ) {
- d_fprintf(stderr, "Failed to open service. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to open service. [%s]\n", win_errstr(result));
return result;
}
@@ -158,7 +158,7 @@ static WERROR control_service(struct rpc_pipe_client *pipe_hnd,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result) ) {
- d_fprintf(stderr, "Failed to open service. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to open service. [%s]\n", win_errstr(result));
goto done;
}
@@ -171,7 +171,7 @@ static WERROR control_service(struct rpc_pipe_client *pipe_hnd,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result) ) {
- d_fprintf(stderr, "Control service request failed. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Control service request failed. [%s]\n", win_errstr(result));
goto done;
}
@@ -220,7 +220,7 @@ static NTSTATUS rpc_service_list_internal(struct net_context *c,
&hSCM,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
- d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", win_errstr(result));
return werror_to_ntstatus(result);
}
@@ -228,7 +228,7 @@ static NTSTATUS rpc_service_list_internal(struct net_context *c,
SVCCTL_STATE_ALL, &num_services, &services );
if ( !W_ERROR_IS_OK(result) ) {
- d_fprintf(stderr, "Failed to enumerate services. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to enumerate services. [%s]\n", win_errstr(result));
goto done;
}
@@ -281,7 +281,7 @@ static NTSTATUS rpc_service_status_internal(struct net_context *c,
&hSCM,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
- d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", win_errstr(result));
return werror_to_ntstatus(result);
}
@@ -295,7 +295,7 @@ static NTSTATUS rpc_service_status_internal(struct net_context *c,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result) ) {
- d_fprintf(stderr, "Failed to open service. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to open service. [%s]\n", win_errstr(result));
goto done;
}
@@ -307,7 +307,7 @@ static NTSTATUS rpc_service_status_internal(struct net_context *c,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result) ) {
- d_fprintf(stderr, "Query status request failed. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Query status request failed. [%s]\n", win_errstr(result));
goto done;
}
@@ -332,7 +332,7 @@ static NTSTATUS rpc_service_status_internal(struct net_context *c,
}
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result) ) {
- d_fprintf(stderr, "Query config request failed. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Query config request failed. [%s]\n", win_errstr(result));
goto done;
}
@@ -404,7 +404,7 @@ static NTSTATUS rpc_service_stop_internal(struct net_context *c,
&hSCM,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
- d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", win_errstr(result));
return werror_to_ntstatus(result);
}
@@ -448,7 +448,7 @@ static NTSTATUS rpc_service_pause_internal(struct net_context *c,
&hSCM,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
- d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", win_errstr(result));
return werror_to_ntstatus(result);
}
@@ -492,7 +492,7 @@ static NTSTATUS rpc_service_resume_internal(struct net_context *c,
&hSCM,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
- d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", win_errstr(result));
return werror_to_ntstatus(result);
}
@@ -534,7 +534,7 @@ static NTSTATUS rpc_service_start_internal(struct net_context *c,
&hSCM,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result)) {
- d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to open Service Control Manager. [%s]\n", win_errstr(result));
return werror_to_ntstatus(result);
}
@@ -548,7 +548,7 @@ static NTSTATUS rpc_service_start_internal(struct net_context *c,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result) ) {
- d_fprintf(stderr, "Failed to open service. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Failed to open service. [%s]\n", win_errstr(result));
goto done;
}
@@ -561,7 +561,7 @@ static NTSTATUS rpc_service_start_internal(struct net_context *c,
&result);
if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result) ) {
- d_fprintf(stderr, "Query status request failed. [%s]\n", dos_errstr(result));
+ d_fprintf(stderr, "Query status request failed. [%s]\n", win_errstr(result));
goto done;
}
@@ -570,7 +570,7 @@ static NTSTATUS rpc_service_start_internal(struct net_context *c,
if ( W_ERROR_IS_OK(result) && (state == SVCCTL_RUNNING) )
d_printf("Successfully started service: %s\n", argv[0] );
else
- d_fprintf(stderr, "Failed to start service: %s [%s]\n", argv[0], dos_errstr(result) );
+ d_fprintf(stderr, "Failed to start service: %s [%s]\n", argv[0], win_errstr(result) );
done:
rpccli_svcctl_CloseServiceHandle(pipe_hnd, mem_ctx, &hService, NULL);
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c
index ce132131f7..e8ebb60205 100644
--- a/source3/utils/net_sam.c
+++ b/source3/utils/net_sam.c
@@ -1735,7 +1735,7 @@ doma_done:
d_printf("Checking Guest's group.\n");
- pwd = getpwnam_alloc(NULL, lp_guestaccount());
+ pwd = getpwnam_alloc(talloc_autofree_context(), lp_guestaccount());
if (!pwd) {
d_fprintf(stderr, "Failed to find just created Guest account!\n"
" Is nss properly configured?!\n");
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 0a76761cb2..fbb105bfe6 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -380,13 +380,25 @@ NTSTATUS contact_winbind_auth_crap(const char *username,
}
if (nt_response && nt_response->length) {
- memcpy(request.data.auth_crap.nt_resp,
- nt_response->data,
- MIN(nt_response->length, sizeof(request.data.auth_crap.nt_resp)));
+ if (nt_response->length > sizeof(request.data.auth_crap.nt_resp)) {
+ request.flags = request.flags | WBFLAG_BIG_NTLMV2_BLOB;
+ request.extra_len = nt_response->length;
+ request.extra_data.data = SMB_MALLOC_ARRAY(char, request.extra_len);
+ if (request.extra_data.data == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ memcpy(request.extra_data.data, nt_response->data,
+ nt_response->length);
+
+ } else {
+ memcpy(request.data.auth_crap.nt_resp,
+ nt_response->data, nt_response->length);
+ }
request.data.auth_crap.nt_resp_len = nt_response->length;
}
result = winbindd_request_response(WINBINDD_PAM_AUTH_CRAP, &request, &response);
+ SAFE_FREE(request.extra_data.data);
/* Display response */
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index fe99b6fc9e..50cbc43d6d 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -571,7 +571,7 @@ static int new_user (struct pdb_methods *in, const char *username,
get_global_sam_sid();
- if ( !(pwd = getpwnam_alloc( NULL, username )) ) {
+ if ( !(pwd = getpwnam_alloc(talloc_autofree_context(), username )) ) {
DEBUG(0,("Cannot locate Unix account for %s\n", username));
return -1;
}
@@ -675,7 +675,7 @@ static int new_machine (struct pdb_methods *in, const char *machine_in)
fstrcpy(machineaccount, machinename);
fstrcat(machineaccount, "$");
- if ( !(pwd = getpwnam_alloc( NULL, machineaccount )) ) {
+ if ( !(pwd = getpwnam_alloc(talloc_autofree_context(), machineaccount )) ) {
DEBUG(0,("Cannot locate Unix account for %s\n", machineaccount));
return -1;
}
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 600fe52f0d..d2652ad95a 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -337,7 +337,7 @@ static int process_root(int local_flags)
load_interfaces();
}
- if (!user_name[0] && (pwd = getpwuid_alloc(NULL, geteuid()))) {
+ if (!user_name[0] && (pwd = getpwuid_alloc(talloc_autofree_context(), geteuid()))) {
fstrcpy(user_name, pwd->pw_name);
TALLOC_FREE(pwd);
}
@@ -498,7 +498,7 @@ static int process_nonroot(int local_flags)
}
if (!user_name[0]) {
- pwd = getpwuid_alloc(NULL, getuid());
+ pwd = getpwuid_alloc(talloc_autofree_context(), getuid());
if (pwd) {
fstrcpy(user_name,pwd->pw_name);
TALLOC_FREE(pwd);