示例#1
0
文件: pdbedit.c 项目: OPSF/uClinux
/*********************************************************
 List Users
**********************************************************/
static int print_users_list (struct pdb_methods *in, BOOL verbosity, BOOL smbpwdstyle)
{
	struct samu *sam_pwent=NULL;
	BOOL check;
	
	check = NT_STATUS_IS_OK(in->setsampwent(in, False, 0));
	if (!check) {
		return 1;
	}

	check = True;
	if ( (sam_pwent = samu_new( NULL )) == NULL ) {
		return 1;
	}

	while (check && NT_STATUS_IS_OK(in->getsampwent (in, sam_pwent))) {
		if (verbosity)
			printf ("---------------\n");
		print_sam_info (sam_pwent, verbosity, smbpwdstyle);
		TALLOC_FREE(sam_pwent);
		
		if ( (sam_pwent = samu_new( NULL )) == NULL ) {
			check = False;
		}
	}
	if (check) 
		TALLOC_FREE(sam_pwent);
	
	in->endsampwent(in);
	return 0;
}
示例#2
0
文件: pdbedit.c 项目: Gazzonyx/samba
/*********************************************************
 List Users
**********************************************************/
static int print_users_list(bool verbosity, bool smbpwdstyle)
{
	struct pdb_search *u_search;
	struct samr_displayentry userentry;
	struct samu *sam_pwent;
	TALLOC_CTX *tosctx;
	struct dom_sid user_sid;
	bool bret;
	int ret;

	tosctx = talloc_tos();
	if (!tosctx) {
		DEBUG(0, ("talloc failed\n"));
		return 1;
	}

	u_search = pdb_search_users(tosctx, 0);
	if (!u_search) {
		DEBUG(0, ("User Search failed!\n"));
		ret = 1;
		goto done;
	}

	while (u_search->next_entry(u_search, &userentry)) {

		sam_pwent = samu_new(tosctx);
		if (sam_pwent == NULL) {
			DEBUG(0, ("talloc failed\n"));
			ret = 1;
			goto done;
		}

		sid_compose(&user_sid, get_global_sam_sid(), userentry.rid);

		bret = pdb_getsampwsid(sam_pwent, &user_sid);
		if (!bret) {
			DEBUG(2, ("getsampwsid failed\n"));
			TALLOC_FREE(sam_pwent);
			continue;
		}

		if (verbosity) {
			printf ("---------------\n");
		}
		print_sam_info(sam_pwent, verbosity, smbpwdstyle);
		TALLOC_FREE(sam_pwent);
	}

	ret = 0;

done:
	TALLOC_FREE(tosctx);
	return ret;
}
示例#3
0
文件: pdbedit.c 项目: OPSF/uClinux
static int print_user_info (struct pdb_methods *in, const char *username, BOOL verbosity, BOOL smbpwdstyle)
{
	struct samu *sam_pwent=NULL;
	BOOL ret;

	if ( (sam_pwent = samu_new( NULL )) == NULL ) {
		return -1;
	}

	ret = NT_STATUS_IS_OK(in->getsampwnam (in, sam_pwent, username));

	if (ret==False) {
		fprintf (stderr, "Username not found!\n");
		TALLOC_FREE(sam_pwent);
		return -1;
	}

	ret=print_sam_info (sam_pwent, verbosity, smbpwdstyle);
	TALLOC_FREE(sam_pwent);
	
	return ret;
}
示例#4
0
文件: pdbedit.c 项目: Gazzonyx/samba
static int print_user_info(const char *username,
			   bool verbosity, bool smbpwdstyle)
{
	struct samu *sam_pwent = NULL;
	bool bret;
	int ret;

	sam_pwent = samu_new(NULL);
	if (!sam_pwent) {
		return -1;
	}

	bret = pdb_getsampwnam(sam_pwent, username);
	if (!bret) {
		fprintf (stderr, "Username not found!\n");
		TALLOC_FREE(sam_pwent);
		return -1;
	}

	ret = print_sam_info(sam_pwent, verbosity, smbpwdstyle);

	TALLOC_FREE(sam_pwent);
	return ret;
}