Last change
on this file since 662 was 662, checked in by Bruno Cornec, 15 years ago |
- First configuration for schroot rpm creation
|
-
Property svn:executable
set to
*
|
File size:
2.0 KB
|
Rev | Line | |
---|
[662] | 1 | diff -ru schroot-1.1.5/sbuild/sbuild-lock.cc schroot-1.1.5.centos/sbuild/sbuild-lock.cc
|
---|
| 2 | --- schroot-1.1.5/sbuild/sbuild-lock.cc 2007-07-08 11:23:29.000000000 +0200
|
---|
| 3 | +++ schroot-1.1.5.centos/sbuild/sbuild-lock.cc 2007-09-11 10:33:36.000000000 +0200
|
---|
| 4 | @@ -251,7 +251,16 @@
|
---|
| 5 | if (locked)
|
---|
| 6 | {
|
---|
| 7 | pid_t status = 0;
|
---|
| 8 | + uid_t olduid;
|
---|
| 9 | + gid_t oldgid;
|
---|
| 10 | + olduid = getuid();
|
---|
| 11 | + oldgid = getgid();
|
---|
| 12 | + setuid(0);
|
---|
| 13 | + setgid(0);
|
---|
| 14 | status = dev_unlock(this->device.c_str(), getpid());
|
---|
| 15 | + setreuid(olduid,0);
|
---|
| 16 | + setregid(oldgid,0);
|
---|
| 17 | +
|
---|
| 18 | if (status < 0) // Failure
|
---|
| 19 | log_exception_warning(error(DEVICE_UNLOCK));
|
---|
| 20 | }
|
---|
| 21 | @@ -265,7 +274,13 @@
|
---|
| 22 | {
|
---|
| 23 | lock_timeout = false;
|
---|
| 24 |
|
---|
| 25 | + uid_t olduid;
|
---|
| 26 | + gid_t oldgid;
|
---|
| 27 | struct itimerval timeout_timer;
|
---|
| 28 | +
|
---|
| 29 | + olduid = getuid();
|
---|
| 30 | + oldgid = getgid();
|
---|
| 31 | +
|
---|
| 32 | timeout_timer.it_interval.tv_sec = timeout_timer.it_interval.tv_usec = 0;
|
---|
| 33 | timeout_timer.it_value.tv_sec = timeout;
|
---|
| 34 | timeout_timer.it_value.tv_usec = 0;
|
---|
| 35 | @@ -282,7 +297,11 @@
|
---|
| 36 | {
|
---|
| 37 | if (lock_type == LOCK_SHARED || lock_type == LOCK_EXCLUSIVE)
|
---|
| 38 | {
|
---|
| 39 | + setuid(0);
|
---|
| 40 | + setgid(0);
|
---|
| 41 | status = dev_lock(this->device.c_str());
|
---|
| 42 | + setreuid(olduid,0);
|
---|
| 43 | + setregid(oldgid,0);
|
---|
| 44 | if (status == 0) // Success
|
---|
| 45 | {
|
---|
| 46 | this->locked = true;
|
---|
| 47 | @@ -295,7 +314,13 @@
|
---|
| 48 | }
|
---|
| 49 | else
|
---|
| 50 | {
|
---|
| 51 | - pid_t cur_lock_pid = dev_testlock(this->device.c_str());
|
---|
| 52 | + pid_t cur_lock_pid;
|
---|
| 53 | + setuid(0);
|
---|
| 54 | + setgid(0);
|
---|
| 55 | + cur_lock_pid = dev_testlock(this->device.c_str());
|
---|
| 56 | + setreuid(olduid,0);
|
---|
| 57 | + setregid(oldgid,0);
|
---|
| 58 | +
|
---|
| 59 | if (cur_lock_pid < 0) // Test failure
|
---|
| 60 | {
|
---|
| 61 | throw error(DEVICE_TEST);
|
---|
| 62 | @@ -306,7 +331,11 @@
|
---|
| 63 | // "drop" our nonexistent lock.
|
---|
| 64 | break;
|
---|
| 65 | }
|
---|
| 66 | + setuid(0);
|
---|
| 67 | + setgid(0);
|
---|
| 68 | status = dev_unlock(this->device.c_str(), getpid());
|
---|
| 69 | + setreuid(olduid,0);
|
---|
| 70 | + setregid(oldgid,0);
|
---|
| 71 | if (status == 0) // Success
|
---|
| 72 | {
|
---|
| 73 | this->locked = false;
|
---|
| 74 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.