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