2 Proprietary Rand Corporation
, 1981.
3 Further distribution of
this software
4 subject to the terms of the Rand
12 #include <sys/types.h>
17 char *AliasFile
= MAILALIASES
;
18 char *Password
= "/etc/passwd";
19 char *MailDir
= MAILDROP
;
25 struct mailname
*m_next
;
38 while(isspace(*ptr
) || *ptr
== ',' || *ptr
== ':')
40 while(isalnum(*ptr
) || *ptr
== '/' || *ptr
== '-' || *ptr
== '.')
66 register char *cp
, **cpp
;
67 register struct mailname
*lp
;
68 register struct group
*gp
;
70 char line
[256], pbuf
[64];
72 struct group
*getgrent();
75 if(argc
== 3 && strcmp(argv
[1], "-mail") == 0)
79 if((a
= fopen(Password
, "r")) == NULL
) {
81 fprintf(out
, "Can't open password file ");
85 while(fgets(line
, sizeof line
, a
)) {
86 if(line
[0] == '\n' || line
[0] == ';')
88 cp
= parse(line
, pbuf
);
92 if((a
= fopen(AliasFile
, "r")) == NULL
) {
94 fprintf(out
, "Can't open alias file: %s\n", AliasFile
);
97 while(fgets(line
, sizeof line
, a
)) {
98 if(line
[0] == '\n' || line
[0] == ';')
100 cp
= parse(line
, pbuf
);
109 fprintf(out
, "No Alias Inconsistencies.\n");
112 fprintf(out
, "%s :: %s Collisions:\n",
113 Password
, AliasFile
);
114 fprintf(out
, "Colliding alias lines:\n");
115 for(lp
= bad
.m_next
; lp
; lp
= lp
->m_next
)
116 fprintf(out
, "%s", lp
->m_name
);
120 while(gp
= getgrent()) {
121 for(cpp
= gp
->gr_mem
; *cpp
; cpp
++)
122 if(!check(*cpp
, 1)) {
124 fprintf(out
, "Group: %s--User: %s not in /etc/passwd\n",
129 if(donecd
< 2 && out
)
130 fprintf(out
, "No extraneous group entries.\n");
132 for(lp
= users
.m_next
; lp
; lp
= lp
->m_next
)
133 if(lp
->m_seen
== 0) {
135 fprintf(out
, "User: %s not in a group.\n", lp
->m_name
);
138 if(donecd
< 3 && out
)
139 fprintf(out
, "No Users not in any group.\n");
141 if((a
= fopen(MailDir
, "r")) == NULL
) {
143 fprintf(out
, "Can't open mail directory: %s\n", MailDir
);
146 while(fread((char *)&dir
, sizeof dir
, 1, a
)) {
148 || dir
.d_name
[0] == '.'
151 if(!check(dir
.d_name
, 0)) {
153 fprintf(out
, "Mail drop: %s--Nonexistent user.\n",
160 if(donecd
< 4 && out
)
161 fprintf(out
, "No Extra mail drops.\n");
169 struct mailname
*list
;
171 register struct mailname
*mp
;
174 for(mp
= list
; mp
->m_next
; mp
= mp
->m_next
)
176 mp
->m_next
= (struct mailname
*) malloc(sizeof *mp
->m_next
);
179 mp
->m_name
= getcpy(name
);
186 register struct mailname
*mp
;
188 for(mp
= users
.m_next
; mp
; mp
= mp
->m_next
)
189 if(uleq(name
, mp
->m_name
)) {
206 out
= fdopen(pipes
[1], "w");
207 if((child
= fork()) == -1) {
208 fprintf(stderr
, "Conflict: no forks!\n");
212 VOID
close(pipes
[1]);
215 VOID
close(pipes
[0]);
216 execl("/bin/mail", "mail", mail
, 0);
217 execl("/usr/bin/mail", "mail", mail
, 0);
221 fprintf(out
, "Conflict: "