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

Bash For loop in ListAction.sh breaks -d domain full backup of zmbackup with domains that have the letter 's' on them #168

Open
krull opened this issue Oct 8, 2021 · 4 comments

Comments

@krull
Copy link

krull commented Oct 8, 2021

ISSUE TYPE
  • Bug Report
ENVIRONMENT VERSION
  • Zmbackup Version: 1.2.6
  • Zimbra Version: 8.8.15_GA_3945.FOSS
  • Linux Distribution & Version: Ubuntu 18.04.4 LTS
SUMMARY
build_listBKP()
line: /usr/local/lib/zmbackup/bash/ListAction.sh:25

build_listRST()
line: /usr/local/lib/zmbackup/bash/ListAction.sh:64

Bash For loop in ListAction.sh breaks -d domain full backup of zmbackup with domains that have the letter 's' on them

STEPS TO REPRODUCE
zmbackup -f -d thesdomain.tld

with #!/bin/bash -x, the result above will have an output:

+ for i in ${4/\s/\n/g}
+ DC=,dc=
+ DOMAIN=dc=then/gdomain,dc=tld
+ ERR='++ ldapsearch -Z -x -H ldap://127.0.0.1:389 -D uid=zimbra,cn=admins,cn=zimbra -w XXXXXXXX -b dc=then/gdomain,dc=tld -LLL '\''(objectclass=zimbraAccount)'\'' zimbraMailDeliveryAddress
No such object (32)
Matched DN: dc=tld'
+ BASHERRCODE=32

ACTUAL RESULTS
tail -f /var/log/syslog

Oct  8 07:55:03 zmb-mbox00 zimbra[31431]: Zmbackup: LDAP - Can't extract accounts from LDAP - Error below:
Oct  8 07:55:03 zmb-mbox00 zimbra[31432]: Zmbackup: No such object (32)#012Matched DN: dc=tld
@krull
Copy link
Author

krull commented Oct 8, 2021

Hello,

This bug report was reproduced with the following; I have several domains that include the letter 's' and ones without.

The ones without successfully backup, however the ones with 's' did not.

I remedied the issue by changing the following in ListAction.sh file:

for i in ${4//\n/g}; do

Not certain if it will break other logics on your script, but it passed correctly the domain with 's' to the ldapsearch command.

hope this helps.

-krull

@tofuSCHNITZEL
Copy link

it also breaks if there is an "n" in the email adress because it gets substituted with g. "\s" and "\n" does not not work with bash substitution.
you can check out the proper fix here:
tofuSCHNITZEL@d502834

@milauria
Copy link

The version 1.2 still present this issue and these changes resolve the issue.
Can somebody release this changes into a new release 1.3 ?

@tofuSCHNITZEL
Copy link

The version 1.2 still present this issue and these changes resolve the issue. Can somebody release this changes into a new release 1.3 ?

you can just clone and use my fork:
https://github.com/tofuSCHNITZEL/zmbackup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants