]>
Commit | Line | Data |
---|---|---|
4ebee360 | 1 | diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c |
2 | --- chkconfig-1.2.24h.orig/chkconfig.c Wed Jul 17 20:10:55 2002 | |
3 | +++ chkconfig-1.2.24h/chkconfig.c Wed Jan 22 12:43:07 2003 | |
4 | @@ -70,7 +70,6 @@ | |
46170f11 JB |
5 | readServiceError(rc, name); |
6 | return 1; | |
7 | } | |
8 | - if (s.type == TYPE_XINETD) return 0; | |
9 | ||
4ebee360 | 10 | for (level = 0; level <= conf.maxlevel; level++) { |
46170f11 | 11 | if (!findServiceEntries(name, level, &globres)) { |
4ebee360 | 12 | @@ -90,8 +89,6 @@ |
13 | readServiceError(rc, name); | |
46170f11 JB |
14 | return 1; |
15 | } | |
4ebee360 | 16 | - |
46170f11 | 17 | - if (s.type == TYPE_XINETD) return 0; |
4ebee360 | 18 | |
19 | for (i = 0; i <= conf.maxlevel; i++) { | |
20 | if (!isConfigured(name, i)) { | |
21 | @@ -118,10 +115,6 @@ | |
46170f11 JB |
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 | ||
4ebee360 | 30 | for (i = 0; i <= conf.maxlevel; i++) { |
46170f11 | 31 | printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off")); |
4ebee360 | 32 | @@ -131,21 +124,6 @@ |
46170f11 JB |
33 | return 0; |
34 | } | |
35 | ||
36 | -static int isXinetdEnabled() { | |
4ebee360 | 37 | - int i; |
38 | - struct service s; | |
39 | - | |
40 | - if (readServiceInfo("xinetd", &s, 0)) { | |
41 | - return 0; | |
42 | - } | |
43 | - for (i = 0; i <= conf.maxlevel; i++) { | |
44 | - if (isOn("xinetd", i)) | |
45 | - return 1; | |
46 | - } | |
47 | - return 0; | |
46170f11 JB |
48 | -} |
49 | - | |
50 | - | |
51 | static int listService(char * item) { | |
52 | DIR * dir; | |
53 | struct dirent * ent; | |
4ebee360 | 54 | @@ -200,34 +178,6 @@ |
46170f11 JB |
55 | |
56 | closedir(dir); | |
4ebee360 | 57 | |
46170f11 JB |
58 | - if (isXinetdEnabled()) { |
59 | - printf(_("xinetd based services:\n")); | |
4ebee360 | 60 | - if (!(dir = opendir(conf.xinetddir))) { |
46170f11 | 61 | - fprintf(stderr, _("failed to open directory %s: %s"), |
4ebee360 | 62 | - conf.xinetddir, strerror(err)); |
46170f11 JB |
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 && | |
bda1ec50 | 74 | - (!strcmp(dn, ".rpmsave") || !strcmp(dn, ".rpmnew") || !strcmp(dn, ".rpmorig") || !strcmp(dn, ".swp"))) |
46170f11 JB |
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 | ||
4ebee360 | 89 | @@ -249,7 +199,6 @@ |
46170f11 JB |
90 | return 1; |
91 | } | |
92 | ||
93 | - if (s.type == TYPE_INIT_D) { | |
4ebee360 | 94 | for (i = 0; i <= conf.maxlevel; i++) { |
95 | if (!((1 << i) & where)) continue; | |
96 | ||
97 | @@ -261,14 +210,6 @@ | |
98 | what = 0; | |
99 | doSetService(s, i, what); | |
100 | } | |
46170f11 | 101 | - } else if (s.type == TYPE_XINETD) { |
4ebee360 | 102 | - char xinetd[250]; |
103 | - | |
46170f11 | 104 | - setXinetdService(s, state); |
4ebee360 | 105 | - snprintf(xinetd, sizeof(xinetd), |
106 | - "%s/xinetd reload >/dev/null 2>&1", conf.initdir); | |
107 | - system(xinetd); | |
108 | - } | |
46170f11 JB |
109 | |
110 | return 0; | |
4ebee360 | 111 | } |
112 | diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c | |
113 | --- chkconfig-1.2.24h.orig/leveldb.c Fri Apr 19 03:15:55 2002 | |
114 | +++ chkconfig-1.2.24h/leveldb.c Wed Jan 22 12:46:28 2003 | |
115 | @@ -140,88 +140,6 @@ | |
46170f11 JB |
116 | return 0; |
117 | } | |
118 | ||
119 | -int readXinetdServiceInfo(char *name, struct service * service, int honorHide) { | |
120 | - char * filename = alloca(strlen(name) + strlen(XINETDDIR) + 50); | |
121 | - int fd; | |
122 | - struct service serv = { NULL, -1, -1, -1, NULL, 1, -1 }; | |
123 | - struct stat sb; | |
124 | - char * buf, *ptr; | |
125 | - char * eng_desc = NULL, *start; | |
126 | - | |
127 | - snprintf(filename, strlen(name)+strlen(XINETDDIR)+50, XINETDDIR "/%s", name); | |
128 | - | |
129 | - if ((fd = open(filename, O_RDONLY)) < 0) return -1; | |
130 | - fstat(fd,&sb); | |
131 | - buf = malloc(sb.st_size+1); | |
132 | - if (read(fd,buf,sb.st_size)!=sb.st_size) { | |
133 | - close(fd); | |
134 | - free(buf); | |
135 | - return -1; | |
136 | - } | |
137 | - close(fd); | |
138 | - serv.name = strdup(name); | |
139 | - buf[sb.st_size] = '\0'; | |
140 | - start = buf; | |
141 | - while (buf) { | |
142 | - ptr = strchr(buf,'\n'); | |
143 | - if (*buf == '#') { | |
144 | - buf++; | |
145 | - while (isspace(*buf) && buf < ptr) buf++; | |
146 | - if (!strncmp(buf,"default:", 9)) { | |
147 | - buf+=8; | |
148 | - while(isspace(*buf)) buf++; | |
149 | - if (!strncmp(buf+9,"on",2)) { | |
150 | - serv.enabled = 1; | |
151 | - } else { | |
152 | - serv.enabled = 0; | |
153 | - } | |
154 | - } else if (!strncmp(buf,"description:",12)) { | |
155 | - buf+=11; | |
156 | - if (readDescription(buf,start+sb.st_size, | |
157 | - &serv.desc,&eng_desc)) { | |
158 | - if (serv.desc) free(serv.desc); | |
159 | - } | |
160 | - if (!serv.desc) { | |
161 | - if (eng_desc) | |
162 | - serv.desc = eng_desc; | |
163 | - } else if (eng_desc) | |
164 | - free (eng_desc); | |
165 | - } | |
166 | - if (ptr) { | |
167 | - *ptr = '\0'; | |
168 | - ptr++; | |
169 | - } | |
170 | - buf = ptr; | |
171 | - continue; | |
172 | - } | |
173 | - while (isspace(*buf) && buf < ptr) buf++; | |
174 | - if (!strncmp(buf,"disable", 7)) { | |
175 | - buf = strstr(buf,"="); | |
176 | - if (buf) | |
177 | - do { | |
178 | - buf++; | |
179 | - } while(isspace(*buf)); | |
180 | - | |
181 | - if (buf && strncmp(buf,"yes",3)) { | |
182 | - serv.levels = parseLevels("0123456",0); | |
183 | - if (serv.enabled == -1) | |
184 | - serv.enabled = 1; | |
185 | - } else { | |
186 | - serv.levels = 0; | |
187 | - if (serv.enabled == -1) | |
188 | - serv.enabled = 0; | |
189 | - } | |
190 | - } | |
191 | - if (ptr) { | |
192 | - *ptr = '\0'; | |
193 | - ptr++; | |
194 | - } | |
195 | - buf = ptr; | |
196 | - } | |
197 | - *service = serv; | |
198 | - return 0; | |
199 | -} | |
200 | - | |
201 | int readServiceInfo(char * name, struct service * service, int honorHide) { | |
4ebee360 | 202 | char * filename = alloca(strlen(name) + strlen(conf.initdir) + 50); |
46170f11 | 203 | int fd; |
4ebee360 | 204 | @@ -235,7 +153,7 @@ |
205 | sprintf(filename, "%s/%s", conf.initdir, name); | |
46170f11 JB |
206 | |
207 | if ((fd = open(filename, O_RDONLY)) < 0) { | |
208 | - return readXinetdServiceInfo(name,service,honorHide); | |
209 | + return -1; | |
210 | } | |
211 | fstat(fd, &sb); | |
212 | ||
4ebee360 | 213 | @@ -427,60 +345,6 @@ |
46170f11 | 214 | return 1; |
4ebee360 | 215 | } |
216 | ||
46170f11 JB |
217 | -int setXinetdService(struct service s, int on) { |
218 | - int oldfd, newfd; | |
219 | - char oldfname[100], newfname[100]; | |
220 | - char tmpstr[50]; | |
221 | - char *buf, *ptr, *tmp; | |
222 | - struct stat sb; | |
223 | - | |
224 | - if (on == -1) { | |
225 | - on = s.enabled ? 1 : 0; | |
226 | - } | |
227 | - snprintf(oldfname,100,"%s/%s",XINETDDIR,s.name); | |
228 | - if ( (oldfd = open(oldfname,O_RDONLY)) == -1 ) { | |
229 | - return -1; | |
230 | - } | |
231 | - fstat(oldfd,&sb); | |
232 | - buf = malloc(sb.st_size+1); | |
233 | - if (read(oldfd,buf,sb.st_size)!=sb.st_size) { | |
234 | - close(oldfd); | |
235 | - free(buf); | |
236 | - return -1; | |
237 | - } | |
238 | - close(oldfd); | |
239 | - buf[sb.st_size] = '\0'; | |
240 | - snprintf(newfname,100,"%s/%s.XXXXXX",XINETDDIR,s.name); | |
241 | - newfd = mkstemp(newfname); | |
242 | - if (newfd == -1) { | |
243 | - free(buf); | |
244 | - return -1; | |
245 | - } | |
246 | - while (buf) { | |
247 | - tmp = buf; | |
248 | - ptr = strchr(buf,'\n'); | |
249 | - if (ptr) { | |
250 | - *ptr = '\0'; | |
251 | - ptr++; | |
252 | - } | |
253 | - while (isspace(*buf)) buf++; | |
bda1ec50 | 254 | - if (strncmp(buf,"disable", 7) && strlen(buf)) { |
46170f11 JB |
255 | - write(newfd,tmp,strlen(tmp)); |
256 | - write(newfd,"\n",1); | |
257 | - if (buf[0] == '{') { | |
258 | - snprintf(tmpstr,50,"\tdisable\t= %s", on ? "no" : "yes"); | |
259 | - write(newfd,tmpstr,strlen(tmpstr)); | |
260 | - write(newfd,"\n",1); | |
261 | - } | |
262 | - } | |
263 | - buf = ptr; | |
264 | - } | |
265 | - close(newfd); | |
266 | - chmod(newfname,0644); | |
267 | - unlink(oldfname); | |
268 | - return(rename(newfname,oldfname)); | |
4ebee360 | 269 | -} |
270 | - | |
46170f11 | 271 | int doSetService(struct service s, int level, int on) { |
4ebee360 | 272 | int priority = on ? s.sPriority : s.kPriority; |
273 | char linkname[200]; | |
274 | diff -Nru chkconfig-1.2.24h.orig/ntsysv.c chkconfig-1.2.24h/ntsysv.c | |
275 | --- chkconfig-1.2.24h.orig/ntsysv.c Sun Jul 28 10:50:04 2002 | |
276 | +++ chkconfig-1.2.24h/ntsysv.c Wed Jan 22 12:50:38 2003 | |
277 | @@ -64,11 +64,6 @@ | |
46170f11 JB |
278 | states = alloca(sizeof(*states) * numServices); |
279 | ||
280 | for (i = 0; i < numServices; i++) { | |
281 | - if (services[i].type == TYPE_XINETD) { | |
282 | - checkboxes[i] = newtCheckbox(-1, i, services[i].name, | |
283 | - services[i].levels ? '*' : ' ', NULL, | |
284 | - states + i); | |
285 | - } else { | |
4ebee360 | 286 | for (j = 0; j <= conf.maxlevel; j++) { |
287 | if (levels & (1 << j)) { | |
288 | if (isOn(services[i].name, j)) break; | |
289 | @@ -78,7 +73,6 @@ | |
290 | (j != (conf.maxlevel+1)) ? | |
291 | '*' : ' ', NULL, | |
292 | states + i); | |
293 | - } | |
46170f11 JB |
294 | newtFormAddComponent(subform, checkboxes[i]); |
295 | } | |
296 | ||
4ebee360 | 297 | @@ -135,13 +129,9 @@ |
46170f11 JB |
298 | if (!update) return 1; |
299 | ||
300 | for (i = 0; i < numServices; i++) { | |
301 | - if (services[i].type == TYPE_XINETD) | |
302 | - setXinetdService(services[i], states[i] == '*'); | |
303 | - else { | |
4ebee360 | 304 | for (j = 0; j <= conf.maxlevel; j++) { |
305 | if (levels & (1 << j)) | |
306 | doSetService(services[i], j, states[i] == '*'); | |
46170f11 | 307 | - } |
46170f11 JB |
308 | } |
309 | } | |
310 | ||
4ebee360 | 311 | @@ -212,49 +202,6 @@ |
46170f11 JB |
312 | |
313 | closedir(dir); | |
4ebee360 | 314 | |
bda1ec50 | 315 | - if (!stat("/usr/sbin/xinetd",&sb)) { |
4ebee360 | 316 | - if (!(dir = opendir(conf.xinetddir))) { |
317 | - fprintf(stderr, "failed to open %s: %s\n", conf.xinetddir, | |
318 | - strerror(errno)); | |
319 | - return 2; | |
320 | - } | |
46170f11 | 321 | - |
4ebee360 | 322 | - while ((ent = readdir(dir))) { |
323 | - if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') || | |
324 | - strchr(ent->d_name, '.')) continue; | |
46170f11 | 325 | - |
4ebee360 | 326 | - sprintf(fn, "%s/%s", conf.xinetddir, ent->d_name); |
327 | - if (stat(fn, &sb)) | |
328 | - { | |
329 | - err = errno; | |
330 | - continue; | |
331 | - } | |
332 | - if (!S_ISREG(sb.st_mode)) continue; | |
46170f11 | 333 | - |
4ebee360 | 334 | - if (numServices == numServicesAlloced) { |
335 | - numServicesAlloced += 10; | |
336 | - services = realloc(services, | |
337 | - numServicesAlloced * sizeof(*services)); | |
338 | - } | |
46170f11 | 339 | - |
4ebee360 | 340 | - rc = readXinetdServiceInfo(ent->d_name, services + numServices, honorHide); |
341 | - | |
342 | - if (rc == -1) { | |
343 | - fprintf(stderr, _("error reading info for service %s: %s\n"), | |
344 | - ent->d_name, strerror(errno)); | |
345 | - closedir(dir); | |
346 | - return 2; | |
347 | - } else if (!rc) | |
348 | - numServices++; | |
349 | - } | |
46170f11 | 350 | - |
4ebee360 | 351 | - if (err) { |
352 | - fprintf(stderr, _("error reading from directory %s: %s\n"), | |
353 | - conf.xinetddir, strerror(err)); | |
354 | - return 1; | |
355 | - } | |
bda1ec50 | 356 | - } |
357 | - | |
46170f11 JB |
358 | qsort(services, numServices, sizeof(*services), serviceNameCmp); |
359 | ||
bda1ec50 | 360 | *servicesPtr = services; |