Changeset 227 for trunk/src/slib.c
- Timestamp:
- Apr 20, 2009, 5:59:31 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/slib.c
r214 r227 1473 1473 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 1474 1474 struct passwd pwd; 1475 char buffer[SH_PWBUF_SIZE];1475 char * buffer; 1476 1476 struct passwd * tempres; 1477 sh_getpwnam_r(user, &pwd, buffer, sizeof(buffer), &tempres); 1477 buffer = malloc(SH_PWBUF_SIZE); 1478 SL_REQUIRE (buffer != NULL, _("buffer != NULL")); 1479 sh_getpwnam_r(user, &pwd, buffer, SH_PWBUF_SIZE, &tempres); 1478 1480 #else 1479 1481 struct passwd * tempres = sh_getpwnam(user); … … 1484 1486 rgid_orig = tempres->pw_gid; 1485 1487 ruid_orig = tempres->pw_uid; 1488 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 1489 free(buffer); 1490 #endif 1486 1491 } 1487 1492 else … … 1516 1521 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 1517 1522 struct passwd pwd; 1518 char buffer[SH_PWBUF_SIZE];1523 char * buffer; 1519 1524 struct passwd * tempres; 1520 sh_getpwnam_r(user, &pwd, buffer, sizeof(buffer), &tempres); 1525 buffer = malloc(SH_PWBUF_SIZE); 1526 SL_REQUIRE (buffer != NULL, _("buffer != NULL")); 1527 sh_getpwnam_r(user, &pwd, buffer, SH_PWBUF_SIZE, &tempres); 1521 1528 #else 1522 1529 struct passwd * tempres = sh_getpwnam(user); … … 1527 1534 SL_REQUIRE (sl_drop_privileges() == SL_ENONE, 1528 1535 _("sl_drop_privileges() == SL_ENONE")); 1536 #if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) 1537 free(buffer); 1538 #endif 1529 1539 } 1530 1540 SL_IRETURN(SL_ENONE, _("sl_policy_get_user"));
Note:
See TracChangeset
for help on using the changeset viewer.