View | Details | Raw Unified | Return to bug 235657
Collapse All | Expand All

(-)atrun.c (-11 / +23 lines)
Lines 200-228 Link Here
200
200
201
    PRIV_END
201
    PRIV_END
202
202
203
    if (stream == NULL)
203
    if (stream == NULL) {
204
        unlink(filename);
204
	perr("cannot open input file %s", filename);
205
	perr("cannot open input file %s", filename);
206
    }
205
207
206
    if ((fd_in = dup(fileno(stream))) <0)
208
    if ((fd_in = dup(fileno(stream))) <0) {
209
        unlink(filename);
207
	perr("error duplicating input file descriptor");
210
	perr("error duplicating input file descriptor");
211
    }
208
212
209
    if (fstat(fd_in, &buf) == -1)
213
    if (fstat(fd_in, &buf) == -1) {
214
        unlink(filename);
210
	perr("error in fstat of input file descriptor");
215
	perr("error in fstat of input file descriptor");
216
    }
211
217
212
    if (lstat(filename, &lbuf) == -1)
218
    if (lstat(filename, &lbuf) == -1) {
219
        unlink(filename);
213
	perr("error in fstat of input file");
220
	perr("error in fstat of input file");
221
    }
214
222
215
    if (S_ISLNK(lbuf.st_mode))
223
    if (S_ISLNK(lbuf.st_mode)) {
224
        unlink(filename);
216
	perrx("Symbolic link encountered in job %s - aborting", filename);
225
	perrx("Symbolic link encountered in job %s - aborting", filename);
226
    }
217
 
227
 
218
    if ((lbuf.st_dev != buf.st_dev) || (lbuf.st_ino != buf.st_ino) ||
228
    if ((lbuf.st_dev != buf.st_dev) || (lbuf.st_ino != buf.st_ino) ||
219
        (lbuf.st_uid != buf.st_uid) || (lbuf.st_gid != buf.st_gid) ||
229
        (lbuf.st_uid != buf.st_uid) || (lbuf.st_gid != buf.st_gid) ||
220
        (lbuf.st_size!=buf.st_size))
230
        (lbuf.st_size!=buf.st_size)) {
231
        unlink(filename);
221
	perrx("Somebody changed files from under us for job %s - aborting",
232
	perrx("Somebody changed files from under us for job %s - aborting",
222
		filename);
233
		filename);
234
    }
223
 
235
 
224
    if (buf.st_nlink > 1)
236
    if (buf.st_nlink > 1) {
237
        unlink(filename);
225
	perrx("Somebody is trying to run a linked script for job %s", filename);
238
	perrx("Somebody is trying to run a linked script for job %s", filename);
239
    }
240
241
    unlink(filename);
226
 
242
 
227
    if ((fflags = fcntl(fd_in, F_GETFD)) <0)
243
    if ((fflags = fcntl(fd_in, F_GETFD)) <0)
228
	perr("error in fcntl");
244
	perr("error in fcntl");
Lines 561-570 Link Here
561
	    if (islower(queue))
577
	    if (islower(queue))
562
		run_file(dirent->d_name, buf.st_uid, buf.st_gid);
578
		run_file(dirent->d_name, buf.st_uid, buf.st_gid);
563
	}
579
	}
564
	/*  Delete older files
565
	 */
566
	if ((run_time < now) && !(S_IXUSR & buf.st_mode) && (S_IRUSR & buf.st_mode))
567
	    unlink(dirent->d_name);
568
    }
580
    }
569
    /* run the single batch file, if any
581
    /* run the single batch file, if any
570
    */
582
    */

Return to bug 235657