OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 had_deletes_ = true; | 237 had_deletes_ = true; |
238 return kSQLAuthAllow; | 238 return kSQLAuthAllow; |
239 } | 239 } |
240 | 240 |
241 int DatabaseAuthorizer::CreateVTable(const String& table_name, | 241 int DatabaseAuthorizer::CreateVTable(const String& table_name, |
242 const String& module_name) { | 242 const String& module_name) { |
243 if (!AllowWrite()) | 243 if (!AllowWrite()) |
244 return kSQLAuthDeny; | 244 return kSQLAuthDeny; |
245 | 245 |
246 // Allow only the FTS3 extension | 246 // Allow only the FTS3 extension |
247 if (!EqualIgnoringCase(module_name, "fts3")) | 247 if (!DeprecatedEqualIgnoringCase(module_name, "fts3")) |
248 return kSQLAuthDeny; | 248 return kSQLAuthDeny; |
249 | 249 |
250 last_action_changed_database_ = true; | 250 last_action_changed_database_ = true; |
251 return DenyBasedOnTableName(table_name); | 251 return DenyBasedOnTableName(table_name); |
252 } | 252 } |
253 | 253 |
254 int DatabaseAuthorizer::DropVTable(const String& table_name, | 254 int DatabaseAuthorizer::DropVTable(const String& table_name, |
255 const String& module_name) { | 255 const String& module_name) { |
256 if (!AllowWrite()) | 256 if (!AllowWrite()) |
257 return kSQLAuthDeny; | 257 return kSQLAuthDeny; |
258 | 258 |
259 // Allow only the FTS3 extension | 259 // Allow only the FTS3 extension |
260 if (!EqualIgnoringCase(module_name, "fts3")) | 260 if (!DeprecatedEqualIgnoringCase(module_name, "fts3")) |
261 return kSQLAuthDeny; | 261 return kSQLAuthDeny; |
262 | 262 |
263 return UpdateDeletesBasedOnTableName(table_name); | 263 return UpdateDeletesBasedOnTableName(table_name); |
264 } | 264 } |
265 | 265 |
266 int DatabaseAuthorizer::AllowDelete(const String& table_name) { | 266 int DatabaseAuthorizer::AllowDelete(const String& table_name) { |
267 if (!AllowWrite()) | 267 if (!AllowWrite()) |
268 return kSQLAuthDeny; | 268 return kSQLAuthDeny; |
269 | 269 |
270 return UpdateDeletesBasedOnTableName(table_name); | 270 return UpdateDeletesBasedOnTableName(table_name); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 // Sadly, normal creates and drops end up affecting sqlite_master in an | 349 // Sadly, normal creates and drops end up affecting sqlite_master in an |
350 // authorizer callback, so it will be tough to enforce all of the following | 350 // authorizer callback, so it will be tough to enforce all of the following |
351 // policies: | 351 // policies: |
352 // if (equalIgnoringCase(tableName, "sqlite_master") || | 352 // if (equalIgnoringCase(tableName, "sqlite_master") || |
353 // equalIgnoringCase(tableName, "sqlite_temp_master") || | 353 // equalIgnoringCase(tableName, "sqlite_temp_master") || |
354 // equalIgnoringCase(tableName, "sqlite_sequence") || | 354 // equalIgnoringCase(tableName, "sqlite_sequence") || |
355 // equalIgnoringCase(tableName, Database::databaseInfoTableName())) | 355 // equalIgnoringCase(tableName, Database::databaseInfoTableName())) |
356 // return SQLAuthDeny; | 356 // return SQLAuthDeny; |
357 | 357 |
358 if (EqualIgnoringCase(table_name, database_info_table_name_)) | 358 if (DeprecatedEqualIgnoringCase(table_name, database_info_table_name_)) |
359 return kSQLAuthDeny; | 359 return kSQLAuthDeny; |
360 | 360 |
361 return kSQLAuthAllow; | 361 return kSQLAuthAllow; |
362 } | 362 } |
363 | 363 |
364 int DatabaseAuthorizer::UpdateDeletesBasedOnTableName( | 364 int DatabaseAuthorizer::UpdateDeletesBasedOnTableName( |
365 const String& table_name) { | 365 const String& table_name) { |
366 int allow = DenyBasedOnTableName(table_name); | 366 int allow = DenyBasedOnTableName(table_name); |
367 if (allow) | 367 if (allow) |
368 had_deletes_ = true; | 368 had_deletes_ = true; |
369 return allow; | 369 return allow; |
370 } | 370 } |
371 | 371 |
372 } // namespace blink | 372 } // namespace blink |
OLD | NEW |