10 #define FATAL "instcheck: fatal: "
11 #define WARNING "instcheck: warning: "
13 void perm(prefix1
,prefix2
,prefix3
,file
,type
,uid
,gid
,mode
)
25 if (stat(file
,&st
) == -1) {
26 if (errno
== error_noent
)
27 strerr_warn6(WARNING
,prefix1
,prefix2
,prefix3
,file
," does not exist",0);
29 strerr_warn4(WARNING
,"unable to stat .../",file
,": ",&strerr_sys
);
33 if ((uid
!= -1) && (st
.st_uid
!= uid
))
34 strerr_warn6(WARNING
,prefix1
,prefix2
,prefix3
,file
," has wrong owner",0);
35 if ((gid
!= -1) && (st
.st_gid
!= gid
))
36 strerr_warn6(WARNING
,prefix1
,prefix2
,prefix3
,file
," has wrong group",0);
37 if ((st
.st_mode
& 07777) != mode
)
38 strerr_warn6(WARNING
,prefix1
,prefix2
,prefix3
,file
," has wrong permissions",0);
39 if ((st
.st_mode
& S_IFMT
) != type
)
40 strerr_warn6(WARNING
,prefix1
,prefix2
,prefix3
,file
," has wrong type",0);
43 void h(home
,uid
,gid
,mode
)
49 perm("","","",home
,S_IFDIR
,uid
,gid
,mode
);
52 void d(home
,subdir
,uid
,gid
,mode
)
59 if (chdir(home
) == -1)
60 strerr_die4sys(111,FATAL
,"unable to switch to ",home
,": ");
61 perm("",home
,"/",subdir
,S_IFDIR
,uid
,gid
,mode
);
64 void c(home
,subdir
,file
,uid
,gid
,mode
)
72 if (chdir(home
) == -1)
73 strerr_die4sys(111,FATAL
,"unable to switch to ",home
,": ");
74 if (chdir(subdir
) == -1)
75 strerr_die6sys(111,FATAL
,"unable to switch to ",home
,"/",subdir
,": ");
76 perm(".../",subdir
,"/",file
,S_IFREG
,uid
,gid
,mode
);