/[monit]/monit/p.y
ViewVC logotype

Diff of /monit/p.y

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.108 by martinp, Mon Aug 11 23:30:54 2003 UTC revision 1.109 by martinp, Tue Aug 12 11:22:17 2003 UTC
# Line 123  Line 123 
123      int  action;      int  action;
124    };    };
125    
126      struct PermSet {
127        int perm;
128        int action;
129      };
130    
131    struct UidSet {    struct UidSet {
132      uid_t uid;      uid_t uid;
133      int   action;      int   action;
# Line 166  Line 171 
171      ACTION_ALERT};      ACTION_ALERT};
172    static struct TimestampSet timestampset= {OPERATOR_EQUAL, 0, 0, ACTION_ALERT};    static struct TimestampSet timestampset= {OPERATOR_EQUAL, 0, 0, ACTION_ALERT};
173    static struct SizeSet sizeset= {OPERATOR_EQUAL, 0, 0, ACTION_ALERT};    static struct SizeSet sizeset= {OPERATOR_EQUAL, 0, 0, ACTION_ALERT};
174      static struct PermSet permset= {0, ACTION_ALERT};
175    static struct UidSet uidset= {0, ACTION_ALERT};    static struct UidSet uidset= {0, ACTION_ALERT};
176    static struct GidSet gidset= {0, ACTION_ALERT};    static struct GidSet gidset= {0, ACTION_ALERT};
177    static struct DeviceSet deviceset= {0, OPERATOR_EQUAL, -1, -1, ACTION_ALERT};    static struct DeviceSet deviceset= {0, OPERATOR_EQUAL, -1, -1, ACTION_ALERT};
# Line 188  Line 194 
194    static void  addargument(char *);    static void  addargument(char *);
195    static uid_t get_uid(char *, uid_t);    static uid_t get_uid(char *, uid_t);
196    static gid_t get_gid(char *, gid_t);    static gid_t get_gid(char *, gid_t);
197      static void  addperm(struct PermSet *);
198    static void  adduid(struct UidSet *);    static void  adduid(struct UidSet *);
199    static void  addgid(struct GidSet *);    static void  addgid(struct GidSet *);
200    static void  addeuid(uid_t);    static void  addeuid(uid_t);
# Line 203  Line 210 
210    static void  reset_resourceset();    static void  reset_resourceset();
211    static void  reset_timestampset();    static void  reset_timestampset();
212    static void  reset_sizeset();    static void  reset_sizeset();
213      static void  reset_permset();
214    static void  reset_uidset();    static void  reset_uidset();
215    static void  reset_gidset();    static void  reset_gidset();
216    static void  reset_deviceset();    static void  reset_deviceset();
# Line 668  eventoption     : START      { eventset Line 676  eventoption     : START      { eventset
676                  | SIZE       { eventset |= EVENT_SIZE; }                  | SIZE       { eventset |= EVENT_SIZE; }
677                  | CONNECTION { eventset |= EVENT_CONNECTION; }                  | CONNECTION { eventset |= EVENT_CONNECTION; }
678                  | PERMISSION { eventset |= EVENT_PERMISSION; }                  | PERMISSION { eventset |= EVENT_PERMISSION; }
679                    | UID        { eventset |= EVENT_UID; }
680                    | GID        { eventset |= EVENT_GID; }
681                  ;                  ;
682    
683  formatlist      : /* EMPTY */  formatlist      : /* EMPTY */
# Line 867  unit            : BYTE     { $<number>$= Line 877  unit            : BYTE     { $<number>$=
877                  | GIGABYTE { $<number>$= UNIT_GIGABYTE; }                  | GIGABYTE { $<number>$= UNIT_GIGABYTE; }
878                  ;                  ;
879    
880  permission      : PERMISSION NUMBER { current->perm=check_perm($2); }  permission      : IF FAILED PERMISSION NUMBER THEN action {
881                        permset.perm= check_perm($4);
882                        permset.action= $<number>6;
883                        addperm(&permset);
884                      }
885                  ;                  ;
886    
887  size            : IF SIZE operator NUMBER unit THEN action {  size            : IF SIZE operator NUMBER unit THEN action {
# Line 1048  static void createservice(int type, char Line 1062  static void createservice(int type, char
1062    /* Set default values */    /* Set default values */
1063    current->do_monitor= TRUE;    current->do_monitor= TRUE;
1064    current->mode= MODE_ACTIVE;    current->mode= MODE_ACTIVE;
   current->perm= -1;  
1065    
1066    current->type= type;    current->type= type;
1067    current->name= name;    current->name= name;
# Line 1346  static void addsize(struct SizeSet *ss) Line 1359  static void addsize(struct SizeSet *ss)
1359    
1360    
1361  /*  /*
1362     * Set Perm object in the current service
1363     */
1364    static void addperm(struct PermSet *ps) {
1365    
1366      Perm_T p;
1367    
1368      ASSERT(ps);
1369    
1370      NEW(p);
1371      p->perm= ps->perm;
1372      p->action= ps->action;
1373    
1374      if((p->action == ACTION_EXEC) && command) {
1375        p->exec= command;
1376        command= NULL;
1377      }
1378    
1379      current->perm= p;
1380    
1381      reset_permset();
1382    
1383    }
1384    
1385    
1386    /*
1387   * Set Uid object in the current service   * Set Uid object in the current service
1388   */   */
1389  static void adduid(struct UidSet *us) {  static void adduid(struct UidSet *us) {
# Line 1857  static void reset_sizeset() { Line 1895  static void reset_sizeset() {
1895    
1896  }  }
1897    
1898    
1899    /*
1900     * Reset the Perm set to default values
1901     */
1902    static void reset_permset() {
1903    
1904      permset.perm= 0;
1905      permset.action= ACTION_ALERT;
1906    
1907    }
1908    
1909    
1910  /*  /*
1911   * Reset the Uid set to default values   * Reset the Uid set to default values

Legend:
Removed from v.1.108  
changed lines
  Added in v.1.109

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26