Fossil SCM
Clean up and standardize the handling of user "nobody" and the g.zLogin global variable.
Commit
840b762206b3ebe1ba6271c190374a2f2f3e8d1d
Parent
68cc26c1ea3a7a7…
13 files changed
+1
-1
+2
-2
+1
-1
+1
-2
+3
-3
+2
-2
+2
-2
+14
+3
-3
+5
-3
+1
-1
+4
-4
+12
-12
+1
-1
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -155,11 +155,11 @@ | ||
| 155 | 155 | } |
| 156 | 156 | n = strlen(g.argv[2]); |
| 157 | 157 | db_open_config(1); |
| 158 | 158 | blob_zero(&extra); |
| 159 | 159 | zCmd = g.argv[2]; |
| 160 | - if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin); | |
| 160 | + if( !login_is_nobody() ) blob_appendf(&extra, " -U %s", g.zLogin); | |
| 161 | 161 | if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){ |
| 162 | 162 | zCmd = "list"; |
| 163 | 163 | useCheckouts = find_option("ckout","c",0)!=0; |
| 164 | 164 | }else if( strncmp(zCmd, "clean", n)==0 ){ |
| 165 | 165 | zCmd = "clean --chdir"; |
| 166 | 166 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -155,11 +155,11 @@ | |
| 155 | } |
| 156 | n = strlen(g.argv[2]); |
| 157 | db_open_config(1); |
| 158 | blob_zero(&extra); |
| 159 | zCmd = g.argv[2]; |
| 160 | if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin); |
| 161 | if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){ |
| 162 | zCmd = "list"; |
| 163 | useCheckouts = find_option("ckout","c",0)!=0; |
| 164 | }else if( strncmp(zCmd, "clean", n)==0 ){ |
| 165 | zCmd = "clean --chdir"; |
| 166 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -155,11 +155,11 @@ | |
| 155 | } |
| 156 | n = strlen(g.argv[2]); |
| 157 | db_open_config(1); |
| 158 | blob_zero(&extra); |
| 159 | zCmd = g.argv[2]; |
| 160 | if( !login_is_nobody() ) blob_appendf(&extra, " -U %s", g.zLogin); |
| 161 | if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){ |
| 162 | zCmd = "list"; |
| 163 | useCheckouts = find_option("ckout","c",0)!=0; |
| 164 | }else if( strncmp(zCmd, "clean", n)==0 ){ |
| 165 | zCmd = "clean --chdir"; |
| 166 |
+2
-2
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -309,11 +309,11 @@ | ||
| 309 | 309 | if( n>0 ){ |
| 310 | 310 | blob_appendf(&manifest, "C %#F\n", n, zComment); |
| 311 | 311 | } |
| 312 | 312 | zDate = date_in_standard_format("now"); |
| 313 | 313 | blob_appendf(&manifest, "D %s\n", zDate); |
| 314 | - blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody"); | |
| 314 | + blob_appendf(&manifest, "U %F\n", login_name()); | |
| 315 | 315 | md5sum_blob(&manifest, &cksum); |
| 316 | 316 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 317 | 317 | attach_put(&manifest, rid, needModerator); |
| 318 | 318 | assert( blob_is_reset(&manifest) ); |
| 319 | 319 | db_end_transaction(0); |
| @@ -427,11 +427,11 @@ | ||
| 427 | 427 | zFile += n; |
| 428 | 428 | if( zFile[0]==0 ) zFile = "unknown"; |
| 429 | 429 | blob_appendf(&manifest, "A %F %F\n", zFile, zTarget); |
| 430 | 430 | zDate = date_in_standard_format("now"); |
| 431 | 431 | blob_appendf(&manifest, "D %s\n", zDate); |
| 432 | - blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody"); | |
| 432 | + blob_appendf(&manifest, "U %F\n", login_name()); | |
| 433 | 433 | md5sum_blob(&manifest, &cksum); |
| 434 | 434 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 435 | 435 | rid = content_put(&manifest); |
| 436 | 436 | manifest_crosslink(rid, &manifest, MC_NONE); |
| 437 | 437 | db_end_transaction(0); |
| 438 | 438 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -309,11 +309,11 @@ | |
| 309 | if( n>0 ){ |
| 310 | blob_appendf(&manifest, "C %#F\n", n, zComment); |
| 311 | } |
| 312 | zDate = date_in_standard_format("now"); |
| 313 | blob_appendf(&manifest, "D %s\n", zDate); |
| 314 | blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody"); |
| 315 | md5sum_blob(&manifest, &cksum); |
| 316 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 317 | attach_put(&manifest, rid, needModerator); |
| 318 | assert( blob_is_reset(&manifest) ); |
| 319 | db_end_transaction(0); |
| @@ -427,11 +427,11 @@ | |
| 427 | zFile += n; |
| 428 | if( zFile[0]==0 ) zFile = "unknown"; |
| 429 | blob_appendf(&manifest, "A %F %F\n", zFile, zTarget); |
| 430 | zDate = date_in_standard_format("now"); |
| 431 | blob_appendf(&manifest, "D %s\n", zDate); |
| 432 | blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody"); |
| 433 | md5sum_blob(&manifest, &cksum); |
| 434 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 435 | rid = content_put(&manifest); |
| 436 | manifest_crosslink(rid, &manifest, MC_NONE); |
| 437 | db_end_transaction(0); |
| 438 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -309,11 +309,11 @@ | |
| 309 | if( n>0 ){ |
| 310 | blob_appendf(&manifest, "C %#F\n", n, zComment); |
| 311 | } |
| 312 | zDate = date_in_standard_format("now"); |
| 313 | blob_appendf(&manifest, "D %s\n", zDate); |
| 314 | blob_appendf(&manifest, "U %F\n", login_name()); |
| 315 | md5sum_blob(&manifest, &cksum); |
| 316 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 317 | attach_put(&manifest, rid, needModerator); |
| 318 | assert( blob_is_reset(&manifest) ); |
| 319 | db_end_transaction(0); |
| @@ -427,11 +427,11 @@ | |
| 427 | zFile += n; |
| 428 | if( zFile[0]==0 ) zFile = "unknown"; |
| 429 | blob_appendf(&manifest, "A %F %F\n", zFile, zTarget); |
| 430 | zDate = date_in_standard_format("now"); |
| 431 | blob_appendf(&manifest, "D %s\n", zDate); |
| 432 | blob_appendf(&manifest, "U %F\n", login_name()); |
| 433 | md5sum_blob(&manifest, &cksum); |
| 434 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 435 | rid = content_put(&manifest); |
| 436 | manifest_crosslink(rid, &manifest, MC_NONE); |
| 437 | db_end_transaction(0); |
| 438 |
+1
-1
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -134,11 +134,11 @@ | ||
| 134 | 134 | const char *zTag = db_column_text(&q, 0); |
| 135 | 135 | blob_appendf(&branch, "T -%F *\n", zTag); |
| 136 | 136 | } |
| 137 | 137 | db_finalize(&q); |
| 138 | 138 | |
| 139 | - blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); | |
| 139 | + blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : login_name()); | |
| 140 | 140 | md5sum_blob(&branch, &mcksum); |
| 141 | 141 | blob_appendf(&branch, "Z %b\n", &mcksum); |
| 142 | 142 | if( !noSign && clearsign(&branch, &branch) ){ |
| 143 | 143 | Blob ans; |
| 144 | 144 | char cReply; |
| 145 | 145 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -134,11 +134,11 @@ | |
| 134 | const char *zTag = db_column_text(&q, 0); |
| 135 | blob_appendf(&branch, "T -%F *\n", zTag); |
| 136 | } |
| 137 | db_finalize(&q); |
| 138 | |
| 139 | blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 140 | md5sum_blob(&branch, &mcksum); |
| 141 | blob_appendf(&branch, "Z %b\n", &mcksum); |
| 142 | if( !noSign && clearsign(&branch, &branch) ){ |
| 143 | Blob ans; |
| 144 | char cReply; |
| 145 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -134,11 +134,11 @@ | |
| 134 | const char *zTag = db_column_text(&q, 0); |
| 135 | blob_appendf(&branch, "T -%F *\n", zTag); |
| 136 | } |
| 137 | db_finalize(&q); |
| 138 | |
| 139 | blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : login_name()); |
| 140 | md5sum_blob(&branch, &mcksum); |
| 141 | blob_appendf(&branch, "Z %b\n", &mcksum); |
| 142 | if( !noSign && clearsign(&branch, &branch) ){ |
| 143 | Blob ans; |
| 144 | char cReply; |
| 145 |
+1
-2
| --- src/captcha.c | ||
| +++ src/captcha.c | ||
| @@ -482,12 +482,11 @@ | ||
| 482 | 482 | ** are user "nobody") and if the "require-captcha" setting is true. The |
| 483 | 483 | ** "require-captcha" setting is controlled on the Admin/Access page. It |
| 484 | 484 | ** defaults to true. |
| 485 | 485 | */ |
| 486 | 486 | int captcha_needed(void){ |
| 487 | - if( g.zLogin!=0 ) return 0; | |
| 488 | - return db_get_boolean("require-captcha", 1); | |
| 487 | + return login_is_nobody() && db_get_boolean("require-captcha", 1); | |
| 489 | 488 | } |
| 490 | 489 | |
| 491 | 490 | /* |
| 492 | 491 | ** If a captcha is required but the correct captcha code is not supplied |
| 493 | 492 | ** in the query parameters, then return false (0). |
| 494 | 493 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -482,12 +482,11 @@ | |
| 482 | ** are user "nobody") and if the "require-captcha" setting is true. The |
| 483 | ** "require-captcha" setting is controlled on the Admin/Access page. It |
| 484 | ** defaults to true. |
| 485 | */ |
| 486 | int captcha_needed(void){ |
| 487 | if( g.zLogin!=0 ) return 0; |
| 488 | return db_get_boolean("require-captcha", 1); |
| 489 | } |
| 490 | |
| 491 | /* |
| 492 | ** If a captcha is required but the correct captcha code is not supplied |
| 493 | ** in the query parameters, then return false (0). |
| 494 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -482,12 +482,11 @@ | |
| 482 | ** are user "nobody") and if the "require-captcha" setting is true. The |
| 483 | ** "require-captcha" setting is controlled on the Admin/Access page. It |
| 484 | ** defaults to true. |
| 485 | */ |
| 486 | int captcha_needed(void){ |
| 487 | return login_is_nobody() && db_get_boolean("require-captcha", 1); |
| 488 | } |
| 489 | |
| 490 | /* |
| 491 | ** If a captcha is required but the correct captcha code is not supplied |
| 492 | ** in the query parameters, then return false (0). |
| 493 |
+3
-3
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -801,11 +801,11 @@ | ||
| 801 | 801 | blob_append(&prompt, |
| 802 | 802 | "\n" |
| 803 | 803 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 804 | 804 | "#\n", -1 |
| 805 | 805 | ); |
| 806 | - blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); | |
| 806 | + blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name()); | |
| 807 | 807 | if( p->zBranch && p->zBranch[0] ){ |
| 808 | 808 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 809 | 809 | }else{ |
| 810 | 810 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 811 | 811 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -963,11 +963,11 @@ | ||
| 963 | 963 | int verifyDate; /* Verify that child is younger */ |
| 964 | 964 | int closeFlag; /* Close the branch being committed */ |
| 965 | 965 | int integrateFlag; /* Close merged-in branches */ |
| 966 | 966 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 967 | 967 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 968 | - const char *zUserOvrd; /* User override. If 0 then use g.zLogin */ | |
| 968 | + const char *zUserOvrd; /* User override. If 0 then use login_name() */ | |
| 969 | 969 | const char *zBranch; /* Branch name. May be 0 */ |
| 970 | 970 | const char *zColor; /* One-time background color. May be 0 */ |
| 971 | 971 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 972 | 972 | const char **azTag; /* Tags to apply to this check-in */ |
| 973 | 973 | }; |
| @@ -1189,11 +1189,11 @@ | ||
| 1189 | 1189 | const char *zBrTag = db_column_text(&q, 0); |
| 1190 | 1190 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1191 | 1191 | } |
| 1192 | 1192 | db_finalize(&q); |
| 1193 | 1193 | } |
| 1194 | - blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); | |
| 1194 | + blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name()); | |
| 1195 | 1195 | md5sum_blob(pOut, &mcksum); |
| 1196 | 1196 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1197 | 1197 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | 1200 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -801,11 +801,11 @@ | |
| 801 | blob_append(&prompt, |
| 802 | "\n" |
| 803 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 804 | "#\n", -1 |
| 805 | ); |
| 806 | blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); |
| 807 | if( p->zBranch && p->zBranch[0] ){ |
| 808 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 809 | }else{ |
| 810 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 811 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -963,11 +963,11 @@ | |
| 963 | int verifyDate; /* Verify that child is younger */ |
| 964 | int closeFlag; /* Close the branch being committed */ |
| 965 | int integrateFlag; /* Close merged-in branches */ |
| 966 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 967 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 968 | const char *zUserOvrd; /* User override. If 0 then use g.zLogin */ |
| 969 | const char *zBranch; /* Branch name. May be 0 */ |
| 970 | const char *zColor; /* One-time background color. May be 0 */ |
| 971 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 972 | const char **azTag; /* Tags to apply to this check-in */ |
| 973 | }; |
| @@ -1189,11 +1189,11 @@ | |
| 1189 | const char *zBrTag = db_column_text(&q, 0); |
| 1190 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1191 | } |
| 1192 | db_finalize(&q); |
| 1193 | } |
| 1194 | blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); |
| 1195 | md5sum_blob(pOut, &mcksum); |
| 1196 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1197 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1198 | } |
| 1199 | |
| 1200 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -801,11 +801,11 @@ | |
| 801 | blob_append(&prompt, |
| 802 | "\n" |
| 803 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 804 | "#\n", -1 |
| 805 | ); |
| 806 | blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 807 | if( p->zBranch && p->zBranch[0] ){ |
| 808 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 809 | }else{ |
| 810 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 811 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -963,11 +963,11 @@ | |
| 963 | int verifyDate; /* Verify that child is younger */ |
| 964 | int closeFlag; /* Close the branch being committed */ |
| 965 | int integrateFlag; /* Close merged-in branches */ |
| 966 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 967 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 968 | const char *zUserOvrd; /* User override. If 0 then use login_name() */ |
| 969 | const char *zBranch; /* Branch name. May be 0 */ |
| 970 | const char *zColor; /* One-time background color. May be 0 */ |
| 971 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 972 | const char **azTag; /* Tags to apply to this check-in */ |
| 973 | }; |
| @@ -1189,11 +1189,11 @@ | |
| 1189 | const char *zBrTag = db_column_text(&q, 0); |
| 1190 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1191 | } |
| 1192 | db_finalize(&q); |
| 1193 | } |
| 1194 | blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 1195 | md5sum_blob(pOut, &mcksum); |
| 1196 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1197 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1198 | } |
| 1199 | |
| 1200 |
+2
-2
| --- src/event.c | ||
| +++ src/event.c | ||
| @@ -342,12 +342,12 @@ | ||
| 342 | 342 | while( db_step(&q)==SQLITE_ROW ){ |
| 343 | 343 | blob_appendf(&event, "T +sym-%F *\n", db_column_text(&q, 0)); |
| 344 | 344 | } |
| 345 | 345 | db_finalize(&q); |
| 346 | 346 | } |
| 347 | - if( g.zLogin ){ | |
| 348 | - blob_appendf(&event, "U %F\n", g.zLogin); | |
| 347 | + if( !login_is_nobody() ){ | |
| 348 | + blob_appendf(&event, "U %F\n", login_name()); | |
| 349 | 349 | } |
| 350 | 350 | blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody); |
| 351 | 351 | md5sum_blob(&event, &cksum); |
| 352 | 352 | blob_appendf(&event, "Z %b\n", &cksum); |
| 353 | 353 | blob_reset(&cksum); |
| 354 | 354 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -342,12 +342,12 @@ | |
| 342 | while( db_step(&q)==SQLITE_ROW ){ |
| 343 | blob_appendf(&event, "T +sym-%F *\n", db_column_text(&q, 0)); |
| 344 | } |
| 345 | db_finalize(&q); |
| 346 | } |
| 347 | if( g.zLogin ){ |
| 348 | blob_appendf(&event, "U %F\n", g.zLogin); |
| 349 | } |
| 350 | blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody); |
| 351 | md5sum_blob(&event, &cksum); |
| 352 | blob_appendf(&event, "Z %b\n", &cksum); |
| 353 | blob_reset(&cksum); |
| 354 |
| --- src/event.c | |
| +++ src/event.c | |
| @@ -342,12 +342,12 @@ | |
| 342 | while( db_step(&q)==SQLITE_ROW ){ |
| 343 | blob_appendf(&event, "T +sym-%F *\n", db_column_text(&q, 0)); |
| 344 | } |
| 345 | db_finalize(&q); |
| 346 | } |
| 347 | if( !login_is_nobody() ){ |
| 348 | blob_appendf(&event, "U %F\n", login_name()); |
| 349 | } |
| 350 | blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody); |
| 351 | md5sum_blob(&event, &cksum); |
| 352 | blob_appendf(&event, "Z %b\n", &cksum); |
| 353 | blob_reset(&cksum); |
| 354 |
+2
-2
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -1443,11 +1443,11 @@ | ||
| 1443 | 1443 | rid = name_to_rid_www("name"); |
| 1444 | 1444 | login_check_credentials(); |
| 1445 | 1445 | if( !g.perm.Read ){ login_needed(); return; } |
| 1446 | 1446 | if( rid==0 ) fossil_redirect_home(); |
| 1447 | 1447 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1448 | - if( fossil_strcmp(P("name"), zUuid)==0 ){ | |
| 1448 | + if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){ | |
| 1449 | 1449 | g.isConst = 1; |
| 1450 | 1450 | } |
| 1451 | 1451 | free(zUuid); |
| 1452 | 1452 | zMime = P("m"); |
| 1453 | 1453 | if( zMime==0 ){ |
| @@ -2262,11 +2262,11 @@ | ||
| 2262 | 2262 | } |
| 2263 | 2263 | db_finalize(&q); |
| 2264 | 2264 | if( nChng>0 ){ |
| 2265 | 2265 | int nrid; |
| 2266 | 2266 | Blob cksum; |
| 2267 | - blob_appendf(&ctrl, "U %F\n", g.zLogin); | |
| 2267 | + blob_appendf(&ctrl, "U %F\n", login_name()); | |
| 2268 | 2268 | md5sum_blob(&ctrl, &cksum); |
| 2269 | 2269 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2270 | 2270 | db_begin_transaction(); |
| 2271 | 2271 | g.markPrivate = content_is_private(rid); |
| 2272 | 2272 | nrid = content_put(&ctrl); |
| 2273 | 2273 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1443,11 +1443,11 @@ | |
| 1443 | rid = name_to_rid_www("name"); |
| 1444 | login_check_credentials(); |
| 1445 | if( !g.perm.Read ){ login_needed(); return; } |
| 1446 | if( rid==0 ) fossil_redirect_home(); |
| 1447 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1448 | if( fossil_strcmp(P("name"), zUuid)==0 ){ |
| 1449 | g.isConst = 1; |
| 1450 | } |
| 1451 | free(zUuid); |
| 1452 | zMime = P("m"); |
| 1453 | if( zMime==0 ){ |
| @@ -2262,11 +2262,11 @@ | |
| 2262 | } |
| 2263 | db_finalize(&q); |
| 2264 | if( nChng>0 ){ |
| 2265 | int nrid; |
| 2266 | Blob cksum; |
| 2267 | blob_appendf(&ctrl, "U %F\n", g.zLogin); |
| 2268 | md5sum_blob(&ctrl, &cksum); |
| 2269 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2270 | db_begin_transaction(); |
| 2271 | g.markPrivate = content_is_private(rid); |
| 2272 | nrid = content_put(&ctrl); |
| 2273 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1443,11 +1443,11 @@ | |
| 1443 | rid = name_to_rid_www("name"); |
| 1444 | login_check_credentials(); |
| 1445 | if( !g.perm.Read ){ login_needed(); return; } |
| 1446 | if( rid==0 ) fossil_redirect_home(); |
| 1447 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1448 | if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){ |
| 1449 | g.isConst = 1; |
| 1450 | } |
| 1451 | free(zUuid); |
| 1452 | zMime = P("m"); |
| 1453 | if( zMime==0 ){ |
| @@ -2262,11 +2262,11 @@ | |
| 2262 | } |
| 2263 | db_finalize(&q); |
| 2264 | if( nChng>0 ){ |
| 2265 | int nrid; |
| 2266 | Blob cksum; |
| 2267 | blob_appendf(&ctrl, "U %F\n", login_name()); |
| 2268 | md5sum_blob(&ctrl, &cksum); |
| 2269 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2270 | db_begin_transaction(); |
| 2271 | g.markPrivate = content_is_private(rid); |
| 2272 | nrid = content_put(&ctrl); |
| 2273 |
+14
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -1142,10 +1142,24 @@ | ||
| 1142 | 1142 | /* Set the capabilities */ |
| 1143 | 1143 | login_set_capabilities(zCap, 0); |
| 1144 | 1144 | login_anon_once = 1; |
| 1145 | 1145 | login_set_anon_nobody_capabilities(); |
| 1146 | 1146 | } |
| 1147 | + | |
| 1148 | +/* | |
| 1149 | +** Return true if the user is "nobody" | |
| 1150 | +*/ | |
| 1151 | +int login_is_nobody(void){ | |
| 1152 | + return g.zLogin==0 || g.zLogin[0]==0 || fossil_strcmp(g.zLogin,"nobody")==0; | |
| 1153 | +} | |
| 1154 | + | |
| 1155 | +/* | |
| 1156 | +** Return the login name. If no login name is specified, return "nobody". | |
| 1157 | +*/ | |
| 1158 | +const char *login_name(void){ | |
| 1159 | + return (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody"; | |
| 1160 | +} | |
| 1147 | 1161 | |
| 1148 | 1162 | /* |
| 1149 | 1163 | ** Call this routine when the credential check fails. It causes |
| 1150 | 1164 | ** a redirect to the "login" page. |
| 1151 | 1165 | */ |
| 1152 | 1166 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -1142,10 +1142,24 @@ | |
| 1142 | /* Set the capabilities */ |
| 1143 | login_set_capabilities(zCap, 0); |
| 1144 | login_anon_once = 1; |
| 1145 | login_set_anon_nobody_capabilities(); |
| 1146 | } |
| 1147 | |
| 1148 | /* |
| 1149 | ** Call this routine when the credential check fails. It causes |
| 1150 | ** a redirect to the "login" page. |
| 1151 | */ |
| 1152 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -1142,10 +1142,24 @@ | |
| 1142 | /* Set the capabilities */ |
| 1143 | login_set_capabilities(zCap, 0); |
| 1144 | login_anon_once = 1; |
| 1145 | login_set_anon_nobody_capabilities(); |
| 1146 | } |
| 1147 | |
| 1148 | /* |
| 1149 | ** Return true if the user is "nobody" |
| 1150 | */ |
| 1151 | int login_is_nobody(void){ |
| 1152 | return g.zLogin==0 || g.zLogin[0]==0 || fossil_strcmp(g.zLogin,"nobody")==0; |
| 1153 | } |
| 1154 | |
| 1155 | /* |
| 1156 | ** Return the login name. If no login name is specified, return "nobody". |
| 1157 | */ |
| 1158 | const char *login_name(void){ |
| 1159 | return (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody"; |
| 1160 | } |
| 1161 | |
| 1162 | /* |
| 1163 | ** Call this routine when the credential check fails. It causes |
| 1164 | ** a redirect to the "login" page. |
| 1165 | */ |
| 1166 |
+3
-3
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -121,11 +121,11 @@ | ||
| 121 | 121 | |
| 122 | 122 | struct Global { |
| 123 | 123 | int argc; char **argv; /* Command-line arguments to the program */ |
| 124 | 124 | char *nameOfExe; /* Full path of executable. */ |
| 125 | 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | - int isConst; /* True if the output is unchanging */ | |
| 126 | + int isConst; /* True if the output is unchanging & cacheable */ | |
| 127 | 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | 130 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | 131 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| @@ -193,11 +193,11 @@ | ||
| 193 | 193 | char *urlFossil; /* The fossil query parameter on ssh: */ |
| 194 | 194 | unsigned urlFlags; /* Boolean flags controlling URL processing */ |
| 195 | 195 | int useProxy; /* Used to remember that a proxy is in use */ |
| 196 | 196 | char *proxyUrlPath; |
| 197 | 197 | int proxyOrigPort; /* Tunneled port number for https through proxy */ |
| 198 | - const char *zLogin; /* Login name. "" if not logged in. */ | |
| 198 | + const char *zLogin; /* Login name. NULL or "" if not logged in. */ | |
| 199 | 199 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of |
| 200 | 200 | ** SSL client identity */ |
| 201 | 201 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 202 | 202 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 203 | 203 | int userUid; /* Integer user id */ |
| @@ -1457,11 +1457,11 @@ | ||
| 1457 | 1457 | zAltRepo[jj] = 0; |
| 1458 | 1458 | zAltRepo += jj+1; |
| 1459 | 1459 | }else{ |
| 1460 | 1460 | zUser = "nobody"; |
| 1461 | 1461 | } |
| 1462 | - if( g.zLogin==0 ) zUser = "nobody"; | |
| 1462 | + if( g.zLogin==0 || g.zLogin[0]==0 ) zUser = "nobody"; | |
| 1463 | 1463 | if( zAltRepo[0]!='/' ){ |
| 1464 | 1464 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1465 | 1465 | file_simplify_name(zAltRepo, -1, 0); |
| 1466 | 1466 | } |
| 1467 | 1467 | db_close(1); |
| 1468 | 1468 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -121,11 +121,11 @@ | |
| 121 | |
| 122 | struct Global { |
| 123 | int argc; char **argv; /* Command-line arguments to the program */ |
| 124 | char *nameOfExe; /* Full path of executable. */ |
| 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | int isConst; /* True if the output is unchanging */ |
| 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| @@ -193,11 +193,11 @@ | |
| 193 | char *urlFossil; /* The fossil query parameter on ssh: */ |
| 194 | unsigned urlFlags; /* Boolean flags controlling URL processing */ |
| 195 | int useProxy; /* Used to remember that a proxy is in use */ |
| 196 | char *proxyUrlPath; |
| 197 | int proxyOrigPort; /* Tunneled port number for https through proxy */ |
| 198 | const char *zLogin; /* Login name. "" if not logged in. */ |
| 199 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of |
| 200 | ** SSL client identity */ |
| 201 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 202 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 203 | int userUid; /* Integer user id */ |
| @@ -1457,11 +1457,11 @@ | |
| 1457 | zAltRepo[jj] = 0; |
| 1458 | zAltRepo += jj+1; |
| 1459 | }else{ |
| 1460 | zUser = "nobody"; |
| 1461 | } |
| 1462 | if( g.zLogin==0 ) zUser = "nobody"; |
| 1463 | if( zAltRepo[0]!='/' ){ |
| 1464 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1465 | file_simplify_name(zAltRepo, -1, 0); |
| 1466 | } |
| 1467 | db_close(1); |
| 1468 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -121,11 +121,11 @@ | |
| 121 | |
| 122 | struct Global { |
| 123 | int argc; char **argv; /* Command-line arguments to the program */ |
| 124 | char *nameOfExe; /* Full path of executable. */ |
| 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | int isConst; /* True if the output is unchanging & cacheable */ |
| 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| @@ -193,11 +193,11 @@ | |
| 193 | char *urlFossil; /* The fossil query parameter on ssh: */ |
| 194 | unsigned urlFlags; /* Boolean flags controlling URL processing */ |
| 195 | int useProxy; /* Used to remember that a proxy is in use */ |
| 196 | char *proxyUrlPath; |
| 197 | int proxyOrigPort; /* Tunneled port number for https through proxy */ |
| 198 | const char *zLogin; /* Login name. NULL or "" if not logged in. */ |
| 199 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of |
| 200 | ** SSL client identity */ |
| 201 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 202 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 203 | int userUid; /* Integer user id */ |
| @@ -1457,11 +1457,11 @@ | |
| 1457 | zAltRepo[jj] = 0; |
| 1458 | zAltRepo += jj+1; |
| 1459 | }else{ |
| 1460 | zUser = "nobody"; |
| 1461 | } |
| 1462 | if( g.zLogin==0 || g.zLogin[0]==0 ) zUser = "nobody"; |
| 1463 | if( zAltRepo[0]!='/' ){ |
| 1464 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1465 | file_simplify_name(zAltRepo, -1, 0); |
| 1466 | } |
| 1467 | db_close(1); |
| 1468 |
+5
-3
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -308,11 +308,11 @@ | ||
| 308 | 308 | Th_Store("manifest_date", MANIFEST_DATE); |
| 309 | 309 | Th_Store("compiler_name", COMPILER_NAME); |
| 310 | 310 | url_var("stylesheet", "css", "style.css"); |
| 311 | 311 | image_url_var("logo"); |
| 312 | 312 | image_url_var("background"); |
| 313 | - if( g.zLogin ){ | |
| 313 | + if( !login_is_nobody() ){ | |
| 314 | 314 | Th_Store("login", g.zLogin); |
| 315 | 315 | } |
| 316 | 316 | if( g.thTrace ) Th_Trace("BEGIN_HEADER_SCRIPT<br />\n", -1); |
| 317 | 317 | Th_Render(zHeader); |
| 318 | 318 | if( g.thTrace ) Th_Trace("END_HEADER<br />\n", -1); |
| @@ -346,12 +346,14 @@ | ||
| 346 | 346 | static void style_ad_unit(void){ |
| 347 | 347 | const char *zAd; |
| 348 | 348 | if( g.perm.Admin && db_get_boolean("adunit-omit-if-admin",0) ){ |
| 349 | 349 | return; |
| 350 | 350 | } |
| 351 | - if( g.zLogin && strcmp(g.zLogin,"anonymous")!=0 | |
| 352 | - && db_get_boolean("adunit-omit-if-user",0) ){ | |
| 351 | + if( !login_is_nobody() | |
| 352 | + && fossil_strcmp(g.zLogin,"anonymous")!=0 | |
| 353 | + && db_get_boolean("adunit-omit-if-user",0) | |
| 354 | + ){ | |
| 353 | 355 | return; |
| 354 | 356 | } |
| 355 | 357 | zAd = db_get("adunit", 0); |
| 356 | 358 | if( zAd ) cgi_append_content(zAd, -1); |
| 357 | 359 | } |
| 358 | 360 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -308,11 +308,11 @@ | |
| 308 | Th_Store("manifest_date", MANIFEST_DATE); |
| 309 | Th_Store("compiler_name", COMPILER_NAME); |
| 310 | url_var("stylesheet", "css", "style.css"); |
| 311 | image_url_var("logo"); |
| 312 | image_url_var("background"); |
| 313 | if( g.zLogin ){ |
| 314 | Th_Store("login", g.zLogin); |
| 315 | } |
| 316 | if( g.thTrace ) Th_Trace("BEGIN_HEADER_SCRIPT<br />\n", -1); |
| 317 | Th_Render(zHeader); |
| 318 | if( g.thTrace ) Th_Trace("END_HEADER<br />\n", -1); |
| @@ -346,12 +346,14 @@ | |
| 346 | static void style_ad_unit(void){ |
| 347 | const char *zAd; |
| 348 | if( g.perm.Admin && db_get_boolean("adunit-omit-if-admin",0) ){ |
| 349 | return; |
| 350 | } |
| 351 | if( g.zLogin && strcmp(g.zLogin,"anonymous")!=0 |
| 352 | && db_get_boolean("adunit-omit-if-user",0) ){ |
| 353 | return; |
| 354 | } |
| 355 | zAd = db_get("adunit", 0); |
| 356 | if( zAd ) cgi_append_content(zAd, -1); |
| 357 | } |
| 358 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -308,11 +308,11 @@ | |
| 308 | Th_Store("manifest_date", MANIFEST_DATE); |
| 309 | Th_Store("compiler_name", COMPILER_NAME); |
| 310 | url_var("stylesheet", "css", "style.css"); |
| 311 | image_url_var("logo"); |
| 312 | image_url_var("background"); |
| 313 | if( !login_is_nobody() ){ |
| 314 | Th_Store("login", g.zLogin); |
| 315 | } |
| 316 | if( g.thTrace ) Th_Trace("BEGIN_HEADER_SCRIPT<br />\n", -1); |
| 317 | Th_Render(zHeader); |
| 318 | if( g.thTrace ) Th_Trace("END_HEADER<br />\n", -1); |
| @@ -346,12 +346,14 @@ | |
| 346 | static void style_ad_unit(void){ |
| 347 | const char *zAd; |
| 348 | if( g.perm.Admin && db_get_boolean("adunit-omit-if-admin",0) ){ |
| 349 | return; |
| 350 | } |
| 351 | if( !login_is_nobody() |
| 352 | && fossil_strcmp(g.zLogin,"anonymous")!=0 |
| 353 | && db_get_boolean("adunit-omit-if-user",0) |
| 354 | ){ |
| 355 | return; |
| 356 | } |
| 357 | zAd = db_get("adunit", 0); |
| 358 | if( zAd ) cgi_append_content(zAd, -1); |
| 359 | } |
| 360 |
+1
-1
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -322,11 +322,11 @@ | ||
| 322 | 322 | if( tagtype>0 && zValue && zValue[0] ){ |
| 323 | 323 | blob_appendf(&ctrl, " %F\n", zValue); |
| 324 | 324 | }else{ |
| 325 | 325 | blob_appendf(&ctrl, "\n"); |
| 326 | 326 | } |
| 327 | - blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); | |
| 327 | + blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : login_name()); | |
| 328 | 328 | md5sum_blob(&ctrl, &cksum); |
| 329 | 329 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 330 | 330 | nrid = content_put(&ctrl); |
| 331 | 331 | manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); |
| 332 | 332 | assert( blob_is_reset(&ctrl) ); |
| 333 | 333 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -322,11 +322,11 @@ | |
| 322 | if( tagtype>0 && zValue && zValue[0] ){ |
| 323 | blob_appendf(&ctrl, " %F\n", zValue); |
| 324 | }else{ |
| 325 | blob_appendf(&ctrl, "\n"); |
| 326 | } |
| 327 | blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 328 | md5sum_blob(&ctrl, &cksum); |
| 329 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 330 | nrid = content_put(&ctrl); |
| 331 | manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); |
| 332 | assert( blob_is_reset(&ctrl) ); |
| 333 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -322,11 +322,11 @@ | |
| 322 | if( tagtype>0 && zValue && zValue[0] ){ |
| 323 | blob_appendf(&ctrl, " %F\n", zValue); |
| 324 | }else{ |
| 325 | blob_appendf(&ctrl, "\n"); |
| 326 | } |
| 327 | blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : login_name()); |
| 328 | md5sum_blob(&ctrl, &cksum); |
| 329 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 330 | nrid = content_put(&ctrl); |
| 331 | manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); |
| 332 | assert( blob_is_reset(&ctrl) ); |
| 333 |
+4
-4
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -614,11 +614,11 @@ | ||
| 614 | 614 | }else{ |
| 615 | 615 | zUuid = db_text(0, "SELECT lower(hex(randomblob(20)))"); |
| 616 | 616 | } |
| 617 | 617 | *(const char**)pUuid = zUuid; |
| 618 | 618 | blob_appendf(&tktchng, "K %s\n", zUuid); |
| 619 | - blob_appendf(&tktchng, "U %F\n", g.zLogin ? g.zLogin : ""); | |
| 619 | + blob_appendf(&tktchng, "U %F\n", login_name()); | |
| 620 | 620 | md5sum_blob(&tktchng, &cksum); |
| 621 | 621 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 622 | 622 | if( nJ==0 ){ |
| 623 | 623 | blob_reset(&tktchng); |
| 624 | 624 | return TH_OK; |
| @@ -675,11 +675,11 @@ | ||
| 675 | 675 | login_insert_csrf_secret(); |
| 676 | 676 | if( P("date_override") && g.perm.Setup ){ |
| 677 | 677 | @ <input type="hidden" name="date_override" value="%h(P("date_override"))"> |
| 678 | 678 | } |
| 679 | 679 | zScript = ticket_newpage_code(); |
| 680 | - Th_Store("login", g.zLogin ? g.zLogin : "nobody"); | |
| 680 | + Th_Store("login", login_name()); | |
| 681 | 681 | Th_Store("date", db_text(0, "SELECT datetime('now')")); |
| 682 | 682 | Th_CreateCommand(g.interp, "submit_ticket", submitTicketCmd, |
| 683 | 683 | (void*)&zNewUuid, 0); |
| 684 | 684 | if( g.thTrace ) Th_Trace("BEGIN_TKTNEW_SCRIPT<br />\n", -1); |
| 685 | 685 | if( Th_Render(zScript)==TH_RETURN && !g.thTrace && zNewUuid ){ |
| @@ -743,11 +743,11 @@ | ||
| 743 | 743 | if( g.zPath[0]=='d' ) showAllFields(); |
| 744 | 744 | form_begin(0, "%R/%s", g.zPath); |
| 745 | 745 | @ <input type="hidden" name="name" value="%s(zName)" /> |
| 746 | 746 | login_insert_csrf_secret(); |
| 747 | 747 | zScript = ticket_editpage_code(); |
| 748 | - Th_Store("login", g.zLogin ? g.zLogin : "nobody"); | |
| 748 | + Th_Store("login", login_name()); | |
| 749 | 749 | Th_Store("date", db_text(0, "SELECT datetime('now')")); |
| 750 | 750 | Th_CreateCommand(g.interp, "append_field", appendRemarkCmd, 0, 0); |
| 751 | 751 | Th_CreateCommand(g.interp, "submit_ticket", submitTicketCmd, (void*)&zName,0); |
| 752 | 752 | if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT_SCRIPT<br />\n", -1); |
| 753 | 753 | if( Th_Render(zScript)==TH_RETURN && !g.thTrace && zName ){ |
| @@ -1102,11 +1102,11 @@ | ||
| 1102 | 1102 | /* do some ints, we want to be inside a checkout */ |
| 1103 | 1103 | db_find_and_open_repository(0, 0); |
| 1104 | 1104 | user_select(); |
| 1105 | 1105 | |
| 1106 | 1106 | zUser = find_option("user-override",0,1); |
| 1107 | - if( zUser==0 ) zUser = g.zLogin; | |
| 1107 | + if( zUser==0 ) zUser = login_name(); | |
| 1108 | 1108 | zDate = find_option("date-override",0,1); |
| 1109 | 1109 | if( zDate==0 ) zDate = "now"; |
| 1110 | 1110 | zDate = date_in_standard_format(zDate); |
| 1111 | 1111 | zTktUuid = find_option("uuid-override",0,1); |
| 1112 | 1112 | if( zTktUuid && (strlen(zTktUuid)!=40 || !validate16(zTktUuid,40)) ){ |
| 1113 | 1113 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -614,11 +614,11 @@ | |
| 614 | }else{ |
| 615 | zUuid = db_text(0, "SELECT lower(hex(randomblob(20)))"); |
| 616 | } |
| 617 | *(const char**)pUuid = zUuid; |
| 618 | blob_appendf(&tktchng, "K %s\n", zUuid); |
| 619 | blob_appendf(&tktchng, "U %F\n", g.zLogin ? g.zLogin : ""); |
| 620 | md5sum_blob(&tktchng, &cksum); |
| 621 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 622 | if( nJ==0 ){ |
| 623 | blob_reset(&tktchng); |
| 624 | return TH_OK; |
| @@ -675,11 +675,11 @@ | |
| 675 | login_insert_csrf_secret(); |
| 676 | if( P("date_override") && g.perm.Setup ){ |
| 677 | @ <input type="hidden" name="date_override" value="%h(P("date_override"))"> |
| 678 | } |
| 679 | zScript = ticket_newpage_code(); |
| 680 | Th_Store("login", g.zLogin ? g.zLogin : "nobody"); |
| 681 | Th_Store("date", db_text(0, "SELECT datetime('now')")); |
| 682 | Th_CreateCommand(g.interp, "submit_ticket", submitTicketCmd, |
| 683 | (void*)&zNewUuid, 0); |
| 684 | if( g.thTrace ) Th_Trace("BEGIN_TKTNEW_SCRIPT<br />\n", -1); |
| 685 | if( Th_Render(zScript)==TH_RETURN && !g.thTrace && zNewUuid ){ |
| @@ -743,11 +743,11 @@ | |
| 743 | if( g.zPath[0]=='d' ) showAllFields(); |
| 744 | form_begin(0, "%R/%s", g.zPath); |
| 745 | @ <input type="hidden" name="name" value="%s(zName)" /> |
| 746 | login_insert_csrf_secret(); |
| 747 | zScript = ticket_editpage_code(); |
| 748 | Th_Store("login", g.zLogin ? g.zLogin : "nobody"); |
| 749 | Th_Store("date", db_text(0, "SELECT datetime('now')")); |
| 750 | Th_CreateCommand(g.interp, "append_field", appendRemarkCmd, 0, 0); |
| 751 | Th_CreateCommand(g.interp, "submit_ticket", submitTicketCmd, (void*)&zName,0); |
| 752 | if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT_SCRIPT<br />\n", -1); |
| 753 | if( Th_Render(zScript)==TH_RETURN && !g.thTrace && zName ){ |
| @@ -1102,11 +1102,11 @@ | |
| 1102 | /* do some ints, we want to be inside a checkout */ |
| 1103 | db_find_and_open_repository(0, 0); |
| 1104 | user_select(); |
| 1105 | |
| 1106 | zUser = find_option("user-override",0,1); |
| 1107 | if( zUser==0 ) zUser = g.zLogin; |
| 1108 | zDate = find_option("date-override",0,1); |
| 1109 | if( zDate==0 ) zDate = "now"; |
| 1110 | zDate = date_in_standard_format(zDate); |
| 1111 | zTktUuid = find_option("uuid-override",0,1); |
| 1112 | if( zTktUuid && (strlen(zTktUuid)!=40 || !validate16(zTktUuid,40)) ){ |
| 1113 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -614,11 +614,11 @@ | |
| 614 | }else{ |
| 615 | zUuid = db_text(0, "SELECT lower(hex(randomblob(20)))"); |
| 616 | } |
| 617 | *(const char**)pUuid = zUuid; |
| 618 | blob_appendf(&tktchng, "K %s\n", zUuid); |
| 619 | blob_appendf(&tktchng, "U %F\n", login_name()); |
| 620 | md5sum_blob(&tktchng, &cksum); |
| 621 | blob_appendf(&tktchng, "Z %b\n", &cksum); |
| 622 | if( nJ==0 ){ |
| 623 | blob_reset(&tktchng); |
| 624 | return TH_OK; |
| @@ -675,11 +675,11 @@ | |
| 675 | login_insert_csrf_secret(); |
| 676 | if( P("date_override") && g.perm.Setup ){ |
| 677 | @ <input type="hidden" name="date_override" value="%h(P("date_override"))"> |
| 678 | } |
| 679 | zScript = ticket_newpage_code(); |
| 680 | Th_Store("login", login_name()); |
| 681 | Th_Store("date", db_text(0, "SELECT datetime('now')")); |
| 682 | Th_CreateCommand(g.interp, "submit_ticket", submitTicketCmd, |
| 683 | (void*)&zNewUuid, 0); |
| 684 | if( g.thTrace ) Th_Trace("BEGIN_TKTNEW_SCRIPT<br />\n", -1); |
| 685 | if( Th_Render(zScript)==TH_RETURN && !g.thTrace && zNewUuid ){ |
| @@ -743,11 +743,11 @@ | |
| 743 | if( g.zPath[0]=='d' ) showAllFields(); |
| 744 | form_begin(0, "%R/%s", g.zPath); |
| 745 | @ <input type="hidden" name="name" value="%s(zName)" /> |
| 746 | login_insert_csrf_secret(); |
| 747 | zScript = ticket_editpage_code(); |
| 748 | Th_Store("login", login_name()); |
| 749 | Th_Store("date", db_text(0, "SELECT datetime('now')")); |
| 750 | Th_CreateCommand(g.interp, "append_field", appendRemarkCmd, 0, 0); |
| 751 | Th_CreateCommand(g.interp, "submit_ticket", submitTicketCmd, (void*)&zName,0); |
| 752 | if( g.thTrace ) Th_Trace("BEGIN_TKTEDIT_SCRIPT<br />\n", -1); |
| 753 | if( Th_Render(zScript)==TH_RETURN && !g.thTrace && zName ){ |
| @@ -1102,11 +1102,11 @@ | |
| 1102 | /* do some ints, we want to be inside a checkout */ |
| 1103 | db_find_and_open_repository(0, 0); |
| 1104 | user_select(); |
| 1105 | |
| 1106 | zUser = find_option("user-override",0,1); |
| 1107 | if( zUser==0 ) zUser = login_name(); |
| 1108 | zDate = find_option("date-override",0,1); |
| 1109 | if( zDate==0 ) zDate = "now"; |
| 1110 | zDate = date_in_standard_format(zDate); |
| 1111 | zTktUuid = find_option("uuid-override",0,1); |
| 1112 | if( zTktUuid && (strlen(zTktUuid)!=40 || !validate16(zTktUuid,40)) ){ |
| 1113 |
+12
-12
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -420,12 +420,12 @@ | ||
| 420 | 420 | if( rid ){ |
| 421 | 421 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 422 | 422 | blob_appendf(&wiki, "P %s\n", zUuid); |
| 423 | 423 | free(zUuid); |
| 424 | 424 | } |
| 425 | - if( g.zLogin ){ | |
| 426 | - blob_appendf(&wiki, "U %F\n", g.zLogin); | |
| 425 | + if( !login_is_nobody() ){ | |
| 426 | + blob_appendf(&wiki, "U %F\n", login_name()); | |
| 427 | 427 | } |
| 428 | 428 | blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody); |
| 429 | 429 | md5sum_blob(&wiki, &cksum); |
| 430 | 430 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 431 | 431 | blob_reset(&cksum); |
| @@ -558,25 +558,25 @@ | ||
| 558 | 558 | zRemark = PD("r",""); |
| 559 | 559 | zUser = PD("u",g.zLogin); |
| 560 | 560 | if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){ |
| 561 | 561 | zId = db_text(0, "SELECT lower(hex(randomblob(8)))"); |
| 562 | 562 | blob_appendf(p, "\n\n<hr><div id=\"%s\"><i>On %s UTC %h", |
| 563 | - zId, zDate, g.zLogin); | |
| 564 | - if( zUser[0] && fossil_strcmp(zUser,g.zLogin) ){ | |
| 563 | + zId, zDate, login_name()); | |
| 564 | + if( zUser[0] && fossil_strcmp(zUser,login_name()) ){ | |
| 565 | 565 | blob_appendf(p, " (claiming to be %h)", zUser); |
| 566 | 566 | } |
| 567 | 567 | blob_appendf(p, " added:</i><br />\n%s</div id=\"%s\">", zRemark, zId); |
| 568 | 568 | }else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){ |
| 569 | - blob_appendf(p, "\n\n------\n*On %s UTC %h", zDate, g.zLogin); | |
| 570 | - if( zUser[0] && fossil_strcmp(zUser,g.zLogin) ){ | |
| 569 | + blob_appendf(p, "\n\n------\n*On %s UTC %h", zDate, login_name()); | |
| 570 | + if( zUser[0] && fossil_strcmp(zUser,login_name()) ){ | |
| 571 | 571 | blob_appendf(p, " (claiming to be %h)", zUser); |
| 572 | 572 | } |
| 573 | 573 | blob_appendf(p, " added:*\n\n%s\n", zRemark); |
| 574 | 574 | }else{ |
| 575 | 575 | blob_appendf(p, "\n\n------------------------------------------------\n" |
| 576 | - "On %s UTC %s", zDate, g.zLogin); | |
| 577 | - if( zUser[0] && fossil_strcmp(zUser,g.zLogin) ){ | |
| 576 | + "On %s UTC %s", zDate, login_name()); | |
| 577 | + if( zUser[0] && fossil_strcmp(zUser,login_name()) ){ | |
| 578 | 578 | blob_appendf(p, " (claiming to be %s)", zUser); |
| 579 | 579 | } |
| 580 | 580 | blob_appendf(p, " added:\n\n%s\n", zRemark); |
| 581 | 581 | } |
| 582 | 582 | fossil_free(zDate); |
| @@ -650,12 +650,12 @@ | ||
| 650 | 650 | if( rid ){ |
| 651 | 651 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 652 | 652 | blob_appendf(&wiki, "P %s\n", zUuid); |
| 653 | 653 | free(zUuid); |
| 654 | 654 | } |
| 655 | - if( g.zLogin ){ | |
| 656 | - blob_appendf(&wiki, "U %F\n", g.zLogin); | |
| 655 | + if( !login_is_nobody() ){ | |
| 656 | + blob_appendf(&wiki, "U %F\n", login_name()); | |
| 657 | 657 | } |
| 658 | 658 | appendRemark(&body, zMimetype); |
| 659 | 659 | blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body)); |
| 660 | 660 | md5sum_blob(&wiki, &cksum); |
| 661 | 661 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| @@ -993,12 +993,12 @@ | ||
| 993 | 993 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 994 | 994 | blob_appendf(&wiki, "P %s\n", zUuid); |
| 995 | 995 | free(zUuid); |
| 996 | 996 | } |
| 997 | 997 | user_select(); |
| 998 | - if( g.zLogin ){ | |
| 999 | - blob_appendf(&wiki, "U %F\n", g.zLogin); | |
| 998 | + if( !login_is_nobody() ){ | |
| 999 | + blob_appendf(&wiki, "U %F\n", login_name()); | |
| 1000 | 1000 | } |
| 1001 | 1001 | blob_appendf( &wiki, "W %d\n%s\n", blob_size(pContent), |
| 1002 | 1002 | blob_str(pContent) ); |
| 1003 | 1003 | md5sum_blob(&wiki, &cksum); |
| 1004 | 1004 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 1005 | 1005 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -420,12 +420,12 @@ | |
| 420 | if( rid ){ |
| 421 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 422 | blob_appendf(&wiki, "P %s\n", zUuid); |
| 423 | free(zUuid); |
| 424 | } |
| 425 | if( g.zLogin ){ |
| 426 | blob_appendf(&wiki, "U %F\n", g.zLogin); |
| 427 | } |
| 428 | blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody); |
| 429 | md5sum_blob(&wiki, &cksum); |
| 430 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 431 | blob_reset(&cksum); |
| @@ -558,25 +558,25 @@ | |
| 558 | zRemark = PD("r",""); |
| 559 | zUser = PD("u",g.zLogin); |
| 560 | if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){ |
| 561 | zId = db_text(0, "SELECT lower(hex(randomblob(8)))"); |
| 562 | blob_appendf(p, "\n\n<hr><div id=\"%s\"><i>On %s UTC %h", |
| 563 | zId, zDate, g.zLogin); |
| 564 | if( zUser[0] && fossil_strcmp(zUser,g.zLogin) ){ |
| 565 | blob_appendf(p, " (claiming to be %h)", zUser); |
| 566 | } |
| 567 | blob_appendf(p, " added:</i><br />\n%s</div id=\"%s\">", zRemark, zId); |
| 568 | }else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){ |
| 569 | blob_appendf(p, "\n\n------\n*On %s UTC %h", zDate, g.zLogin); |
| 570 | if( zUser[0] && fossil_strcmp(zUser,g.zLogin) ){ |
| 571 | blob_appendf(p, " (claiming to be %h)", zUser); |
| 572 | } |
| 573 | blob_appendf(p, " added:*\n\n%s\n", zRemark); |
| 574 | }else{ |
| 575 | blob_appendf(p, "\n\n------------------------------------------------\n" |
| 576 | "On %s UTC %s", zDate, g.zLogin); |
| 577 | if( zUser[0] && fossil_strcmp(zUser,g.zLogin) ){ |
| 578 | blob_appendf(p, " (claiming to be %s)", zUser); |
| 579 | } |
| 580 | blob_appendf(p, " added:\n\n%s\n", zRemark); |
| 581 | } |
| 582 | fossil_free(zDate); |
| @@ -650,12 +650,12 @@ | |
| 650 | if( rid ){ |
| 651 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 652 | blob_appendf(&wiki, "P %s\n", zUuid); |
| 653 | free(zUuid); |
| 654 | } |
| 655 | if( g.zLogin ){ |
| 656 | blob_appendf(&wiki, "U %F\n", g.zLogin); |
| 657 | } |
| 658 | appendRemark(&body, zMimetype); |
| 659 | blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body)); |
| 660 | md5sum_blob(&wiki, &cksum); |
| 661 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| @@ -993,12 +993,12 @@ | |
| 993 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 994 | blob_appendf(&wiki, "P %s\n", zUuid); |
| 995 | free(zUuid); |
| 996 | } |
| 997 | user_select(); |
| 998 | if( g.zLogin ){ |
| 999 | blob_appendf(&wiki, "U %F\n", g.zLogin); |
| 1000 | } |
| 1001 | blob_appendf( &wiki, "W %d\n%s\n", blob_size(pContent), |
| 1002 | blob_str(pContent) ); |
| 1003 | md5sum_blob(&wiki, &cksum); |
| 1004 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 1005 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -420,12 +420,12 @@ | |
| 420 | if( rid ){ |
| 421 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 422 | blob_appendf(&wiki, "P %s\n", zUuid); |
| 423 | free(zUuid); |
| 424 | } |
| 425 | if( !login_is_nobody() ){ |
| 426 | blob_appendf(&wiki, "U %F\n", login_name()); |
| 427 | } |
| 428 | blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody); |
| 429 | md5sum_blob(&wiki, &cksum); |
| 430 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 431 | blob_reset(&cksum); |
| @@ -558,25 +558,25 @@ | |
| 558 | zRemark = PD("r",""); |
| 559 | zUser = PD("u",g.zLogin); |
| 560 | if( fossil_strcmp(zMimetype, "text/x-fossil-wiki")==0 ){ |
| 561 | zId = db_text(0, "SELECT lower(hex(randomblob(8)))"); |
| 562 | blob_appendf(p, "\n\n<hr><div id=\"%s\"><i>On %s UTC %h", |
| 563 | zId, zDate, login_name()); |
| 564 | if( zUser[0] && fossil_strcmp(zUser,login_name()) ){ |
| 565 | blob_appendf(p, " (claiming to be %h)", zUser); |
| 566 | } |
| 567 | blob_appendf(p, " added:</i><br />\n%s</div id=\"%s\">", zRemark, zId); |
| 568 | }else if( fossil_strcmp(zMimetype, "text/x-markdown")==0 ){ |
| 569 | blob_appendf(p, "\n\n------\n*On %s UTC %h", zDate, login_name()); |
| 570 | if( zUser[0] && fossil_strcmp(zUser,login_name()) ){ |
| 571 | blob_appendf(p, " (claiming to be %h)", zUser); |
| 572 | } |
| 573 | blob_appendf(p, " added:*\n\n%s\n", zRemark); |
| 574 | }else{ |
| 575 | blob_appendf(p, "\n\n------------------------------------------------\n" |
| 576 | "On %s UTC %s", zDate, login_name()); |
| 577 | if( zUser[0] && fossil_strcmp(zUser,login_name()) ){ |
| 578 | blob_appendf(p, " (claiming to be %s)", zUser); |
| 579 | } |
| 580 | blob_appendf(p, " added:\n\n%s\n", zRemark); |
| 581 | } |
| 582 | fossil_free(zDate); |
| @@ -650,12 +650,12 @@ | |
| 650 | if( rid ){ |
| 651 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 652 | blob_appendf(&wiki, "P %s\n", zUuid); |
| 653 | free(zUuid); |
| 654 | } |
| 655 | if( !login_is_nobody() ){ |
| 656 | blob_appendf(&wiki, "U %F\n", login_name()); |
| 657 | } |
| 658 | appendRemark(&body, zMimetype); |
| 659 | blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body)); |
| 660 | md5sum_blob(&wiki, &cksum); |
| 661 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| @@ -993,12 +993,12 @@ | |
| 993 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 994 | blob_appendf(&wiki, "P %s\n", zUuid); |
| 995 | free(zUuid); |
| 996 | } |
| 997 | user_select(); |
| 998 | if( !login_is_nobody() ){ |
| 999 | blob_appendf(&wiki, "U %F\n", login_name()); |
| 1000 | } |
| 1001 | blob_appendf( &wiki, "W %d\n%s\n", blob_size(pContent), |
| 1002 | blob_str(pContent) ); |
| 1003 | md5sum_blob(&wiki, &cksum); |
| 1004 | blob_appendf(&wiki, "Z %b\n", &cksum); |
| 1005 |