Changeset 248
- Timestamp:
- Sep 21, 2009, 8:23:56 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r247 r248 12 12 dnl start 13 13 dnl 14 AM_INIT_AUTOMAKE(samhain, 2.5.9 a)14 AM_INIT_AUTOMAKE(samhain, 2.5.9b) 15 15 AC_DEFINE([SAMHAIN], 1, [Application is samhain]) 16 16 AC_CANONICAL_HOST -
trunk/docs/Changelog
r247 r248 1 2.5.9b: 2 * remove stale file record when creating handle, and raise diagnostic 3 error to find origin of stale record 4 1 5 2.5.9a: 2 6 * fixed a race condition in closing of file handles -
trunk/include/slib.h
r243 r248 327 327 * ---------------------------------------------------------------- */ 328 328 329 SL_TICKET sl_make_ticket (int fd, const char * path); 330 329 #define SL_OFILE_SIZE 32 330 331 char * sl_check_stale(); 332 333 SL_TICKET sl_make_ticket (const char * ofile, int oline, 334 int fd, const char * filename); 335 331 336 /* Open for writing. 332 337 */ 333 SL_TICKET sl_open_write (const char * fname, int priviledge_mode); 338 SL_TICKET sl_open_write (const char * ofile, int oline, 339 const char * fname, int priviledge_mode); 334 340 335 341 /* Open for reading. 336 342 */ 337 SL_TICKET sl_open_read (const char * fname, int priviledge_mode); 343 SL_TICKET sl_open_read (const char * ofile, int oline, 344 const char * fname, int priviledge_mode); 338 345 339 346 /* Drop from cach when closing … … 343 350 /* Open for reading w/minimum checking. 344 351 */ 345 SL_TICKET sl_open_fastread (const char * fname, int priviledge_mode); 352 SL_TICKET sl_open_fastread (const char * ofile, int oline, 353 const char * fname, int priviledge_mode); 346 354 347 355 /* Open for read and write. 348 356 */ 349 SL_TICKET sl_open_rdwr (const char * fname, int priviledge_mode); 357 SL_TICKET sl_open_rdwr (const char * ofile, int oline, 358 const char * fname, int priviledge_mode); 350 359 351 360 /* Open for read and write, fail if file exists. 352 361 */ 353 SL_TICKET sl_open_safe_rdwr (const char * fname, int priv); 362 SL_TICKET sl_open_safe_rdwr (const char * ofile, int oline, 363 const char * fname, int priv); 354 364 355 365 /* Open for write, truncate. 356 366 */ 357 SL_TICKET sl_open_write_trunc (const char * fname, int priviledge_mode); 367 SL_TICKET sl_open_write_trunc (const char * ofile, int oline, 368 const char * fname, int priviledge_mode); 358 369 359 370 /* Open for read and write, truncate. 360 371 */ 361 SL_TICKET sl_open_rdwr_trunc (const char * fname, int priviledge_mode); 372 SL_TICKET sl_open_rdwr_trunc (const char * ofile, int oline, 373 const char * fname, int priviledge_mode); 362 374 363 375 /* Initialize the content sh_string. -
trunk/src/bignum.c
r1 r248 926 926 if (a->sign == BIG_SIGN_MINUS) 927 927 { 928 928 *n = -*n;; 929 929 } 930 930 return FALSE; -
trunk/src/cutest_sh_tiger0.c
r170 r248 159 159 CuAssertStrEquals(tc, expected, actual); 160 160 161 rval_open = sl_open_fastread ( "cutest_foo", SL_YESPRIV);161 rval_open = sl_open_fastread (__FILE__, __LINE__, "cutest_foo", SL_YESPRIV); 162 162 CuAssertTrue(tc, rval_open >= 0); 163 163 … … 173 173 CuAssertTrue(tc, result == 0); 174 174 175 rval_open = sl_open_fastread ( "cutest_foo", SL_YESPRIV);175 rval_open = sl_open_fastread (__FILE__, __LINE__, "cutest_foo", SL_YESPRIV); 176 176 CuAssertTrue(tc, rval_open >= 0); 177 177 … … 189 189 CuAssertTrue(tc, result == 0); 190 190 191 rval_open = sl_open_fastread ( "cutest_foo", SL_YESPRIV);191 rval_open = sl_open_fastread (__FILE__, __LINE__, "cutest_foo", SL_YESPRIV); 192 192 CuAssertTrue(tc, rval_open >= 0); 193 193 … … 354 354 CuAssertTrue(tc, result == 0); 355 355 356 rval_open = sl_open_fastread ( "cutest_foo", SL_YESPRIV);356 rval_open = sl_open_fastread (__FILE__, __LINE__, "cutest_foo", SL_YESPRIV); 357 357 CuAssertTrue(tc, rval_open >= 0); 358 358 -
trunk/src/cutest_slib.c
r169 r248 5 5 #include "CuTest.h" 6 6 #include "samhain.h" 7 8 void Test_sl_stale (CuTest *tc) { 9 10 extern int get_the_fd (SL_TICKET ticket); 11 12 int fd1, fd2, ret, line, val; 13 SL_TICKET tfd1, tfd2; 14 char * err1; 15 char err2[128]; 16 17 line = __LINE__; tfd1 = sl_open_read(__FILE__, __LINE__, "/etc/group", SL_NOPRIV); 18 CuAssertTrue(tc, tfd1 > 0); 19 20 fd1 = get_the_fd(tfd1); 21 CuAssertTrue(tc, fd1 >= 0); 22 23 ret = close(fd1); 24 CuAssertTrue(tc, ret == 0); 25 26 tfd2 = sl_open_read(__FILE__, __LINE__, "/etc/group", SL_NOPRIV); 27 CuAssertTrue(tc, tfd2 > 0); 28 CuAssertTrue(tc, tfd2 != tfd1); 29 30 fd2 = get_the_fd(tfd2); 31 CuAssertIntEquals(tc, fd1, fd2); 32 33 err1 = sl_check_stale(); 34 CuAssertTrue(tc, err1 != NULL); 35 36 sl_snprintf(err2, sizeof(err2), 37 "stale handle, %s, %d", __FILE__, line); 38 val = strcmp(err1, err2); 39 CuAssertIntEquals(tc, 0, val); 40 } 7 41 8 42 void Test_sl_snprintf (CuTest *tc) { -
trunk/src/samhain.c
r215 r248 2099 2099 #endif 2100 2100 2101 { 2102 char * stale = sl_check_stale(); 2103 2104 if (stale) 2105 { 2106 sh_error_handle(SH_ERR_ERR, FIL__, __LINE__, 0, MSG_E_SUBGEN, 2107 stale, _("sl_check_stale")); 2108 } 2109 } 2110 2101 2111 /* no loop if not daemon 2102 2112 */ -
trunk/src/sh_err_log.c
r212 r248 69 69 /* open the file, then check it 70 70 */ 71 if ( SL_ISERROR(fd = sl_open_read ( path, SL_NOPRIV)))71 if ( SL_ISERROR(fd = sl_open_read (FIL__, __LINE__, path, SL_NOPRIV))) 72 72 { 73 73 fprintf(stderr, _("Could not open file <%s>\n"), path); … … 163 163 } 164 164 165 if ( SL_ISERROR(fd = sl_open_read ( s, SL_NOPRIV)) )165 if ( SL_ISERROR(fd = sl_open_read (FIL__, __LINE__, s, SL_NOPRIV)) ) 166 166 { 167 167 fprintf(stderr, … … 540 540 if (status == 0) 541 541 { 542 fd = sl_open_write ( logfile, SL_YESPRIV);542 fd = sl_open_write (FIL__, __LINE__, logfile, SL_YESPRIV); 543 543 if (SL_ISERROR(fd)) 544 544 { … … 761 761 if (!sl_ok_adds(status, (2*KEY_LEN)) || !sl_ok_adds((2*KEY_LEN + status),32)) 762 762 { 763 sl_close(fd); 763 764 SL_RETURN ((-1), _("sh_log_file")); 764 765 } -
trunk/src/sh_extern.c
r247 r248 381 381 382 382 fd = 383 sl_open_read( task->command,383 sl_open_read(FIL__, __LINE__, task->command, 384 384 task->privileged==0 ? SL_NOPRIV : SL_YESPRIV); 385 385 … … 389 389 { 390 390 PDBGC_S("fexecve: checksum mismatch"); 391 sl_close(fd); 391 392 _exit(EXIT_FAILURE); 392 393 } … … 398 399 } while (val_return < 0 && errno == EINTR); 399 400 pfd = val_return; 401 402 sl_close(fd); 403 fd = -1; 404 400 405 if (pfd < 0) 401 406 { … … 403 408 _exit(EXIT_FAILURE); 404 409 } 405 sl_close(fd);406 fd = -1;407 410 } 408 411 #endif … … 538 541 PDBG_D(task->pipeFD); 539 542 540 task->pipeTI = sl_make_ticket( task->pipeFD, _("pipe"));543 task->pipeTI = sl_make_ticket(FIL__, __LINE__, task->pipeFD, _("pipe")); 541 544 542 545 flags = (int) retry_fcntl (FIL__, __LINE__, task->pipeFD, F_GETFL, 0); -
trunk/src/sh_forward.c
r225 r248 3133 3133 if (conn != NULL && conn->FileName != NULL) 3134 3134 { 3135 sfd = sl_open_read(conn->FileName, SL_YESPRIV); 3135 sfd = sl_open_read(FIL__, __LINE__, 3136 conn->FileName, SL_YESPRIV); 3136 3137 if (!SL_ISERROR(sfd)) 3137 3138 { … … 3229 3230 { 3230 3231 bytes = -1; 3231 sfd = sl_open_read(conn->FileName, SL_YESPRIV); 3232 sfd = sl_open_read(FIL__, __LINE__, 3233 conn->FileName, SL_YESPRIV); 3232 3234 if (!SL_ISERROR(sfd)) 3233 3235 { -
trunk/src/sh_gpg.c
r247 r248 270 270 char pname[128]; 271 271 int pfd; 272 int val_return; 272 273 #endif 273 274 #endif … … 534 535 */ 535 536 #if defined(WITH_PGP) 536 checkfd = sl_open_read( DEFAULT_PGP_PATH, SL_NOPRIV);537 #else 538 checkfd = sl_open_read( DEFAULT_GPG_PATH, SL_NOPRIV);537 checkfd = sl_open_read(FIL__, __LINE__, DEFAULT_PGP_PATH, SL_NOPRIV); 538 #else 539 checkfd = sl_open_read(FIL__, __LINE__, DEFAULT_GPG_PATH, SL_NOPRIV); 539 540 #endif 540 541 541 542 if (0 != sh_gpg_checksum(checkfd, 0)) 542 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 543 { 544 sl_close(checkfd); 545 aud__exit(FIL__, __LINE__, EXIT_FAILURE); 546 } 543 547 544 548 pfd = get_the_fd(checkfd); 549 do { 550 val_return = dup (pfd); 551 } while (val_return < 0 && errno == EINTR); 552 pfd = val_return; 553 sl_close(checkfd); 554 checkfd = -1; 555 545 556 sl_snprintf(pname, sizeof(pname), _("/proc/self/fd/%d"), pfd); 546 557 if (0 == access(pname, R_OK|X_OK)) /* flawfinder: ignore */ … … 559 570 /* procfs not working, go ahead 560 571 */ 561 sl_close(checkfd);562 checkfd = -1;563 572 #endif 564 573 … … 576 585 { 577 586 #if defined(WITH_PGP) 578 checkfd = sl_open_fastread( DEFAULT_PGP_PATH, SL_NOPRIV);579 #else 580 checkfd = sl_open_fastread( DEFAULT_GPG_PATH, SL_NOPRIV);587 checkfd = sl_open_fastread(FIL__, __LINE__, DEFAULT_PGP_PATH, SL_NOPRIV); 588 #else 589 checkfd = sl_open_fastread(FIL__, __LINE__, DEFAULT_GPG_PATH, SL_NOPRIV); 581 590 #endif 582 591 if (0 != sh_gpg_checksum(checkfd, 0)) { … … 685 694 686 695 #ifdef HAVE_GPG_CHECKSUM 687 checkfd = sl_open_read( DEFAULT_GPG_PATH, SL_YESPRIV);696 checkfd = sl_open_read(FIL__, __LINE__, DEFAULT_GPG_PATH, SL_YESPRIV); 688 697 689 698 if (0 != sh_gpg_checksum(checkfd, 1)) … … 716 725 717 726 #ifdef HAVE_GPG_CHECKSUM 718 checkfd = sl_open_read( DEFAULT_PGP_PATH, SL_YESPRIV);727 checkfd = sl_open_read(FIL__, __LINE__, DEFAULT_PGP_PATH, SL_YESPRIV); 719 728 720 729 if (0 != sh_gpg_checksum(checkfd, 1)) -
trunk/src/sh_hash.c
r247 r248 1191 1191 if (fd == (-1)) 1192 1192 { 1193 if ( SL_ISERROR(fd = sl_open_read(file_path('D', 'R'), SL_YESPRIV))) 1193 if ( SL_ISERROR(fd = sl_open_read(FIL__, __LINE__, 1194 file_path('D', 'R'), SL_YESPRIV))) 1194 1195 { 1195 1196 TPT(( 0, FIL__, __LINE__, _("msg=<Error opening: %s>\n"), … … 1548 1549 if (pushdata_stdout == S_FALSE && pushdata_fd == -1) 1549 1550 { 1550 if ( SL_ISERROR(pushdata_fd = sl_open_write(file_path('D', 'W'), SL_YESPRIV))) 1551 if ( SL_ISERROR(pushdata_fd = sl_open_write(FIL__, __LINE__, 1552 file_path('D', 'W'), 1553 SL_YESPRIV))) 1551 1554 { 1552 1555 SH_FREE(fullpath); … … 1572 1575 SH_FREE(linkpath); 1573 1576 sh_error_handle((-1), FIL__, __LINE__, status, MSG_E_SUBGPATH, 1574 _("Failed to seek to end of baseline database"), _("sh_hash_pushdata_int"), 1577 _("Failed to seek to end of baseline database"), 1578 _("sh_hash_pushdata_int"), 1575 1579 file_path('D', 'W')); 1576 1580 aud_exit(FIL__, __LINE__, EXIT_FAILURE); … … 1583 1587 { 1584 1588 TPT((0, FIL__, __LINE__, _("msg=<Update.>\n"))) 1585 if ( SL_ISERROR(pushdata_fd = sl_open_rdwr(file_path('D', 'W'), SL_YESPRIV))){ 1589 if ( SL_ISERROR(pushdata_fd = sl_open_rdwr(FIL__, __LINE__, 1590 file_path('D', 'W'), 1591 SL_YESPRIV))){ 1586 1592 SH_FREE(fullpath); 1587 1593 SH_FREE(linkpath); … … 4032 4038 line = SH_ALLOC(MAX_PATH_STORE+2); 4033 4039 4034 if ( SL_ISERROR(fd = sl_open_read( db_file, SL_YESPRIV)))4040 if ( SL_ISERROR(fd = sl_open_read(FIL__, __LINE__, db_file, SL_YESPRIV))) 4035 4041 { 4036 4042 fprintf(stderr, _("ERROR: can't open %s for read (errnum = %ld)\n"), -
trunk/src/sh_html.c
r170 r248 106 106 if (p) 107 107 { 108 fd = sl_open_read ( p, SL_YESPRIV);108 fd = sl_open_read (FIL__, __LINE__, p, SL_YESPRIV); 109 109 SH_FREE(p); 110 110 } … … 227 227 if (p) 228 228 { 229 fd = sl_open_read ( p, SL_YESPRIV);229 fd = sl_open_read (FIL__, __LINE__, p, SL_YESPRIV); 230 230 SH_FREE(p); 231 231 } … … 300 300 if (p) 301 301 { 302 fd = sl_open_read ( p, SL_YESPRIV);302 fd = sl_open_read (FIL__, __LINE__, p, SL_YESPRIV); 303 303 SH_FREE(p); 304 304 } … … 481 481 482 482 483 fd = sl_open_write_trunc ( DEFAULT_HTML_FILE, SL_YESPRIV);483 fd = sl_open_write_trunc (FIL__, __LINE__, DEFAULT_HTML_FILE, SL_YESPRIV); 484 484 485 485 if (SL_ISERROR(fd)) -
trunk/src/sh_mail.c
r240 r248 115 115 _exit (EXIT_FAILURE); 116 116 } 117 if ( SL_ISERROR(fd = sl_open_read ( s, SL_NOPRIV)))117 if ( SL_ISERROR(fd = sl_open_read (FIL__, __LINE__, s, SL_NOPRIV))) 118 118 { 119 119 fprintf(stderr, _("Could not open file %s\n"), s); -
trunk/src/sh_prelink.c
r192 r248 120 120 task->com_ti = -1; 121 121 } 122 ticket = sl_open_read( task->command,122 ticket = sl_open_read(FIL__, __LINE__, task->command, 123 123 task->privileged == 0 ? SL_NOPRIV : SL_YESPRIV); 124 124 if (SL_ISERROR(ticket)) -
trunk/src/sh_readconf.c
r219 r248 407 407 aud_exit (FIL__, __LINE__, EXIT_FAILURE); 408 408 } 409 if (SL_ISERROR(fd = sl_open_read(file_path('C',local_flag),SL_YESPRIV))) 409 if (SL_ISERROR(fd = sl_open_read(FIL__, __LINE__, 410 file_path('C',local_flag),SL_YESPRIV))) 410 411 { 411 412 sl_get_euid(&euid); … … 425 426 */ 426 427 sl_strlcpy(sh.conf.hash, 427 sh_tiger_hash(file_path('C',local_flag), fd, TIGER_NOLIM, hashbuf, sizeof(hashbuf)), 428 sh_tiger_hash(file_path('C',local_flag), fd, TIGER_NOLIM, 429 hashbuf, sizeof(hashbuf)), 428 430 KEY_LEN+1); 429 431 sl_rewind (fd); -
trunk/src/sh_tiger0.c
r192 r248 169 169 TPT((0,FIL__, __LINE__, _("msg=<TIGER_FILE>, path=<%s>\n"), 170 170 (filename == NULL ? _("(null)") : filename) )); 171 fd = sl_open_read ( filename, SL_YESPRIV);171 fd = sl_open_read (FIL__, __LINE__, filename, SL_YESPRIV); 172 172 } 173 173 -
trunk/src/sh_tools.c
r197 r248 1737 1737 } while (status == BAD); 1738 1738 1739 fd = sl_open_safe_rdwr ( file, SL_YESPRIV);1739 fd = sl_open_safe_rdwr (FIL__, __LINE__, file, SL_YESPRIV); 1740 1740 if (SL_ISERROR(fd)) 1741 1741 { -
trunk/src/sh_unix.c
r247 r248 3472 3472 if (stat_return == 0 && S_ISREG(buf.st_mode)) 3473 3473 { 3474 rval_open = sl_open_fastread (path /* theFile->fullpath */, SL_YESPRIV); 3474 rval_open = sl_open_fastread (FIL__, __LINE__, 3475 path /* theFile->fullpath */, SL_YESPRIV); 3475 3476 if (SL_ISERROR(rval_open)) 3476 3477 err_open = errno; … … 4109 4110 } 4110 4111 4111 fd = sl_open_safe_rdwr (lockfile, SL_YESPRIV); /* fails if file exists */ 4112 fd = sl_open_safe_rdwr (FIL__, __LINE__, 4113 lockfile, SL_YESPRIV); /* fails if file exists */ 4112 4114 4113 4115 if (!SL_ISERROR(fd)) … … 4198 4200 if (status >= 0) 4199 4201 { 4200 fd = sl_open_read ( lockfile, SL_YESPRIV);4202 fd = sl_open_read (FIL__, __LINE__, lockfile, SL_YESPRIV); 4201 4203 if (SL_ISERROR(fd)) 4202 4204 sh_error_handle ((-1), FIL__, __LINE__, fd, -
trunk/src/sh_utils.c
r226 r248 1170 1170 sl_snprintf (outpath, len, _("%s.out"), path); 1171 1171 1172 fp = sl_open_read( path, SL_NOPRIV);1172 fp = sl_open_read(FIL__, __LINE__, path, SL_NOPRIV); 1173 1173 if (SL_ISERROR(fp)) 1174 1174 { … … 1181 1181 } 1182 1182 1183 fout = sl_open_write( outpath, SL_NOPRIV);1183 fout = sl_open_write(FIL__, __LINE__, outpath, SL_NOPRIV); 1184 1184 if (SL_ISERROR(fout)) 1185 1185 { -
trunk/src/slib.c
r247 r248 1557 1557 1558 1558 typedef struct openfiles { 1559 SL_TICKET ticket; /* The unique ID. */ 1560 int fd; /* The file descriptor. */ 1561 char * path; /* The file path. */ 1562 int flush; /* Whether we want to flush the cache */ 1563 sh_string * content; /* The file content */ 1559 SL_TICKET ticket; /* The unique ID. */ 1560 int fd; /* The file descriptor. */ 1561 char * path; /* The file path. */ 1562 int flush; /* Whether we want to flush the cache */ 1563 char ofile[SL_OFILE_SIZE]; /* origin file */ 1564 int oline; /* origin line */ 1565 sh_string * content; /* The file content */ 1564 1566 } SL_OFILE; 1565 1567 1566 1568 static SL_OFILE * ofiles[MAXFD]; 1567 1569 1570 static char stale_orig_file[64] = { '\0' }; 1571 static int stale_orig_line = -1; 1572 static char stale_orig_mesg[128]; 1573 1568 1574 SH_MUTEX_STATIC(mutex_ticket, PTHREAD_MUTEX_INITIALIZER); 1569 1575 1570 1576 static unsigned int nonce_counter = TOFFSET; 1577 1578 char * sl_check_stale() 1579 { 1580 if (stale_orig_line == -1) 1581 return NULL; 1582 sl_snprintf(stale_orig_mesg, sizeof(stale_orig_mesg), 1583 _("stale handle, %s, %d"), stale_orig_file, stale_orig_line); 1584 stale_orig_file[0] = '\0'; 1585 stale_orig_line = -1; 1586 return stale_orig_mesg; 1587 } 1571 1588 1572 1589 static … … 1648 1665 } 1649 1666 1650 SL_TICKET sl_make_ticket (int fd, const char * filename) 1667 SL_TICKET sl_make_ticket (const char * ofile, int oline, 1668 int fd, const char * filename) 1651 1669 { 1652 1670 size_t len; … … 1660 1678 } 1661 1679 1662 if (ofiles[fd] != NULL) 1663 { 1664 SL_IRETURN(SL_EINTERNAL06, _("sl_make_ticket")); 1680 if (ofiles[fd] != NULL) /* stale entry */ 1681 { 1682 /* SL_IRETURN(SL_EINTERNAL06, _("sl_make_ticket")); */ 1683 sl_strlcpy(stale_orig_file, ofiles[fd]->ofile, sizeof(stale_orig_file)); 1684 stale_orig_line = ofiles[fd]->oline; 1685 1686 if (ofiles[fd]->content) 1687 sh_string_destroy(&(ofiles[fd]->content)); 1688 (void) free (ofiles[fd]->path); 1689 (void) free (ofiles[fd]); 1690 ofiles[fd] = NULL; 1665 1691 } 1666 1692 … … 1696 1722 ofiles[fd]->content = NULL; 1697 1723 ofiles[fd]->flush = SL_FALSE; 1724 1725 sl_strlcpy(ofiles[fd]->ofile, ofile, SL_OFILE_SIZE); 1726 ofiles[fd]->oline = oline; 1698 1727 1699 1728 SL_IRETURN(ticket, _("sl_make_ticket")); … … 1726 1755 1727 1756 static 1728 int sl_open_file (const char *filename, int mode, int priv) 1757 int sl_open_file (const char * ofile, int oline, 1758 const char *filename, int mode, int priv) 1729 1759 { 1730 1760 struct stat lbuf; … … 1920 1950 } 1921 1951 1922 if (ofiles[fd] != NULL) 1923 { 1952 if (ofiles[fd] != NULL) /* stale entry */ 1953 { 1954 /* 1924 1955 close(fd); 1925 1956 SL_IRETURN(SL_EINTERNAL09, _("sl_open_file")); 1957 */ 1958 sl_strlcpy(stale_orig_file, ofiles[fd]->ofile, sizeof(stale_orig_file)); 1959 stale_orig_line = ofiles[fd]->oline; 1960 1961 if (ofiles[fd]->content) 1962 sh_string_destroy(&(ofiles[fd]->content)); 1963 (void) free (ofiles[fd]->path); 1964 (void) free (ofiles[fd]); 1965 ofiles[fd] = NULL; 1926 1966 } 1927 1967 … … 1961 2001 ofiles[fd]->flush = SL_FALSE; 1962 2002 2003 sl_strlcpy(ofiles[fd]->ofile, ofile, SL_OFILE_SIZE); 2004 ofiles[fd]->oline = oline; 2005 1963 2006 SL_IRETURN(ticket, _("sl_open_file")); 1964 2007 } … … 1971 2014 return (fd); 1972 2015 1973 if (ofiles[fd] == NULL || fd != ofiles[fd]->fd || fd < 0) 2016 if (ofiles[fd] == NULL || fd != ofiles[fd]->fd || 2017 ticket != ofiles[fd]->ticket || fd < 0) 1974 2018 return (SL_EINTERNAL10); 2019 1975 2020 return (fd); 1976 2021 } … … 1987 2032 } 1988 2033 1989 SL_TICKET sl_open_write (const char * fname, int priv) 2034 SL_TICKET sl_open_write (const char * ofile, int oline, 2035 const char * fname, int priv) 1990 2036 { 1991 2037 long status; … … 1995 2041 SL_IRETURN(status, _("sl_open_write")); 1996 2042 1997 status = sl_open_file( fname, SL_OPEN_FOR_WRITE, priv);2043 status = sl_open_file(ofile, oline, fname, SL_OPEN_FOR_WRITE, priv); 1998 2044 SL_IRETURN(status, _("sl_open_write")); 1999 2045 } 2000 2046 2001 SL_TICKET sl_open_read (const char * fname, int priv) 2047 SL_TICKET sl_open_read (const char * ofile, int oline, 2048 const char * fname, int priv) 2002 2049 { 2003 2050 long status; … … 2012 2059 } 2013 2060 2014 status = sl_open_file( fname, SL_OPEN_FOR_READ, priv);2061 status = sl_open_file(ofile, oline, fname, SL_OPEN_FOR_READ, priv); 2015 2062 SL_IRETURN(status, _("sl_open_read")); 2016 2063 } … … 2067 2114 } 2068 2115 2069 SL_TICKET sl_open_fastread (const char * fname, int priv) 2116 SL_TICKET sl_open_fastread (const char * ofile, int oline, 2117 const char * fname, int priv) 2070 2118 { 2071 2119 long status; … … 2075 2123 SL_IRETURN(status, _("sl_open_read")); 2076 2124 2077 status = sl_open_file( fname, SL_OPEN_FOR_FASTREAD, priv);2125 status = sl_open_file(ofile, oline, fname, SL_OPEN_FOR_FASTREAD, priv); 2078 2126 2079 2127 #if defined(HAVE_POSIX_FADVISE) && defined(HAVE_MINCORE) && defined(POSIX_FADV_DONTNEED) … … 2094 2142 } 2095 2143 2096 SL_TICKET sl_open_rdwr (const char * fname, int priv) 2144 SL_TICKET sl_open_rdwr (const char * ofile, int oline, 2145 const char * fname, int priv) 2097 2146 { 2098 2147 long status; … … 2102 2151 SL_IRETURN(status, _("sl_open_rdwr")); 2103 2152 2104 status = sl_open_file( fname, SL_OPEN_FOR_RDWR, priv);2153 status = sl_open_file(ofile, oline, fname, SL_OPEN_FOR_RDWR, priv); 2105 2154 SL_IRETURN(status, _("sl_open_rdwr")); 2106 2155 } 2107 2156 2108 SL_TICKET sl_open_safe_rdwr (const char * fname, int priv) 2157 SL_TICKET sl_open_safe_rdwr (const char * ofile, int oline, 2158 const char * fname, int priv) 2109 2159 { 2110 2160 long status; … … 2114 2164 SL_IRETURN(status, _("sl_open_safe_rdwr")); 2115 2165 2116 status = sl_open_file( fname, SL_OPEN_SAFE_RDWR, priv);2166 status = sl_open_file(ofile, oline, fname, SL_OPEN_SAFE_RDWR, priv); 2117 2167 SL_IRETURN(status, _("sl_open_safe_rdwr")); 2118 2168 } 2119 2169 2120 SL_TICKET sl_open_write_trunc (const char * fname, int priv) 2170 SL_TICKET sl_open_write_trunc (const char * ofile, int oline, 2171 const char * fname, int priv) 2121 2172 { 2122 2173 long status; … … 2126 2177 SL_IRETURN(status, _("sl_open_write_trunc")); 2127 2178 2128 status = sl_open_file( fname, SL_OPEN_FOR_WTRUNC, priv);2179 status = sl_open_file(ofile, oline, fname, SL_OPEN_FOR_WTRUNC, priv); 2129 2180 SL_IRETURN(status, _("sl_open_write_trunc")); 2130 2181 } 2131 2182 2132 SL_TICKET sl_open_rdwr_trunc (const char * fname, int priv) 2183 SL_TICKET sl_open_rdwr_trunc (const char * ofile, int oline, 2184 const char * fname, int priv) 2133 2185 { 2134 2186 long status; … … 2138 2190 SL_IRETURN(status, _("sl_open_rdwr_trunc")); 2139 2191 2140 status = sl_open_file( fname, SL_OPEN_FOR_RWTRUNC, priv);2192 status = sl_open_file(ofile, oline, fname, SL_OPEN_FOR_RWTRUNC, priv); 2141 2193 SL_IRETURN(status, _("sl_open_rdwr_trunc")); 2142 2194 } … … 2150 2202 return (fd); 2151 2203 2152 if (ofiles[fd] == NULL || fd != ofiles[fd]->fd || fd < 0) 2204 if (ofiles[fd] == NULL || fd != ofiles[fd]->fd || 2205 ticket != ofiles[fd]->ticket || fd < 0) 2153 2206 return (SL_EINTERNAL12); 2154 2207 … … 2167 2220 return (NULL); 2168 2221 2169 if (ofiles[fd] == NULL || fd != ofiles[fd]->fd || fd < 0) 2222 if (ofiles[fd] == NULL || fd != ofiles[fd]->fd || 2223 ticket != ofiles[fd]->ticket || fd < 0) 2170 2224 return (NULL); 2171 2225
Note:
See TracChangeset
for help on using the changeset viewer.