[glom/glom-1-20] Limit user and group name lengths.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-20] Limit user and group name lengths.
- Date: Mon, 6 Feb 2012 09:19:25 +0000 (UTC)
commit 96aef9dfda43590613c8e00abc3d3e88d431ded4
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Feb 1 15:15:18 2012 +0100
Limit user and group name lengths.
* glom/libglom/privs.[h|cc]: Add a MAX_ROLE_SIZE enum constants.
I cannot find any PostgreSQL documentation of this 63 character limit.
* glom/mode_design/users/dialog_new_group.cc:
* glom/mode_design/users/dialog_user.cc: Use it to set maximum characters
for the entry boxes.
* tests/test_selfhosting_new_empty_then_users.cc: Show that the problem
found so far was caused by too-long names, not spaces.
I still need to check parsing of table permissions.
Conflicts:
glom/mode_design/users/dialog_new_group.cc
glom/mode_design/users/dialog_user.cc
ChangeLog | 13 +++++++++++++
tests/test_selfhosting_new_empty_then_users.cc | 18 ++++++++++++++----
2 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 38806df..d20131f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2012-02-01 Murray Cumming <murrayc murrayc com>
+ Limit user and group name lengths.
+
+ * glom/libglom/privs.[h|cc]: Add a MAX_ROLE_SIZE enum constants.
+ I cannot find any PostgreSQL documentation of this 63 character limit.
+ * glom/mode_design/users/dialog_new_group.cc:
+ * glom/mode_design/users/dialog_user.cc: Use it to set maximum characters
+ for the entry boxes.
+ * tests/test_selfhosting_new_empty_then_users.cc: Show that the problem
+ found so far was caused by too-long names, not spaces.
+ I still need to check parsing of table permissions.
+
+2012-02-01 Murray Cumming <murrayc murrayc com>
+
test_selfhosting_new_empty_then_users: Test user adding with all group names.
* tests/test_selfhosting_new_empty_then_users.cc: Use for loops to
diff --git a/tests/test_selfhosting_new_empty_then_users.cc b/tests/test_selfhosting_new_empty_then_users.cc
index 3f90c87..a3c8ad4 100644
--- a/tests/test_selfhosting_new_empty_then_users.cc
+++ b/tests/test_selfhosting_new_empty_then_users.cc
@@ -99,8 +99,9 @@ static bool test(Glom::Document::HostingMode hosting_mode)
typedef std::vector<Glib::ustring> type_vec_strings;
type_vec_strings table_names;
table_names.push_back("sometable1");
- table_names.push_back("sometable with space characters1");
+ table_names.push_back("sometable with space characters");
table_names.push_back("sometable with a \" quote character");
+ table_names.push_back("sometablewithaverylongnameyaddayaddayaddayaddayaddyaddayaddayaddayaddayaddayaddayaddayaddayaddayaddayaddayadda");
//Add some tables, for the groups to have rights for:
for(type_vec_strings::const_iterator iter = table_names.begin(); iter != table_names.end(); ++iter)
@@ -131,8 +132,11 @@ static bool test(Glom::Document::HostingMode hosting_mode)
//Add groups:
type_vec_strings group_names;
group_names.push_back("somegroup1");
- group_names.push_back("somegroup with space characters1");
+ group_names.push_back("somegroup with space characters");
group_names.push_back("somegroup with a \" quote character");
+ group_names.push_back("somegroupwithaverylongnameyaddayaddayaddayaddayaddyaddayaddayad"); //Almost too big.
+ //We expect this to fail because of an apparently-undocumented max pg_user size of 63 characters in PostgreSQL:
+ //group_names.push_back("somegroupwithaverylongnameyaddayaddayaddayaddayaddyaddayaddayadd");
//Add groups:
for(type_vec_strings::const_iterator iter = group_names.begin(); iter != group_names.end(); ++iter)
@@ -147,15 +151,21 @@ static bool test(Glom::Document::HostingMode hosting_mode)
//TODO: Test strange passwords.
type_vec_strings user_names;
user_names.push_back("someuser1");
- user_names.push_back("someuser with space characters1");
+ user_names.push_back("someuser with space characters");
user_names.push_back("someuser with a \" quote character");
+ user_names.push_back("someuserwithaverylongnameyaddayaddayaddayaddayaddyaddayadda"); //Almost too big, with space for the numeric suffix below.
+ //We expect this to fail because of an apparently-undocumented max pg_user size of 63 characters in PostgreSQL:
+ //user_names.push_back("someuserwithaverylongnameyaddayaddayaddayaddayaddyaddayaddayadd");
+
+ guint i = 0;
for(type_vec_strings::const_iterator iter_user = user_names.begin(); iter_user != user_names.end(); ++iter_user)
{
for(type_vec_strings::const_iterator iter_group = group_names.begin(); iter_group != group_names.end(); ++iter_group)
{
- const Glib::ustring username = *iter_user + "for_" + *iter_group; //Make sure the username is unique.
+ const Glib::ustring username = Glib::ustring::compose("%1%2", *iter_user, i); //Make sure the username is unique.
if(!test_add_user(document, username, *iter_group))
return false;
+ ++i;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]