]> git.pld-linux.org Git - packages/chkconfig.git/blame - chkconfig-noxinet.patch
- drop obsolete files
[packages/chkconfig.git] / chkconfig-noxinet.patch
CommitLineData
09a63b21
AM
1--- chkconfig-1.3.37.org/chkconfig.c 2007-11-08 22:28:34.000000000 +0100
2+++ chkconfig-1.3.37/chkconfig.c 2008-04-24 09:30:17.709152778 +0200
3@@ -68,8 +68,6 @@
82df657c
ER
4 readServiceError(rc, name);
5 return 1;
6 }
7- if (s.type == TYPE_XINETD) return 0;
09a63b21 8-
82df657c 9
09a63b21
AM
10 if (!findServiceEntries(name, level, &globres)) {
11 for (i = 0; i < globres.gl_pathc; i++)
12@@ -88,7 +86,6 @@
82df657c
ER
13 readServiceError(rc, name);
14 return 1;
15 }
09a63b21
AM
16- if (s.type == TYPE_XINETD) return 0;
17
18 for (level = 0; level < 7; level++) {
19 if (!findServiceEntries(name, level, &globres)) {
20@@ -238,7 +235,6 @@
21 return 1;
22 }
23
24- if (s.type == TYPE_XINETD) return 0;
25 if (s.isLSB)
26 frobDependencies(&s);
27 else
28@@ -269,8 +265,6 @@
29 if ((rc = readServiceDifferences(name, &s, &o, 0))) {
30 return 0;
31 }
82df657c
ER
32-
33- if (s.type == TYPE_XINETD) return 0;
09a63b21
AM
34
35 if ((s.levels == o.levels) &&
36 (s.kPriority == o.kPriority) &&
37@@ -351,10 +345,6 @@
82df657c
ER
38 }
39
40 printf("%-15s", s.name);
41- if (s.type == TYPE_XINETD) {
42- printf("\t%s\n", s.levels ? _("on") : _("off"));
43- return 0;
44- }
45
09a63b21 46 for (i = 0; i < 7; i++) {
82df657c 47 printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off"));
09a63b21 48@@ -364,32 +354,10 @@
82df657c
ER
49 return 0;
50 }
51
52-static int isXinetdEnabled() {
09a63b21
AM
53- int i;
54- struct service s;
55-
56- if (readServiceInfo("xinetd", &s, 0)) {
57- return 0;
58- }
59- for (i = 0; i < 7; i++) {
60- if (isOn("xinetd", i))
61- return 1;
62- }
63- return 0;
64-}
82df657c 65-
09a63b21
AM
66 static int serviceNameCmp(const void * a, const void * b) {
67 return strcmp(* (char **)a, * (char **)b);
68 }
69
70-static int xinetdNameCmp(const void * a, const void * b) {
71- const struct service * first = a;
72- const struct service * second = b;
73-
74- return strcmp(first->name, second->name);
82df657c 75-}
82df657c 76-
09a63b21
AM
77-
78
82df657c
ER
79 static int listService(char * item) {
80 DIR * dir;
09a63b21
AM
81@@ -459,53 +427,6 @@
82
82df657c 83 closedir(dir);
09a63b21 84
82df657c 85- if (isXinetdEnabled()) {
09a63b21
AM
86- struct service *s, *t;
87-
88- printf("\n");
82df657c 89- printf(_("xinetd based services:\n"));
09a63b21
AM
90- if (!(dir = opendir(XINETDDIR))) {
91- fprintf(stderr, _("failed to open directory %s: %s\n"),
92- XINETDDIR, strerror(err));
82df657c
ER
93- return 1;
94- }
09a63b21
AM
95- numServices = 0;
96- numServicesAlloced = 10;
97- s = malloc(sizeof (*s) * numServicesAlloced);
98-
82df657c
ER
99- while ((ent = readdir(dir))) {
100- const char *dn;
82df657c
ER
101-
102- /* Skip any file starting with a . */
103- if (ent->d_name[0] == '.') continue;
104-
105- /* Skip files with known bad extensions */
106- if ((dn = strrchr(ent->d_name, '.')) != NULL &&
107- (!strcmp(dn, ".rpmsave") || !strcmp(dn, ".rpmnew") || !strcmp(dn, ".rpmorig") || !strcmp(dn, ".swp")))
108- continue;
109-
110- dn = ent->d_name + strlen(ent->d_name) - 1;
111- if (*dn == '~' || *dn == ',')
112- continue;
113-
09a63b21
AM
114- if (numServices == numServicesAlloced) {
115- numServicesAlloced += 10;
116- s = realloc(s, numServicesAlloced * sizeof (*s));
117- }
118- if (readXinetdServiceInfo(ent->d_name, s + numServices, 0) != -1)
119- numServices ++;
120- }
121-
122- qsort(s, numServices, sizeof(*s), xinetdNameCmp);
123- t = s;
124- for (i = 0; i < numServices; i++, s++) {
125- char *tmp = malloc(strlen(s->name) + 5);
126- sprintf(tmp,"%s:",s->name);
127- printf("\t%-15s\t%s\n", tmp, s->levels ? _("on") : _("off"));
82df657c
ER
128- }
129- closedir(dir);
09a63b21 130- free(t);
82df657c
ER
131- }
132 return 0;
133 }
134
09a63b21
AM
135@@ -547,11 +468,6 @@
136 rc |= doSetService(s, i, what);
82df657c 137 }
09a63b21 138 return rc;
82df657c 139- } else if (s.type == TYPE_XINETD) {
09a63b21
AM
140- if (setXinetdService(s, state)) {
141- return 1;
142- }
143- system("/etc/init.d/xinetd reload >/dev/null 2>&1");
144 }
82df657c
ER
145
146 return 0;
09a63b21
AM
147@@ -682,13 +598,7 @@
148 rc = readServiceInfo(name, &s, 0);
149 if (rc)
150 return 1;
151- if (s.type == TYPE_XINETD) {
152- if (isOn("xinetd",level))
153- return !s.levels;
154- else
155- return 1;
156- } else
157- return isOn(name, level) ? 0 : 1;
158+ return isOn(name, level) ? 0 : 1;
159 } else if (!strcmp(state, "on"))
160 return setService(name, where, 1);
161 else if (!strcmp(state, "off"))
162diff -urN chkconfig-1.3.37.org/leveldb.c chkconfig-1.3.37/leveldb.c
163--- chkconfig-1.3.37.org/leveldb.c 2007-08-03 19:57:56.000000000 +0200
27ddd8a0 164+++ chkconfig-1.3.37/leveldb.c 2008-04-24 09:34:20.447423719 +0200
09a63b21 165@@ -149,101 +149,6 @@
82df657c
ER
166 return 0;
167 }
168
169-int readXinetdServiceInfo(char *name, struct service * service, int honorHide) {
170- char * filename = alloca(strlen(name) + strlen(XINETDDIR) + 50);
171- int fd;
09a63b21
AM
172- struct service serv = {
173- name: NULL,
174- levels: -1,
175- kPriority: -1,
176- sPriority: -1,
177- desc: NULL,
178- startDeps: NULL,
179- stopDeps: NULL,
180- provides: NULL,
181- type: TYPE_XINETD,
182- isLSB: 0,
183- enabled: -1
184- };
82df657c
ER
185- struct stat sb;
186- char * buf, *ptr;
187- char * eng_desc = NULL, *start;
188-
189- snprintf(filename, strlen(name)+strlen(XINETDDIR)+50, XINETDDIR "/%s", name);
190-
191- if ((fd = open(filename, O_RDONLY)) < 0) return -1;
192- fstat(fd,&sb);
09a63b21 193- if (! S_ISREG(sb.st_mode)) return -1;
82df657c
ER
194- buf = malloc(sb.st_size+1);
195- if (read(fd,buf,sb.st_size)!=sb.st_size) {
196- close(fd);
197- free(buf);
198- return -1;
199- }
200- close(fd);
201- serv.name = strdup(name);
202- buf[sb.st_size] = '\0';
203- start = buf;
204- while (buf) {
205- ptr = strchr(buf,'\n');
206- if (*buf == '#') {
207- buf++;
208- while (isspace(*buf) && buf < ptr) buf++;
209- if (!strncmp(buf,"default:", 9)) {
210- buf+=8;
211- while(isspace(*buf)) buf++;
212- if (!strncmp(buf+9,"on",2)) {
213- serv.enabled = 1;
214- } else {
215- serv.enabled = 0;
216- }
217- } else if (!strncmp(buf,"description:",12)) {
218- buf+=11;
219- if (readDescription(buf,start+sb.st_size,
220- &serv.desc,&eng_desc)) {
221- if (serv.desc) free(serv.desc);
222- }
223- if (!serv.desc) {
224- if (eng_desc)
225- serv.desc = eng_desc;
226- } else if (eng_desc)
227- free (eng_desc);
228- }
229- if (ptr) {
230- *ptr = '\0';
231- ptr++;
232- }
233- buf = ptr;
234- continue;
235- }
236- while (isspace(*buf) && buf < ptr) buf++;
237- if (!strncmp(buf,"disable", 7)) {
238- buf = strstr(buf,"=");
239- if (buf)
240- do {
241- buf++;
242- } while(isspace(*buf));
243-
244- if (buf && strncmp(buf,"yes",3)) {
245- serv.levels = parseLevels("0123456",0);
246- if (serv.enabled == -1)
247- serv.enabled = 1;
248- } else {
249- serv.levels = 0;
250- if (serv.enabled == -1)
251- serv.enabled = 0;
252- }
253- }
254- if (ptr) {
255- *ptr = '\0';
256- ptr++;
257- }
258- buf = ptr;
259- }
260- *service = serv;
261- return 0;
262-}
263-
264 int readServiceInfo(char * name, struct service * service, int honorHide) {
09a63b21 265 char * filename = alloca(strlen(name) + strlen(RUNLEVELS) + 50);
82df657c 266 int fd;
27ddd8a0
AM
267@@ -253,7 +158,7 @@
268 sprintf(filename, RUNLEVELS "/init.d/%s", name);
269
270 if ((fd = open(filename, O_RDONLY)) < 0) {
271- return readXinetdServiceInfo(name,service,honorHide);
272+ return -1;
273 }
274
275 parseret = parseServiceInfo(fd, name, &serv, honorHide, 0);
276@@ -290,7 +195,7 @@
277 sprintf(filename, RUNLEVELS "/init.d/%s", name);
278
279 if ((fd = open(filename, O_RDONLY)) < 0) {
280- return readXinetdServiceInfo(name,service,honorHide);
281+ return -1;
282 }
283
284 parseret = parseServiceInfo(fd, name, &serv, honorHide, 0);
09a63b21 285@@ -656,60 +561,6 @@
82df657c
ER
286 return 1;
287 }
288
289-int setXinetdService(struct service s, int on) {
290- int oldfd, newfd;
291- char oldfname[100], newfname[100];
292- char tmpstr[50];
293- char *buf, *ptr, *tmp;
294- struct stat sb;
295-
296- if (on == -1) {
297- on = s.enabled ? 1 : 0;
298- }
299- snprintf(oldfname,100,"%s/%s",XINETDDIR,s.name);
300- if ( (oldfd = open(oldfname,O_RDONLY)) == -1 ) {
301- return -1;
302- }
303- fstat(oldfd,&sb);
304- buf = malloc(sb.st_size+1);
305- if (read(oldfd,buf,sb.st_size)!=sb.st_size) {
306- close(oldfd);
307- free(buf);
308- return -1;
309- }
310- close(oldfd);
311- buf[sb.st_size] = '\0';
312- snprintf(newfname,100,"%s/%s.XXXXXX",XINETDDIR,s.name);
313- newfd = mkstemp(newfname);
314- if (newfd == -1) {
315- free(buf);
316- return -1;
317- }
318- while (buf) {
319- tmp = buf;
320- ptr = strchr(buf,'\n');
321- if (ptr) {
322- *ptr = '\0';
323- ptr++;
324- }
325- while (isspace(*buf)) buf++;
326- if (strncmp(buf,"disable", 7) && strlen(buf)) {
327- write(newfd,tmp,strlen(tmp));
328- write(newfd,"\n",1);
329- if (buf[0] == '{') {
330- snprintf(tmpstr,50,"\tdisable\t= %s", on ? "no" : "yes");
331- write(newfd,tmpstr,strlen(tmpstr));
332- write(newfd,"\n",1);
333- }
334- }
335- buf = ptr;
336- }
337- close(newfd);
338- chmod(newfname,0644);
339- unlink(oldfname);
340- return(rename(newfname,oldfname));
341-}
342-
343 int doSetService(struct service s, int level, int on) {
344 int priority = on ? s.sPriority : s.kPriority;
345 char linkname[200];
27ddd8a0
AM
346diff -urN chkconfig-1.3.37.org/ntsysv.c chkconfig-1.3.37/ntsysv.c
347--- chkconfig-1.3.37.org/ntsysv.c 2007-08-03 19:57:56.000000000 +0200
348+++ chkconfig-1.3.37/ntsysv.c 2008-04-24 09:34:50.485526379 +0200
349@@ -131,16 +131,10 @@
350 if (!update) return 1;
351
352 for (i = 0; i < numServices; i++) {
353- if (services[i].type == TYPE_XINETD) {
354- if ((services[i].enabled && states[i] != '*') ||
355- (!services[i].enabled && states[i] == '*'))
356- setXinetdService(services[i], states[i] == '*');
357- } else {
358 for (j = 0; j < 7; j++) {
359 if (levels & (1 << j))
360 doSetService(services[i], j, states[i] == '*');
361 }
362- }
363 }
364
365 return 0;
366@@ -217,49 +211,6 @@
367
368 closedir(dir);
369
370- if (!stat("/usr/sbin/xinetd",&sb)) {
371- if (!(dir = opendir(XINETDDIR))) {
372- fprintf(stderr, "failed to open " XINETDDIR ": %s\n",
373- strerror(errno));
374- return 2;
375- }
376-
377- while ((ent = readdir(dir))) {
378- if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') ||
379- strchr(ent->d_name, '.')) continue;
380-
381- sprintf(fn, "%s/%s", XINETDDIR, ent->d_name);
382- if (stat(fn, &sb))
383- {
384- err = errno;
385- continue;
386- }
387- if (!S_ISREG(sb.st_mode)) continue;
388-
389- if (numServices == numServicesAlloced) {
390- numServicesAlloced += 10;
391- services = realloc(services,
392- numServicesAlloced * sizeof(*services));
393- }
394-
395- rc = readXinetdServiceInfo(ent->d_name, services + numServices, honorHide);
396-
397- if (rc == -1) {
398- fprintf(stderr, _("error reading info for service %s: %s\n"),
399- ent->d_name, strerror(errno));
400- closedir(dir);
401- return 2;
402- } else if (!rc)
403- numServices++;
404- }
405-
406- if (err) {
407- fprintf(stderr, _("error reading from directory %s: %s\n"),
408- XINETDDIR, strerror(err));
409- return 1;
410- }
411- }
412-
413 qsort(services, numServices, sizeof(*services), serviceNameCmp);
414
415 *servicesPtr = services;
564d2f1f
ER
416--- chkconfig-1.3.37/chkconfig.8~ 2007-11-08 23:28:34.000000000 +0200
417+++ chkconfig-1.3.37/chkconfig.8 2008-04-24 10:48:07.171320486 +0300
418@@ -63,11 +63,6 @@
419 an already-started service, and will not re-stop a service that is
420 not running.
421
422-\fBchkconfig\fR also can manage xinetd scripts via the means
423-of xinetd.d configuration files. Note that only the
424-\fBon\fR, \fBoff\fR, and \fB-\-list\fR commands are supported
425-for xinetd.d services.
426-
427 .SH OPTIONS
428 .TP
429 \fB-\-level \fIlevels\fR
This page took 0.130905 seconds and 4 git commands to generate.