--- chkconfig-1.3.37.org/chkconfig.c 2007-11-08 22:28:34.000000000 +0100 +++ chkconfig-1.3.37/chkconfig.c 2008-04-24 09:30:17.709152778 +0200 @@ -68,8 +68,6 @@ readServiceError(rc, name); return 1; } - if (s.type == TYPE_XINETD) return 0; - if (!findServiceEntries(name, level, &globres)) { for (i = 0; i < globres.gl_pathc; i++) @@ -88,7 +86,6 @@ readServiceError(rc, name); return 1; } - if (s.type == TYPE_XINETD) return 0; for (level = 0; level < 7; level++) { if (!findServiceEntries(name, level, &globres)) { @@ -238,7 +235,6 @@ return 1; } - if (s.type == TYPE_XINETD) return 0; if (s.isLSB) frobDependencies(&s); else @@ -269,8 +265,6 @@ if ((rc = readServiceDifferences(name, &s, &o, 0))) { return 0; } - - if (s.type == TYPE_XINETD) return 0; if ((s.levels == o.levels) && (s.kPriority == o.kPriority) && @@ -351,10 +345,6 @@ } printf("%-15s", s.name); - if (s.type == TYPE_XINETD) { - printf("\t%s\n", s.levels ? _("on") : _("off")); - return 0; - } for (i = 0; i < 7; i++) { printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off")); @@ -364,32 +354,10 @@ return 0; } -static int isXinetdEnabled() { - int i; - struct service s; - - if (readServiceInfo("xinetd", &s, 0)) { - return 0; - } - for (i = 0; i < 7; i++) { - if (isOn("xinetd", i)) - return 1; - } - return 0; -} - static int serviceNameCmp(const void * a, const void * b) { return strcmp(* (char **)a, * (char **)b); } -static int xinetdNameCmp(const void * a, const void * b) { - const struct service * first = a; - const struct service * second = b; - - return strcmp(first->name, second->name); -} - - static int listService(char * item) { DIR * dir; @@ -459,53 +427,6 @@ closedir(dir); - if (isXinetdEnabled()) { - struct service *s, *t; - - printf("\n"); - printf(_("xinetd based services:\n")); - if (!(dir = opendir(XINETDDIR))) { - fprintf(stderr, _("failed to open directory %s: %s\n"), - XINETDDIR, strerror(err)); - return 1; - } - numServices = 0; - numServicesAlloced = 10; - s = malloc(sizeof (*s) * numServicesAlloced); - - while ((ent = readdir(dir))) { - const char *dn; - - /* Skip any file starting with a . */ - if (ent->d_name[0] == '.') continue; - - /* Skip files with known bad extensions */ - if ((dn = strrchr(ent->d_name, '.')) != NULL && - (!strcmp(dn, ".rpmsave") || !strcmp(dn, ".rpmnew") || !strcmp(dn, ".rpmorig") || !strcmp(dn, ".swp"))) - continue; - - dn = ent->d_name + strlen(ent->d_name) - 1; - if (*dn == '~' || *dn == ',') - continue; - - if (numServices == numServicesAlloced) { - numServicesAlloced += 10; - s = realloc(s, numServicesAlloced * sizeof (*s)); - } - if (readXinetdServiceInfo(ent->d_name, s + numServices, 0) != -1) - numServices ++; - } - - qsort(s, numServices, sizeof(*s), xinetdNameCmp); - t = s; - for (i = 0; i < numServices; i++, s++) { - char *tmp = malloc(strlen(s->name) + 5); - sprintf(tmp,"%s:",s->name); - printf("\t%-15s\t%s\n", tmp, s->levels ? _("on") : _("off")); - } - closedir(dir); - free(t); - } return 0; } @@ -547,11 +468,6 @@ rc |= doSetService(s, i, what); } return rc; - } else if (s.type == TYPE_XINETD) { - if (setXinetdService(s, state)) { - return 1; - } - system("/etc/init.d/xinetd reload >/dev/null 2>&1"); } return 0; @@ -682,13 +598,7 @@ rc = readServiceInfo(name, &s, 0); if (rc) return 1; - if (s.type == TYPE_XINETD) { - if (isOn("xinetd",level)) - return !s.levels; - else - return 1; - } else - return isOn(name, level) ? 0 : 1; + return isOn(name, level) ? 0 : 1; } else if (!strcmp(state, "on")) return setService(name, where, 1); else if (!strcmp(state, "off")) diff -urN chkconfig-1.3.37.org/leveldb.c chkconfig-1.3.37/leveldb.c --- chkconfig-1.3.37.org/leveldb.c 2007-08-03 19:57:56.000000000 +0200 +++ chkconfig-1.3.37/leveldb.c 2008-04-24 09:34:20.447423719 +0200 @@ -149,101 +149,6 @@ return 0; } -int readXinetdServiceInfo(char *name, struct service * service, int honorHide) { - char * filename = alloca(strlen(name) + strlen(XINETDDIR) + 50); - int fd; - struct service serv = { - name: NULL, - levels: -1, - kPriority: -1, - sPriority: -1, - desc: NULL, - startDeps: NULL, - stopDeps: NULL, - provides: NULL, - type: TYPE_XINETD, - isLSB: 0, - enabled: -1 - }; - struct stat sb; - char * buf, *ptr; - char * eng_desc = NULL, *start; - - snprintf(filename, strlen(name)+strlen(XINETDDIR)+50, XINETDDIR "/%s", name); - - if ((fd = open(filename, O_RDONLY)) < 0) return -1; - fstat(fd,&sb); - if (! S_ISREG(sb.st_mode)) return -1; - buf = malloc(sb.st_size+1); - if (read(fd,buf,sb.st_size)!=sb.st_size) { - close(fd); - free(buf); - return -1; - } - close(fd); - serv.name = strdup(name); - buf[sb.st_size] = '\0'; - start = buf; - while (buf) { - ptr = strchr(buf,'\n'); - if (*buf == '#') { - buf++; - while (isspace(*buf) && buf < ptr) buf++; - if (!strncmp(buf,"default:", 9)) { - buf+=8; - while(isspace(*buf)) buf++; - if (!strncmp(buf+9,"on",2)) { - serv.enabled = 1; - } else { - serv.enabled = 0; - } - } else if (!strncmp(buf,"description:",12)) { - buf+=11; - if (readDescription(buf,start+sb.st_size, - &serv.desc,&eng_desc)) { - if (serv.desc) free(serv.desc); - } - if (!serv.desc) { - if (eng_desc) - serv.desc = eng_desc; - } else if (eng_desc) - free (eng_desc); - } - if (ptr) { - *ptr = '\0'; - ptr++; - } - buf = ptr; - continue; - } - while (isspace(*buf) && buf < ptr) buf++; - if (!strncmp(buf,"disable", 7)) { - buf = strstr(buf,"="); - if (buf) - do { - buf++; - } while(isspace(*buf)); - - if (buf && strncmp(buf,"yes",3)) { - serv.levels = parseLevels("0123456",0); - if (serv.enabled == -1) - serv.enabled = 1; - } else { - serv.levels = 0; - if (serv.enabled == -1) - serv.enabled = 0; - } - } - if (ptr) { - *ptr = '\0'; - ptr++; - } - buf = ptr; - } - *service = serv; - return 0; -} - int readServiceInfo(char * name, struct service * service, int honorHide) { char * filename = alloca(strlen(name) + strlen(RUNLEVELS) + 50); int fd; @@ -253,7 +158,7 @@ sprintf(filename, RUNLEVELS "/init.d/%s", name); if ((fd = open(filename, O_RDONLY)) < 0) { - return readXinetdServiceInfo(name,service,honorHide); + return -1; } parseret = parseServiceInfo(fd, name, &serv, honorHide, 0); @@ -290,7 +195,7 @@ sprintf(filename, RUNLEVELS "/init.d/%s", name); if ((fd = open(filename, O_RDONLY)) < 0) { - return readXinetdServiceInfo(name,service,honorHide); + return -1; } parseret = parseServiceInfo(fd, name, &serv, honorHide, 0); @@ -656,60 +561,6 @@ return 1; } -int setXinetdService(struct service s, int on) { - int oldfd, newfd; - char oldfname[100], newfname[100]; - char tmpstr[50]; - char *buf, *ptr, *tmp; - struct stat sb; - - if (on == -1) { - on = s.enabled ? 1 : 0; - } - snprintf(oldfname,100,"%s/%s",XINETDDIR,s.name); - if ( (oldfd = open(oldfname,O_RDONLY)) == -1 ) { - return -1; - } - fstat(oldfd,&sb); - buf = malloc(sb.st_size+1); - if (read(oldfd,buf,sb.st_size)!=sb.st_size) { - close(oldfd); - free(buf); - return -1; - } - close(oldfd); - buf[sb.st_size] = '\0'; - snprintf(newfname,100,"%s/%s.XXXXXX",XINETDDIR,s.name); - newfd = mkstemp(newfname); - if (newfd == -1) { - free(buf); - return -1; - } - while (buf) { - tmp = buf; - ptr = strchr(buf,'\n'); - if (ptr) { - *ptr = '\0'; - ptr++; - } - while (isspace(*buf)) buf++; - if (strncmp(buf,"disable", 7) && strlen(buf)) { - write(newfd,tmp,strlen(tmp)); - write(newfd,"\n",1); - if (buf[0] == '{') { - snprintf(tmpstr,50,"\tdisable\t= %s", on ? "no" : "yes"); - write(newfd,tmpstr,strlen(tmpstr)); - write(newfd,"\n",1); - } - } - buf = ptr; - } - close(newfd); - chmod(newfname,0644); - unlink(oldfname); - return(rename(newfname,oldfname)); -} - int doSetService(struct service s, int level, int on) { int priority = on ? s.sPriority : s.kPriority; char linkname[200]; diff -urN chkconfig-1.3.37.org/ntsysv.c chkconfig-1.3.37/ntsysv.c --- chkconfig-1.3.37.org/ntsysv.c 2007-08-03 19:57:56.000000000 +0200 +++ chkconfig-1.3.37/ntsysv.c 2008-04-24 09:34:50.485526379 +0200 @@ -131,16 +131,10 @@ if (!update) return 1; for (i = 0; i < numServices; i++) { - if (services[i].type == TYPE_XINETD) { - if ((services[i].enabled && states[i] != '*') || - (!services[i].enabled && states[i] == '*')) - setXinetdService(services[i], states[i] == '*'); - } else { for (j = 0; j < 7; j++) { if (levels & (1 << j)) doSetService(services[i], j, states[i] == '*'); } - } } return 0; @@ -217,49 +211,6 @@ closedir(dir); - if (!stat("/usr/sbin/xinetd",&sb)) { - if (!(dir = opendir(XINETDDIR))) { - fprintf(stderr, "failed to open " XINETDDIR ": %s\n", - strerror(errno)); - return 2; - } - - while ((ent = readdir(dir))) { - if (strchr(ent->d_name, '~') || strchr(ent->d_name, ',') || - strchr(ent->d_name, '.')) continue; - - sprintf(fn, "%s/%s", XINETDDIR, ent->d_name); - if (stat(fn, &sb)) - { - err = errno; - continue; - } - if (!S_ISREG(sb.st_mode)) continue; - - if (numServices == numServicesAlloced) { - numServicesAlloced += 10; - services = realloc(services, - numServicesAlloced * sizeof(*services)); - } - - rc = readXinetdServiceInfo(ent->d_name, services + numServices, honorHide); - - if (rc == -1) { - fprintf(stderr, _("error reading info for service %s: %s\n"), - ent->d_name, strerror(errno)); - closedir(dir); - return 2; - } else if (!rc) - numServices++; - } - - if (err) { - fprintf(stderr, _("error reading from directory %s: %s\n"), - XINETDDIR, strerror(err)); - return 1; - } - } - qsort(services, numServices, sizeof(*services), serviceNameCmp); *servicesPtr = services; --- chkconfig-1.3.37/chkconfig.8~ 2007-11-08 23:28:34.000000000 +0200 +++ chkconfig-1.3.37/chkconfig.8 2008-04-24 10:48:07.171320486 +0300 @@ -63,11 +63,6 @@ an already-started service, and will not re-stop a service that is not running. -\fBchkconfig\fR also can manage xinetd scripts via the means -of xinetd.d configuration files. Note that only the -\fBon\fR, \fBoff\fR, and \fB-\-list\fR commands are supported -for xinetd.d services. - .SH OPTIONS .TP \fB-\-level \fIlevels\fR