bool AdminCache::BindAdminIdentity(AdminId id, const char *auth, const char *ident) { if (ident[0] == '\0') { return false; } AdminUser *pUser = (AdminUser *)m_pMemory->GetAddress(id); if (!pUser || pUser->magic != USR_MAGIC_SET) { return false; } Trie *pTable; if (!sm_trie_retrieve(m_pAuthTables, auth, (void **)&pTable)) { return false; } /* If the id was a steam id strip off the STEAM_*: part */ if (strcmp(auth, "steam") == 0 && strncmp(ident, "STEAM_", 6) == 0) { ident += 8; } if (sm_trie_retrieve(pTable, ident, NULL)) { return false; } int i_ident = m_pStrings->AddString(ident); pUser = (AdminUser *)m_pMemory->GetAddress(id); pUser->auth.identidx = i_ident; GetMethodIndex(auth, &pUser->auth.index); return sm_trie_insert(pTable, ident, (void **)id); }
PRInt32 HttpMethodRegistry::RegisterMethod(const char* method) { PR_ASSERT(method); PRInt32 index = GetMethodIndex(method); /* Register the method only it hasn't already been registered */ if (index == -1) { /* VB: keyword.cpp does not address memory maangement correctly. We need to dup and free there. However, not to start making global changes, i fix this here for the moment by an extra stringdup */ index = NSKW_DefineKeyword(strdup(method), -1, _httpMethodsTable); if (index != -1) { index = index - 1; _allMethodsStr.append(", "); _allMethodsStr.append(method); _numRegisteredMethod++; } NSKW_Optimize(_httpMethodsTable); } return index; }
PRBool HttpMethodRegistry::IsKnownHttpMethod(const char* method) const { return (GetMethodIndex(method) != -1) ? PR_TRUE : PR_FALSE; }