123 |
int action; |
int action; |
124 |
}; |
}; |
125 |
|
|
126 |
|
struct ChecksumSet { |
127 |
|
char *md5; |
128 |
|
int action; |
129 |
|
}; |
130 |
|
|
131 |
struct PermSet { |
struct PermSet { |
132 |
int perm; |
int perm; |
133 |
int action; |
int action; |
176 |
ACTION_ALERT}; |
ACTION_ALERT}; |
177 |
static struct TimestampSet timestampset= {OPERATOR_EQUAL, 0, 0, ACTION_ALERT}; |
static struct TimestampSet timestampset= {OPERATOR_EQUAL, 0, 0, ACTION_ALERT}; |
178 |
static struct SizeSet sizeset= {OPERATOR_EQUAL, 0, 0, ACTION_ALERT}; |
static struct SizeSet sizeset= {OPERATOR_EQUAL, 0, 0, ACTION_ALERT}; |
179 |
|
static struct ChecksumSet checksumset= {NULL, ACTION_ALERT}; |
180 |
static struct PermSet permset= {0, ACTION_ALERT}; |
static struct PermSet permset= {0, ACTION_ALERT}; |
181 |
static struct UidSet uidset= {0, ACTION_ALERT}; |
static struct UidSet uidset= {0, ACTION_ALERT}; |
182 |
static struct GidSet gidset= {0, ACTION_ALERT}; |
static struct GidSet gidset= {0, ACTION_ALERT}; |
189 |
static void addmail(char *, Mail_T, unsigned int); |
static void addmail(char *, Mail_T, unsigned int); |
190 |
static void createservice(int, char *, char *); |
static void createservice(int, char *, char *); |
191 |
static void adddependant(char *); |
static void adddependant(char *); |
|
static void addchecksum(char *); |
|
192 |
static void addport(struct PortSet *); |
static void addport(struct PortSet *); |
193 |
static void addresource(struct ResourceSet *); |
static void addresource(struct ResourceSet *); |
194 |
static void addtimestamp(struct TimestampSet *); |
static void addtimestamp(struct TimestampSet *); |
199 |
static void addargument(char *); |
static void addargument(char *); |
200 |
static uid_t get_uid(char *, uid_t); |
static uid_t get_uid(char *, uid_t); |
201 |
static gid_t get_gid(char *, gid_t); |
static gid_t get_gid(char *, gid_t); |
202 |
|
static void addchecksum(struct ChecksumSet *); |
203 |
static void addperm(struct PermSet *); |
static void addperm(struct PermSet *); |
204 |
static void adduid(struct UidSet *); |
static void adduid(struct UidSet *); |
205 |
static void addgid(struct GidSet *); |
static void addgid(struct GidSet *); |
216 |
static void reset_resourceset(); |
static void reset_resourceset(); |
217 |
static void reset_timestampset(); |
static void reset_timestampset(); |
218 |
static void reset_sizeset(); |
static void reset_sizeset(); |
219 |
|
static void reset_checksumset(); |
220 |
static void reset_permset(); |
static void reset_permset(); |
221 |
static void reset_uidset(); |
static void reset_uidset(); |
222 |
static void reset_gidset(); |
static void reset_gidset(); |
836 |
| EXEC argumentlist useroptionlist { $<number>$= ACTION_EXEC; } |
| EXEC argumentlist useroptionlist { $<number>$= ACTION_EXEC; } |
837 |
; |
; |
838 |
|
|
839 |
checksum : CHECKSUM { addchecksum(NULL); } |
checksum : IF FAILED CHECKSUM THEN action { |
840 |
| CHECKSUM EXPECT STRING { addchecksum($3); } |
checksumset.action= $<number>5; |
841 |
|
addchecksum(&checksumset); |
842 |
|
} |
843 |
|
| IF FAILED CHECKSUM EXPECT STRING THEN action { |
844 |
|
checksumset.md5= $5; |
845 |
|
checksumset.action= $<number>7; |
846 |
|
addchecksum(&checksumset); |
847 |
|
} |
848 |
; |
; |
849 |
|
|
850 |
inode : IF INODE operator NUMBER THEN action { |
inode : IF INODE operator NUMBER THEN action { |
1137 |
|
|
1138 |
|
|
1139 |
/* |
/* |
|
* Add a filename and its associated md5 checksum |
|
|
* to the current service |
|
|
*/ |
|
|
static void addchecksum(char *sum) { |
|
|
|
|
|
if(sum) { |
|
|
|
|
|
current->md5= sum; |
|
|
|
|
|
} else if( !(current->md5= get_md5sum(current->path)) ) { |
|
|
|
|
|
log("%s: Cannot compute a checksum for %s at line %d\n", |
|
|
prog, current->path, lineno-1); |
|
|
cfg_errflag++; |
|
|
|
|
|
} |
|
|
|
|
|
if(current->md5 != NULL) |
|
|
cleanup_md5_string(current->md5); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/* |
|
1140 |
* Add the given mailaddress with the apropriate alert notification |
* Add the given mailaddress with the apropriate alert notification |
1141 |
* values and mail attributes to the current service's mailinglist. |
* values and mail attributes to the current service's mailinglist. |
1142 |
*/ |
*/ |
1349 |
|
|
1350 |
|
|
1351 |
/* |
/* |
1352 |
|
* Set Checksum object in the current service |
1353 |
|
*/ |
1354 |
|
static void addchecksum(struct ChecksumSet *cs) { |
1355 |
|
|
1356 |
|
Checksum_T c; |
1357 |
|
|
1358 |
|
ASSERT(cs); |
1359 |
|
|
1360 |
|
if(!cs->md5) |
1361 |
|
if( !(cs->md5= get_md5sum(current->path)) ) |
1362 |
|
yyerror("Cannot compute a checksum."); |
1363 |
|
|
1364 |
|
cleanup_md5_string(cs->md5); |
1365 |
|
|
1366 |
|
NEW(c); |
1367 |
|
c->md5= cs->md5; |
1368 |
|
c->action= cs->action; |
1369 |
|
|
1370 |
|
if((c->action == ACTION_EXEC) && command) { |
1371 |
|
c->exec= command; |
1372 |
|
command= NULL; |
1373 |
|
} |
1374 |
|
|
1375 |
|
current->checksum= c; |
1376 |
|
|
1377 |
|
reset_checksumset(); |
1378 |
|
|
1379 |
|
} |
1380 |
|
|
1381 |
|
|
1382 |
|
/* |
1383 |
* Set Perm object in the current service |
* Set Perm object in the current service |
1384 |
*/ |
*/ |
1385 |
static void addperm(struct PermSet *ps) { |
static void addperm(struct PermSet *ps) { |
1916 |
|
|
1917 |
} |
} |
1918 |
|
|
1919 |
|
|
1920 |
|
/* |
1921 |
|
* Reset the Checksum set to default values |
1922 |
|
*/ |
1923 |
|
static void reset_checksumset() { |
1924 |
|
|
1925 |
|
checksumset.md5= NULL; |
1926 |
|
checksumset.action= ACTION_ALERT; |
1927 |
|
|
1928 |
|
} |
1929 |
|
|
1930 |
|
|
1931 |
/* |
/* |
1932 |
* Reset the Perm set to default values |
* Reset the Perm set to default values |