diff -Nru chkconfig-1.2.24h.orig/chkconfig.c chkconfig-1.2.24h/chkconfig.c --- chkconfig-1.2.24h.orig/chkconfig.c Wed Jul 17 20:10:55 2002 +++ chkconfig-1.2.24h/chkconfig.c Wed Jan 22 12:43:07 2003 @@ -70,7 +70,6 @@ readServiceError(rc, name); return 1; } - if (s.type == TYPE_XINETD) return 0; for (level = 0; level <= conf.maxlevel; level++) { if (!findServiceEntries(name, level, &globres)) { @@ -90,8 +89,6 @@ readServiceError(rc, name); return 1; } - - if (s.type == TYPE_XINETD) return 0; for (i = 0; i <= conf.maxlevel; i++) { if (!isConfigured(name, i)) { @@ -118,10 +115,6 @@ } printf("%-15s", s.name); - if (s.type == TYPE_XINETD) { - printf("\t%s\n", s.levels ? _("on") : _("off")); - return 0; - } for (i = 0; i <= conf.maxlevel; i++) { printf("\t%d:%s", i, isOn(s.name, i) ? _("on") : _("off")); @@ -131,21 +124,6 @@ return 0; } -static int isXinetdEnabled() { - int i; - struct service s; - - if (readServiceInfo("xinetd", &s, 0)) { - return 0; - } - for (i = 0; i <= conf.maxlevel; i++) { - if (isOn("xinetd", i)) - return 1; - } - return 0; -} - - static int listService(char * item) { DIR * dir; struct dirent * ent; @@ -200,34 +178,6 @@ closedir(dir); - if (isXinetdEnabled()) { - printf(_("xinetd based services:\n")); - if (!(dir = opendir(conf.xinetddir))) { - fprintf(stderr, _("failed to open directory %s: %s"), - conf.xinetddir, strerror(err)); - return 1; - } - while ((ent = readdir(dir))) { - const char *dn; - struct service s; - - /* 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; - - readXinetdServiceInfo(ent->d_name, &s, 0); - printf("\t%s:\t%s\n", s.name, s.levels ? _("on") : _("off")); - } - closedir(dir); - } return 0; } @@ -249,7 +199,6 @@ return 1; } - if (s.type == TYPE_INIT_D) { for (i = 0; i <= conf.maxlevel; i++) { if (!((1 << i) & where)) continue; @@ -261,14 +210,6 @@ what = 0; doSetService(s, i, what); } - } else if (s.type == TYPE_XINETD) { - char xinetd[250]; - - setXinetdService(s, state); - snprintf(xinetd, sizeof(xinetd), - "%s/xinetd reload >/dev/null 2>&1", conf.initdir); - system(xinetd); - } return 0; } diff -Nru chkconfig-1.2.24h.orig/leveldb.c chkconfig-1.2.24h/leveldb.c --- chkconfig-1.2.24h.orig/leveldb.c Fri Apr 19 03:15:55 2002 +++ chkconfig-1.2.24h/leveldb.c Wed Jan 22 12:46:28 2003 @@ -140,88 +140,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 = { NULL, -1, -1, -1, NULL, 1, -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); - 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(conf.initdir) + 50); int fd; @@ -235,7 +153,7 @@ sprintf(filename, "%s/%s", conf.initdir, name); if ((fd = open(filename, O_RDONLY)) < 0) { - return readXinetdServiceInfo(name,service,honorHide); + return -1; } fstat(fd, &sb); @@ -427,60 +345,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 -Nru chkconfig-1.2.24h.orig/ntsysv.c chkconfig-1.2.24h/ntsysv.c --- chkconfig-1.2.24h.orig/ntsysv.c Sun Jul 28 10:50:04 2002 +++ chkconfig-1.2.24h/ntsysv.c Wed Jan 22 12:50:38 2003 @@ -64,11 +64,6 @@ states = alloca(sizeof(*states) * numServices); for (i = 0; i < numServices; i++) { - if (services[i].type == TYPE_XINETD) { - checkboxes[i] = newtCheckbox(-1, i, services[i].name, - services[i].levels ? '*' : ' ', NULL, - states + i); - } else { for (j = 0; j <= conf.maxlevel; j++) { if (levels & (1 << j)) { if (isOn(services[i].name, j)) break; @@ -78,7 +73,6 @@ (j != (conf.maxlevel+1)) ? '*' : ' ', NULL, states + i); - } newtFormAddComponent(subform, checkboxes[i]); } @@ -135,13 +129,9 @@ if (!update) return 1; for (i = 0; i < numServices; i++) { - if (services[i].type == TYPE_XINETD) - setXinetdService(services[i], states[i] == '*'); - else { for (j = 0; j <= conf.maxlevel; j++) { if (levels & (1 << j)) doSetService(services[i], j, states[i] == '*'); - } } } @@ -212,49 +202,6 @@ closedir(dir); - if (!stat("/usr/sbin/xinetd",&sb)) { - if (!(dir = opendir(conf.xinetddir))) { - fprintf(stderr, "failed to open %s: %s\n", conf.xinetddir, - 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", conf.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"), - conf.xinetddir, strerror(err)); - return 1; - } - } - qsort(services, numServices, sizeof(*services), serviceNameCmp); *servicesPtr = services;