path: root/src/wydawca.h
diff options
authorSergey Poznyakoff <gray@gnu.org.ua>2009-02-26 00:50:24 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2009-02-26 00:50:24 +0200
commit81640ab2b9ad954d4952aed43a70d7874da1c463 (patch)
tree8160066cb7259357f17a40121f7ed7d0fff5701e /src/wydawca.h
parent9ec721b2a3a023f6339fe3c910635e477e4a311f (diff)
Switch to non-privileged UID/GID before startup.
* src/userprivs.c: New file. * src/Makefile.am (wydawca_SOURCES): Add userprivs.c * src/config.c (cb_access_method_params): Add missing gl_list_iterator_free. (cb_user, cb_supp_groups): New callbacks. (wydawca_kw): New keywords: user and group. * src/wydawca.c (wydawca_uid, wydawca_gid) (wydawca_supp_groupc, wydawca_supp_groups): New variables. (wydawca_set_uid, wydawca_set_gid, wydawca_set_privs) (wydawca_set_triplet_privs, wydawca_set_root_privs): Remove. (main): --dry-run implies --cron. Switch to non-privileged UID/GID before startup. * src/wydawca.h (wydawca_uid, wydawca_gid) (wydawca_supp_groupc, wydawca_supp_groups): New declarations. * src/mail.c (do_notify): Duplicate admin_address, it gets freed in do_notify. * src/directive.c, src/diskio.c, src/lock.c, src/triplet.c: Update.
Diffstat (limited to 'src/wydawca.h')
1 files changed, 9 insertions, 5 deletions
diff --git a/src/wydawca.h b/src/wydawca.h
index f786271..81e6509 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -300,12 +300,16 @@ void meta_escape (struct access_method *method, void *handle,
void meta_free (struct metadef *def);
void make_default_meta (struct metadef kwexp[5], const char *user,
const char *project);
/* Global variables */
+extern uid_t wydawca_uid;
+extern gid_t wydawca_gid;
+extern size_t wydawca_supp_groupc;
+extern gid_t *wydawca_supp_groups;
extern char *conffile; /* Configuration file name */
extern int debug_level; /* Debugging level */
extern int dry_run_mode; /* Dry run indicator */
extern int log_to_stderr; /* Log to stderr instead of the syslog */
extern int log_facility; /* Syslog facility to use if !log_to_stderr */
extern char *syslog_tag; /* Syslog tag */
@@ -352,14 +356,14 @@ void logstats (void);
char *safe_file_name (char *file_name);
char *safe_file_name_alloc (const char *file_name);
size_t trim_length (const char *str);
size_t trim (char *str);
void logmsg (int prio, char *fmt, ...) GSC_PRINTFLIKE(2,3);
int test_dir (const char *name, int *ec);
-char *create_directory (const char *base, const char *name,
- uid_t uid, gid_t gid);
+char *create_directory (const char *base, const char *name);
+int create_hierarchy (char *dir, size_t baselen);
void parse_config (void);
void log_output (int prio, const char *prog, FILE *fp);
enum exec_result
exec_success, /* Command executed and returned 0 */
@@ -425,15 +429,12 @@ int directive_next (struct file_triplet *trp, int n,
const char **pkey, const char **pval);
int process_directives (struct file_triplet *trp,
const struct spool *spool);
int enabled_spool_p (const struct spool *spool);
-int wydawca_set_privs (uid_t uid, gid_t gid);
-int wydawca_set_triplet_privs (struct file_triplet *trp);
-int wydawca_set_root_privs (void);
int parse_time_interval (const char *str, time_t *pint, const char **endp);
/* config.c */
@@ -535,6 +536,9 @@ void wydawca_unlock (const char *lockname);
void wydawca_lock_init (void);
/* tcpwrap.h */
extern struct gconf_keyword tcpwrapper_kw[];
int tcpwrap_access(int fd);
+/* userprivs.c */
+int wydawca_userprivs (uid_t uid, gid_t gid, gid_t *grplist, size_t ngrp);

Return to:

Send suggestions and report system problems to the System administrator.