|
Lines 585-600
Link Here
|
| 585 |
|
585 |
|
| 586 |
lock_file_name(pp, lf, sizeof lf); |
586 |
lock_file_name(pp, lf, sizeof lf); |
| 587 |
printf("%s:\n", pp->printer); |
587 |
printf("%s:\n", pp->printer); |
| 588 |
|
588 |
|
| 589 |
/* |
589 |
/* |
| 590 |
* Turn off the owner execute bit of the lock file to enable printing. |
590 |
* For enable==1 ('start'), turn off the LFM_PRINT_DIS bit of the lock |
|
|
591 |
* file to re-enable printing. For enable==2 ('up'), also turn off |
| 592 |
* the LFM_QUEUE_DIS bit to re-enable queueing. |
| 591 |
*/ |
593 |
*/ |
| 592 |
seteuid(euid); |
594 |
seteuid(euid); |
| 593 |
if (enable && stat(lf, &stbuf) >= 0) { |
595 |
if (enable && stat(lf, &stbuf) >= 0) { |
| 594 |
mode_t bits = (enable == 2 ? 0 |
596 |
mode_t bits = (enable == 2 ? 0 : LFM_QUEUE_DIS); |
| 595 |
: (LFM_PRINT_DIS | LFM_QUEUE_DIS)); |
|
|
| 596 |
if (chmod(lf, stbuf.st_mode & (LOCK_FILE_MODE | bits)) < 0) |
597 |
if (chmod(lf, stbuf.st_mode & (LOCK_FILE_MODE | bits)) < 0) |
| 597 |
printf("\tcannot enable printing\n"); |
598 |
printf("\tcannot enable printing\n"); |
| 598 |
else |
599 |
else |
| 599 |
printf("\tprinting enabled\n"); |
600 |
printf("\tprinting enabled\n"); |
| 600 |
} |
601 |
} |