Postfix combine multiple checks

I am trying to configure Postfix to allow mail only if it is from a certain email, AND if it is from a certain server (google). This is my configuration:

smtpd_sender_restrictions =
    check_sender_access hash:/etc/postfix/access_from,
    check_client_access hash:/etc/postfix/client_access,
    reject

access_from:

max@[REDACTED].com OK

client_access:

google.com OK

However, if I send an email from google servers, but not from the correct email, it still goes through. Here are the logs:

maps_find: hash:/etc/postfix/access_from: [WRONG ADDRESS]@gmail.com: not found
maps_find: hash:/etc/postfix/access_from: gmail.com: not found
maps_find: hash:/etc/postfix/access_from: com: not found
maps_find: hash:/etc/postfix/access_from: [WRONG ADDRESS]@: not found
mail_addr_find: [WRONG ADDRESS]@gmail.com -> (not found)
generic_checks: name=check_sender_access status=0
generic_checks: name=check_client_access
check_namadr_access: name mail-qk1-f178.google.com addr 209.85.222.178
check_domain_access: mail-qk1-f178.google.com
maps_find: hash:/etc/postfix/client_access: mail-qk1-f178.google.com: not found
maps_find: hash:/etc/postfix/client_access: hash:/etc/postfix/client_access(0,lock|fold_fix|utf8_request): google.com = OK
check_table_result: hash:/etc/postfix/client_access OK mail-qk1-f178.google.com
smtpd_acl_permit: checking smtpd_log_access_permit_actions settings
match_list_match: OK: no match
smtpd_acl_permit: smtpd_log_access_permit_actions: no match
generic_checks: name=check_client_access status=1

Postfix sees that the sending email is invalid, but when it also sees that it's sent from google, it ignores the previous error and still accepts the email. In other words, Postfix is ORing the two checks, but I need it to AND the two checks. How can I do that?


I figured it out!

smtpd_client_restrictions =
    check_client_access hash:/etc/postfix/client_access,
    reject

smtpd_sender_restrictions =
    check_sender_access hash:/etc/postfix/access_from,
    reject

If the client restrictions don't go through, it will immediately reject.