1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

Test password removal via python proctitle

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
David Mulder 2019-11-08 20:06:53 +00:00 committed by Stefan Metzmacher
parent 9ec698954d
commit a31891c742
25 changed files with 75 additions and 2 deletions

View File

@ -32,7 +32,7 @@ variables:
# Set this to the contents of bootstrap/sha1sum.txt # Set this to the contents of bootstrap/sha1sum.txt
# which is generated by bootstrap/template.py --render # which is generated by bootstrap/template.py --render
# #
SAMBA_CI_CONTAINER_TAG: d4867986881a9601c4620baf9a3bf28f5d1d1343 SAMBA_CI_CONTAINER_TAG: 42ecbfbf716fa85ce251a955de72a92af26fc7b2
# #
# We use the ubuntu1804 image as default as # We use the ubuntu1804 image as default as
# it matches what we have on sn-devel-184. # it matches what we have on sn-devel-184.

View File

@ -141,6 +141,7 @@ PKGS = [
('python3-dnspython', 'python3-dns'), ('python3-dnspython', 'python3-dns'),
('python3-pexpect', ''), # for wintest only ('python3-pexpect', ''), # for wintest only
('python3-pyasn1', 'python3-pyasn1'), # for krb5 tests ('python3-pyasn1', 'python3-pyasn1'), # for krb5 tests
('python3-setproctitle', 'python3-setproctitle'),
('', 'libsemanage-python'), ('', 'libsemanage-python'),
('', 'policycoreutils-python'), ('', 'policycoreutils-python'),
@ -451,6 +452,7 @@ RPM_DISTS = {
'libcephfs-devel': '', 'libcephfs-devel': '',
'gnutls-devel': 'compat-gnutls34-devel', 'gnutls-devel': 'compat-gnutls34-devel',
'liburing-devel': '', # not available 'liburing-devel': '', # not available
'python3-setproctitle': 'python36-setproctitle',
} }
}, },
'centos8': { 'centos8': {

View File

@ -91,6 +91,7 @@ yum install -y \
python36-iso8601 \ python36-iso8601 \
python36-markdown \ python36-markdown \
python36-pyasn1 \ python36-pyasn1 \
python36-setproctitle \
quota-devel \ quota-devel \
readline-devel \ readline-devel \
redhat-lsb \ redhat-lsb \

View File

@ -77,6 +77,7 @@ packages:
- python36-iso8601 - python36-iso8601
- python36-markdown - python36-markdown
- python36-pyasn1 - python36-pyasn1
- python36-setproctitle
- quota-devel - quota-devel
- readline-devel - readline-devel
- redhat-lsb - redhat-lsb

View File

@ -98,6 +98,7 @@ yum install -y \
python3-markdown \ python3-markdown \
python3-policycoreutils \ python3-policycoreutils \
python3-pyasn1 \ python3-pyasn1 \
python3-setproctitle \
quota-devel \ quota-devel \
readline-devel \ readline-devel \
redhat-lsb \ redhat-lsb \

View File

@ -80,6 +80,7 @@ packages:
- python3-markdown - python3-markdown
- python3-policycoreutils - python3-policycoreutils
- python3-pyasn1 - python3-pyasn1
- python3-setproctitle
- quota-devel - quota-devel
- readline-devel - readline-devel
- redhat-lsb - redhat-lsb

View File

@ -92,6 +92,7 @@ apt-get -y install \
python3-matplotlib \ python3-matplotlib \
python3-pexpect \ python3-pexpect \
python3-pyasn1 \ python3-pyasn1 \
python3-setproctitle \
rng-tools \ rng-tools \
rsync \ rsync \
sed \ sed \

View File

@ -81,6 +81,7 @@ packages:
- python3-matplotlib - python3-matplotlib
- python3-pexpect - python3-pexpect
- python3-pyasn1 - python3-pyasn1
- python3-setproctitle
- rng-tools - rng-tools
- rsync - rsync
- sed - sed

View File

@ -94,6 +94,7 @@ dnf install -y \
python3-markdown \ python3-markdown \
python3-policycoreutils \ python3-policycoreutils \
python3-pyasn1 \ python3-pyasn1 \
python3-setproctitle \
quota-devel \ quota-devel \
readline-devel \ readline-devel \
redhat-lsb \ redhat-lsb \

View File

@ -83,6 +83,7 @@ packages:
- python3-markdown - python3-markdown
- python3-policycoreutils - python3-policycoreutils
- python3-pyasn1 - python3-pyasn1
- python3-setproctitle
- quota-devel - quota-devel
- readline-devel - readline-devel
- redhat-lsb - redhat-lsb

View File

@ -95,6 +95,7 @@ dnf install -y \
python3-markdown \ python3-markdown \
python3-policycoreutils \ python3-policycoreutils \
python3-pyasn1 \ python3-pyasn1 \
python3-setproctitle \
quota-devel \ quota-devel \
readline-devel \ readline-devel \
redhat-lsb \ redhat-lsb \

View File

@ -84,6 +84,7 @@ packages:
- python3-markdown - python3-markdown
- python3-policycoreutils - python3-policycoreutils
- python3-pyasn1 - python3-pyasn1
- python3-setproctitle
- quota-devel - quota-devel
- readline-devel - readline-devel
- redhat-lsb - redhat-lsb

View File

@ -88,6 +88,7 @@ zypper --non-interactive install \
python3-gpg \ python3-gpg \
python3-iso8601 \ python3-iso8601 \
python3-pyasn1 \ python3-pyasn1 \
python3-setproctitle \
readline-devel \ readline-devel \
rng-tools \ rng-tools \
rpcgen \ rpcgen \

View File

@ -76,6 +76,7 @@ packages:
- python3-gpg - python3-gpg
- python3-iso8601 - python3-iso8601
- python3-pyasn1 - python3-pyasn1
- python3-setproctitle
- readline-devel - readline-devel
- rng-tools - rng-tools
- rpcgen - rpcgen

View File

@ -90,6 +90,7 @@ zypper --non-interactive install \
python3-gpg \ python3-gpg \
python3-iso8601 \ python3-iso8601 \
python3-pyasn1 \ python3-pyasn1 \
python3-setproctitle \
readline-devel \ readline-devel \
rng-tools \ rng-tools \
rpcgen \ rpcgen \

View File

@ -78,6 +78,7 @@ packages:
- python3-gpg - python3-gpg
- python3-iso8601 - python3-iso8601
- python3-pyasn1 - python3-pyasn1
- python3-setproctitle
- readline-devel - readline-devel
- rng-tools - rng-tools
- rpcgen - rpcgen

View File

@ -91,6 +91,7 @@ apt-get -y install \
python3-matplotlib \ python3-matplotlib \
python3-pexpect \ python3-pexpect \
python3-pyasn1 \ python3-pyasn1 \
python3-setproctitle \
rng-tools \ rng-tools \
rsync \ rsync \
sed \ sed \

View File

@ -80,6 +80,7 @@ packages:
- python3-matplotlib - python3-matplotlib
- python3-pexpect - python3-pexpect
- python3-pyasn1 - python3-pyasn1
- python3-setproctitle
- rng-tools - rng-tools
- rsync - rsync
- sed - sed

View File

@ -93,6 +93,7 @@ apt-get -y install \
python3-matplotlib \ python3-matplotlib \
python3-pexpect \ python3-pexpect \
python3-pyasn1 \ python3-pyasn1 \
python3-setproctitle \
rng-tools \ rng-tools \
rsync \ rsync \
sed \ sed \

View File

@ -82,6 +82,7 @@ packages:
- python3-matplotlib - python3-matplotlib
- python3-pexpect - python3-pexpect
- python3-pyasn1 - python3-pyasn1
- python3-setproctitle
- rng-tools - rng-tools
- rsync - rsync
- sed - sed

View File

@ -93,6 +93,7 @@ apt-get -y install \
python3-matplotlib \ python3-matplotlib \
python3-pexpect \ python3-pexpect \
python3-pyasn1 \ python3-pyasn1 \
python3-setproctitle \
rng-tools \ rng-tools \
rsync \ rsync \
sed \ sed \

View File

@ -82,6 +82,7 @@ packages:
- python3-matplotlib - python3-matplotlib
- python3-pexpect - python3-pexpect
- python3-pyasn1 - python3-pyasn1
- python3-setproctitle
- rng-tools - rng-tools
- rsync - rsync
- sed - sed

View File

@ -1 +1 @@
d4867986881a9601c4620baf9a3bf28f5d1d1343 42ecbfbf716fa85ce251a955de72a92af26fc7b2

View File

@ -0,0 +1,50 @@
# Unix SMB/CIFS implementation.
# Copyright (C) David Mulder <dmulder@suse.com> 2019
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""Tests for cred option parsing.
"""
import optparse
from samba.getopt import CredentialsOptions
import samba.tests
import setproctitle
import sys
password_opt = '--password=super_secret_password'
clear_password_opt = '--password=xxx'
class CredentialsOptionsTests(samba.tests.TestCase):
def setUp(self):
super(samba.tests.TestCase, self).setUp()
self.old_proctitle = setproctitle.getproctitle()
setproctitle.setproctitle('%s %s' % (self.old_proctitle, password_opt))
sys.argv.append(password_opt)
def test_clear_proctitle_password(self):
parser = optparse.OptionParser()
credopts = CredentialsOptions(parser)
parser.add_option_group(credopts)
(opts, args) = parser.parse_args()
self.assertNotIn(password_opt, setproctitle.getproctitle())
self.assertIn(clear_password_opt, setproctitle.getproctitle())
def tearDown(self):
super(samba.tests.TestCase, self).tearDown()
setproctitle.setproctitle(self.old_proctitle)
sys.argv.pop()

View File

@ -65,6 +65,7 @@ planpythontestsuite("none", "samba.tests.credentials")
planpythontestsuite("none", "samba.tests.registry") planpythontestsuite("none", "samba.tests.registry")
planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth") planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth")
planpythontestsuite("none", "samba.tests.get_opt") planpythontestsuite("none", "samba.tests.get_opt")
planpythontestsuite("none", "samba.tests.cred_opt")
planpythontestsuite("none", "samba.tests.security") planpythontestsuite("none", "samba.tests.security")
planpythontestsuite("none", "samba.tests.dcerpc.misc") planpythontestsuite("none", "samba.tests.dcerpc.misc")
planpythontestsuite("none", "samba.tests.dcerpc.integer") planpythontestsuite("none", "samba.tests.dcerpc.integer")