Пример #1
0
	ustring MakeSDDL(const ustring &name, const ustring &group, mode_t mode, bool protect) {
		ustring Result;
		if (!name.empty())
			Result = Result + L"O:" + Sid(name.c_str()).as_str();
		if (!group.empty())
			Result = Result + L"G:" + Sid(group.c_str()).as_str();
		Result += L"D:";
		if (protect)
			Result += L"P";
		Result += Mode2Sddl(name, group, mode);
		return Result;
	}
Пример #2
0
	ustring ExpAccess::get_name() const {
		TRUSTEE_FORM tf = ::GetTrusteeFormW((PTRUSTEEW)&Trustee);
		if (tf == TRUSTEE_IS_NAME)
			return ustring(::GetTrusteeNameW((PTRUSTEEW)&Trustee));
		else if (tf != TRUSTEE_IS_SID)
			CheckApiError(ERROR_INVALID_PARAMETER);
		return Sid((PSID)Trustee.ptstrName).get_name();
	}
Пример #3
0
	void WinUsers::add(const ustring& name, const ustring& pass) {
		User::add(name, pass);
		push_back(UserInfo(UserBuf(name).data()));
		if (!m_group.empty())
			Group::add_member(m_group, Sid(name.c_str()));
	}
Пример #4
0
	Sid ExpAccess::get_sid() const {
		if (::GetTrusteeFormW((PTRUSTEEW)&Trustee) != TRUSTEE_IS_SID)
			CheckApiError(ERROR_INVALID_PARAMETER);
		return Sid((PSID)Trustee.ptstrName);
	}