Lookup string names for SID types.
****************************************************************************/
-const static struct {
+static const struct {
enum SID_NAME_USE sid_type;
- char *string;
+ const char *string;
} sid_name_type[] = {
{SID_NAME_USER, "User"},
{SID_NAME_DOM_GRP, "Domain Group"},
{SID_NAME_DELETED, "Deleted Account"},
{SID_NAME_INVALID, "Invalid Account"},
{SID_NAME_UNKNOWN, "UNKNOWN"},
+ {SID_NAME_COMPUTER, "Computer"},
- {SID_NAME_USE_NONE, NULL}
+ {(enum SID_NAME_USE)0, NULL}
};
const char *sid_type_lookup(uint32 sid_type)
return &system_token;
}
+/******************************************************************
+ get the default domain/netbios name to be used when dealing
+ with our passdb list of accounts
+******************************************************************/
+
+const char *get_global_sam_name(void)
+{
+ if ((lp_server_role() == ROLE_DOMAIN_PDC) || (lp_server_role() == ROLE_DOMAIN_BDC)) {
+ return lp_workgroup();
+ }
+ return global_myname();
+}
+
/**************************************************************************
Splits a name of format \DOMAIN\name or name into its two components.
Sets the DOMAIN name to global_myname() if it has not been specified.
void split_domain_name(const char *fullname, char *domain, char *name)
{
pstring full_name;
- char *p, *sep;
+ const char *sep;
+ char *p;
sep = lp_winbind_separator();
fstrcpy(domain, full_name);
fstrcpy(name, p+1);
} else {
- fstrcpy(domain, global_myname());
+ fstrcpy(domain, get_global_sam_name());
fstrcpy(name, full_name);
}
if (!exp_dom_sid || !sid || !rid)
return False;
+ if (sid->num_auths != (exp_dom_sid->num_auths+1)) {
+ return False;
+ }
if (sid_compare_domain(exp_dom_sid, sid)!=0){
*rid=(-1);
return s;
}
+/*******************************************************************
+ Tallocs a duplicate SID.
+********************************************************************/
-/*****************************************************************
- Print a GUID structure for debugging.
-*****************************************************************/
-
-void print_guid(GUID *guid)
+DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src)
{
- int i;
-
- d_printf("%08x-%04x-%04x",
- IVAL(guid->info, 0), SVAL(guid->info, 4), SVAL(guid->info, 6));
- d_printf("-%02x%02x-", guid->info[8], guid->info[9]);
- for (i=10;i<GUID_SIZE;i++)
- d_printf("%02x", guid->info[i]);
- d_printf("\n");
+ DOM_SID *dst;
+
+ if(!src)
+ return NULL;
+
+ if((dst = talloc_zero(ctx, sizeof(DOM_SID))) != NULL) {
+ sid_copy( dst, src);
+ }
+
+ return dst;
}