sed or awk: decode base64 string in passwd-like file


I have a file with strings like:


I need to decode the second field (password field), with something like:

echo e0NSWVBUfVUx= | openssl base64 -d

How can I do this with all other lines?

I have already a small awk script, that converts my ldapsearch output to
a Dovecot readable passwd file.

/^uid: / {uid=$2}
/^uid: / {uid=$2; u=tolower(substr(uid,1,1));}
/^postalAddress:/ {maildomain=$2}
/^myMailQuota/ {mailquota=$2}
/^userPassword/ {userpassword=$2}
/^dn/ {printf("%s@%s:%s:500:12002::/imap/spool/%s/%s/%s:storage=%s
END {printf("%s@%s:%s:500:12002::/imap/spool/%s/%s/%s:storage=%s

the third %s must be changed, means decoded from base64.

any suggestions?

Attachment: signature.asc
Description: This is a digitally signed message part