#6810 [Py3] vault_add() fails while archiving empty data
Closed 7 years ago Opened 8 years ago by cheimes.

At the end of vault_add.forward(), the plugin calls vault_archive to archive an empty entry. This operation fails because str instead of bytes is used:

Traceback (most recent call last):
  File "...python3.5/site-packages/custodia/httpd/server.py", line 351, in handle_one_request
    response = self.pipeline(self.server.config, request)
  File "...python3.5/site-packages/custodia/httpd/server.py", line 469, in pipeline
    return con.handle(request)
  File "...python3.5/site-packages/custodia/plugin.py", line 405, in handle
    output = handler(request, response)
  File "...python3.5/site-packages/custodia/secrets.py", line 135, in PUT
    self._set_key(trail, request, response)
  File "...python3.5/site-packages/custodia/secrets.py", line 268, in _set_key
    self._int_set_key, trail, request, response)
  File "...python3.5/site-packages/custodia/secrets.py", line 242, in _audit
    fn(trail, request, response)
  File "...python3.5/site-packages/custodia/secrets.py", line 300, in _int_set_key
    ok = self.root.store.set(key, msg.payload)
  File "...python3.5/site-packages/custodia/ipa/vault.py", line 155, in set
    key, ipavaulttype=u"standard", **self._vault_args)
  File "...python3.5/site-packages/ipalib/frontend.py", line 447, in __call__
    return self.__do_call(*args, **options)
  File "...python3.5/site-packages/ipalib/frontend.py", line 475, in __do_call
    ret = self.run(*args, **options)
  File "...python3.5/site-packages/ipalib/frontend.py", line 1199, in run
    return self.forward(*args, **options)
  File "...python3.5/site-packages/ipaclient/plugins/vault.py", line 367, in forward
    self.api.Command.vault_archive(*args, **opts)
  File "...python3.5/site-packages/ipalib/frontend.py", line 447, in __call__
    return self.__do_call(*args, **options)
  File "...python3.5/site-packages/ipalib/frontend.py", line 475, in __do_call
    ret = self.run(*args, **options)
  File "...python3.5/site-packages/ipalib/frontend.py", line 1199, in run
    return self.forward(*args, **options)
  File "...python3.5/site-packages/ipaclient/plugins/vault.py", line 803, in forward
    data = options.get('data')
  File "/usr/lib64/python3.5/base64.py", line 59, in b64encode
    encoded = binascii.b2a_base64(s)[:-1]
TypeError: a bytes-like object is required, not 'str'

Metadata Update from @cheimes:
- Issue tagged with: py3

8 years ago

Metadata Update from @pvoborni:
- Issue set to the milestone: FreeIPA 4.6

8 years ago

Metadata Update from @fbarreto:
- Issue assigned to fbarreto

7 years ago

I was not able to reproduce this from master:

[root@localhost vagrant]# python3 /usr/bin/ipa vault-add test
New password: 
Enter New password again to verify: 
------------------
Added vault "test"
------------------
  Vault name: test
  Type: symmetric
  Salt: K5u51fBkAniCl/BfpYvznQ==
  Owner users: admin
  Vault user: admin
[root@localhost vagrant]# ipa --version
VERSION: 4.5.90.dev201707072021+git17f03a7, API_VERSION: 2.228

AFAICT it's fixed.

Closing this since it's fixed.

Metadata Update from @fbarreto:
- Issue status updated to: Closed (was: Open)

7 years ago

Log in to comment on this ticket.

Metadata