示例#1
0
文件: net.c 项目: AllardJ/Tomato
static uint32 get_maxrid(void)
{
	uint32 max_rid = 0;

	if (!search_maxrid(pdb_search_users(0), "users", &max_rid))
		return 0;

	if (!search_maxrid(pdb_search_groups(), "groups", &max_rid))
		return 0;

	if (!search_maxrid(pdb_search_aliases(get_global_sam_sid()),
			   "aliases", &max_rid))
		return 0;
	
	return max_rid;
}
示例#2
0
static NTSTATUS enum_groups_internal(struct winbindd_domain *domain,
				TALLOC_CTX *mem_ctx,
				uint32 *num_entries, 
				struct acct_info **info,
				enum lsa_SidType sidtype)
{
	struct pdb_search *search;
	struct samr_displayentry *entries;
	int i;
	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;

	if (sidtype == SID_NAME_ALIAS) {
		search = pdb_search_aliases(&domain->sid);
	} else {
		search = pdb_search_groups();
	}

	if (search == NULL) goto done;

	*num_entries = pdb_search_entries(search, 0, 0xffffffff, &entries);
	if (*num_entries == 0) {
		/* Zero entries isn't an error */
		result = NT_STATUS_OK;
		goto done;
	}

	*info = TALLOC_ARRAY(mem_ctx, struct acct_info, *num_entries);
	if (*info == NULL) {
		result = NT_STATUS_NO_MEMORY;
		goto done;
	}

	for (i=0; i<*num_entries; i++) {
		fstrcpy((*info)[i].acct_name, entries[i].account_name);
		fstrcpy((*info)[i].acct_desc, entries[i].description);
		(*info)[i].rid = entries[i].rid;
	}

	result = NT_STATUS_OK;
 done:
	pdb_search_destroy(search);
	return result;
}