15void h(
char *home,
int uid,
int gid,
int mode)
17 if (mkdir(home,0700) == -1)
19 logmsg(
WHO,111,FATAL,B(
"unable to mkdir: ",home));
20 if (chown(home,uid,gid) == -1)
21 logmsg(
WHO,111,FATAL,B(
"unable to chown: ",home));
22 if (chmod(home,
mode) == -1)
23 logmsg(
WHO,111,FATAL,B(
"unable to chmod: ",home));
26void d(
char *home,
char *subdir,
int uid,
int gid,
int mode)
28 if (chdir(home) == -1)
29 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home));
30 if (mkdir(subdir,0700) == -1)
32 logmsg(
WHO,111,FATAL,B(
"unable to mkdir: ",home,
"/",subdir));
33 if (chown(subdir,uid,gid) == -1)
34 logmsg(
WHO,111,FATAL,B(
"unable to chown: ",home,
"/",subdir));
35 if (chmod(subdir,
mode) == -1)
36 logmsg(
WHO,111,FATAL,B(
"unable to chmod: ",home,
"/",subdir));
44void c(
char *home,
char *subdir,
char *file,
int uid,
int gid,
int mode)
50 logmsg(
WHO,111,FATAL,
"unable to switch back to source directory");
52 fdin = open_read(file);
54 logmsg(
WHO,111,FATAL,B(
"unable to read: ",file));
57 if (chdir(home) == -1)
58 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home));
59 if (chdir(subdir) == -1)
60 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home,
"/",subdir));
62 fdout = open_trunc(file);
64 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
69 logmsg(
WHO,111,FATAL,B(
"unable to read: ",file));
71 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
75 if (buffer_flush(&
ssout) == -1)
76 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
77 if (fsync(fdout) == -1)
78 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
79 if (close(fdout) == -1)
80 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
82 if (chown(file,uid,gid) == -1)
83 logmsg(
WHO,111,FATAL,B(
"unable to chown: .../",subdir,
"/",file));
84 if (chmod(file,
mode) == -1)
85 logmsg(
WHO,111,FATAL,B(
"unable to chmod: .../",subdir,
"/",file));
88void z(
char *home,
char *subdir,
char *file,
int len,
int uid,
int gid,
int mode)
92 if (chdir(home) == -1)
93 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home));
94 if (chdir(subdir) == -1)
95 logmsg(
WHO,111,FATAL,B(
"unable to switch to: ",home,
"/",subdir));
97 fdout = open_trunc(file);
99 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
103 if (buffer_put(&
ssout,
"",1) == -1)
104 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
106 if (buffer_flush(&
ssout) == -1)
107 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
108 if (fsync(fdout) == -1)
109 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
110 if (close(fdout) == -1)
111 logmsg(
WHO,111,FATAL,B(
"unable to write: .../",subdir,
"/",file));
113 if (chown(file,uid,gid) == -1)
114 logmsg(
WHO,111,FATAL,B(
"unable to chown: .../",subdir,
"/",file));
115 if (chmod(file,
mode) == -1)
116 logmsg(
WHO,111,FATAL,B(
"unable to chmod: .../",subdir,
"/",file));
123 logmsg(
WHO,111,FATAL,
"unable to open current directory");
void d(char *home, char *subdir, int uid, int gid, int mode)
void c(char *home, char *subdir, char *file, int uid, int gid, int mode)
void z(char *home, char *subdir, char *file, int len, int uid, int gid, int mode)
void h(char *home, int uid, int gid, int mode)
char outbuf[BUFFER_OUTSIZE]