summaryrefslogtreecommitdiffstats
path: root/src/auth/db-passwd-file.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:51:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:51:24 +0000
commitf7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch)
treea3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/auth/db-passwd-file.h
parentInitial commit. (diff)
downloaddovecot-upstream.tar.xz
dovecot-upstream.zip
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/auth/db-passwd-file.h')
-rw-r--r--src/auth/db-passwd-file.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/auth/db-passwd-file.h b/src/auth/db-passwd-file.h
new file mode 100644
index 0000000..498f9c3
--- /dev/null
+++ b/src/auth/db-passwd-file.h
@@ -0,0 +1,58 @@
+#ifndef DB_PASSWD_FILE_H
+#define DB_PASSWD_FILE_H
+
+#include "hash.h"
+
+#define PASSWD_FILE_DEFAULT_USERNAME_FORMAT "%u"
+#define PASSWD_FILE_DEFAULT_SCHEME "CRYPT"
+
+struct passwd_user {
+ uid_t uid;
+ gid_t gid;
+
+ char *home;
+ char *password;
+ char **extra_fields;
+};
+
+struct passwd_file {
+ struct db_passwd_file *db;
+ pool_t pool;
+ int refcount;
+ struct event *event;
+
+ time_t last_sync_time;
+ char *path;
+ time_t stamp;
+ off_t size;
+ int fd;
+
+ HASH_TABLE(char *, struct passwd_user *) users;
+};
+
+struct db_passwd_file {
+ struct db_passwd_file *next;
+
+ int refcount;
+ struct event *event;
+
+ char *path;
+ HASH_TABLE(char *, struct passwd_file *) files;
+ struct passwd_file *default_file;
+
+ bool vars:1;
+ bool userdb:1;
+ bool userdb_warn_missing:1;
+};
+
+int db_passwd_file_lookup(struct db_passwd_file *db,
+ struct auth_request *request,
+ const char *username_format,
+ struct passwd_user **user_r);
+
+struct db_passwd_file *
+db_passwd_file_init(const char *path, bool userdb, bool debug);
+void db_passwd_file_parse(struct db_passwd_file *db);
+void db_passwd_file_unref(struct db_passwd_file **db);
+
+#endif