Lines 1-6
Link Here
|
1 |
--- ctm/ctm_pass3.c.orig 2018-10-27 15:56:22 UTC |
1 |
--- ctm/ctm_pass3.c.orig 2018-10-27 15:56:22 UTC |
2 |
+++ ctm/ctm_pass3.c |
2 |
+++ ctm/ctm_pass3.c |
3 |
@@ -35,10 +35,12 @@ Pass3(FILE *fd) |
3 |
@@ -31,14 +31,29 @@ settime(const char *name, const struct timeval *times) |
|
|
4 |
} |
5 |
|
6 |
int |
7 |
+setmodefromchar(const char *name, const u_char *modechar) |
8 |
+{ |
9 |
+ mode_t mode = 0; |
10 |
+ int i; |
11 |
+ for (i=0; modechar[i] != 0; i++) |
12 |
+ { |
13 |
+ if (modechar[i] < '0' || modechar[i] > '7') return -1; |
14 |
+ mode = 8 * mode + modechar[i] - '0'; |
15 |
+ } |
16 |
+ return chmod(name, mode); |
17 |
+} |
18 |
+ |
19 |
+int |
20 |
Pass3(FILE *fd) |
4 |
{ |
21 |
{ |
5 |
u_char *p,*q,buf[BUFSIZ]; |
22 |
u_char *p,*q,buf[BUFSIZ]; |
6 |
MD5_CTX ctx; |
23 |
MD5_CTX ctx; |
Lines 15-21
Link Here
|
15 |
struct stat st; |
32 |
struct stat st; |
16 |
char md5_1[33]; |
33 |
char md5_1[33]; |
17 |
int match=0; |
34 |
int match=0; |
18 |
@@ -131,7 +133,7 @@ Pass3(FILE *fd) |
35 |
@@ -131,7 +146,7 @@ Pass3(FILE *fd) |
19 |
WRONG |
36 |
WRONG |
20 |
found: |
37 |
found: |
21 |
for(i=0;(j = sp->List[i]);i++) { |
38 |
for(i=0;(j = sp->List[i]);i++) { |
Lines 24-30
Link Here
|
24 |
sep = ' '; |
41 |
sep = ' '; |
25 |
else |
42 |
else |
26 |
sep = '\n'; |
43 |
sep = '\n'; |
27 |
@@ -149,53 +151,98 @@ Pass3(FILE *fd) |
44 |
@@ -149,53 +164,99 @@ Pass3(FILE *fd) |
28 |
break; |
45 |
break; |
29 |
case CTM_F_Count: GETBYTECNT(cnt,sep); break; |
46 |
case CTM_F_Count: GETBYTECNT(cnt,sep); break; |
30 |
case CTM_F_Bytes: GETDATA(trash,cnt); break; |
47 |
case CTM_F_Bytes: GETDATA(trash,cnt); break; |
Lines 140-145
Link Here
|
140 |
+ WRONG |
157 |
+ WRONG |
141 |
+ } |
158 |
+ } |
142 |
+ if (settime(name,times)) WRONG |
159 |
+ if (settime(name,times)) WRONG |
|
|
160 |
+ if (setmodefromchar(name,mode)) WRONG |
143 |
+ continue; |
161 |
+ continue; |
144 |
} |
162 |
} |
145 |
- if(cnt != write(i,trash,cnt)) { |
163 |
- if(cnt != write(i,trash,cnt)) { |
Lines 159-168
Link Here
|
159 |
if(!strcmp(sp->Key,"FE")) { |
177 |
if(!strcmp(sp->Key,"FE")) { |
160 |
ed = popen("ed","w"); |
178 |
ed = popen("ed","w"); |
161 |
if(!ed) { |
179 |
if(!ed) { |
162 |
@@ -278,6 +325,8 @@ Pass3(FILE *fd) |
180 |
@@ -218,6 +279,7 @@ Pass3(FILE *fd) |
|
|
181 |
WRONG |
163 |
} |
182 |
} |
|
|
183 |
if (settime(name,times)) WRONG |
184 |
+ if (setmodefromchar(name,mode)) WRONG |
164 |
continue; |
185 |
continue; |
165 |
} |
186 |
} |
|
|
187 |
if(!strcmp(sp->Key,"FN")) { |
188 |
@@ -237,6 +299,7 @@ Pass3(FILE *fd) |
189 |
if (rename(buf,name) == -1) |
190 |
WRONG |
191 |
if (settime(name,times)) WRONG |
192 |
+ if (setmodefromchar(name,mode)) WRONG |
193 |
continue; |
194 |
} |
195 |
if(!strcmp(sp->Key,"DM")) { |
196 |
@@ -249,6 +312,7 @@ Pass3(FILE *fd) |
197 |
WRONG |
198 |
} |
199 |
if (settime(name,times)) WRONG |
200 |
+ if (setmodefromchar(name,mode)) WRONG |
201 |
continue; |
202 |
} |
203 |
if(!strcmp(sp->Key,"FR")) { |
204 |
@@ -278,6 +342,8 @@ Pass3(FILE *fd) |
205 |
} |
206 |
continue; |
207 |
} |
166 |
+ if(!strcmp(sp->Key,"TR") || !strcmp(sp->Key,"SV")) |
208 |
+ if(!strcmp(sp->Key,"TR") || !strcmp(sp->Key,"SV")) |
167 |
+ continue; |
209 |
+ continue; |
168 |
WRONG |
210 |
WRONG |