diff options
| author | Wayne Davison <wayned@samba.org> | 2017-10-09 17:13:00 -0700 |
|---|---|---|
| committer | Wayne Davison <wayned@samba.org> | 2017-10-09 17:13:00 -0700 |
| commit | 17b849c97aa24f30d572ac5ea552e8cb5a27e9fe (patch) | |
| tree | 3e7acbe20f582dd8e0b8cde90dd76a47cdfc5152 | |
| parent | 276a9836bd5232d081b18590e013aabaf587577b (diff) | |
| download | android_external_rsync-17b849c97aa24f30d572ac5ea552e8cb5a27e9fe.tar.gz android_external_rsync-17b849c97aa24f30d572ac5ea552e8cb5a27e9fe.tar.bz2 android_external_rsync-17b849c97aa24f30d572ac5ea552e8cb5a27e9fe.zip | |
Set our_uid & our_gid values when changed by the daemon.
Fixes bug 10719.
| -rw-r--r-- | clientserver.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clientserver.c b/clientserver.c index 7c79e90a..4b84b823 100644 --- a/clientserver.c +++ b/clientserver.c @@ -59,6 +59,8 @@ extern filter_rule_list daemon_filter_list; extern char *iconv_opt; extern iconv_t ic_send, ic_recv; #endif +extern uid_t our_uid; +extern gid_t our_gid; char *auth_user; int read_only = 0; @@ -834,6 +836,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char return -1; } #endif + our_gid = MY_GID(); } if (set_uid) { @@ -847,7 +850,8 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char return -1; } - am_root = (MY_UID() == 0); + our_uid = MY_UID(); + am_root = (our_uid == 0); } if (lp_temp_dir(i) && *lp_temp_dir(i)) { @@ -1070,6 +1074,7 @@ int start_daemon(int f_in, int f_out) rsyserr(FLOG, errno, "Unable to set group to daemon gid %ld", (long)gid); return -1; } + our_gid = MY_GID(); } p = lp_daemon_uid(); if (*p) { @@ -1082,6 +1087,8 @@ int start_daemon(int f_in, int f_out) rsyserr(FLOG, errno, "Unable to set user to daemon uid %ld", (long)uid); return -1; } + our_uid = MY_UID(); + am_root = (our_uid == 0); } addr = client_addr(f_in); |
