Skip to content

Instantly share code, notes, and snippets.

@mrballcb
Created June 11, 2014 16:39
Show Gist options
  • Save mrballcb/9d05b30b15cbb3951a9b to your computer and use it in GitHub Desktop.
Save mrballcb/9d05b30b15cbb3951a9b to your computer and use it in GitHub Desktop.
# A manual SELECT needs to return data in order specified bellow:
# username, cryptpw, clearpw, uid, gid, home, maildir, quota, fullname, options
#
MYSQL_SELECT_CLAUSE SELECT CONCAT(email.name, '@', domain.name), \
user.password, \
'', \
503, \
500, \
TRIM(TRAILING '/Maildir/' FROM CASE \
WHEN email.homedir LIKE "/netapp%" THEN email.homedir \
ELSE CONCAT('/IV/user_data/email/', email.homedir) END), \
CASE WHEN email.homedir LIKE "/netapp%" THEN email.homedir \
ELSE CONCAT('/IV/user_data/email/', email.homedir) END, \
email.quota, \
CONCAT(user.first_name,' ', user.last_name), \
'' \
FROM email, domain, user \
WHERE email.name = '$(local_part)' \
AND domain.name = '$(domain)' \
AND email.domain_id = domain.id \
AND user.email_id = email.id \
AND domain.active = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment