1
/* ========================================================================
2
* Copyright 1988-2006 University of Washington
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
11
* ========================================================================
15
* Program: UNIX environment routines
17
* Author: Mark Crispin
18
* Networks and Distributed Computing
19
* Computing & Communications
20
* University of Washington
21
* Administration Building, AG-44
23
* Internet: MRC@CAC.Washington.EDU
26
* Last Edited: 30 August 2006
30
typedef struct dotlock_base {
31
char lock[MAILTMPLEN];
37
/* Bits that can be set in restrictBox */
39
#define RESTRICTROOT 0x1 /* restricted box doesn't allow root */
40
#define RESTRICTOTHERUSER 0x2 /* restricted box doesn't allow other user */
42
/* Subscription definitions for UNIX */
44
#define SUBSCRIPTIONFILE(t) sprintf (t,"%s/.mailboxlist",myhomedir ())
45
#define SUBSCRIPTIONTEMP(t) sprintf (t,"%s/.mlbxlsttmp",myhomedir ())
50
#define SYSCONFIG "/etc/c-client.cf"
55
#define ANONYMOUSUSER "nobody" /* anonymous user */
56
#define UNLOGGEDUSER "root" /* unlogged-in user */
57
#define ADMINGROUP "mailadm" /* mail administrator group */
59
/* Function prototypes */
63
void rfc822_fixed_date (char *date);
64
long env_init (char *user,char *home);
65
char *myusername_full (unsigned long *flags);
67
#define MU_NOTLOGGEDIN 1
68
#define MU_ANONYMOUS 2
69
#define myusername() \
72
char *mailboxdir (char *dst,char *dir,char *name);
73
long dotlock_lock (char *file,DOTLOCK *base,int fd);
74
long dotlock_unlock (DOTLOCK *base);
75
int lockname (char *lock,char *fname,int op,long *pid);
76
int lockfd (int fd,char *lock,int op);
77
int lock_work (char *lock,void *sbuf,int op,long *pid);
78
long chk_notsymlink (char *name,void *sbuf);
79
void unlockfd (int fd,char *lock);
80
long set_mbx_protections (char *mailbox,char *path);
81
long get_dir_protection (char *mailbox);
82
MAILSTREAM *user_flags (MAILSTREAM *stream);
83
char *default_user_flag (unsigned long i);
84
void dorc (char *file,long flag);
85
long path_create (MAILSTREAM *stream,char *mailbox);
86
void grim_pid_reap_status (int pid,int killreq,void *status);
87
#define grim_pid_reap(pid,killreq) \
88
grim_pid_reap_status (pid,killreq,NIL)
89
long safe_write (int fd,char *buf,long nbytes);
90
void *arm_signal (int sig,void *action);
91
struct passwd *checkpw (struct passwd *pw,char *pass,int argc,char *argv[]);
92
long loginpw (struct passwd *pw,int argc,char *argv[]);
93
long pw_login (struct passwd *pw,char *auser,char *user,char *home,int argc,
95
void *mm_blocknotify (int reason,void *data);