"Fossies" - the Fresh Open Source Software Archive

Member "dovecot-2.3.8/src/lib-auth/auth-master.h" (8 Oct 2019, 2813 Bytes) of package /linux/misc/dovecot-2.3.8.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "auth-master.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.3.7.2_vs_2.3.8.

    1 #ifndef AUTH_MASTER_H
    2 #define AUTH_MASTER_H
    3 
    4 #include "net.h"
    5 
    6 enum auth_master_flags {
    7     /* Enable logging debug information */
    8     AUTH_MASTER_FLAG_DEBUG          = 0x01,
    9     /* Don't disconnect from auth socket when idling */
   10     AUTH_MASTER_FLAG_NO_IDLE_TIMEOUT    = 0x02
   11 };
   12 
   13 struct auth_user_info {
   14     const char *service;
   15     struct ip_addr local_ip, remote_ip, real_local_ip, real_remote_ip;
   16     in_port_t local_port, remote_port, real_local_port, real_remote_port;
   17     bool debug;
   18 };
   19 
   20 struct auth_user_reply {
   21     uid_t uid;
   22     gid_t gid;
   23     const char *home, *chroot;
   24     ARRAY_TYPE(const_string) extra_fields;
   25     bool anonymous:1;
   26 };
   27 
   28 struct auth_master_connection *
   29 auth_master_init(const char *auth_socket_path, enum auth_master_flags flags);
   30 void auth_master_deinit(struct auth_master_connection **conn);
   31 
   32 /* Set timeout for lookups. */
   33 void auth_master_set_timeout(struct auth_master_connection *conn,
   34                  unsigned int msecs);
   35 
   36 /* Returns the auth_socket_path */
   37 const char *auth_master_get_socket_path(struct auth_master_connection *conn);
   38 
   39 /* Do a USER lookup. Returns -2 = user-specific error, -1 = internal error,
   40    0 = user not found, 1 = ok. When returning -1 and fields[0] isn't NULL, it
   41    contains an error message that should be shown to user. */
   42 int auth_master_user_lookup(struct auth_master_connection *conn,
   43                 const char *user, const struct auth_user_info *info,
   44                 pool_t pool, const char **username_r,
   45                 const char *const **fields_r);
   46 /* Do a PASS lookup (the actual password isn't returned). */
   47 int auth_master_pass_lookup(struct auth_master_connection *conn,
   48                 const char *user, const struct auth_user_info *info,
   49                 pool_t pool, const char *const **fields_r);
   50 /* Flush authentication cache for everyone (users=NULL) or only for specified
   51    users. Returns number of users flushed from cache. */
   52 int auth_master_cache_flush(struct auth_master_connection *conn,
   53                 const char *const *users, unsigned int *count_r);
   54 
   55 /* Parse userdb extra fields into auth_user_reply structure. */
   56 void auth_user_fields_parse(const char *const *fields, pool_t pool,
   57                 struct auth_user_reply *reply_r);
   58 
   59 /* Iterate through all users. If user_mask is non-NULL, it contains a string
   60    with wildcards ('*', '?') that the auth server MAY use to limit what users
   61    are returned (but it may as well return all users anyway). */
   62 struct auth_master_user_list_ctx *
   63 auth_master_user_list_init(struct auth_master_connection *conn,
   64                const char *user_mask,
   65                const struct auth_user_info *info) ATTR_NULL(3);
   66 const char *auth_master_user_list_next(struct auth_master_user_list_ctx *ctx);
   67 /* Returns -1 if anything failed, 0 if ok */
   68 int auth_master_user_list_deinit(struct auth_master_user_list_ctx **ctx);
   69 
   70 /* INTERNAL: */
   71 void auth_user_info_export(string_t *str, const struct auth_user_info *info);
   72 #endif