[Git][debian-proftpd-team/proftpd][master] 3 commits: Add more patches from upstream.

Hilmar Preuße (@hilmar-guest) gitlab at salsa.debian.org
Mon Mar 6 20:15:41 GMT 2023



Hilmar Preuße pushed to branch master at Debian ProFTPD Team / proftpd


Commits:
e6b098df by Hilmar Preusse at 2023-03-06T21:12:45+01:00
Add more patches from upstream.

- - - - -
eb1b01bf by Hilmar Preusse at 2023-03-06T21:13:13+01:00
Add more patches from upstream #2.

- - - - -
8f87d98d by Hilmar Preusse at 2023-03-06T21:15:04+01:00
Finalize for upload.

- - - - -


6 changed files:

- debian/changelog
- debian/patches/series
- + debian/patches/upstream_bug_1568.diff
- + debian/patches/upstream_bug_1581.diff
- + debian/patches/upstream_bug_1584.diff
- + debian/patches/upstream_bug_1597.diff


Changes:

=====================================
debian/changelog
=====================================
@@ -1,13 +1,22 @@
-proftpd-dfsg (1.3.8+dfsg-3) UNRELEASED; urgency=medium
+proftpd-dfsg (1.3.8+dfsg-3) unstable; urgency=medium
 
   [ Jörn-Thorben Hinz ]
   * Drop dependency on the obsolete and empty lsb-base
   * Correctly use Rules-Requires-Root
 
-  * Patch from upstream to fix loading of rewrite module:
-    upstream_1592.diff. (Closes: #1032424)
-
- -- Hilmar Preusse <hille42 at web.de>  Thu, 16 Feb 2023 08:03:26 +0100
+  * Remove obsolete patches.
+  * Copy new patches from upstream:
+    - fix loading of rewrite module: upstream_1592.diff (Closes: #1032424).
+    - upstream_bug_1568.diff: Build-time detection of Linux POSIX ACL support
+      broken
+    - upstream_bug_1581.diff: mod_sftp fails to handle SFTP requests to
+      truncate files to zero size
+    - upstream_bug_1584.diff: mod_sftp improperly handles SFTP WRITE requests
+      for files opened for appending
+    - upstream_bug_1597.diff: <Class> section is allowed to be in <Global>,
+      but From directive is not
+
+ -- Hilmar Preusse <hille42 at web.de>  Mon, 06 Mar 2023 21:13:28 +0100
 
 proftpd-dfsg (1.3.8+dfsg-2) unstable; urgency=low
 


=====================================
debian/patches/series
=====================================
@@ -9,4 +9,8 @@ odbc
 #reproducible_build
 #wrong-path-for-interpreter_perl.diff
 #proftpd-mysql-password-backend.diff
+upstream_bug_1568.diff
+upstream_bug_1581.diff
+upstream_bug_1584.diff
 upstream_1592.diff
+upstream_bug_1597.diff


=====================================
debian/patches/upstream_bug_1568.diff
=====================================
@@ -0,0 +1,52 @@
+From aeff0fa791d479c30e38ba51fb0c05f41aff2cb7 Mon Sep 17 00:00:00 2001
+From: TJ Saunders <tj at castaglia.org>
+Date: Mon, 30 Jan 2023 18:14:38 -0800
+Subject: [PATCH] Backporting the fix for Issue #1568 to the 1.3.8 branch..
+
+---
+ NEWS         | 2 ++
+ configure    | 4 ++--
+ configure.in | 6 +++---
+ 3 files changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/NEWS b/NEWS
+index 8ff1358e2..679cf6ca7 100644
+diff --git a/configure b/configure
+index 18179359c..8db039b50 100755
+--- a/configure
++++ b/configure
+@@ -22280,8 +22280,8 @@ rm -f core conftest.err conftest.$ac_objext \
+     if test "$pr_cv_func_facl" = "none"; then
+     old_ldflags=$LDFLAGS
+     old_libs=$LIBS
+-    new_ldflags=`echo "$LDFLAGS" | sed -e 's/-L\$(top_srcdir)\/lib//g'`
+-    LDFLAGS="$new_ldflags"
++    new_ldflags=`echo "$LDFLAGS" | sed -e 's/-Wl\.*\/lib //g'`
++    LDFLAGS="-L\$(top_builddir)/lib $new_ldflags"
+     LIBS="-lacl $LIBS"
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+diff --git a/configure.in b/configure.in
+index b0aa09385..cd753c1f2 100644
+--- a/configure.in
++++ b/configure.in
+@@ -1,7 +1,7 @@
+ dnl ProFTPD - FTP server daemon
+ dnl Copyright (c) 1997, 1998 Public Flood Software
+ dnl Copyright (c) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver at tos.net>
+-dnl Copyright (c) 2001-2022 The ProFTPD Project team
++dnl Copyright (c) 2001-2023 The ProFTPD Project team
+ dnl
+ dnl This program is free software; you can redistribute it and/or modify
+ dnl it under the terms of the GNU General Public License as published by
+@@ -2371,8 +2371,8 @@ AC_CACHE_CHECK(
+   if test "$pr_cv_func_facl" = "none"; then
+     old_ldflags=$LDFLAGS
+     old_libs=$LIBS
+-    new_ldflags=`echo "$LDFLAGS" | sed -e 's/-L\$(top_srcdir)\/lib//g'`
+-    LDFLAGS="$new_ldflags"
++    new_ldflags=`echo "$LDFLAGS" | sed -e 's/-Wl\.*\/lib //g'`
++    LDFLAGS="-L\$(top_builddir)/lib $new_ldflags"
+     LIBS="-lacl $LIBS"
+     AC_TRY_LINK(
+       [ #include <sys/types.h>


=====================================
debian/patches/upstream_bug_1581.diff
=====================================
@@ -0,0 +1,40 @@
+From ba4f23f2eeee5839df825f3adce8e3558ee66f76 Mon Sep 17 00:00:00 2001
+From: TJ Saunders <tj at castaglia.org>
+Date: Sat, 21 Jan 2023 09:14:29 -0800
+Subject: [PATCH] Backporting fix for Issue #1581 to the 1.3.8 branch.
+
+---
+ .github/workflows/ci.yml  | 6 ++----
+ .github/workflows/rpm.yml | 6 ++----
+ NEWS                      | 5 +++++
+ contrib/mod_sftp/fxp.c    | 5 ++---
+ 4 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
+index 6d6b009cbd..923cd97f04 100644
+diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml
+index d70430a417..82811da303 100644
+diff --git a/NEWS b/NEWS
+index 8aed7717eb..ac09fd605e 100644
+diff --git a/contrib/mod_sftp/fxp.c b/contrib/mod_sftp/fxp.c
+index a1e6f2b917..8305108adf 100644
+--- a/contrib/mod_sftp/fxp.c
++++ b/contrib/mod_sftp/fxp.c
+@@ -1,6 +1,6 @@
+ /*
+  * ProFTPD - mod_sftp sftp
+- * Copyright (c) 2008-2022 TJ Saunders
++ * Copyright (c) 2008-2023 TJ Saunders
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+@@ -1524,8 +1524,7 @@ static int fxp_attrs_set(pr_fh_t *fh, const char *path, struct stat *attrs,
+   }
+ 
+   if (attr_flags & SSH2_FX_ATTR_SIZE) {
+-    if (attrs->st_size &&
+-        st.st_size != attrs->st_size) {
++    if (st.st_size != attrs->st_size) {
+ 
+       /* If we're dealing with a FIFO, just pretend that the truncate(2)
+        * succeeded; FIFOs don't handle truncation well.  And it won't


=====================================
debian/patches/upstream_bug_1584.diff
=====================================
@@ -0,0 +1,64 @@
+From f816ee63adae2b910fb3379eb4ca0a52d600adac Mon Sep 17 00:00:00 2001
+From: TJ Saunders <tj at castaglia.org>
+Date: Sat, 21 Jan 2023 09:33:28 -0800
+Subject: [PATCH] Backport of fix for Issue #1584 to the 1.3.8 branch.
+
+---
+ NEWS                   |  2 ++
+ contrib/mod_sftp/fxp.c | 34 ++++++++++++++++++++++++----------
+ 2 files changed, 26 insertions(+), 10 deletions(-)
+
+diff --git a/NEWS b/NEWS
+index ac09fd605..8ff1358e2 100644
+diff --git a/contrib/mod_sftp/fxp.c b/contrib/mod_sftp/fxp.c
+index 8305108ad..dc1dae501 100644
+--- a/contrib/mod_sftp/fxp.c
++++ b/contrib/mod_sftp/fxp.c
+@@ -13135,6 +13135,30 @@ static int fxp_handle_write(struct fxp_packet *fxp) {
+     return fxp_packet_write(resp);
+   }
+ 
++  /* If the open flags have O_APPEND, treat this as an APPE command, rather
++   * than a STOR command.
++   *
++   * Note that this means that the offset provided by the client in this
++   * WRITE requested is ignored, per SFTP Draft:
++   *
++   *  SSH_FXF_APPEND_DATA
++   *    Data is always written at the end of the file.  The offset field
++   *    of SSH_FXP_WRITE requests is ignored.
++   *
++   * Instead, we override the offset to the current size of the file.
++   */
++  if (fxh->fh_flags & O_APPEND) {
++    pr_trace_msg(trace_channel, 5, "ignoring WRITE offset %" PR_LU " for file "
++      "opened for appending, using file size %" PR_LU " as offset instead",
++      (pr_off_t) offset, (pr_off_t) fxh->fh_st->st_size);
++    offset = fxh->fh_st->st_size;
++
++    cmd2 = fxp_cmd_alloc(fxp->pool, C_APPE, NULL);
++
++  } else {
++    cmd2 = fxp_cmd_alloc(fxp->pool, C_STOR, NULL);
++  }
++
+   if (S_ISREG(fxh->fh_st->st_mode)) {
+     off_t *file_offset;
+ 
+@@ -13145,16 +13169,6 @@ static int fxp_handle_write(struct fxp_packet *fxp) {
+       sizeof(off_t));
+   }
+ 
+-  /* If the open flags have O_APPEND, treat this as an APPE command, rather
+-   * than a STOR command.
+-   */
+-  if (!(fxh->fh_flags & O_APPEND)) {
+-    cmd2 = fxp_cmd_alloc(fxp->pool, C_STOR, NULL);
+-
+-  } else {
+-    cmd2 = fxp_cmd_alloc(fxp->pool, C_APPE, NULL);
+-  }
+-
+   pbuf = pcalloc(fxp->pool, sizeof(pr_buffer_t));
+   pbuf->buf = (char *) data;
+   pbuf->buflen = datalen;


=====================================
debian/patches/upstream_bug_1597.diff
=====================================
@@ -0,0 +1,460 @@
+From 99edaa306ba6fd532b2429ea328f51de3c4b9646 Mon Sep 17 00:00:00 2001
+From: TJ Saunders <tj at castaglia.org>
+Date: Sat, 18 Feb 2023 08:27:16 -0800
+Subject: [PATCH] Issue #1597: Properly handle `From` directives inside a
+ `<Class>` section that is itself within a `<Global>` section.
+
+The underlying cause was the lack of creating a "Class" config context on
+the parser stack for the entire `<Class>` section.  Without this, the
+`From` directives were not being associated into the `CONF_CLASS` configuration
+context, which in turn meant that the directive handler checks for proper
+context were failing unexpectedly.
+---
+ modules/mod_core.c                          |  14 +-
+ src/dirtree.c                               |  54 ++++--
+ src/parser.c                                |   8 +-
+ tests/t/lib/ProFTPD/Tests/Config/Classes.pm | 176 ++++++++++++++------
+ 4 files changed, 182 insertions(+), 70 deletions(-)
+
+diff --git a/modules/mod_core.c b/modules/mod_core.c
+index 4c22e63cd7..8699f57e9e 100644
+--- a/modules/mod_core.c
++++ b/modules/mod_core.c
+@@ -2,7 +2,7 @@
+  * ProFTPD - FTP server daemon
+  * Copyright (c) 1997, 1998 Public Flood Software
+  * Copyright (c) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver at tos.net>
+- * Copyright (c) 2001-2022 The ProFTPD Project team
++ * Copyright (c) 2001-2023 The ProFTPD Project team
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+@@ -2789,6 +2789,8 @@ MODRET end_anonymous(cmd_rec *cmd) {
+ }
+ 
+ MODRET add_class(cmd_rec *cmd) {
++  config_rec *c;
++
+   CHECK_ARGS(cmd, 1);
+   CHECK_CONF(cmd, CONF_ROOT|CONF_GLOBAL);
+ 
+@@ -2797,16 +2799,26 @@ MODRET add_class(cmd_rec *cmd) {
+       cmd->argv[1], ">: ", strerror(errno), NULL));
+   }
+ 
++  c = pr_parser_config_ctxt_open("Class");
++  c->config_type = CONF_CLASS;
++
+   return PR_HANDLED(cmd);
+ }
+ 
+ MODRET end_class(cmd_rec *cmd) {
++  int empty_ctx = FALSE;
++
+   if (cmd->argc > 1) {
+     CONF_ERROR(cmd, "wrong number of parameters");
+   }
+ 
+   CHECK_CONF(cmd, CONF_CLASS);
+ 
++  pr_parser_config_ctxt_close(&empty_ctx);
++  if (empty_ctx == TRUE) {
++    pr_log_debug(DEBUG3, "%s: ignoring empty section", (char *) cmd->argv[0]);
++  }
++
+   if (pr_class_close() < 0) {
+     pr_log_pri(PR_LOG_WARNING, "warning: empty <Class> definition");
+   }
+diff --git a/src/dirtree.c b/src/dirtree.c
+index 4df12ec2bc..ac6e029a9f 100644
+--- a/src/dirtree.c
++++ b/src/dirtree.c
+@@ -2,7 +2,7 @@
+  * ProFTPD - FTP server daemon
+  * Copyright (c) 1997, 1998 Public Flood Software
+  * Copyright (c) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver at tos.net>
+- * Copyright (c) 2001-2022 The ProFTPD Project team
++ * Copyright (c) 2001-2023 The ProFTPD Project team
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+@@ -2875,11 +2875,17 @@ void init_dirtree(void) {
+ /* These functions are used by modules to help parse configuration. */
+ 
+ unsigned char check_context(cmd_rec *cmd, int allowed) {
+-  int ctxt = (cmd->config && cmd->config->config_type != CONF_PARAM ?
+-     cmd->config->config_type : cmd->server->config_type ?
+-     cmd->server->config_type : CONF_ROOT);
++  int ctx;
+ 
+-  if (ctxt & allowed) {
++  if (cmd == NULL) {
++    return FALSE;
++  }
++
++  ctx = (cmd->config && cmd->config->config_type != CONF_PARAM ?
++    cmd->config->config_type : cmd->server->config_type ?
++    cmd->server->config_type : CONF_ROOT);
++
++  if (ctx & allowed) {
+     return TRUE;
+   }
+ 
+@@ -2889,36 +2895,50 @@ unsigned char check_context(cmd_rec *cmd, int allowed) {
+ 
+ char *get_context_name(cmd_rec *cmd) {
+   static char cbuf[20];
++  char *ctx_name = NULL;
+ 
+-  if (!cmd->config || cmd->config->config_type == CONF_PARAM) {
++  if (cmd->config == NULL ||
++      cmd->config->config_type == CONF_PARAM) {
+     if (cmd->server->config_type == CONF_VIRTUAL) {
+-      return "<VirtualHost>";
++      ctx_name = "<VirtualHost>";
++
++    } else {
++      ctx_name = "server config";
+     }
++  }
+ 
+-    return "server config";
++  if (ctx_name != NULL) {
++    return ctx_name;
+   }
+ 
+   switch (cmd->config->config_type) {
+     case CONF_DIR:
+-      return "<Directory>";
++      ctx_name = "<Directory>";
++      break;
+ 
+     case CONF_ANON:
+-      return "<Anonymous>";
++      ctx_name = "<Anonymous>";
++      break;
+ 
+     case CONF_CLASS:
+-      return "<Class>";
++      ctx_name = "<Class>";
++      break;
+ 
+     case CONF_LIMIT:
+-      return "<Limit>";
++      ctx_name = "<Limit>";
++      break;
+ 
+     case CONF_DYNDIR:
+-      return ".ftpaccess";
++      ctx_name = ".ftpaccess";
++      break;
+ 
+     case CONF_GLOBAL:
+-      return "<Global>";
++      ctx_name = "<Global>";
++      break;
+ 
+     case CONF_USERDATA:
+-      return "user data";
++      ctx_name = "user data";
++      break;
+ 
+     default:
+       /* XXX should dispatch to modules here, to allow them to create and
+@@ -2926,8 +2946,10 @@ char *get_context_name(cmd_rec *cmd) {
+        */
+       memset(cbuf, '\0', sizeof(cbuf));
+       pr_snprintf(cbuf, sizeof(cbuf), "%d", cmd->config->config_type);
+-      return cbuf;
++      ctx_name = cbuf;
+   }
++
++  return ctx_name;
+ }
+ 
+ int get_boolean(cmd_rec *cmd, int av) {
+diff --git a/src/parser.c b/src/parser.c
+index 1be99c4cb6..61a35e0172 100644
+--- a/src/parser.c
++++ b/src/parser.c
+@@ -1,6 +1,6 @@
+ /*
+  * ProFTPD - FTP server daemon
+- * Copyright (c) 2004-2022 The ProFTPD Project team
++ * Copyright (c) 2004-2023 The ProFTPD Project team
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+@@ -261,7 +261,7 @@ config_rec *pr_parser_config_ctxt_open(const char *name) {
+     return NULL;
+   }
+ 
+-  if (parent) {
++  if (parent != NULL) {
+     parent_pool = parent->pool;
+     set = &parent->subset;
+ 
+@@ -277,7 +277,7 @@ config_rec *pr_parser_config_ctxt_open(const char *name) {
+    * parent server.  This keeps <Global> config recs from being freed
+    * prematurely, and helps to avoid memory leaks.
+    */
+-  if (strncasecmp(name, "<Global>", 9) == 0) {
++  if (strcasecmp(name, "<Global>") == 0) {
+     if (global_config_pool == NULL) {
+       global_config_pool = make_sub_pool(permanent_pool);
+       pr_pool_tag(global_config_pool, "<Global> Pool");
+@@ -304,7 +304,7 @@ config_rec *pr_parser_config_ctxt_open(const char *name) {
+   c->parent = parent;
+   c->name = pstrdup(c->pool, name);
+ 
+-  if (parent) {
++  if (parent != NULL) {
+     if (parent->config_type == CONF_DYNDIR) {
+       c->flags |= CF_DYNAMIC;
+     }
+diff --git a/tests/t/lib/ProFTPD/Tests/Config/Classes.pm b/tests/t/lib/ProFTPD/Tests/Config/Classes.pm
+index 9212c2a70f..1a0d120922 100644
+--- a/tests/t/lib/ProFTPD/Tests/Config/Classes.pm
++++ b/tests/t/lib/ProFTPD/Tests/Config/Classes.pm
+@@ -115,6 +115,11 @@ my $TESTS = {
+     test_class => [qw(forking)],
+   },
+ 
++  class_from_global_issue1597 => {
++    order => ++$order,
++    test_class => [qw(bug forking)],
++  },
++
+ };
+ 
+ sub new {
+@@ -2619,49 +2624,19 @@ EOC
+ sub class_satisfy_all {
+   my $self = shift;
+   my $tmpdir = $self->{tmpdir};
+-
+-  my $config_file = "$tmpdir/config.conf";
+-  my $pid_file = File::Spec->rel2abs("$tmpdir/config.pid");
+-  my $scoreboard_file = File::Spec->rel2abs("$tmpdir/config.scoreboard");
+-
+-  my $log_file = File::Spec->rel2abs('tests.log');
+-
+-  my $auth_user_file = File::Spec->rel2abs("$tmpdir/config.passwd");
+-  my $auth_group_file = File::Spec->rel2abs("$tmpdir/config.group");
+-
+-  my $user = 'proftpd';
+-  my $passwd = 'test';
+-  my $home_dir = File::Spec->rel2abs($tmpdir);
+-  my $uid = 500;
+-  my $gid = 500;
+-
+-  # Make sure that, if we're running as root, that the home directory has
+-  # permissions/privs set for the account we create
+-  if ($< == 0) {
+-    unless (chmod(0755, $home_dir)) {
+-      die("Can't set perms on $home_dir to 0755: $!");
+-    }
+-
+-    unless (chown($uid, $gid, $home_dir)) {
+-      die("Can't set owner of $home_dir to $uid/$gid: $!");
+-    }
+-  }
+-
+-  auth_user_write($auth_user_file, $user, $passwd, $uid, $gid, $home_dir,
+-    '/bin/bash');
+-  auth_group_write($auth_group_file, 'ftpd', $gid, $user);
++  my $setup = test_setup($tmpdir, 'config');
+ 
+   my $class_name = 'test-class';
+ 
+   my $config = {
+-    PidFile => $pid_file,
+-    ScoreboardFile => $scoreboard_file,
+-    SystemLog => $log_file,
+-    TraceLog => $log_file,
++    PidFile => $setup->{pid_file},
++    ScoreboardFile => $setup->{scoreboard_file},
++    SystemLog => $setup->{log_file},
++    TraceLog => $setup->{log_file},
+     Trace => 'class:10 netaddr:10 netacl:10',
+ 
+-    AuthUserFile => $auth_user_file,
+-    AuthGroupFile => $auth_group_file,
++    AuthUserFile => $setup->{auth_user_file},
++    AuthGroupFile => $setup->{auth_group_file},
+     AuthOrder => 'mod_auth_file.c',
+ 
+     UseReverseDNS => 'on',
+@@ -2681,9 +2656,10 @@ sub class_satisfy_all {
+     },
+   };
+ 
+-  my ($port, $config_user, $config_group) = config_write($config_file, $config);
++  my ($port, $config_user, $config_group) = config_write($setup->{config_file},
++    $config);
+ 
+-  if (open(my $fh, ">> $config_file")) {
++  if (open(my $fh, ">> $setup->{config_file}")) {
+     print $fh <<EOC;
+ <Class $class_name>
+   From 127.0.0.1
+@@ -2695,11 +2671,11 @@ sub class_satisfy_all {
+ </Class>
+ EOC
+     unless (close($fh)) {
+-      die("Can't write $config_file: $!");
++      die("Can't write $setup->{config_file}: $!");
+     }
+ 
+   } else {
+-    die("Can't open $config_file: $!");
++    die("Can't open $setup->{config_file}: $!");
+   }
+ 
+   # Open pipes, for use between the parent and child processes.  Specifically,
+@@ -2717,11 +2693,13 @@ EOC
+   defined(my $pid = fork()) or die("Can't fork: $!");
+   if ($pid) {
+     eval {
++      # Allow for server startup
++      sleep(1);
++
+       my $client = ProFTPD::TestSuite::FTP->new('127.0.0.1', $port, 1, 1);
+-      $client->login($user, $passwd);
++      $client->login($setup->{user}, $setup->{passwd});
+       $client->quit();
+     };
+-
+     if ($@) {
+       $ex = $@;
+     }
+@@ -2730,7 +2708,7 @@ EOC
+     $wfh->flush();
+ 
+   } else {
+-    eval { server_wait($config_file, $rfh) };
++    eval { server_wait($setup->{config_file}, $rfh) };
+     if ($@) {
+       warn($@);
+       exit 1;
+@@ -2740,15 +2718,115 @@ EOC
+   }
+ 
+   # Stop server
+-  server_stop($pid_file);
+-
++  server_stop($setup->{pid_file});
+   $self->assert_child_ok($pid);
+ 
+-  if ($ex) {
+-    die($ex);
++  test_cleanup($setup->{log_file}, $ex);
++}
++
++sub class_from_global_issue1597 {
++  my $self = shift;
++  my $tmpdir = $self->{tmpdir};
++  my $setup = test_setup($tmpdir, 'config');
++
++  my $class_name = 'test-class';
++
++  my $config = {
++    PidFile => $setup->{pid_file},
++    ScoreboardFile => $setup->{scoreboard_file},
++    SystemLog => $setup->{log_file},
++    TraceLog => $setup->{log_file},
++    Trace => 'class:10 netaddr:10 netacl:10',
++
++    AuthUserFile => $setup->{auth_user_file},
++    AuthGroupFile => $setup->{auth_group_file},
++    AuthOrder => 'mod_auth_file.c',
++
++    UseReverseDNS => 'on',
++
++    Limit => {
++      LOGIN => {
++        Order => 'allow,deny',
++        AllowClass => $class_name,
++        DenyAll => '',
++      },
++    },
++
++    IfModules => {
++      'mod_delay.c' => {
++        DelayEngine => 'off',
++      },
++    },
++  };
++
++  my ($port, $config_user, $config_group) = config_write($setup->{config_file},
++    $config);
++
++  if (open(my $fh, ">> $setup->{config_file}")) {
++    print $fh <<EOC;
++<Global>
++  <Class $class_name>
++    From 127.0.0.1
++    From localhost
++    From \!evil.com
++    From 127.0.0.0/8
++    From 127.0.0.
++    Satisfy all
++  </Class>
++</Global>
++EOC
++    unless (close($fh)) {
++      die("Can't write $setup->{config_file}: $!");
++    }
++
++  } else {
++    die("Can't open $setup->{config_file}: $!");
+   }
+ 
+-  unlink($log_file);
++  # Open pipes, for use between the parent and child processes.  Specifically,
++  # the child will indicate when it's done with its test by writing a message
++  # to the parent.
++  my ($rfh, $wfh);
++  unless (pipe($rfh, $wfh)) {
++    die("Can't open pipe: $!");
++  }
++
++  my $ex;
++
++  # Fork child
++  $self->handle_sigchld();
++  defined(my $pid = fork()) or die("Can't fork: $!");
++  if ($pid) {
++    eval {
++      # Allow for server startup
++      sleep(1);
++
++      my $client = ProFTPD::TestSuite::FTP->new('127.0.0.1', $port, 1, 1);
++      $client->login($setup->{user}, $setup->{passwd});
++      $client->quit();
++    };
++    if ($@) {
++      $ex = $@;
++    }
++
++    $wfh->print("done\n");
++    $wfh->flush();
++
++  } else {
++    eval { server_wait($setup->{config_file}, $rfh) };
++    if ($@) {
++      warn($@);
++      exit 1;
++    }
++
++    exit 0;
++  }
++
++  # Stop server
++  server_stop($setup->{pid_file});
++  $self->assert_child_ok($pid);
++
++  test_cleanup($setup->{log_file}, $ex);
+ }
+ 
+ 1;



View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd/-/compare/7c4d3644c46ff3922269b050d2456c366af1d021...8f87d98de8799751115db56de5f2c64657523cd5

-- 
View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd/-/compare/7c4d3644c46ff3922269b050d2456c366af1d021...8f87d98de8799751115db56de5f2c64657523cd5
You're receiving this email because of your account on salsa.debian.org.




More information about the Pkg-proftpd-maintainers mailing list