c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#ifndef AUTH_MASTER_CONNECTION_H
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#define AUTH_MASTER_CONNECTION_H
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
c95b7ce6c3ebf84a9ef20320b9f11ef2129e1f1aTimo Sirainenstruct stat;
226259ee6fb9830dafc1a5ba1e95bf5a4345b406Timo Sirainenstruct auth_stream_reply;
226259ee6fb9830dafc1a5ba1e95bf5a4345b406Timo Sirainen
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainenstruct auth_master_connection {
29d4c6eac14a0b3d79656eb6b206a102fd09d24aTimo Sirainen struct auth_master_connection *prev, *next;
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen struct auth *auth;
ecb1b2d6236942bf82f822e8d0167f0e160b206dTimo Sirainen int refcount;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen int fd;
86a58337862c546aa489f07e8e6d242f0180e4a0Timo Sirainen char *path;
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainen struct istream *input;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen struct ostream *output;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen struct io *io;
76213404317a7ed17bec0beadb5137c82785d816Timo Sirainen
47b5ef748f34ca194419befab4f7450002f4e85dTimo Sirainen struct master_list_iter_ctx *iter_ctx;
c95b7ce6c3ebf84a9ef20320b9f11ef2129e1f1aTimo Sirainen /* If non-zero, allow only USER lookups whose returned uid matches
c95b7ce6c3ebf84a9ef20320b9f11ef2129e1f1aTimo Sirainen this uid. Don't allow LIST/PASS lookups. */
c95b7ce6c3ebf84a9ef20320b9f11ef2129e1f1aTimo Sirainen uid_t userdb_restricted_uid;
0602c7dee8ceda2d7c7e5723f18c56698ac5a76dTimo Sirainen
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool version_received:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool destroyed:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool userdb_only:1;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen};
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainenstruct auth_master_connection *
c95b7ce6c3ebf84a9ef20320b9f11ef2129e1f1aTimo Sirainenauth_master_connection_create(struct auth *auth, int fd,
86a58337862c546aa489f07e8e6d242f0180e4a0Timo Sirainen const char *path, const struct stat *socket_st,
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen bool userdb_only) ATTR_NULL(4);
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainenvoid auth_master_connection_destroy(struct auth_master_connection **conn);
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
ecb1b2d6236942bf82f822e8d0167f0e160b206dTimo Sirainenvoid auth_master_connection_ref(struct auth_master_connection *conn);
ecb1b2d6236942bf82f822e8d0167f0e160b206dTimo Sirainenvoid auth_master_connection_unref(struct auth_master_connection **conn);
ecb1b2d6236942bf82f822e8d0167f0e160b206dTimo Sirainen
6aafdd81aa1e12c127941c1ebd87e8ee4697ec3eTimo Sirainenvoid auth_master_request_callback(const char *reply, struct auth_master_connection *conn);
657afb33796f8216c568ad813627da89970760beTimo Sirainen
29d4c6eac14a0b3d79656eb6b206a102fd09d24aTimo Sirainenvoid auth_master_connections_destroy_all(void);
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen#endif