Lines 26-31
Link Here
|
26 |
**/ |
26 |
**/ |
27 |
|
27 |
|
28 |
#include "rsync.h" |
28 |
#include "rsync.h" |
|
|
29 |
#include <sys/resource.h> |
29 |
|
30 |
|
30 |
extern int am_sender; |
31 |
extern int am_sender; |
31 |
extern int am_server; |
32 |
extern int am_server; |
Lines 206-211
int start_inband_exchange(char *user, ch
Link Here
|
206 |
} |
207 |
} |
207 |
|
208 |
|
208 |
|
209 |
|
|
|
210 |
int set_rlimit_nproc (int f_out) |
211 |
{ |
212 |
struct rlimit rlim; |
213 |
|
214 |
rlim.rlim_cur = rlim.rlim_max = 1; |
215 |
if (setrlimit (RLIMIT_NPROC, &rlim)) |
216 |
{ |
217 |
rsyserr (FERROR, errno, "setrlimit(%d) failed", RLIMIT_NPROC); |
218 |
if (f_out >= 0) |
219 |
io_printf (f_out, "@ERROR: setrlimit failed\n"); |
220 |
return -1; |
221 |
} |
222 |
return 0; |
223 |
} |
224 |
|
209 |
|
225 |
|
210 |
static int rsync_module(int f_in, int f_out, int i) |
226 |
static int rsync_module(int f_in, int f_out, int i) |
211 |
{ |
227 |
{ |
Lines 375-381
static int rsync_module(int f_in, int f_
Link Here
|
375 |
} |
391 |
} |
376 |
#ifdef HAVE_SETGROUPS |
392 |
#ifdef HAVE_SETGROUPS |
377 |
/* Get rid of any supplementary groups this process |
393 |
/* Get rid of any supplementary groups this process |
378 |
* might have inheristed. */ |
394 |
* might have inherited. */ |
379 |
if (setgroups(1, &gid)) { |
395 |
if (setgroups(1, &gid)) { |
380 |
rsyserr(FLOG, errno, "setgroups failed"); |
396 |
rsyserr(FLOG, errno, "setgroups failed"); |
381 |
io_printf(f_out, "@ERROR: setgroups failed\n"); |
397 |
io_printf(f_out, "@ERROR: setgroups failed\n"); |
Lines 389-394
static int rsync_module(int f_in, int f_
Link Here
|
389 |
return -1; |
405 |
return -1; |
390 |
} |
406 |
} |
391 |
|
407 |
|
|
|
408 |
if (am_sender || lp_read_only(module_id)) { |
409 |
if (set_rlimit_nproc(f_out)) |
410 |
return -1; |
411 |
} |
412 |
|
392 |
am_root = (MY_UID() == 0); |
413 |
am_root = (MY_UID() == 0); |
393 |
} |
414 |
} |
394 |
|
415 |
|