Fossil SCM

minor fix for fossil's internal handling of name=xyz parameter.

stephan 2011-09-30 15:48 UTC json
Commit 9f2535f1e072df4bab691d097afc809e58e4df68
1 file changed +25 -18
+25 -18
--- src/json_login.c
+++ src/json_login.c
@@ -9,15 +9,15 @@
99
/*
1010
** Implementation of the /json/login page.
1111
**
1212
*/
1313
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
1919
g.json.errorDetailParanoia ? 0 : 1
2020
#else
2121
0
2222
#endif
2323
;
@@ -39,23 +39,17 @@
3939
char const * name = cson_value_get_cstr(json_payload_property("name"));
4040
char const * pw = NULL;
4141
char const * anonSeed = NULL;
4242
cson_value * payload = NULL;
4343
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
+ */
5751
pw = cson_value_get_cstr(json_payload_property("password"));
5852
if( !pw ){
5953
pw = PD("p",NULL);
6054
if( !pw ){
6155
pw = PD("password",NULL);
@@ -65,10 +59,23 @@
6559
g.json.resultCode = preciseErrors
6660
? FSL_JSON_E_LOGIN_FAILED_NOPW
6761
: FSL_JSON_E_LOGIN_FAILED;
6862
return NULL;
6963
}
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
+ }
7077
7178
if(0 == strcmp("anonymous",name)){
7279
/* check captcha/seed values... */
7380
enum { SeedBufLen = 100 /* in some JSON tests i once actually got an
7481
80-digit number.
7582
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button