mirror of
https://github.com/samba-team/samba.git
synced 2025-12-06 16:23:49 +03:00
r816: - Make use of tridge's new samdb_result_sid_prefix() helper function.
- Remove legacy sid_to_string (which contained a memleak) - Remove some unused parts of lib/util_sid.c Andrew Bartlett
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
b4b67c3301
commit
7c69a85984
@@ -143,76 +143,6 @@ void generate_wellknown_sids(void)
|
||||
initialised = True;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
Splits a name of format \DOMAIN\name or name into its two components.
|
||||
Sets the DOMAIN name to lp_netbios_name() if it has not been specified.
|
||||
***************************************************************************/
|
||||
|
||||
void split_domain_name(const char *fullname, char *domain, char *name)
|
||||
{
|
||||
pstring full_name;
|
||||
const char *sep;
|
||||
char *p;
|
||||
|
||||
sep = lp_winbind_separator();
|
||||
|
||||
*domain = *name = '\0';
|
||||
|
||||
if (fullname[0] == sep[0] || fullname[0] == '\\')
|
||||
fullname++;
|
||||
|
||||
pstrcpy(full_name, fullname);
|
||||
p = strchr_m(full_name+1, '\\');
|
||||
if (!p) p = strchr_m(full_name+1, sep[0]);
|
||||
|
||||
if (p != NULL) {
|
||||
*p = 0;
|
||||
fstrcpy(domain, full_name);
|
||||
fstrcpy(name, p+1);
|
||||
} else {
|
||||
fstrcpy(domain, lp_netbios_name());
|
||||
fstrcpy(name, full_name);
|
||||
}
|
||||
|
||||
DEBUG(10,("split_domain_name:name '%s' split into domain :'%s' and user :'%s'\n",
|
||||
fullname, domain, name));
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
Convert a SID to an ascii string.
|
||||
*****************************************************************/
|
||||
|
||||
char *sid_to_string(fstring sidstr_out, const struct dom_sid *sid)
|
||||
{
|
||||
char *tmp_string;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
if (!(mem_ctx = talloc_init("sid_to_string temp context"))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tmp_string = dom_sid_string(mem_ctx, sid);
|
||||
if (!tmp_string)
|
||||
return NULL;
|
||||
|
||||
fstrcpy(sidstr_out, tmp_string);
|
||||
return sidstr_out;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
Removes the last rid from the end of a sid
|
||||
*****************************************************************/
|
||||
|
||||
BOOL sid_split_rid(struct dom_sid *sid, uint32 *rid)
|
||||
{
|
||||
if (sid->num_auths > 0) {
|
||||
sid->num_auths--;
|
||||
if (rid)
|
||||
*rid = sid->sub_auths[sid->num_auths];
|
||||
return True;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
Return the last rid from the end of a sid
|
||||
*****************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user