11void perm(
char *prefix1,
char *prefix2,
char *prefix3,
char *file,
int type,
int uid,
int gid,
int mode)
15 if (stat(file,&st) == -1) {
17 logmsg(
WHO,-99,WARN,B(prefix1,prefix2,prefix3,file,
" does not exist"));
19 logmsg(
WHO,-99,WARN,B(
"unable to stat: .../",file));
23 if ((uid != -1) && (st.st_uid != uid))
24 logmsg(
WHO,-99,WARN,B(prefix1,prefix2,prefix3,file,
" has wrong owner"));
25 if ((gid != -1) && (st.st_gid != gid))
26 logmsg(
WHO,-99,WARN,B(prefix1,prefix2,prefix3,file,
" has wrong group"));
27 if ((st.st_mode & 07777) !=
mode)
28 logmsg(
WHO,-99,WARN,B(prefix1,prefix2,prefix3,file,
" has wrong permissions"));
29 if ((st.st_mode & S_IFMT) !=
type)
30 logmsg(
WHO,-99,WARN,B(prefix1,prefix2,prefix3,file,
" has wrong type"));
33void h(
char *home,
int uid,
int gid,
int mode)
35 perm(
"",
"",
"",home,S_IFDIR,uid,gid,
mode);
38void d(
char *home,
char *subdir,
int uid,
int gid,
int mode)
40 if (chdir(home) == -1)
41 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home));
42 perm(
"",home,
"/",subdir,S_IFDIR,uid,gid,
mode);
45void p(
char *home,
char *fifo,
int uid,
int gid,
int mode)
47 if (chdir(home) == -1)
48 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home));
49 perm(
"",home,
"/",fifo,S_IFIFO,uid,gid,
mode);
52void c(
char *home,
char *subdir,
char *file,
int uid,
int gid,
int mode)
54 if (chdir(home) == -1)
55 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home));
56 if (chdir(subdir) == -1)
57 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home,
"/",subdir));
58 perm(
".../",subdir,
"/",file,S_IFREG,uid,gid,
mode);
61void z(
char *home,
char *file,
int len,
int uid,
int gid,
int mode)
63 if (chdir(home) == -1)
64 logmsg(
WHO,111,FATAL,B(
"unable to switch to; ",home));
65 perm(
"",home,
"/",file,S_IFREG,uid,gid,
mode);
void c(const char *home, const char *subdir, const char *file, int uid, int gid, int mode)
void d(const char *home, const char *subdir, int uid, int gid, int mode)
void p(char *home, char *fifo, int uid, int gid, int mode)
void perm(char *prefix1, char *prefix2, char *prefix3, char *file, int type, int uid, int gid, int mode)
void h(char *home, int uid, int gid, int mode)
void z(char *home, char *file, int len, int uid, int gid, int mode)