Diff for /parser3/src/main/pa_common.C between versions 1.148 and 1.151

version 1.148, 2003/03/21 07:18:01 version 1.151, 2003/05/30 10:45:37
Line 452  bool file_read(Pool& pool, const String& Line 452  bool file_read(Pool& pool, const String&
         return result;          return result;
 }  }
   
   #ifdef PA_SAFE_MODE
   void check_safe_mode(struct stat finfo, const String& file_spec, const char* fname) {
           if(finfo.st_uid/*foreign?*/!=geteuid()
                   && finfo.st_gid/*foreign?*/!=getegid())
                   throw Exception("parser.runtime", 
                           &file_spec, 
                           "parser is in safe mode: "
                           "reading files of foreign group and user disabled "
                           "[recompile parser with --disable-safe-mode configure option], "
                           "actual filename '%s', "
                           "fuid(%d)!=euid(%d) or fgid(%d)!=egid(%d)", 
                                   fname,
                                   finfo.st_uid, geteuid(),
                                   finfo.st_gid, getegid());
   }
   #endif
   
 bool file_read_action_under_lock(Pool& pool, const String& file_spec,   bool file_read_action_under_lock(Pool& pool, const String& file_spec, 
                                 const char* action_name, File_read_action action, void *context,                                   const char* action_name, File_read_action action, void *context, 
                                 bool as_text,                                   bool as_text, 
Line 484  bool file_read_action_under_lock(Pool& p Line 501  bool file_read_action_under_lock(Pool& p
                                                 strerror(errno), errno, fname);                                                   strerror(errno), errno, fname); 
   
 #ifdef PA_SAFE_MODE  #ifdef PA_SAFE_MODE
                         if(finfo.st_uid/*foreign?*/!=geteuid()                          check_safe_mode(finfo, file_spec, fname);
                                 && finfo.st_gid/*foreign?*/!=getegid())  
                                 throw Exception("parser.runtime",   
                                         &file_spec,   
                                         "parser is in safe mode: reading files of foreign group and user disabled [recompile parser with --disable-safe-mode configure option], actual filename '%s'",   
                                                 fname);   
 #endif  #endif
   
                         action(pool, finfo, f, file_spec, fname, as_text, context);                           action(pool, finfo, f, file_spec, fname, as_text, context); 
Line 963  int pa_sleep(unsigned long secs, unsigne Line 975  int pa_sleep(unsigned long secs, unsigne
   
 // attributed meaning  // attributed meaning
   
   /// http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
 static size_t date_attribute(const VDate& vdate, char *buf, size_t buf_size) {  static size_t date_attribute(const VDate& vdate, char *buf, size_t buf_size) {
     const char month_names[12][4]={      const char month_names[12][4]={
                 "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};                  "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
Line 975  static size_t date_attribute(const VDate Line 988  static size_t date_attribute(const VDate
                 throw Exception(0,                  throw Exception(0,
                         0,                          0,
                         "bad time in attribute value (seconds from epoch=%ld)", when);                          "bad time in attribute value (seconds from epoch=%ld)", when);
         return snprintf(buf, MAX_STRING, "%s, %.2d-%s-%.4d %.2d:%.2d:%.2d GMT",           return snprintf(buf, MAX_STRING, "%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT", 
                 days[tms->tm_wday],                  days[tms->tm_wday],
                 tms->tm_mday,month_names[tms->tm_mon],tms->tm_year+1900,                  tms->tm_mday,month_names[tms->tm_mon],tms->tm_year+1900,
                 tms->tm_hour,tms->tm_min,tms->tm_sec);                  tms->tm_hour,tms->tm_min,tms->tm_sec);

Removed from v.1.148  
changed lines
  Added in v.1.151


E-mail: