diff options
author | onefang | 2020-04-19 20:11:22 +1000 |
---|---|---|
committer | onefang | 2020-04-19 20:11:22 +1000 |
commit | 9dcba2758b75868b8837141b9cea403bc0c1b756 (patch) | |
tree | 21cac75fce3d66ad2e861f37683e9c9ecfc44818 | |
parent | Add a simple voucher field. (diff) | |
download | opensim-SC_OLD-9dcba2758b75868b8837141b9cea403bc0c1b756.zip opensim-SC_OLD-9dcba2758b75868b8837141b9cea403bc0c1b756.tar.gz opensim-SC_OLD-9dcba2758b75868b8837141b9cea403bc0c1b756.tar.bz2 opensim-SC_OLD-9dcba2758b75868b8837141b9cea403bc0c1b756.tar.xz |
Fix up name validation.
Diffstat (limited to '')
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 771cf87..f21b2a6 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -3808,7 +3808,7 @@ static int nameValidate(reqData *Rd, inputForm *iF, inputValue *iV) | |||
3808 | } | 3808 | } |
3809 | else | 3809 | else |
3810 | { | 3810 | { |
3811 | int l0 = strlen(name), l1; | 3811 | int l0 = strlen(name), l1 = 0, l2 = 0; |
3812 | 3812 | ||
3813 | if (0 == l0) | 3813 | if (0 == l0) |
3814 | { | 3814 | { |
@@ -3825,11 +3825,17 @@ static int nameValidate(reqData *Rd, inputForm *iF, inputValue *iV) | |||
3825 | if (isalnum(name[i]) == 0) | 3825 | if (isalnum(name[i]) == 0) |
3826 | { | 3826 | { |
3827 | 3827 | ||
3828 | if ((' ' == name[i] && (NULL == s))) | 3828 | if ((' ' == name[i] /*&& (NULL == s)*/)) |
3829 | { | 3829 | { |
3830 | s = &name[i]; | 3830 | s = &name[i]; |
3831 | *s++ = '\0'; | 3831 | *s++ = '\0'; |
3832 | l1 = strlen(s); | 3832 | while(' ' == *s) |
3833 | { | ||
3834 | i++; | ||
3835 | s++; | ||
3836 | } | ||
3837 | l1 = strlen(name); | ||
3838 | l2 = strlen(s); | ||
3833 | 3839 | ||
3834 | // Apparently names are not case sensitive on login, but stored with case in the database. | 3840 | // Apparently names are not case sensitive on login, but stored with case in the database. |
3835 | // I confirmed that, can log in no matter what case you use. | 3841 | // I confirmed that, can log in no matter what case you use. |
@@ -3842,16 +3848,6 @@ static int nameValidate(reqData *Rd, inputForm *iF, inputValue *iV) | |||
3842 | // Singularity at least limits the total name to 64. | 3848 | // Singularity at least limits the total name to 64. |
3843 | // I can't find any limitations on characters allowed, but I only ever see letters and digits used. Case is stored, but not significant. | 3849 | // I can't find any limitations on characters allowed, but I only ever see letters and digits used. Case is stored, but not significant. |
3844 | // OpenSims "create user" console command doesn't sanitize it at all, even crashing on some names. | 3850 | // OpenSims "create user" console command doesn't sanitize it at all, even crashing on some names. |
3845 | if (0 == l1) | ||
3846 | { | ||
3847 | bitch(Rd, "Account names have to be two words.", ""); | ||
3848 | ret++; | ||
3849 | } | ||
3850 | if ((31 < i) || (31 < l1)) | ||
3851 | { | ||
3852 | bitch(Rd, "First and last names are limited to 31 letters each.", ""); | ||
3853 | ret++; | ||
3854 | } | ||
3855 | } | 3851 | } |
3856 | else | 3852 | else |
3857 | { | 3853 | { |
@@ -3863,16 +3859,29 @@ static int nameValidate(reqData *Rd, inputForm *iF, inputValue *iV) | |||
3863 | } | 3859 | } |
3864 | } | 3860 | } |
3865 | 3861 | ||
3862 | if (NULL == s) | ||
3863 | { | ||
3864 | bitch(Rd, "Account names have to be two words.", ""); | ||
3865 | ret++; | ||
3866 | } | ||
3867 | if ((31 < l1) || (31 < l2)) | ||
3868 | { | ||
3869 | bitch(Rd, "First and last names are limited to 31 letters each.", ""); | ||
3870 | ret++; | ||
3871 | } | ||
3872 | if ((0 == l1) || (0 == l2)) | ||
3873 | { | ||
3874 | bitch(Rd, "First and last names have to be more than one letter each.", ""); | ||
3875 | ret++; | ||
3876 | } | ||
3877 | |||
3866 | if (0 == ret) | 3878 | if (0 == ret) |
3867 | { | 3879 | { |
3868 | Rd->stuff->putstr(Rd->stuff, "firstName", name); | 3880 | Rd->stuff->putstr(Rd->stuff, "firstName", name); |
3869 | Rd->stuff->putstr(Rd->stuff, "lastName", s); | 3881 | Rd->stuff->putstr(Rd->stuff, "lastName", s); |
3870 | if (s) {s--; *s = ' '; s++;} | 3882 | Rd->stuff->putstrf(Rd->stuff, "name", "%s %s", name, s); |
3871 | s = NULL; | 3883 | Rd->shs.name = Rd->stuff->getstr(Rd->stuff, "name", true); |
3872 | Rd->stuff->putstr(Rd->stuff, "name", name); | ||
3873 | Rd->shs.name = xstrdup(name); | ||
3874 | } | 3884 | } |
3875 | if (s) {s--; *s = ' '; s++;} | ||
3876 | } | 3885 | } |
3877 | } | 3886 | } |
3878 | free(name); | 3887 | free(name); |