summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2018-12-08 15:05:53 +0100
committerJeremy Allison <jra@samba.org>2018-12-11 00:40:30 +0100
commit302840173714420efeef219ebdf8bd13b850aaa4 (patch)
treea80f2e8cb1d11979c8208c928801d772c9862d79
parentc48d6345e32fb8f5727f8545c60d58bd7570b056 (diff)
downloadsamba-302840173714420efeef219ebdf8bd13b850aaa4.tar.gz
net: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/utils/net_groupmap.c22
-rw-r--r--source3/utils/net_lookup.c6
-rw-r--r--source3/utils/net_rpc.c4
-rw-r--r--source3/utils/net_rpc_shell.c4
-rw-r--r--source3/utils/net_sam.c19
-rw-r--r--source3/utils/net_usershare.c6
6 files changed, 44 insertions, 17 deletions
diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c
index 6559cd7f0b9..b4da9bae556 100644
--- a/source3/utils/net_groupmap.c
+++ b/source3/utils/net_groupmap.c
@@ -68,12 +68,16 @@ static bool get_sid_from_input(struct dom_sid *sid, char *input)
static void print_map_entry (const GROUP_MAP *map, bool long_list)
{
+ struct dom_sid_buf buf;
+
if (!long_list)
d_printf("%s (%s) -> %s\n", map->nt_name,
- sid_string_tos(&map->sid), gidtoname(map->gid));
+ dom_sid_str_buf(&map->sid, &buf),
+ gidtoname(map->gid));
else {
d_printf("%s\n", map->nt_name);
- d_printf(_("\tSID : %s\n"), sid_string_tos(&map->sid));
+ d_printf(_("\tSID : %s\n"),
+ dom_sid_str_buf(&map->sid, &buf));
d_printf(_("\tUnix gid : %u\n"), (unsigned int)map->gid);
d_printf(_("\tUnix group: %s\n"), gidtoname(map->gid));
d_printf(_("\tGroup type: %s\n"),
@@ -303,8 +307,9 @@ static int net_groupmap_add(struct net_context *c, int argc, const char **argv)
/* Default is domain group. */
map->sid_name_use = SID_NAME_DOM_GRP;
if (pdb_getgrgid(map, gid)) {
+ struct dom_sid_buf buf;
d_printf(_("Unix group %s already mapped to SID %s\n"),
- unixgrp, sid_string_tos(&map->sid));
+ unixgrp, dom_sid_str_buf(&map->sid, &buf));
TALLOC_FREE(map);
return -1;
}
@@ -767,9 +772,10 @@ static int net_groupmap_cleanup(struct net_context *c, int argc, const char **ar
if (!sid_check_is_in_our_sam(&maps[i]->sid) &&
!sid_check_is_in_builtin(&maps[i]->sid))
{
+ struct dom_sid_buf buf;
printf(_("Deleting mapping for NT Group %s, sid %s\n"),
maps[i]->nt_name,
- sid_string_tos(&maps[i]->sid));
+ dom_sid_str_buf(&maps[i]->sid, &buf));
pdb_delete_group_mapping_entry(maps[i]->sid);
}
}
@@ -850,7 +856,8 @@ static int net_groupmap_listmem(struct net_context *c, int argc, const char **ar
}
for (i = 0; i < num; i++) {
- printf("%s\n", sid_string_tos(&(members[i])));
+ struct dom_sid_buf buf;
+ printf("%s\n", dom_sid_str_buf(&(members[i]), &buf));
}
TALLOC_FREE(members);
@@ -864,6 +871,7 @@ static bool print_alias_memberships(TALLOC_CTX *mem_ctx,
{
uint32_t *alias_rids;
size_t i, num_alias_rids;
+ struct dom_sid_buf buf;
alias_rids = NULL;
num_alias_rids = 0;
@@ -872,14 +880,14 @@ static bool print_alias_memberships(TALLOC_CTX *mem_ctx,
mem_ctx, domain_sid, member, 1,
&alias_rids, &num_alias_rids))) {
d_fprintf(stderr, _("Could not list memberships for sid %s\n"),
- sid_string_tos(member));
+ dom_sid_str_buf(member, &buf));
return false;
}
for (i = 0; i < num_alias_rids; i++) {
struct dom_sid alias;
sid_compose(&alias, domain_sid, alias_rids[i]);
- printf("%s\n", sid_string_tos(&alias));
+ printf("%s\n", dom_sid_str_buf(&alias, &buf));
}
return true;
diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c
index 140f9900795..df047f617e7 100644
--- a/source3/utils/net_lookup.c
+++ b/source3/utils/net_lookup.c
@@ -337,6 +337,7 @@ static int net_lookup_name(struct net_context *c, int argc, const char **argv)
{
const char *dom, *name;
struct dom_sid sid;
+ struct dom_sid_buf buf;
enum lsa_SidType type;
if (argc != 1) {
@@ -352,7 +353,7 @@ static int net_lookup_name(struct net_context *c, int argc, const char **argv)
return -1;
}
- d_printf("%s %d (%s) %s\\%s\n", sid_string_tos(&sid),
+ d_printf("%s %d (%s) %s\\%s\n", dom_sid_str_buf(&sid, &buf),
type, sid_type_lookup(type), dom, name);
return 0;
}
@@ -361,6 +362,7 @@ static int net_lookup_sid(struct net_context *c, int argc, const char **argv)
{
const char *dom, *name;
struct dom_sid sid;
+ struct dom_sid_buf buf;
enum lsa_SidType type;
if (argc != 1) {
@@ -381,7 +383,7 @@ static int net_lookup_sid(struct net_context *c, int argc, const char **argv)
return -1;
}
- d_printf("%s %d (%s) %s\\%s\n", sid_string_tos(&sid),
+ d_printf("%s %d (%s) %s\\%s\n", dom_sid_str_buf(&sid, &buf),
type, sid_type_lookup(type), dom, name);
return 0;
}
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index d6ade7471b4..a3b3727b484 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -4843,7 +4843,9 @@ static void dump_user_token(struct user_token *token)
d_printf("%s\n", token->name);
for (i=0; i<token->token.num_sids; i++) {
- d_printf(" %s\n", sid_string_tos(&token->token.sids[i]));
+ struct dom_sid_buf buf;
+ d_printf(" %s\n",
+ dom_sid_str_buf(&token->token.sids[i], &buf));
}
}
diff --git a/source3/utils/net_rpc_shell.c b/source3/utils/net_rpc_shell.c
index 120cfa6af95..f07ba779bba 100644
--- a/source3/utils/net_rpc_shell.c
+++ b/source3/utils/net_rpc_shell.c
@@ -27,6 +27,7 @@
#include "lib/netapi/netapi_net.h"
#include "../libcli/smbreadline/smbreadline.h"
#include "libsmb/libsmb.h"
+#include "libcli/security/dom_sid.h"
static NTSTATUS rpc_sh_info(struct net_context *c,
TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx,
@@ -219,6 +220,7 @@ int net_rpc_shell(struct net_context *c, int argc, const char **argv)
{
NTSTATUS status;
struct rpc_sh_ctx *ctx;
+ struct dom_sid_buf buf;
if (argc != 0 || c->display_usage) {
d_printf("%s\nnet rpc shell\n", _("Usage:"));
@@ -258,7 +260,7 @@ int net_rpc_shell(struct net_context *c, int argc, const char **argv)
}
d_printf(_("Talking to domain %s (%s)\n"), ctx->domain_name,
- sid_string_tos(ctx->domain_sid));
+ dom_sid_str_buf(ctx->domain_sid, &buf));
this_ctx = ctx;
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c
index 52d6515f014..5a9d1792d51 100644
--- a/source3/utils/net_sam.c
+++ b/source3/utils/net_sam.c
@@ -693,13 +693,15 @@ static int net_sam_rights_list(struct net_context *c, int argc,
for (i=0; i<num_sids; i++) {
const char *dom, *name;
enum lsa_SidType type;
+ struct dom_sid_buf buf;
if (lookup_sid(talloc_tos(), &sids[i], &dom, &name,
&type)) {
d_printf("%s\\%s\n", dom, name);
}
else {
- d_printf("%s\n", sid_string_tos(&sids[i]));
+ d_printf("%s\n",
+ dom_sid_str_buf(&sids[i], &buf));
}
}
return 0;
@@ -871,6 +873,7 @@ static int net_sam_mapunixgroup(struct net_context *c, int argc, const char **ar
NTSTATUS status;
GROUP_MAP *map;
struct group *grp;
+ struct dom_sid_buf buf;
if (argc != 1 || c->display_usage) {
d_fprintf(stderr, "%s\n%s",
@@ -900,7 +903,7 @@ static int net_sam_mapunixgroup(struct net_context *c, int argc, const char **ar
}
d_printf(_("Mapped unix group %s to SID %s\n"), argv[0],
- sid_string_tos(&map->sid));
+ dom_sid_str_buf(&map->sid, &buf));
TALLOC_FREE(map);
return 0;
@@ -1328,8 +1331,11 @@ static int net_sam_delmem(struct net_context *c, int argc, const char **argv)
d_printf(_("Deleted %s\\%s from %s\\%s\n"),
memberdomain, membername, groupdomain, groupname);
} else {
+ struct dom_sid_buf buf;
d_printf(_("Deleted %s from %s\\%s\n"),
- sid_string_tos(&member), groupdomain, groupname);
+ dom_sid_str_buf(&member, &buf),
+ groupdomain,
+ groupname);
}
return 0;
@@ -1406,7 +1412,9 @@ static int net_sam_listmem(struct net_context *c, int argc, const char **argv)
if (lookup_sid(talloc_tos(), &members[i], &dom, &name, NULL)) {
d_printf(" %s\\%s\n", dom, name);
} else {
- d_printf(" %s\n", sid_string_tos(&members[i]));
+ struct dom_sid_buf buf;
+ d_printf(" %s\n",
+ dom_sid_str_buf(&members[i], &buf));
}
}
@@ -1555,6 +1563,7 @@ static int net_sam_list(struct net_context *c, int argc, const char **argv)
static int net_sam_show(struct net_context *c, int argc, const char **argv)
{
struct dom_sid sid;
+ struct dom_sid_buf buf;
enum lsa_SidType type;
const char *dom, *name;
@@ -1572,7 +1581,7 @@ static int net_sam_show(struct net_context *c, int argc, const char **argv)
}
d_printf(_("%s\\%s is a %s with SID %s\n"), dom, name,
- sid_type_lookup(type), sid_string_tos(&sid));
+ sid_type_lookup(type), dom_sid_str_buf(&sid, &buf));
return 0;
}
diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c
index 1e2925979d0..f5b126aa3d1 100644
--- a/source3/utils/net_usershare.c
+++ b/source3/utils/net_usershare.c
@@ -818,6 +818,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
for (i = 0; i < num_aces; i++) {
struct dom_sid sid;
+ struct dom_sid_buf buf;
const char *pcolon = strchr_m(pacl, ':');
const char *name;
@@ -881,7 +882,10 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
}
}
us_acl = talloc_asprintf_append(
- us_acl, "%s:%c,", sid_string_tos(&sid), pcolon[1]);
+ us_acl,
+ "%s:%c,",
+ dom_sid_str_buf(&sid, &buf),
+ pcolon[1]);
/* Move to the next ACL entry. */
if (pcolon[2] == ',') {