Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdnsutil set-meta clobbers multi-valued domainmetadata #5853

Closed
jpmens opened this issue Oct 26, 2017 · 3 comments
Closed

pdnsutil set-meta clobbers multi-valued domainmetadata #5853

jpmens opened this issue Oct 26, 2017 · 3 comments

Comments

@jpmens
Copy link
Contributor

jpmens commented Oct 26, 2017

  • Program: Authoritative
  • Issue type: Bug report

Short description

pdnsutil set-meta overwrites existing multi-valued settings in the domainmetadata table.

Environment

  • Operating system: CentOS
  • Software version: auth master
  • Software source: PowerDNS repo

Steps to reproduce

$ pdnsutil create-zone a.aa
Creating empty zone 'a.aa'

$ pdnsutil set-meta a.aa ALLOW-AXFR-FROM 1.1.1.1/32
Set 'a.aa' meta ALLOW-AXFR-FROM = 1.1.1.1/32

$ pdnsutil set-meta a.aa ALLOW-AXFR-FROM 2.2.2.2/32
Set 'a.aa' meta ALLOW-AXFR-FROM = 2.2.2.2/32

$ sqlite3 powerdns.sqlite
sqlite> select * from domainmetadata;
6|3|ALLOW-AXFR-FROM|2.2.2.2/32

Expected behaviour

I expected the ALLOW-AXFR-FROM to be added to the table (INSERT).

Usecase

Use pdnsutil set-meta in a script to add settings to table in a controlled manner (instead of using naked SQL INSERT statements.

Description

The utility should, on multivalued settings, not overwrite existing ones or it should, at the very least, refuse operation informing user that it cannot write a setting because settings of same kind exist. Overwriting (and thereby destroying) data cannot be right!

@pieterlexis
Copy link
Contributor

pdnsutil --help does say:

set-meta ZONE KIND [VALUE] [VALUE] Set zone metadata, optionally providing a value. *No* value clears meta
                                   Note - this will replace all metadata records of KIND!

But I think a 'add-metadata' might be not a bad idea

@jpmens
Copy link
Contributor Author

jpmens commented Nov 1, 2017

The documentation doesn't say

set-meta ZONE ATTRIBUTE [VALUE]
    Set domainmetadata ATTRIBUTE for ZONE to VALUE. An empty value clears it.

and unfortunately, a

pdnsutil --help | grep set-meta

to find the synopsis for a subcommand I know exists doesn't either.... That's how it happened.

@Habbie
Copy link
Member

Habbie commented Nov 9, 2017

pdnsutil --help | grep set-meta

grep -3 does the trick though..

@Habbie Habbie added this to the auth-4.1.x milestone Nov 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants