| 1 | /* $Cambridge: exim/src/src/routers/rf_set_ugid.c,v 1.4 2007/01/08 10:50:20 ph10 Exp $ */ |
| 2 | |
| 3 | /************************************************* |
| 4 | * Exim - an Internet mail transport agent * |
| 5 | *************************************************/ |
| 6 | |
| 7 | /* Copyright (c) University of Cambridge 1995 - 2007 */ |
| 8 | /* See the file NOTICE for conditions of use and distribution. */ |
| 9 | |
| 10 | #include "../exim.h" |
| 11 | #include "rf_functions.h" |
| 12 | |
| 13 | |
| 14 | /************************************************* |
| 15 | * Set uid/gid from block into address * |
| 16 | *************************************************/ |
| 17 | |
| 18 | /* This function copies any set uid or gid from a ugid block into an |
| 19 | address. |
| 20 | |
| 21 | Arguments: |
| 22 | addr the address |
| 23 | ugid the ugid block |
| 24 | |
| 25 | Returns: nothing |
| 26 | */ |
| 27 | |
| 28 | void |
| 29 | rf_set_ugid(address_item *addr, ugid_block *ugid) |
| 30 | { |
| 31 | if (ugid->uid_set) |
| 32 | { |
| 33 | addr->uid = ugid->uid; |
| 34 | setflag(addr, af_uid_set); |
| 35 | } |
| 36 | |
| 37 | if (ugid->gid_set) |
| 38 | { |
| 39 | addr->gid = ugid->gid; |
| 40 | setflag(addr, af_gid_set); |
| 41 | } |
| 42 | |
| 43 | if (ugid->initgroups) setflag(addr, af_initgroups); |
| 44 | } |
| 45 | |
| 46 | /* End of rf_set_ugid.c */ |