Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | If a user tries to add an attachment which is a valid control artifact, compress the attachment and append ".gz" to its names, to prevent it from being interpreted as a real control artifact. Also fix an unrelated comment typo. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cd4e08803fc02a041067d48ade679caa |
User & Date: | drh 2012-04-17 20:37:07 |
Context
2012-04-17
| ||
21:56 | Pull in the latest pre-release version of SQLite, including the new shell. ... (check-in: 4faefe63 user: drh tags: trunk) | |
20:37 | If a user tries to add an attachment which is a valid control artifact, compress the attachment and append ".gz" to its names, to prevent it from being interpreted as a real control artifact. Also fix an unrelated comment typo. ... (check-in: cd4e0880 user: drh tags: trunk) | |
2012-04-13
| ||
22:42 | Fix the /dir webpages to that it treats folders whos names differ only in case as the same folder when case-sensitive is off. ... (check-in: 4290a801 user: drh tags: trunk) | |
Changes
Changes to src/attach.c.
︙ | ︙ | |||
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | Blob manifest; Blob cksum; char *zUUID; const char *zComment; char *zDate; int rid; int i, n; db_begin_transaction(); blob_init(&content, aContent, szContent); rid = content_put(&content); zUUID = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); blob_zero(&manifest); for(i=n=0; zName[i]; i++){ if( zName[i]=='/' || zName[i]=='\\' ) n = i; } zName += n; if( zName[0]==0 ) zName = "unknown"; | > > > > > > > > > | > | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | Blob manifest; Blob cksum; char *zUUID; const char *zComment; char *zDate; int rid; int i, n; int addCompress = 0; Manifest *pManifest; db_begin_transaction(); blob_init(&content, aContent, szContent); pManifest = manifest_parse(&content, 0); manifest_destroy(pManifest); blob_init(&content, aContent, szContent); if( pManifest ){ blob_compress(&content, &content); addCompress = 1; } rid = content_put(&content); zUUID = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); blob_zero(&manifest); for(i=n=0; zName[i]; i++){ if( zName[i]=='/' || zName[i]=='\\' ) n = i; } zName += n; if( zName[0]==0 ) zName = "unknown"; blob_appendf(&manifest, "A %F%s %F %s\n", zName, addCompress ? ".gz" : "", zTarget, zUUID); zComment = PD("comment", ""); while( fossil_isspace(zComment[0]) ) zComment++; n = strlen(zComment); while( n>0 && fossil_isspace(zComment[n-1]) ){ n--; } if( n>0 ){ blob_appendf(&manifest, "C %F\n", zComment); } |
︙ | ︙ |
Changes to src/login.c.
︙ | ︙ | |||
383 384 385 386 387 388 389 | /* ** Look at the HTTP_USER_AGENT parameter and try to determine if the user agent ** is a manually operated browser or a bot. When in doubt, assume a bot. ** Return true if we believe the agent is a real person. */ static int isHuman(const char *zAgent){ int i; | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | /* ** Look at the HTTP_USER_AGENT parameter and try to determine if the user agent ** is a manually operated browser or a bot. When in doubt, assume a bot. ** Return true if we believe the agent is a real person. */ static int isHuman(const char *zAgent){ int i; if( zAgent==0 ) return 0; /* If not UserAgent, then probably a bot */ for(i=0; zAgent[i]; i++){ if( prefix_match("bot", zAgent+i) ) return 0; if( prefix_match("spider", zAgent+i) ) return 0; if( prefix_match("crawl", zAgent+i) ) return 0; /* If a URI appears in the User-Agent, it is probably a bot */ if( memcmp("http", zAgent+i,4)==0 ) return 0; } |
︙ | ︙ |
Changes to src/manifest.c.
︙ | ︙ | |||
332 333 334 335 336 337 338 | ** The file consists of zero or more cards, one card per line. ** (Except: the content of the W card can extend of multiple lines.) ** Each card is divided into tokens by a single space character. ** The first token is a single upper-case letter which is the card type. ** The card type determines the other parameters to the card. ** Cards must occur in lexicographical order. */ | | > > | | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | ** The file consists of zero or more cards, one card per line. ** (Except: the content of the W card can extend of multiple lines.) ** Each card is divided into tokens by a single space character. ** The first token is a single upper-case letter which is the card type. ** The card type determines the other parameters to the card. ** Cards must occur in lexicographical order. */ Manifest *manifest_parse(Blob *pContent, int rid){ Manifest *p; int seenZ = 0; int i, lineNo=0; ManifestText x; char cPrevType = 0; char cType; char *z; int n; char *zUuid; int sz = 0; int isRepeat; static Bag seen; if( rid==0 ){ isRepeat = 1; }else if( bag_find(&seen, rid) ){ isRepeat = 1; }else{ isRepeat = 0; bag_insert(&seen, rid); } /* Every control artifact ends with a '\n' character. Exit early |
︙ | ︙ |