~ubuntu-branches/ubuntu/raring/vsftpd/raring

« back to all changes in this revision

Viewing changes to sysdeputil.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-07-20 05:55:34 UTC
  • mfrom: (2.2.12 sid)
  • Revision ID: james.westby@ubuntu.com-20090720055534-kerhcu3y5q115pf5
Tags: 2.2.0~pre4-2ubuntu1
* Merge from debian unstable, remaining changes:
  - Use LSB functions in the init script.
  - Use snakeoil SSL certificates and key.
  - Do not create rc.d stop symlinks
  - Add update-inetd dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
 
66
66
/* BEGIN config */
67
67
#if defined(__linux__)
 
68
  #include <errno.h>
 
69
  #include <syscall.h>
68
70
  #define VSF_SYSDEP_HAVE_LINUX_CLONE
69
71
  #include <sched.h>
70
72
  #ifndef CLONE_NEWPID
73
75
  #ifndef CLONE_NEWIPC
74
76
    #define CLONE_NEWIPC 0x08000000
75
77
  #endif
 
78
  #ifndef CLONE_NEWNET
 
79
    #define CLONE_NEWNET 0x40000000
 
80
  #endif
76
81
  #include <linux/unistd.h>
77
82
  #include <errno.h>
78
83
  #include <syscall.h>
306
311
static void vsf_auth_shutdown(void);
307
312
 
308
313
int
309
 
vsf_sysdep_check_auth(const struct mystr* p_user_str,
 
314
vsf_sysdep_check_auth(struct mystr* p_user_str,
310
315
                      const struct mystr* p_pass_str,
311
316
                      const struct mystr* p_remote_host)
312
317
{
313
318
  int retval;
 
319
  const char* pam_user_name = 0;
314
320
  struct pam_conv the_conv =
315
321
  {
316
322
    &pam_conv_func,
362
368
    s_pamh = 0;
363
369
    return 0;
364
370
  }
 
371
#ifdef PAM_USER
 
372
  retval = pam_get_item(s_pamh, PAM_USER, (const void**) &pam_user_name);
 
373
  if (retval != PAM_SUCCESS)
 
374
  {
 
375
    (void) pam_end(s_pamh, retval);
 
376
    s_pamh = 0;
 
377
    return 0;
 
378
  }
 
379
  str_alloc_text(p_user_str, pam_user_name);
 
380
#endif
365
381
  retval = pam_acct_mgmt(s_pamh, 0);
366
382
  if (retval != PAM_SUCCESS)
367
383
  {
1256
1272
}
1257
1273
 
1258
1274
int
 
1275
vsf_sysutil_fork_newnet()
 
1276
{
 
1277
#ifdef VSF_SYSDEP_HAVE_LINUX_CLONE
 
1278
  static int cloneflags_work = 1;
 
1279
  if (cloneflags_work)
 
1280
  {
 
1281
    int ret = syscall(__NR_clone, CLONE_NEWNET | SIGCHLD, NULL);
 
1282
    if (ret != -1 || errno != EINVAL)
 
1283
    {
 
1284
      vsf_sysutil_clear_pid_cache();
 
1285
      return ret;
 
1286
    }
 
1287
    cloneflags_work = 0;
 
1288
  }
 
1289
#endif
 
1290
  return vsf_sysutil_fork();
 
1291
}
 
1292
 
 
1293
int
1259
1294
vsf_sysutil_getpid_nocache(void)
1260
1295
{
1261
1296
#ifdef VSF_SYSDEP_HAVE_LINUX_CLONE