]> git.pld-linux.org Git - packages/chkconfig.git/blob - chkconfig-noxinet.patch
- noxinet patch to remove xinetd stuff - we use rc-inetd instead
[packages/chkconfig.git] / chkconfig-noxinet.patch
1 diff -Nur chkconfig-1.2.16.orig/chkconfig.c chkconfig-1.2.16/chkconfig.c
2 --- chkconfig-1.2.16.orig/chkconfig.c   Sat Mar 24 14:51:20 2001
3 +++ chkconfig-1.2.16/chkconfig.c        Sat Mar 24 15:15:33 2001
4 @@ -52,7 +52,6 @@
5         readServiceError(rc, name);
6         return 1;
7      }
8 -    if (s.type == TYPE_XINETD) return 0;
9  
10      for (level = 0; level < 7; level++) {
11             if (!findServiceEntries(name, level, &globres)) {
12 @@ -73,8 +72,6 @@
13         return 1;
14      }
15         
16 -    if (s.type == TYPE_XINETD) return 0;
17 -    
18      for (i = 0; i < 7; i++) {
19             if ((1 << i) & s.levels)
20                 doSetService(s, i, 1);
21 @@ -97,10 +94,6 @@
22      }
23  
24      printf("%-15s", s.name);
25 -    if (s.type == TYPE_XINETD) {
26 -           printf("\t%s\n", s.levels ? _("on") : _("off"));
27 -           return 0;
28 -    }
29  
30      for (i = 0; i < 7; i++) {
31         printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off"));
32 @@ -110,21 +103,6 @@
33      return 0;
34  }
35  
36 -static int isXinetdEnabled() {
37 -       int i;
38 -       struct service s;
39 -       
40 -       if (readServiceInfo("xinetd", &s, 0)) {
41 -               return 0;
42 -       }
43 -       for (i = 0; i < 7; i++) {
44 -               if (isOn("xinetd", i))
45 -                 return 1;
46 -       }
47 -       return 0;
48 -}
49 -       
50 -
51  static int listService(char * item) {
52      DIR * dir;
53      struct dirent * ent;
54 @@ -176,34 +154,6 @@
55  
56      closedir(dir);
57         
58 -    if (isXinetdEnabled()) {
59 -           printf(_("xinetd based services:\n"));
60 -           if (!(dir = opendir(XINETDDIR))) {
61 -                   fprintf(stderr, _("failed to open directory %s: %s"),
62 -                           XINETDDIR, strerror(err));
63 -                   return 1;
64 -           }
65 -           while ((ent = readdir(dir))) {
66 -                   const char *dn;
67 -                   struct service s;
68 -
69 -                   /* Skip any file starting with a . */
70 -                   if (ent->d_name[0] == '.')  continue;
71 -
72 -                   /* Skip files with known bad extensions */
73 -                   if ((dn = strrchr(ent->d_name, '.')) != NULL &&
74 -                       (!strcmp(dn, ".rpmsave") || !strcmp(dn, ".rpmorig") || !strcmp(dn, ".swp")))
75 -                     continue;
76 -
77 -                   dn = ent->d_name + strlen(ent->d_name) - 1;
78 -                   if (*dn == '~' || *dn == ',')
79 -                     continue;
80 -           
81 -                   readXinetdServiceInfo(ent->d_name, &s, 0);
82 -                   printf("\t%s:\t%s\n", s.name, s.levels ? _("on") : _("off"));
83 -           }
84 -           closedir(dir);
85 -    }
86      return 0;
87  }
88  
89 @@ -225,21 +175,16 @@
90         return 1;
91      }
92  
93 -    if (s.type == TYPE_INIT_D) {
94 -           for (i = 0; i < 7; i++) {
95 -                   if (!((1 << i) & where)) continue;
96 -
97 -                   if (state == 1 || state == 0)
98 -                     what = state;
99 -                   else if (s.levels & (1 << i))
100 -                     what = 1;
101 -                   else
102 -                     what = 0;
103 -                   doSetService(s, i, what);
104 -           }
105 -    } else if (s.type == TYPE_XINETD) {
106 -           setXinetdService(s, state);
107 -           system("/etc/init.d/xinetd reload >/dev/null 2>&1");
108 +    for (i = 0; i < 7; i++) {
109 +           if (!((1 << i) & where)) continue;
110 +
111 +           if (state == 1 || state == 0)
112 +             what = state;
113 +           else if (s.levels & (1 << i))
114 +             what = 1;
115 +           else
116 +             what = 0;
117 +           doSetService(s, i, what);
118      }
119  
120      return 0;
121 diff -Nur chkconfig-1.2.16.orig/leveldb.c chkconfig-1.2.16/leveldb.c
122 --- chkconfig-1.2.16.orig/leveldb.c     Sat Mar 24 14:51:20 2001
123 +++ chkconfig-1.2.16/leveldb.c  Sat Mar 24 15:17:14 2001
124 @@ -138,88 +138,6 @@
125         return 0;
126  }
127  
128 -int readXinetdServiceInfo(char *name, struct service * service, int honorHide) {
129 -       char * filename = alloca(strlen(name) + strlen(XINETDDIR) + 50);
130 -       int fd;
131 -       struct service serv = { NULL, -1, -1, -1, NULL, 1, -1 };
132 -       struct stat sb;
133 -       char * buf, *ptr;
134 -       char * eng_desc = NULL, *start;
135 -       
136 -       snprintf(filename, strlen(name)+strlen(XINETDDIR)+50, XINETDDIR "/%s", name);
137 -       
138 -       if ((fd = open(filename, O_RDONLY)) < 0) return -1;
139 -       fstat(fd,&sb);
140 -       buf = malloc(sb.st_size+1);
141 -       if (read(fd,buf,sb.st_size)!=sb.st_size) {
142 -               close(fd);
143 -               free(buf);
144 -               return -1;
145 -       }
146 -       close(fd);
147 -        serv.name = strdup(name);
148 -       buf[sb.st_size] = '\0';
149 -       start = buf;
150 -       while (buf) {
151 -               ptr = strchr(buf,'\n');
152 -               if (*buf == '#') {
153 -                       buf++;
154 -                       while (isspace(*buf) && buf < ptr) buf++;
155 -                       if (!strncmp(buf,"default:", 9)) {
156 -                               buf+=8;
157 -                               while(isspace(*buf)) buf++;
158 -                               if (!strncmp(buf+9,"on",2)) {
159 -                                       serv.enabled = 1;
160 -                               } else {
161 -                                       serv.enabled = 0;
162 -                               }
163 -                       } else if (!strncmp(buf,"description:",12)) {
164 -                               buf+=11;
165 -                               if (readDescription(buf,start+sb.st_size,
166 -                                                   &serv.desc,&eng_desc)) {
167 -                                       if (serv.desc) free(serv.desc);
168 -                               }
169 -                               if (!serv.desc) {
170 -                                       if (eng_desc)
171 -                                         serv.desc = eng_desc;
172 -                               } else if (eng_desc)
173 -                                         free (eng_desc);
174 -                       }
175 -                       if (ptr) {
176 -                               *ptr = '\0';
177 -                               ptr++;
178 -                       } 
179 -                       buf = ptr;
180 -                       continue;
181 -               }
182 -               while (isspace(*buf) && buf < ptr) buf++;
183 -               if (!strncmp(buf,"disable", 7)) {
184 -                       buf = strstr(buf,"=");
185 -                       if (buf) 
186 -                         do {
187 -                                 buf++;
188 -                         } while(isspace(*buf));
189 -
190 -                       if (buf && strncmp(buf,"yes",3)) {
191 -                               serv.levels = parseLevels("0123456",0);
192 -                               if (serv.enabled == -1)
193 -                                 serv.enabled = 1;
194 -                       } else {
195 -                               serv.levels = 0;
196 -                               if (serv.enabled == -1)
197 -                                 serv.enabled = 0;
198 -                       }
199 -               }
200 -               if (ptr) {
201 -                       *ptr = '\0';
202 -                       ptr++;
203 -               } 
204 -               buf = ptr;
205 -       }
206 -       *service = serv;
207 -       return 0;
208 -}
209 -
210  int readServiceInfo(char * name, struct service * service, int honorHide) {
211      char * filename = alloca(strlen(name) + strlen(RUNLEVELS) + 50);
212      int fd;
213 @@ -236,7 +154,7 @@
214      sprintf(filename, RUNLEVELS "/init.d/%s", name);
215  
216      if ((fd = open(filename, O_RDONLY)) < 0) {
217 -           return readXinetdServiceInfo(name,service,honorHide);
218 +           return -1;
219      }
220      fstat(fd, &sb);
221  
222 @@ -418,60 +336,6 @@
223  
224      globfree(&globres);
225      return 1;
226 -}
227 -
228 -int setXinetdService(struct service s, int on) {
229 -       int oldfd, newfd;
230 -       char oldfname[100], newfname[100];
231 -       char tmpstr[50];
232 -       char *buf, *ptr, *tmp;
233 -       struct stat sb;
234 -       
235 -       if (on == -1) {
236 -               on = s.enabled ? 1 : 0;
237 -       }
238 -       snprintf(oldfname,100,"%s/%s",XINETDDIR,s.name);
239 -       if ( (oldfd = open(oldfname,O_RDONLY)) == -1 ) {
240 -               return -1;
241 -       }
242 -       fstat(oldfd,&sb);
243 -       buf = malloc(sb.st_size+1);
244 -       if (read(oldfd,buf,sb.st_size)!=sb.st_size) {
245 -               close(oldfd);
246 -               free(buf);
247 -               return -1;
248 -       }
249 -       close(oldfd);
250 -       buf[sb.st_size] = '\0';
251 -       snprintf(newfname,100,"%s/%s.XXXXXX",XINETDDIR,s.name);
252 -       newfd = mkstemp(newfname);
253 -       if (newfd == -1) {
254 -               free(buf);
255 -               return -1;
256 -       }
257 -       while (buf) {
258 -               tmp = buf;
259 -               ptr = strchr(buf,'\n');
260 -               if (ptr) {
261 -                       *ptr = '\0';
262 -                       ptr++;
263 -               } 
264 -               while (isspace(*buf)) buf++;
265 -               if (strncmp(buf,"disable", 7)) {
266 -                       write(newfd,tmp,strlen(tmp));
267 -                       write(newfd,"\n",1);
268 -                       if (buf[0] == '{') {
269 -                               snprintf(tmpstr,50,"\tdisable\t= %s", on ? "no" : "yes");
270 -                               write(newfd,tmpstr,strlen(tmpstr));
271 -                               write(newfd,"\n",1);
272 -                       }
273 -               }
274 -               buf = ptr;
275 -       }
276 -       close(newfd);
277 -       chmod(newfname,0644);
278 -       unlink(oldfname);
279 -       return(rename(newfname,oldfname));
280  }
281  
282  int doSetService(struct service s, int level, int on) {
283 diff -Nur chkconfig-1.2.16.orig/leveldb.h chkconfig-1.2.16/leveldb.h
284 --- chkconfig-1.2.16.orig/leveldb.h     Sat Mar 24 14:51:20 2001
285 +++ chkconfig-1.2.16/leveldb.h  Sat Mar 24 15:14:46 2001
286 @@ -2,12 +2,10 @@
287  #define H_LEVELDB
288  
289  #define RUNLEVELS "/etc/rc.d"
290 -#define XINETDDIR "/etc/xinetd.d"
291  
292  #include <glob.h>
293  
294  #define TYPE_INIT_D    0
295 -#define TYPE_XINETD    1
296  
297  struct service {
298      char * name;
299 @@ -27,7 +25,5 @@
300  int isConfigured(char * name, int level);
301  int doSetService(struct service s, int level, int on);
302  int findServiceEntries(char * name, int level, glob_t * globresptr);
303 -int readXinetdServiceInfo(char *name, struct service *service, int honorHide);
304 -int setXinetdService(struct service s, int on);
305  
306  #endif
307 diff -Nur chkconfig-1.2.16.orig/ntsysv.c chkconfig-1.2.16/ntsysv.c
308 --- chkconfig-1.2.16.orig/ntsysv.c      Wed Aug 16 22:04:28 2000
309 +++ chkconfig-1.2.16/ntsysv.c   Sat Mar 24 15:14:46 2001
310 @@ -40,20 +40,14 @@
311      states = alloca(sizeof(*states) * numServices);
312      
313      for (i = 0; i < numServices; i++) {
314 -       if (services[i].type == TYPE_XINETD) {
315 -               checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
316 -                                    services[i].levels ? '*' : ' ', NULL, 
317 -                                    states + i);
318 -       } else {
319 -               for (j = 0; j < 7; j++) {
320 -                       if (levels & (1 << j)) {
321 -                               if (isOn(services[i].name, j)) break;
322 -                       }
323 +       for (j = 0; j < 7; j++) {
324 +               if (levels & (1 << j)) {
325 +                       if (isOn(services[i].name, j)) break;
326                 }
327 -               checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
328 -                                            (j != 7) ? '*' : ' ', NULL, 
329 -                                            states + i);
330         }
331 +       checkboxes[i] = newtCheckbox(-1, i, services[i].name, 
332 +                                    (j != 7) ? '*' : ' ', NULL, 
333 +                                    states + i);
334         newtFormAddComponent(subform, checkboxes[i]);
335      }
336  
337 @@ -110,13 +104,9 @@
338      if (!update) return 1;
339  
340      for (i = 0; i < numServices; i++) {
341 -      if (services[i].type == TYPE_XINETD)
342 -             setXinetdService(services[i], states[i] == '*');
343 -      else {
344 -             for (j = 0; j < 7; j++) {
345 -                     if (levels & (1 << j))
346 -                       doSetService(services[i], j, states[i] == '*');
347 -             }
348 +      for (j = 0; j < 7; j++) {
349 +             if (levels & (1 << j))
350 +               doSetService(services[i], j, states[i] == '*');
351        }
352      }
353  
354 @@ -186,47 +176,6 @@
355      }
356  
357      closedir(dir);
358 -
359 -    if (!(dir = opendir(XINETDDIR))) {
360 -       fprintf(stderr, "failed to open " XINETDDIR ": %s\n",
361 -               strerror(errno));
362 -        return 2;
363 -    }
364 -
365 -    while ((ent = readdir(dir))) {
366 -       if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') ||
367 -           strchr(ent->d_name, '.')) continue;
368 -
369 -       sprintf(fn, "%s/%s", XINETDDIR, ent->d_name);
370 -       if (stat(fn, &sb))
371 -       {
372 -               err = errno;
373 -               continue;
374 -       }
375 -       if (!S_ISREG(sb.st_mode)) continue;
376 -
377 -       if (numServices == numServicesAlloced) {
378 -           numServicesAlloced += 10;
379 -           services = realloc(services, 
380 -                               numServicesAlloced * sizeof(*services));
381 -       }
382 -
383 -       rc = readXinetdServiceInfo(ent->d_name, services + numServices, honorHide);
384 -       
385 -       if (rc == -1) {
386 -           fprintf(stderr, _("error reading info for service %s: %s\n"),
387 -                       ent->d_name, strerror(errno));
388 -           closedir(dir);
389 -           return 2;
390 -       } else if (!rc)
391 -           numServices++;
392 -    }
393 -
394 -    if (err) {
395 -       fprintf(stderr, _("error reading from directory %s: %s\n"),
396 -               XINETDDIR, strerror(err));
397 -        return 1;
398 -    }
399  
400      qsort(services, numServices, sizeof(*services), serviceNameCmp);
401  
This page took 0.174077 seconds and 4 git commands to generate.