Fossil

Check-in [da9d38e2c3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the "add" command is that it does not allow users to accidently add files that contain shell wildcard characters.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: da9d38e2c38f5271e1abbdee4a771a09be3a1812
User & Date: drh 2007-10-15 20:45:11.000
Context
2007-10-21
11:11
Fix a bug in wiki rendering that caused an extra paragraph end tag following a hyperlink. check-in: 8f423ad438 user: drh tags: trunk
2007-10-15
20:45
Fix the "add" command is that it does not allow users to accidently add files that contain shell wildcard characters. check-in: da9d38e2c3 user: drh tags: trunk
2007-10-14
00:30
Add a sample ticket configuration script. This is just working notes. It will eventually be removed. check-in: d29dd11f2e user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/add.c.
62
63
64
65
66
67
68



69
70
71
72
73
74
75
      fossil_fatal("cannot open %s", zName);
    }
    file_tree_name(zName, &pathname);
    zPath = blob_str(&pathname);
    if( strcmp(zPath, "manifest")==0 || strcmp(zPath, "_FOSSIL_")==0 ){
      fossil_fatal("cannot add %s", zPath);
    }



    if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
      db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
    }else{
      db_multi_exec(
        "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
        "VALUES(%d,0,0,0,%Q)", vid, zPath);
    }







>
>
>







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
      fossil_fatal("cannot open %s", zName);
    }
    file_tree_name(zName, &pathname);
    zPath = blob_str(&pathname);
    if( strcmp(zPath, "manifest")==0 || strcmp(zPath, "_FOSSIL_")==0 ){
      fossil_fatal("cannot add %s", zPath);
    }
    if( !file_is_simple_pathname(zPath) ){
      fossil_fatal("filename contains illegal characters: %s", zPath);
    }
    if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
      db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
    }else{
      db_multi_exec(
        "INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
        "VALUES(%d,0,0,0,%Q)", vid, zPath);
    }