already_AddRefed<nsIPerformanceStats>
nsPerformanceSnapshot::ImportStats(JSContext* cx, const js::PerformanceData& performance, const uint64_t uid) {
  JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx));

  if (!global) {
    // While it is possible for a compartment to have no global
    // (e.g. atoms), this compartment is not very interesting for us.
    return nullptr;
  }

  nsString groupId;
  GetGroupId(cx, uid, groupId);

  nsString addonId;
  GetAddonId(cx, global, addonId);

  nsString title;
  uint64_t windowId;
  GetWindowData(cx, title, &windowId);

  nsAutoString name;
  nsAutoCString cname;
  xpc::GetCurrentCompartmentName(cx, cname);
  name.Assign(NS_ConvertUTF8toUTF16(cname));

  bool isSystem = GetIsSystem(cx, global);

  nsCOMPtr<nsIPerformanceStats> result =
    new nsPerformanceStats(name, groupId, addonId, title, windowId, isSystem, performance);
  return result.forget();
}
Example #2
0
already_AddRefed<nsIPerformanceStats>
nsPerformanceSnapshot::ImportStats(JSContext* cx, const js::PerformanceData& performance, const uint64_t uid, nsIPerformanceStats* parent) {
  if (performance.ticks == 0) {
    // Ignore compartments with no activity.
    return nullptr;
  }
  JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx));

  if (!global) {
    // While it is possible for a compartment to have no global
    // (e.g. atoms), this compartment is not very interesting for us.
    return nullptr;
  }

  nsString groupId;
  GetGroupId(cx, uid, groupId);

  nsString addonId;
  GetAddonId(cx, global, addonId);

  nsString title;
  uint64_t windowId;
  GetWindowData(cx, title, &windowId);

  nsString name;
  GetName(cx, global, name);

  bool isSystem = GetIsSystem(cx, global);

  nsCOMPtr<nsIPerformanceStats> result =
    new nsPerformanceStats(name, parent, groupId, addonId, title, windowId, mProcessId, isSystem, performance);
  return result.forget();
}
static
DWORD
TestAddUser(
    HANDLE hLsaConnection,
    PSTR pszUser
    )
{
    DWORD dwError = LW_ERROR_SUCCESS;
    DWORD dwUserInfoLevel = 0;
    PVOID pUserInfo = NULL;
    PSTR pszShell = "/bin/sh";
    PSTR pszHomedir = "/home";
    gid_t gid = 0;
    LSA_FIND_FLAGS FindFlags = 0;

    PCSTR pszTestDescription = 
        "Verify LsaAddUser adds a user";
    PCSTR pszTestAPIs = 
        "LsaAddUser";
    
    char szTestMsg[512] = { 0 };
    
    dwError = GetGroupId( hLsaConnection, pszUser, &gid);
    BAIL_ON_TEST_BROKE(dwError);

    dwError = BuildUserInfo(0, gid, pszUser, pszShell, pszHomedir, (PLSA_USER_INFO_0*)&pUserInfo);
    BAIL_ON_TEST_BROKE(dwError);

    dwError = LsaAddUser(
                 hLsaConnection,
                 pUserInfo,
                 dwUserInfoLevel);
    BAIL_ON_TEST_BROKE(dwError);

    dwError = LsaFindUserByName(
                    hLsaConnection,
                    pszUser,
                    FindFlags,
                    &pUserInfo);
    BAIL_ON_TEST_BROKE(dwError);
    
    if( !pUserInfo )
    {
        dwError = LW_ERROR_TEST_FAILED;
        snprintf(szTestMsg, sizeof(szTestMsg), 
            "unexpected result while adding the user %s",
            pszUser);
        LWT_LOG_TEST(szTestMsg);
    }

cleanup:
    if (pUserInfo) {
        LsaFreeUserInfo(dwUserInfoLevel, pUserInfo);
    }
    return dwError;
error:
    goto cleanup;
}
Example #4
0
pgObject *pgGroup::Refresh(ctlTree *browser, const wxTreeItemId item)
{
	pgObject *group = 0;
	pgCollection *coll = browser->GetParentCollection(item);
	if (coll)
		group = groupFactory.CreateObjects(coll, 0, wxT("\n WHERE grosysid=") + NumToStr(GetGroupId()));

	return group;
}
Example #5
0
void pgGroup::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (!expandedKids)
	{
		expandedKids = true;

		if (!memberIds.IsEmpty())
		{
			wxString ml = memberIds;
			ml.Replace(wxT(" "), wxT(","));
			pgSet *set = server->ExecuteSet(wxT(
			                                    "SELECT usename FROM pg_user WHERE usesysid IN (") + ml + wxT(")"));
			if (set)
			{
				while (!set->Eof())
				{
					wxString user = set->GetVal(0);
					if (memberCount)
					{
						members += wxT(", ");
						quotedMembers += wxT(", ");
					}
					members += user;
					quotedMembers += qtIdent(user);
					memberCount++;
					usersIn.Add(user);
					set->MoveNext();
				}
				delete set;
			}
		}
	}

	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("Group ID"), GetGroupId());
		properties->AppendItem(_("Member count"), GetMemberCount());
		properties->AppendItem(_("Members"), GetMembers());
	}
}
Example #6
0
unsigned long URL::GetGroup()
{
	return GetGroupId(ipaddress);
}