summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net.h10
-rw-r--r--source3/utils/net_proto.h5
-rw-r--r--source3/utils/net_rap.c9
-rw-r--r--source3/utils/net_registry.c4
-rw-r--r--source3/utils/net_rpc.c10
-rw-r--r--source3/utils/net_rpc_join.c3
-rw-r--r--source3/utils/net_rpc_samsync.c180
-rw-r--r--source3/utils/net_sam.c2
-rw-r--r--source3/utils/net_util.c38
-rw-r--r--source3/utils/ntlm_auth.c25
-rw-r--r--source3/utils/pdbedit.c4
-rw-r--r--source3/utils/smbpasswd.c4
-rw-r--r--source3/utils/smbtree.c16
13 files changed, 269 insertions, 41 deletions
diff --git a/source3/utils/net.h b/source3/utils/net.h
index 5dc2b11d4e..2d72756def 100644
--- a/source3/utils/net.h
+++ b/source3/utils/net.h
@@ -70,6 +70,16 @@ struct net_context {
void *private_data;
};
+struct net_dc_info {
+ bool is_dc;
+ bool is_pdc;
+ bool is_ad;
+ bool is_mixed_mode;
+ const char *netbios_domain_name;
+ const char *dns_domain_name;
+ const char *forest_name;
+};
+
#define NET_TRANSPORT_LOCAL 0x01
#define NET_TRANSPORT_RAP 0x02
#define NET_TRANSPORT_RPC 0x04
diff --git a/source3/utils/net_proto.h b/source3/utils/net_proto.h
index ee4388f157..c058a0166f 100644
--- a/source3/utils/net_proto.h
+++ b/source3/utils/net_proto.h
@@ -359,6 +359,7 @@ NTSTATUS rpc_vampire_internals(struct net_context *c,
TALLOC_CTX *mem_ctx,
int argc,
const char **argv);
+int rpc_vampire_passdb(struct net_context *c, int argc, const char **argv);
int rpc_vampire_ldif(struct net_context *c, int argc, const char **argv);
NTSTATUS rpc_vampire_ldif_internals(struct net_context *c,
const DOM_SID *domain_sid,
@@ -473,6 +474,10 @@ void net_display_usage_from_functable(struct functable *table);
const char *net_share_type_str(int num_type);
+NTSTATUS net_scan_dc(struct net_context *c,
+ struct cli_state *cli,
+ struct net_dc_info *dc_info);
+
/* The following definitions come from utils/netlookup.c */
NTSTATUS net_lookup_name_from_sid(struct net_context *c,
diff --git a/source3/utils/net_rap.c b/source3/utils/net_rap.c
index 570e951aee..dd757abd1a 100644
--- a/source3/utils/net_rap.c
+++ b/source3/utils/net_rap.c
@@ -612,7 +612,7 @@ int net_rap_printq_usage(struct net_context *c, int argc, const char **argv)
d_printf(
"net rap printq [misc. options] [targets]\n"
"\tor\n"
- "net rap printq list [<queue_name>] [misc. options] [targets]\n"
+ "net rap printq info [<queue_name>] [misc. options] [targets]\n"
"\tlists the specified queue and jobs on the target server.\n"
"\tIf the queue name is not specified, all queues are listed.\n\n");
d_printf(
@@ -726,9 +726,10 @@ int net_rap_printq(struct net_context *c, int argc, const char **argv)
"info",
rap_printq_info,
NET_TRANSPORT_RAP,
- "Display info about print job",
- "net rap printq info\n"
- " Display info about print job"
+ "Display info about print queues and jobs",
+ "net rap printq info [queue]\n"
+ " Display info about print jobs in queue.\n"
+ " If queue is not specified, all queues are listed"
},
{
"delete",
diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c
index 64a0d8ac40..e2f410b9ac 100644
--- a/source3/utils/net_registry.c
+++ b/source3/utils/net_registry.c
@@ -339,6 +339,10 @@ static int net_registry_setvalue(struct net_context *c, int argc,
value.type = REG_SZ;
value.v.sz.len = strlen(argv[3])+1;
value.v.sz.str = CONST_DISCARD(char *, argv[3]);
+ } else if (strequal(argv[2], "multi_sz")) {
+ value.type = REG_MULTI_SZ;
+ value.v.multi_sz.num_strings = argc - 3;
+ value.v.multi_sz.strings = (char **)(argv + 3);
} else {
d_fprintf(stderr, "type \"%s\" not implemented\n", argv[2]);
goto done;
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 10f2a324a3..3c8ce0326e 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -5253,7 +5253,7 @@ static NTSTATUS rpc_trustdom_add_internals(struct net_context *c,
0, 0, ACB_DOMTRUST, SAMR_FIELD_ACCT_FLAGS,
hours,
0, 0, 0, 0, 0, 0, 0,
- crypt_pwd.data, 24);
+ &crypt_pwd);
result = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
&user_pol,
@@ -6370,6 +6370,14 @@ static int rpc_vampire(struct net_context *c, int argc, const char **argv)
"net rpc vampire keytab\n"
" Dump remote SAM database to Kerberos keytab file"
},
+ {
+ "passdb",
+ rpc_vampire_passdb,
+ NET_TRANSPORT_RPC,
+ "Dump remote SAM database to passdb",
+ "net rpc vampire passdb\n"
+ " Dump remote SAM database to passdb"
+ },
{NULL, NULL, 0, NULL, NULL}
};
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c
index 2fe464a000..8070a6282b 100644
--- a/source3/utils/net_rpc_join.c
+++ b/source3/utils/net_rpc_join.c
@@ -339,7 +339,8 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
&cli->user_session_key,
&crypt_pwd);
- init_samr_user_info24(&set_info.info24, crypt_pwd.data, 24);
+ init_samr_user_info24(&set_info.info24, &crypt_pwd,
+ PASS_DONT_CHANGE_AT_NEXT_LOGON);
CHECK_RPC_ERR(rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
&user_pol,
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index c0922efe6b..6b23db74cb 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -26,6 +26,81 @@
#include "includes.h"
#include "utils/net.h"
+static void parse_samsync_partial_replication_objects(TALLOC_CTX *mem_ctx,
+ int argc,
+ const char **argv,
+ bool *do_single_object_replication,
+ struct samsync_object **objects,
+ uint32_t *num_objects)
+{
+ int i;
+
+ if (argc > 0) {
+ *do_single_object_replication = true;
+ }
+
+ for (i=0; i<argc; i++) {
+
+ struct samsync_object o;
+
+ ZERO_STRUCT(o);
+
+ if (!StrnCaseCmp(argv[i], "user_rid=", strlen("user_rid="))) {
+ o.object_identifier.rid = get_int_param(argv[i]);
+ o.object_type = NETR_DELTA_USER;
+ o.database_id = SAM_DATABASE_DOMAIN;
+ }
+ if (!StrnCaseCmp(argv[i], "group_rid=", strlen("group_rid="))) {
+ o.object_identifier.rid = get_int_param(argv[i]);
+ o.object_type = NETR_DELTA_GROUP;
+ o.database_id = SAM_DATABASE_DOMAIN;
+ }
+ if (!StrnCaseCmp(argv[i], "group_member_rid=", strlen("group_member_rid="))) {
+ o.object_identifier.rid = get_int_param(argv[i]);
+ o.object_type = NETR_DELTA_GROUP_MEMBER;
+ o.database_id = SAM_DATABASE_DOMAIN;
+ }
+ if (!StrnCaseCmp(argv[i], "alias_rid=", strlen("alias_rid="))) {
+ o.object_identifier.rid = get_int_param(argv[i]);
+ o.object_type = NETR_DELTA_ALIAS;
+ o.database_id = SAM_DATABASE_BUILTIN;
+ }
+ if (!StrnCaseCmp(argv[i], "alias_member_rid=", strlen("alias_member_rid="))) {
+ o.object_identifier.rid = get_int_param(argv[i]);
+ o.object_type = NETR_DELTA_ALIAS_MEMBER;
+ o.database_id = SAM_DATABASE_BUILTIN;
+ }
+ if (!StrnCaseCmp(argv[i], "account_sid=", strlen("account_sid="))) {
+ const char *sid_str = get_string_param(argv[i]);
+ string_to_sid(&o.object_identifier.sid, sid_str);
+ o.object_type = NETR_DELTA_ACCOUNT;
+ o.database_id = SAM_DATABASE_PRIVS;
+ }
+ if (!StrnCaseCmp(argv[i], "policy_sid=", strlen("policy_sid="))) {
+ const char *sid_str = get_string_param(argv[i]);
+ string_to_sid(&o.object_identifier.sid, sid_str);
+ o.object_type = NETR_DELTA_POLICY;
+ o.database_id = SAM_DATABASE_PRIVS;
+ }
+ if (!StrnCaseCmp(argv[i], "trustdom_sid=", strlen("trustdom_sid="))) {
+ const char *sid_str = get_string_param(argv[i]);
+ string_to_sid(&o.object_identifier.sid, sid_str);
+ o.object_type = NETR_DELTA_TRUSTED_DOMAIN;
+ o.database_id = SAM_DATABASE_PRIVS;
+ }
+ if (!StrnCaseCmp(argv[i], "secret_name=", strlen("secret_name="))) {
+ o.object_identifier.name = get_string_param(argv[i]);
+ o.object_type = NETR_DELTA_SECRET;
+ o.database_id = SAM_DATABASE_PRIVS;
+ }
+
+ if (o.object_type > 0) {
+ ADD_TO_ARRAY(mem_ctx, struct samsync_object, o,
+ objects, num_objects);
+ }
+ }
+}
+
/* dump sam database via samsync rpc calls */
NTSTATUS rpc_samdump_internals(struct net_context *c,
const DOM_SID *domain_sid,
@@ -48,9 +123,17 @@ NTSTATUS rpc_samdump_internals(struct net_context *c,
ctx->mode = NET_SAMSYNC_MODE_DUMP;
ctx->cli = pipe_hnd;
- ctx->delta_fn = display_sam_entries;
+ ctx->ops = &libnet_samsync_display_ops;
ctx->domain_name = domain_name;
+ ctx->force_full_replication = c->opt_force_full_repl ? true : false;
+ ctx->clean_old_entries = c->opt_clean_old_entries ? true : false;
+
+ parse_samsync_partial_replication_objects(ctx, argc, argv,
+ &ctx->single_object_replication,
+ &ctx->objects,
+ &ctx->num_objects);
+
libnet_samsync(SAM_DATABASE_DOMAIN, ctx);
libnet_samsync(SAM_DATABASE_BUILTIN, ctx);
@@ -123,9 +206,17 @@ NTSTATUS rpc_vampire_internals(struct net_context *c,
ctx->mode = NET_SAMSYNC_MODE_FETCH_PASSDB;
ctx->cli = pipe_hnd;
- ctx->delta_fn = fetch_sam_entries;
+ ctx->ops = &libnet_samsync_passdb_ops;
ctx->domain_name = domain_name;
+ ctx->force_full_replication = c->opt_force_full_repl ? true : false;
+ ctx->clean_old_entries = c->opt_clean_old_entries ? true : false;
+
+ parse_samsync_partial_replication_objects(ctx, argc, argv,
+ &ctx->single_object_replication,
+ &ctx->objects,
+ &ctx->num_objects);
+
/* fetch domain */
result = libnet_samsync(SAM_DATABASE_DOMAIN, ctx);
@@ -157,6 +248,19 @@ NTSTATUS rpc_vampire_internals(struct net_context *c,
return result;
}
+int rpc_vampire_passdb(struct net_context *c, int argc, const char **argv)
+{
+ if (c->display_usage) {
+ d_printf("Usage:\n"
+ "net rpc vampire passdb\n"
+ " Dump remote SAM database to passdb\n");
+ return 0;
+ }
+
+ return run_rpc_command(c, NULL, &ndr_table_netlogon.syntax_id, 0,
+ rpc_vampire_internals, argc, argv);
+}
+
NTSTATUS rpc_vampire_ldif_internals(struct net_context *c,
const DOM_SID *domain_sid,
const char *domain_name,
@@ -179,12 +283,21 @@ NTSTATUS rpc_vampire_ldif_internals(struct net_context *c,
if (argc >= 1) {
ctx->output_filename = argv[0];
}
+ if (argc >= 2) {
+ parse_samsync_partial_replication_objects(ctx, argc-1, argv+1,
+ &ctx->single_object_replication,
+ &ctx->objects,
+ &ctx->num_objects);
+ }
ctx->mode = NET_SAMSYNC_MODE_FETCH_LDIF;
ctx->cli = pipe_hnd;
- ctx->delta_fn = fetch_sam_entries_ldif;
+ ctx->ops = &libnet_samsync_ldif_ops;
ctx->domain_name = domain_name;
+ ctx->force_full_replication = c->opt_force_full_repl ? true : false;
+ ctx->clean_old_entries = c->opt_clean_old_entries ? true : false;
+
/* fetch domain */
status = libnet_samsync(SAM_DATABASE_DOMAIN, ctx);
@@ -249,17 +362,29 @@ 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];
}
+ if (argc >= 2) {
+ parse_samsync_partial_replication_objects(ctx, argc-1, argv+1,
+ &ctx->single_object_replication,
+ &ctx->objects,
+ &ctx->num_objects);
+ }
ctx->mode = NET_SAMSYNC_MODE_FETCH_KEYTAB;
ctx->cli = pipe_hnd;
- ctx->delta_fn = fetch_sam_entries_keytab;
+ ctx->ops = &libnet_samsync_keytab_ops;
ctx->domain_name = domain_name;
ctx->username = c->opt_user_name;
ctx->password = c->opt_password;
+ ctx->force_full_replication = c->opt_force_full_repl ? true : false;
+ ctx->clean_old_entries = c->opt_clean_old_entries ? true : false;
+
/* fetch domain */
status = libnet_samsync(SAM_DATABASE_DOMAIN, ctx);
@@ -299,9 +424,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;
@@ -341,22 +470,41 @@ static NTSTATUS rpc_vampire_keytab_ds_internals(struct net_context *c,
int rpc_vampire_keytab(struct net_context *c, int argc, const char **argv)
{
int ret = 0;
+ NTSTATUS status;
+ struct cli_state *cli = NULL;
+ struct net_dc_info dc_info;
- 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;
}
- ret = run_rpc_command(c, NULL, &ndr_table_drsuapi.syntax_id,
- NET_FLAGS_SEAL,
- rpc_vampire_keytab_ds_internals, argc, argv);
- if (ret == 0) {
- return 0;
+ status = net_make_ipc_connection(c, 0, &cli);
+ if (!NT_STATUS_IS_OK(status)) {
+ return -1;
}
- return run_rpc_command(c, NULL, &ndr_table_netlogon.syntax_id, 0,
- rpc_vampire_keytab_internals,
- argc, argv);
+ status = net_scan_dc(c, cli, &dc_info);
+ if (!NT_STATUS_IS_OK(status)) {
+ return -1;
+ }
+
+ if (!dc_info.is_ad) {
+ printf("DC is not running Active Directory\n");
+ return -1;
+ }
+
+ if (dc_info.is_mixed_mode) {
+ ret = run_rpc_command(c, cli, &ndr_table_netlogon.syntax_id,
+ 0,
+ rpc_vampire_keytab_internals, argc, argv);
+ } else {
+ ret = run_rpc_command(c, cli, &ndr_table_drsuapi.syntax_id,
+ NET_FLAGS_SEAL,
+ rpc_vampire_keytab_ds_internals, argc, argv);
+ }
+
+ return ret;
}
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/net_util.c b/source3/utils/net_util.c
index a9b2bbe621..590a916522 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -607,3 +607,41 @@ const char *net_share_type_str(int num_type)
default: return "Unknown";
}
}
+
+NTSTATUS net_scan_dc(struct net_context *c,
+ struct cli_state *cli,
+ struct net_dc_info *dc_info)
+{
+ TALLOC_CTX *mem_ctx = talloc_tos();
+ struct rpc_pipe_client *dssetup_pipe = NULL;
+ union dssetup_DsRoleInfo info;
+ NTSTATUS status;
+
+ ZERO_STRUCTP(dc_info);
+
+ status = cli_rpc_pipe_open_noauth(cli, &ndr_table_dssetup.syntax_id,
+ &dssetup_pipe);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ status = rpccli_dssetup_DsRoleGetPrimaryDomainInformation(dssetup_pipe, mem_ctx,
+ DS_ROLE_BASIC_INFORMATION,
+ &info,
+ NULL);
+ TALLOC_FREE(dssetup_pipe);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ dc_info->is_dc = (info.basic.role & (DS_ROLE_PRIMARY_DC|DS_ROLE_BACKUP_DC));
+ dc_info->is_pdc = (info.basic.role & DS_ROLE_PRIMARY_DC);
+ dc_info->is_ad = (info.basic.flags & DS_ROLE_PRIMARY_DS_RUNNING);
+ dc_info->is_mixed_mode = (info.basic.flags & DS_ROLE_PRIMARY_DS_MIXED_MODE);
+ dc_info->netbios_domain_name = talloc_strdup(mem_ctx, info.basic.domain);
+ dc_info->dns_domain_name = talloc_strdup(mem_ctx, info.basic.dns_domain);
+ dc_info->forest_name = talloc_strdup(mem_ctx, info.basic.forest);
+
+ return NT_STATUS_OK;
+}
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 0a76761cb2..8aa8e5e0f9 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 */
@@ -535,7 +547,8 @@ static NTSTATUS winbind_pw_check(struct ntlmssp_state *ntlmssp_state, DATA_BLOB
if (memcmp(user_sess_key, zeros, 16) != 0) {
*user_session_key = data_blob(user_sess_key, 16);
}
- ntlmssp_state->auth_context = talloc_strdup(ntlmssp_state->mem_ctx, unix_name);
+ ntlmssp_state->auth_context = talloc_strdup(ntlmssp_state,
+ unix_name);
SAFE_FREE(unix_name);
} else {
DEBUG(NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED) ? 0 : 3,
@@ -555,7 +568,7 @@ static NTSTATUS local_pw_check(struct ntlmssp_state *ntlmssp_state, DATA_BLOB *u
nt_lm_owf_gen (opt_password, nt_pw, lm_pw);
- nt_status = ntlm_password_check(ntlmssp_state->mem_ctx,
+ nt_status = ntlm_password_check(ntlmssp_state,
&ntlmssp_state->chal,
&ntlmssp_state->lm_resp,
&ntlmssp_state->nt_resp,
@@ -566,7 +579,7 @@ static NTSTATUS local_pw_check(struct ntlmssp_state *ntlmssp_state, DATA_BLOB *u
lm_pw, nt_pw, user_session_key, lm_session_key);
if (NT_STATUS_IS_OK(nt_status)) {
- ntlmssp_state->auth_context = talloc_asprintf(ntlmssp_state->mem_ctx,
+ ntlmssp_state->auth_context = talloc_asprintf(ntlmssp_state,
"%s%c%s", ntlmssp_state->domain,
*lp_winbind_separator(),
ntlmssp_state->user);
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);
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index ce2de4d7fe..9fc02bac13 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -30,15 +30,15 @@ static enum tree_level level = LEV_SHARE;
/* Holds a list of workgroups or servers */
-struct name_list {
- struct name_list *prev, *next;
+struct smb_name_list {
+ struct smb_name_list *prev, *next;
char *name, *comment;
uint32 server_type;
};
-static struct name_list *workgroups, *servers, *shares;
+static struct smb_name_list *workgroups, *servers, *shares;
-static void free_name_list(struct name_list *list)
+static void free_name_list(struct smb_name_list *list)
{
while(list)
DLIST_REMOVE(list, list);
@@ -47,10 +47,10 @@ static void free_name_list(struct name_list *list)
static void add_name(const char *machine_name, uint32 server_type,
const char *comment, void *state)
{
- struct name_list **name_list = (struct name_list **)state;
- struct name_list *new_name;
+ struct smb_name_list **name_list = (struct smb_name_list **)state;
+ struct smb_name_list *new_name;
- new_name = SMB_MALLOC_P(struct name_list);
+ new_name = SMB_MALLOC_P(struct smb_name_list);
if (!new_name)
return;
@@ -222,7 +222,7 @@ static bool get_shares(char *server_name, struct user_auth_info *user_info)
static bool print_tree(struct user_auth_info *user_info)
{
- struct name_list *wg, *sv, *sh;
+ struct smb_name_list *wg, *sv, *sh;
/* List workgroups */