Check-in [20bcbcf2f2]
Not logged in
Overview

SHA1 Hash:20bcbcf2f2b2518f1745f473337ce5c524e2a4cf
Date: 2007-08-08 15:22:43
User: drh
Comment:Make sure a user does not attempt to "fossil add" the manifest or the _FOSSIL_ files.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/add.c from [1a5dfcdbfd] to [f62f7b3cc4].

@@ -53,17 +53,20 @@
 
     zName = mprintf("%s", g.argv[i]);
     isDir = file_isdir(zName);
     if( isDir==1 ) continue;
     if( isDir==0 ){
-      fossil_panic("not found: %s\n", zName);
+      fossil_fatal("not found: %s", zName);
     }
     if( isDir==2 && access(zName, R_OK) ){
-      fossil_panic("cannot open %s\n", zName);
+      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)"
@@ -99,15 +102,15 @@
     zName = mprintf("%s", g.argv[i]);
     file_tree_name(zName, &pathname);
     zPath = blob_str(&pathname);
     if( !db_exists(
              "SELECT 1 FROM vfile WHERE pathname=%Q AND NOT deleted", zPath) ){
-      fossil_panic("not in the repository: %s\n", zName);
+      fossil_fatal("not in the repository: %s", zName);
     }else{
       db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zPath);
     }
     blob_reset(&pathname);
     free(zName);
   }
   db_multi_exec("DELETE FROM vfile WHERE deleted AND rid=0");
   db_end_transaction(0);
 }