* Unix SMB/CIFS implementation.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-2000,
- * Copyright (C) Jean François Micouleau 1998-2001.
+ * Copyright (C) Jean François Micouleau 1998-2001.
* Copyright (C) Gerald Carter 2003,
* Copyright (C) Volker Lendecke 2004
*
#include "utils/net.h"
#include "../libcli/security/security.h"
#include "passdb.h"
+#include "lib/util/string_wrappers.h"
/*********************************************************
Figure out if the input was an NT group or a SID string.
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"),
fstring type = "";
fstring ntcomment = "";
enum lsa_SidType sid_type = SID_NAME_DOM_GRP;
- uint32 rid = 0;
+ uint32_t rid = 0;
gid_t gid;
int i;
GROUP_MAP *map;
if ( rid < DOMAIN_RID_ADMINS ) {
d_fprintf(stderr,
_("RID must be greater than %d\n"),
- (uint32)DOMAIN_RID_ADMINS-1);
+ (uint32_t)DOMAIN_RID_ADMINS-1);
return -1;
}
}
/* 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;
}
if (c->opt_rid == 0) {
if ( pdb_capabilities() & PDB_CAP_STORE_RIDS ) {
- if ( !pdb_new_rid((uint32*)&c->opt_rid) ) {
+ if ( !pdb_new_rid((uint32_t *)&c->opt_rid) ) {
d_fprintf( stderr,
_("Could not allocate new RID\n"));
TALLOC_FREE(map);
printf(_("Group %s is not mapped\n"),
maps[i]->nt_name);
- if (!sid_check_is_in_our_sam(&maps[i]->sid)) {
+ 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);
}
}
}
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);
const struct dom_sid *domain_sid,
const struct dom_sid *member)
{
- uint32 *alias_rids;
+ uint32_t *alias_rids;
size_t i, num_alias_rids;
+ struct dom_sid_buf buf;
alias_rids = NULL;
num_alias_rids = 0;
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;