Fossil SCM
minor fix for fossil's internal handling of name=xyz parameter.
Commit
9f2535f1e072df4bab691d097afc809e58e4df68
Parent
42a07be4c5460a1…
1 file changed
+25
-18
+25
-18
| --- src/json_login.c | ||
| +++ src/json_login.c | ||
| @@ -9,15 +9,15 @@ | ||
| 9 | 9 | /* |
| 10 | 10 | ** Implementation of the /json/login page. |
| 11 | 11 | ** |
| 12 | 12 | */ |
| 13 | 13 | cson_value * json_page_login(){ |
| 14 | - static char preciseErrors = /* if true, "complete" JSON error codes are used, | |
| 15 | - else they are "dumbed down" to a generic login | |
| 16 | - error code. | |
| 17 | - */ | |
| 18 | -#if 0 | |
| 14 | + char preciseErrors = /* if true, "complete" JSON error codes are used, | |
| 15 | + else they are "dumbed down" to a generic login | |
| 16 | + error code. | |
| 17 | + */ | |
| 18 | +#if 1 | |
| 19 | 19 | g.json.errorDetailParanoia ? 0 : 1 |
| 20 | 20 | #else |
| 21 | 21 | 0 |
| 22 | 22 | #endif |
| 23 | 23 | ; |
| @@ -39,23 +39,17 @@ | ||
| 39 | 39 | char const * name = cson_value_get_cstr(json_payload_property("name")); |
| 40 | 40 | char const * pw = NULL; |
| 41 | 41 | char const * anonSeed = NULL; |
| 42 | 42 | cson_value * payload = NULL; |
| 43 | 43 | int uid = 0; |
| 44 | - if( !name ){ | |
| 45 | - name = PD("n",NULL); | |
| 46 | - if( !name ){ | |
| 47 | - name = PD("name",NULL); | |
| 48 | - if( !name ){ | |
| 49 | - g.json.resultCode = preciseErrors | |
| 50 | - ? FSL_JSON_E_LOGIN_FAILED_NONAME | |
| 51 | - : FSL_JSON_E_LOGIN_FAILED; | |
| 52 | - return NULL; | |
| 53 | - } | |
| 54 | - } | |
| 55 | - } | |
| 56 | - | |
| 44 | + /* reminder to self: | |
| 45 | + Fossil internally (for the sake of /wiki) interprets | |
| 46 | + paths in the form /foo/bar/baz such that | |
| 47 | + P("name") == "bar/baz". This collides with our | |
| 48 | + name/password checking, and thus we check for the | |
| 49 | + password first. | |
| 50 | + */ | |
| 57 | 51 | pw = cson_value_get_cstr(json_payload_property("password")); |
| 58 | 52 | if( !pw ){ |
| 59 | 53 | pw = PD("p",NULL); |
| 60 | 54 | if( !pw ){ |
| 61 | 55 | pw = PD("password",NULL); |
| @@ -65,10 +59,23 @@ | ||
| 65 | 59 | g.json.resultCode = preciseErrors |
| 66 | 60 | ? FSL_JSON_E_LOGIN_FAILED_NOPW |
| 67 | 61 | : FSL_JSON_E_LOGIN_FAILED; |
| 68 | 62 | return NULL; |
| 69 | 63 | } |
| 64 | + | |
| 65 | + if( !name ){ | |
| 66 | + name = PD("n",NULL); | |
| 67 | + if( !name ){ | |
| 68 | + name = PD("name",NULL); | |
| 69 | + if( !name ){ | |
| 70 | + g.json.resultCode = preciseErrors | |
| 71 | + ? FSL_JSON_E_LOGIN_FAILED_NONAME | |
| 72 | + : FSL_JSON_E_LOGIN_FAILED; | |
| 73 | + return NULL; | |
| 74 | + } | |
| 75 | + } | |
| 76 | + } | |
| 70 | 77 | |
| 71 | 78 | if(0 == strcmp("anonymous",name)){ |
| 72 | 79 | /* check captcha/seed values... */ |
| 73 | 80 | enum { SeedBufLen = 100 /* in some JSON tests i once actually got an |
| 74 | 81 | 80-digit number. |
| 75 | 82 |
| --- src/json_login.c | |
| +++ src/json_login.c | |
| @@ -9,15 +9,15 @@ | |
| 9 | /* |
| 10 | ** Implementation of the /json/login page. |
| 11 | ** |
| 12 | */ |
| 13 | cson_value * json_page_login(){ |
| 14 | static char preciseErrors = /* if true, "complete" JSON error codes are used, |
| 15 | else they are "dumbed down" to a generic login |
| 16 | error code. |
| 17 | */ |
| 18 | #if 0 |
| 19 | g.json.errorDetailParanoia ? 0 : 1 |
| 20 | #else |
| 21 | 0 |
| 22 | #endif |
| 23 | ; |
| @@ -39,23 +39,17 @@ | |
| 39 | char const * name = cson_value_get_cstr(json_payload_property("name")); |
| 40 | char const * pw = NULL; |
| 41 | char const * anonSeed = NULL; |
| 42 | cson_value * payload = NULL; |
| 43 | int uid = 0; |
| 44 | if( !name ){ |
| 45 | name = PD("n",NULL); |
| 46 | if( !name ){ |
| 47 | name = PD("name",NULL); |
| 48 | if( !name ){ |
| 49 | g.json.resultCode = preciseErrors |
| 50 | ? FSL_JSON_E_LOGIN_FAILED_NONAME |
| 51 | : FSL_JSON_E_LOGIN_FAILED; |
| 52 | return NULL; |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | pw = cson_value_get_cstr(json_payload_property("password")); |
| 58 | if( !pw ){ |
| 59 | pw = PD("p",NULL); |
| 60 | if( !pw ){ |
| 61 | pw = PD("password",NULL); |
| @@ -65,10 +59,23 @@ | |
| 65 | g.json.resultCode = preciseErrors |
| 66 | ? FSL_JSON_E_LOGIN_FAILED_NOPW |
| 67 | : FSL_JSON_E_LOGIN_FAILED; |
| 68 | return NULL; |
| 69 | } |
| 70 | |
| 71 | if(0 == strcmp("anonymous",name)){ |
| 72 | /* check captcha/seed values... */ |
| 73 | enum { SeedBufLen = 100 /* in some JSON tests i once actually got an |
| 74 | 80-digit number. |
| 75 |
| --- src/json_login.c | |
| +++ src/json_login.c | |
| @@ -9,15 +9,15 @@ | |
| 9 | /* |
| 10 | ** Implementation of the /json/login page. |
| 11 | ** |
| 12 | */ |
| 13 | cson_value * json_page_login(){ |
| 14 | char preciseErrors = /* if true, "complete" JSON error codes are used, |
| 15 | else they are "dumbed down" to a generic login |
| 16 | error code. |
| 17 | */ |
| 18 | #if 1 |
| 19 | g.json.errorDetailParanoia ? 0 : 1 |
| 20 | #else |
| 21 | 0 |
| 22 | #endif |
| 23 | ; |
| @@ -39,23 +39,17 @@ | |
| 39 | char const * name = cson_value_get_cstr(json_payload_property("name")); |
| 40 | char const * pw = NULL; |
| 41 | char const * anonSeed = NULL; |
| 42 | cson_value * payload = NULL; |
| 43 | int uid = 0; |
| 44 | /* reminder to self: |
| 45 | Fossil internally (for the sake of /wiki) interprets |
| 46 | paths in the form /foo/bar/baz such that |
| 47 | P("name") == "bar/baz". This collides with our |
| 48 | name/password checking, and thus we check for the |
| 49 | password first. |
| 50 | */ |
| 51 | pw = cson_value_get_cstr(json_payload_property("password")); |
| 52 | if( !pw ){ |
| 53 | pw = PD("p",NULL); |
| 54 | if( !pw ){ |
| 55 | pw = PD("password",NULL); |
| @@ -65,10 +59,23 @@ | |
| 59 | g.json.resultCode = preciseErrors |
| 60 | ? FSL_JSON_E_LOGIN_FAILED_NOPW |
| 61 | : FSL_JSON_E_LOGIN_FAILED; |
| 62 | return NULL; |
| 63 | } |
| 64 | |
| 65 | if( !name ){ |
| 66 | name = PD("n",NULL); |
| 67 | if( !name ){ |
| 68 | name = PD("name",NULL); |
| 69 | if( !name ){ |
| 70 | g.json.resultCode = preciseErrors |
| 71 | ? FSL_JSON_E_LOGIN_FAILED_NONAME |
| 72 | : FSL_JSON_E_LOGIN_FAILED; |
| 73 | return NULL; |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | if(0 == strcmp("anonymous",name)){ |
| 79 | /* check captcha/seed values... */ |
| 80 | enum { SeedBufLen = 100 /* in some JSON tests i once actually got an |
| 81 | 80-digit number. |
| 82 |