summaryrefslogtreecommitdiff
path: root/net/sup/files/patch-ac
blob: 9c8a3dd25b4905464c6a6ecef604ff88499e853f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
Index: expand.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/lib/expand.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- expand.c	1995/12/26 04:54:46	1.1.1.1
+++ expand.c	1996/09/24 08:08:06	1.2
@@ -61,7 +61,7 @@
  */
 #include <sys/param.h>
 #include <sys/stat.h>
-#include <sys/dir.h>
+#include <dirent.h>
 #include <pwd.h>
 #include <ctype.h>
 #include <libc.h>
@@ -159,7 +159,7 @@
 static matchdir(pattern)
 	char *pattern;
 {
-	register struct direct *dp;
+	register struct dirent *dp;
 	DIR *dirp;
 
 	dirp = opendir(path);
Index: scan.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/lib/scan.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- scan.c	1995/12/26 05:10:59	1.3
+++ scan.c	1996/09/24 08:08:11	1.4
@@ -104,8 +110,8 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/stat.h>
-#include <sys/dir.h>
 #include <sys/file.h>
+#include <dirent.h>
 #include "sup.h"
 
 /*************************
@@ -714,7 +720,7 @@
 char *name;
 int always;
 {
-	struct direct *dentry;
+	struct dirent *dentry;
 	register DIR *dirp;
 	char ename[STRINGLENGTH],newname[STRINGLENGTH],filename[STRINGLENGTH];
 	register char *p,*newp;
Index: scm.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/lib/scm.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- scm.c	1995/12/26 05:02:49	1.2
+++ scm.c	1996/09/06 16:08:32	1.3
@@ -271,6 +280,8 @@
 		return (scmerr (errno, stderr, "Can't create socket for connections"));
 	if (setsockopt (sock,SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof(int)) < 0)
 		(void) scmerr (errno, stderr, "Can't set SO_REUSEADDR socket option");
+	if (setsockopt (sock,SOL_SOCKET,SO_KEEPALIVE,(char *)&one,sizeof(int)) < 0)
+		(void) scmerr (errno, stderr, "Can't set SO_KEEPALIVE socket option");
 	(void) bzero ((char *)&sin,sizeof(sin));
 	sin.sin_family = AF_INET;
 	sin.sin_port = port;
Index: supcmeat.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/sup/supcmeat.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- supcmeat.c	1995/12/26 05:03:05	1.2
+++ supcmeat.c	1996/10/30 23:58:07	1.3
@@ -325,7 +331,7 @@
 	/* If protocol is > 7 then try compression */
 	if (protver > 7) {
 		cancompress = TRUE;
-		notify ("SUP Fileserver supports compression.\n");
+		vnotify ("SUP Fileserver supports compression.\n");
 	}
 	return (FALSE);
 }
@@ -635,7 +641,7 @@
 denyone (t)
 register TREE *t;
 {
-	vnotify ("SUP: Access denied to %s\n",t->Tname);
+	notify ("SUP: Access denied to %s\n",t->Tname);
 	return (SCMOK);
 }
 
Index: supcmisc.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/sup/supcmisc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- supcmisc.c	1995/12/26 04:54:46	1.1.1.1
+++ supcmisc.c	1996/10/31 00:03:14	1.3
@@ -277,7 +287,7 @@
 #endif
 	char buf[STRINGLENGTH];
 	char collrelname[STRINGLENGTH];
-	long tloc;
+	time_t tloc;
 	static FILE *noteF = NULL;	/* mail program on pipe */
 	va_list ap;
 
@@ -300,7 +310,7 @@
 	
 	if (noteF == NULL) {
 		if ((thisC->Cflags&CFMAIL) && thisC->Cnotify) {
-			(void) sprintf (buf,"mail -s \"SUP Upgrade of %s\" %s >/dev/null",
+			(void) sprintf (buf,"/usr/bin/mail -s \"SUP Upgrade of %s\" %s >/dev/null",
 				collrelname,thisC->Cnotify);
 			noteF = popen (buf,"w");
 			if (noteF == NULL) {
@@ -310,7 +320,7 @@
 			}
 		} else
 			noteF = stdout;
-		tloc = time ((long *)NULL);
+		tloc = time ((time_t *)NULL);
 		fprintf (noteF,"SUP Upgrade of %s at %s",
 			collrelname,ctime (&tloc));
 		(void) fflush (noteF);
Index: supfilesrv.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/supfilesrv/supfilesrv.c,v
retrieving revision 1.4
retrieving revision 1.6
diff -u -r1.4 -r1.6
--- supfilesrv.c	1996/02/06 19:03:58	1.4
+++ supfilesrv.c	1996/09/24 08:43:04	1.6
@@ -268,7 +288,6 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/file.h>
-#include <sys/dir.h>
 #if	MACH
 #include <sys/ioctl.h>
 #endif
@@ -1233,6 +1252,7 @@
 	register int fdtmp;
 	char sys_com[STRINGLENGTH], temp_file[STRINGLENGTH], rcs_file[STRINGLENGTH];
         union wait status;
+	int wstat;
 	char *uconvert(),*gconvert();
 	int sendfile ();
 
@@ -1300,15 +1320,54 @@
 #endif
                         if (fd == -1) {
                                 if (docompress) {
-                                        tmpnam(temp_file);
-                                        sprintf(sys_com, "gzip -c < %s > %s\n", t->Tname, temp_file);
-                                        if (system(sys_com) != 0) {
-                                                /* Just in case */
-                                                unlink(temp_file);
-                                                goaway ("We died trying to \"%s\"", sys_com);
-                                                t->Tmode = 0;
-                                        }
-                                        fd = open (temp_file,O_RDONLY,0);
+					FILE *tf;
+					int pid;
+					int i;
+
+					tf = tmpfile();
+					if (tf == NULL) {
+						goaway("no temp file");
+						t->Tmode = 0;
+						goto out;
+					}
+					pid = fork();
+					switch (pid) {
+					case -1:	/* fail */
+						goaway("Could not fork");
+						t->Tmode = 0;
+						fclose(tf);
+						break;
+					case 0:		/* child */
+						close(1);
+						dup(fileno(tf));/* write end */
+						for(i = 3; i < 64; i++)
+							close(i);
+						execl("/usr/bin/gzip", "sup-gzip", "-c", t->Tname, 0);
+						execl("/usr/local/bin/gzip", "sup-gzip", "-c", t->Tname, 0);
+						execlp("gzip", "sup-gzip", "-c", t->Tname, 0);
+						perror("gzip");
+						_exit(1); /* pipe breaks */
+					default:	/* parent */
+						wait(&wstat);
+						if (WIFEXITED(wstat) &&
+						    WEXITSTATUS(wstat) > 0) {
+							fclose(tf);
+							goaway("gzip failed!");
+							t->Tmode = 0;
+							goto out;
+						}
+						if (WIFSIGNALED(wstat)) {
+							fclose(tf);
+							goaway("gzip died!");
+							t->Tmode = 0;
+							goto out;
+						}
+						fd = dup(fileno(tf));
+						fclose(tf);
+						lseek(fd, 0, 0);
+						break;
+					}
+			out:
                                 }
                                 else
                                         fd = open (t->Tname,O_RDONLY,0);