Diff

Differences From Artifact [1dcdd9bb28]:

To Artifact [126129663c]:


   460    460   }
   461    461   
   462    462   static int tcl_appfs_simulate_user_fs_leave(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
   463    463   	appfs_simulate_user_fs_leave();
   464    464   
   465    465   	return(TCL_OK);
   466    466   }
          467  +
          468  +static int tcl_appfs_get_fsuid(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          469  +	uid_t fsuid;
          470  +
          471  +	fsuid = appfs_get_fsuid();
          472  +
          473  +       	Tcl_SetObjResult(interp, Tcl_NewWideIntObj(fsuid));
          474  +
          475  +	return(TCL_OK);
          476  +}
          477  +
          478  +static int tcl_appfs_get_fsgid(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
          479  +	gid_t fsgid;
          480  +
          481  +	fsgid = appfs_get_fsgid();
          482  +
          483  +       	Tcl_SetObjResult(interp, Tcl_NewWideIntObj(fsgid));
          484  +
          485  +	return(TCL_OK);
          486  +}
   467    487   
   468    488   /*
   469    489    * Generate an inode for a given path.  The inode should be computed in such
   470    490    * a way that it is unlikely to be duplicated and remains the same for a given
   471    491    * file
   472    492    */
   473    493   static long long appfs_get_path_inode(const char *path) {
................................................................................
   714    734   	memset(stbuf, 0, sizeof(struct stat));
   715    735   
   716    736   	stbuf->st_mtime = pathinfo.time;
   717    737   	stbuf->st_ctime = pathinfo.time;
   718    738   	stbuf->st_atime = pathinfo.time;
   719    739   	stbuf->st_ino   = pathinfo.inode;
   720    740   	stbuf->st_mode  = 0;
   721         -	stbuf->st_uid   = appfs_get_fsuid();
   722         -	stbuf->st_gid   = appfs_get_fsgid();
          741  +	stbuf->st_uid   = 0;
          742  +	stbuf->st_gid   = 0;
   723    743   
   724    744   	switch (pathinfo.type) {
   725    745   		case APPFS_PATHTYPE_DIRECTORY:
   726    746   			stbuf->st_mode = S_IFDIR | 0555;
   727    747   			stbuf->st_nlink = 2 + pathinfo.typeinfo.dir.childcount;
   728    748   			break;
   729    749   		case APPFS_PATHTYPE_FILE:
................................................................................
  1164   1184   #ifdef USE_TCL_STUBS
  1165   1185   	if (Tcl_InitStubs(interp, TCL_VERSION, 0) == 0L) {
  1166   1186   		return(TCL_ERROR);
  1167   1187   	}
  1168   1188   #endif
  1169   1189   
  1170   1190   	Tcl_CreateObjCommand(interp, "appfsd::get_homedir", tcl_appfs_get_homedir, NULL, NULL);
         1191  +	Tcl_CreateObjCommand(interp, "appfsd::get_fsuid", tcl_appfs_get_fsuid, NULL, NULL);
         1192  +	Tcl_CreateObjCommand(interp, "appfsd::get_fsgid", tcl_appfs_get_fsgid, NULL, NULL);
  1171   1193   	Tcl_CreateObjCommand(interp, "appfsd::simulate_user_fs_enter", tcl_appfs_simulate_user_fs_enter, NULL, NULL);
  1172   1194   	Tcl_CreateObjCommand(interp, "appfsd::simulate_user_fs_leave", tcl_appfs_simulate_user_fs_leave, NULL, NULL);
  1173   1195   
  1174   1196   	Tcl_PkgProvide(interp, "appfsd", "1.0");
  1175   1197   
  1176   1198   	return(TCL_OK);
  1177   1199   }